More paranoid _r protochecking. At least Tru64 and
[p5sagit/p5-mst-13.2.git] / Configure
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 and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat Mar 16 20:51:19 EET 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 bincompat5005=''
305 d_bincompat5005=''
306 byteorder=''
307 cc=''
308 ccflags=''
309 cppflags=''
310 ldflags=''
311 lkflags=''
312 locincpth=''
313 optimize=''
314 cf_email=''
315 cf_by=''
316 cf_time=''
317 charsize=''
318 contains=''
319 cpp_stuff=''
320 cpplast=''
321 cppminus=''
322 cpprun=''
323 cppstdin=''
324 d__fwalk=''
325 d_access=''
326 d_accessx=''
327 d_alarm=''
328 asctime_r_proto=''
329 d_asctime_r=''
330 d_attribut=''
331 d_bcmp=''
332 d_bcopy=''
333 d_bzero=''
334 d_casti32=''
335 castflags=''
336 d_castneg=''
337 d_chown=''
338 d_chroot=''
339 d_chsize=''
340 d_class=''
341 d_closedir=''
342 d_void_closedir=''
343 d_cmsghdr_s=''
344 d_const=''
345 cryptlib=''
346 d_crypt=''
347 crypt_r_proto=''
348 d_crypt_r=''
349 d_csh=''
350 full_csh=''
351 ctermid_r_proto=''
352 d_ctermid_r=''
353 ctime_r_proto=''
354 d_ctime_r=''
355 d_cuserid=''
356 d_dbl_dig=''
357 d_dbminitproto=''
358 d_difftime=''
359 d_dirfd=''
360 d_dlerror=''
361 d_dlopen=''
362 d_dlsymun=''
363 d_dosuid=''
364 d_suidsafe=''
365 d_drand48_r=''
366 drand48_r_proto=''
367 d_drand48proto=''
368 d_dup2=''
369 d_eaccess=''
370 d_endgrent=''
371 d_endgrent_r=''
372 endgrent_r_proto=''
373 d_endhent=''
374 d_endhostent_r=''
375 endhostent_r_proto=''
376 d_endnent=''
377 d_endnetent_r=''
378 endnetent_r_proto=''
379 d_endpent=''
380 d_endprotoent_r=''
381 endprotoent_r_proto=''
382 d_endpwent=''
383 d_endpwent_r=''
384 endpwent_r_proto=''
385 d_endsent=''
386 d_endservent_r=''
387 endservent_r_proto=''
388 d_fchdir=''
389 d_fchmod=''
390 d_fchown=''
391 d_fcntl=''
392 d_fcntl_can_lock=''
393 d_fd_macros=''
394 d_fd_set=''
395 d_fds_bits=''
396 d_fgetpos=''
397 d_finite=''
398 d_finitel=''
399 d_flexfnam=''
400 d_flock=''
401 d_flockproto=''
402 d_fork=''
403 d_fp_class=''
404 d_fpclass=''
405 d_fpclassify=''
406 d_fpclassl=''
407 d_fpos64_t=''
408 d_frexpl=''
409 d_fs_data_s=''
410 d_fseeko=''
411 d_fsetpos=''
412 d_fstatfs=''
413 d_fsync=''
414 d_ftello=''
415 d_ftime=''
416 d_gettimeod=''
417 d_Gconvert=''
418 d_getcwd=''
419 d_getespwnam=''
420 d_getfsstat=''
421 d_getgrent=''
422 d_getgrent_r=''
423 getgrent_r_proto=''
424 d_getgrgid_r=''
425 getgrgid_r_proto=''
426 d_getgrnam_r=''
427 getgrnam_r_proto=''
428 d_getgrps=''
429 d_gethbyaddr=''
430 d_gethbyname=''
431 d_gethent=''
432 aphostname=''
433 d_gethname=''
434 d_phostname=''
435 d_uname=''
436 d_gethostbyaddr_r=''
437 gethostbyaddr_r_proto=''
438 d_gethostbyname_r=''
439 gethostbyname_r_proto=''
440 d_gethostent_r=''
441 gethostent_r_proto=''
442 d_gethostprotos=''
443 d_getitimer=''
444 d_getlogin=''
445 d_getlogin_r=''
446 getlogin_r_proto=''
447 d_getmnt=''
448 d_getmntent=''
449 d_getnbyaddr=''
450 d_getnbyname=''
451 d_getnent=''
452 d_getnetbyaddr_r=''
453 getnetbyaddr_r_proto=''
454 d_getnetbyname_r=''
455 getnetbyname_r_proto=''
456 d_getnetent_r=''
457 getnetent_r_proto=''
458 d_getnetprotos=''
459 d_getpagsz=''
460 d_getpent=''
461 d_getpgid=''
462 d_getpgrp2=''
463 d_bsdgetpgrp=''
464 d_getpgrp=''
465 d_getppid=''
466 d_getprior=''
467 d_getpbyname=''
468 d_getpbynumber=''
469 d_getprotobyname_r=''
470 getprotobyname_r_proto=''
471 d_getprotobynumber_r=''
472 getprotobynumber_r_proto=''
473 d_getprotoent_r=''
474 getprotoent_r_proto=''
475 d_getprotoprotos=''
476 d_getprpwnam=''
477 d_getpwent=''
478 d_getpwent_r=''
479 getpwent_r_proto=''
480 d_getpwnam_r=''
481 getpwnam_r_proto=''
482 d_getpwuid_r=''
483 getpwuid_r_proto=''
484 d_getsent=''
485 d_getservbyname_r=''
486 getservbyname_r_proto=''
487 d_getservbyport_r=''
488 getservbyport_r_proto=''
489 d_getservent_r=''
490 getservent_r_proto=''
491 d_getservprotos=''
492 d_getspnam=''
493 d_getspnam_r=''
494 getspnam_r_proto=''
495 d_getsbyname=''
496 d_getsbyport=''
497 d_gmtime_r=''
498 gmtime_r_proto=''
499 d_gnulibc=''
500 d_hasmntopt=''
501 d_htonl=''
502 d_inetaton=''
503 d_int64_t=''
504 d_isascii=''
505 d_isfinite=''
506 d_isinf=''
507 d_isnan=''
508 d_isnanl=''
509 d_killpg=''
510 d_lchown=''
511 d_ldbl_dig=''
512 d_link=''
513 d_localtime_r=''
514 localtime_r_proto=''
515 d_locconv=''
516 d_lockf=''
517 d_longdbl=''
518 longdblsize=''
519 d_longlong=''
520 longlongsize=''
521 d_lseekproto=''
522 d_lstat=''
523 d_madvise=''
524 d_mblen=''
525 d_mbstowcs=''
526 d_mbtowc=''
527 d_memchr=''
528 d_memcmp=''
529 d_memcpy=''
530 d_memmove=''
531 d_memset=''
532 d_mkdir=''
533 d_mkdtemp=''
534 d_mkfifo=''
535 d_mkstemp=''
536 d_mkstemps=''
537 d_mktime=''
538 d_mmap=''
539 mmaptype=''
540 d_modfl=''
541 d_modfl_pow32_bug=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nice=''
552 d_nl_langinfo=''
553 d_off64_t=''
554 d_open3=''
555 d_fpathconf=''
556 d_pathconf=''
557 d_pause=''
558 d_pipe=''
559 d_poll=''
560 d_portable=''
561 d_procselfexe=''
562 procselfexe=''
563 d_old_pthread_create_joinable=''
564 old_pthread_create_joinable=''
565 d_pthread_atfork=''
566 d_pthread_yield=''
567 d_sched_yield=''
568 sched_yield=''
569 d_qgcvt=''
570 d_random_r=''
571 random_r_proto=''
572 d_readdir64_r=''
573 readdir64_r_proto=''
574 d_readdir=''
575 d_rewinddir=''
576 d_seekdir=''
577 d_telldir=''
578 d_readdir_r=''
579 readdir_r_proto=''
580 d_readlink=''
581 d_readv=''
582 d_recvmsg=''
583 d_rename=''
584 d_rmdir=''
585 d_safebcpy=''
586 d_safemcpy=''
587 d_sanemcmp=''
588 d_sbrkproto=''
589 d_select=''
590 d_sem=''
591 d_semctl=''
592 d_semget=''
593 d_semop=''
594 d_sendmsg=''
595 d_setegid=''
596 d_seteuid=''
597 d_setgrent=''
598 d_setgrent_r=''
599 setgrent_r_proto=''
600 d_setgrps=''
601 d_sethent=''
602 d_sethostent_r=''
603 sethostent_r_proto=''
604 d_setitimer=''
605 d_setlinebuf=''
606 d_setlocale=''
607 d_setlocale_r=''
608 setlocale_r_proto=''
609 d_setnent=''
610 d_setnetent_r=''
611 setnetent_r_proto=''
612 d_setpent=''
613 d_setpgid=''
614 d_setpgrp2=''
615 d_bsdsetpgrp=''
616 d_setpgrp=''
617 d_setprior=''
618 d_setproctitle=''
619 d_setprotoent_r=''
620 setprotoent_r_proto=''
621 d_setpwent=''
622 d_setpwent_r=''
623 setpwent_r_proto=''
624 d_setregid=''
625 d_setresgid=''
626 d_setresuid=''
627 d_setreuid=''
628 d_setrgid=''
629 d_setruid=''
630 d_setsent=''
631 d_setservent_r=''
632 setservent_r_proto=''
633 d_setsid=''
634 d_setvbuf=''
635 d_sfio=''
636 usesfio=''
637 d_shm=''
638 d_shmat=''
639 d_shmatprototype=''
640 shmattype=''
641 d_shmctl=''
642 d_shmdt=''
643 d_shmget=''
644 d_sigaction=''
645 d_sigprocmask=''
646 d_sigsetjmp=''
647 d_sockatmark=''
648 d_sockatmarkproto=''
649 d_msg_ctrunc=''
650 d_msg_dontroute=''
651 d_msg_oob=''
652 d_msg_peek=''
653 d_msg_proxy=''
654 d_oldsock=''
655 d_scm_rights=''
656 d_socket=''
657 d_sockpair=''
658 sockethdr=''
659 socketlib=''
660 d_socklen_t=''
661 d_socks5_init=''
662 d_sqrtl=''
663 d_srand48_r=''
664 srand48_r_proto=''
665 d_srandom_r=''
666 srandom_r_proto=''
667 d_sresgproto=''
668 d_sresuproto=''
669 d_statblks=''
670 d_statfs_f_flags=''
671 d_statfs_s=''
672 d_fstatvfs=''
673 d_statvfs=''
674 d_stdio_cnt_lval=''
675 d_stdio_ptr_lval=''
676 d_stdio_ptr_lval_nochange_cnt=''
677 d_stdio_ptr_lval_sets_cnt=''
678 d_stdiobase=''
679 d_stdstdio=''
680 stdio_base=''
681 stdio_bufsiz=''
682 stdio_cnt=''
683 stdio_filbuf=''
684 stdio_ptr=''
685 d_index=''
686 d_strchr=''
687 d_strcoll=''
688 d_strctcpy=''
689 d_strerrm=''
690 d_strerror=''
691 d_sysernlst=''
692 d_syserrlst=''
693 d_strerror_r=''
694 strerror_r_proto=''
695 d_strftime=''
696 d_strtod=''
697 d_strtol=''
698 d_strtold=''
699 d_strtoll=''
700 d_strtoq=''
701 d_strtoul=''
702 d_strtoull=''
703 d_strtouq=''
704 d_strxfrm=''
705 d_symlink=''
706 d_syscall=''
707 d_syscallproto=''
708 d_sysconf=''
709 d_system=''
710 d_tcgetpgrp=''
711 d_tcsetpgrp=''
712 d_telldirproto=''
713 d_time=''
714 timetype=''
715 clocktype=''
716 d_times=''
717 d_tmpnam_r=''
718 tmpnam_r_proto=''
719 d_truncate=''
720 d_ttyname_r=''
721 ttyname_r_proto=''
722 d_tzname=''
723 d_u32align=''
724 d_ualarm=''
725 d_umask=''
726 d_semctl_semid_ds=''
727 d_semctl_semun=''
728 d_union_semun=''
729 d_unordered=''
730 d_usleep=''
731 d_usleepproto=''
732 d_ustat=''
733 d_vfork=''
734 usevfork=''
735 d_voidsig=''
736 signal_t=''
737 d_volatile=''
738 d_charvspr=''
739 d_vprintf=''
740 d_wait4=''
741 d_waitpid=''
742 d_wcstombs=''
743 d_wctomb=''
744 d_writev=''
745 dlext=''
746 cccdlflags=''
747 ccdlflags=''
748 dlsrc=''
749 ld=''
750 lddlflags=''
751 usedl=''
752 doublesize=''
753 ebcdic=''
754 fflushNULL=''
755 fflushall=''
756 fpossize=''
757 fpostype=''
758 gccosandvers=''
759 gccversion=''
760 gidformat=''
761 gidsign=''
762 gidsize=''
763 gidtype=''
764 groupstype=''
765 h_fcntl=''
766 h_sysfile=''
767 i_arpainet=''
768 i_crypt=''
769 db_hashtype=''
770 db_prefixtype=''
771 db_version_major=''
772 db_version_minor=''
773 db_version_patch=''
774 i_db=''
775 i_dbm=''
776 i_rpcsvcdbm=''
777 d_dirnamlen=''
778 direntrytype=''
779 i_dirent=''
780 i_dld=''
781 i_dlfcn=''
782 i_fcntl=''
783 i_float=''
784 i_fp=''
785 i_fp_class=''
786 i_gdbm=''
787 d_grpasswd=''
788 i_grp=''
789 i_ieeefp=''
790 i_inttypes=''
791 i_langinfo=''
792 i_libutil=''
793 i_limits=''
794 i_locale=''
795 i_machcthr=''
796 i_malloc=''
797 i_math=''
798 i_memory=''
799 i_mntent=''
800 i_ndbm=''
801 i_netdb=''
802 i_neterrno=''
803 i_netinettcp=''
804 i_niin=''
805 i_sysin=''
806 i_poll=''
807 i_prot=''
808 i_pthread=''
809 d_pwage=''
810 d_pwchange=''
811 d_pwclass=''
812 d_pwcomment=''
813 d_pwexpire=''
814 d_pwgecos=''
815 d_pwpasswd=''
816 d_pwquota=''
817 i_pwd=''
818 i_sfio=''
819 i_shadow=''
820 i_socks=''
821 i_stddef=''
822 i_stdlib=''
823 i_string=''
824 strings=''
825 i_sunmath=''
826 i_sysaccess=''
827 i_sysdir=''
828 i_sysfile=''
829 d_voidtty=''
830 i_bsdioctl=''
831 i_sysfilio=''
832 i_sysioctl=''
833 i_syssockio=''
834 i_syslog=''
835 i_sysmman=''
836 i_sysmode=''
837 i_sysmount=''
838 i_sysndir=''
839 i_sysparam=''
840 i_sysresrc=''
841 i_syssecrt=''
842 i_sysselct=''
843 i_sysstat=''
844 i_sysstatfs=''
845 i_sysstatvfs=''
846 i_systimes=''
847 i_systypes=''
848 i_sysuio=''
849 i_sysun=''
850 i_sysutsname=''
851 i_sysvfs=''
852 i_syswait=''
853 i_sgtty=''
854 i_termio=''
855 i_termios=''
856 d_tm_tm_gmtoff=''
857 d_tm_tm_zone=''
858 i_systime=''
859 i_systimek=''
860 i_time=''
861 timeincl=''
862 i_unistd=''
863 i_ustat=''
864 i_utime=''
865 i_values=''
866 i_stdarg=''
867 i_varargs=''
868 i_varhdr=''
869 i_vfork=''
870 inc_version_list=''
871 inc_version_list_init=''
872 installprefix=''
873 installprefixexp=''
874 installstyle=''
875 installusrbinperl=''
876 intsize=''
877 longsize=''
878 shortsize=''
879 issymlink=''
880 libc=''
881 ldlibpthname=''
882 libperl=''
883 shrpenv=''
884 useshrplib=''
885 glibpth=''
886 libpth=''
887 loclibpth=''
888 plibpth=''
889 xlibpth=''
890 ignore_versioned_solibs=''
891 libs=''
892 libsdirs=''
893 libsfiles=''
894 libsfound=''
895 libspath=''
896 lns=''
897 d_PRIEUldbl=''
898 d_PRIFUldbl=''
899 d_PRIGUldbl=''
900 d_PRIeldbl=''
901 d_PRIfldbl=''
902 d_PRIgldbl=''
903 d_SCNfldbl=''
904 sPRIEUldbl=''
905 sPRIFUldbl=''
906 sPRIGUldbl=''
907 sPRIeldbl=''
908 sPRIfldbl=''
909 sPRIgldbl=''
910 sSCNfldbl=''
911 lseeksize=''
912 lseektype=''
913 make_set_make=''
914 d_mymalloc=''
915 freetype=''
916 mallocobj=''
917 mallocsrc=''
918 malloctype=''
919 usemymalloc=''
920 installman1dir=''
921 man1dir=''
922 man1direxp=''
923 man1ext=''
924 installman3dir=''
925 man3dir=''
926 man3direxp=''
927 man3ext=''
928 modetype=''
929 multiarch=''
930 mydomain=''
931 myhostname=''
932 phostname=''
933 c=''
934 n=''
935 d_eofnblk=''
936 eagain=''
937 o_nonblock=''
938 rd_nodata=''
939 need_va_copy=''
940 netdb_hlen_type=''
941 netdb_host_type=''
942 netdb_name_type=''
943 netdb_net_type=''
944 groupcat=''
945 hostcat=''
946 passcat=''
947 orderlib=''
948 ranlib=''
949 d_perl_otherlibdirs=''
950 otherlibdirs=''
951 package=''
952 spackage=''
953 pager=''
954 api_revision=''
955 api_subversion=''
956 api_version=''
957 api_versionstring=''
958 patchlevel=''
959 perl_patchlevel=''
960 revision=''
961 subversion=''
962 version=''
963 version_patchlevel_string=''
964 perl5=''
965 perladmin=''
966 perlpath=''
967 d_nv_preserves_uv=''
968 d_nv_preserves_uv_bits=''
969 i16size=''
970 i16type=''
971 i32size=''
972 i32type=''
973 i64size=''
974 i64type=''
975 i8size=''
976 i8type=''
977 ivsize=''
978 ivtype=''
979 nvsize=''
980 nvtype=''
981 u16size=''
982 u16type=''
983 u32size=''
984 u32type=''
985 u64size=''
986 u64type=''
987 u8size=''
988 u8type=''
989 uvsize=''
990 uvtype=''
991 ivdformat=''
992 nvEUformat=''
993 nvFUformat=''
994 nvGUformat=''
995 nveformat=''
996 nvfformat=''
997 nvgformat=''
998 uvXUformat=''
999 uvoformat=''
1000 uvuformat=''
1001 uvxformat=''
1002 pidtype=''
1003 prefix=''
1004 prefixexp=''
1005 installprivlib=''
1006 privlib=''
1007 privlibexp=''
1008 prototype=''
1009 ptrsize=''
1010 d_PRIXU64=''
1011 d_PRId64=''
1012 d_PRIi64=''
1013 d_PRIo64=''
1014 d_PRIu64=''
1015 d_PRIx64=''
1016 sPRIXU64=''
1017 sPRId64=''
1018 sPRIi64=''
1019 sPRIo64=''
1020 sPRIu64=''
1021 sPRIx64=''
1022 d_quad=''
1023 quadkind=''
1024 quadtype=''
1025 uquadtype=''
1026 drand01=''
1027 randbits=''
1028 randfunc=''
1029 randseedtype=''
1030 seedfunc=''
1031 installscript=''
1032 scriptdir=''
1033 scriptdirexp=''
1034 selectminbits=''
1035 selecttype=''
1036 sh=''
1037 sig_count=''
1038 sig_name=''
1039 sig_name_init=''
1040 sig_num=''
1041 sig_num_init=''
1042 sig_size=''
1043 installsitearch=''
1044 sitearch=''
1045 sitearchexp=''
1046 installsitebin=''
1047 sitebin=''
1048 sitebinexp=''
1049 installsitelib=''
1050 sitelib=''
1051 sitelib_stem=''
1052 sitelibexp=''
1053 siteprefix=''
1054 siteprefixexp=''
1055 sizesize=''
1056 sizetype=''
1057 so=''
1058 socksizetype=''
1059 sharpbang=''
1060 shsharp=''
1061 spitshell=''
1062 src=''
1063 ssizetype=''
1064 startperl=''
1065 startsh=''
1066 stdchar=''
1067 d_stdio_stream_array=''
1068 stdio_stream_array=''
1069 sysman=''
1070 trnl=''
1071 uidformat=''
1072 uidsign=''
1073 uidsize=''
1074 uidtype=''
1075 archname64=''
1076 use64bitall=''
1077 use64bitint=''
1078 ccflags_uselargefiles=''
1079 ldflags_uselargefiles=''
1080 libswanted_uselargefiles=''
1081 uselargefiles=''
1082 uselongdouble=''
1083 usemorebits=''
1084 usemultiplicity=''
1085 nm_opt=''
1086 nm_so_opt=''
1087 runnm=''
1088 usenm=''
1089 useperlio=''
1090 usesocks=''
1091 d_oldpthreads=''
1092 use5005threads=''
1093 useithreads=''
1094 usereentrant=''
1095 usethreads=''
1096 incpath=''
1097 mips_type=''
1098 usrinc=''
1099 d_vendorarch=''
1100 installvendorarch=''
1101 vendorarch=''
1102 vendorarchexp=''
1103 d_vendorbin=''
1104 installvendorbin=''
1105 vendorbin=''
1106 vendorbinexp=''
1107 d_vendorlib=''
1108 installvendorlib=''
1109 vendorlib=''
1110 vendorlib_stem=''
1111 vendorlibexp=''
1112 usevendorprefix=''
1113 vendorprefix=''
1114 vendorprefixexp=''
1115 versiononly=''
1116 defvoidused=''
1117 voidflags=''
1118 pm_apiversion=''
1119 xs_apiversion=''
1120 yacc=''
1121 yaccflags=''
1122 CONFIG=''
1123
1124 define='define'
1125 undef='undef'
1126 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1127 rmlist=''
1128
1129 : We must find out about Eunice early
1130 eunicefix=':'
1131 if test -f /etc/unixtovms; then
1132         eunicefix=/etc/unixtovms
1133 fi
1134 if test -f /etc/unixtovms.exe; then
1135         eunicefix=/etc/unixtovms.exe
1136 fi
1137
1138 : Set executable suffix now -- needed before hints available
1139 if test -f "/libs/version.library"; then
1140 : Amiga OS
1141     _exe=""
1142 elif test -f "/system/gnu_library/bin/ar.pm"; then
1143 : Stratus VOS
1144     _exe=".pm"
1145 elif test -n "$DJGPP"; then
1146 : DOS DJGPP
1147     _exe=".exe"
1148 elif test -d c:/. ; then
1149 : OS/2 or cygwin
1150     _exe=".exe"
1151 fi
1152
1153 i_whoami=''
1154 ccname=''
1155 ccversion=''
1156 perllibs=''
1157 : set useposix=false in your hint file to disable the POSIX extension.
1158 useposix=true
1159 : set useopcode=false in your hint file to disable the Opcode extension.
1160 useopcode=true
1161 : Trailing extension.  Override this in a hint file, if needed.
1162 : Extra object files, if any, needed on this platform.
1163 archobjs=''
1164 archname=''
1165 : Possible local include directories to search.
1166 : Set locincpth to "" in a hint file to defeat local include searches.
1167 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1168 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1169 :
1170 : no include file wanted by default
1171 inclwanted=''
1172
1173 groupstype=''
1174 libnames=''
1175 : change the next line if compiling for Xenix/286 on Xenix/386
1176 xlibpth='/usr/lib/386 /lib/386'
1177 : Possible local library directories to search.
1178 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1179 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1180
1181 : general looking path for locating libraries
1182 glibpth="/lib /usr/lib $xlibpth"
1183 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1184 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1185 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1186
1187 : Private path used by Configure to find libraries.  Its value
1188 : is prepended to libpth. This variable takes care of special
1189 : machines, like the mips.  Usually, it should be empty.
1190 plibpth=''
1191
1192 : default library list
1193 libswanted=''
1194 : some systems want to use only the non-versioned libso:s
1195 ignore_versioned_solibs=''
1196 archname64=''
1197 ccflags_uselargefiles=''
1198 ldflags_uselargefiles=''
1199 libswanted_uselargefiles=''
1200 : set usemultiplicity on the Configure command line to enable multiplicity.
1201 : set usesocks on the Configure command line to enable socks.
1202 : set usethreads on the Configure command line to enable threads.
1203 usereentrant='undef'
1204 : full support for void wanted by default
1205 defvoidused=15
1206
1207 : List of libraries we want.
1208 : If anyone needs -lnet, put it in a hint file.
1209 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1210 libswanted="$libswanted dld ld sun m c cposix posix"
1211 libswanted="$libswanted ndir dir crypt sec"
1212 libswanted="$libswanted ucb bsd BSD PW x util"
1213 : We probably want to search /usr/shlib before most other libraries.
1214 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1215 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1216 glibpth="/usr/shlib $glibpth"
1217 : Do not use vfork unless overridden by a hint file.
1218 usevfork=false
1219
1220 : Find the basic shell for Bourne shell scripts
1221 case "$sh" in
1222 '')
1223         case "$SYSTYPE" in
1224         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1225         *) xxx='/bin/sh';;
1226         esac
1227         if test -f "$xxx"; then
1228                 sh="$xxx"
1229         else
1230                 : Build up a list and do a single loop so we can 'break' out.
1231                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1232                 for xxx in sh bash ksh pdksh ash; do
1233                         for p in $pth; do
1234                                 try="$try ${p}/${xxx}"
1235                         done
1236                 done
1237                 for xxx in $try; do
1238                         if test -f "$xxx"; then
1239                                 sh="$xxx";
1240                                 break
1241                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1242                                 sh="$xxx";
1243                                 break
1244                         elif test -f "$xxx.exe"; then
1245                                 sh="$xxx";
1246                                 break
1247                         fi
1248                 done
1249         fi
1250         ;;
1251 esac
1252
1253 case "$sh" in
1254 '')     cat >&2 <<EOM
1255 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1256
1257 Usually it's in /bin/sh.  How did you even get this far?
1258 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1259 we'll try to straighten this all out.
1260 EOM
1261         exit 1
1262         ;;
1263 esac
1264
1265 : see if sh knows # comments
1266 if `$sh -c '#' >/dev/null 2>&1`; then
1267         shsharp=true
1268         spitshell=cat
1269         xcat=/bin/cat
1270         test -f $xcat$_exe || xcat=/usr/bin/cat
1271         if test ! -f $xcat$_exe; then
1272                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1273                         if test -f $p/cat$_exe; then
1274                                 xcat=$p/cat
1275                                 break
1276                         fi
1277                 done
1278                 if test ! -f $xcat$_exe; then
1279                         echo "Can't find cat anywhere!"
1280                         exit 1
1281                 fi
1282         fi
1283         echo "#!$xcat" >sharp
1284         $eunicefix sharp
1285         chmod +x sharp
1286         ./sharp > today
1287         if test -s today; then
1288                 sharpbang='#!'
1289         else
1290                 echo "#! $xcat" > sharp
1291                 $eunicefix sharp
1292                 chmod +x sharp
1293                 ./sharp > today
1294                 if test -s today; then
1295                         sharpbang='#! '
1296                 else
1297                         sharpbang=': use '
1298                 fi
1299         fi
1300 else
1301         echo " "
1302         echo "Your $sh doesn't grok # comments--I will strip them later on."
1303         shsharp=false
1304         cd ..
1305         echo "exec grep -v '^[  ]*#'" >spitshell
1306         chmod +x spitshell
1307         $eunicefix spitshell
1308         spitshell=`pwd`/spitshell
1309         cd UU
1310         echo "I presume that if # doesn't work, #! won't work either!"
1311         sharpbang=': use '
1312 fi
1313 rm -f sharp today
1314
1315 : figure out how to guarantee sh startup
1316 case "$startsh" in
1317 '') startsh=${sharpbang}${sh} ;;
1318 *)
1319 esac
1320 cat >sharp <<EOSS
1321 $startsh
1322 set abc
1323 test "$?abc" != 1
1324 EOSS
1325
1326 chmod +x sharp
1327 $eunicefix sharp
1328 if ./sharp; then
1329         : echo "Yup, it does."
1330 else
1331         echo "Hmm... '$startsh' does not guarantee sh startup..."
1332         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1333 fi
1334 rm -f sharp
1335
1336
1337 : Save command line options in file UU/cmdline.opt for later use in
1338 : generating config.sh.
1339 cat > cmdline.opt <<EOSH
1340 # Configure command line arguments.
1341 config_arg0='$0'
1342 config_args='$*'
1343 config_argc=$#
1344 EOSH
1345 argn=1
1346 args_exp=''
1347 args_sep=''
1348 for arg in "$@"; do
1349         cat >>cmdline.opt <<EOSH
1350 config_arg$argn='$arg'
1351 EOSH
1352         # Extreme backslashitis: replace each ' by '"'"'
1353         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1354 $arg
1355 EOC
1356         arg_exp=`cat cmdl.opt`
1357         args_exp="$args_exp$args_sep'$arg_exp'"
1358         argn=`expr $argn + 1`
1359         args_sep=' '
1360 done
1361 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1362 # used by ./hints/os2.sh
1363 rm -f cmdl.opt
1364
1365 : produce awk script to parse command line options
1366 cat >options.awk <<'EOF'
1367 BEGIN {
1368         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1369
1370         len = length(optstr);
1371         for (i = 1; i <= len; i++) {
1372                 c = substr(optstr, i, 1);
1373                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1374                 if (a == ":") {
1375                         arg[c] = 1;
1376                         i++;
1377                 }
1378                 opt[c] = 1;
1379         }
1380 }
1381 {
1382         expect = 0;
1383         str = $0;
1384         if (substr(str, 1, 1) != "-") {
1385                 printf("'%s'\n", str);
1386                 next;
1387         }
1388         len = length($0);
1389         for (i = 2; i <= len; i++) {
1390                 c = substr(str, i, 1);
1391                 if (!opt[c]) {
1392                         printf("-%s\n", substr(str, i));
1393                         next;
1394                 }
1395                 printf("-%s\n", c);
1396                 if (arg[c]) {
1397                         if (i < len)
1398                                 printf("'%s'\n", substr(str, i + 1));
1399                         else
1400                                 expect = 1;
1401                         next;
1402                 }
1403         }
1404 }
1405 END {
1406         if (expect)
1407                 print "?";
1408 }
1409 EOF
1410
1411 : process the command line options
1412 set X `for arg in "$@"; do echo "X$arg"; done |
1413         sed -e s/X// | awk -f options.awk`
1414 eval "set $*"
1415 shift
1416 rm -f options.awk
1417
1418 : set up default values
1419 fastread=''
1420 reuseval=false
1421 config_sh=''
1422 alldone=''
1423 error=''
1424 silent=''
1425 extractsh=''
1426 override=''
1427 knowitall=''
1428 rm -f optdef.sh posthint.sh
1429 cat >optdef.sh <<EOS
1430 $startsh
1431 EOS
1432
1433
1434 : option parsing
1435 while test $# -gt 0; do
1436         case "$1" in
1437         -d) shift; fastread=yes;;
1438         -e) shift; alldone=cont;;
1439         -f)
1440                 shift
1441                 cd ..
1442                 if test -r "$1"; then
1443                         config_sh="$1"
1444                 else
1445                         echo "$me: cannot read config file $1." >&2
1446                         error=true
1447                 fi
1448                 cd UU
1449                 shift;;
1450         -h) shift; error=true;;
1451         -r) shift; reuseval=true;;
1452         -s) shift; silent=true; realsilent=true;;
1453         -E) shift; alldone=exit;;
1454         -K) shift; knowitall=true;;
1455         -O) shift; override=true;;
1456         -S) shift; silent=true; extractsh=true;;
1457         -D)
1458                 shift
1459                 case "$1" in
1460                 *=)
1461                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1462                         echo "$me: ignoring -D $1" >&2
1463                         ;;
1464                 *=*) echo "$1" | \
1465                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1466                 *) echo "$1='define'" >> optdef.sh;;
1467                 esac
1468                 shift
1469                 ;;
1470         -U)
1471                 shift
1472                 case "$1" in
1473                 *=) echo "$1" >> optdef.sh;;
1474                 *=*)
1475                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1476                         echo "$me: ignoring -U $1" >&2
1477                         ;;
1478                 *) echo "$1='undef'" >> optdef.sh;;
1479                 esac
1480                 shift
1481                 ;;
1482         -A)
1483             shift
1484             xxx=''
1485             yyy="$1"
1486             zzz=''
1487             uuu=undef
1488             case "$yyy" in
1489             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1490                  case "$zzz" in
1491                  *:*) zzz='' ;;
1492                  *)   xxx=append
1493                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1494                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1495                  esac
1496                  ;;
1497             esac
1498             case "$xxx" in
1499             '')  case "$yyy" in
1500                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1501                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1502                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1503                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1504                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1505                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1506                  esac
1507                  ;;       
1508             esac
1509             case "$xxx" in
1510             append)
1511                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1512             clear)
1513                 echo "$yyy=''"                  >> posthint.sh ;;
1514             define)
1515                 case "$zzz" in
1516                 '') zzz=define ;;
1517                 esac
1518                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1519             eval)
1520                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1521             prepend)
1522                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1523             undef)
1524                 case "$zzz" in
1525                 '') zzz="$uuu" ;;
1526                 esac
1527                 echo "$yyy=$zzz"                >> posthint.sh ;;
1528             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1529             esac
1530             shift
1531             ;;
1532         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1533             exit 0;;
1534         --) break;;
1535         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1536         *) break;;
1537         esac
1538 done
1539
1540 case "$error" in
1541 true)
1542         cat >&2 <<EOM
1543 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1544                  [-U symbol] [-U symbol=] [-A command:symbol...]
1545   -d : use defaults for all answers.
1546   -e : go on without questioning past the production of config.sh.
1547   -f : specify an alternate default configuration file.
1548   -h : print this help message and exit (with an error status).
1549   -r : reuse C symbols value if possible (skips costly nm extraction).
1550   -s : silent mode, only echoes questions and essential information.
1551   -D : define symbol to have some value:
1552          -D symbol         symbol gets the value 'define'
1553          -D symbol=value   symbol gets the value 'value'
1554   -E : stop at the end of questions, after having produced config.sh.
1555   -K : do not use unless you know what you are doing.
1556   -O : let -D and -U override definitions from loaded configuration file.
1557   -S : perform variable substitutions on all .SH files (can mix with -f)
1558   -U : undefine symbol:
1559          -U symbol    symbol gets the value 'undef'
1560          -U symbol=   symbol gets completely empty
1561   -A : manipulate symbol after the platform specific hints have been applied:
1562          -A symbol=value                append " "value to symbol
1563          -A append:symbol=value         append value to symbol
1564          -A define:symbol=value         define symbol to have value
1565          -A clear:symbol                define symbol to be ''
1566          -A define:symbol               define symbol to be 'define'
1567          -A eval:symbol=value           define symbol to be eval of value
1568          -A prepend:symbol=value        prepend value to symbol
1569          -A undef:symbol                define symbol to be 'undef'
1570          -A undef:symbol=               define symbol to be ''
1571   -V : print version number and exit (with a zero status).
1572 EOM
1573         exit 1
1574         ;;
1575 esac
1576
1577 : Sanity checks
1578 case "$fastread$alldone" in
1579 yescont|yesexit) ;;
1580 *)
1581         case "$extractsh" in
1582         true) ;;
1583         *)
1584                 if test ! -t 0; then
1585                         echo "Say 'sh Configure', not 'sh <Configure'"
1586                         exit 1
1587                 fi
1588                 ;;
1589         esac
1590         ;;
1591 esac
1592
1593 exec 4>&1
1594 case "$silent" in
1595 true) exec 1>/dev/null;;
1596 esac
1597
1598 : run the defines and the undefines, if any, but leave the file out there...
1599 touch optdef.sh
1600 . ./optdef.sh
1601 : create the posthint manipulation script and leave the file out there...
1602 touch posthint.sh
1603
1604 : set package name
1605 package=perl5
1606 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1607 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1608 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1609 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1610 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1611 esac
1612
1613 : Some greps do not return status, grrr.
1614 echo "grimblepritz" >grimble
1615 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1616         contains=contains
1617 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1618         contains=grep
1619 else
1620         contains=contains
1621 fi
1622 rm -f grimble
1623 : the following should work in any shell
1624 case "$contains" in
1625 contains*)
1626         echo " "
1627         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1628         cat >contains <<'EOSS'
1629 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1630 EOSS
1631 chmod +x contains
1632 esac
1633
1634 : Find the path to the source tree
1635 case "$src" in
1636 '') case "$0" in
1637     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1638          case "$src" in
1639          /*)    ;;
1640          .)     ;;
1641          *)     src=`cd ../$src && pwd` ;;
1642          esac
1643          ;;
1644     *)   src='.';;
1645     esac;;
1646 esac
1647 case "$src" in
1648 '')     src=/
1649         rsrc=/
1650         ;;
1651 /*) rsrc="$src";;
1652 *) rsrc="../$src";;
1653 esac
1654 if test -f $rsrc/Configure && \
1655         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1656 then
1657    : found it, so we are ok.
1658 else
1659         rsrc=''
1660         for src in . .. ../.. ../../.. ../../../..; do
1661                 if test -f ../$src/Configure && \
1662                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1663                 then
1664                         rsrc=../$src
1665                         break
1666                 fi
1667         done
1668 fi
1669 case "$rsrc" in
1670 '')
1671         cat <<EOM >&4
1672
1673 Sorry, I can't seem to locate the source dir for $package.  Please start
1674 Configure with an explicit path -- i.e. /some/path/Configure.
1675
1676 EOM
1677         exit 1
1678         ;;
1679 ../.)   rsrc='..';;
1680 *)
1681         echo " "
1682         echo "Sources for $package found in \"$src\"." >&4
1683         ;;
1684 esac
1685
1686 : script used to extract .SH files with variable substitutions
1687 cat >extract <<'EOS'
1688 PERL_CONFIG_SH=true
1689 echo "Doing variable substitutions on .SH files..."
1690 if test -f MANIFEST; then
1691         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1692 else
1693         echo "(Looking for .SH files under the source directory.)"
1694         set x `(cd "$src"; find . -name "*.SH" -print)`
1695 fi
1696 shift
1697 case $# in
1698 0) set x `(cd "$src"; echo *.SH)`; shift;;
1699 esac
1700 if test ! -f "$src/$1"; then
1701         shift
1702 fi
1703 mkdir_p='
1704 name=$1;
1705 create="";
1706 while test $name; do
1707         if test ! -d "$name"; then
1708                 create="$name $create";
1709                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1710                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1711         else
1712                 name="";
1713         fi;
1714 done;
1715 for file in $create; do
1716         mkdir $file;
1717 done
1718 '
1719 for file in $*; do
1720         case "$src" in
1721         ".")
1722                 case "$file" in
1723                 */*)
1724                         dir=`expr X$file : 'X\(.*\)/'`
1725                         file=`expr X$file : 'X.*/\(.*\)'`
1726                         (cd "$dir" && . ./$file)
1727                         ;;
1728                 *)
1729                         . ./$file
1730                         ;;
1731                 esac
1732                 ;;
1733         *)
1734                 case "$file" in
1735                 */*)
1736                         dir=`expr X$file : 'X\(.*\)/'`
1737                         file=`expr X$file : 'X.*/\(.*\)'`
1738                         (set x $dir; shift; eval $mkdir_p)
1739                         sh <"$src/$dir/$file"
1740                         ;;
1741                 *)
1742                         sh <"$src/$file"
1743                         ;;
1744                 esac
1745                 ;;
1746         esac
1747 done
1748 if test -f "$src/config_h.SH"; then
1749         if test ! -f config.h; then
1750         : oops, they left it out of MANIFEST, probably, so do it anyway.
1751         . "$src/config_h.SH"
1752         fi
1753 fi
1754 EOS
1755
1756 : extract files and exit if asked to do so
1757 case "$extractsh" in
1758 true)
1759         case "$realsilent" in
1760         true) ;;
1761         *) exec 1>&4;;
1762         esac
1763         case "$config_sh" in
1764         '') config_sh='config.sh';;
1765         esac
1766         echo " "
1767         echo "Fetching answers from $config_sh..."
1768         cd ..
1769         . $config_sh
1770         test "$override" && . ./optdef.sh
1771         echo " "
1772         . UU/extract
1773         rm -rf UU
1774         echo "Extraction done."
1775         exit 0
1776         ;;
1777 esac
1778
1779 : Eunice requires " " instead of "", can you believe it
1780 echo " "
1781 : Here we go...
1782 echo "Beginning of configuration questions for $package."
1783
1784 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1785
1786 : first determine how to suppress newline on echo command
1787 echo " "
1788 echo "Checking echo to see how to suppress newlines..."
1789 (echo "hi there\c" ; echo " ") >.echotmp
1790 if $contains c .echotmp >/dev/null 2>&1 ; then
1791         echo "...using -n."
1792         n='-n'
1793         c=''
1794 else
1795         cat <<'EOM'
1796 ...using \c
1797 EOM
1798         n=''
1799         c='\c'
1800 fi
1801 echo $n "The star should be here-->$c"
1802 echo '*'
1803 rm -f .echotmp
1804
1805 : Now test for existence of everything in MANIFEST
1806 echo " "
1807 if test -f "$rsrc/MANIFEST"; then
1808         echo "First let's make sure your kit is complete.  Checking..." >&4
1809         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1810         rm -f missing
1811         tmppwd=`pwd`
1812         for filelist in x??; do
1813                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1814         done
1815         if test -s missing; then
1816                 cat missing >&4
1817                 cat >&4 <<'EOM'
1818
1819 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1820
1821 You have the option of continuing the configuration process, despite the
1822 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1823 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1824 and contact the author (perlbug@perl.org).
1825
1826 EOM
1827                 echo $n "Continue? [n] $c" >&4
1828                 read ans
1829                 case "$ans" in
1830                 y*)
1831                         echo "Continuing..." >&4
1832                         rm -f missing
1833                         ;;
1834                 *)
1835                         echo "ABORTING..." >&4
1836                         kill $$
1837                         ;;
1838                 esac
1839         else
1840                 echo "Looks good..."
1841         fi
1842 else
1843         echo "There is no MANIFEST file.  I hope your kit is complete !"
1844 fi
1845 rm -f missing x??
1846
1847 echo " "
1848 : Find the appropriate value for a newline for tr
1849 if test -n "$DJGPP"; then
1850        trnl='\012'
1851 fi
1852 if test X"$trnl" = X; then
1853         case "`echo foo|tr '\n' x 2>/dev/null`" in
1854         foox) trnl='\n' ;;
1855         esac
1856 fi
1857 if test X"$trnl" = X; then
1858         case "`echo foo|tr '\012' x 2>/dev/null`" in
1859         foox) trnl='\012' ;;
1860         esac
1861 fi
1862 if test X"$trnl" = X; then
1863         cat <<EOM >&2
1864
1865 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1866
1867 EOM
1868         exit 1
1869 fi
1870
1871 : compute the number of columns on the terminal for proper question formatting
1872 case "$COLUMNS" in
1873 '') COLUMNS='80';;
1874 esac
1875
1876 : set up the echo used in my read
1877 myecho="case \"\$xxxm\" in
1878 '') echo $n \"\$rp $c\" >&4;;
1879 *) case \"\$rp\" in
1880         '') echo $n \"[\$xxxm] $c\";;
1881         *)
1882                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1883                         echo \"\$rp\" >&4
1884                         echo $n \"[\$xxxm] $c\" >&4
1885                 else
1886                         echo $n \"\$rp [\$xxxm] $c\" >&4
1887                 fi
1888                 ;;
1889         esac;;
1890 esac"
1891
1892 : now set up to do reads with possible shell escape and default assignment
1893 cat <<EOSC >myread
1894 $startsh
1895 xxxm=\$dflt
1896 $myecho
1897 ans='!'
1898 case "\$fastread" in
1899 yes) case "\$dflt" in
1900         '') ;;
1901         *) ans='';
1902                 case "\$silent-\$rp" in
1903                 true-) ;;
1904                 *) echo " " >&4;;
1905                 esac;;
1906         esac;;
1907 *) case "\$silent" in
1908         true) case "\$rp" in
1909                 '') ans='';;
1910                 esac;;
1911         esac;;
1912 esac
1913 while expr "X\$ans" : "X!" >/dev/null; do
1914         read answ
1915         set x \$xxxm
1916         shift
1917         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1918         case  "\$answ" in
1919         "!")
1920                 sh 1>&4
1921                 echo " "
1922                 $myecho
1923                 ;;
1924         !*)
1925                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1926                 shift
1927                 sh 1>&4 -c "\$*"
1928                 echo " "
1929                 $myecho
1930                 ;;
1931         "\$ans")
1932                 case "\$ans" in
1933                 \\&*)
1934                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1935                         shift
1936                         case "\$1" in
1937                         -d)
1938                                 fastread=yes
1939                                 echo "(OK, I'll run with -d after this question.)" >&4
1940                                 ;;
1941                         -*)
1942                                 echo "*** Sorry, \$1 not supported yet." >&4
1943                                 ;;
1944                         esac
1945                         $myecho
1946                         ans=!
1947                         ;;
1948                 esac;;
1949         *)
1950                 case "\$aok" in
1951                 y)
1952                         echo "*** Substitution done -- please confirm."
1953                         xxxm="\$ans"
1954                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1955                         xxxm="\$ans"
1956                         ans=!
1957                         ;;
1958                 *)
1959                         echo "*** Error -- try again."
1960                         ans=!
1961                         ;;
1962                 esac
1963                 $myecho
1964                 ;;
1965         esac
1966         case "\$ans\$xxxm\$nostick" in
1967         '')
1968                 ans=!
1969                 $myecho
1970                 ;;
1971         esac
1972 done
1973 case "\$ans" in
1974 '') ans="\$xxxm";;
1975 esac
1976 EOSC
1977
1978 : create .config dir to save info across Configure sessions
1979 test -d ../.config || mkdir ../.config
1980 cat >../.config/README <<EOF
1981 This directory created by Configure to save information that should
1982 persist across sessions for $package.
1983
1984 You may safely delete it if you wish.
1985 EOF
1986
1987 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1988 case "$usedevel" in
1989 $define|true|[yY]*) ;;
1990 *) case "$xversion" in
1991    *[13579])
1992         cat >&4 <<EOH
1993 *** WHOA THERE!!! ***
1994
1995     This is an UNSTABLE DEVELOPMENT release.
1996     The version of this $package distribution is $xversion, that is, odd,
1997     (as opposed to even) and that signifies a development release.
1998     If you want a maintenance release, you want an even-numbered version.
1999
2000     Do ***NOT*** install this into production use.
2001     Data corruption and crashes are possible.
2002
2003     It is most seriously suggested that you do not continue any further
2004     unless you want to help in developing and debugging Perl.
2005
2006     If you *still* want to build perl, you can answer 'y' now,
2007     or pass -Dusedevel to Configure.
2008
2009 EOH
2010         rp='Do you really want to continue?'
2011         dflt='n'
2012         . ./myread
2013         case "$ans" in
2014         [yY]) echo >&4 "Okay, continuing."
2015               usedevel="$define" ;;
2016         *) echo >&4 "Okay, bye."
2017            exit 1
2018            ;;
2019         esac
2020         ;;
2021     esac
2022     ;;
2023 esac
2024 case "$usedevel" in
2025 $define|true|[yY]*)
2026         case "$versiononly" in
2027         '') versiononly="$define" ;;
2028         esac
2029         case "$installusrbinperl" in
2030         '') installusrbinperl="$undef" ;;
2031         esac
2032         ;;
2033 esac
2034
2035 : general instructions
2036 needman=true
2037 firsttime=true
2038 user=`(logname) 2>/dev/null`
2039 case "$user" in
2040 '') user=`whoami 2>&1`;;
2041 esac
2042 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2043         firsttime=false
2044         echo " "
2045         rp='Would you like to see the instructions?'
2046         dflt=n
2047         . ./myread
2048         case "$ans" in
2049         [yY]*) ;;
2050         *) needman=false;;
2051         esac
2052 fi
2053 if $needman; then
2054         cat <<EOH
2055
2056 This installation shell script will examine your system and ask you questions
2057 to determine how the perl5 package should be installed. If you get
2058 stuck on a question, you may use a ! shell escape to start a subshell or
2059 execute a command.  Many of the questions will have default answers in square
2060 brackets; typing carriage return will give you the default.
2061
2062 On some of the questions which ask for file or directory names you are allowed
2063 to use the ~name construct to specify the login directory belonging to "name",
2064 even if you don't have a shell which knows about that.  Questions where this is
2065 allowed will be marked "(~name ok)".
2066
2067 EOH
2068         rp=''
2069         dflt='Type carriage return to continue'
2070         . ./myread
2071         cat <<'EOH'
2072
2073 The prompter used in this script allows you to use shell variables and
2074 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2075 in the default answer, as if the default line was a set of arguments given to a
2076 script shell.  This means you may also use $* to repeat the whole default line,
2077 so you do not have to re-type everything to add something to the default.
2078
2079 Everytime there is a substitution, you will have to confirm.  If there is an
2080 error (e.g. an unmatched backtick), the default answer will remain unchanged
2081 and you will be prompted again.
2082
2083 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2084 the questions and use the computed defaults (or the previous answers if there
2085 was already a config.sh file). Type 'Configure -h' for a list of options.
2086 You may also start interactively and then answer '& -d' at any prompt to turn
2087 on the non-interactive behaviour for the remainder of the execution.
2088
2089 EOH
2090         . ./myread
2091         cat <<EOH
2092
2093 Much effort has been expended to ensure that this shell script will run on any
2094 Unix system.  If despite that it blows up on yours, your best bet is to edit
2095 Configure and run it again.  If you can't run Configure for some reason,
2096 you'll have to generate a config.sh file by hand.  Whatever problems you
2097 have, let me (perlbug@perl.org) know how I blew it.
2098
2099 This installation script affects things in two ways:
2100
2101 1) it may do direct variable substitutions on some of the files included
2102    in this kit.
2103 2) it builds a config.h file for inclusion in C programs.  You may edit
2104    any of these files as the need arises after running this script.
2105
2106 If you make a mistake on a question, there is no easy way to back up to it
2107 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2108 files.  Configure will offer to let you do this before it runs the SH files.
2109
2110 EOH
2111         dflt='Type carriage return to continue'
2112         . ./myread
2113         case "$firsttime" in
2114         true) echo $user >>../.config/instruct;;
2115         esac
2116 fi
2117
2118 : find out where common programs are
2119 echo " "
2120 echo "Locating common programs..." >&4
2121 cat <<EOSC >loc
2122 $startsh
2123 case \$# in
2124 0) exit 1;;
2125 esac
2126 thing=\$1
2127 shift
2128 dflt=\$1
2129 shift
2130 for dir in \$*; do
2131         case "\$thing" in
2132         .)
2133         if test -d \$dir/\$thing; then
2134                 echo \$dir
2135                 exit 0
2136         fi
2137         ;;
2138         *)
2139         for thisthing in \$dir/\$thing; do
2140                 : just loop through to pick last item
2141         done
2142         if test -f \$thisthing; then
2143                 echo \$thisthing
2144                 exit 0
2145         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2146                 echo \$thisthing
2147                 exit 0
2148         elif test -f \$dir/\$thing.exe; then
2149                 if test -n "$DJGPP"; then
2150                         echo \$dir/\$thing.exe
2151                 else
2152                         : on Eunice apparently
2153                         echo \$dir/\$thing
2154                 fi
2155                 exit 0
2156         fi
2157         ;;
2158         esac
2159 done
2160 echo \$dflt
2161 exit 1
2162 EOSC
2163 chmod +x loc
2164 $eunicefix loc
2165 loclist="
2166 awk
2167 cat
2168 chmod
2169 comm
2170 cp
2171 echo
2172 expr
2173 grep
2174 ls
2175 mkdir
2176 rm
2177 sed
2178 sort
2179 touch
2180 tr
2181 uniq
2182 "
2183 trylist="
2184 Mcc
2185 ar
2186 bison
2187 byacc
2188 cpp
2189 csh
2190 date
2191 egrep
2192 gmake
2193 gzip
2194 less
2195 ln
2196 make
2197 more
2198 nm
2199 nroff
2200 pg
2201 test
2202 uname
2203 zip
2204 "
2205 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2206 pth="$pth /lib /usr/lib"
2207 for file in $loclist; do
2208         eval xxx=\$$file
2209         case "$xxx" in
2210         /*|?:[\\/]*)
2211                 if test -f "$xxx"; then
2212                         : ok
2213                 else
2214                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2215                         xxx=`./loc $file $file $pth`
2216                 fi
2217                 ;;
2218         '') xxx=`./loc $file $file $pth`;;
2219         *) xxx=`./loc $xxx $xxx $pth`;;
2220         esac
2221         eval $file=$xxx$_exe
2222         eval _$file=$xxx
2223         case "$xxx" in
2224         /*)
2225                 echo $file is in $xxx.
2226                 ;;
2227         ?:[\\/]*)
2228                 echo $file is in $xxx.
2229                 ;;
2230         *)
2231                 echo "I don't know where '$file' is, and my life depends on it." >&4
2232                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2233                 exit 1
2234                 ;;
2235         esac
2236 done
2237 echo " "
2238 echo "Don't worry if any of the following aren't found..."
2239 say=offhand
2240 for file in $trylist; do
2241         eval xxx=\$$file
2242         case "$xxx" in
2243         /*|?:[\\/]*)
2244                 if test -f "$xxx"; then
2245                         : ok
2246                 else
2247                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2248                         xxx=`./loc $file $file $pth`
2249                 fi
2250                 ;;
2251         '') xxx=`./loc $file $file $pth`;;
2252         *) xxx=`./loc $xxx $xxx $pth`;;
2253         esac
2254         eval $file=$xxx$_exe
2255         eval _$file=$xxx
2256         case "$xxx" in
2257         /*)
2258                 echo $file is in $xxx.
2259                 ;;
2260         ?:[\\/]*)
2261                 echo $file is in $xxx.
2262                 ;;
2263         *)
2264                 echo "I don't see $file out there, $say."
2265                 say=either
2266                 ;;
2267         esac
2268 done
2269 case "$egrep" in
2270 egrep)
2271         echo "Substituting grep for egrep."
2272         egrep=$grep
2273         _egrep=$grep
2274         ;;
2275 esac
2276 case "$ln" in
2277 ln)
2278         echo "Substituting cp for ln."
2279         ln=$cp
2280         _ln=$cp
2281         ;;
2282 esac
2283 case "$make" in
2284 make)   
2285         case "$gmake" in
2286         gmake)
2287         echo "I can't find make or gmake, and my life depends on it." >&4
2288         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2289         exit 1
2290         ;;
2291         esac
2292         ;;
2293 esac    
2294 case "$gmake" in
2295 gmake)  ;;
2296 *)      # We can't have osname yet.
2297         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2298                 # Assume that gmake, if found, is definitely GNU make
2299                 # and prefer it over the system make.
2300                 echo "Substituting gmake for make."
2301                 make=$gmake
2302                 _make=$gmake
2303         fi
2304         ;;
2305 esac
2306 case "$test" in
2307 test)
2308         echo "Hopefully test is built into your sh."
2309         ;;
2310 *)
2311         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2312                 echo "Using the test built into your sh."
2313                 test=test
2314                 _test=test
2315         fi
2316         ;;
2317 esac
2318 case "$echo" in
2319 echo)
2320         echo "Hopefully echo is built into your sh."
2321         ;;
2322 '') ;;
2323 *)
2324         echo " "
2325 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2326         $echo $n "hi there$c" >foo1
2327         echo $n "hi there$c" >foo2
2328         if cmp foo1 foo2 >/dev/null 2>&1; then
2329                 echo "They are compatible.  In fact, they may be identical."
2330         else
2331                 case "$n" in
2332                 '-n') n='' c='\c';;
2333                 *) n='-n' c='';;
2334                 esac
2335                 cat <<FOO
2336 They are not compatible!  You are probably running ksh on a non-USG system.
2337 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2338 have echo built in and we may have to run some Bourne shell scripts.  That
2339 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2340
2341 FOO
2342                 $echo $n "The star should be here-->$c"
2343                 $echo "*"
2344         fi
2345         $rm -f foo1 foo2
2346         ;;
2347 esac
2348
2349 cat <<EOS >trygcc
2350 $startsh
2351 EOS
2352 cat <<'EOSC' >>trygcc
2353 case "$cc" in
2354 '') ;;
2355 *)  $rm -f try try.*
2356     $cat >try.c <<EOM
2357 int main(int argc, char *argv[]) {
2358   return 0;
2359 }
2360 EOM
2361     if $cc -o try $ccflags $ldflags try.c; then
2362        :
2363     else
2364         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2365         despair=yes
2366         trygcc=yes
2367         case "$cc" in
2368         *gcc*) trygcc=no ;;
2369         esac
2370         case "`$cc -v -c try.c 2>&1`" in
2371         *gcc*) trygcc=no ;;
2372         esac
2373         if $test X"$trygcc" = Xyes; then
2374             if gcc -o try -c try.c; then
2375                 echo " "
2376                 echo "You seem to have a working gcc, though." >&4
2377                 rp="Would you like to use it?"
2378                 dflt=y
2379                 if $test -f myread; then
2380                     . ./myread
2381                 else
2382                     if $test -f UU/myread; then
2383                         . ./UU/myread
2384                     else
2385                         echo "Cannot find myread, sorry.  Aborting." >&2
2386                         exit 1
2387                     fi
2388                 fi  
2389                 case "$ans" in
2390                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2391                 esac
2392             fi
2393         fi
2394     fi
2395     $rm -f try try.*
2396     ;;
2397 esac
2398 EOSC
2399
2400 cat <<EOS >checkcc
2401 $startsh
2402 EOS
2403 cat <<'EOSC' >>checkcc
2404 case "$cc" in        
2405 '') ;;
2406 *)  $rm -f try try.*              
2407     $cat >try.c <<EOM
2408 int main(int argc, char *argv[]) {
2409   return 0;
2410 }
2411 EOM
2412     if $cc -o try $ccflags $ldflags try.c; then
2413        :
2414     else
2415         if $test X"$despair" = Xyes; then
2416            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2417         fi
2418         $cat >&4 <<EOM         
2419 You need to find a working C compiler.
2420 Either (purchase and) install the C compiler supplied by your OS vendor,
2421 or for a free C compiler try http://gcc.gnu.org/
2422 I cannot continue any further, aborting.
2423 EOM
2424         exit 1
2425     fi
2426     $rm -f try try.*
2427     ;;
2428 esac
2429 EOSC
2430
2431 : determine whether symbolic links are supported
2432 echo " "
2433 $touch blurfl
2434 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2435         echo "Symbolic links are supported." >&4
2436         lns="$ln -s"
2437 else
2438         echo "Symbolic links are NOT supported." >&4
2439         lns="$ln"
2440 fi
2441 $rm -f blurfl sym
2442
2443 : determine whether symbolic links are supported
2444 echo " "
2445 case "$lns" in
2446 *"ln"*" -s")
2447         echo "Checking how to test for symbolic links..." >&4
2448         $lns blurfl sym
2449         if $test "X$issymlink" = X; then
2450                 case "$newsh" in
2451                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2452                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2453                 esac
2454                 if test $? = 0; then
2455                         issymlink="test -h"
2456                 else
2457                         echo "Your builtin 'test -h' may be broken." >&4
2458                         case "$test" in
2459                         /*)     ;;
2460                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2461                                 for p in $pth
2462                                 do
2463                                         if test -f "$p/$test"; then
2464                                                 test="$p/$test"
2465                                                 break
2466                                         fi
2467                                 done
2468                                 ;;
2469                         esac
2470                         case "$test" in
2471                         /*)
2472                                 echo "Trying external '$test -h'." >&4
2473                                 issymlink="$test -h"
2474                                 if $test ! -h sym >/dev/null 2>&1; then
2475                                         echo "External '$test -h' is broken, too." >&4
2476                                         issymlink=''
2477                                 fi
2478                                 ;;
2479                         *)      issymlink='' ;;
2480                         esac
2481                 fi              
2482         fi
2483         if $test "X$issymlink" = X; then
2484                 if $test -L sym 2>/dev/null; then
2485                         issymlink="$test -L"
2486                         echo "The builtin '$test -L' worked." >&4
2487                 fi
2488         fi
2489         if $test "X$issymlink" != X; then
2490                 echo "You can test for symbolic links with '$issymlink'." >&4
2491         else
2492                 echo "I do not know how you can test for symbolic links." >&4
2493         fi
2494         $rm -f blurfl sym
2495         ;;
2496 *)      echo "No symbolic links, so not testing for their testing..." >&4
2497         ;;
2498 esac
2499 echo " "
2500
2501
2502 case "$mksymlinks" in
2503 $define|true|[yY]*)
2504         case "$src" in
2505         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2506                 exit 1
2507                 ;;
2508         *)      case "$lns:$issymlink" in
2509                 *"ln"*" -s:"*"test -"?)
2510                         echo "Creating the symbolic links..." >&4
2511                         echo "(First creating the subdirectories...)" >&4
2512                         cd ..
2513                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2514                                 read directory
2515                                 test -z "$directory" && break
2516                                 mkdir -p $directory
2517                         done
2518                         # Sanity check 1.
2519                         if test ! -d t/base; then
2520                                 echo "Failed to create the subdirectories.  Aborting." >&4
2521                                 exit 1
2522                         fi
2523                         echo "(Then creating the symlinks...)" >&4
2524                         awk '{print $1}' $src/MANIFEST | while true; do
2525                                 read filename
2526                                 test -z "$filename" && break
2527                                 if test -f $filename; then
2528                                         if $issymlink $filename; then
2529                                                 rm -f $filename
2530                                         fi
2531                                 fi
2532                                 if test -f $filename; then
2533                                         echo "$filename already exists, not symlinking."
2534                                 else
2535                                         ln -s $src/$filename $filename
2536                                 fi
2537                         done
2538                         # Sanity check 2.
2539                         if test ! -f t/base/lex.t; then
2540                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2541                                 exit 1
2542                         fi
2543                         cd UU
2544                         ;;
2545                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2546                         ;;
2547                 esac
2548                 ;;
2549         esac
2550         ;;
2551 esac
2552
2553
2554 case "$usecrosscompile" in
2555 $define|true|[yY]*)
2556         $echo "Cross-compiling..."
2557         croak=''
2558         case "$cc" in
2559         *-*-gcc) # A cross-compiling gcc, probably.
2560             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2561             ar=$targetarch-ar
2562             # leave out ld, choosing it is more complex
2563             nm=$targetarch-nm
2564             ranlib=$targetarch-ranlib
2565             $echo 'extern int foo;' > try.c
2566             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2567             shift
2568             if $test $# -gt 0; then
2569                 incpth="$incpth $*"
2570                 incpth="`$echo $incpth|$sed 's/^ //'`"
2571                 echo "Guessing incpth '$incpth'." >&4
2572                 for i in $*; do
2573                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2574                     if $test -d $j; then
2575                         libpth="$libpth $j"
2576                     fi
2577                 done   
2578                 libpth="`$echo $libpth|$sed 's/^ //'`"
2579                 echo "Guessing libpth '$libpth'." >&4
2580             fi
2581             $rm -f try.c
2582             ;;
2583         esac
2584         case "$targetarch" in
2585         '') echo "Targetarch not defined." >&4; croak=y ;;
2586         *)  echo "Using targetarch $targetarch." >&4 ;;
2587         esac
2588         case "$incpth" in
2589         '') echo "Incpth not defined." >&4; croak=y ;;
2590         *)  echo "Using incpth '$incpth'." >&4 ;;
2591         esac
2592         case "$libpth" in
2593         '') echo "Libpth not defined." >&4; croak=y ;;
2594         *)  echo "Using libpth '$libpth'." >&4 ;;
2595         esac
2596         case "$usrinc" in
2597         '') for i in $incpth; do
2598                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2599                     usrinc=$i
2600                     echo "Guessing usrinc $usrinc." >&4
2601                     break
2602                 fi
2603             done
2604             case "$usrinc" in
2605             '') echo "Usrinc not defined." >&4; croak=y ;;
2606             esac
2607             ;;
2608         *)  echo "Using usrinc $usrinc." >&4 ;;
2609         esac
2610         case "$targethost" in
2611         '') echo "Targethost not defined." >&4; croak=y ;;
2612         *)  echo "Using targethost $targethost." >&4
2613         esac
2614         locincpth=' '
2615         loclibpth=' '
2616         case "$croak" in
2617         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2618         esac
2619         case "$src" in
2620         /*) run=$src/Cross/run
2621             targetmkdir=$src/Cross/mkdir
2622             to=$src/Cross/to
2623             from=$src/Cross/from
2624             ;;
2625         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2626             run=$pwd/Cross/run
2627             targetmkdir=$pwd/Cross/mkdir
2628             to=$pwd/Cross/to
2629             from=$pwd/Cross/from
2630             ;;
2631         esac
2632         case "$targetrun" in
2633         '') targetrun=ssh ;;
2634         esac
2635         case "$targetto" in
2636         '') targetto=scp ;;
2637         esac
2638         case "$targetfrom" in
2639         '') targetfrom=scp ;;
2640         esac
2641         run=$run-$targetrun
2642         to=$to-$targetto
2643         from=$from-$targetfrom
2644         case "$targetdir" in
2645         '')  targetdir=/tmp
2646              echo "Guessing targetdir $targetdir." >&4
2647              ;;
2648         esac
2649         case "$targetuser" in
2650         '')  targetuser=root
2651              echo "Guessing targetuser $targetuser." >&4
2652              ;;
2653         esac
2654         case "$targetfrom" in
2655         scp)    q=-q ;;
2656         *)      q='' ;;
2657         esac
2658         case "$targetrun" in
2659         ssh|rsh)
2660             cat >$run <<EOF
2661 #!/bin/sh
2662 case "\$1" in
2663 -cwd)
2664   shift
2665   cwd=\$1
2666   shift
2667   ;;
2668 esac
2669 case "\$cwd" in
2670 '') cwd=$targetdir ;;
2671 esac
2672 exe=\$1
2673 shift
2674 if $test ! -f \$exe.xok; then
2675   $to \$exe
2676   $touch \$exe.xok
2677 fi
2678 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2679 EOF
2680             ;;
2681         *)  echo "Unknown targetrun '$targetrun'" >&4
2682             exit 1
2683             ;;
2684         esac
2685         case "$targetmkdir" in
2686         */Cross/mkdir)
2687             cat >$targetmkdir <<EOF
2688 #!/bin/sh
2689 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2690 EOF
2691             $chmod a+rx $targetmkdir
2692             ;;
2693         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2694             exit 1
2695             ;;
2696         esac
2697         case "$targetto" in
2698         scp|rcp)
2699             cat >$to <<EOF
2700 #!/bin/sh
2701 for f in \$@
2702 do
2703   case "\$f" in
2704   /*)
2705     $targetmkdir \`dirname \$f\`
2706     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2707     ;;
2708   *)
2709     $targetmkdir $targetdir/\`dirname \$f\`
2710     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2711     ;;
2712   esac
2713 done
2714 exit 0
2715 EOF
2716             ;;
2717         cp) cat >$to <<EOF
2718 #!/bin/sh
2719 for f in \$@
2720 do
2721   case "\$f" in
2722   /*)
2723     $mkdir -p $targetdir/\`dirname \$f\`
2724     $cp \$f $targetdir/\$f || exit 1
2725     ;;
2726   *)
2727     $targetmkdir $targetdir/\`dirname \$f\`
2728     $cp \$f $targetdir/\$f || exit 1
2729     ;;
2730   esac
2731 done
2732 exit 0
2733 EOF
2734             ;;
2735         *)  echo "Unknown targetto '$targetto'" >&4
2736             exit 1
2737             ;;
2738         esac
2739         case "$targetfrom" in
2740         scp|rcp)
2741           cat >$from <<EOF
2742 #!/bin/sh
2743 for f in \$@
2744 do
2745   $rm -f \$f
2746   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2747 done
2748 exit 0
2749 EOF
2750             ;;
2751         cp) cat >$from <<EOF
2752 #!/bin/sh
2753 for f in \$@
2754 do
2755   $rm -f \$f
2756   cp $targetdir/\$f . || exit 1
2757 done
2758 exit 0
2759 EOF
2760             ;;
2761         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2762             exit 1
2763             ;;
2764         esac
2765         if $test ! -f $run; then
2766             echo "Target 'run' script '$run' not found." >&4
2767         else
2768             $chmod a+rx $run
2769         fi
2770         if $test ! -f $to; then
2771             echo "Target 'to' script '$to' not found." >&4
2772         else
2773             $chmod a+rx $to
2774         fi
2775         if $test ! -f $from; then
2776             echo "Target 'from' script '$from' not found." >&4
2777         else
2778             $chmod a+rx $from
2779         fi
2780         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2781             exit 1
2782         fi
2783         cat >&4 <<EOF
2784 Using '$run' for remote execution,
2785 and '$from' and '$to'
2786 for remote file transfer.
2787 EOF
2788         ;;
2789 *)      run=''
2790         to=:
2791         from=:
2792         usecrosscompile='undef'
2793         targetarch=''
2794         ;;
2795 esac
2796
2797 : see whether [:lower:] and [:upper:] are supported character classes
2798 echo " "
2799 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2800 ABYZ)
2801         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2802         up='[:upper:]'
2803         low='[:lower:]'
2804         ;;
2805 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2806         # (0xc9 and 0xd1), therefore that is a nice testing point.
2807         if test "X$up" = X -o "X$low" = X; then
2808             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2809             ij) up='[A-Z]'
2810                 low='[a-z]'
2811                 ;;
2812             esac
2813         fi
2814         if test "X$up" = X -o "X$low" = X; then
2815             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2816             ij) up='A-Z'
2817                 low='a-z'
2818                 ;;
2819             esac
2820         fi
2821         if test "X$up" = X -o "X$low" = X; then
2822             case "`echo IJ | od -x 2>/dev/null`" in
2823             *C9D1*|*c9d1*)
2824                 echo "Hey, this might be EBCDIC." >&4
2825                 if test "X$up" = X -o "X$low" = X; then
2826                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2827                     ij) up='[A-IJ-RS-Z]'
2828                         low='[a-ij-rs-z]'
2829                         ;;
2830                     esac
2831                 fi
2832                 if test "X$up" = X -o "X$low" = X; then
2833                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2834                     ij) up='A-IJ-RS-Z'
2835                         low='a-ij-rs-z'
2836                         ;;
2837                     esac
2838                 fi
2839                 ;;
2840             esac
2841         fi
2842 esac
2843 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2844 ij)
2845     echo "Using $up and $low to convert case." >&4
2846     ;;
2847 *)
2848     echo "I don't know how to translate letters from upper to lower case." >&4
2849     echo "Your tr is not acting any way I know of." >&4
2850     exit 1
2851     ;;
2852 esac
2853 : set up the translation script tr, must be called with ./tr of course
2854 cat >tr <<EOSC
2855 $startsh
2856 case "\$1\$2" in
2857 '[A-Z][a-z]') exec $tr '$up' '$low';;
2858 '[a-z][A-Z]') exec $tr '$low' '$up';;
2859 esac
2860 exec $tr "\$@"
2861 EOSC
2862 chmod +x tr
2863 $eunicefix tr
2864
2865 : Try to determine whether config.sh was made on this system
2866 case "$config_sh" in
2867 '')
2868 myuname=`$uname -a 2>/dev/null`
2869 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2870 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2871 # because the A-Z/a-z are not consecutive.
2872 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2873         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2874 newmyuname="$myuname"
2875 dflt=n
2876 case "$knowitall" in
2877 '')
2878         if test -f ../config.sh; then
2879                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2880                         eval "`grep myuname= ../config.sh`"
2881                 fi
2882                 if test "X$myuname" = "X$newmyuname"; then
2883                         dflt=y
2884                 fi
2885         fi
2886         ;;
2887 *) dflt=y;;
2888 esac
2889
2890 : Get old answers from old config file if Configure was run on the
2891 : same system, otherwise use the hints.
2892 hint=default
2893 cd ..
2894 if test -f config.sh; then
2895         echo " "
2896         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2897         . UU/myread
2898         case "$ans" in
2899         n*|N*) echo "OK, I'll ignore it."
2900                 mv config.sh config.sh.old
2901                 myuname="$newmyuname"
2902                 ;;
2903         *)  echo "Fetching default answers from your old config.sh file..." >&4
2904                 tmp_n="$n"
2905                 tmp_c="$c"
2906                 tmp_sh="$sh"
2907                 . ./config.sh
2908                 cp config.sh UU
2909                 n="$tmp_n"
2910                 c="$tmp_c"
2911                 : Older versions did not always set $sh.  Catch re-use of such
2912                 : an old config.sh.
2913                 case "$sh" in
2914                 '') sh="$tmp_sh" ;;
2915                 esac
2916                 hint=previous
2917                 ;;
2918         esac
2919 fi
2920 . ./UU/checkcc
2921 if test ! -f config.sh; then
2922         $cat <<EOM
2923
2924 First time through, eh?  I have some defaults handy for some systems
2925 that need some extra help getting the Configure answers right:
2926
2927 EOM
2928         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2929         dflt=''
2930         : Half the following guesses are probably wrong... If you have better
2931         : tests or hints, please send them to perlbug@perl.org
2932         : The metaconfig authors would also appreciate a copy...
2933         $test -f /irix && osname=irix
2934         $test -f /xenix && osname=sco_xenix
2935         $test -f /dynix && osname=dynix
2936         $test -f /dnix && osname=dnix
2937         $test -f /lynx.os && osname=lynxos
2938         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2939         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2940         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2941         $test -f /bin/mips && /bin/mips && osname=mips
2942         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2943                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2944         $test -d /usr/apollo/bin && osname=apollo
2945         $test -f /etc/saf/_sactab && osname=svr4
2946         $test -d /usr/include/minix && osname=minix
2947         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2948         if $test -d /MachTen -o -d /MachTen_Folder; then
2949                 osname=machten
2950                 if $test -x /sbin/version; then
2951                         osvers=`/sbin/version | $awk '{print $2}' |
2952                         $sed -e 's/[A-Za-z]$//'`
2953                 elif $test -x /usr/etc/version; then
2954                         osvers=`/usr/etc/version | $awk '{print $2}' |
2955                         $sed -e 's/[A-Za-z]$//'`
2956                 else
2957                         osvers="$2.$3"
2958                 fi
2959         fi
2960
2961         $test -f /sys/posix.dll &&
2962                 $test -f /usr/bin/what &&
2963                 set X `/usr/bin/what /sys/posix.dll` &&
2964                 $test "$3" = UWIN &&
2965                 osname=uwin &&
2966                 osvers="$5"
2967
2968         if $test -f $uname; then
2969                 set X $myuname
2970                 shift
2971
2972                 case "$5" in
2973                 fps*) osname=fps ;;
2974                 mips*)
2975                         case "$4" in
2976                         umips) osname=umips ;;
2977                         *) osname=mips ;;
2978                         esac;;
2979                 [23]100) osname=mips ;;
2980                 next*) osname=next ;;
2981                 i386*)
2982                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2983                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2984                                 osname='sco'
2985                                 osvers=$tmp
2986                         elif $test -f /etc/kconfig; then
2987                                 osname=isc
2988                                 if test "$lns" = "$ln -s"; then
2989                                         osvers=4
2990                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2991                                         osvers=3
2992                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2993                                         osvers=2
2994                                 fi
2995                         fi
2996                         tmp=''
2997                         ;;
2998                 pc*)
2999                         if test -n "$DJGPP"; then
3000                                 osname=dos
3001                                 osvers=djgpp
3002                         fi
3003                         ;;
3004                 esac
3005
3006                 case "$1" in
3007                 aix) osname=aix
3008                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3009                         case "$tmp" in
3010                         'not found') osvers="$4"."$3" ;;
3011                         '<3240'|'<>3240') osvers=3.2.0 ;;
3012                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3013                         '=3250'|'>3250') osvers=3.2.5 ;;
3014                         *) osvers=$tmp;;
3015                         esac
3016                         ;;
3017                 bsd386) osname=bsd386
3018                         osvers=`$uname -r`
3019                         ;;
3020                 cygwin*) osname=cygwin
3021                         osvers="$3"
3022                         ;;
3023                 *dc.osx) osname=dcosx
3024                         osvers="$3"
3025                         ;;
3026                 dnix) osname=dnix
3027                         osvers="$3"
3028                         ;;
3029                 domainos) osname=apollo
3030                         osvers="$3"
3031                         ;;
3032                 dgux) osname=dgux 
3033                         osvers="$3"
3034                         ;;
3035                 dynixptx*) osname=dynixptx
3036                         osvers=`echo "$4"|sed 's/^v//'`
3037                         ;;
3038                 freebsd) osname=freebsd 
3039                         osvers="$3" ;;
3040                 genix) osname=genix ;;
3041                 hp*) osname=hpux 
3042                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3043                         ;;
3044                 irix*) osname=irix
3045                         case "$3" in
3046                         4*) osvers=4 ;;
3047                         5*) osvers=5 ;;
3048                         *)      osvers="$3" ;;
3049                         esac
3050                         ;;
3051                 linux) osname=linux
3052                         case "$3" in
3053                         *)      osvers="$3" ;;
3054                         esac
3055                         ;;
3056                 MiNT) osname=mint
3057                         ;;
3058                 netbsd*) osname=netbsd
3059                         osvers="$3"
3060                         ;;
3061                 news-os) osvers="$3"
3062                         case "$3" in
3063                         4*) osname=newsos4 ;;
3064                         *) osname=newsos ;;
3065                         esac
3066                         ;;
3067                 next*) osname=next ;;
3068                 nonstop-ux) osname=nonstopux ;;
3069                 POSIX-BC | posix-bc ) osname=posix-bc
3070                         osvers="$3"
3071                         ;;
3072                 powerux | power_ux | powermax_os | powermaxos | \
3073                 powerunix | power_unix) osname=powerux
3074                         osvers="$3"
3075                         ;;
3076                 qnx) osname=qnx
3077                         osvers="$4"
3078                         ;;
3079                 solaris) osname=solaris
3080                         case "$3" in
3081                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3082                         *)      osvers="$3" ;;
3083                         esac
3084                         ;;
3085                 sunos) osname=sunos
3086                         case "$3" in
3087                         5*) osname=solaris
3088                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3089                         *)      osvers="$3" ;;
3090                         esac
3091                         ;;
3092                 titanos) osname=titanos
3093                         case "$3" in
3094                         1*) osvers=1 ;;
3095                         2*) osvers=2 ;;
3096                         3*) osvers=3 ;;
3097                         4*) osvers=4 ;;
3098                         *)      osvers="$3" ;;
3099                         esac
3100                         ;;
3101                 ultrix) osname=ultrix
3102                         osvers="$3"
3103                         ;;
3104                 osf1|mls+)      case "$5" in
3105                                 alpha)
3106                                         osname=dec_osf
3107                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3108                                         case "$osvers" in
3109                                         [1-9].[0-9]*) ;;
3110                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3111                                         esac
3112                                         ;;
3113                         hp*)    osname=hp_osf1  ;;
3114                         mips)   osname=mips_osf1 ;;
3115                         esac
3116                         ;;
3117                 unixware) osname=svr5
3118                         osvers="$4"
3119                         ;;
3120                 uts)    osname=uts
3121                         osvers="$3"
3122                         ;;
3123                 vos) osvers="$3"
3124                         ;;
3125                 $2) case "$osname" in
3126                         *isc*) ;;
3127                         *freebsd*) ;;
3128                         svr*)
3129                                 : svr4.x or possibly later
3130                                 case "svr$3" in 
3131                                 ${osname}*)
3132                                         osname=svr$3
3133                                         osvers=$4
3134                                         ;;
3135                                 esac
3136                                 case "$osname" in
3137                                 svr4.0)
3138                                         : Check for ESIX
3139                                         if test -f /stand/boot ; then
3140                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3141                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3142                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3143                                                         if test -n "$isesix"; then
3144                                                                 osname=esix4
3145                                                         fi
3146                                                 fi
3147                                         fi
3148                                         ;;
3149                                 esac
3150                                 ;;
3151                         *)      if test -f /etc/systemid; then
3152                                         osname=sco
3153                                         set `echo $3 | $sed 's/\./ /g'` $4
3154                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3155                                                 osvers=$1.$2.$3
3156                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3157                                                 osvers=$1.$2
3158                                         elif $test -f $src/hints/sco_$1.sh; then
3159                                                 osvers=$1
3160                                         fi
3161                                 else
3162                                         case "$osname" in
3163                                         '') : Still unknown.  Probably a generic Sys V.
3164                                                 osname="sysv"
3165                                                 osvers="$3"
3166                                                 ;;
3167                                         esac
3168                                 fi
3169                                 ;;
3170                         esac
3171                         ;;
3172                 *)      case "$osname" in
3173                         '') : Still unknown.  Probably a generic BSD.
3174                                 osname="$1"
3175                                 osvers="$3"
3176                                 ;;
3177                         esac
3178                         ;;
3179                 esac
3180         else
3181                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3182                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3183                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3184                                 osname=news_os
3185                         fi
3186                         $rm -f UU/kernel.what
3187                 elif test -d c:/.; then
3188                         set X $myuname
3189                         osname=os2
3190                         osvers="$5"
3191                 fi
3192         fi
3193         
3194         case "$targetarch" in
3195         '') ;;
3196         *)  hostarch=$osname
3197             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3198             osvers=''
3199             ;;
3200         esac
3201
3202         : Now look for a hint file osname_osvers, unless one has been
3203         : specified already.
3204         case "$hintfile" in
3205         ''|' ')
3206                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3207                 : Also try without trailing minor version numbers.
3208                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3209                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3210                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3211                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3212                 case "$file" in
3213                 '') dflt=none ;;
3214                 *)  case "$osvers" in
3215                         '') dflt=$file
3216                                 ;;
3217                         *)  if $test -f $src/hints/$file.sh ; then
3218                                         dflt=$file
3219                                 elif $test -f $src/hints/$xfile.sh ; then
3220                                         dflt=$xfile
3221                                 elif $test -f $src/hints/$xxfile.sh ; then
3222                                         dflt=$xxfile
3223                                 elif $test -f $src/hints/$xxxfile.sh ; then
3224                                         dflt=$xxxfile
3225                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3226                                         dflt=$xxxxfile
3227                                 elif $test -f "$src/hints/${osname}.sh" ; then
3228                                         dflt="${osname}"
3229                                 else
3230                                         dflt=none
3231                                 fi
3232                                 ;;
3233                         esac
3234                         ;;
3235                 esac
3236                 if $test -f Policy.sh ; then
3237                         case "$dflt" in
3238                         *Policy*) ;;
3239                         none) dflt="Policy" ;;
3240                         *) dflt="Policy $dflt" ;;
3241                         esac
3242                 fi
3243                 ;;
3244         *)
3245                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3246                 ;;
3247         esac
3248
3249         if $test -f Policy.sh ; then
3250                 $cat <<EOM
3251
3252 There's also a Policy hint file available, which should make the
3253 site-specific (policy) questions easier to answer.
3254 EOM
3255
3256         fi
3257
3258         $cat <<EOM
3259
3260 You may give one or more space-separated answers, or "none" if appropriate.
3261 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3262 is a good thing.  DO NOT give a wrong version or a wrong OS.
3263
3264 EOM
3265
3266         rp="Which of these apply, if any?"
3267         . UU/myread
3268         tans=$ans
3269         for file in $tans; do
3270                 if $test X$file = XPolicy -a -f Policy.sh; then
3271                         . Policy.sh
3272                         $cat Policy.sh >> UU/config.sh
3273                 elif $test -f $src/hints/$file.sh; then
3274                         . $src/hints/$file.sh
3275                         $cat $src/hints/$file.sh >> UU/config.sh
3276                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3277                         : nothing
3278                 else
3279                         : Give one chance to correct a possible typo.
3280                         echo "$file.sh does not exist"
3281                         dflt=$file
3282                         rp="hint to use instead?"
3283                         . UU/myread
3284                         for file in $ans; do
3285                                 if $test -f "$src/hints/$file.sh"; then
3286                                         . $src/hints/$file.sh
3287                                         $cat $src/hints/$file.sh >> UU/config.sh
3288                                 elif $test X$ans = X -o X$ans = Xnone ; then
3289                                         : nothing
3290                                 else
3291                                         echo "$file.sh does not exist -- ignored."
3292                                 fi
3293                         done
3294                 fi
3295         done
3296
3297         hint=recommended
3298         : Remember our hint file for later.
3299         if $test -f "$src/hints/$file.sh" ; then
3300                 hintfile="$file"
3301         else
3302                 hintfile=''
3303         fi
3304 fi
3305 cd UU
3306 ;;
3307 *)
3308         echo " "
3309         echo "Fetching default answers from $config_sh..." >&4
3310         tmp_n="$n"
3311         tmp_c="$c"
3312         cd ..
3313         cp $config_sh config.sh 2>/dev/null
3314         chmod +w config.sh
3315         . ./config.sh
3316         cd UU
3317         cp ../config.sh .
3318         n="$tmp_n"
3319         c="$tmp_c"
3320         hint=previous
3321         ;;
3322 esac
3323 test "$override" && . ./optdef.sh
3324
3325 : Restore computed paths
3326 for file in $loclist $trylist; do
3327         eval $file="\$_$file"
3328 done
3329
3330 cat << EOM
3331
3332 Configure uses the operating system name and version to set some defaults.
3333 The default value is probably right if the name rings a bell. Otherwise,
3334 since spelling matters for me, either accept the default or answer "none"
3335 to leave it blank.
3336
3337 EOM
3338 case "$osname" in
3339         ''|' ')
3340                 case "$hintfile" in
3341                 ''|' '|none) dflt=none ;;
3342                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3343                 esac
3344                 ;;
3345         *) dflt="$osname" ;;
3346 esac
3347 rp="Operating system name?"
3348 . ./myread
3349 case "$ans" in
3350 none)  osname='' ;;
3351 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3352 esac
3353 echo " "
3354 case "$osvers" in
3355         ''|' ')
3356                 case "$hintfile" in
3357                 ''|' '|none) dflt=none ;;
3358                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3359                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3360                         case "$dflt" in
3361                         ''|' ') dflt=none ;;
3362                         esac
3363                         ;;
3364                 esac
3365                 ;;
3366         *) dflt="$osvers" ;;
3367 esac
3368 rp="Operating system version?"
3369 . ./myread
3370 case "$ans" in
3371 none)  osvers='' ;;
3372 *) osvers="$ans" ;;
3373 esac
3374
3375
3376 . ./posthint.sh
3377
3378 : who configured the system
3379 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3380 cf_by=`(logname) 2>/dev/null`
3381 case "$cf_by" in
3382 "")
3383         cf_by=`(whoami) 2>/dev/null`
3384         case "$cf_by" in
3385         "") cf_by=unknown ;;
3386         esac ;;
3387 esac
3388
3389 : set up the script used to warn in case of inconsistency
3390 cat <<EOS >whoa
3391 $startsh
3392 EOS
3393 cat <<'EOSC' >>whoa
3394 dflt=y
3395 echo " "
3396 echo "*** WHOA THERE!!! ***" >&4
3397 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3398 rp="    Keep the $hint value?"
3399 . ./myread
3400 case "$ans" in
3401 y) td=$was; tu=$was;;
3402 esac
3403 EOSC
3404
3405 : function used to set $1 to $val
3406 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3407 case "$val$was" in
3408 $define$undef) . ./whoa; eval "$var=\$td";;
3409 $undef$define) . ./whoa; eval "$var=\$tu";;
3410 *) eval "$var=$val";;
3411 esac'
3412
3413 case "$usethreads" in
3414 $define|true|[yY]*)     dflt='y';;
3415 *) dflt='n';;
3416 esac
3417 cat <<EOM
3418
3419 Perl can be built to take advantage of threads on some systems.
3420 To do so, Configure can be run with -Dusethreads.
3421
3422 Note that threading is a highly experimental feature, and
3423 some known race conditions still remain.  If you choose to try
3424 it, be very sure to not actually deploy it for production
3425 purposes.  README.threads has more details, and is required
3426 reading if you enable threads.
3427
3428 If this doesn't make any sense to you, just accept the default '$dflt'.
3429 EOM
3430 rp='Build a threading Perl?'
3431 . ./myread
3432 case "$ans" in
3433 y|Y)    val="$define" ;;
3434 *)      val="$undef" ;;
3435 esac
3436 set usethreads
3437 eval $setvar
3438
3439 case "$usethreads" in
3440 $define)
3441         $cat <<EOM
3442
3443 As of 5.5.640, Perl has two different internal threading implementations,
3444 the 5.005 version (5005threads) and an interpreter-based version
3445 (ithreads) that has one interpreter per thread.  Both are very 
3446 experimental.  This arrangement exists to help developers work out
3447 which one is better.
3448
3449 If you're a casual user, you probably don't want interpreter-threads
3450 at this time.  But if you do, the 'threads' module allows their use,
3451 and the 'Thread' module offers an interface to both 5005threads and
3452 ithreads (whichever has been configured).
3453 EOM
3454         : Default to ithreads unless overridden on command line or with
3455         : old config.sh
3456         dflt='y'
3457         case "$use5005threads" in
3458                 $define|true|[yY]*) dflt='n';;
3459         esac
3460         case "$useithreads" in
3461                 $undef|false|[nN]*) dflt='n';;
3462         esac
3463         rp='Use interpreter-based ithreads?'
3464         . ./myread
3465         case "$ans" in
3466         y|Y)    val="$define" ;;
3467         *)      val="$undef" ;;
3468         esac
3469         set useithreads
3470         eval $setvar
3471         : Now set use5005threads to the opposite value.
3472         case "$useithreads" in
3473         $define) val="$undef" ;;
3474         *) val="$define" ;;
3475         esac
3476         set use5005threads
3477         eval $setvar
3478         ;;
3479 *)
3480         useithreads="$undef"
3481         use5005threads="$undef"
3482         ;;
3483 esac
3484
3485 case "$useithreads$use5005threads" in
3486 "$define$define")
3487         $cat >&4 <<EOM
3488
3489 You cannot have both the ithreads and the 5.005 threads enabled
3490 at the same time.  Disabling the 5.005 threads since they are
3491 much less stable than the ithreads.
3492
3493 EOM
3494         use5005threads="$undef"
3495         ;;
3496 esac
3497
3498 case "$d_oldpthreads" in
3499 '')     : Configure tests would be welcome here.  For now, assume undef.
3500         val="$undef" ;;
3501 *)      val="$d_oldpthreads" ;;
3502 esac
3503 set d_oldpthreads
3504 eval $setvar
3505
3506
3507 case "$usethreads" in
3508 "$define"|true|[yY]*)
3509 : Look for a hint-file generated 'call-back-unit'.  If the
3510 : user has specified that a threading perl is to be built,
3511 : we may need to set or change some other defaults.
3512         if $test -f usethreads.cbu; then
3513                 echo "Your platform has some specific hints for threaded builds, using them..."
3514                 . ./usethreads.cbu
3515         else
3516                 $cat <<EOM
3517 (Your platform doesn't have any specific hints for threaded builds.
3518  Assuming POSIX threads, then.)
3519 EOM
3520         fi
3521         ;;
3522 esac
3523
3524 cat <<EOM
3525
3526 Perl can be built so that multiple Perl interpreters can coexist
3527 within the same Perl executable.
3528 EOM
3529
3530 case "$useithreads" in
3531 $define)
3532         cat <<EOM
3533 This multiple interpreter support is required for interpreter-based threads.
3534 EOM
3535         val="$define"
3536         ;;
3537 *)      case "$usemultiplicity" in
3538         $define|true|[yY]*)     dflt='y';;
3539         *) dflt='n';;
3540         esac
3541         echo " "
3542         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3543         rp='Build Perl for multiplicity?'
3544         . ./myread
3545         case "$ans" in
3546         y|Y)    val="$define" ;;
3547         *)      val="$undef" ;;
3548         esac
3549         ;;
3550 esac
3551 set usemultiplicity
3552 eval $setvar
3553
3554
3555 case "$usemorebits" in
3556 "$define"|true|[yY]*)
3557         use64bitint="$define"
3558         uselongdouble="$define"
3559         usemorebits="$define"
3560         ;;
3561 *)      usemorebits="$undef"
3562         ;;
3563 esac
3564
3565 : make some quick guesses about what we are up against
3566 echo " "
3567 $echo $n "Hmm...  $c"
3568 echo exit 1 >bsd
3569 echo exit 1 >usg
3570 echo exit 1 >v7
3571 echo exit 1 >osf1
3572 echo exit 1 >eunice
3573 echo exit 1 >xenix
3574 echo exit 1 >venix
3575 echo exit 1 >os2
3576 d_bsd="$undef"
3577 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3578 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3579 then
3580         echo "Looks kind of like an OSF/1 system, but we'll see..."
3581         echo exit 0 >osf1
3582 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3583         xxx=`./loc addbib blurfl $pth`
3584         if $test -f $xxx; then
3585         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3586                 echo exit 0 >bsd
3587                 echo exit 0 >usg
3588         else
3589                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3590                         echo "Looks kind of like an extended USG system, but we'll see..."
3591                 else
3592                         echo "Looks kind of like a USG system, but we'll see..."
3593                 fi
3594                 echo exit 0 >usg
3595         fi
3596 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3597         echo "Looks kind of like a BSD system, but we'll see..."
3598         d_bsd="$define"
3599         echo exit 0 >bsd
3600 else
3601         echo "Looks kind of like a Version 7 system, but we'll see..."
3602         echo exit 0 >v7
3603 fi
3604 case "$eunicefix" in
3605 *unixtovms*)
3606         $cat <<'EOI'
3607 There is, however, a strange, musty smell in the air that reminds me of
3608 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3609 EOI
3610         echo exit 0 >eunice
3611         d_eunice="$define"
3612 : it so happens the Eunice I know will not run shell scripts in Unix format
3613         ;;
3614 *)
3615         echo " "
3616         echo "Congratulations.  You aren't running Eunice."
3617         d_eunice="$undef"
3618         ;;
3619 esac
3620 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3621 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3622 : semicolon as a patch separator
3623 case "$p_" in
3624 :) ;;
3625 *)
3626         $cat <<'EOI'
3627 I have the feeling something is not exactly right, however...don't tell me...
3628 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3629 (Or you may be running DOS with DJGPP.)
3630 EOI
3631         echo exit 0 >os2
3632         ;;
3633 esac
3634 if test -f /xenix; then
3635         echo "Actually, this looks more like a XENIX system..."
3636         echo exit 0 >xenix
3637         d_xenix="$define"
3638 else
3639         echo " "
3640         echo "It's not Xenix..."
3641         d_xenix="$undef"
3642 fi
3643 chmod +x xenix
3644 $eunicefix xenix
3645 if test -f /venix; then
3646         echo "Actually, this looks more like a VENIX system..."
3647         echo exit 0 >venix
3648 else
3649         echo " "
3650         if ./xenix; then
3651                 : null
3652         else
3653                 echo "Nor is it Venix..."
3654         fi
3655 fi
3656 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3657 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3658 $rm -f foo
3659
3660 case "$cc" in
3661 '') dflt=cc;;
3662 *) dflt="$cc";;
3663 esac
3664 rp="Use which C compiler?"
3665 . ./myread
3666 cc="$ans"
3667
3668 : See if they have not cc but they do have gcc
3669 . ./trygcc
3670 : Look for a hint-file generated 'call-back-unit'.  Now that the
3671 : user has specified the compiler, we may need to set or change some
3672 : other defaults.
3673 if $test -f cc.cbu; then
3674     . ./cc.cbu
3675 fi
3676 . ./checkcc
3677
3678 echo " "
3679 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3680 $cat >try.c <<EOM
3681 #include <stdio.h>
3682 int main() {
3683 #ifdef __GNUC__
3684 #ifdef __VERSION__
3685         printf("%s\n", __VERSION__);
3686 #else
3687         printf("%s\n", "1");
3688 #endif
3689 #endif
3690         exit(0);
3691 }
3692 EOM
3693 if $cc -o try $ccflags $ldflags try.c; then
3694         gccversion=`$run ./try`
3695         case "$gccversion" in
3696         '') echo "You are not using GNU cc." ;;
3697         *)  echo "You are using GNU cc $gccversion."
3698             ccname=gcc  
3699             ;;
3700         esac
3701 else
3702         echo " "
3703         echo "*** WHOA THERE!!! ***" >&4
3704         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3705         case "$knowitall" in
3706         '')
3707         echo "    You'd better start hunting for one and let me know about it." >&4
3708                 exit 1
3709                 ;;
3710         esac
3711 fi
3712 $rm -f try try.*
3713 case "$gccversion" in
3714 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3715 esac
3716 case "$gccversion" in
3717 '') gccosandvers='' ;;
3718 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3719    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3720    gccshortvers=''
3721    case "$gccosandvers" in
3722    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3723    $osname$osvers) ;; # looking good
3724    $osname*) cat <<EOM >&4
3725
3726 *** WHOA THERE!!! ***
3727
3728     Your gcc has not been compiled for the exact release of
3729     your operating system ($gccosandvers versus $osname$osvers).
3730
3731     In general it is a good idea to keep gcc synchronized with
3732     the operating system because otherwise serious problems
3733     may ensue when trying to compile software, like Perl.
3734
3735     I'm trying to be optimistic here, though, and will continue.
3736     If later during the configuration and build icky compilation
3737     problems appear (headerfile conflicts being the most common
3738     manifestation), I suggest reinstalling the gcc to match
3739     your operating system release.
3740
3741 EOM
3742       ;;
3743    *) gccosandvers='' ;; # failed to parse, better be silent
3744    esac
3745    ;;
3746 esac
3747 case "$ccname" in
3748 '') ccname="$cc" ;;
3749 esac
3750
3751
3752 : decide how portable to be.  Allow command line overrides.
3753 case "$d_portable" in
3754 "$undef") ;;
3755 *)      d_portable="$define" ;;
3756 esac
3757
3758 : set up shell script to do ~ expansion
3759 cat >filexp <<EOSS
3760 $startsh
3761 : expand filename
3762 case "\$1" in
3763  ~/*|~)
3764         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3765         ;;
3766  ~*)
3767         if $test -f /bin/csh; then
3768                 /bin/csh -f -c "glob \$1"
3769                 failed=\$?
3770                 echo ""
3771                 exit \$failed
3772         else
3773                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3774                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3775                 if $test ! -d "\$dir"; then
3776                         me=\`basename \$0\`
3777                         echo "\$me: can't locate home directory for: \$name" >&2
3778                         exit 1
3779                 fi
3780                 case "\$1" in
3781                 */*)
3782                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3783                         ;;
3784                 *)
3785                         echo \$dir
3786                         ;;
3787                 esac
3788         fi
3789         ;;
3790 *)
3791         echo \$1
3792         ;;
3793 esac
3794 EOSS
3795 chmod +x filexp
3796 $eunicefix filexp
3797
3798 : now set up to get a file name
3799 cat <<EOS >getfile
3800 $startsh
3801 EOS
3802 cat <<'EOSC' >>getfile
3803 tilde=''
3804 fullpath=''
3805 already=''
3806 skip=''
3807 none_ok=''
3808 exp_file=''
3809 nopath_ok=''
3810 orig_rp="$rp"
3811 orig_dflt="$dflt"
3812 case "$gfpth" in
3813 '') gfpth='.' ;;
3814 esac
3815
3816 case "$fn" in
3817 *\(*)
3818         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3819         fn=`echo $fn | sed 's/(.*)//'`
3820         ;;
3821 esac
3822
3823 case "$fn" in
3824 *:*)
3825         loc_file=`expr $fn : '.*:\(.*\)'`
3826         fn=`expr $fn : '\(.*\):.*'`
3827         ;;
3828 esac
3829
3830 case "$fn" in
3831 *~*) tilde=true;;
3832 esac
3833 case "$fn" in
3834 */*) fullpath=true;;
3835 esac
3836 case "$fn" in
3837 *+*) skip=true;;
3838 esac
3839 case "$fn" in
3840 *n*) none_ok=true;;
3841 esac
3842 case "$fn" in
3843 *e*) exp_file=true;;
3844 esac
3845 case "$fn" in
3846 *p*) nopath_ok=true;;
3847 esac
3848
3849 case "$fn" in
3850 *f*) type='File';;
3851 *d*) type='Directory';;
3852 *l*) type='Locate';;
3853 esac
3854
3855 what="$type"
3856 case "$what" in
3857 Locate) what='File';;
3858 esac
3859
3860 case "$exp_file" in
3861 '')
3862         case "$d_portable" in
3863         "$define") ;;
3864         *) exp_file=true;;
3865         esac
3866         ;;
3867 esac
3868
3869 cd ..
3870 while test "$type"; do
3871         redo=''
3872         rp="$orig_rp"
3873         dflt="$orig_dflt"
3874         case "$tilde" in
3875         true) rp="$rp (~name ok)";;
3876         esac
3877         . UU/myread
3878         if test -f UU/getfile.ok && \
3879                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3880         then
3881                 value="$ans"
3882                 ansexp="$ans"
3883                 break
3884         fi
3885         case "$ans" in
3886         none)
3887                 value=''
3888                 ansexp=''
3889                 case "$none_ok" in
3890                 true) type='';;
3891                 esac
3892                 ;;
3893         *)
3894                 case "$tilde" in
3895                 '') value="$ans"
3896                         ansexp="$ans";;
3897                 *)
3898                         value=`UU/filexp $ans`
3899                         case $? in
3900                         0)
3901                                 if test "$ans" != "$value"; then
3902                                         echo "(That expands to $value on this system.)"
3903                                 fi
3904                                 ;;
3905                         *) value="$ans";;
3906                         esac
3907                         ansexp="$value"
3908                         case "$exp_file" in
3909                         '') value="$ans";;
3910                         esac
3911                         ;;
3912                 esac
3913                 case "$fullpath" in
3914                 true)
3915                         case "$ansexp" in
3916                         /*) value="$ansexp" ;;
3917                         [a-zA-Z]:/*) value="$ansexp" ;;
3918                         *)
3919                                 redo=true
3920                                 case "$already" in
3921                                 true)
3922                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3923                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3924                                         ;;
3925                                 *)
3926                                 echo "Please give a full path name, starting with slash." >&4
3927                                         case "$tilde" in
3928                                         true)
3929                                 echo "Note that using ~name is ok provided it expands well." >&4
3930                                                 already=true
3931                                                 ;;
3932                                         esac
3933                                 esac
3934                                 ;;
3935                         esac
3936                         ;;
3937                 esac
3938                 case "$redo" in
3939                 '')
3940                         case "$type" in
3941                         File)
3942                                 for fp in $gfpth; do
3943                                         if test "X$fp" = X.; then
3944                                             pf="$ansexp"
3945                                         else    
3946                                             pf="$fp/$ansexp"
3947                                         fi
3948                                         if test -f "$pf"; then
3949                                                 type=''
3950                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3951                                         then
3952                                                 echo "($value is not a plain file, but that's ok.)"
3953                                                 type=''
3954                                         fi
3955                                         if test X"$type" = X; then
3956                                             value="$pf"
3957                                             break
3958                                         fi
3959                                 done
3960                                 ;;
3961                         Directory)
3962                                 for fp in $gfpth; do
3963                                         if test "X$fp" = X.; then
3964                                             dir="$ans"
3965                                             direxp="$ansexp"
3966                                         else    
3967                                             dir="$fp/$ansexp"
3968                                             direxp="$fp/$ansexp"
3969                                         fi
3970                                         if test -d "$direxp"; then
3971                                                 type=''
3972                                                 value="$dir"
3973                                                 break
3974                                         fi
3975                                 done
3976                                 ;;
3977                         Locate)
3978                                 if test -d "$ansexp"; then
3979                                         echo "(Looking for $loc_file in directory $value.)"
3980                                         value="$value/$loc_file"
3981                                         ansexp="$ansexp/$loc_file"
3982                                 fi
3983                                 if test -f "$ansexp"; then
3984                                         type=''
3985                                 fi
3986                                 case "$nopath_ok" in
3987                                 true)   case "$value" in
3988                                         */*) ;;
3989                                         *)      echo "Assuming $value will be in people's path."
3990                                                 type=''
3991                                                 ;;
3992                                         esac
3993                                         ;;
3994                                 esac
3995                                 ;;
3996                         esac
3997
3998                         case "$skip" in
3999                         true) type='';
4000                         esac
4001
4002                         case "$type" in
4003                         '') ;;
4004                         *)
4005                                 if test "$fastread" = yes; then
4006                                         dflt=y
4007                                 else
4008                                         dflt=n
4009                                 fi
4010                                 rp="$what $value doesn't exist.  Use that name anyway?"
4011                                 . UU/myread
4012                                 dflt=''
4013                                 case "$ans" in
4014                                 y*) type='';;
4015                                 *) echo " ";;
4016                                 esac
4017                                 ;;
4018                         esac
4019                         ;;
4020                 esac
4021                 ;;
4022         esac
4023 done
4024 cd UU
4025 ans="$value"
4026 rp="$orig_rp"
4027 dflt="$orig_dflt"
4028 rm -f getfile.ok
4029 test "X$gfpthkeep" != Xy && gfpth=""
4030 EOSC
4031
4032 : What should the include directory be ?
4033 echo " "
4034 $echo $n "Hmm...  $c"
4035 dflt='/usr/include'
4036 incpath=''
4037 mips_type=''
4038 if $test -f /bin/mips && /bin/mips; then
4039         echo "Looks like a MIPS system..."
4040         $cat >usr.c <<'EOCP'
4041 #ifdef SYSTYPE_BSD43
4042 /bsd43
4043 #endif
4044 EOCP
4045         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4046                 dflt='/bsd43/usr/include'
4047                 incpath='/bsd43'
4048                 mips_type='BSD 4.3'
4049         else
4050                 mips_type='System V'
4051         fi
4052         $rm -f usr.c usr.out
4053         echo "and you're compiling with the $mips_type compiler and libraries."
4054         xxx_prompt=y
4055         echo "exit 0" >mips
4056 else
4057         echo "Doesn't look like a MIPS system."
4058         xxx_prompt=n
4059         echo "exit 1" >mips
4060 fi
4061 chmod +x mips
4062 $eunicefix mips
4063 case "$usrinc" in
4064 '') ;;
4065 *) dflt="$usrinc";;
4066 esac
4067 case "$xxx_prompt" in
4068 y)      fn=d/
4069         echo " "
4070         rp='Where are the include files you want to use?'
4071         . ./getfile
4072         usrinc="$ans"
4073         ;;
4074 *)      usrinc="$dflt"
4075         ;;
4076 esac
4077
4078 : see how we invoke the C preprocessor
4079 echo " "
4080 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4081 cat <<'EOT' >testcpp.c
4082 #define ABC abc
4083 #define XYZ xyz
4084 ABC.XYZ
4085 EOT
4086 cd ..
4087 if test ! -f cppstdin; then
4088         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4089                 # AIX cc -E doesn't show the absolute headerfile
4090                 # locations but we'll cheat by using the -M flag.
4091                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4092         else
4093                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4094         fi
4095 else
4096         echo "Keeping your $hint cppstdin wrapper."
4097 fi
4098 chmod 755 cppstdin
4099 wrapper=`pwd`/cppstdin
4100 ok='false'
4101 cd UU
4102
4103 if $test "X$cppstdin" != "X" && \
4104         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4105         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4106 then
4107         echo "You used to use $cppstdin $cppminus so we'll use that again."
4108         case "$cpprun" in
4109         '') echo "But let's see if we can live without a wrapper..." ;;
4110         *)
4111                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4112                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4113                 then
4114                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4115                         ok='true'
4116                 else
4117                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4118                 fi
4119                 ;;
4120         esac
4121 else
4122         case "$cppstdin" in
4123         '') ;;
4124         *)
4125                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4126                 ;;
4127         esac
4128 fi
4129
4130 if $ok; then
4131         : nothing
4132 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4133         $cc -E <testcpp.c >testcpp.out 2>&1; \
4134         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4135         echo "Yup, it does."
4136         x_cpp="$cc -E"
4137         x_minus='';
4138 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4139         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4140         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4141         echo "Yup, it does."
4142         x_cpp="$cc -E"
4143         x_minus='-';
4144 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4145         $cc -P <testcpp.c >testcpp.out 2>&1; \
4146         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4147         echo "Yipee, that works!"
4148         x_cpp="$cc -P"
4149         x_minus='';
4150 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4151         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4152         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4153         echo "At long last!"
4154         x_cpp="$cc -P"
4155         x_minus='-';
4156 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4157         $cpp <testcpp.c >testcpp.out 2>&1; \
4158         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4159         echo "It works!"
4160         x_cpp="$cpp"
4161         x_minus='';
4162 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4163         $cpp - <testcpp.c >testcpp.out 2>&1; \
4164         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4165         echo "Hooray, it works!  I was beginning to wonder."
4166         x_cpp="$cpp"
4167         x_minus='-';
4168 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4169         $wrapper <testcpp.c >testcpp.out 2>&1; \
4170         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4171         x_cpp="$wrapper"
4172         x_minus=''
4173         echo "Eureka!"
4174 else
4175         dflt=''
4176         rp="No dice.  I can't find a C preprocessor.  Name one:"
4177         . ./myread
4178         x_cpp="$ans"
4179         x_minus=''
4180         $x_cpp <testcpp.c >testcpp.out 2>&1
4181         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4182                 echo "OK, that will do." >&4
4183         else
4184 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4185                 exit 1
4186         fi
4187 fi
4188
4189 case "$ok" in
4190 false)
4191         cppstdin="$x_cpp"
4192         cppminus="$x_minus"
4193         cpprun="$x_cpp"
4194         cpplast="$x_minus"
4195         set X $x_cpp
4196         shift
4197         case "$1" in
4198         "$cpp")
4199                 echo "Perhaps can we force $cc -E using a wrapper..."
4200                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4201                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4202                 then
4203                         echo "Yup, we can."
4204                         cppstdin="$wrapper"
4205                         cppminus='';
4206                 else
4207                         echo "Nope, we'll have to live without it..."
4208                 fi
4209                 ;;
4210         esac
4211         case "$cpprun" in
4212         "$wrapper")
4213                 cpprun=''
4214                 cpplast=''
4215                 ;;
4216         esac
4217         ;;
4218 esac
4219
4220 case "$cppstdin" in
4221 "$wrapper"|'cppstdin') ;;
4222 *) $rm -f $wrapper;;
4223 esac
4224 $rm -f testcpp.c testcpp.out
4225
4226 : Set private lib path
4227 case "$plibpth" in
4228 '') if ./mips; then
4229                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4230         fi;;
4231 esac
4232 case "$libpth" in
4233 ' ') dlist='';;
4234 '') dlist="$loclibpth $plibpth $glibpth";;
4235 *) dlist="$libpth";;
4236 esac
4237
4238 : Now check and see which directories actually exist, avoiding duplicates
4239 libpth=''
4240 for xxx in $dlist
4241 do
4242     if $test -d $xxx; then
4243                 case " $libpth " in
4244                 *" $xxx "*) ;;
4245                 *) libpth="$libpth $xxx";;
4246                 esac
4247     fi
4248 done
4249 $cat <<'EOM'
4250
4251 Some systems have incompatible or broken versions of libraries.  Among
4252 the directories listed in the question below, please remove any you
4253 know not to be holding relevant libraries, and add any that are needed.
4254 Say "none" for none.
4255
4256 EOM
4257 case "$libpth" in
4258 '') dflt='none';;
4259 *)
4260         set X $libpth
4261         shift
4262         dflt=${1+"$@"}
4263         ;;
4264 esac
4265 rp="Directories to use for library searches?"
4266 . ./myread
4267 case "$ans" in
4268 none) libpth=' ';;
4269 *) libpth="$ans";;
4270 esac
4271
4272 : compute shared library extension
4273 case "$so" in
4274 '')
4275         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4276                 dflt='sl'
4277         else
4278                 dflt='so'
4279         fi
4280         ;;
4281 *) dflt="$so";;
4282 esac
4283 $cat <<EOM
4284
4285 On some systems, shared libraries may be available.  Answer 'none' if
4286 you want to suppress searching of shared libraries for the remainder
4287 of this configuration.
4288
4289 EOM
4290 rp='What is the file extension used for shared libraries?'
4291 . ./myread
4292 so="$ans"
4293
4294 : Define several unixisms.
4295 : Hints files or command line option can be used to override them.
4296 : The convoluted testing is in case hints files set either the old
4297 : or the new name.
4298 case "$_exe" in
4299 '')     case "$exe_ext" in
4300         '')     ;;
4301         *)      _exe="$exe_ext" ;;
4302         esac
4303         ;;
4304 esac
4305 case "$_a" in
4306 '')     case "$lib_ext" in
4307     '') _a='.a';;
4308         *)      _a="$lib_ext" ;;
4309         esac
4310         ;;
4311 esac
4312 case "$_o" in
4313 '') case "$obj_ext" in
4314         '')     _o='.o';;
4315         *)      _o="$obj_ext";;
4316         esac
4317         ;;
4318 esac
4319 case "$p_" in
4320 '') case "$path_sep" in
4321         '')     p_=':';;
4322         *)      p_="$path_sep";;
4323         esac
4324         ;;
4325 esac
4326 exe_ext=$_exe
4327 lib_ext=$_a
4328 obj_ext=$_o
4329 path_sep=$p_
4330
4331 : Which makefile gets called first.  This is used by make depend.
4332 case "$firstmakefile" in
4333 '') firstmakefile='makefile';;
4334 esac
4335
4336 case "$usesocks" in
4337 $define|true|[yY]*)     dflt='y';;
4338 *) dflt='n';;
4339 esac
4340 cat <<EOM
4341
4342 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4343 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4344 to use the PerlIO abstraction layer, this will be implicitly selected.
4345
4346 If this doesn't make any sense to you, just accept the default '$dflt'.
4347 EOM
4348 rp='Build Perl for SOCKS?'
4349 . ./myread
4350 case "$ans" in
4351 y|Y)    val="$define" ;;     
4352 *)      val="$undef" ;;
4353 esac
4354 set usesocks
4355 eval $setvar
4356
4357 case "$usesocks" in
4358 $define|true|[yY]*) useperlio="$define";;
4359 esac
4360
4361 : Looking for optional libraries
4362 echo " "
4363 echo "Checking for optional libraries..." >&4
4364 case "$libs" in
4365 ' '|'') dflt='';;
4366 *) dflt="$libs";;
4367 esac
4368 case "$libswanted" in
4369 '') libswanted='c_s';;
4370 esac
4371 case "$usesocks" in
4372 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4373 esac
4374 libsfound=''
4375 libsfiles=''
4376 libsdirs=''
4377 libspath=''
4378 for thisdir in $libpth $xlibpth; do
4379   test -d $thisdir && libspath="$libspath $thisdir"
4380 done
4381 for thislib in $libswanted; do
4382         for thisdir in $libspath; do
4383             xxx=''
4384             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4385                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4386                 $test -f "$xxx" && eval $libscheck
4387                 $test -f "$xxx" && libstyle=shared
4388             fi
4389             if test ! -f "$xxx"; then
4390                 xxx=$thisdir/lib$thislib.$so
4391                 $test -f "$xxx" && eval $libscheck
4392                 $test -f "$xxx" && libstyle=shared
4393             fi  
4394             if test ! -f "$xxx"; then
4395                 xxx=$thisdir/lib$thislib$_a
4396                 $test -f "$xxx" && eval $libscheck
4397                 $test -f "$xxx" && libstyle=static
4398             fi
4399             if test ! -f "$xxx"; then
4400                 xxx=$thisdir/$thislib$_a
4401                 $test -f "$xxx" && eval $libscheck
4402                 $test -f "$xxx" && libstyle=static
4403             fi
4404             if test ! -f "$xxx"; then
4405                 xxx=$thisdir/lib${thislib}_s$_a
4406                 $test -f "$xxx" && eval $libscheck
4407                 $test -f "$xxx" && libstyle=static
4408                 $test -f "$xxx" && thislib=${thislib}_s
4409             fi
4410             if test ! -f "$xxx"; then
4411                 xxx=$thisdir/Slib$thislib$_a
4412                 $test -f "$xxx" && eval $libscheck
4413                 $test -f "$xxx" && libstyle=static
4414             fi
4415             if $test -f "$xxx"; then
4416                 case "$libstyle" in
4417                 shared) echo "Found -l$thislib (shared)." ;;
4418                 static) echo "Found -l$thislib." ;;
4419                 *)      echo "Found -l$thislib ($libstyle)." ;;
4420                 esac
4421                 case " $dflt " in
4422                 *"-l$thislib "*);;
4423                 *) dflt="$dflt -l$thislib"
4424                    libsfound="$libsfound $xxx"
4425                    yyy=`basename $xxx`
4426                    libsfiles="$libsfiles $yyy"
4427                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4428                    case " $libsdirs " in
4429                    *" $yyy "*) ;;
4430                    *) libsdirs="$libsdirs $yyy" ;;
4431                    esac
4432                    ;;
4433                 esac
4434                 break
4435             fi  
4436         done
4437         if $test ! -f "$xxx"; then
4438             echo "No -l$thislib."
4439         fi
4440 done
4441 set X $dflt
4442 shift
4443 dflt="$*"
4444 case "$libs" in
4445 '') dflt="$dflt";;
4446 *) dflt="$libs";;
4447 esac
4448 case "$dflt" in
4449 ' '|'') dflt='none';;
4450 esac
4451
4452 $cat <<EOM
4453
4454 In order to compile $package on your machine, a number of libraries
4455 are usually needed.  Include any other special libraries here as well.
4456 Say "none" for none.  The default list is almost always right.
4457 EOM
4458
4459 echo " "
4460 rp="What libraries to use?"
4461 . ./myread
4462 case "$ans" in
4463 none) libs=' ';;
4464 *) libs="$ans";;
4465 esac
4466
4467 : determine optimization, if desired, or use for debug flag also
4468 case "$optimize" in
4469 ' '|$undef) dflt='none';;
4470 '') dflt='-O';;
4471 *) dflt="$optimize";;
4472 esac
4473 $cat <<EOH
4474
4475 By default, $package compiles with the -O flag to use the optimizer.
4476 Alternately, you might want to use the symbolic debugger, which uses
4477 the -g flag (on traditional Unix systems).  Either flag can be
4478 specified here.  To use neither flag, specify the word "none".
4479
4480 EOH
4481 rp="What optimizer/debugger flag should be used?"
4482 . ./myread
4483 optimize="$ans"
4484 case "$optimize" in
4485 'none') optimize=" ";;
4486 esac
4487
4488 dflt=''
4489 : We will not override a previous value, but we might want to
4490 : augment a hint file
4491 case "$hint" in
4492 default|recommended)
4493         case "$gccversion" in
4494         1*) dflt='-fpcc-struct-return' ;;
4495         esac
4496         case "$optimize" in
4497         *-g*) dflt="$dflt -DDEBUGGING";;
4498         esac
4499         case "$gccversion" in
4500         2*) if test -d /etc/conf/kconfig.d &&
4501                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4502                 then
4503                         dflt="$dflt -posix"
4504                 fi
4505                 ;;
4506         esac
4507         case "$gccversion" in
4508         1*) ;;
4509         2.[0-8]*) ;;
4510         ?*)     echo " "
4511                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4512                 echo 'int main(void) { return 0; }' > gcctest.c
4513                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4514                         echo "Yes, it does." 2>&1
4515                         case "$ccflags" in
4516                         *strict-aliasing*) 
4517                                 echo "Leaving current flags $ccflags alone." 2>&1
4518                                 ;;
4519                         *) dflt="$dflt -fno-strict-aliasing" ;;
4520                         esac
4521                 else
4522                         echo "Nope, it doesn't, but that's ok." 2>&1
4523                 fi
4524                 ;;
4525         esac
4526         ;;
4527 esac
4528
4529 case "$mips_type" in
4530 *BSD*|'') inclwanted="$locincpth $usrinc";;
4531 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4532 esac
4533 for thisincl in $inclwanted; do
4534         if $test -d $thisincl; then
4535                 if $test x$thisincl != x$usrinc; then
4536                         case "$dflt" in
4537                         *" -I$thisincl "*);;
4538                         *) dflt="$dflt -I$thisincl ";;
4539                         esac
4540                 fi
4541         fi
4542 done
4543
4544 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4545         xxx=true;
4546 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4547         xxx=true;
4548 else
4549         xxx=false;
4550 fi;
4551 if $xxx; then
4552         case "$dflt" in
4553         *$2*);;
4554         *) dflt="$dflt -D$2";;
4555         esac;
4556 fi'
4557
4558 set signal.h LANGUAGE_C; eval $inctest
4559
4560 case "$usesocks" in
4561 $define)
4562         ccflags="$ccflags -DSOCKS"
4563         ;;
4564 esac
4565
4566 case "$hint" in
4567 default|recommended) dflt="$ccflags $dflt" ;;
4568 *) dflt="$ccflags";;
4569 esac
4570
4571 case "$dflt" in
4572 ''|' ') dflt=none;;
4573 esac
4574
4575 $cat <<EOH
4576
4577 Your C compiler may want other flags.  For this question you should include
4578 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4579 but you should NOT include libraries or ld flags like -lwhatever.  If you
4580 want $package to honor its debug switch, you should include -DDEBUGGING here.
4581 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4582
4583 To use no flags, specify the word "none".
4584
4585 EOH
4586 set X $dflt
4587 shift
4588 dflt=${1+"$@"}
4589 rp="Any additional cc flags?"
4590 . ./myread
4591 case "$ans" in
4592 none) ccflags='';;
4593 *) ccflags="$ans";;
4594 esac
4595
4596 : the following weeds options from ccflags that are of no interest to cpp
4597 case "$cppflags" in
4598 '') cppflags="$ccflags" ;;
4599 *)  cppflags="$cppflags $ccflags" ;;
4600 esac
4601 case "$gccversion" in
4602 1*) cppflags="$cppflags -D__GNUC__"
4603 esac
4604 case "$mips_type" in
4605 '');;
4606 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4607 esac
4608 case "$cppflags" in
4609 '');;
4610 *)
4611         echo " "
4612         echo "Let me guess what the preprocessor flags are..." >&4
4613         set X $cppflags
4614         shift
4615         cppflags=''
4616         $cat >cpp.c <<'EOM'
4617 #define BLURFL foo
4618
4619 BLURFL xx LFRULB
4620 EOM
4621         previous=''
4622         for flag in $*
4623         do
4624                 case "$flag" in
4625                 -*) ftry="$flag";;
4626                 *) ftry="$previous $flag";;
4627                 esac
4628                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4629                         >cpp1.out 2>/dev/null && \
4630                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4631                         >cpp2.out 2>/dev/null && \
4632                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4633                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4634                 then
4635                         cppflags="$cppflags $ftry"
4636                         previous=''
4637                 else
4638                         previous="$flag"
4639                 fi
4640         done
4641         set X $cppflags
4642         shift
4643         cppflags=${1+"$@"}
4644         case "$cppflags" in
4645         *-*)  echo "They appear to be: $cppflags";;
4646         esac
4647         $rm -f cpp.c cpp?.out
4648         ;;
4649 esac
4650
4651 : flags used in final linking phase
4652 case "$ldflags" in
4653 '') if ./venix; then
4654                 dflt='-i -z'
4655         else
4656                 dflt=''
4657         fi
4658         case "$ccflags" in
4659         *-posix*) dflt="$dflt -posix" ;;
4660         esac
4661         ;;
4662 *) dflt="$ldflags";;
4663 esac
4664
4665 : Try to guess additional flags to pick up local libraries.
4666 for thislibdir in $libpth; do
4667         case " $loclibpth " in
4668         *" $thislibdir "*)
4669                 case "$dflt " in 
4670                 *"-L$thislibdir "*) ;;
4671                 *)  dflt="$dflt -L$thislibdir" ;;
4672                 esac
4673                 ;;
4674         esac
4675 done
4676
4677 case "$dflt" in
4678 '') dflt='none' ;;
4679 esac
4680
4681 $cat <<EOH
4682
4683 Your C linker may need flags.  For this question you should
4684 include -L/whatever and any other flags used by the C linker, but you
4685 should NOT include libraries like -lwhatever.
4686
4687 Make sure you include the appropriate -L/path flags if your C linker
4688 does not normally search all of the directories you specified above,
4689 namely
4690         $libpth
4691 To use no flags, specify the word "none".
4692
4693 EOH
4694
4695 rp="Any additional ld flags (NOT including libraries)?"
4696 . ./myread
4697 case "$ans" in
4698 none) ldflags='';;
4699 *) ldflags="$ans";;
4700 esac
4701 rmlist="$rmlist pdp11"
4702
4703 : coherency check
4704 echo " "
4705 echo "Checking your choice of C compiler and flags for coherency..." >&4
4706 $cat > try.c <<'EOF'
4707 #include <stdio.h>
4708 int main() { printf("Ok\n"); exit(0); }
4709 EOF
4710 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4711 shift
4712 $cat >try.msg <<'EOM'
4713 I've tried to compile and run the following simple program:
4714
4715 EOM
4716 $cat try.c >> try.msg
4717
4718 $cat >> try.msg <<EOM
4719
4720 I used the command:
4721
4722         $*
4723         $run ./try
4724
4725 and I got the following output:
4726
4727 EOM
4728 dflt=y
4729 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4730         if $sh -c "$run ./try" >>try.msg 2>&1; then
4731                 xxx=`$run ./try`
4732                 case "$xxx" in
4733                 "Ok") dflt=n ;;
4734                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4735                         case " $libs " in
4736                         *" -lsfio "*)
4737                                 cat >> try.msg <<'EOQS'
4738 If $libs contains -lsfio, and sfio is mis-configured, then it
4739 sometimes (apparently) runs and exits with a 0 status, but with no
4740 output!  It may have to do with sfio's use of _exit vs. exit.
4741
4742 EOQS
4743                                 rp="You have a big problem.  Shall I abort Configure"
4744                                 dflt=y
4745                                 ;;
4746                         esac
4747                         ;;
4748                 esac
4749         else
4750                 echo "The program compiled OK, but exited with status $?." >>try.msg
4751                 rp="You have a problem.  Shall I abort Configure"
4752                 dflt=y
4753         fi
4754 else
4755         echo "I can't compile the test program." >>try.msg
4756         rp="You have a BIG problem.  Shall I abort Configure"
4757         dflt=y
4758 fi
4759 case "$dflt" in
4760 y)
4761         $cat try.msg >&4
4762         case "$knowitall" in
4763         '')
4764                 echo "(The supplied flags or libraries might be incorrect.)"
4765                 ;;
4766         *) dflt=n;;
4767         esac
4768         echo " "
4769         . ./myread
4770         case "$ans" in
4771         n*|N*) ;;
4772         *)      echo "Ok.  Stopping Configure." >&4
4773                 exit 1
4774                 ;;
4775         esac
4776         ;;
4777 n) echo "OK, that should do.";;
4778 esac
4779 $rm -f try try.* core
4780
4781 : define a shorthand compile call
4782 compile='
4783 mc_file=$1;
4784 shift;
4785 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4786 : define a shorthand compile call for compilations that should be ok.
4787 compile_ok='
4788 mc_file=$1;
4789 shift;
4790 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4791
4792 : check for lengths of integral types
4793 echo " "
4794 case "$intsize" in
4795 '')
4796         echo "Checking to see how big your integers are..." >&4
4797         $cat >try.c <<'EOCP'
4798 #include <stdio.h>
4799 int main()
4800 {
4801         printf("intsize=%d;\n", (int)sizeof(int));
4802         printf("longsize=%d;\n", (int)sizeof(long));
4803         printf("shortsize=%d;\n", (int)sizeof(short));
4804         exit(0);
4805 }
4806 EOCP
4807         set try
4808         if eval $compile_ok && $run ./try > /dev/null; then
4809                 eval `$run ./try`
4810                 echo "Your integers are $intsize bytes long."
4811                 echo "Your long integers are $longsize bytes long."
4812                 echo "Your short integers are $shortsize bytes long."
4813         else
4814                 $cat >&4 <<EOM
4815 !
4816 Help! I can't compile and run the intsize test program: please enlighten me!
4817 (This is probably a misconfiguration in your system or libraries, and
4818 you really ought to fix it.  Still, I'll try anyway.)
4819 !
4820 EOM
4821                 dflt=4
4822                 rp="What is the size of an integer (in bytes)?"
4823                 . ./myread
4824                 intsize="$ans"
4825                 dflt=$intsize
4826                 rp="What is the size of a long integer (in bytes)?"
4827                 . ./myread
4828                 longsize="$ans"
4829                 dflt=2
4830                 rp="What is the size of a short integer (in bytes)?"
4831                 . ./myread
4832                 shortsize="$ans"
4833         fi
4834         ;;
4835 esac
4836 $rm -f try try.*
4837
4838 : check for void type
4839 echo " "
4840 echo "Checking to see how well your C compiler groks the void type..." >&4
4841 case "$voidflags" in
4842 '')
4843         $cat >try.c <<'EOCP'
4844 #if TRY & 1
4845 void sub() {
4846 #else
4847 sub() {
4848 #endif
4849         extern void moo();      /* function returning void */
4850         void (*goo)();          /* ptr to func returning void */
4851 #if TRY & 8
4852         void *hue;              /* generic ptr */
4853 #endif
4854 #if TRY & 2
4855         void (*foo[10])();
4856 #endif
4857
4858 #if TRY & 4
4859         if(goo == moo) {
4860                 exit(0);
4861         }
4862 #endif
4863         exit(0);
4864 }
4865 int main() { sub(); }
4866 EOCP
4867         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4868                 voidflags=$defvoidused
4869         echo "Good.  It appears to support void to the level $package wants.">&4
4870                 if $contains warning .out >/dev/null 2>&1; then
4871                         echo "However, you might get some warnings that look like this:"
4872                         $cat .out
4873                 fi
4874         else
4875 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4876                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4877                         echo "It supports 1..."
4878                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4879                                 echo "It also supports 2..."
4880                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4881                                         voidflags=7
4882                                         echo "And it supports 4 but not 8 definitely."
4883                                 else
4884                                         echo "It doesn't support 4..."
4885                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4886                                                 voidflags=11
4887                                                 echo "But it supports 8."
4888                                         else
4889                                                 voidflags=3
4890                                                 echo "Neither does it support 8."
4891                                         fi
4892                                 fi
4893                         else
4894                                 echo "It does not support 2..."
4895                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4896                                         voidflags=13
4897                                         echo "But it supports 4 and 8."
4898                                 else
4899                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4900                                                 voidflags=5
4901                                                 echo "And it supports 4 but has not heard about 8."
4902                                         else
4903                                                 echo "However it supports 8 but not 4."
4904                                         fi
4905                                 fi
4906                         fi
4907                 else
4908                         echo "There is no support at all for void."
4909                         voidflags=0
4910                 fi
4911         fi
4912 esac
4913 case "$voidflags" in
4914 "$defvoidused") ;;
4915 *)      $cat >&4 <<'EOM'
4916   Support flag bits are:
4917     1: basic void declarations.
4918     2: arrays of pointers to functions returning void.
4919     4: operations between pointers to and addresses of void functions.
4920     8: generic void pointers.
4921 EOM
4922         dflt="$voidflags";
4923         rp="Your void support flags add up to what?"
4924         . ./myread
4925         voidflags="$ans"
4926         ;;
4927 esac
4928 $rm -f try.* .out
4929
4930 : check for length of pointer
4931 echo " "
4932 case "$ptrsize" in
4933 '')
4934         echo "Checking to see how big your pointers are..." >&4
4935         if test "$voidflags" -gt 7; then
4936                 echo '#define VOID_PTR char *' > try.c
4937         else
4938                 echo '#define VOID_PTR void *' > try.c
4939         fi
4940         $cat >>try.c <<'EOCP'
4941 #include <stdio.h>
4942 int main()
4943 {
4944     printf("%d\n", (int)sizeof(VOID_PTR));
4945     exit(0);
4946 }
4947 EOCP
4948         set try
4949         if eval $compile_ok; then
4950                 ptrsize=`$run ./try`
4951                 echo "Your pointers are $ptrsize bytes long."
4952         else
4953                 dflt='4'
4954                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4955                 rp="What is the size of a pointer (in bytes)?"
4956                 . ./myread
4957                 ptrsize="$ans"
4958         fi
4959         ;;
4960 esac
4961 $rm -f try.c try
4962
4963 : check for long long
4964 echo " "
4965 echo "Checking to see if you have long long..." >&4
4966 echo 'int main() { long long x = 7; return 0; }' > try.c
4967 set try
4968 if eval $compile; then
4969         val="$define"
4970         echo "You have long long."
4971 else
4972         val="$undef"
4973         echo "You do not have long long."
4974 fi
4975 $rm try.*
4976 set d_longlong
4977 eval $setvar
4978
4979 : check for length of long long
4980 case "${d_longlong}${longlongsize}" in
4981 $define)
4982         echo " "
4983         echo "Checking to see how big your long longs are..." >&4
4984         $cat >try.c <<'EOCP'
4985 #include <stdio.h>
4986 int main()
4987 {
4988     printf("%d\n", (int)sizeof(long long));
4989     return(0);
4990 }
4991 EOCP
4992         set try
4993         if eval $compile_ok; then
4994                 longlongsize=`$run ./try`
4995                 echo "Your long longs are $longlongsize bytes long."
4996         else
4997                 dflt='8'
4998                 echo " "
4999                 echo "(I can't seem to compile the test program.  Guessing...)"
5000                 rp="What is the size of a long long (in bytes)?"
5001                 . ./myread
5002                 longlongsize="$ans"
5003         fi
5004         if $test "X$longsize" = "X$longlongsize"; then
5005                 echo "(That isn't any different from an ordinary long.)"
5006         fi      
5007         ;;
5008 esac
5009 $rm -f try.* try
5010
5011 : determine filename position in cpp output
5012 echo " "
5013 echo "Computing filename position in cpp output for #include directives..." >&4
5014 case "$osname" in
5015 vos) testaccess=-e ;;
5016 *)   testaccess=-r ;;
5017 esac
5018 echo '#include <stdio.h>' > foo.c
5019 $cat >fieldn <<EOF
5020 $startsh
5021 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5022 $grep '^[       ]*#.*stdio\.h' | \
5023 while read cline; do
5024         pos=1
5025         set \$cline
5026         while $test \$# -gt 0; do
5027                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5028                         echo "\$pos"
5029                         exit 0
5030                 fi
5031                 shift
5032                 pos=\`expr \$pos + 1\`
5033         done
5034 done
5035 EOF
5036 chmod +x fieldn
5037 fieldn=`./fieldn`
5038 $rm -f foo.c fieldn
5039 case $fieldn in
5040 '') pos='???';;
5041 1) pos=first;;
5042 2) pos=second;;
5043 3) pos=third;;
5044 *) pos="${fieldn}th";;
5045 esac
5046 echo "Your cpp writes the filename in the $pos field of the line."
5047
5048 case "$osname" in
5049 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5050 *)   cppfilter='' ;;
5051 esac
5052 : locate header file
5053 $cat >findhdr <<EOF
5054 $startsh
5055 wanted=\$1
5056 name=''
5057 for usrincdir in $usrinc
5058 do
5059         if test -f \$usrincdir/\$wanted; then
5060                 echo "\$usrincdir/\$wanted"
5061                 exit 0
5062         fi
5063 done
5064 awkprg='{ print \$$fieldn }'
5065 echo "#include <\$wanted>" > foo\$\$.c
5066 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5067 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5068 while read cline; do
5069         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5070         case "\$name" in
5071         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5072         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5073         *) exit 2;;
5074         esac;
5075 done;
5076 #
5077 # status = 0: grep returned 0 lines, case statement not executed
5078 # status = 1: headerfile found
5079 # status = 2: while loop executed, no headerfile found
5080 #
5081 status=\$?
5082 $rm -f foo\$\$.c;
5083 if test \$status -eq 1; then
5084         exit 0;
5085 fi
5086 exit 1
5087 EOF
5088 chmod +x findhdr
5089
5090 : define an alternate in-header-list? function
5091 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5092 cont=true; xxf="echo \"<\$1> found.\" >&4";
5093 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5094 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5095 esac;
5096 case $# in 4) instead=instead;; *) instead="at last";; esac;
5097 while $test "$cont"; do
5098         xxx=`./findhdr $1`
5099         var=$2; eval "was=\$$2";
5100         if $test "$xxx" && $test -r "$xxx";
5101         then eval $xxf;
5102         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5103                 cont="";
5104         else eval $xxnf;
5105         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5106         set $yyy; shift; shift; yyy=$@;
5107         case $# in 0) cont="";;
5108         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5109                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5110         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5111                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5112         esac;
5113 done;
5114 while $test "$yyy";
5115 do set $yyy; var=$2; eval "was=\$$2";
5116         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5117         set $yyy; shift; shift; yyy=$@;
5118 done'
5119
5120 : see if inttypes.h is available
5121 : we want a real compile instead of Inhdr because some systems
5122 : have an inttypes.h which includes non-existent headers
5123 echo " "
5124 $cat >try.c <<EOCP
5125 #include <inttypes.h>
5126 int main() {
5127         static int32_t foo32 = 0x12345678;
5128 }
5129 EOCP
5130 set try
5131 if eval $compile; then
5132         echo "<inttypes.h> found." >&4
5133         val="$define"
5134 else
5135         echo "<inttypes.h> NOT found." >&4
5136         val="$undef"
5137 fi
5138 $rm -f try.c try
5139 set i_inttypes
5140 eval $setvar
5141
5142 : check for int64_t
5143 echo " "
5144 echo "Checking to see if you have int64_t..." >&4
5145 $cat >try.c <<EOCP
5146 #include <sys/types.h>
5147 #$i_inttypes I_INTTYPES
5148 #ifdef I_INTTYPES
5149 #include <inttypes.h>
5150 #endif
5151 int main() { int64_t x = 7; }
5152 EOCP
5153 set try
5154 if eval $compile; then
5155         val="$define"
5156         echo "You have int64_t."
5157 else
5158         val="$undef"
5159         echo "You do not have int64_t."
5160 fi
5161 $rm -f try try.*
5162 set d_int64_t
5163 eval $setvar
5164
5165
5166 echo " "
5167 echo "Checking which 64-bit integer type we could use..." >&4
5168
5169 case "$intsize" in
5170 8) val=int
5171    set quadtype
5172    eval $setvar
5173    val='"unsigned int"'
5174    set uquadtype
5175    eval $setvar
5176    quadkind=1
5177    ;;
5178 *) case "$longsize" in
5179    8) val=long
5180       set quadtype
5181       eval $setvar
5182       val='"unsigned long"'
5183       set uquadtype
5184       eval $setvar
5185       quadkind=2
5186       ;;
5187    *) case "$d_longlong:$longlongsize" in
5188       define:8)
5189         val='"long long"'
5190         set quadtype
5191         eval $setvar
5192         val='"unsigned long long"'
5193         set uquadtype
5194         eval $setvar
5195         quadkind=3
5196         ;;
5197       *) case "$d_int64_t" in
5198          define)
5199            val=int64_t
5200            set quadtype
5201            eval $setvar
5202            val=uint64_t
5203            set uquadtype
5204            eval $setvar
5205            quadkind=4
5206            ;;
5207          esac
5208          ;;
5209       esac
5210       ;;
5211    esac
5212    ;;
5213 esac
5214
5215 case "$quadtype" in
5216 '')     echo "Alas, no 64-bit integer types in sight." >&4
5217         d_quad="$undef"
5218         ;;
5219 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5220         d_quad="$define"
5221         ;;
5222 esac
5223
5224
5225 case "$uselonglong" in
5226 "$define"|true|[yY]*)
5227         cat <<EOM >&4
5228
5229 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5230 EOM
5231         use64bitint="$define"
5232         ;;
5233 esac                          
5234 case "$use64bits" in
5235 "$define"|true|[yY]*)
5236         cat <<EOM >&4
5237
5238 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5239 EOM
5240         use64bitint="$define"
5241         ;;
5242 esac                          
5243 case "$use64bitints" in
5244 "$define"|true|[yY]*)
5245         cat <<EOM >&4
5246
5247 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5248 EOM
5249         use64bitint="$define"
5250         ;;
5251 esac                          
5252 case "$use64bitsint" in
5253 "$define"|true|[yY]*)
5254         cat <<EOM >&4
5255
5256 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5257 EOM
5258         use64bitint="$define"
5259         ;;
5260 esac                          
5261 case "$uselonglongs" in
5262 "$define"|true|[yY]*)
5263         cat <<EOM >&4
5264
5265 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5266 EOM
5267         use64bitint="$define"
5268         ;;
5269 esac                          
5270 case "$use64bitsall" in
5271 "$define"|true|[yY]*)
5272         cat <<EOM >&4
5273
5274 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5275 EOM
5276         use64bitall="$define"
5277         ;;
5278 esac                          
5279
5280 case "$ccflags" in
5281 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5282 esac
5283 case "$use64bitall" in
5284 "$define"|true|[yY]*) use64bitint="$define" ;;
5285 esac
5286
5287 case "$longsize" in
5288 8) cat <<EOM
5289
5290 You have natively 64-bit long integers.
5291 EOM
5292    val="$define"
5293    ;;
5294 *) case "$use64bitint" in
5295    "$define"|true|[yY]*) dflt='y';;
5296    *) dflt='n';;
5297    esac
5298    case "$d_quad" in
5299    "$define") ;;
5300    *) dflt='n' ;;
5301    esac
5302    cat <<EOM
5303
5304 Perl can be built to take advantage of 64-bit integer types
5305 on some systems.  To do so, Configure can be run with -Duse64bitint.
5306 Choosing this option will most probably introduce binary incompatibilities.
5307
5308 If this doesn't make any sense to you, just accept the default '$dflt'.
5309 (The default has been chosen based on your configuration.)
5310 EOM
5311    rp='Try to use 64-bit integers, if available?'
5312    . ./myread
5313    case "$ans" in
5314    [yY]*) val="$define" ;;
5315    *)     val="$undef"  ;;
5316    esac
5317    ;;
5318 esac
5319 set use64bitint
5320 eval $setvar
5321
5322 case "$use64bitall" in
5323 "$define"|true|[yY]*) dflt='y' ;;
5324 *) case "$longsize" in
5325    8) dflt='y' ;;
5326    *) dflt='n' ;;
5327    esac
5328    ;;
5329 esac    
5330 cat <<EOM
5331
5332 You may also choose to try maximal 64-bitness.  It means using as much
5333 64-bitness as possible on the platform.  This in turn means even more
5334 binary incompatibilities.  On the other hand, your platform may not
5335 have any more 64-bitness available than what you already have chosen.
5336
5337 If this doesn't make any sense to you, just accept the default '$dflt'.
5338 (The default has been chosen based on your configuration.)
5339 EOM
5340 rp='Try to use maximal 64-bit support, if available?'
5341 . ./myread
5342 case "$ans" in
5343 [yY]*) val="$define" ;;
5344 *)     val="$undef"  ;;
5345 esac
5346 set use64bitall
5347 eval $setvar
5348 case "$use64bitall" in
5349 "$define")
5350         case "$use64bitint" in
5351         "$undef")
5352                 cat <<EOM
5353
5354 Since you have chosen a maximally 64-bit build, I'm also turning on
5355 the use of 64-bit integers.
5356 EOM
5357                 use64bitint="$define" ;;
5358         esac
5359         ;;
5360 esac
5361
5362 case "$use64bitall" in
5363 "$define"|true|[yY]*)
5364         case "$ptrsize" in
5365         4)      cat <<EOM >&4
5366
5367 *** You have chosen a maximally 64-bit build, but your pointers
5368 *** are only 4 bytes wide, disabling maximal 64-bitness.
5369
5370 EOM
5371                 use64bitall="$undef"
5372                 case "$use64bitint" in
5373                 "$define"|true|[yY]*) ;;
5374                 *)      cat <<EOM >&4
5375
5376 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5377
5378 EOM
5379                         use64bitint="$define"
5380                         ;;
5381                 esac
5382                 ;;
5383         esac
5384         ;;
5385 esac
5386
5387 case "$use64bitint" in
5388 "$define"|true|[yY]*)
5389 : Look for a hint-file generated 'call-back-unit'.  If the
5390 : user has specified that a 64-bit perl is to be built,
5391 : we may need to set or change some other defaults.
5392         if $test -f use64bitint.cbu; then
5393                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5394                 . ./use64bitint.cbu
5395         fi
5396         case "$longsize" in
5397         4) case "$archname64" in
5398            '') archname64=64int ;;
5399            esac
5400            ;;
5401         esac
5402         ;;
5403 esac
5404
5405 case "$use64bitall" in
5406 "$define"|true|[yY]*)
5407 : Look for a hint-file generated 'call-back-unit'.  If the
5408 : user has specified that a maximally 64-bit perl is to be built,
5409 : we may need to set or change some other defaults.
5410         if $test -f use64bitall.cbu; then
5411                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5412                 . ./use64bitall.cbu
5413         fi
5414         case "$longsize" in
5415         4) case "$archname64" in
5416            ''|64int) archname64=64all ;;
5417            esac
5418            ;;
5419         esac
5420         ;;
5421 esac
5422
5423 echo " "
5424 echo "Checking for GNU C Library..." >&4
5425 cat >try.c <<EOM
5426 #include <stdio.h>
5427 int main()
5428 {
5429 #ifdef __GLIBC__
5430     exit(0);
5431 #else
5432     exit(1);
5433 #endif
5434 }
5435 EOM
5436 set try
5437 if eval $compile_ok && $run ./try; then
5438         val="$define"
5439         echo "You are using the GNU C Library"
5440 else
5441         val="$undef"
5442         echo "You are not using the GNU C Library"
5443 fi
5444 $rm -f try try.*
5445 set d_gnulibc
5446 eval $setvar
5447
5448 : see if nm is to be used to determine whether a symbol is defined or not
5449 case "$usenm" in
5450 '')
5451         dflt=''
5452         case "$d_gnulibc" in
5453         "$define")
5454                 echo " "
5455                 echo "nm probably won't work on the GNU C Library." >&4
5456                 dflt=n
5457                 ;;
5458         esac
5459         case "$dflt" in
5460         '') 
5461                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5462                         echo " "
5463                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5464                         echo "'nm' won't be sufficient on this sytem." >&4
5465                         dflt=n
5466                 fi
5467                 ;;
5468         esac
5469         case "$dflt" in
5470         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5471                 if $test $dflt -gt 20; then
5472                         dflt=y
5473                 else
5474                         dflt=n
5475                 fi
5476                 ;;
5477         esac
5478         ;;
5479 *)
5480         case "$usenm" in
5481         true|$define) dflt=y;;
5482         *) dflt=n;;
5483         esac
5484         ;;
5485 esac
5486 $cat <<EOM
5487
5488 I can use $nm to extract the symbols from your C libraries. This
5489 is a time consuming task which may generate huge output on the disk (up
5490 to 3 megabytes) but that should make the symbols extraction faster. The
5491 alternative is to skip the 'nm' extraction part and to compile a small
5492 test program instead to determine whether each symbol is present. If
5493 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5494 this may be the best solution.
5495
5496 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5497
5498 EOM
5499 rp="Shall I use $nm to extract C symbols from the libraries?"
5500 . ./myread
5501 case "$ans" in
5502 [Nn]*) usenm=false;;
5503 *) usenm=true;;
5504 esac
5505
5506 runnm=$usenm
5507 case "$reuseval" in
5508 true) runnm=false;;
5509 esac
5510
5511 : nm options which may be necessary
5512 case "$nm_opt" in
5513 '') if $test -f /mach_boot; then
5514                 nm_opt=''       # Mach
5515         elif $test -d /usr/ccs/lib; then
5516                 nm_opt='-p'     # Solaris (and SunOS?)
5517         elif $test -f /dgux; then
5518                 nm_opt='-p'     # DG-UX
5519         elif $test -f /lib64/rld; then
5520                 nm_opt='-p'     # 64-bit Irix
5521         else
5522                 nm_opt=''
5523         fi;;
5524 esac
5525
5526 : nm options which may be necessary for shared libraries but illegal
5527 : for archive libraries.  Thank you, Linux.
5528 case "$nm_so_opt" in
5529 '')     case "$myuname" in
5530         *linux*)
5531                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5532                         nm_so_opt='--dynamic'
5533                 fi
5534                 ;;
5535         esac
5536         ;;
5537 esac
5538
5539 case "$runnm" in
5540 true)
5541 : get list of predefined functions in a handy place
5542 echo " "
5543 case "$libc" in
5544 '') libc=unknown
5545         case "$libs" in
5546         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5547         esac
5548         ;;
5549 esac
5550 case "$libs" in
5551 '') ;;
5552 *)  for thislib in $libs; do
5553         case "$thislib" in
5554         -lc|-lc_s)
5555                 : Handle C library specially below.
5556                 ;;
5557         -l*)
5558                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5559                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5560                         :
5561                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5562                         :
5563                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5564                         :
5565                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5566                         :
5567                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5568                         :
5569                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5570                         :
5571                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5572                         :
5573                 else
5574                         try=''
5575                 fi
5576                 libnames="$libnames $try"
5577                 ;;
5578         *) libnames="$libnames $thislib" ;;
5579         esac
5580         done
5581         ;;
5582 esac
5583 xxx=normal
5584 case "$libc" in
5585 unknown)
5586         set /lib/libc.$so
5587         for xxx in $libpth; do
5588                 $test -r $1 || set $xxx/libc.$so
5589                 : The messy sed command sorts on library version numbers.
5590                 $test -r $1 || \
5591                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5592                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5593                                 h
5594                                 s/[0-9][0-9]*/0000&/g
5595                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5596                                 G
5597                                 s/\n/ /' | \
5598                          $sort | $sed -e 's/^.* //'`
5599                 eval set \$$#
5600         done
5601         $test -r $1 || set /usr/ccs/lib/libc.$so
5602         $test -r $1 || set /lib/libsys_s$_a
5603         ;;
5604 *)
5605         set blurfl
5606         ;;
5607 esac
5608 if $test -r "$1"; then
5609         echo "Your (shared) C library seems to be in $1."
5610         libc="$1"
5611 elif $test -r /lib/libc && $test -r /lib/clib; then
5612         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5613         xxx=apollo
5614         libc='/lib/clib /lib/libc'
5615         if $test -r /lib/syslib; then
5616                 echo "(Your math library is in /lib/syslib.)"
5617                 libc="$libc /lib/syslib"
5618         fi
5619 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5620         echo "Your C library seems to be in $libc, as you said before."
5621 elif $test -r $incpath/usr/lib/libc$_a; then
5622         libc=$incpath/usr/lib/libc$_a;
5623         echo "Your C library seems to be in $libc.  That's fine."
5624 elif $test -r /lib/libc$_a; then
5625         libc=/lib/libc$_a;
5626         echo "Your C library seems to be in $libc.  You're normal."
5627 else
5628         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5629                 :
5630         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5631                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5632         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5633                 :
5634         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5635                 :
5636         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5637                 :
5638         else
5639                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5640         fi
5641         if $test -r "$tans"; then
5642                 echo "Your C library seems to be in $tans, of all places."
5643                 libc=$tans
5644         else
5645                 libc='blurfl'
5646         fi
5647 fi
5648 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5649         dflt="$libc"
5650         cat <<EOM
5651
5652 If the guess above is wrong (which it might be if you're using a strange
5653 compiler, or your machine supports multiple models), you can override it here.
5654
5655 EOM
5656 else
5657         dflt=''
5658         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5659         cat >&4 <<EOM
5660 I can't seem to find your C library.  I've looked in the following places:
5661
5662 EOM
5663         $sed 's/^/      /' libpath
5664         cat <<EOM
5665
5666 None of these seems to contain your C library. I need to get its name...
5667
5668 EOM
5669 fi
5670 fn=f
5671 rp='Where is your C library?'
5672 . ./getfile
5673 libc="$ans"
5674
5675 echo " "
5676 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5677 set X `cat libnames`
5678 shift
5679 xxx=files
5680 case $# in 1) xxx=file; esac
5681 echo "Extracting names from the following $xxx for later perusal:" >&4
5682 echo " "
5683 $sed 's/^/      /' libnames >&4
5684 echo " "
5685 $echo $n "This may take a while...$c" >&4
5686
5687 for file in $*; do
5688         case $file in
5689         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5690         *) $nm $nm_opt $file 2>/dev/null;;
5691         esac
5692 done >libc.tmp
5693
5694 $echo $n ".$c"
5695 $grep fprintf libc.tmp > libc.ptf
5696 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5697 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5698 xxx='[ADTSIW]'
5699 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5700         eval $xscan;\
5701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5702                 eval $xrun
5703 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5704         eval $xscan;\
5705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706                 eval $xrun
5707 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5708         eval $xscan;\
5709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710                 eval $xrun
5711 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5724                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 else
5757         $nm -p $* 2>/dev/null >libc.tmp
5758         $grep fprintf libc.tmp > libc.ptf
5759         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5760                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5761         then
5762                 nm_opt='-p'
5763                 eval $xrun
5764         else
5765                 echo " "
5766                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5767                 com=''
5768                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5769                         for thisname in $libnames $libc; do
5770                                 $ar t $thisname >>libc.tmp
5771                         done
5772                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5773                         echo "Ok." >&4
5774                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5775                         # Repeat libc to extract forwarders to DLL entries too
5776                         for thisname in $libnames $libc; do
5777                                 $ar tv $thisname >>libc.tmp
5778                                 # Revision 50 of EMX has bug in $ar.
5779                                 # it will not extract forwarders to DLL entries
5780                                 # Use emximp which will extract exactly them.
5781                                 emximp -o tmp.imp $thisname \
5782                                     2>/dev/null && \
5783                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5784                                     < tmp.imp >>libc.tmp
5785                                 $rm tmp.imp
5786                         done
5787                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5788                         echo "Ok." >&4
5789                 else
5790                         echo "$ar didn't seem to work right." >&4
5791                         echo "Maybe this is a Cray...trying bld instead..." >&4
5792                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5793                         then
5794                                 for thisname in $libnames; do
5795                                         bld t $libnames | \
5796                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5797                                         $ar t $thisname >>libc.tmp
5798                                 done
5799                                 echo "Ok." >&4
5800                         else
5801                                 echo "That didn't work either.  Giving up." >&4
5802                                 exit 1
5803                         fi
5804                 fi
5805         fi
5806 fi
5807 nm_extract="$com"
5808 if $test -f /lib/syscalls.exp; then
5809         echo " "
5810         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5811         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5812 fi
5813 ;;
5814 esac
5815 $rm -f libnames libpath
5816
5817 : is a C symbol defined?
5818 csym='tlook=$1;
5819 case "$3" in
5820 -v) tf=libc.tmp; tc=""; tdc="";;
5821 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5822 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5823 esac;
5824 tx=yes;
5825 case "$reuseval-$4" in
5826 true-) ;;
5827 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5828 esac;
5829 case "$tx" in
5830 yes)
5831         case "$runnm" in
5832         true)
5833                 if $contains $tlook $tf >/dev/null 2>&1;
5834                 then tval=true;
5835                 else tval=false;
5836                 fi;;
5837         *)
5838                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5839                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5840                 then tval=true;
5841                 else tval=false;
5842                 fi;
5843                 $rm -f t t.c;;
5844         esac;;
5845 *)
5846         case "$tval" in
5847         $define) tval=true;;
5848         *) tval=false;;
5849         esac;;
5850 esac;
5851 eval "$2=$tval"'
5852
5853 : define an is-in-libc? function
5854 inlibc='echo " "; td=$define; tu=$undef;
5855 sym=$1; var=$2; eval "was=\$$2";
5856 tx=yes;
5857 case "$reuseval$was" in
5858 true) ;;
5859 true*) tx=no;;
5860 esac;
5861 case "$tx" in
5862 yes)
5863         set $sym tres -f;
5864         eval $csym;
5865         case "$tres" in
5866         true)
5867                 echo "$sym() found." >&4;
5868                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5869         *)
5870                 echo "$sym() NOT found." >&4;
5871                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5872         esac;;
5873 *)
5874         case "$was" in
5875         $define) echo "$sym() found." >&4;;
5876         *) echo "$sym() NOT found." >&4;;
5877         esac;;
5878 esac'
5879
5880 : see if sqrtl exists
5881 set sqrtl d_sqrtl
5882 eval $inlibc
5883
5884 : check for length of double
5885 echo " "
5886 case "$doublesize" in
5887 '')
5888         echo "Checking to see how big your double precision numbers are..." >&4
5889         $cat >try.c <<'EOCP'
5890 #include <stdio.h>
5891 int main()
5892 {
5893     printf("%d\n", (int)sizeof(double));
5894     exit(0);
5895 }
5896 EOCP
5897         set try
5898         if eval $compile_ok; then
5899                 doublesize=`$run ./try`
5900                 echo "Your double is $doublesize bytes long."
5901         else
5902                 dflt='8'
5903                 echo "(I can't seem to compile the test program.  Guessing...)"
5904                 rp="What is the size of a double precision number (in bytes)?"
5905                 . ./myread
5906                 doublesize="$ans"
5907         fi
5908         ;;
5909 esac
5910 $rm -f try.c try
5911
5912 : check for long doubles
5913 echo " "
5914 echo "Checking to see if you have long double..." >&4
5915 echo 'int main() { long double x = 7.0; }' > try.c
5916 set try
5917 if eval $compile; then
5918         val="$define"
5919         echo "You have long double."
5920 else
5921         val="$undef"
5922         echo "You do not have long double."
5923 fi
5924 $rm try.*
5925 set d_longdbl
5926 eval $setvar
5927
5928 : check for length of long double
5929 case "${d_longdbl}${longdblsize}" in
5930 $define)
5931         echo " "
5932         echo "Checking to see how big your long doubles are..." >&4
5933         $cat >try.c <<'EOCP'
5934 #include <stdio.h>
5935 int main()
5936 {
5937         printf("%d\n", sizeof(long double));
5938 }
5939 EOCP
5940         set try
5941         set try
5942         if eval $compile; then
5943                 longdblsize=`$run ./try`
5944                 echo "Your long doubles are $longdblsize bytes long."
5945         else
5946                 dflt='8'
5947                 echo " "
5948                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5949                 rp="What is the size of a long double (in bytes)?"
5950                 . ./myread
5951                 longdblsize="$ans"
5952         fi
5953         if $test "X$doublesize" = "X$longdblsize"; then
5954                 echo "(That isn't any different from an ordinary double.)"
5955         fi      
5956         ;;
5957 esac
5958 $rm -f try.* try
5959
5960 echo " "
5961
5962 if $test X"$d_longdbl" = X"$define"; then
5963
5964 echo "Checking how to print long doubles..." >&4
5965
5966 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5967         $cat >try.c <<'EOCP'
5968 #include <sys/types.h>
5969 #include <stdio.h>
5970 int main() {
5971   double d = 123.456;
5972   printf("%.3f\n", d);
5973 }
5974 EOCP
5975         set try
5976         if eval $compile; then
5977                 yyy=`$run ./try`
5978                 case "$yyy" in
5979                 123.456)
5980                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5981                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5982                         echo "We will use %f."
5983                         ;;
5984                 esac
5985         fi
5986 fi
5987
5988 if $test X"$sPRIfldbl" = X; then
5989         $cat >try.c <<'EOCP'
5990 #include <sys/types.h>
5991 #include <stdio.h>
5992 int main() {
5993   long double d = 123.456;
5994   printf("%.3Lf\n", d);
5995 }
5996 EOCP
5997         set try
5998         if eval $compile; then
5999                 yyy=`$run ./try`
6000                 case "$yyy" in
6001                 123.456)
6002                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6003                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6004                         echo "We will use %Lf."
6005                         ;;
6006                 esac
6007         fi
6008 fi
6009
6010 if $test X"$sPRIfldbl" = X; then
6011         $cat >try.c <<'EOCP'
6012 #include <sys/types.h>
6013 #include <stdio.h>
6014 int main() {
6015   long double d = 123.456;
6016   printf("%.3llf\n", d);
6017 }
6018 EOCP
6019         set try
6020         if eval $compile; then
6021                 yyy=`$run ./try`
6022                 case "$yyy" in
6023                 123.456)
6024                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6025                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6026                         echo "We will use %llf."
6027                         ;;
6028                 esac
6029         fi
6030 fi
6031
6032 if $test X"$sPRIfldbl" = X; then
6033         $cat >try.c <<'EOCP'
6034 #include <sys/types.h>
6035 #include <stdio.h>
6036 int main() {
6037   long double d = 123.456;
6038   printf("%.3lf\n", d);
6039 }
6040 EOCP
6041         set try
6042         if eval $compile; then
6043                 yyy=`$run ./try`
6044                 case "$yyy" in
6045                 123.456)
6046                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6047                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6048                         echo "We will use %lf."
6049                         ;;
6050                 esac
6051         fi
6052 fi
6053
6054 if $test X"$sPRIfldbl" = X; then
6055         echo "Cannot figure out how to print long doubles." >&4
6056 else
6057         sSCNfldbl=$sPRIfldbl    # expect consistency
6058 fi
6059
6060 $rm -f try try.*
6061
6062 fi # d_longdbl
6063
6064 case "$sPRIfldbl" in
6065 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6066         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6067         d_SCNfldbl="$undef";
6068         ;;
6069 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6070         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6071         d_SCNfldbl="$define";
6072         ;;
6073 esac
6074
6075 : see if modfl exists
6076 set modfl d_modfl
6077 eval $inlibc
6078
6079 d_modfl_pow32_bug="$undef"
6080
6081 case "$d_longdbl$d_modfl" in
6082 $define$define)
6083         $cat <<EOM
6084 Checking to see whether your modfl() is okay for large values...
6085 EOM
6086 $cat >try.c <<EOCP
6087 #include <math.h> 
6088 #include <stdio.h>
6089 int main() {
6090     long double nv = 4294967303.15;
6091     long double v, w;
6092     v = modfl(nv, &w);         
6093 #ifdef __GLIBC__
6094     printf("glibc");
6095 #endif
6096     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6097     return 0;
6098 }
6099 EOCP
6100         case "$osname:$gccversion" in
6101         aix:)   saveccflags="$ccflags"
6102                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6103         esac
6104         set try
6105         if eval $compile; then
6106                 foo=`$run ./try`
6107                 case "$foo" in
6108                 *" 4294967303.150000 1.150000 4294967302.000000")
6109                         echo >&4 "Your modfl() is broken for large values."
6110                         d_modfl_pow32_bug="$define"
6111                         case "$foo" in
6112                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6113                         ;;
6114                         esac
6115                         ;;
6116                 *" 4294967303.150000 0.150000 4294967303.000000")
6117                         echo >&4 "Your modfl() seems okay for large values."
6118                         ;;
6119                 *)      echo >&4 "I don't understand your modfl() at all."
6120                         d_modfl="$undef"
6121                         ;;
6122                 esac
6123                 $rm -f try.* try core core.try.*
6124         else
6125                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6126                 d_modfl="$undef"
6127         fi
6128         case "$osname:$gccversion" in
6129         aix:)   ccflags="$saveccflags" ;; # restore
6130         esac
6131         ;;
6132 esac
6133
6134 case "$ccflags" in
6135 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6136 esac
6137
6138 case "$uselongdouble" in
6139 $define|true|[yY]*)     dflt='y';;
6140 *) dflt='n';;
6141 esac
6142 cat <<EOM
6143
6144 Perl can be built to take advantage of long doubles which
6145 (if available) may give more accuracy and range for floating point numbers.
6146
6147 If this doesn't make any sense to you, just accept the default '$dflt'.
6148 EOM
6149 rp='Try to use long doubles if available?'
6150 . ./myread
6151 case "$ans" in
6152 y|Y)    val="$define"   ;;
6153 *)      val="$undef"    ;;
6154 esac
6155 set uselongdouble
6156 eval $setvar
6157
6158 case "$uselongdouble" in
6159 true|[yY]*) uselongdouble="$define" ;;
6160 esac
6161
6162 case "$uselongdouble" in
6163 $define)
6164 : Look for a hint-file generated 'call-back-unit'.  If the
6165 : user has specified that long doubles should be used,
6166 : we may need to set or change some other defaults.
6167         if $test -f uselongdouble.cbu; then
6168                 echo "Your platform has some specific hints for long doubles, using them..."
6169                 . ./uselongdouble.cbu
6170         else
6171                 $cat <<EOM
6172 (Your platform doesn't have any specific hints for long doubles.)
6173 EOM
6174         fi
6175         ;;
6176 esac
6177
6178 message=X
6179 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6180 $define:$define:$define)
6181         : You have both
6182         ;;
6183 $define:$define:$undef)
6184         message="I could not find modfl"
6185         ;;
6186 $define:$undef:$define)
6187         message="I could not find sqrtl"
6188         ;;
6189 $define:$undef:$undef)
6190         message="I found neither sqrtl nor modfl"
6191         ;;
6192 esac
6193
6194 if $test "$message" != X; then
6195         $cat <<EOM >&4
6196
6197 *** You requested the use of long doubles but you do not seem to have
6198 *** the mathematic functions for long doubles.
6199 *** ($message)
6200 *** I'm disabling the use of long doubles.
6201
6202 EOM
6203
6204         uselongdouble=$undef
6205 fi
6206
6207 case "$useperlio" in
6208 $define|true|[yY]*|'')  dflt='y';;
6209 *) dflt='n';;
6210 esac
6211 cat <<EOM
6212
6213 Previous version of $package used the standard IO mechanisms as
6214 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6215 alternate IO mechanisms via the PerlIO abstraction layer, but the
6216 stdio mechanism is still available if needed.  The abstraction layer
6217 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6218 Using PerlIO with sfio may cause problems with some extension modules.
6219
6220 If this doesn't make any sense to you, just accept the default '$dflt'.
6221 EOM
6222 rp='Use the PerlIO abstraction layer?'
6223 . ./myread
6224 case "$ans" in
6225 y|Y) 
6226         val="$define"
6227         ;;
6228 *)      
6229         echo "Ok, doing things the stdio way."
6230         val="$undef"
6231         ;;
6232 esac
6233 set useperlio
6234 eval $setvar 
6235
6236 case "$usesocks" in
6237 $define|true|[yY]*)
6238         case "$useperlio" in
6239         $define|true|[yY]*) ;;
6240         *)      cat >&4 <<EOM
6241
6242 You are using the SOCKS proxy protocol library which means that you
6243 should also use the PerlIO layer.  You may be headed for trouble.
6244
6245 EOM
6246                 ;;
6247         esac
6248         ;;
6249 esac
6250
6251         
6252 : determine the architecture name
6253 echo " "
6254 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6255         tarch=`arch`"-$osname"
6256 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6257         if uname -m > tmparch 2>&1 ; then
6258                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6259                         -e 's/$/'"-$osname/" tmparch`
6260         else
6261                 tarch="$osname"
6262         fi
6263         $rm -f tmparch
6264 else
6265         tarch="$osname"
6266 fi
6267 case "$myarchname" in
6268 ''|"$tarch") ;;
6269 *)
6270         echo "(Your architecture name used to be $myarchname.)"
6271         archname=''
6272         ;;
6273 esac
6274 case "$targetarch" in
6275 '') ;;
6276 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6277 esac
6278 myarchname="$tarch"
6279 case "$archname" in
6280 '') dflt="$tarch";;
6281 *) dflt="$archname";;
6282 esac
6283 rp='What is your architecture name'
6284 . ./myread
6285 archname="$ans"
6286 case "$usethreads" in
6287 $define)
6288         echo "Threads selected." >&4
6289         case "$archname" in
6290         *-thread*) echo "...and architecture name already has -thread." >&4
6291                 ;;
6292         *)      archname="$archname-thread"
6293                 echo "...setting architecture name to $archname." >&4
6294                 ;;
6295         esac
6296         ;;
6297 esac
6298 case "$usemultiplicity" in
6299 $define)
6300         echo "Multiplicity selected." >&4
6301         case "$archname" in
6302         *-multi*) echo "...and architecture name already has -multi." >&4
6303                 ;;
6304         *)      archname="$archname-multi"
6305                 echo "...setting architecture name to $archname." >&4
6306                 ;;
6307         esac
6308         ;;
6309 esac
6310 case "$use64bitint$use64bitall" in
6311 *"$define"*)
6312         case "$archname64" in
6313         '')
6314                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6315                 ;;
6316         *)
6317                 case "$use64bitint" in
6318                 "$define") echo "64 bit integers selected." >&4 ;;
6319                 esac
6320                 case "$use64bitall" in
6321                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6322                 esac
6323                 case "$archname" in
6324                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6325                         ;;
6326                 *)      archname="$archname-$archname64"
6327                         echo "...setting architecture name to $archname." >&4
6328                         ;;
6329                 esac
6330                 ;;
6331         esac
6332 esac
6333 case "$uselongdouble" in
6334 $define)
6335         echo "Long doubles selected." >&4
6336         case "$longdblsize" in
6337         $doublesize)
6338                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6339                 ;;
6340         *)
6341                 case "$archname" in
6342                 *-ld*) echo "...and architecture name already has -ld." >&4
6343                         ;;
6344                 *)      archname="$archname-ld"
6345                         echo "...setting architecture name to $archname." >&4
6346                         ;;
6347                 esac
6348                 ;;
6349         esac
6350         ;;
6351 esac
6352 case "$useperlio" in
6353 $define)
6354         echo "Perlio selected." >&4
6355         ;;
6356 *)
6357         echo "Perlio not selected, using stdio." >&4
6358         case "$archname" in
6359         *-stdio*) echo "...and architecture name already has -stdio." >&4
6360                 ;;
6361         *)      archname="$archname-stdio"
6362                 echo "...setting architecture name to $archname." >&4
6363                 ;;
6364         esac
6365         ;;
6366 esac
6367
6368 : determine root of directory hierarchy where package will be installed.
6369 case "$prefix" in
6370 '')
6371         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6372         ;;
6373 *)
6374         dflt="$prefix"
6375         ;;
6376 esac
6377 $cat <<EOM
6378
6379 By default, $package will be installed in $dflt/bin, manual pages
6380 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6381 installation directories. Typically this is something like /usr/local.
6382 If you wish to have binaries under /usr/bin but other parts of the
6383 installation under /usr/local, that's ok: you will be prompted
6384 separately for each of the installation directories, the prefix being
6385 only used to set the defaults.
6386
6387 EOM
6388 fn=d~
6389 rp='Installation prefix to use?'
6390 . ./getfile
6391 oldprefix=''
6392 case "$prefix" in
6393 '') ;;
6394 *)
6395         case "$ans" in
6396         "$prefix") ;;
6397         *) oldprefix="$prefix";;
6398         esac
6399         ;;
6400 esac
6401 prefix="$ans"
6402 prefixexp="$ansexp"
6403
6404 case "$afsroot" in
6405 '')     afsroot=/afs ;;
6406 *)      afsroot=$afsroot ;;
6407 esac
6408
6409 : is AFS running?
6410 echo " "
6411 case "$afs" in
6412 $define|true)   afs=true ;;
6413 $undef|false)   afs=false ;;
6414 *)      if test -d $afsroot; then
6415                 afs=true
6416         else
6417                 afs=false
6418         fi
6419         ;;
6420 esac
6421 if $afs; then
6422         echo "AFS may be running... I'll be extra cautious then..." >&4
6423 else
6424         echo "AFS does not seem to be running..." >&4
6425 fi
6426
6427 : determine installation prefix for where package is to be installed.
6428 if $afs; then 
6429 $cat <<EOM
6430
6431 Since you are running AFS, I need to distinguish the directory in which
6432 files will reside from the directory in which they are installed (and from
6433 which they are presumably copied to the former directory by occult means).
6434
6435 EOM
6436         case "$installprefix" in
6437         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6438         *) dflt="$installprefix";;
6439         esac
6440 else
6441 $cat <<EOM
6442
6443 In some special cases, particularly when building $package for distribution,
6444 it is convenient to distinguish between the directory in which files should 
6445 be installed from the directory ($prefix) in which they 
6446 will eventually reside.  For most users, these two directories are the same.
6447
6448 EOM
6449         case "$installprefix" in
6450         '') dflt=$prefix ;;
6451         *) dflt=$installprefix;;
6452         esac
6453 fi
6454 fn=d~
6455 rp='What installation prefix should I use for installing files?'
6456 . ./getfile
6457 installprefix="$ans"
6458 installprefixexp="$ansexp"
6459
6460 : set the prefixit variable, to compute a suitable default value
6461 prefixit='case "$3" in
6462 ""|none)
6463         case "$oldprefix" in
6464         "") eval "$1=\"\$$2\"";;
6465         *)
6466                 case "$3" in
6467                 "") eval "$1=";;
6468                 none)
6469                         eval "tp=\"\$$2\"";
6470                         case "$tp" in
6471                         ""|" ") eval "$1=\"\$$2\"";;
6472                         *) eval "$1=";;
6473                         esac;;
6474                 esac;;
6475         esac;;
6476 *)
6477         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6478         case "$tp" in
6479         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6480         /*-$oldprefix/*|\~*-$oldprefix/*)
6481                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6482         *) eval "$1=\"\$$2\"";;
6483         esac;;
6484 esac'
6485
6486 : get the patchlevel
6487 echo " "
6488 echo "Getting the current patchlevel..." >&4
6489 if $test -r $rsrc/patchlevel.h;then
6490         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6491         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6492         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6493         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6494         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6495         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6496        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6497 else
6498         revision=0
6499         patchlevel=0
6500         subversion=0
6501         api_revision=0
6502         api_version=0
6503         api_subversion=0
6504         perl_patchlevel=0
6505         $echo "(You do not have patchlevel.h.  Eek.)"
6506 fi
6507 if $test -r $rsrc/.patch ; then  
6508         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6509                 perl_patchlevel=`cat $rsrc/.patch`
6510         fi
6511 fi
6512 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6513 version_patchlevel_string="version $patchlevel subversion $subversion"
6514 case "$perl_patchlevel" in
6515 0|'') ;;
6516 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6517 esac
6518
6519 $echo "(You have $package $version_patchlevel_string.)"
6520
6521 case "$osname" in
6522 dos|vms)
6523         : XXX Should be a Configure test for double-dots in filenames.
6524         version=`echo $revision $patchlevel $subversion | \
6525                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6526         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6527                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6528         ;;
6529 *)
6530         version=`echo $revision $patchlevel $subversion | \
6531                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6532         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6533                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6534         ;;
6535 esac
6536 : Special case the 5.005_xx maintenance series, which used 5.005
6537 : without any subversion label as a subdirectory in $sitelib
6538 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6539         api_versionstring='5.005'
6540 fi
6541
6542 : determine installation style
6543 : For now, try to deduce it from prefix unless it is already set.
6544 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6545 case "$installstyle" in
6546 '')     case "$prefix" in
6547                 *perl*) dflt='lib';;
6548                 *) dflt='lib/perl5' ;;
6549         esac
6550         ;;
6551 *)      dflt="$installstyle" ;;
6552 esac
6553 : Probably not worth prompting for this since we prompt for all
6554 : the directories individually, and the prompt would be too long and
6555 : confusing anyway.
6556 installstyle=$dflt
6557
6558 : determine where private library files go
6559 : Usual default is /usr/local/lib/perl5/$version.
6560 : Also allow things like /opt/perl/lib/$version, since 
6561 : /opt/perl/lib/perl5... would be redundant.
6562 : The default "style" setting is made in installstyle.U
6563 case "$installstyle" in
6564 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6565 *)       set dflt privlib lib/$version ;;
6566 esac
6567 eval $prefixit
6568 $cat <<EOM
6569
6570 There are some auxiliary files for $package that need to be put into a
6571 private library directory that is accessible by everyone.
6572
6573 EOM
6574 fn=d~+
6575 rp='Pathname where the private library files will reside?'
6576 . ./getfile
6577 privlib="$ans"
6578 privlibexp="$ansexp"
6579 : Change installation prefix, if necessary.
6580 if $test X"$prefix" != X"$installprefix"; then
6581         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6582 else
6583         installprivlib="$privlibexp"
6584 fi
6585
6586 : set the prefixup variable, to restore leading tilda escape
6587 prefixup='case "$prefixexp" in
6588 "$prefix") ;;
6589 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6590 esac'
6591
6592 : determine where public architecture dependent libraries go
6593 set archlib archlib
6594 eval $prefixit
6595 : privlib default is /usr/local/lib/$package/$version
6596 : archlib default is /usr/local/lib/$package/$version/$archname
6597 : privlib may have an optional trailing /share.
6598 tdflt=`echo $privlib | $sed 's,/share$,,'`
6599 tdflt=$tdflt/$archname
6600 case "$archlib" in
6601 '')     dflt=$tdflt
6602         ;;
6603 *)      dflt="$archlib"
6604     ;;
6605 esac
6606 $cat <<EOM
6607
6608 $spackage contains architecture-dependent library files.  If you are
6609 sharing libraries in a heterogeneous environment, you might store
6610 these files in a separate location.  Otherwise, you can just include
6611 them with the rest of the public library files.
6612
6613 EOM
6614 fn=d+~
6615 rp='Where do you want to put the public architecture-dependent libraries?'
6616 . ./getfile
6617 archlib="$ans"
6618 archlibexp="$ansexp"
6619 if $test X"$archlib" = X"$privlib"; then
6620         d_archlib="$undef"
6621 else
6622         d_archlib="$define"
6623 fi
6624 : Change installation prefix, if necessary.
6625 if $test X"$prefix" != X"$installprefix"; then
6626         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6627 else
6628         installarchlib="$archlibexp"
6629 fi
6630
6631
6632 : Binary compatibility with 5.005 is not possible for builds
6633 : with advanced features
6634 case "$usethreads$usemultiplicity" in
6635 *define*)
6636         bincompat5005="$undef"
6637         d_bincompat5005="$undef"
6638         ;;
6639 *)      $cat <<EOM
6640
6641 This version of Perl can be compiled for binary compatibility with 5.005.
6642 If you decide to do so, you will be able to continue using most of the
6643 extensions that were compiled for Perl 5.005.
6644
6645 EOM
6646         case "$bincompat5005$d_bincompat5005" in
6647         *"$undef"*) dflt=n ;;
6648         *) dflt=y ;;
6649         esac
6650         rp='Binary compatibility with Perl 5.005?'
6651         . ./myread
6652         case "$ans" in
6653         y*) val="$define" ;;
6654         *)  val="$undef" ;;
6655         esac
6656         set d_bincompat5005
6657         eval $setvar
6658         case "$d_bincompat5005" in
6659         "$define")
6660                 bincompat5005="$define"
6661                 ;;
6662         *)      bincompat5005="$undef"
6663                 d_bincompat5005="$undef"
6664                 ;;
6665         esac
6666         ;;
6667 esac
6668
6669
6670 : see if setuid scripts can be secure
6671 $cat <<EOM
6672
6673 Some kernels have a bug that prevents setuid #! scripts from being
6674 secure.  Some sites have disabled setuid #! scripts because of this.
6675
6676 First let's decide if your kernel supports secure setuid #! scripts.
6677 (If setuid #! scripts would be secure but have been disabled anyway,
6678 don't say that they are secure if asked.)
6679
6680 EOM
6681
6682 val="$undef"
6683 if $test -d /dev/fd; then
6684         echo "#!$ls" >reflect
6685         chmod +x,u+s reflect
6686         ./reflect >flect 2>&1
6687         if $contains "/dev/fd" flect >/dev/null; then
6688                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6689                 val="$define"
6690         else
6691                 $cat <<EOM
6692 If you are not sure if they are secure, I can check but I'll need a
6693 username and password different from the one you are using right now.
6694 If you don't have such a username or don't want me to test, simply
6695 enter 'none'.
6696
6697 EOM
6698                 rp='Other username to test security of setuid scripts with?'
6699                 dflt='none'
6700                 . ./myread
6701                 case "$ans" in
6702                 n|none)
6703                         case "$d_suidsafe" in
6704                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6705                                 dflt=n;;
6706                         "$undef")
6707                                 echo "Well, the $hint value is *not* secure." >&4
6708                                 dflt=n;;
6709                         *)      echo "Well, the $hint value *is* secure." >&4
6710                                 dflt=y;;
6711                         esac
6712                         ;;
6713                 *)
6714                         $rm -f reflect flect
6715                         echo "#!$ls" >reflect
6716                         chmod +x,u+s reflect
6717                         echo >flect
6718                         chmod a+w flect
6719                         echo '"su" will (probably) prompt you for '"$ans's password."
6720                         su $ans -c './reflect >flect'
6721                         if $contains "/dev/fd" flect >/dev/null; then
6722                                 echo "Okay, it looks like setuid scripts are secure." >&4
6723                                 dflt=y
6724                         else
6725                                 echo "I don't think setuid scripts are secure." >&4
6726                                 dflt=n
6727                         fi
6728                         ;;
6729                 esac
6730                 rp='Does your kernel have *secure* setuid scripts?'
6731                 . ./myread
6732                 case "$ans" in
6733                 [yY]*)  val="$define";;
6734                 *)      val="$undef";;
6735                 esac
6736         fi
6737 else
6738         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6739         echo "(That's for file descriptors, not floppy disks.)"
6740         val="$undef"
6741 fi
6742 set d_suidsafe
6743 eval $setvar
6744
6745 $rm -f reflect flect
6746
6747 : now see if they want to do setuid emulation
6748 echo " "
6749 val="$undef"
6750 case "$d_suidsafe" in
6751 "$define")
6752         val="$undef"
6753         echo "No need to emulate SUID scripts since they are secure here." >&4
6754         ;;
6755 *)
6756         $cat <<EOM
6757 Some systems have disabled setuid scripts, especially systems where
6758 setuid scripts cannot be secure.  On systems where setuid scripts have
6759 been disabled, the setuid/setgid bits on scripts are currently
6760 useless.  It is possible for $package to detect those bits and emulate
6761 setuid/setgid in a secure fashion.  This emulation will only work if
6762 setuid scripts have been disabled in your kernel.
6763
6764 EOM
6765         case "$d_dosuid" in
6766         "$define") dflt=y ;;
6767         *) dflt=n ;;
6768         esac
6769         rp="Do you want to do setuid/setgid emulation?"
6770         . ./myread
6771         case "$ans" in
6772         [yY]*)  val="$define";;
6773         *)      val="$undef";;
6774         esac
6775         ;;
6776 esac
6777 set d_dosuid
6778 eval $setvar
6779
6780 : see if this is a malloc.h system
6781 set malloc.h i_malloc
6782 eval $inhdr
6783
6784 : see if stdlib is available
6785 set stdlib.h i_stdlib
6786 eval $inhdr
6787
6788 : determine which malloc to compile in
6789 echo " "
6790 case "$usemymalloc" in
6791 [yY]*|true|$define)     dflt='y' ;;
6792 [nN]*|false|$undef)     dflt='n' ;;
6793 *)      case "$ptrsize" in
6794         4) dflt='y' ;;
6795         *) dflt='n' ;;
6796         esac
6797         ;;
6798 esac
6799 rp="Do you wish to attempt to use the malloc that comes with $package?"
6800 . ./myread
6801 usemymalloc="$ans"
6802 case "$ans" in
6803 y*|true)
6804         usemymalloc='y'
6805         mallocsrc='malloc.c'
6806         mallocobj="malloc$_o"
6807         d_mymalloc="$define"
6808         case "$libs" in
6809         *-lmalloc*)
6810                 : Remove malloc from list of libraries to use
6811                 echo "Removing unneeded -lmalloc from library list" >&4
6812                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6813                 shift
6814                 libs="$*"
6815                 echo "libs = $libs" >&4
6816                 ;;
6817         esac
6818         ;;
6819 *)
6820         usemymalloc='n'
6821         mallocsrc=''
6822         mallocobj=''
6823         d_mymalloc="$undef"
6824         ;;
6825 esac
6826
6827 : compute the return types of malloc and free
6828 echo " "
6829 $cat >malloc.c <<END
6830 #$i_malloc I_MALLOC
6831 #$i_stdlib I_STDLIB
6832 #include <stdio.h>
6833 #include <sys/types.h>
6834 #ifdef I_MALLOC
6835 #include <malloc.h>
6836 #endif
6837 #ifdef I_STDLIB
6838 #include <stdlib.h>
6839 #endif
6840 #ifdef TRY_MALLOC
6841 void *malloc();
6842 #endif
6843 #ifdef TRY_FREE
6844 void free();
6845 #endif
6846 END
6847 case "$malloctype" in
6848 '')
6849         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6850                 malloctype='void *'
6851         else
6852                 malloctype='char *'
6853         fi
6854         ;;
6855 esac
6856 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6857
6858 case "$freetype" in
6859 '')
6860         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6861                 freetype='void'
6862         else
6863                 freetype='int'
6864         fi
6865         ;;
6866 esac
6867 echo "Your system uses $freetype free(), it would seem." >&4
6868 $rm -f malloc.[co]
6869 $cat <<EOM
6870
6871 After $package is installed, you may wish to install various
6872 add-on modules and utilities.  Typically, these add-ons will
6873 be installed under $prefix with the rest
6874 of this package.  However, you may wish to install such add-ons
6875 elsewhere under a different prefix.
6876
6877 If you do not wish to put everything under a single prefix, that's
6878 ok.  You will be prompted for the individual locations; this siteprefix
6879 is only used to suggest the defaults.
6880
6881 The default should be fine for most people.
6882
6883 EOM
6884 fn=d~+
6885 rp='Installation prefix to use for add-on modules and utilities?'
6886 : XXX Here might be another good place for an installstyle setting.
6887 case "$siteprefix" in
6888 '') dflt=$prefix ;;
6889 *)  dflt=$siteprefix ;;
6890 esac
6891 . ./getfile
6892 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6893 oldsiteprefix=''
6894 case "$siteprefix" in
6895 '') ;;
6896 *)      case "$ans" in
6897         "$prefix") ;;
6898         *) oldsiteprefix="$prefix";;
6899         esac
6900         ;;
6901 esac
6902 siteprefix="$ans"
6903 siteprefixexp="$ansexp"
6904
6905 : determine where site specific libraries go.
6906 : Usual default is /usr/local/lib/perl5/site_perl/$version
6907 : The default "style" setting is made in installstyle.U
6908 : XXX No longer works with Prefixit stuff.
6909 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6910 case "$sitelib" in
6911 '') case "$installstyle" in
6912         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6913         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6914         esac
6915         ;;
6916 *)      dflt="$sitelib"
6917         ;;
6918 esac
6919 $cat <<EOM
6920
6921 The installation process will create a directory for
6922 site-specific extensions and modules.  Most users find it convenient
6923 to place all site-specific files in this directory rather than in the
6924 main distribution directory.
6925
6926 EOM
6927 fn=d~+
6928 rp='Pathname for the site-specific library files?'
6929 . ./getfile
6930 sitelib="$ans"
6931 sitelibexp="$ansexp"
6932 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6933 : Change installation prefix, if necessary.
6934 if $test X"$prefix" != X"$installprefix"; then
6935         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6936 else
6937         installsitelib="$sitelibexp"
6938 fi
6939
6940 : determine where site specific architecture-dependent libraries go.
6941 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6942 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6943 : sitelib may have an optional trailing /share.
6944 case "$sitearch" in
6945 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6946         dflt="$dflt/$archname"
6947         ;;
6948 *)      dflt="$sitearch"
6949         ;;
6950 esac
6951 set sitearch sitearch none
6952 eval $prefixit
6953 $cat <<EOM
6954
6955 The installation process will also create a directory for
6956 architecture-dependent site-specific extensions and modules.
6957
6958 EOM
6959 fn=d~+
6960 rp='Pathname for the site-specific architecture-dependent library files?'
6961 . ./getfile
6962 sitearch="$ans"
6963 sitearchexp="$ansexp"
6964 : Change installation prefix, if necessary.
6965 if $test X"$prefix" != X"$installprefix"; then
6966         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6967 else
6968         installsitearch="$sitearchexp"
6969 fi
6970
6971 $cat <<EOM
6972
6973 The installation process will also create a directory for
6974 vendor-supplied add-ons.  Vendors who supply perl with their system
6975 may find it convenient to place all vendor-supplied files in this
6976 directory rather than in the main distribution directory.  This will
6977 ease upgrades between binary-compatible maintenance versions of perl.
6978
6979 Of course you may also use these directories in whatever way you see
6980 fit.  For example, you might use them to access modules shared over a
6981 company-wide network.
6982
6983 The default answer should be fine for most people.
6984 This causes further questions about vendor add-ons to be skipped
6985 and no vendor-specific directories will be configured for perl.
6986
6987 EOM
6988 rp='Do you want to configure vendor-specific add-on directories?'
6989 case "$usevendorprefix" in
6990 define|true|[yY]*) dflt=y ;;
6991 *)      : User may have set vendorprefix directly on Configure command line.
6992         case "$vendorprefix" in
6993         ''|' ') dflt=n ;;
6994         *)      dflt=y ;;
6995         esac
6996         ;;
6997 esac
6998 . ./myread
6999 case "$ans" in
7000 [yY]*)  fn=d~+
7001         rp='Installation prefix to use for vendor-supplied add-ons?'
7002         case "$vendorprefix" in
7003         '') dflt='' ;;
7004         *)  dflt=$vendorprefix ;;
7005         esac
7006         . ./getfile
7007         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7008         oldvendorprefix=''
7009         case "$vendorprefix" in
7010         '') ;;
7011         *)      case "$ans" in
7012                 "$prefix") ;;
7013                 *) oldvendorprefix="$prefix";;
7014                 esac
7015                 ;;
7016         esac
7017         usevendorprefix="$define"
7018         vendorprefix="$ans"
7019         vendorprefixexp="$ansexp"
7020         ;;
7021 *)      usevendorprefix="$undef"
7022         vendorprefix=''
7023         vendorprefixexp=''
7024         ;;
7025 esac
7026
7027 case "$vendorprefix" in
7028 '')     d_vendorlib="$undef"
7029         vendorlib=''
7030         vendorlibexp=''
7031         ;;
7032 *)      d_vendorlib="$define"
7033         : determine where vendor-supplied modules go.
7034         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7035         case "$vendorlib" in
7036         '')
7037                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7038                 case "$installstyle" in
7039                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7040                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7041                 esac
7042                 ;;
7043         *)      dflt="$vendorlib"
7044                 ;;
7045         esac
7046         fn=d~+
7047         rp='Pathname for the vendor-supplied library files?'
7048         . ./getfile
7049         vendorlib="$ans"
7050         vendorlibexp="$ansexp"
7051         ;;
7052 esac
7053 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7054 : Change installation prefix, if necessary.
7055 if $test X"$prefix" != X"$installprefix"; then
7056         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7057 else
7058         installvendorlib="$vendorlibexp"
7059 fi
7060
7061 case "$vendorprefix" in
7062 '')     d_vendorarch="$undef"
7063         vendorarch=''
7064         vendorarchexp=''
7065         ;;
7066 *)      d_vendorarch="$define"
7067         : determine where vendor-supplied architecture-dependent libraries go.
7068         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7069         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7070         : vendorlib may have an optional trailing /share.
7071         case "$vendorarch" in
7072         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7073                 dflt="$dflt/$archname"
7074                 ;;
7075         *)      dflt="$vendorarch" ;;
7076         esac
7077         fn=d~+
7078         rp='Pathname for vendor-supplied architecture-dependent files?'
7079         . ./getfile
7080         vendorarch="$ans"
7081         vendorarchexp="$ansexp"
7082         ;;
7083 esac
7084 : Change installation prefix, if necessary.
7085 if $test X"$prefix" != X"$installprefix"; then
7086         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7087 else
7088         installvendorarch="$vendorarchexp"
7089 fi
7090
7091 : Final catch-all directories to search
7092 $cat <<EOM
7093
7094 Lastly, you can have perl look in other directories for extensions and
7095 modules in addition to those already specified.
7096 These directories will be searched after 
7097         $sitearch 
7098         $sitelib 
7099 EOM
7100 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7101 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7102 echo ' '
7103 case "$otherlibdirs" in
7104 ''|' ') dflt='none' ;;
7105 *)      dflt="$otherlibdirs" ;;
7106 esac
7107 $cat <<EOM
7108 Enter a colon-separated set of extra paths to include in perl's @INC
7109 search path, or enter 'none' for no extra paths.
7110
7111 EOM
7112
7113 rp='Colon-separated list of additional directories for perl to search?'
7114 . ./myread
7115 case "$ans" in
7116 ' '|''|none)    otherlibdirs=' ' ;;     
7117 *)      otherlibdirs="$ans" ;;
7118 esac
7119 case "$otherlibdirs" in
7120 ' ') val=$undef ;;
7121 *)      val=$define ;;
7122 esac
7123 set d_perl_otherlibdirs
7124 eval $setvar
7125
7126 : Cruising for prototypes
7127 echo " "
7128 echo "Checking out function prototypes..." >&4
7129 $cat >prototype.c <<'EOCP'
7130 int main(int argc, char *argv[]) {
7131         exit(0);}
7132 EOCP
7133 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7134         echo "Your C compiler appears to support function prototypes."
7135         val="$define"
7136 else
7137         echo "Your C compiler doesn't seem to understand function prototypes."
7138         val="$undef"
7139 fi
7140 set prototype
7141 eval $setvar
7142 $rm -f prototype*
7143
7144 case "$prototype" in
7145 "$define") ;;
7146 *)      ansi2knr='ansi2knr'
7147         echo " "
7148         cat <<EOM >&4
7149
7150 $me:  FATAL ERROR:
7151 This version of $package can only be compiled by a compiler that 
7152 understands function prototypes.  Unfortunately, your C compiler 
7153         $cc $ccflags
7154 doesn't seem to understand them.  Sorry about that.
7155
7156 If GNU cc is available for your system, perhaps you could try that instead.  
7157
7158 Eventually, we hope to support building Perl with pre-ANSI compilers.
7159 If you would like to help in that effort, please contact <perlbug@perl.org>.
7160
7161 Aborting Configure now.
7162 EOM
7163         exit 2
7164         ;;
7165 esac
7166
7167 : determine where public executables go
7168 echo " "
7169 set dflt bin bin
7170 eval $prefixit
7171 fn=d~
7172 rp='Pathname where the public executables will reside?'
7173 . ./getfile
7174 if $test "X$ansexp" != "X$binexp"; then
7175         installbin=''
7176 fi
7177 bin="$ans"
7178 binexp="$ansexp"
7179 : Change installation prefix, if necessary.
7180 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7181 if $test X"$prefix" != X"$installprefix"; then
7182         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7183 else
7184         installbin="$binexp"
7185 fi
7186
7187 echo " "
7188 case "$extras" in
7189 '') dflt='n';;
7190 *) dflt='y';;
7191 esac
7192 cat <<EOM
7193 Perl can be built with extra modules or bundles of modules which
7194 will be fetched from the CPAN and installed alongside Perl.
7195
7196 Notice that you will need access to the CPAN; either via the Internet,
7197 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7198 be asked later to configure the CPAN.pm module which will in turn do
7199 the installation of the rest of the extra modules or bundles.)
7200
7201 Notice also that if the modules require any external software such as
7202 libraries and headers (the libz library and the zlib.h header for the
7203 Compress::Zlib module, for example) you MUST have any such software
7204 already installed, this configuration process will NOT install such
7205 things for you.
7206
7207 If this doesn't make any sense to you, just accept the default '$dflt'.
7208 EOM
7209 rp='Install any extra modules (y or n)?'
7210 . ./myread
7211 case "$ans" in
7212 y|Y)
7213         cat <<EOM
7214
7215 Please list any extra modules or bundles to be installed from CPAN,
7216 with spaces between the names.  The names can be in any format the
7217 'install' command of CPAN.pm will understand.  (Answer 'none',
7218 without the quotes, to install no extra modules or bundles.)
7219 EOM
7220         rp='Extras?'
7221         dflt="$extras"
7222         . ./myread
7223         extras="$ans"
7224 esac
7225 case "$extras" in
7226 ''|'none')
7227         val=''
7228         $rm -f ../extras.lst
7229         ;;
7230 *)      echo "(Saving the list of extras for later...)"
7231         echo "$extras" > ../extras.lst
7232         val="'$extras'"
7233         ;;
7234 esac
7235 set extras
7236 eval $setvar
7237 echo " "
7238
7239 : Find perl5.005 or later.
7240 echo "Looking for a previously installed perl5.005 or later... "
7241 case "$perl5" in
7242 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7243                 : Check if this perl is recent and can load a simple module
7244                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7245                         perl5=$tdir/perl
7246                         break;
7247                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7248                         perl5=$tdir/perl5
7249                         break;
7250                 fi
7251         done
7252         ;;
7253 *)      perl5="$perl5"
7254         ;;
7255 esac
7256 case "$perl5" in
7257 '')     echo "None found.  That's ok.";;
7258 *)      echo "Using $perl5." ;;
7259 esac
7260
7261 : Determine list of previous versions to include in @INC
7262 $cat > getverlist <<EOPL
7263 #!$perl5 -w
7264 use File::Basename;
7265 \$api_versionstring = "$api_versionstring";
7266 \$version = "$version";
7267 \$stem = "$sitelib_stem";
7268 \$archname = "$archname";
7269 EOPL
7270         $cat >> getverlist <<'EOPL'
7271 # Can't have leading @ because metaconfig interprets it as a command!
7272 ;@inc_version_list=();
7273 # XXX Redo to do opendir/readdir? 
7274 if (-d $stem) {
7275     chdir($stem);
7276     ;@candidates = glob("5.*");
7277 }
7278 else {
7279     ;@candidates = ();
7280 }
7281
7282 # XXX ToDo:  These comparisons must be reworked when two-digit
7283 # subversions come along, so that 5.7.10 compares as greater than
7284 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7285 # widespread that we can use the built-in version vectors rather
7286 # than reinventing them here.  For 5.6.0, however, we must
7287 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7288 foreach $d (@candidates) {
7289     if ($d lt $version) {
7290         if ($d ge $api_versionstring) {
7291             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7292         }
7293         elsif ($d ge "5.005") {
7294             unshift(@inc_version_list, grep { -d } $d);
7295         }
7296     }
7297     else {
7298         # Skip newer version.  I.e. don't look in
7299         # 5.7.0 if we're installing 5.6.1.
7300     }
7301 }
7302
7303 if (@inc_version_list) {
7304     print join(' ', @inc_version_list);
7305 }
7306 else {
7307     # Blank space to preserve value for next Configure run.
7308     print " ";
7309 }
7310 EOPL
7311 chmod +x getverlist
7312 case "$inc_version_list" in
7313 '')     if test -x "$perl5$exe_ext"; then
7314                 dflt=`$perl5 getverlist`
7315         else
7316                 dflt='none'
7317         fi
7318         ;;
7319 $undef) dflt='none' ;;
7320 *)  eval dflt=\"$inc_version_list\" ;;
7321 esac
7322 case "$dflt" in
7323 ''|' ') dflt=none ;;
7324 esac
7325 case "$dflt" in
7326 5.005) case "$bincompat5005" in
7327        $define|true|[yY]*) ;;
7328        *) dflt=none ;;
7329        esac
7330        ;;
7331 esac
7332 $cat <<'EOM'
7333
7334 In order to ease the process of upgrading, this version of perl 
7335 can be configured to use modules built and installed with earlier 
7336 versions of perl that were installed under $prefix.  Specify here
7337 the list of earlier versions that this version of perl should check.
7338 If Configure detected no earlier versions of perl installed under
7339 $prefix, then the list will be empty.  Answer 'none' to tell perl
7340 to not search earlier versions.
7341
7342 The default should almost always be sensible, so if you're not sure,
7343 just accept the default.
7344 EOM
7345
7346 rp='List of earlier versions to include in @INC?'
7347 . ./myread
7348 case "$ans" in
7349 [Nn]one|''|' ') inc_version_list=' ' ;;
7350 *) inc_version_list="$ans" ;;
7351 esac
7352 case "$inc_version_list" in
7353 ''|' ') 
7354         inc_version_list_init='0';;
7355 *)      inc_version_list_init=`echo $inc_version_list |
7356                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7357         ;;
7358 esac
7359 $rm -f getverlist
7360
7361 : determine whether to install perl also as /usr/bin/perl
7362
7363 echo " "
7364 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7365         $cat <<EOM
7366 Many scripts expect perl to be installed as /usr/bin/perl.
7367 I can install the perl you are about to compile also as /usr/bin/perl
7368 (in addition to $installbin/perl).
7369 EOM
7370         case "$installusrbinperl" in
7371         "$undef"|[nN]*) dflt='n';;
7372         *)              dflt='y';;
7373         esac
7374         rp="Do you want to install perl as /usr/bin/perl?"
7375         . ./myread
7376         case "$ans" in
7377         [yY]*)  val="$define";;
7378         *)      val="$undef" ;;
7379         esac
7380 else
7381         val="$undef"
7382 fi
7383 set installusrbinperl
7384 eval $setvar
7385
7386 : see if dld is available
7387 set dld.h i_dld
7388 eval $inhdr
7389
7390 : see if dlopen exists
7391 xxx_runnm="$runnm"
7392 runnm=false
7393 set dlopen d_dlopen
7394 eval $inlibc
7395 runnm="$xxx_runnm"
7396
7397 : determine which dynamic loading, if any, to compile in
7398 echo " "
7399 dldir="ext/DynaLoader"
7400 case "$usedl" in
7401 $define|y|true)
7402         dflt='y'
7403         usedl="$define"
7404         ;;
7405 $undef|n|false)
7406         dflt='n'
7407         usedl="$undef"
7408         ;;
7409 *) 
7410         dflt='n'
7411         case "$d_dlopen" in
7412             $define) dflt='y' ;;
7413         esac
7414         case "$i_dld" in
7415             $define) dflt='y' ;;
7416         esac
7417         : Does a dl_xxx.xs file exist for this operating system
7418         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7419         ;;
7420 esac
7421 rp="Do you wish to use dynamic loading?"
7422 . ./myread
7423 usedl="$ans"
7424 case "$ans" in
7425 y*) usedl="$define"
7426         case "$dlsrc" in
7427         '')
7428                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7429                         dflt="$dldir/dl_${osname}.xs"
7430                 elif $test "$d_dlopen" = "$define" ; then
7431                         dflt="$dldir/dl_dlopen.xs"
7432                 elif $test "$i_dld" = "$define" ; then
7433                         dflt="$dldir/dl_dld.xs"
7434                 else
7435                         dflt=''
7436                 fi
7437                 ;;
7438         *)      dflt="$dldir/$dlsrc"
7439                 ;;
7440         esac
7441     echo "The following dynamic loading files are available:"
7442         : Can not go over to $dldir because getfile has path hard-coded in.
7443         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7444         rp="Source file to use for dynamic loading"
7445         fn="fne"
7446         gfpth="$src"
7447         . ./getfile
7448         usedl="$define"
7449         : emulate basename
7450         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7451
7452         $cat << EOM
7453
7454 Some systems may require passing special flags to $cc -c to
7455 compile modules that will be used to create a shared library.
7456 To use no flags, say "none".
7457
7458 EOM
7459     case "$cccdlflags" in
7460     '') case "$gccversion" in
7461                 '') case "$osname" in
7462                         hpux)   dflt='+z' ;;
7463                         next)   dflt='none' ;;
7464                         irix*)  dflt='-KPIC' ;;
7465                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7466                         sunos)  dflt='-pic' ;;
7467                         *)      dflt='none' ;;
7468                     esac
7469                         ;;
7470                 *)  case "$osname" in
7471                         darwin) dflt='none' ;;
7472                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7473                         *)      dflt='-fpic' ;;
7474                     esac ;;
7475             esac ;;
7476         ' ') dflt='none' ;;
7477     *)  dflt="$cccdlflags" ;;
7478     esac
7479     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7480     . ./myread
7481     case "$ans" in
7482     none) cccdlflags=' ' ;;
7483     *) cccdlflags="$ans" ;;
7484     esac
7485
7486     cat << EOM
7487
7488 Some systems use ld to create libraries that can be dynamically loaded,
7489 while other systems (such as those using ELF) use $cc.
7490
7491 EOM
7492         case "$ld" in
7493         '')     $cat >try.c <<'EOM'
7494 /* Test for whether ELF binaries are produced */
7495 #include <fcntl.h>
7496 #include <stdlib.h>
7497 int main() {
7498         char b[4];
7499         int i = open("a.out",O_RDONLY);
7500         if(i == -1) 
7501                 exit(1); /* fail */
7502         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7503                 exit(0); /* succeed (yes, it's ELF) */
7504         else
7505                 exit(1); /* fail */
7506 }
7507 EOM
7508                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7509                         cat <<EOM
7510 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7511 EOM
7512                         dflt="$cc"
7513                 else
7514                         echo "I'll use ld to build dynamic libraries."
7515                         dflt='ld'
7516                 fi
7517                 rm -f try.c a.out
7518                 ;;
7519         *)      dflt="$ld"
7520                 ;;
7521         esac
7522
7523     rp="What command should be used to create dynamic libraries?"
7524     . ./myread
7525         ld="$ans"
7526
7527     cat << EOM
7528
7529 Some systems may require passing special flags to $ld to create a
7530 library that can be dynamically loaded.  If your ld flags include
7531 -L/other/path options to locate libraries outside your loader's normal
7532 search path, you may need to specify those -L options here as well.  To
7533 use no flags, say "none".
7534
7535 EOM
7536     case "$lddlflags" in
7537     '') case "$osname" in
7538                         beos) dflt='-nostart' ;;
7539                         hpux) dflt='-b';
7540                               case "$gccversion" in
7541                               '') dflt="$dflt +vnocompatwarnings" ;;
7542                               esac
7543                               ;;        
7544                         linux|irix*)    dflt='-shared' ;;
7545                         next)  dflt='none' ;;
7546                         solaris) dflt='-G' ;;
7547                         sunos) dflt='-assert nodefinitions' ;;
7548                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7549                 *)     dflt='none' ;;
7550                         esac
7551                         ;;
7552     *) dflt="$lddlflags" ;;
7553     esac
7554
7555         : Try to guess additional flags to pick up local libraries.
7556         : Be careful not to append to a plain 'none'
7557         case "$dflt" in
7558         none) dflt='' ;;
7559         esac
7560         for thisflag in $ldflags; do
7561                 case "$thisflag" in
7562                 -L*|-R*|-Wl,-R*)
7563                         case " $dflt " in
7564                         *" $thisflag "*) ;;
7565                         *) dflt="$dflt $thisflag" ;;
7566                         esac
7567                         ;;
7568                 esac
7569         done
7570
7571         case "$dflt" in
7572         ''|' ') dflt='none' ;;
7573         esac
7574
7575     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7576     . ./myread
7577     case "$ans" in
7578     none) lddlflags=' ' ;;
7579     *) lddlflags="$ans" ;;
7580     esac
7581
7582         cat <<EOM
7583
7584 Some systems may require passing special flags to $cc to indicate that
7585 the resulting executable will use dynamic linking.  To use no flags,
7586 say "none".
7587
7588 EOM
7589     case "$ccdlflags" in
7590     '') case "$osname" in
7591                 hpux)   dflt='-Wl,-E' ;;
7592                 linux)  dflt='-rdynamic' ;;
7593                 next)   dflt='none' ;;
7594                 sunos)  dflt='none' ;;
7595                 *)      dflt='none' ;;
7596             esac ;;
7597     ' ')  dflt='none' ;;
7598     *)  dflt="$ccdlflags" ;;
7599     esac
7600     rp="Any special flags to pass to $cc to use dynamic linking?"
7601     . ./myread
7602     case "$ans" in
7603     none) ccdlflags=' ' ;;
7604     *) ccdlflags="$ans" ;;
7605     esac
7606     ;;
7607 *)  usedl="$undef"
7608         ld='ld'
7609     dlsrc='dl_none.xs'
7610     lddlflags=''
7611     ccdlflags=''
7612     ;;
7613 esac
7614
7615 also=''
7616 case "$usedl" in
7617 $undef)
7618         # No dynamic loading being used, so don't bother even to prompt.
7619         useshrplib='false'
7620         ;;
7621 *)      case "$useshrplib" in
7622         '')     case "$osname" in
7623                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7624                         dflt=y
7625                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7626                         ;;
7627                 next*)
7628                         case "$osvers" in
7629                         4*)     dflt=y
7630                                 also='Building a shared libperl is needed for MAB support.'
7631                                 ;;
7632                         *)      dflt=n
7633                                 ;;
7634                         esac
7635                         ;;
7636                 *)      dflt=n
7637                         ;;
7638                 esac
7639                 ;;
7640         $define|true|[Yy]*)
7641                 dflt=y
7642                 ;;
7643         *)      dflt=n
7644                 ;;
7645         esac
7646         $cat << EOM
7647
7648 The perl executable is normally obtained by linking perlmain.c with
7649 libperl${_a}, any static extensions (usually just DynaLoader), and
7650 any other libraries needed on this system (such as -lm, etc.).  Since
7651 your system supports dynamic loading, it is probably possible to build
7652 a shared libperl.$so.  If you will have more than one executable linked
7653 to libperl.$so, this will significantly reduce the size of each
7654 executable, but it may have a noticeable affect on performance.  The
7655 default is probably sensible for your system.
7656 $also
7657
7658 EOM
7659         rp="Build a shared libperl.$so (y/n)"
7660         . ./myread
7661         case "$ans" in
7662         true|$define|[Yy]*)
7663                 useshrplib='true'  ;;
7664         *)      useshrplib='false' ;;
7665         esac
7666         ;;
7667 esac
7668
7669 case "$useshrplib" in
7670 true)
7671         case "$libperl" in
7672         '')
7673                 # Figure out a good name for libperl.so.  Since it gets stored in
7674                 # a version-specific architecture-dependent library, the version
7675                 # number isn't really that important, except for making cc/ld happy.
7676                 #
7677                 # A name such as libperl.so.3.1
7678                 majmin="libperl.$so.$patchlevel.$subversion"
7679                 # A name such as libperl.so.301
7680                 majonly=`echo $patchlevel $subversion |
7681                         $awk '{printf "%d%02d", $1, $2}'`
7682                 majonly=libperl.$so.$majonly
7683                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7684                 # rely on figuring it out from the naming of libc.
7685                 case "${osname}${osvers}" in
7686                 next4*)
7687                         dflt=libperl.5.$so
7688                         # XXX How handle the --version stuff for MAB?
7689                         ;;
7690                 linux*)  # ld won't link with a bare -lperl otherwise.
7691                         dflt=libperl.$so
7692                         ;;
7693                 cygwin*) # ld links against an importlib
7694                         dflt=libperl$lib_ext
7695                         ;;
7696                 *)      # Try to guess based on whether libc has major.minor.
7697                         case "$libc" in
7698                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7699                         *libc.$so.[0-9]*) dflt=$majonly ;;
7700                         *)      dflt=libperl.$so ;;
7701                         esac
7702                         ;;
7703                 esac
7704                 ;;
7705         *)      dflt=$libperl
7706                 ;;
7707         esac
7708         cat << EOM
7709
7710 I need to select a good name for the shared libperl.  If your system uses
7711 library names with major and minor numbers, then you might want something
7712 like $majmin.  Alternatively, if your system uses a single version
7713 number for shared libraries, then you might want to use $majonly.
7714 Or, your system might be quite happy with a simple libperl.$so.
7715
7716 Since the shared libperl will get installed into a version-specific
7717 architecture-dependent directory, the version number of the shared perl
7718 library probably isn't important, so the default should be o.k.
7719
7720 EOM
7721         rp='What name do you want to give to the shared libperl?'
7722         . ./myread
7723         libperl=$ans
7724         echo "Ok, I'll use $libperl"
7725         ;;
7726 *)
7727         libperl="libperl${_a}"
7728         ;;
7729 esac
7730
7731 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7732 case "$shrpdir" in
7733 '') ;;
7734 *)      $cat >&4 <<EOM
7735 WARNING:  Use of the shrpdir variable for the installation location of
7736 the shared $libperl is not supported.  It was never documented and
7737 will not work in this version.  Let me (perlbug@perl.org)
7738 know of any problems this may cause.
7739
7740 EOM
7741         case "$shrpdir" in
7742         "$archlibexp/CORE")
7743                 $cat >&4 <<EOM
7744 But your current setting of $shrpdir is
7745 the default anyway, so it's harmless.
7746 EOM
7747                 ;;
7748         *)
7749                 $cat >&4 <<EOM
7750 Further, your current attempted setting of $shrpdir
7751 conflicts with the value of $archlibexp/CORE
7752 that installperl will use.
7753 EOM
7754                 ;;
7755         esac
7756         ;;
7757 esac
7758
7759 # How will the perl executable find the installed shared $libperl?
7760 # Add $xxx to ccdlflags.
7761 # If we can't figure out a command-line option, use $shrpenv to
7762 # set env LD_RUN_PATH.  The main perl makefile uses this.
7763 shrpdir=$archlibexp/CORE
7764 xxx=''
7765 tmp_shrpenv=''
7766 if "$useshrplib"; then
7767     case "$osname" in 
7768         aix)
7769                 # We'll set it in Makefile.SH...
7770                 ;;
7771         solaris)
7772                 xxx="-R $shrpdir"
7773                 ;;
7774         freebsd|netbsd)
7775                 xxx="-Wl,-R$shrpdir"
7776                 ;;
7777         bsdos|linux|irix*|dec_osf)
7778                 xxx="-Wl,-rpath,$shrpdir"
7779                 ;;
7780         next)
7781                 # next doesn't like the default...
7782                 ;;
7783         beos)
7784                 # beos doesn't like the default, either.
7785                 ;;
7786         hpux*)
7787                 # hpux doesn't like the default, either.
7788                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7789                 ;;
7790         *)
7791                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7792                 ;;
7793         esac
7794         case "$xxx" in
7795         '') ;;
7796         *)      
7797                 # Only add $xxx if it isn't already in ccdlflags.
7798                 case " $ccdlflags " in
7799                 *" $xxx "*)     ;;
7800                 *)      ccdlflags="$ccdlflags $xxx"
7801                         cat <<EOM >&4
7802
7803 Adding $xxx to the flags
7804 passed to $ld so that the perl executable will find the 
7805 installed shared $libperl.
7806
7807 EOM
7808                         ;;
7809                 esac
7810                 ;;
7811         esac
7812 fi
7813 # Fix ccdlflags in AIX for building external extensions.
7814 # (For building Perl itself bare -bE:perl.exp is needed,
7815 #  Makefile.SH takes care of this.)
7816 case "$osname" in
7817 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7818 esac
7819 # Respect a hint or command-line value.
7820 case "$shrpenv" in
7821 '') shrpenv="$tmp_shrpenv" ;;
7822 esac
7823 case "$ldlibpthname" in
7824 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7825 none)   ldlibpthname='' ;;
7826 esac
7827
7828 : determine where manual pages are on this system
7829 echo " "
7830 case "$sysman" in
7831 '') 
7832         syspath='/usr/share/man/man1 /usr/man/man1'
7833         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7834         syspath="$syspath /usr/man/u_man/man1"
7835         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7836         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7837         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7838         sysman=`./loc . /usr/man/man1 $syspath`
7839         ;;
7840 esac
7841 if $test -d "$sysman"; then
7842         echo "System manual is in $sysman." >&4
7843 else
7844         echo "Could not find manual pages in source form." >&4
7845 fi
7846
7847 : determine where manual pages go
7848 set man1dir man1dir none
7849 eval $prefixit
7850 $cat <<EOM
7851
7852 $spackage has manual pages available in source form.
7853 EOM
7854 case "$nroff" in
7855 nroff)
7856         echo "However, you don't have nroff, so they're probably useless to you."
7857         case "$man1dir" in
7858         '') man1dir="none";;
7859         esac;;
7860 esac
7861 echo "If you don't want the manual sources installed, answer 'none'."
7862 case "$man1dir" in
7863 ' ') dflt=none
7864         ;;
7865 '')
7866         lookpath="$prefixexp/share/man/man1"
7867         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7868         lookpath="$lookpath $prefixexp/man/p_man/man1"
7869         lookpath="$lookpath $prefixexp/man/u_man/man1"
7870         lookpath="$lookpath $prefixexp/man/man.1"
7871         case "$sysman" in
7872         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7873         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7874         esac
7875         set dflt
7876         eval $prefixup
7877         ;;
7878 *)  dflt="$man1dir"
7879         ;;
7880 esac
7881 echo " "
7882 fn=dn+~
7883 rp="Where do the main $spackage manual pages (source) go?"
7884 . ./getfile
7885 if $test "X$man1direxp" != "X$ansexp"; then
7886         installman1dir=''
7887 fi
7888 man1dir="$ans"
7889 man1direxp="$ansexp"
7890 case "$man1dir" in
7891 '')     man1dir=' '
7892         installman1dir='';;
7893 esac
7894
7895 : Change installation prefix, if necessary.
7896 if $test X"$prefix" != X"$installprefix"; then
7897         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7898 else
7899         installman1dir="$man1direxp"
7900 fi
7901
7902 : What suffix to use on installed man pages
7903
7904 case "$man1dir" in
7905 ' ')
7906         man1ext='0'
7907         ;;
7908 *)
7909         rp="What suffix should be used for the main $spackage man pages?"
7910         case "$man1ext" in
7911         '')     case "$man1dir" in
7912                 *1)  dflt=1 ;;
7913                 *1p) dflt=1p ;;
7914                 *1pm) dflt=1pm ;;
7915                 *l) dflt=l;;
7916                 *n) dflt=n;;
7917                 *o) dflt=o;;
7918                 *p) dflt=p;;
7919                 *C) dflt=C;;
7920                 *L) dflt=L;;
7921                 *L1) dflt=L1;;
7922                 *) dflt=1;;
7923                 esac
7924                 ;;
7925         *)      dflt="$man1ext";;
7926         esac
7927         . ./myread
7928         man1ext="$ans"
7929         ;;
7930 esac
7931
7932 : see if we can have long filenames
7933 echo " "
7934 first=123456789abcdef
7935 $rm -f $first
7936 if (echo hi >$first) 2>/dev/null; then
7937         if $test -f 123456789abcde; then
7938                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7939                 val="$undef"
7940         else
7941                 echo 'You can have filenames longer than 14 characters.'>&4
7942                 val="$define"
7943         fi
7944 else
7945         $cat <<'EOM'
7946 You can't have filenames longer than 14 chars.
7947 You can't even think about them!
7948 EOM
7949         val="$undef"
7950 fi 
7951 set d_flexfnam
7952 eval $setvar
7953 $rm -rf 123456789abcde*
7954
7955 : determine where library module manual pages go
7956 set man3dir man3dir none
7957 eval $prefixit
7958 $cat <<EOM
7959
7960 $spackage has manual pages for many of the library modules.
7961 EOM
7962
7963 case "$nroff" in
7964 nroff)
7965         $cat <<'EOM'
7966 However, you don't have nroff, so they're probably useless to you.
7967 EOM
7968         case "$man3dir" in
7969         '') man3dir="none";;
7970         esac;;
7971 esac
7972
7973 case "$d_flexfnam" in
7974 undef)
7975         $cat <<'EOM'
7976 However, your system can't handle the long file names like File::Basename.3. 
7977 EOM
7978         case "$man3dir" in
7979         '') man3dir="none";;
7980         esac;;
7981 esac
7982
7983 echo "If you don't want the manual sources installed, answer 'none'."
7984 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7985 case "$man3dir" in
7986 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7987         if $test -d "$privlib/man/man3"; then
7988                 cat <<EOM >&4
7989
7990 WARNING:  Previous versions of perl installed man3 pages into
7991 $privlib/man/man3.  This version will suggest a 
7992 new default of $dflt.  
7993 EOM
7994                 tdflt=$dflt
7995                 dflt='n'
7996                 rp='Do you wish to preserve the old behavior?(y/n)'
7997                 . ./myread
7998                 case "$ans" in
7999                 y*) dflt="$privlib/man/man3" ;;
8000                 *)  dflt=$tdflt ;;
8001                 esac
8002     fi
8003         ;;
8004 *)      dflt="$man3dir" ;;
8005 esac
8006 case "$dflt" in
8007 ' ') dflt=none ;;
8008 esac
8009 echo " "
8010 fn=dn+~
8011 rp="Where do the $package library man pages (source) go?"
8012 . ./getfile
8013 man3dir="$ans"
8014 man3direxp="$ansexp"
8015 case "$man3dir" in
8016 '')     man3dir=' '
8017         installman3dir='';;
8018 esac
8019
8020 : Change installation prefix, if necessary.
8021 if $test X"$prefix" != X"$installprefix"; then
8022         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8023 else
8024         installman3dir="$man3direxp"
8025 fi
8026
8027 : What suffix to use on installed man pages
8028 case "$man3dir" in
8029 ' ')
8030         man3ext='0'
8031         ;;
8032 *)
8033         rp="What suffix should be used for the $package library man pages?"
8034         case "$man3ext" in
8035         '')     case "$man3dir" in
8036                 *3)  dflt=3 ;;
8037                 *3p) dflt=3p ;;
8038                 *3pm) dflt=3pm ;;
8039                 *l) dflt=l;;
8040                 *n) dflt=n;;
8041                 *o) dflt=o;;
8042                 *p) dflt=p;;
8043                 *C) dflt=C;;
8044                 *L) dflt=L;;
8045                 *L3) dflt=L3;;
8046                 *) dflt=3;;
8047                 esac
8048                 ;;
8049         *)      dflt="$man3ext";;
8050         esac
8051         . ./myread
8052         man3ext="$ans"
8053         ;;
8054 esac
8055
8056 : see if we have to deal with yellow pages, now NIS.
8057 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8058         if $test -f /usr/etc/nibindd; then
8059                 echo " "
8060                 echo "I'm fairly confident you're on a NeXT."
8061                 echo " "
8062                 rp='Do you get the hosts file via NetInfo?'
8063                 dflt=y
8064                 case "$hostcat" in
8065                 nidump*) ;;
8066                 '') ;;
8067                 *) dflt=n;;
8068                 esac
8069                 . ./myread
8070                 case "$ans" in
8071                 y*) hostcat='nidump hosts .';;
8072                 *)      case "$hostcat" in
8073                         nidump*) hostcat='';;
8074                         esac
8075                         ;;
8076                 esac
8077         fi
8078         case "$hostcat" in
8079         nidump*) ;;
8080         *)
8081                 case "$hostcat" in
8082                 *ypcat*) dflt=y;;
8083                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8084                                 dflt=y
8085                         else
8086                                 dflt=n
8087                         fi;;
8088                 *) dflt=n;;
8089                 esac
8090                 echo " "
8091                 rp='Are you getting the hosts file via yellow pages?'
8092                 . ./myread
8093                 case "$ans" in
8094                 y*) hostcat='ypcat hosts';;
8095                 *) hostcat='cat /etc/hosts';;
8096                 esac
8097                 ;;
8098         esac
8099 fi
8100 case "$hostcat" in
8101 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8102 esac
8103 case "$groupcat" in
8104 '') test -f /etc/group && groupcat='cat /etc/group';;
8105 esac
8106 case "$passcat" in
8107 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8108 esac
8109
8110 : now get the host name
8111 echo " "
8112 echo "Figuring out host name..." >&4
8113 case "$myhostname" in
8114 '') cont=true
8115         echo 'Maybe "hostname" will work...'
8116         if tans=`sh -c hostname 2>&1` ; then
8117                 myhostname=$tans
8118                 phostname=hostname
8119                 cont=''
8120         fi
8121         ;;
8122 *) cont='';;
8123 esac
8124 if $test "$cont"; then
8125         if ./xenix; then
8126                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8127                 if tans=`cat /etc/systemid 2>&1` ; then
8128                         myhostname=$tans
8129                         phostname='cat /etc/systemid'
8130                         echo "Whadyaknow.  Xenix always was a bit strange..."
8131                         cont=''
8132                 fi
8133         elif $test -r /etc/systemid; then
8134                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8135         fi
8136 fi
8137 if $test "$cont"; then
8138         echo 'No, maybe "uuname -l" will work...'
8139         if tans=`sh -c 'uuname -l' 2>&1` ; then
8140                 myhostname=$tans
8141                 phostname='uuname -l'
8142         else
8143                 echo 'Strange.  Maybe "uname -n" will work...'
8144                 if tans=`sh -c 'uname -n' 2>&1` ; then
8145                         myhostname=$tans
8146                         phostname='uname -n'
8147                 else
8148                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8149                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8150                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8151                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8152                         else
8153                                 case "$myhostname" in
8154                                 '') echo "Does this machine have an identity crisis or something?"
8155                                         phostname='';;
8156                                 *)
8157                                         echo "Well, you said $myhostname before..."
8158                                         phostname='echo $myhostname';;
8159                                 esac
8160                         fi
8161                 fi
8162         fi
8163 fi
8164 case "$myhostname" in
8165 '') myhostname=noname ;;
8166 esac
8167 : you do not want to know about this
8168 set $myhostname
8169 myhostname=$1
8170
8171 : verify guess
8172 if $test "$myhostname" ; then
8173         dflt=y
8174         rp='Your host name appears to be "'$myhostname'".'" Right?"
8175         . ./myread
8176         case "$ans" in
8177         y*) ;;
8178         *) myhostname='';;
8179         esac
8180 fi
8181
8182 : bad guess or no guess
8183 while $test "X$myhostname" = X ; do
8184         dflt=''
8185         rp="Please type the (one word) name of your host:"
8186         . ./myread
8187         myhostname="$ans"
8188 done
8189
8190 : translate upper to lower if necessary
8191 case "$myhostname" in
8192 *[A-Z]*)
8193         echo "(Normalizing case in your host name)"
8194         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8195         ;;
8196 esac
8197
8198 case "$myhostname" in
8199 *.*)
8200         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8201         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8202         echo "(Trimming domain name from host name--host name is now $myhostname)"
8203         ;;
8204 *) case "$mydomain" in
8205         '')
8206                 {
8207                         test "X$hostcat" = "Xypcat hosts" &&
8208                         ypmatch "$myhostname" hosts 2>/dev/null |\
8209                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8210                         $test -s hosts
8211                 } || {
8212                         test "X$hostcat" != "X" &&
8213                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8214                                         /[       ]$myhostname[  . ]/p" > hosts
8215                 }
8216                 tmp_re="[       . ]"
8217                 if $test -f hosts; then
8218                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8219                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8220                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8221                                 hosts | $sort | $uniq | \
8222                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8223                         case `$echo X$dflt` in
8224                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8225                                 dflt=.
8226                                 ;;
8227                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8228                                 ;;
8229                         esac
8230                 else
8231                         echo "(I cannot locate a hosts database anywhere)"
8232                         dflt=.
8233                 fi
8234                 case "$dflt" in
8235                 .)
8236                         tans=`./loc resolv.conf X /etc /usr/etc`
8237                         if $test -f "$tans"; then
8238                                 echo "(Attempting domain name extraction from $tans)"
8239                                 dflt=.`$sed -n -e 's/   / /g' \
8240                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8241                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8242                                 case "$dflt" in
8243                                 .) dflt=.`$sed -n -e 's/        / /g' \
8244                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8245                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8246                                         ;;
8247                                 esac
8248                         fi
8249                         ;;
8250                 esac
8251                 case "$dflt" in
8252                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8253                         dflt=.`sh -c domainname 2>/dev/null`
8254                         case "$dflt" in
8255                         '') dflt='.';;
8256                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8257                         esac
8258                         ;;
8259                 esac
8260                 case "$dflt$osname" in
8261                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8262                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8263                         ;;
8264                 esac
8265                 case "$dflt" in
8266                 .) echo "(Lost all hope -- silly guess then)"
8267                         dflt='.nonet'
8268                         ;;
8269                 esac
8270                 $rm -f hosts
8271                 ;;
8272         *) dflt="$mydomain";;
8273         esac;;
8274 esac
8275 echo " "
8276 rp="What is your domain name?"
8277 . ./myread
8278 tans="$ans"
8279 case "$ans" in
8280 '') ;;
8281 .*) ;;
8282 *) tans=".$tans";;
8283 esac
8284 mydomain="$tans"
8285
8286 : translate upper to lower if necessary
8287 case "$mydomain" in
8288 *[A-Z]*)
8289         echo "(Normalizing case in your domain name)"
8290         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8291         ;;
8292 esac
8293
8294 : a little sanity check here
8295 case "$phostname" in
8296 '') ;;
8297 *)
8298         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8299         $myhostname$mydomain|$myhostname) ;;
8300         *)
8301                 case "$phostname" in
8302                 sed*)
8303                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8304                         ;;
8305                 *)
8306                         echo "(That doesn't agree with your $phostname command, by the way.)"
8307                         ;;
8308                 esac
8309         ;;
8310         esac
8311         ;;
8312 esac
8313
8314 $cat <<EOM
8315
8316 I need to get your e-mail address in Internet format if possible, i.e.
8317 something like user@host.domain. Please answer accurately since I have
8318 no easy means to double check it. The default value provided below
8319 is most probably close to reality but may not be valid from outside
8320 your organization...
8321
8322 EOM
8323 cont=x
8324 while test "$cont"; do
8325         case "$cf_email" in
8326         '') dflt="$cf_by@$myhostname$mydomain";;
8327         *) dflt="$cf_email";;
8328         esac
8329         rp='What is your e-mail address?'
8330         . ./myread
8331         cf_email="$ans"
8332         case "$cf_email" in
8333         *@*.*) cont='' ;;
8334         *)
8335                 rp='Address does not look like an Internet one.  Use it anyway?'
8336                 case "$fastread" in
8337                 yes) dflt=y ;;
8338                 *) dflt=n ;;
8339                 esac
8340                 . ./myread
8341                 case "$ans" in
8342                 y*) cont='' ;;
8343                 *) echo " " ;;
8344                 esac
8345                 ;;
8346         esac
8347 done
8348
8349 $cat <<EOM
8350
8351 If you or somebody else will be maintaining perl at your site, please
8352 fill in the correct e-mail address here so that they may be contacted
8353 if necessary. Currently, the "perlbug" program included with perl
8354 will send mail to this address in addition to perlbug@perl.org. You may
8355 enter "none" for no administrator.
8356
8357 EOM
8358 case "$perladmin" in
8359 '') dflt="$cf_email";;
8360 *) dflt="$perladmin";;
8361 esac
8362 rp='Perl administrator e-mail address'
8363 . ./myread
8364 perladmin="$ans"
8365
8366 : determine whether to only install version-specific parts.
8367 echo " "
8368 $cat <<EOM
8369 Do you want to install only the version-specific parts of the perl
8370 distribution?  Usually you do *not* want to do this.
8371 EOM
8372 case "$versiononly" in
8373 "$define"|[Yy]*|true) dflt='y' ;;
8374 *) dflt='n';
8375 esac
8376 rp="Do you want to install only the version-specific parts of perl?"
8377 . ./myread
8378 case "$ans" in
8379 [yY]*)  val="$define";;
8380 *)      val="$undef" ;;
8381 esac
8382 set versiononly
8383 eval $setvar
8384
8385 : figure out how to guarantee perl startup
8386 case "$startperl" in
8387 '')
8388         case "$sharpbang" in
8389         *!)
8390                 $cat <<EOH
8391
8392 I can use the #! construct to start perl on your system. This will
8393 make startup of perl scripts faster, but may cause problems if you
8394 want to share those scripts and perl is not in a standard place
8395 ($binexp/perl) on all your platforms. The alternative is to force
8396 a shell by starting the script with a single ':' character.
8397
8398 EOH
8399                 case "$versiononly" in
8400                 "$define")      dflt="$binexp/perl$version";;  
8401                 *)              dflt="$binexp/perl";;
8402                 esac
8403                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8404                 . ./myread
8405                 case "$ans" in
8406                 none)   startperl=": # use perl";;
8407                 *)      startperl="#!$ans"
8408                         if $test 30 -lt `echo "$ans" | wc -c`; then
8409                                 $cat >&4 <<EOM
8410
8411 WARNING:  Some systems limit the #! command to 32 characters.
8412 If you experience difficulty running Perl scripts with #!, try
8413 installing Perl in a directory with a shorter pathname.
8414
8415 EOM
8416                         fi ;;
8417                 esac
8418                 ;;
8419         *) startperl=": # use perl"
8420                 ;;
8421         esac
8422         ;;
8423 esac
8424 echo "I'll use $startperl to start perl scripts."
8425
8426 : figure best path for perl in scripts
8427 case "$perlpath" in
8428 '')
8429         case "$versiononly" in
8430         "$define")      perlpath="$binexp/perl$version";;
8431         *)              perlpath="$binexp/perl";;
8432         esac
8433         case "$startperl" in
8434         *!*) ;;
8435         *)
8436                 $cat <<EOH
8437
8438 I will use the "eval 'exec'" idiom to start Perl on your system.
8439 I can use the full path of your Perl binary for this purpose, but
8440 doing so may cause problems if you want to share those scripts and
8441 Perl is not always in a standard place ($binexp/perl).
8442
8443 EOH
8444                 dflt="$binexp/perl"
8445                 rp="What path shall I use in \"eval 'exec'\"?"
8446                 . ./myread
8447                 perlpath="$ans"
8448                 ;;
8449         esac
8450         ;;
8451 esac
8452 case "$startperl" in
8453 *!*)    ;;
8454 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8455 esac
8456
8457 : determine where public executable scripts go
8458 set scriptdir scriptdir
8459 eval $prefixit
8460 case "$scriptdir" in
8461 '')
8462         dflt="$bin"
8463         : guess some guesses
8464         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8465         $test -d /usr/share/bin     && dflt=/usr/share/bin
8466         $test -d /usr/local/script  && dflt=/usr/local/script
8467         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8468         $test -d $prefixexp/script  && dflt=$prefixexp/script
8469         set dflt
8470         eval $prefixup
8471         ;;
8472 *)  dflt="$scriptdir"
8473         ;;
8474 esac
8475 $cat <<EOM
8476  
8477 Some installations have a separate directory just for executable scripts so
8478 that they can mount it across multiple architectures but keep the scripts in
8479 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8480 Or you might just lump your scripts in with all your other executables.
8481  
8482 EOM
8483 fn=d~
8484 rp='Where do you keep publicly executable scripts?'
8485 . ./getfile
8486 if $test "X$ansexp" != "X$scriptdirexp"; then
8487         installscript=''
8488 fi
8489 scriptdir="$ans"
8490 scriptdirexp="$ansexp"
8491 : Change installation prefix, if necessary.
8492 if $test X"$prefix" != X"$installprefix"; then
8493         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8494 else
8495         installscript="$scriptdirexp"
8496 fi
8497
8498 : determine where add-on public executables go
8499 case "$sitebin" in
8500 '')     dflt=$siteprefix/bin ;;
8501 *)      dflt=$sitebin ;;
8502 esac
8503 fn=d~
8504 rp='Pathname where the add-on public executables should be installed?'
8505 . ./getfile
8506 sitebin="$ans"
8507 sitebinexp="$ansexp"
8508 : Change installation prefix, if necessary.
8509 if $test X"$prefix" != X"$installprefix"; then
8510         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8511 else
8512         installsitebin="$sitebinexp"
8513 fi
8514
8515 : define an is-a-typedef? function
8516 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8517 case "$inclist" in
8518 "") inclist="sys/types.h";;
8519 esac;
8520 eval "varval=\$$var";
8521 case "$varval" in
8522 "")
8523         $rm -f temp.c;
8524         for inc in $inclist; do
8525                 echo "#include <$inc>" >>temp.c;
8526         done;
8527         echo "#ifdef $type" >> temp.c;
8528         echo "printf(\"We have $type\");" >> temp.c;
8529         echo "#endif" >> temp.c;
8530         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8531         if $contains $type temp.E >/dev/null 2>&1; then
8532                 eval "$var=\$type";
8533         else
8534                 eval "$var=\$def";
8535         fi;
8536         $rm -f temp.?;;
8537 *) eval "$var=\$varval";;
8538 esac'
8539
8540 : define an is-a-typedef? function that prompts if the type is not available.
8541 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8542 case "$inclist" in
8543 "") inclist="sys/types.h";;
8544 esac;
8545 eval "varval=\$$var";
8546 case "$varval" in
8547 "")
8548         $rm -f temp.c;
8549         for inc in $inclist; do
8550                 echo "#include <$inc>" >>temp.c;
8551         done;
8552         echo "#ifdef $type" >> temp.c;
8553         echo "printf(\"We have $type\");" >> temp.c;
8554         echo "#endif" >> temp.c;
8555         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8556         echo " " ;
8557         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8558         if $contains $type temp.E >/dev/null 2>&1; then
8559                 echo "$type found." >&4;
8560                 eval "$var=\$type";
8561         else
8562                 echo "$type NOT found." >&4;
8563                 dflt="$def";
8564                 . ./myread ;
8565                 eval "$var=\$ans";
8566         fi;
8567         $rm -f temp.?;;
8568 *) eval "$var=\$varval";;
8569 esac'
8570
8571 : see what type lseek is declared as in the kernel
8572 rp="What is the type used for lseek's offset on this system?"
8573 set off_t lseektype long stdio.h sys/types.h
8574 eval $typedef_ask
8575
8576 echo " "
8577 echo "Checking to see how big your file offsets are..." >&4
8578 $cat >try.c <<EOCP
8579 #include <sys/types.h>
8580 #include <stdio.h>
8581 int main()
8582 {
8583     printf("%d\n", (int)sizeof($lseektype));
8584     return(0); 
8585 }
8586 EOCP
8587 set try
8588 if eval $compile_ok; then
8589         lseeksize=`$run ./try`
8590         echo "Your file offsets are $lseeksize bytes long."
8591 else
8592         dflt=$longsize
8593         echo " "
8594         echo "(I can't seem to compile the test program.  Guessing...)"
8595         rp="What is the size of your file offsets (in bytes)?"
8596         . ./myread
8597         lseeksize="$ans"
8598 fi
8599 $rm -f try.c try
8600
8601 : see what type file positions are declared as in the library
8602 rp="What is the type for file position used by fsetpos()?"
8603 set fpos_t fpostype long stdio.h sys/types.h
8604 eval $typedef_ask
8605
8606 echo " "
8607 case "$fpostype" in
8608 *_t) zzz="$fpostype"    ;;
8609 *)   zzz="fpos_t"       ;;
8610 esac
8611 echo "Checking the size of $zzz..." >&4 
8612 cat > try.c <<EOCP
8613 #include <sys/types.h>
8614 #include <stdio.h>
8615 int main() {
8616     printf("%d\n", (int)sizeof($fpostype));
8617     exit(0);
8618 }
8619 EOCP
8620 set try
8621 if eval $compile_ok; then
8622         yyy=`$run ./try`
8623         case "$yyy" in
8624         '')     fpossize=4
8625                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8626                 ;;
8627         *)      fpossize=$yyy
8628                 echo "Your $zzz is $fpossize bytes long."
8629                 ;;
8630         esac
8631 else
8632         dflt="$longsize"
8633         echo " " >&4
8634         echo "(I can't compile the test program.  Guessing...)" >&4
8635         rp="What is the size of your file positions (in bytes)?"
8636         . ./myread
8637         fpossize="$ans"
8638 fi
8639
8640
8641
8642 # Backward compatibility (uselfs is deprecated).
8643 case "$uselfs" in
8644 "$define"|true|[yY]*)
8645         cat <<EOM >&4
8646
8647 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8648 EOM
8649         uselargefiles="$define"
8650         ;;
8651 esac                          
8652
8653 case "$lseeksize:$fpossize" in
8654 8:8) cat <<EOM
8655
8656 You can have files larger than 2 gigabytes.
8657 EOM
8658    val="$define" ;;
8659 *)    case "$uselargefiles" in
8660    "$undef"|false|[nN]*) dflt='n' ;;
8661    *)   dflt='y' ;;
8662    esac
8663    cat <<EOM
8664
8665 Perl can be built to understand large files (files larger than 2 gigabytes)
8666 on some systems.  To do so, Configure can be run with -Duselargefiles.
8667
8668 If this doesn't make any sense to you, just accept the default '$dflt'.
8669 EOM
8670    rp='Try to understand large files, if available?'
8671    . ./myread
8672    case "$ans" in
8673    y|Y)         val="$define" ;;
8674    *)           val="$undef"  ;;
8675    esac
8676    ;;
8677 esac
8678 set uselargefiles
8679 eval $setvar
8680 case "$uselargefiles" in
8681 "$define")
8682 : Look for a hint-file generated 'call-back-unit'.  If the
8683 : user has specified that a large files perl is to be built,
8684 : we may need to set or change some other defaults.
8685         if $test -f uselargefiles.cbu; then
8686                 echo "Your platform has some specific hints for large file builds, using them..."
8687                 . ./uselargefiles.cbu
8688                 echo " "
8689                 echo "Rechecking to see how big your file offsets are..." >&4
8690                 $cat >try.c <<EOCP
8691 #include <sys/types.h>
8692 #include <stdio.h>
8693 int main()
8694 {
8695     printf("%d\n", (int)sizeof($lseektype));
8696     return(0); 
8697 }
8698 EOCP
8699                 set try
8700                 if eval $compile_ok; then
8701                         lseeksize=`$run ./try`
8702                         $echo "Your file offsets are now $lseeksize bytes long."
8703                 else
8704                         dflt="$lseeksize"
8705                         echo " "
8706                         echo "(I can't seem to compile the test program.  Guessing...)"
8707                         rp="What is the size of your file offsets (in bytes)?"
8708                         . ./myread
8709                         lseeksize="$ans"
8710                 fi
8711                 case "$fpostype" in
8712                 *_t) zzz="$fpostype"    ;;
8713                 *)   zzz="fpos_t"       ;;
8714                 esac
8715                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8716                 $cat > try.c <<EOCP
8717 #include <sys/types.h>
8718 #include <stdio.h>
8719 int main() {
8720     printf("%d\n", (int)sizeof($fpostype));
8721     exit(0);
8722 }
8723 EOCP
8724                 set try
8725                 if eval $compile_ok; then
8726                         yyy=`$run ./try`
8727                         dflt="$lseeksize"
8728                         case "$yyy" in
8729                         '')     echo " "
8730                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8731                                 ;;
8732                         *)      fpossize=$yyy
8733                                 echo " $fpossize bytes." >&4
8734                                 ;;
8735                         esac
8736                 else
8737                         dflt="$fpossize"
8738                         echo " "
8739                         echo "(I can't compile the test program.  Guessing...)" >&4
8740                         rp="What is the size of your file positions (in bytes)?"
8741                         . ./myread
8742                         fpossize="$ans"
8743                 fi
8744                 $rm -f try.c try
8745         fi
8746         ;;
8747 esac
8748
8749 case "$vendorprefix" in
8750 '')     d_vendorbin="$undef"
8751         vendorbin=''
8752         vendorbinexp=''
8753         ;;
8754 *)      d_vendorbin="$define"
8755         : determine where vendor-supplied executables go.
8756         case "$vendorbin" in
8757         '') dflt=$vendorprefix/bin ;;
8758         *)      dflt="$vendorbin" ;;
8759         esac
8760         fn=d~+
8761         rp='Pathname for the vendor-supplied executables directory?'
8762         . ./getfile
8763         vendorbin="$ans"
8764         vendorbinexp="$ansexp"
8765         ;;
8766 esac
8767 : Change installation prefix, if necessary.
8768 if $test X"$prefix" != X"$installprefix"; then
8769         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8770 else
8771         installvendorbin="$vendorbinexp"
8772 fi
8773
8774 : see if qgcvt exists
8775 set qgcvt d_qgcvt
8776 eval $inlibc
8777
8778 : Check how to convert floats to strings.
8779
8780 if test "X$d_Gconvert" = X; then
8781
8782 echo " "
8783 echo "Checking for an efficient way to convert floats to strings."
8784 echo " " > try.c
8785 case "$uselongdouble" in
8786 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8787 esac
8788 case "$d_longdbl" in
8789 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8790 esac
8791 case "$d_PRIgldbl" in
8792 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8793 esac
8794 $cat >>try.c <<EOP
8795 #ifdef TRY_gconvert
8796 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8797 char *myname = "gconvert";
8798 #endif
8799 #ifdef TRY_gcvt
8800 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8801 char *myname = "gcvt";
8802 #endif
8803 #ifdef TRY_qgcvt
8804 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8805 char *myname = "qgcvt";
8806 #define DOUBLETYPE long double
8807 #endif
8808 #ifdef TRY_sprintf
8809 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8810 #ifdef HAS_PRIgldbl
8811 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8812 #else
8813 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8814 #endif
8815 #else
8816 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8817 #endif
8818 char *myname = "sprintf";
8819 #endif
8820
8821 #ifndef DOUBLETYPE
8822 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8823 #define DOUBLETYPE long double
8824 #else
8825 #define DOUBLETYPE double
8826 #endif
8827 #endif
8828
8829 #include <stdio.h>
8830
8831 #define I_STDLIB $i_stdlib
8832 #ifdef I_STDLIB
8833 #include <stdlib.h>
8834 #endif
8835
8836 int
8837 checkit(expect, got)
8838 char *expect;
8839 char *got;
8840 {
8841     if (strcmp(expect, got)) {
8842                 printf("%s oddity:  Expected %s, got %s\n",
8843                         myname, expect, got);
8844                 exit(1);
8845         }
8846 }
8847
8848 int main()
8849
8850         char buf[64]; 
8851         buf[63] = '\0';
8852
8853         /* This must be 1st test on (which?) platform */
8854         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8855         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8856         checkit("0.1", buf);
8857
8858         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8859         checkit("0.01", buf);
8860
8861         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8862         checkit("0.001", buf);
8863
8864         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8865         checkit("0.0001", buf);
8866
8867         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8868         if (strlen(buf) > 5)
8869             checkit("9e-005", buf); /* for Microsoft ?? */
8870         else
8871             checkit("9e-05", buf);
8872
8873         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8874         checkit("1", buf);
8875
8876         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8877         checkit("1.1", buf);
8878
8879         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8880         checkit("1.01", buf);
8881
8882         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8883         checkit("1.001", buf);
8884
8885         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8886         checkit("1.0001", buf);
8887
8888         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8889         checkit("1.00001", buf);
8890
8891         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8892         checkit("1.000001", buf);
8893
8894         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8895         checkit("0", buf);
8896
8897         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8898         checkit("-1", buf);
8899
8900         /* Some Linux gcvt's give 1.e+5 here. */
8901         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8902         checkit("100000", buf);
8903         
8904         /* Some Linux gcvt's give -1.e+5 here. */
8905         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8906         checkit("-100000", buf);
8907
8908         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8909         checkit("123.456", buf);
8910
8911         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8912         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8913         /* 34 should be enough to scare even long double
8914          * places into using the e notation. */
8915         if (strlen(buf) > 5)
8916             checkit("1e+034", buf); /* for Microsoft */
8917         else
8918             checkit("1e+34", buf);
8919
8920         /* For Perl, if you add additional tests here, also add them to
8921          * t/base/num.t for benefit of platforms not using Configure or
8922          * overriding d_Gconvert */
8923
8924         exit(0);
8925 }
8926 EOP
8927 : first add preferred functions to our list
8928 xxx_list=""
8929 for xxx_convert in $gconvert_preference; do
8930     case $xxx_convert in
8931     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8932     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8933     esac 
8934 done
8935 : then add any others
8936 for xxx_convert in gconvert gcvt sprintf; do
8937     case "$xxx_list" in
8938     *$xxx_convert*) ;;
8939     *) xxx_list="$xxx_list $xxx_convert" ;;
8940     esac 
8941 done
8942
8943 case "$d_longdbl$uselongdouble" in
8944 "$define$define")
8945     : again, add prefered functions to our list first
8946     xxx_ld_list=""
8947     for xxx_convert in $gconvert_ld_preference; do
8948         case $xxx_convert in
8949         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8950         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8951         esac
8952     done
8953     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8954     for xxx_convert in qgcvt sprintf $xxx_list; do
8955         case "$xxx_ld_list" in
8956         $xxx_convert*|*" $xxx_convert"*) ;;
8957         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8958         esac
8959     done
8960     : if sprintf cannot do long doubles, move it to the end
8961     if test "$d_PRIgldbl" != "$define"; then
8962         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8963     fi
8964     : if no qgcvt, remove it
8965     if test "$d_qgcvt" != "$define"; then
8966         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8967     fi
8968     : use the ld_list
8969     xxx_list="$xxx_ld_list"
8970     ;;
8971 esac
8972
8973 for xxx_convert in $xxx_list; do
8974         echo "Trying $xxx_convert..."
8975         $rm -f try try$_o
8976         set try -DTRY_$xxx_convert
8977         if eval $compile; then
8978                 echo "$xxx_convert() found." >&4
8979                 if $run ./try; then
8980                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8981                         break;
8982                 else
8983                         echo "...But $xxx_convert didn't work as I expected."
8984                         xxx_convert=''
8985                 fi
8986         else
8987                 echo "$xxx_convert NOT found." >&4
8988         fi
8989 done
8990
8991 if test X$xxx_convert = X; then
8992     echo "*** WHOA THERE!!! ***" >&4
8993     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8994     xxx_convert=sprintf
8995 fi
8996
8997 case "$xxx_convert" in
8998 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8999 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9000 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9001 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9002    "$define$define$define")
9003       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9004    "$define$define$undef")
9005       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9006    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9007    esac
9008    ;;  
9009 esac
9010
9011 fi
9012
9013 : see if _fwalk exists
9014 set fwalk d__fwalk
9015 eval $inlibc
9016
9017 : Initialize h_fcntl
9018 h_fcntl=false
9019
9020 : Initialize h_sysfile
9021 h_sysfile=false
9022
9023 : access call always available on UNIX
9024 set access d_access
9025 eval $inlibc
9026
9027 : locate the flags for 'access()'
9028 case "$d_access" in
9029 "$define")
9030         echo " "
9031         $cat >access.c <<'EOCP'
9032 #include <sys/types.h>
9033 #ifdef I_FCNTL
9034 #include <fcntl.h>
9035 #endif
9036 #ifdef I_SYS_FILE
9037 #include <sys/file.h>
9038 #endif
9039 #ifdef I_UNISTD
9040 #include <unistd.h>
9041 #endif
9042 int main() {
9043         exit(R_OK);
9044 }
9045 EOCP
9046         : check sys/file.h first, no particular reason here
9047         if $test `./findhdr sys/file.h` && \
9048                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9049                 h_sysfile=true;
9050                 echo "<sys/file.h> defines the *_OK access constants." >&4
9051         elif $test `./findhdr fcntl.h` && \
9052                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9053                 h_fcntl=true;
9054                 echo "<fcntl.h> defines the *_OK access constants." >&4
9055         elif $test `./findhdr unistd.h` && \
9056                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9057                 echo "<unistd.h> defines the *_OK access constants." >&4
9058         else
9059                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9060         fi
9061         ;;
9062 esac
9063 $rm -f access*
9064
9065 : see if accessx exists
9066 set accessx d_accessx
9067 eval $inlibc
9068
9069 : see if alarm exists
9070 set alarm d_alarm
9071 eval $inlibc
9072
9073 : define a fucntion to check prototypes
9074 $cat > protochk <<EOSH
9075 $startsh
9076 cc="$cc"
9077 optimize="$optimize"
9078 ccflags="$ccflags"
9079 prototype="$prototype"
9080 define="$define"
9081 rm=$rm
9082 EOSH
9083
9084 $cat >> protochk <<'EOSH'
9085
9086 $rm -f try.c
9087 foo="$1"
9088 shift
9089 while test $# -ge 2; do
9090         case "$1" in
9091                 $define) echo "#include <$2>" >> try.c ;;
9092                 literal) echo "$2" >> try.c ;;
9093         esac
9094     shift 2
9095 done
9096 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9097 cat >> try.c <<'EOCP'
9098 #ifdef CAN_PROTOTYPE
9099 #define _(args) args
9100 #else
9101 #define _(args) ()
9102 #endif
9103 EOCP
9104 echo "$foo" >> try.c
9105 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9106 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9107 status=$?
9108 $rm -f try.[co]
9109 exit $status
9110 EOSH
9111 chmod +x protochk
9112 $eunicefix protochk
9113
9114 hasproto='varname=$1; func=$2; shift; shift;
9115 while $test $# -ge 2; do
9116         case "$1" in
9117         $define) echo "#include <$2>";;
9118         esac ;
9119     shift 2;
9120 done > try.c;
9121 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9122 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9123         echo "$func() prototype found.";
9124         val="$define";
9125 else
9126         echo "$func() prototype NOT found.";
9127         val="$undef";
9128 fi;
9129 set $varname;
9130 eval $setvar;
9131 $rm -f try.c tryout.c'
9132
9133 : see if sys/types.h has to be included
9134 set sys/types.h i_systypes
9135 eval $inhdr
9136
9137 : see if sys/select.h has to be included
9138 set sys/select.h i_sysselct
9139 eval $inhdr
9140
9141 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9142 while $test $# -ge 2; do
9143         case "$1" in
9144         $define) echo "#include <$2>";;
9145         esac ;
9146     shift 2;
9147 done > try.c;
9148 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9149 set try;
9150 if eval $compile; then
9151         val="$define";
9152 else
9153         val="$undef";
9154 fi;
9155 set $varname;
9156 eval $setvar;
9157 $rm -f try.c try.o'
9158
9159 : see if we should include time.h, sys/time.h, or both
9160 echo " "
9161 if test "X$timeincl" = X; then
9162         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9163         $echo $n "I'm now running the test program...$c"
9164         $cat >try.c <<'EOCP'
9165 #include <sys/types.h>
9166 #ifdef I_TIME
9167 #include <time.h>
9168 #endif
9169 #ifdef I_SYSTIME
9170 #ifdef SYSTIMEKERNEL
9171 #define KERNEL
9172 #endif
9173 #include <sys/time.h>
9174 #endif
9175 #ifdef I_SYSSELECT
9176 #include <sys/select.h>
9177 #endif
9178 int main()
9179 {
9180         struct tm foo;
9181 #ifdef S_TIMEVAL
9182         struct timeval bar;
9183 #endif
9184 #ifdef S_TIMEZONE
9185         struct timezone tzp;
9186 #endif
9187         if (foo.tm_sec == foo.tm_sec)
9188                 exit(0);
9189 #ifdef S_TIMEVAL
9190         if (bar.tv_sec == bar.tv_sec)
9191                 exit(0);
9192 #endif
9193         exit(1);
9194 }
9195 EOCP
9196         flags=''
9197         for s_timezone in '-DS_TIMEZONE' ''; do
9198         sysselect=''
9199         for s_timeval in '-DS_TIMEVAL' ''; do
9200         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9201         for i_time in '' '-DI_TIME'; do
9202         for i_systime in '-DI_SYSTIME' ''; do
9203                 case "$flags" in
9204                 '') $echo $n ".$c"
9205                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9206                         if eval $compile; then
9207                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9208                                 shift
9209                                 flags="$*"
9210                                 echo " "
9211                                 $echo $n "Succeeded with $flags$c"
9212                         fi
9213                         ;;
9214                 esac
9215         done
9216         done
9217         done
9218         done
9219         done
9220         timeincl=''
9221         echo " "
9222         case "$flags" in
9223         *SYSTIMEKERNEL*) i_systimek="$define"
9224                 timeincl=`./findhdr sys/time.h`
9225                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9226         *) i_systimek="$undef";;
9227         esac
9228         case "$flags" in
9229         *I_TIME*) i_time="$define"
9230                 timeincl=`./findhdr time.h`" $timeincl"
9231                 echo "We'll include <time.h>." >&4;;
9232         *) i_time="$undef";;
9233         esac
9234         case "$flags" in
9235         *I_SYSTIME*) i_systime="$define"
9236                 timeincl=`./findhdr sys/time.h`" $timeincl"
9237                 echo "We'll include <sys/time.h>." >&4;;
9238         *) i_systime="$undef";;
9239         esac
9240         $rm -f try.c try
9241 fi
9242 : see if struct tm knows about tm_zone
9243 case "$i_systime$i_time" in
9244 *$define*) 
9245         echo " "
9246         echo "Checking to see if your struct tm has tm_zone field..." >&4
9247         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9248         eval $hasfield
9249         ;;
9250 *)      val="$undef"
9251         set d_tm_tm_zone
9252         eval $setvar
9253         ;;
9254 esac
9255 case "$d_tm_tm_zone" in
9256 "$define")      echo "Yes, it does."   ;;
9257 *)              echo "No, it doesn't." ;;
9258 esac
9259 : see if struct tm knows about tm_gmtoff
9260 case "$i_systime$i_time" in
9261 *$define*) 
9262         echo " "
9263         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9264         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9265         eval $hasfield
9266         ;;
9267 *)      val="$undef"
9268         set d_tm_tm_gmtoff
9269         eval $setvar
9270         ;;
9271 esac
9272 case "$d_tm_tm_gmtoff" in
9273 "$define")      echo "Yes, it does."   ;;
9274 *)              echo "No, it doesn't." ;;
9275 esac
9276
9277 : see if asctime_r exists
9278 set asctime_r d_asctime_r
9279 eval $inlibc
9280 case "$d_asctime_r" in
9281 "$define")
9282         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
9283         case "$d_asctime_r_proto" in
9284         '')     d_asctime_r_proto=define
9285                 set d_asctime_r_proto asctime_r $hdrs
9286                 eval $hasproto ;;
9287         *)      ;;
9288         esac
9289         case "$d_asctime_r_proto" in
9290         define)
9291         case "$asctime_r_proto" in
9292         ''|0) try='char* asctime_r(const struct tm*, char*);'
9293         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9294         esac
9295         case "$asctime_r_proto" in
9296         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9297         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9298         esac
9299         case "$asctime_r_proto" in
9300         ''|0) try='int asctime_r(const struct tm*, char*);'
9301         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9302         esac
9303         case "$asctime_r_proto" in
9304         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9305         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9306         esac
9307         case "$asctime_r_proto" in
9308         '')     d_asctime_r=undef
9309                 asctime_r_proto=0
9310                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9311         * )     case "$asctime_r_proto" in
9312                 REENTRANT_PROTO*) ;;
9313                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9314                 esac
9315                 echo "Prototype: $try" ;;
9316         esac
9317         ;;
9318         *)      echo "You have asctime_r but no prototype, not using it." >&4 ;;
9319         esac
9320         ;;
9321 *)      asctime_r_proto=0
9322         ;;
9323 esac
9324
9325 : see if atolf exists
9326 set atolf d_atolf
9327 eval $inlibc
9328
9329 : see if atoll exists
9330 set atoll d_atoll
9331 eval $inlibc
9332
9333 : Look for GNU-cc style attribute checking
9334 echo " "
9335 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9336 $cat >attrib.c <<'EOCP'
9337 #include <stdio.h>
9338 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9339 EOCP
9340 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9341         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9342                 echo "Your C compiler doesn't fully support __attribute__."
9343                 val="$undef"
9344         else
9345                 echo "Your C compiler supports __attribute__."
9346                 val="$define"
9347         fi
9348 else
9349         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9350         val="$undef"
9351 fi
9352 set d_attribut
9353 eval $setvar
9354 $rm -f attrib*
9355
9356 : see if bcmp exists
9357 set bcmp d_bcmp
9358 eval $inlibc
9359
9360 : see if bcopy exists
9361 set bcopy d_bcopy
9362 eval $inlibc
9363
9364 : see if this is a unistd.h system
9365 set unistd.h i_unistd
9366 eval $inhdr
9367
9368 : see if getpgrp exists
9369 set getpgrp d_getpgrp
9370 eval $inlibc
9371
9372 case "$d_getpgrp" in
9373 "$define")
9374         echo " "
9375         echo "Checking to see which flavor of getpgrp is in use..."
9376         $cat >try.c <<EOP
9377 #$i_unistd I_UNISTD
9378 #include <sys/types.h>
9379 #ifdef I_UNISTD
9380 #  include <unistd.h>
9381 #endif
9382 int main()
9383 {
9384         if (getuid() == 0) {
9385                 printf("(I see you are running Configure as super-user...)\n");
9386                 setuid(1);
9387         }
9388 #ifdef TRY_BSD_PGRP
9389         if (getpgrp(1) == 0)
9390                 exit(0);
9391 #else
9392         if (getpgrp() > 0)
9393                 exit(0);
9394 #endif
9395         exit(1);
9396 }
9397 EOP
9398         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9399                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9400                 val="$define"
9401         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9402                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9403                 val="$undef"
9404         else
9405                 echo "I can't seem to compile and run the test program."
9406                 if ./usg; then
9407                         xxx="a USG one, i.e. you use getpgrp()."
9408                 else
9409                         # SVR4 systems can appear rather BSD-ish.
9410                         case "$i_unistd" in
9411                         $undef)
9412                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9413                                 val="$define"
9414                                 ;;
9415                         $define)
9416                                 xxx="probably a USG one, i.e. you use getpgrp()."
9417                                 val="$undef"
9418                                 ;;
9419                         esac
9420                 fi
9421                 echo "Assuming your getpgrp is $xxx" >&4
9422         fi
9423         ;;
9424 *) val="$undef";;
9425 esac
9426 set d_bsdgetpgrp
9427 eval $setvar
9428 $rm -f try try.*
9429
9430 : see if setpgrp exists
9431 set setpgrp d_setpgrp
9432 eval $inlibc
9433
9434 case "$d_setpgrp" in
9435 "$define")
9436         echo " "
9437         echo "Checking to see which flavor of setpgrp is in use..."
9438         $cat >try.c <<EOP
9439 #$i_unistd I_UNISTD
9440 #include <sys/types.h>
9441 #ifdef I_UNISTD
9442 #  include <unistd.h>
9443 #endif
9444 int main()
9445 {
9446         if (getuid() == 0) {
9447                 printf("(I see you are running Configure as super-user...)\n");
9448                 setuid(1);
9449         }
9450 #ifdef TRY_BSD_PGRP
9451         if (-1 == setpgrp(1, 1))
9452                 exit(0);
9453 #else
9454         if (setpgrp() != -1)
9455                 exit(0);
9456 #endif
9457         exit(1);
9458 }
9459 EOP
9460         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9461                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9462                 val="$define"
9463         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9464                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9465                 val="$undef"
9466         else
9467                 echo "(I can't seem to compile and run the test program.)"
9468                 if ./usg; then
9469                         xxx="a USG one, i.e. you use setpgrp()."
9470                 else
9471                         # SVR4 systems can appear rather BSD-ish.
9472                         case "$i_unistd" in
9473                         $undef)
9474                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9475                                 val="$define"
9476                                 ;;
9477                         $define)
9478                                 xxx="probably a USG one, i.e. you use setpgrp()."
9479                                 val="$undef"
9480                                 ;;
9481                         esac
9482                 fi
9483                 echo "Assuming your setpgrp is $xxx" >&4
9484         fi
9485         ;;
9486 *) val="$undef";;
9487 esac
9488 set d_bsdsetpgrp
9489 eval $setvar
9490 $rm -f try try.*
9491 : see if bzero exists
9492 set bzero d_bzero
9493 eval $inlibc
9494
9495 : see if signal is declared as pointer to function returning int or void
9496 echo " "
9497 xxx=`./findhdr signal.h`
9498 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9499 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9500         echo "You have int (*signal())() instead of void." >&4
9501         val="$undef"
9502 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9503         echo "You have void (*signal())()." >&4
9504         val="$define"
9505 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9506         echo "You have int (*signal())() instead of void." >&4
9507         val="$undef"
9508 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9509         echo "You have void (*signal())()." >&4
9510         val="$define"
9511 else
9512         case "$d_voidsig" in
9513         '')
9514         echo "I can't determine whether signal handler returns void or int..." >&4
9515                 dflt=void
9516                 rp="What type does your signal handler return?"
9517                 . ./myread
9518                 case "$ans" in
9519                 v*) val="$define";;
9520                 *) val="$undef";;
9521                 esac;;
9522         "$define")
9523                 echo "As you already told me, signal handler returns void." >&4
9524                 val="$define"
9525                 ;;
9526         *)      echo "As you already told me, signal handler returns int." >&4
9527                 val="$undef"
9528                 ;;
9529         esac
9530 fi
9531 set d_voidsig
9532 eval $setvar
9533 case "$d_voidsig" in
9534 "$define") signal_t="void";;
9535 *) signal_t="int";;
9536 esac
9537 $rm -f $$.tmp
9538
9539 : check for ability to cast large floats to 32-bit ints.
9540 echo " "
9541 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9542 if $test "$intsize" -ge 4; then
9543         xxx=int
9544 else
9545         xxx=long
9546 fi
9547 $cat >try.c <<EOCP
9548 #include <stdio.h>
9549 #include <sys/types.h>
9550 #include <signal.h>
9551 $signal_t blech(s) int s; { exit(3); }
9552 int main()
9553 {
9554         $xxx i32;
9555         double f, g;
9556         int result = 0;
9557         char str[16];
9558         signal(SIGFPE, blech);
9559
9560         /* Don't let compiler optimize the test away.  Store the number 
9561            in a writable string for gcc to pass to sscanf under HP/UX.
9562         */
9563         sprintf(str, "2147483647");
9564         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9565         g = 10 * f;
9566         i32  = ($xxx) g;
9567
9568         /* x86 processors will probably give 0x8000 0000, which is a
9569        sign change.  We don't want that.  We want to mimic SPARC
9570            behavior here, which is to preserve the sign and give
9571            back 0x7fff ffff.
9572         */
9573         if (i32 != ($xxx) f)
9574                 result |= 1;
9575         exit(result);
9576 }
9577 EOCP
9578 set try
9579 if eval $compile_ok; then
9580         $run ./try
9581         yyy=$?
9582 else
9583         echo "(I can't seem to compile the test program--assuming it can't)"
9584         yyy=1
9585 fi
9586 case "$yyy" in
9587 0)      val="$define"
9588         echo "Yup, it can."
9589         ;;
9590 *)      val="$undef"
9591         echo "Nope, it can't."
9592         ;;
9593 esac
9594 set d_casti32
9595 eval $setvar
9596 $rm -f try try.*
9597
9598 : check for ability to cast negative floats to unsigned
9599 echo " "
9600 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9601 $cat >try.c <<EOCP
9602 #include <stdio.h>
9603 #include <sys/types.h>
9604 #include <signal.h>
9605 $signal_t blech(s) int s; { exit(7); }
9606 $signal_t blech_in_list(s) int s; { exit(4); }
9607 unsigned long dummy_long(p) unsigned long p; { return p; }
9608 unsigned int dummy_int(p) unsigned int p; { return p; }
9609 unsigned short dummy_short(p) unsigned short p; { return p; }
9610 int main()
9611 {
9612         double f;
9613         unsigned long along;
9614         unsigned int aint;
9615         unsigned short ashort;
9616         int result = 0;
9617         char str[16];
9618         
9619         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9620            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9621            optimized the whole file away
9622         */
9623         /* Store the number in a writable string for gcc to pass to 
9624            sscanf under HP/UX.
9625         */
9626         sprintf(str, "-123");
9627         sscanf(str, "%lf", &f);  /* f = -123.; */
9628
9629         signal(SIGFPE, blech);
9630         along = (unsigned long)f;
9631         aint = (unsigned int)f;
9632         ashort = (unsigned short)f;
9633         if (along != (unsigned long)-123)
9634                 result |= 1;
9635         if (aint != (unsigned int)-123)
9636                 result |= 1;
9637         if (ashort != (unsigned short)-123)
9638                 result |= 1;
9639         sprintf(str, "1073741824.");
9640         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9641         f = f + f;
9642         along = 0;
9643         along = (unsigned long)f;
9644         if (along != 0x80000000)
9645                 result |= 2;
9646         f -= 1.;
9647         along = 0;
9648         along = (unsigned long)f;
9649         if (along != 0x7fffffff)
9650                 result |= 1;
9651         f += 2.;
9652         along = 0;
9653         along = (unsigned long)f;
9654         if (along != 0x80000001)
9655                 result |= 2;
9656         if (result)
9657                 exit(result);
9658         signal(SIGFPE, blech_in_list);
9659         sprintf(str, "123.");
9660         sscanf(str, "%lf", &f);  /* f = 123.; */
9661         along = dummy_long((unsigned long)f);
9662         aint = dummy_int((unsigned int)f);
9663         ashort = dummy_short((unsigned short)f);
9664         if (along != (unsigned long)123)
9665                 result |= 4;
9666         if (aint != (unsigned int)123)
9667                 result |= 4;
9668         if (ashort != (unsigned short)123)
9669                 result |= 4;
9670         exit(result);
9671
9672 }
9673 EOCP
9674 set try
9675 if eval $compile_ok; then
9676         $run ./try
9677         castflags=$?
9678 else
9679         echo "(I can't seem to compile the test program--assuming it can't)"
9680         castflags=7
9681 fi
9682 case "$castflags" in
9683 0)      val="$define"
9684         echo "Yup, it can."
9685         ;;
9686 *)      val="$undef"
9687         echo "Nope, it can't."
9688         ;;
9689 esac
9690 set d_castneg
9691 eval $setvar
9692 $rm -f try.*
9693
9694 : see if vprintf exists
9695 echo " "
9696 if set vprintf val -f d_vprintf; eval $csym; $val; then
9697         echo 'vprintf() found.' >&4
9698         val="$define"
9699         $cat >try.c <<'EOF'
9700 #include <varargs.h>
9701
9702 int main() { xxx("foo"); }
9703
9704 xxx(va_alist)
9705 va_dcl
9706 {
9707         va_list args;
9708         char buf[10];
9709
9710         va_start(args);
9711         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9712 }
9713 EOF
9714         set try
9715         if eval $compile && $run ./try; then
9716                 echo "Your vsprintf() returns (int)." >&4
9717                 val2="$undef"
9718         else
9719                 echo "Your vsprintf() returns (char*)." >&4
9720                 val2="$define"
9721         fi
9722 else
9723         echo 'vprintf() NOT found.' >&4
9724                 val="$undef"
9725                 val2="$undef"
9726 fi
9727 $rm -f try try.*
9728 set d_vprintf
9729 eval $setvar
9730 val=$val2
9731 set d_charvspr
9732 eval $setvar
9733
9734 : see if chown exists
9735 set chown d_chown
9736 eval $inlibc
9737
9738 : see if chroot exists
9739 set chroot d_chroot
9740 eval $inlibc
9741
9742 : see if chsize exists
9743 set chsize d_chsize
9744 eval $inlibc
9745
9746 : see if class exists
9747 set class d_class
9748 eval $inlibc
9749
9750 hasstruct='varname=$1; struct=$2; shift; shift;
9751 while $test $# -ge 2; do
9752         case "$1" in
9753         $define) echo "#include <$2>";;
9754         esac ;
9755     shift 2;
9756 done > try.c;
9757 echo "int main () { struct $struct foo; }" >> try.c;
9758 set try;
9759 if eval $compile; then
9760         val="$define";
9761 else
9762         val="$undef";
9763 fi;
9764 set $varname;
9765 eval $setvar;
9766 $rm -f try.c try.o'
9767
9768 socketlib=''
9769 sockethdr=''
9770 : see whether socket exists
9771 echo " "
9772 $echo $n "Hmm... $c" >&4
9773 if set socket val -f d_socket; eval $csym; $val; then
9774         echo "Looks like you have Berkeley networking support." >&4
9775         d_socket="$define"
9776         if set setsockopt val -f; eval $csym; $val; then
9777                 d_oldsock="$undef"
9778         else
9779                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9780                 d_oldsock="$define"
9781         fi
9782 else
9783         if $contains socklib libc.list >/dev/null 2>&1; then
9784                 echo "Looks like you have Berkeley networking support." >&4
9785                 d_socket="$define"
9786                 : we will have to assume that it supports the 4.2 BSD interface
9787                 d_oldsock="$undef"
9788         else
9789                 echo "You don't have Berkeley networking in libc$_a..." >&4
9790                 if test "X$d_socket" = "X$define"; then
9791                    echo "...but you seem to believe that you have sockets." >&4
9792                 else
9793                         for net in net socket
9794                         do
9795                                 if test -f /usr/lib/lib$net$_a; then
9796                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9797                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9798                                         if $contains socket libc.list >/dev/null 2>&1; then
9799                                                 d_socket="$define"
9800                                                 socketlib="-l$net"
9801                                                 case "$net" in
9802                                                 net)
9803                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9804                                                         sockethdr="-I/usr/netinclude"
9805                                                         ;;
9806                                                 esac
9807                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9808                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9809                                                         d_oldsock="$undef"
9810                                                 else
9811                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9812                                                         d_oldsock="$define"
9813                                                 fi
9814                                                 break
9815                                         fi
9816                                 fi
9817                         done
9818                         if test "X$d_socket" != "X$define"; then
9819                            echo "or anywhere else I see." >&4
9820                            d_socket="$undef"
9821                            d_oldsock="$undef"
9822                         fi
9823                 fi
9824         fi
9825 fi
9826
9827 : see if socketpair exists
9828 set socketpair d_sockpair
9829 eval $inlibc
9830
9831
9832 echo " "
9833 echo "Checking the availability of certain socket constants..." >&4
9834 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9835         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9836         $cat >try.c <<EOF
9837 #include <sys/types.h>
9838 #include <sys/socket.h>
9839 int main() {
9840     int i = $ENUM;
9841 }
9842 EOF
9843         val="$undef"
9844         set try; if eval $compile; then
9845                 val="$define"
9846         fi
9847         set d_${enum}; eval $setvar
9848         $rm -f try.c try
9849 done
9850
9851 : see if this is a sys/uio.h system
9852 set sys/uio.h i_sysuio
9853 eval $inhdr
9854
9855
9856 echo " "
9857 echo "Checking to see if your system supports struct cmsghdr..." >&4
9858 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9859 eval $hasstruct
9860 case "$d_cmsghdr_s" in
9861 "$define")      echo "Yes, it does."   ;;
9862 *)              echo "No, it doesn't." ;;
9863 esac
9864
9865
9866 : check for const keyword
9867 echo " "
9868 echo 'Checking to see if your C compiler knows about "const"...' >&4
9869 $cat >const.c <<'EOCP'
9870 typedef struct spug { int drokk; } spug;
9871 int main()
9872 {
9873         const char *foo;
9874         const spug y;
9875 }
9876 EOCP
9877 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9878         val="$define"
9879         echo "Yup, it does."
9880 else
9881         val="$undef"
9882         echo "Nope, it doesn't."
9883 fi
9884 set d_const
9885 eval $setvar
9886
9887 : see if crypt exists
9888 echo " "
9889 set crypt d_crypt
9890 eval $inlibc
9891 case "$d_crypt" in
9892 $define) cryptlib='' ;;
9893 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9894                 echo 'crypt() found.' >&4
9895                 val="$define"
9896                 cryptlib=''
9897         else
9898                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9899                 if $test -z "$cryptlib"; then
9900                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9901                 else
9902                         cryptlib=-lcrypt
9903                 fi
9904                 if $test -z "$cryptlib"; then
9905                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9906                 else
9907                         cryptlib=-lcrypt
9908                 fi
9909                 if $test -z "$cryptlib"; then
9910                         cryptlib=`./loc libcrypt$_a "" $libpth`
9911                 else
9912                         cryptlib=-lcrypt
9913                 fi
9914                 if $test -z "$cryptlib"; then
9915                         echo 'crypt() NOT found.' >&4
9916                         val="$undef"
9917                 else
9918                         val="$define"
9919                 fi
9920         fi
9921         set d_crypt
9922         eval $setvar
9923         ;;
9924 esac
9925
9926 : see if this is a crypt.h system
9927 set crypt.h i_crypt
9928 eval $inhdr
9929
9930 : see if crypt_r exists
9931 set crypt_r d_crypt_r
9932 eval $inlibc
9933 case "$d_crypt_r" in
9934 "$define")
9935         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9936         case "$d_crypt_r_proto" in
9937         '')     d_crypt_r_proto=define
9938                 set d_crypt_r_proto crypt_r $hdrs
9939                 eval $hasproto ;;
9940         *)      ;;
9941         esac
9942         case "$d_crypt_r_proto" in
9943         define)
9944         case "$crypt_r_proto" in
9945         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9946         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9947         esac
9948         case "$crypt_r_proto" in
9949         '')     d_crypt_r=undef
9950                 crypt_r_proto=0
9951                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9952         * )     case "$crypt_r_proto" in
9953                 REENTRANT_PROTO*) ;;
9954                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9955                 esac
9956                 echo "Prototype: $try" ;;
9957         esac
9958         ;;
9959         *)      echo "You have crypt_r but no prototype, not using it." >&4 ;;
9960         esac
9961         ;;
9962 *)      crypt_r_proto=0
9963         ;;
9964 esac
9965
9966 : get csh whereabouts
9967 case "$csh" in
9968 'csh') val="$undef" ;;
9969 *) val="$define" ;;
9970 esac
9971 set d_csh
9972 eval $setvar
9973 : Respect a hint or command line value for full_csh.
9974 case "$full_csh" in
9975 '') full_csh=$csh ;;
9976 esac
9977
9978 : see if ctermid_r exists
9979 set ctermid_r d_ctermid_r
9980 eval $inlibc
9981 case "$d_ctermid_r" in
9982 "$define")
9983         hdrs="$i_systypes sys/types.h define stdio.h $i_stdio stdio.h"
9984         case "$d_ctermid_r_proto" in
9985         '')     d_ctermid_r_proto=define
9986                 set d_ctermid_r_proto ctermid_r $hdrs
9987                 eval $hasproto ;;
9988         *)      ;;
9989         esac
9990         case "$d_ctermid_r_proto" in
9991         define)
9992         case "$ctermid_r_proto" in
9993         ''|0) try='char* ctermid_r(char*);'
9994         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
9995         esac
9996         case "$ctermid_r_proto" in
9997         '')     d_ctermid_r=undef
9998                 ctermid_r_proto=0
9999                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10000         * )     case "$ctermid_r_proto" in
10001                 REENTRANT_PROTO*) ;;
10002                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10003                 esac
10004                 echo "Prototype: $try" ;;
10005         esac
10006         ;;
10007         *)      echo "You have ctermid_r but no prototype, not using it." >&4 ;;
10008         esac
10009         ;;
10010 *)      ctermid_r_proto=0
10011         ;;
10012 esac
10013
10014 : see if ctime_r exists
10015 set ctime_r d_ctime_r
10016 eval $inlibc
10017 case "$d_ctime_r" in
10018 "$define")
10019         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
10020         case "$d_ctime_r_proto" in
10021         '')     d_ctime_r_proto=define
10022                 set d_ctime_r_proto ctime_r $hdrs
10023                 eval $hasproto ;;
10024         *)      ;;
10025         esac
10026         case "$d_ctime_r_proto" in
10027         define)
10028         case "$ctime_r_proto" in
10029         ''|0) try='char* ctime_r(const time_t*, char*);'
10030         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10031         esac
10032         case "$ctime_r_proto" in
10033         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10034         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10035         esac
10036         case "$ctime_r_proto" in
10037         ''|0) try='int ctime_r(const time_t*, char*);'
10038         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10039         esac
10040         case "$ctime_r_proto" in
10041         ''|0) try='int ctime_r(const time_t*, char*, int);'
10042         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10043         esac
10044         case "$ctime_r_proto" in
10045         '')     d_ctime_r=undef
10046                 ctime_r_proto=0
10047                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10048         * )     case "$ctime_r_proto" in
10049                 REENTRANT_PROTO*) ;;
10050                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10051                 esac
10052                 echo "Prototype: $try" ;;
10053         esac
10054         ;;
10055         *)      echo "You have ctime_r but no prototype, not using it." >&4 ;;
10056         esac
10057         ;;
10058 *)      ctime_r_proto=0
10059         ;;
10060 esac
10061
10062 : see if cuserid exists
10063 set cuserid d_cuserid
10064 eval $inlibc
10065
10066 : see if this is a limits.h system
10067 set limits.h i_limits
10068 eval $inhdr
10069
10070 : see if this is a float.h system
10071 set float.h i_float
10072 eval $inhdr
10073
10074 : See if number of significant digits in a double precision number is known
10075 echo " "
10076 $cat >dbl_dig.c <<EOM
10077 #$i_limits I_LIMITS
10078 #$i_float I_FLOAT
10079 #ifdef I_LIMITS
10080 #include <limits.h>
10081 #endif
10082 #ifdef I_FLOAT
10083 #include <float.h>
10084 #endif
10085 #ifdef DBL_DIG
10086 printf("Contains DBL_DIG");
10087 #endif
10088 EOM
10089 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10090 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10091         echo "DBL_DIG found." >&4
10092         val="$define"
10093 else
10094         echo "DBL_DIG NOT found." >&4
10095         val="$undef"
10096 fi
10097 $rm -f dbl_dig.?
10098 set d_dbl_dig
10099 eval $setvar
10100
10101 : see if dbm.h is available
10102 : see if dbmclose exists
10103 set dbmclose d_dbmclose
10104 eval $inlibc
10105
10106 case "$d_dbmclose" in
10107 $define)
10108         set dbm.h i_dbm
10109         eval $inhdr
10110         case "$i_dbm" in
10111         $define)
10112                 val="$undef"
10113                 set i_rpcsvcdbm
10114                 eval $setvar
10115                 ;;
10116         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10117                 eval $inhdr
10118                 ;;
10119         esac
10120         ;;
10121 *)      echo "We won't be including <dbm.h>"
10122         val="$undef"
10123         set i_dbm
10124         eval $setvar
10125         val="$undef"
10126         set i_rpcsvcdbm
10127         eval $setvar
10128         ;;
10129 esac
10130
10131 : see if prototype for dbminit is available
10132 echo " "
10133 set d_dbminitproto dbminit $i_dbm dbm.h
10134 eval $hasproto
10135
10136 : see if difftime exists
10137 set difftime d_difftime
10138 eval $inlibc
10139
10140 : see if this is a dirent system
10141 echo " "
10142 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10143         val="$define"
10144         echo "<dirent.h> found." >&4
10145 else
10146         val="$undef"
10147         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10148                 echo "<sys/dir.h> found." >&4
10149                 echo " "
10150         else
10151                 xinc=`./findhdr sys/ndir.h`
10152         fi
10153         echo "<dirent.h> NOT found." >&4
10154 fi
10155 set i_dirent
10156 eval $setvar
10157
10158 : Look for type of directory structure.
10159 echo " "
10160 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10161
10162 case "$direntrytype" in
10163 ''|' ')
10164         case "$i_dirent" in
10165         $define) guess1='struct dirent' ;;
10166         *) guess1='struct direct'  ;;
10167         esac
10168         ;;
10169 *)      guess1="$direntrytype"
10170         ;;
10171 esac
10172
10173 case "$guess1" in
10174 'struct dirent') guess2='struct direct' ;;
10175 *) guess2='struct dirent' ;;
10176 esac
10177                 
10178 if $contains "$guess1" try.c >/dev/null 2>&1; then
10179         direntrytype="$guess1"
10180         echo "Your directory entries are $direntrytype." >&4
10181 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10182         direntrytype="$guess2"
10183         echo "Your directory entries seem to be $direntrytype." >&4
10184 else
10185         echo "I don't recognize your system's directory entries." >&4
10186         rp="What type is used for directory entries on this system?"
10187         dflt="$guess1"
10188         . ./myread
10189         direntrytype="$ans"
10190 fi
10191 $rm -f try.c
10192
10193
10194 : see if the directory entry stores field length
10195 echo " "
10196 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10197 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10198         echo "Good, your directory entry keeps length information in d_namlen." >&4
10199         val="$define"
10200 else
10201         echo "Your directory entry does not know about the d_namlen field." >&4
10202         val="$undef"
10203 fi
10204 set d_dirnamlen
10205 eval $setvar
10206 $rm -f try.c
10207
10208 : see if this is an sysdir system
10209 set sys/dir.h i_sysdir
10210 eval $inhdr
10211
10212 : see if this is an sysndir system
10213 set sys/ndir.h i_sysndir
10214 eval $inhdr
10215
10216 : Look for dirfd
10217 echo " "
10218 $cat >dirfd.c <<EOM
10219 #include <stdio.h>
10220 #$i_dirent I_DIRENT             /**/
10221 #$i_sysdir I_SYS_DIR            /**/
10222 #$i_sysndir I_SYS_NDIR          /**/
10223 #$i_systypes I_SYS_TYPES        /**/
10224 #if defined(I_SYS_TYPES)
10225 #include <sys/types.h>
10226 #endif
10227 #if defined(I_DIRENT)
10228 #include <dirent.h>
10229 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10230 #include <sys/dir.h>
10231 #endif
10232 #else
10233 #ifdef I_SYS_NDIR
10234 #include <sys/ndir.h>
10235 #else
10236 #ifdef I_SYS_DIR
10237 #ifdef hp9000s500
10238 #include <ndir.h>       /* may be wrong in the future */
10239 #else
10240 #include <sys/dir.h>
10241 #endif
10242 #endif
10243 #endif
10244 #endif 
10245 int main() {
10246         DIR *dirp = opendir(".");
10247         if (dirfd(dirp) >= 0)
10248                 exit(0);
10249         else
10250                 exit(1);
10251 }
10252 EOM
10253 set dirfd
10254 if eval $compile; then
10255         val="$define"
10256 fi
10257 case "$val" in
10258 $define)        echo "dirfd() found." >&4       ;;
10259 *)              echo "dirfd() NOT found." >&4   ;;
10260 esac
10261 set d_dirfd
10262 eval $setvar
10263 $rm -f dirfd*
10264
10265 : see if dlerror exists
10266 xxx_runnm="$runnm"
10267 runnm=false
10268 set dlerror d_dlerror
10269 eval $inlibc
10270 runnm="$xxx_runnm"
10271
10272 : see if dlfcn is available
10273 set dlfcn.h i_dlfcn
10274 eval $inhdr
10275
10276 case "$usedl" in
10277 $define|y|true)
10278         $cat << EOM
10279
10280 On a few systems, the dynamically loaded modules that perl generates and uses
10281 will need a different extension than shared libs. The default will probably
10282 be appropriate.
10283
10284 EOM
10285         case "$dlext" in
10286         '')     dflt="$so" ;;
10287         *)      dflt="$dlext" ;;
10288         esac
10289         rp='What is the extension of dynamically loaded modules'
10290         . ./myread
10291         dlext="$ans"
10292         ;;
10293 *)
10294         dlext="none"
10295         ;;
10296 esac
10297
10298 : Check if dlsym need a leading underscore
10299 echo " "
10300 val="$undef"
10301
10302 case "$dlsrc" in
10303 dl_dlopen.xs)
10304         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10305         $cat >dyna.c <<'EOM'
10306 fred () { }
10307 EOM
10308
10309 $cat >fred.c<<EOM
10310
10311 #include <stdio.h>
10312 #$i_dlfcn I_DLFCN
10313 #ifdef I_DLFCN
10314 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10315 #else
10316 #include <sys/types.h>
10317 #include <nlist.h>
10318 #include <link.h>
10319 #endif
10320
10321 extern int fred() ;
10322
10323 int main()
10324 {
10325     void * handle ;
10326     void * symbol ;
10327 #ifndef RTLD_LAZY
10328     int mode = 1 ;
10329 #else
10330     int mode = RTLD_LAZY ;
10331 #endif
10332     handle = dlopen("./dyna.$dlext", mode) ;
10333     if (handle == NULL) {
10334         printf ("1\n") ;
10335         fflush (stdout) ;
10336         exit(0);
10337     }
10338     symbol = dlsym(handle, "fred") ;
10339     if (symbol == NULL) {
10340         /* try putting a leading underscore */
10341         symbol = dlsym(handle, "_fred") ;
10342         if (symbol == NULL) {
10343             printf ("2\n") ;
10344             fflush (stdout) ;
10345             exit(0);
10346         }
10347         printf ("3\n") ;
10348     }
10349     else
10350         printf ("4\n") ;
10351     fflush (stdout) ;
10352     exit(0);
10353 }
10354 EOM
10355         : Call the object file tmp-dyna.o in case dlext=o.
10356         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10357                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10358                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10359                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10360                 xxx=`$run ./fred`
10361                 case $xxx in
10362                 1)      echo "Test program failed using dlopen." >&4
10363                         echo "Perhaps you should not use dynamic loading." >&4;;
10364                 2)      echo "Test program failed using dlsym." >&4
10365                         echo "Perhaps you should not use dynamic loading." >&4;;
10366                 3)      echo "dlsym needs a leading underscore" >&4
10367                         val="$define" ;;
10368                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10369                 esac
10370         else
10371                 echo "I can't compile and run the test program." >&4
10372                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10373         fi
10374         ;;
10375 esac
10376                 
10377 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10378
10379 set d_dlsymun
10380 eval $setvar
10381
10382 : see if drand48_r exists
10383 set drand48_r d_drand48_r
10384 eval $inlibc
10385 case "$d_drand48_r" in
10386 "$define")
10387         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10388         case "$d_drand48_r_proto" in
10389         '')     d_drand48_r_proto=define
10390                 set d_drand48_r_proto drand48_r $hdrs
10391                 eval $hasproto ;;
10392         *)      ;;
10393         esac
10394         case "$d_drand48_r_proto" in
10395         define)
10396         case "$drand48_r_proto" in
10397         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10398         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10399         esac
10400         case "$drand48_r_proto" in
10401         '')     d_drand48_r=undef
10402                 drand48_r_proto=0
10403                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10404         * )     case "$drand48_r_proto" in
10405                 REENTRANT_PROTO*) ;;
10406                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10407                 esac
10408                 echo "Prototype: $try" ;;
10409         esac
10410         ;;
10411         *)      echo "You have drand48_r but no prototype, not using it." >&4 ;;
10412         esac
10413         ;;
10414 *)      drand48_r_proto=0
10415         ;;
10416 esac
10417
10418 : see if prototype for drand48 is available
10419 echo " "
10420 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10421 eval $hasproto
10422
10423 : see if dup2 exists
10424 set dup2 d_dup2
10425 eval $inlibc
10426
10427 : see if eaccess exists
10428 set eaccess d_eaccess
10429 eval $inlibc
10430
10431 : see if endgrent exists
10432 set endgrent d_endgrent
10433 eval $inlibc
10434
10435 : see if this is an grp system
10436 set grp.h i_grp
10437 eval $inhdr
10438
10439 case "$i_grp" in
10440 $define)
10441         xxx=`./findhdr grp.h`
10442         $cppstdin $cppflags $cppminus < $xxx >$$.h
10443
10444         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10445                 val="$define"
10446         else
10447                 val="$undef"
10448         fi
10449         set d_grpasswd
10450         eval $setvar
10451
10452         $rm -f $$.h
10453         ;;
10454 *)
10455         val="$undef";
10456         set d_grpasswd; eval $setvar
10457         ;;
10458 esac
10459
10460 : see if endgrent_r exists
10461 set endgrent_r d_endgrent_r
10462 eval $inlibc
10463 case "$d_endgrent_r" in
10464 "$define")
10465         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10466         case "$d_endgrent_r_proto" in
10467         '')     d_endgrent_r_proto=define
10468                 set d_endgrent_r_proto endgrent_r $hdrs
10469                 eval $hasproto ;;
10470         *)      ;;
10471         esac
10472         case "$d_endgrent_r_proto" in
10473         define)
10474         case "$endgrent_r_proto" in
10475         ''|0) try='int endgrent_r(FILE**);'
10476         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10477         esac
10478         case "$endgrent_r_proto" in
10479         ''|0) try='void endgrent_r(FILE**);'
10480         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10481         esac
10482         case "$endgrent_r_proto" in
10483         '')     d_endgrent_r=undef
10484                 endgrent_r_proto=0
10485                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10486         * )     case "$endgrent_r_proto" in
10487                 REENTRANT_PROTO*) ;;
10488                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10489                 esac
10490                 echo "Prototype: $try" ;;
10491         esac
10492         ;;
10493         *)      echo "You have endgrent_r but no prototype, not using it." >&4 ;;
10494         esac
10495         ;;
10496 *)      endgrent_r_proto=0
10497         ;;
10498 esac
10499
10500 : see if endhostent exists
10501 set endhostent d_endhent
10502 eval $inlibc
10503
10504 : see if this is a netdb.h system
10505 set netdb.h i_netdb
10506 eval $inhdr
10507
10508 : see if endhostent_r exists
10509 set endhostent_r d_endhostent_r
10510 eval $inlibc
10511 case "$d_endhostent_r" in
10512 "$define")
10513         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10514         case "$d_endhostent_r_proto" in
10515         '')     d_endhostent_r_proto=define
10516                 set d_endhostent_r_proto endhostent_r $hdrs
10517                 eval $hasproto ;;
10518         *)      ;;
10519         esac
10520         case "$d_endhostent_r_proto" in
10521         define)
10522         case "$endhostent_r_proto" in
10523         ''|0) try='int endhostent_r(struct hostent_data*);'
10524         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_S ;;
10525         esac
10526         case "$endhostent_r_proto" in
10527         ''|0) try='void endhostent_r(struct hostent_data*);'
10528         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_S ;;
10529         esac
10530         case "$endhostent_r_proto" in
10531         '')     d_endhostent_r=undef
10532                 endhostent_r_proto=0
10533                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10534         * )     case "$endhostent_r_proto" in
10535                 REENTRANT_PROTO*) ;;
10536                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10537                 esac
10538                 echo "Prototype: $try" ;;
10539         esac
10540         ;;
10541         *)      echo "You have endhostent_r but no prototype, not using it." >&4 ;;
10542         esac
10543         ;;
10544 *)      endhostent_r_proto=0
10545         ;;
10546 esac
10547
10548 : see if endnetent exists
10549 set endnetent d_endnent
10550 eval $inlibc
10551
10552 : see if endnetent_r exists
10553 set endnetent_r d_endnetent_r
10554 eval $inlibc
10555 case "$d_endnetent_r" in
10556 "$define")
10557         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10558         case "$d_endnetent_r_proto" in
10559         '')     d_endnetent_r_proto=define
10560                 set d_endnetent_r_proto endnetent_r $hdrs
10561                 eval $hasproto ;;
10562         *)      ;;
10563         esac
10564         case "$d_endnetent_r_proto" in
10565         define)
10566         case "$endnetent_r_proto" in
10567         ''|0) try='int endnetent_r(struct netent_data*);'
10568         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_S ;;
10569         esac
10570         case "$endnetent_r_proto" in
10571         ''|0) try='void endnetent_r(struct netent_data*);'
10572         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_S ;;
10573         esac
10574         case "$endnetent_r_proto" in
10575         '')     d_endnetent_r=undef
10576                 endnetent_r_proto=0
10577                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10578         * )     case "$endnetent_r_proto" in
10579                 REENTRANT_PROTO*) ;;
10580                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10581                 esac
10582                 echo "Prototype: $try" ;;
10583         esac
10584         ;;
10585         *)      echo "You have endnetent_r but no prototype, not using it." >&4 ;;
10586         esac
10587         ;;
10588 *)      endnetent_r_proto=0
10589         ;;
10590 esac
10591
10592 : see if endprotoent exists
10593 set endprotoent d_endpent
10594 eval $inlibc
10595
10596 : see if endprotoent_r exists
10597 set endprotoent_r d_endprotoent_r
10598 eval $inlibc
10599 case "$d_endprotoent_r" in
10600 "$define")
10601         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10602         case "$d_endprotoent_r_proto" in
10603         '')     d_endprotoent_r_proto=define
10604                 set d_endprotoent_r_proto endprotoent_r $hdrs
10605                 eval $hasproto ;;
10606         *)      ;;
10607         esac
10608         case "$d_endprotoent_r_proto" in
10609         define)
10610         case "$endprotoent_r_proto" in
10611         ''|0) try='int endprotoent_r(struct protoent_data*);'
10612         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_S ;;
10613         esac
10614         case "$endprotoent_r_proto" in
10615         ''|0) try='void endprotoent_r(struct protoent_data*);'
10616         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_S ;;
10617         esac
10618         case "$endprotoent_r_proto" in
10619         '')     d_endprotoent_r=undef
10620                 endprotoent_r_proto=0
10621                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10622         * )     case "$endprotoent_r_proto" in
10623                 REENTRANT_PROTO*) ;;
10624                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10625                 esac
10626                 echo "Prototype: $try" ;;
10627         esac
10628         ;;
10629         *)      echo "You have endprotoent_r but no prototype, not using it." >&4 ;;
10630         esac
10631         ;;
10632 *)      endprotoent_r_proto=0
10633         ;;
10634 esac
10635
10636 : see if endpwent exists
10637 set endpwent d_endpwent
10638 eval $inlibc
10639
10640 : see if this is a pwd.h system
10641 set pwd.h i_pwd
10642 eval $inhdr
10643
10644 case "$i_pwd" in
10645 $define)
10646         xxx=`./findhdr pwd.h`
10647         $cppstdin $cppflags $cppminus < $xxx >$$.h
10648
10649         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10650                 val="$define"
10651         else
10652                 val="$undef"
10653         fi
10654         set d_pwquota
10655         eval $setvar
10656
10657         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10658                 val="$define"
10659         else
10660                 val="$undef"
10661         fi
10662         set d_pwage
10663         eval $setvar
10664
10665         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10666                 val="$define"
10667         else
10668                 val="$undef"
10669         fi
10670         set d_pwchange
10671         eval $setvar
10672
10673         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10674                 val="$define"
10675         else
10676                 val="$undef"
10677         fi
10678         set d_pwclass
10679         eval $setvar
10680
10681         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10682                 val="$define"
10683         else
10684                 val="$undef"
10685         fi
10686         set d_pwexpire
10687         eval $setvar
10688
10689         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10690                 val="$define"
10691         else
10692                 val="$undef"
10693         fi
10694         set d_pwcomment
10695         eval $setvar
10696
10697         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10698                 val="$define"
10699         else
10700                 val="$undef"
10701         fi
10702         set d_pwgecos
10703         eval $setvar
10704
10705         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10706                 val="$define"
10707         else
10708                 val="$undef"
10709         fi
10710         set d_pwpasswd
10711         eval $setvar
10712
10713         $rm -f $$.h
10714         ;;
10715 *)
10716         val="$undef"; 
10717         set d_pwquota; eval $setvar
10718         set d_pwage; eval $setvar
10719         set d_pwchange; eval $setvar
10720         set d_pwclass; eval $setvar
10721         set d_pwexpire; eval $setvar
10722         set d_pwcomment; eval $setvar
10723         set d_pwgecos; eval $setvar
10724         set d_pwpasswd; eval $setvar
10725         ;;
10726 esac
10727
10728 : see if endpwent_r exists
10729 set endpwent_r d_endpwent_r
10730 eval $inlibc
10731 case "$d_endpwent_r" in
10732 "$define")
10733         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10734         case "$d_endpwent_r_proto" in
10735         '')     d_endpwent_r_proto=define
10736                 set d_endpwent_r_proto endpwent_r $hdrs
10737                 eval $hasproto ;;
10738         *)      ;;
10739         esac
10740         case "$d_endpwent_r_proto" in
10741         define)
10742         case "$endpwent_r_proto" in
10743         ''|0) try='int endpwent_r(FILE**);'
10744         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10745         esac
10746         case "$endpwent_r_proto" in
10747         ''|0) try='void endpwent_r(FILE**);'
10748         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10749         esac
10750         case "$endpwent_r_proto" in
10751         '')     d_endpwent_r=undef
10752                 endpwent_r_proto=0
10753                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10754         * )     case "$endpwent_r_proto" in
10755                 REENTRANT_PROTO*) ;;
10756                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10757                 esac
10758                 echo "Prototype: $try" ;;
10759         esac
10760         ;;
10761         *)      echo "You have endpwent_r but no prototype, not using it." >&4 ;;
10762         esac
10763         ;;
10764 *)      endpwent_r_proto=0
10765         ;;
10766 esac
10767
10768 : see if endservent exists
10769 set endservent d_endsent
10770 eval $inlibc
10771
10772 : see if endservent_r exists
10773 set endservent_r d_endservent_r
10774 eval $inlibc
10775 case "$d_endservent_r" in
10776 "$define")
10777         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10778         case "$d_endservent_r_proto" in
10779         '')     d_endservent_r_proto=define
10780                 set d_endservent_r_proto endservent_r $hdrs
10781                 eval $hasproto ;;
10782         *)      ;;
10783         esac
10784         case "$d_endservent_r_proto" in
10785         define)
10786         case "$endservent_r_proto" in
10787         ''|0) try='int endservent_r(struct servent_data*);'
10788         ./protochk "extern $try" $hdrs && endservent_r_proto=I_S ;;
10789         esac
10790         case "$endservent_r_proto" in
10791         ''|0) try='void endservent_r(struct servent_data*);'
10792         ./protochk "extern $try" $hdrs && endservent_r_proto=V_S ;;
10793         esac
10794         case "$endservent_r_proto" in
10795         '')     d_endservent_r=undef
10796                 endservent_r_proto=0
10797                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10798         * )     case "$endservent_r_proto" in
10799                 REENTRANT_PROTO*) ;;
10800                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10801                 esac
10802                 echo "Prototype: $try" ;;
10803         esac
10804         ;;
10805         *)      echo "You have endservent_r but no prototype, not using it." >&4 ;;
10806         esac
10807         ;;
10808 *)      endservent_r_proto=0
10809         ;;
10810 esac
10811
10812 : Locate the flags for 'open()'
10813 echo " "
10814 $cat >try.c <<'EOCP'
10815 #include <sys/types.h>
10816 #ifdef I_FCNTL
10817 #include <fcntl.h>
10818 #endif
10819 #ifdef I_SYS_FILE
10820 #include <sys/file.h>
10821 #endif
10822 int main() {
10823         if(O_RDONLY);
10824 #ifdef O_TRUNC
10825         exit(0);
10826 #else
10827         exit(1);
10828 #endif
10829 }
10830 EOCP
10831 : check sys/file.h first to get FREAD on Sun
10832 if $test `./findhdr sys/file.h` && \
10833                 set try -DI_SYS_FILE && eval $compile; then
10834         h_sysfile=true;
10835         echo "<sys/file.h> defines the O_* constants..." >&4
10836         if $run ./try; then
10837                 echo "and you have the 3 argument form of open()." >&4
10838                 val="$define"
10839         else
10840                 echo "but not the 3 argument form of open().  Oh, well." >&4
10841                 val="$undef"
10842         fi
10843 elif $test `./findhdr fcntl.h` && \
10844                 set try -DI_FCNTL && eval $compile; then
10845         h_fcntl=true;
10846         echo "<fcntl.h> defines the O_* constants..." >&4
10847         if $run ./try; then
10848                 echo "and you have the 3 argument form of open()." >&4
10849                 val="$define"
10850         else
10851                 echo "but not the 3 argument form of open().  Oh, well." >&4
10852                 val="$undef"
10853         fi
10854 else
10855         val="$undef"
10856         echo "I can't find the O_* constant definitions!  You got problems." >&4
10857 fi
10858 set d_open3
10859 eval $setvar
10860 $rm -f try try.*
10861
10862 : see which of string.h or strings.h is needed
10863 echo " "
10864 strings=`./findhdr string.h`
10865 if $test "$strings" && $test -r "$strings"; then
10866         echo "Using <string.h> instead of <strings.h>." >&4
10867         val="$define"
10868 else
10869         val="$undef"
10870         strings=`./findhdr strings.h`
10871         if $test "$strings" && $test -r "$strings"; then
10872                 echo "Using <strings.h> instead of <string.h>." >&4
10873         else
10874                 echo "No string header found -- You'll surely have problems." >&4
10875         fi
10876 fi
10877 set i_string
10878 eval $setvar
10879 case "$i_string" in
10880 "$undef") strings=`./findhdr strings.h`;;
10881 *)        strings=`./findhdr string.h`;;
10882 esac
10883
10884 : see if this is a sys/file.h system
10885 val=''
10886 set sys/file.h val
10887 eval $inhdr
10888
10889 : do we need to include sys/file.h ?
10890 case "$val" in
10891 "$define")
10892         echo " "
10893         if $h_sysfile; then
10894                 val="$define"
10895                 echo "We'll be including <sys/file.h>." >&4
10896         else
10897                 val="$undef"
10898                 echo "We won't be including <sys/file.h>." >&4
10899         fi
10900         ;;
10901 *)
10902         h_sysfile=false
10903         ;;
10904 esac
10905 set i_sysfile
10906 eval $setvar
10907
10908 : see if fcntl.h is there
10909 val=''
10910 set fcntl.h val
10911 eval $inhdr
10912
10913 : see if we can include fcntl.h
10914 case "$val" in
10915 "$define")
10916         echo " "
10917         if $h_fcntl; then
10918                 val="$define"
10919                 echo "We'll be including <fcntl.h>." >&4
10920         else
10921                 val="$undef"
10922                 if $h_sysfile; then
10923         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10924                 else
10925                         echo "We won't be including <fcntl.h>." >&4
10926                 fi
10927         fi
10928         ;;
10929 *)
10930         h_fcntl=false
10931         val="$undef"
10932         ;;
10933 esac
10934 set i_fcntl
10935 eval $setvar
10936
10937 : check for non-blocking I/O stuff
10938 case "$h_sysfile" in
10939 true) echo "#include <sys/file.h>" > head.c;;
10940 *)
10941        case "$h_fcntl" in
10942        true) echo "#include <fcntl.h>" > head.c;;
10943        *) echo "#include <sys/fcntl.h>" > head.c;;
10944        esac
10945        ;;
10946 esac
10947 echo " "
10948 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
10949 case "$o_nonblock" in
10950 '')
10951         $cat head.c > try.c
10952         $cat >>try.c <<EOCP
10953 #include <stdio.h>
10954 #include <stdlib.h>
10955 #$i_fcntl I_FCNTL
10956 #ifdef I_FCNTL
10957 #include <fcntl.h>
10958 #endif
10959 int main() {
10960 #ifdef O_NONBLOCK
10961         printf("O_NONBLOCK\n");
10962         exit(0);
10963 #endif
10964 #ifdef O_NDELAY
10965         printf("O_NDELAY\n");
10966         exit(0);
10967 #endif
10968 #ifdef FNDELAY
10969         printf("FNDELAY\n");
10970         exit(0);
10971 #endif
10972         exit(0);
10973 }
10974 EOCP
10975         set try
10976         if eval $compile_ok; then
10977                 o_nonblock=`$run ./try`
10978                 case "$o_nonblock" in
10979                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
10980                 *) echo "Seems like we can use $o_nonblock.";;
10981                 esac
10982         else
10983                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
10984         fi
10985         ;;
10986 *) echo "Using $hint value $o_nonblock.";;
10987 esac
10988 $rm -f try try.* .out core
10989
10990 echo " "
10991 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
10992 case "$eagain" in
10993 '')
10994         $cat head.c > try.c
10995         $cat >>try.c <<EOCP
10996 #include <errno.h>
10997 #include <sys/types.h>
10998 #include <signal.h>
10999 #include <stdio.h> 
11000 #include <stdlib.h> 
11001 #$i_fcntl I_FCNTL
11002 #ifdef I_FCNTL
11003 #include <fcntl.h>
11004 #endif
11005 #define MY_O_NONBLOCK $o_nonblock
11006 #ifndef errno  /* XXX need better Configure test */
11007 extern int errno;
11008 #endif
11009 #$i_unistd I_UNISTD
11010 #ifdef I_UNISTD
11011 #include <unistd.h>
11012 #endif
11013 #$i_string I_STRING
11014 #ifdef I_STRING
11015 #include <string.h>
11016 #else
11017 #include <strings.h>
11018 #endif
11019 $signal_t blech(x) int x; { exit(3); }
11020 EOCP
11021         $cat >> try.c <<'EOCP'
11022 int main()
11023 {
11024         int pd[2];
11025         int pu[2];
11026         char buf[1];
11027         char string[100];
11028
11029         pipe(pd);       /* Down: child -> parent */
11030         pipe(pu);       /* Up: parent -> child */
11031         if (0 != fork()) {
11032                 int ret;
11033                 close(pd[1]);   /* Parent reads from pd[0] */
11034                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11035 #ifdef F_SETFL
11036                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11037                         exit(1);
11038 #else
11039                 exit(4);
11040 #endif
11041                 signal(SIGALRM, blech);
11042                 alarm(5);
11043                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11044                         exit(2);
11045                 sprintf(string, "%d\n", ret);
11046                 write(2, string, strlen(string));
11047                 alarm(0);
11048 #ifdef EAGAIN
11049                 if (errno == EAGAIN) {
11050                         printf("EAGAIN\n");
11051                         goto ok;
11052                 }
11053 #endif
11054 #ifdef EWOULDBLOCK
11055                 if (errno == EWOULDBLOCK)
11056                         printf("EWOULDBLOCK\n");
11057 #endif
11058         ok:
11059                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11060                 sleep(2);                               /* Give it time to close our pipe */
11061                 alarm(5);
11062                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11063                 alarm(0);
11064                 sprintf(string, "%d\n", ret);
11065                 write(4, string, strlen(string));
11066                 exit(0);
11067         }
11068
11069         close(pd[0]);                   /* We write to pd[1] */
11070         close(pu[1]);                   /* We read from pu[0] */
11071         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11072         close(pd[1]);                   /* Pipe pd is now fully closed! */
11073         exit(0);                                /* Bye bye, thank you for playing! */
11074 }
11075 EOCP
11076         set try
11077         if eval $compile_ok; then
11078                 echo "$startsh" >mtry
11079                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11080                 chmod +x mtry
11081                 ./mtry >/dev/null 2>&1
11082                 case $? in
11083                 0) eagain=`$cat try.out`;;
11084                 1) echo "Could not perform non-blocking setting!";;
11085                 2) echo "I did a successful read() for something that was not there!";;
11086                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11087                 4) echo "Could not find F_SETFL!";;
11088                 *) echo "Something terribly wrong happened during testing.";;
11089                 esac
11090                 rd_nodata=`$cat try.ret`
11091                 echo "A read() system call with no data present returns $rd_nodata."
11092                 case "$rd_nodata" in
11093                 0|-1) ;;
11094                 *)
11095                         echo "(That's peculiar, fixing that to be -1.)"
11096                         rd_nodata=-1
11097                         ;;
11098                 esac
11099                 case "$eagain" in
11100                 '')
11101                         echo "Forcing errno EAGAIN on read() with no data available."
11102                         eagain=EAGAIN
11103                         ;;
11104                 *)
11105                         echo "Your read() sets errno to $eagain when no data is available."
11106                         ;;
11107                 esac
11108                 status=`$cat try.err`
11109                 case "$status" in
11110                 0) echo "And it correctly returns 0 to signal EOF.";;
11111                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11112                 *) echo "However, your read() returns '$status' on EOF??";;
11113                 esac
11114                 val="$define"
11115                 if test "$status" = "$rd_nodata"; then
11116                         echo "WARNING: you can't distinguish between EOF and no data!"
11117                         val="$undef"
11118                 fi
11119         else
11120                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11121                 eagain=EAGAIN
11122         fi
11123         set d_eofnblk
11124         eval $setvar
11125         ;;
11126 *)
11127         echo "Using $hint value $eagain."
11128         echo "Your read() returns $rd_nodata when no data is present."
11129         case "$d_eofnblk" in
11130         "$define") echo "And you can see EOF because read() returns 0.";;
11131         "$undef") echo "But you can't see EOF status from read() returned value.";;
11132         *)
11133                 echo "(Assuming you can't see EOF status from read anyway.)"
11134                 d_eofnblk=$undef
11135                 ;;
11136         esac
11137         ;;
11138 esac
11139 $rm -f try try.* .out core head.c mtry
11140
11141 : see if fchdir exists
11142 set fchdir d_fchdir
11143 eval $inlibc
11144
11145 : see if fchmod exists
11146 set fchmod d_fchmod
11147 eval $inlibc
11148
11149 : see if fchown exists
11150 set fchown d_fchown
11151 eval $inlibc
11152
11153 : see if this is an fcntl system
11154 set fcntl d_fcntl
11155 eval $inlibc
11156
11157 echo " "
11158 : See if fcntl-based locking works.
11159 $cat >try.c <<EOCP
11160 #include <stdlib.h>
11161 #include <unistd.h>
11162 #include <fcntl.h>
11163 #include <signal.h>
11164 $signal_t blech(x) int x; { exit(3); }
11165 int main() {
11166 #if defined(F_SETLK) && defined(F_SETLKW)
11167      struct flock flock;
11168      int retval, fd;
11169      fd = open("try.c", O_RDONLY);
11170      flock.l_type = F_RDLCK;
11171      flock.l_whence = SEEK_SET;
11172      flock.l_start = flock.l_len = 0;
11173      signal(SIGALRM, blech);
11174      alarm(10);
11175      retval = fcntl(fd, F_SETLK, &flock);
11176      close(fd);
11177      (retval < 0 ? exit(2) : exit(0));
11178 #else
11179      exit(2);
11180 #endif
11181 }
11182 EOCP
11183 echo "Checking if fcntl-based file locking works... "
11184 case "$d_fcntl" in
11185 "$define")
11186         set try
11187         if eval $compile_ok; then
11188                 if $run ./try; then
11189                         echo "Yes, it seems to work."
11190                         val="$define"
11191                 else
11192                         echo "Nope, it didn't work."
11193                         val="$undef"
11194                         case "$?" in
11195                         3) $cat >&4 <<EOM
11196 ***
11197 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11198 *** This is (almost) impossible.
11199 *** If your NFS lock daemons are not feeling well, something like
11200 *** this may happen, please investigate.  Cannot continue, aborting.
11201 ***
11202 EOM
11203                                 exit 1
11204                                 ;;
11205                         esac
11206                 fi
11207         else
11208                 echo "I'm unable to compile the test program, so I'll assume not."
11209                 val="$undef"
11210         fi
11211         ;;
11212 *) val="$undef";
11213         echo "Nope, since you don't even have fcntl()."
11214         ;;
11215 esac
11216 set d_fcntl_can_lock
11217 eval $setvar
11218 $rm -f try*
11219
11220
11221 : check for fd_set items
11222 $cat <<EOM
11223
11224 Checking to see how well your C compiler handles fd_set and friends ...
11225 EOM
11226 $cat >try.c <<EOCP
11227 #$i_systime I_SYS_TIME
11228 #$i_sysselct I_SYS_SELECT
11229 #$d_socket HAS_SOCKET
11230 #include <sys/types.h>
11231 #ifdef HAS_SOCKET
11232 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11233 #endif
11234 #ifdef I_SYS_TIME
11235 #include <sys/time.h>
11236 #endif
11237 #ifdef I_SYS_SELECT
11238 #include <sys/select.h>
11239 #endif
11240 int main() {
11241         fd_set fds;
11242
11243 #ifdef TRYBITS
11244         if(fds.fds_bits);
11245 #endif
11246
11247 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11248         exit(0);
11249 #else
11250         exit(1);
11251 #endif
11252 }
11253 EOCP
11254 set try -DTRYBITS
11255 if eval $compile; then
11256         d_fds_bits="$define"
11257         d_fd_set="$define"
11258         echo "Well, your system knows about the normal fd_set typedef..." >&4
11259         if $run ./try; then
11260                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11261                 d_fd_macros="$define"
11262         else
11263                 $cat >&4 <<'EOM'
11264 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11265 EOM
11266                 d_fd_macros="$undef"
11267         fi
11268 else
11269         $cat <<'EOM'
11270 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11271 EOM
11272         set try
11273         if eval $compile; then
11274                 d_fds_bits="$undef"
11275                 d_fd_set="$define"
11276                 echo "Well, your system has some sort of fd_set available..." >&4
11277                 if $run ./try; then
11278                         echo "and you have the normal fd_set macros." >&4
11279                         d_fd_macros="$define"
11280                 else
11281                         $cat <<'EOM'
11282 but not the normal fd_set macros!  Gross!  More work for me...
11283 EOM
11284                         d_fd_macros="$undef"
11285                 fi
11286         else
11287         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11288                 d_fd_set="$undef"
11289                 d_fds_bits="$undef"
11290                 d_fd_macros="$undef"
11291         fi
11292 fi
11293 $rm -f try try.*
11294
11295 : see if fgetpos exists
11296 set fgetpos d_fgetpos
11297 eval $inlibc
11298
11299 : see if finite exists
11300 set finite d_finite
11301 eval $inlibc
11302
11303 : see if finitel exists
11304 set finitel d_finitel
11305 eval $inlibc
11306
11307 : see if flock exists
11308 set flock d_flock
11309 eval $inlibc
11310
11311 : see if prototype for flock is available
11312 echo " "
11313 set d_flockproto flock $i_sysfile sys/file.h
11314 eval $hasproto
11315
11316 : see if fork exists
11317 set fork d_fork
11318 eval $inlibc
11319
11320 : see if fp_class exists
11321 set fp_class d_fp_class
11322 eval $inlibc
11323
11324 : see if pathconf exists
11325 set pathconf d_pathconf
11326 eval $inlibc
11327
11328 : see if fpathconf exists
11329 set fpathconf d_fpathconf
11330 eval $inlibc
11331
11332 : see if fpclass exists
11333 set fpclass d_fpclass
11334 eval $inlibc
11335
11336 : see if fpclassify exists
11337 set fpclassify d_fpclassify
11338 eval $inlibc
11339
11340 : see if fpclassl exists
11341 set fpclassl d_fpclassl
11342 eval $inlibc
11343
11344
11345 : check for fpos64_t
11346 echo " "
11347 echo "Checking to see if you have fpos64_t..." >&4
11348 $cat >try.c <<EOCP
11349 #include <stdio.h>
11350 int main() { fpos64_t x = 7; }
11351 EOCP
11352 set try
11353 if eval $compile; then
11354         val="$define"
11355         echo "You have fpos64_t."
11356 else
11357         val="$undef"
11358         echo "You do not have fpos64_t."
11359         case "$fpossize" in
11360         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11361         esac
11362 fi
11363 $rm -f try.* try
11364 set d_fpos64_t
11365 eval $setvar
11366
11367 : see if frexpl exists
11368 set frexpl d_frexpl
11369 eval $inlibc
11370
11371 : see if this is a sys/param system
11372 set sys/param.h i_sysparam
11373 eval $inhdr
11374
11375 : see if this is a sys/mount.h system
11376 set sys/mount.h i_sysmount
11377 eval $inhdr
11378
11379
11380 echo " "
11381 echo "Checking to see if your system supports struct fs_data..." >&4
11382 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11383 eval $hasstruct
11384 case "$d_fs_data_s" in
11385 "$define")      echo "Yes, it does."   ;;
11386 *)              echo "No, it doesn't." ;;
11387 esac
11388
11389 : see if fseeko exists
11390 set fseeko d_fseeko
11391 eval $inlibc
11392 case "$longsize" in
11393 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11394 esac
11395
11396 : see if fsetpos exists
11397 set fsetpos d_fsetpos
11398 eval $inlibc
11399
11400
11401 : see if fstatfs exists
11402 set fstatfs d_fstatfs
11403 eval $inlibc
11404
11405
11406 : see if statvfs exists
11407 set statvfs d_statvfs
11408 eval $inlibc
11409
11410 : see if fstatvfs exists
11411 set fstatvfs d_fstatvfs
11412 eval $inlibc
11413
11414
11415 : see if fsync exists
11416 set fsync d_fsync
11417 eval $inlibc
11418
11419 : see if ftello exists
11420 set ftello d_ftello
11421 eval $inlibc
11422 case "$longsize" in
11423 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11424 esac
11425
11426 : see if getcwd exists
11427 set getcwd d_getcwd
11428 eval $inlibc
11429
11430 : see if getespwnam exists
11431 set getespwnam d_getespwnam
11432 eval $inlibc
11433
11434
11435 : see if getfsstat exists
11436 set getfsstat d_getfsstat
11437 eval $inlibc
11438
11439 : see if getgrent exists
11440 set getgrent d_getgrent
11441 eval $inlibc
11442
11443 : see if getgrent_r exists
11444 set getgrent_r d_getgrent_r
11445 eval $inlibc
11446 case "$d_getgrent_r" in
11447 "$define")
11448         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11449         case "$d_getgrent_r_proto" in
11450         '')     d_getgrent_r_proto=define
11451                 set d_getgrent_r_proto getgrent_r $hdrs
11452                 eval $hasproto ;;
11453         *)      ;;
11454         esac
11455         case "$d_getgrent_r_proto" in
11456         define)
11457         case "$getgrent_r_proto" in
11458         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11459         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11460         esac
11461         case "$getgrent_r_proto" in
11462         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11463         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11464         esac
11465         case "$getgrent_r_proto" in
11466         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11467         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11468         esac
11469         case "$getgrent_r_proto" in
11470         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11471         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11472         esac
11473         case "$getgrent_r_proto" in
11474         ''|0) try='int getgrent_r(struct group*, char*, int);'
11475         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11476         esac
11477         case "$getgrent_r_proto" in
11478         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11479         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11480         esac
11481         case "$getgrent_r_proto" in
11482         '')     d_getgrent_r=undef
11483                 getgrent_r_proto=0
11484                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11485         * )     case "$getgrent_r_proto" in
11486                 REENTRANT_PROTO*) ;;
11487                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11488                 esac
11489                 echo "Prototype: $try" ;;
11490         esac
11491         ;;
11492         *)      echo "You have getgrent_r but no prototype, not using it." >&4 ;;
11493         esac
11494         ;;
11495 *)      getgrent_r_proto=0
11496         ;;
11497 esac
11498
11499 : see if getgrgid_r exists
11500 set getgrgid_r d_getgrgid_r
11501 eval $inlibc
11502 case "$d_getgrgid_r" in
11503 "$define")
11504         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11505         case "$d_getgrgid_r_proto" in
11506         '')     d_getgrgid_r_proto=define
11507                 set d_getgrgid_r_proto getgrgid_r $hdrs
11508                 eval $hasproto ;;
11509         *)      ;;
11510         esac
11511         case "$d_getgrgid_r_proto" in
11512         define)
11513         case "$getgrgid_r_proto" in
11514         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11515         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11516         esac
11517         case "$getgrgid_r_proto" in
11518         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11519         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11520         esac
11521         case "$getgrgid_r_proto" in
11522         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11523         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11524         esac
11525         case "$getgrgid_r_proto" in
11526         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11527         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11528         esac
11529         case "$getgrgid_r_proto" in
11530         '')     d_getgrgid_r=undef
11531                 getgrgid_r_proto=0
11532                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11533         * )     case "$getgrgid_r_proto" in
11534                 REENTRANT_PROTO*) ;;
11535                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11536                 esac
11537                 echo "Prototype: $try" ;;
11538         esac
11539         ;;
11540         *)      echo "You have getgrgid_r but no prototype, not using it." >&4 ;;
11541         esac
11542         ;;
11543 *)      getgrgid_r_proto=0
11544         ;;
11545 esac
11546
11547 : see if getgrnam_r exists
11548 set getgrnam_r d_getgrnam_r
11549 eval $inlibc
11550 case "$d_getgrnam_r" in
11551 "$define")
11552         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11553         case "$d_getgrnam_r_proto" in
11554         '')     d_getgrnam_r_proto=define
11555                 set d_getgrnam_r_proto getgrnam_r $hdrs
11556                 eval $hasproto ;;
11557         *)      ;;
11558         esac
11559         case "$d_getgrnam_r_proto" in
11560         define)
11561         case "$getgrnam_r_proto" in
11562         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11563         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11564         esac
11565         case "$getgrnam_r_proto" in
11566         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11567         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11568         esac
11569         case "$getgrnam_r_proto" in
11570         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11571         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11572         esac
11573         case "$getgrnam_r_proto" in
11574         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11575         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11576         esac
11577         case "$getgrnam_r_proto" in
11578         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11579         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11580         esac
11581         case "$getgrnam_r_proto" in
11582         '')     d_getgrnam_r=undef
11583                 getgrnam_r_proto=0
11584                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11585         * )     case "$getgrnam_r_proto" in
11586                 REENTRANT_PROTO*) ;;
11587                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11588                 esac
11589                 echo "Prototype: $try" ;;
11590         esac
11591         ;;
11592         *)      echo "You have getgrnam_r but no prototype, not using it." >&4 ;;
11593         esac
11594         ;;
11595 *)      getgrnam_r_proto=0
11596         ;;
11597 esac
11598
11599 : see if gethostbyaddr exists
11600 set gethostbyaddr d_gethbyaddr
11601 eval $inlibc
11602
11603 : see if gethostbyname exists
11604 set gethostbyname d_gethbyname
11605 eval $inlibc
11606
11607 : see if gethostent exists
11608 set gethostent d_gethent
11609 eval $inlibc
11610
11611 : see how we will look up host name
11612 echo " "
11613 call=''
11614 if set gethostname val -f d_gethname; eval $csym; $val; then
11615         echo 'gethostname() found.' >&4
11616         d_gethname="$define"
11617         call=gethostname
11618 fi
11619 if set uname val -f d_uname; eval $csym; $val; then
11620         if ./xenix; then
11621                 $cat <<'EOM'
11622 uname() was found, but you're running xenix, and older versions of xenix
11623 have a broken uname(). If you don't really know whether your xenix is old
11624 enough to have a broken system call, use the default answer.
11625
11626 EOM
11627                 dflt=y
11628                 case "$d_uname" in
11629                 "$define") dflt=n;;
11630                 esac
11631                 rp='Is your uname() broken?'
11632                 . ./myread
11633                 case "$ans" in
11634                 n*) d_uname="$define"; call=uname;;
11635                 esac
11636         else
11637                 echo 'uname() found.' >&4
11638                 d_uname="$define"
11639                 case "$call" in
11640                 '') call=uname ;;
11641                 esac
11642         fi
11643 fi
11644 case "$d_gethname" in
11645 '') d_gethname="$undef";;
11646 esac
11647 case "$d_uname" in
11648 '') d_uname="$undef";;
11649 esac
11650 case "$d_uname$d_gethname" in
11651 *define*)
11652         dflt=n
11653         cat <<EOM
11654  
11655 Every now and then someone has a $call() that lies about the hostname
11656 but can't be fixed for political or economic reasons.  If you wish, I can
11657 pretend $call() isn't there and maybe compute hostname at run-time
11658 thanks to the '$phostname' command.
11659
11660 EOM
11661         rp="Shall I ignore $call() from now on?"
11662         . ./myread
11663         case "$ans" in
11664         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11665         esac;;
11666 esac
11667 case "$phostname" in
11668 '') aphostname='';;
11669 *) case "$aphostname" in
11670         /*) ;;
11671         *) set X $phostname
11672                 shift
11673                 file=$1
11674                 shift
11675                 file=`./loc $file $file $pth`
11676                 aphostname=`echo $file $*`
11677                 ;;
11678         esac
11679         ;;
11680 esac
11681 case "$d_uname$d_gethname" in
11682 *define*) ;;
11683 *)
11684         case "$phostname" in
11685         '')
11686                 echo "There will be no way for $package to get your hostname." >&4;;
11687         *)
11688         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11689                 ;;
11690         esac;;
11691 esac
11692 case "$d_phostname" in
11693 '') d_phostname="$undef";;
11694 esac
11695
11696 : see if gethostbyaddr_r exists
11697 set gethostbyaddr_r d_gethostbyaddr_r
11698 eval $inlibc
11699 case "$d_gethostbyaddr_r" in
11700 "$define")
11701         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11702         case "$d_gethostbyaddr_r_proto" in
11703         '')     d_gethostbyaddr_r_proto=define
11704                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11705                 eval $hasproto ;;
11706         *)      ;;
11707         esac
11708         case "$d_gethostbyaddr_r_proto" in
11709         define)
11710         case "$gethostbyaddr_r_proto" in
11711         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11712         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11713         esac
11714         case "$gethostbyaddr_r_proto" in
11715         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11716         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11717         esac
11718         case "$gethostbyaddr_r_proto" in
11719         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11720         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11721         esac
11722         case "$gethostbyaddr_r_proto" in
11723         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11724         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11725         esac
11726         case "$gethostbyaddr_r_proto" in
11727         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11728         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11729         esac
11730         case "$gethostbyaddr_r_proto" in
11731         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11732         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11733         esac
11734         case "$gethostbyaddr_r_proto" in
11735         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11736         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11737         esac
11738         case "$gethostbyaddr_r_proto" in
11739         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11740         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11741         esac
11742         case "$gethostbyaddr_r_proto" in
11743         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11744         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11745         esac
11746         case "$gethostbyaddr_r_proto" in
11747         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11748         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11749         esac
11750         case "$gethostbyaddr_r_proto" in
11751         '')     d_gethostbyaddr_r=undef
11752                 gethostbyaddr_r_proto=0
11753                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11754         * )     case "$gethostbyaddr_r_proto" in
11755                 REENTRANT_PROTO*) ;;
11756                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11757                 esac
11758                 echo "Prototype: $try" ;;
11759         esac
11760         ;;
11761         *)      echo "You have gethostbyaddr_r but no prototype, not using it." >&4 ;;
11762         esac
11763         ;;
11764 *)      gethostbyaddr_r_proto=0
11765         ;;
11766 esac
11767
11768 : see if gethostbyname_r exists
11769 set gethostbyname_r d_gethostbyname_r
11770 eval $inlibc
11771 case "$d_gethostbyname_r" in
11772 "$define")
11773         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11774         case "$d_gethostbyname_r_proto" in
11775         '')     d_gethostbyname_r_proto=define
11776                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11777                 eval $hasproto ;;
11778         *)      ;;
11779         esac
11780         case "$d_gethostbyname_r_proto" in
11781         define)
11782         case "$gethostbyname_r_proto" in
11783         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11784         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11785         esac
11786         case "$gethostbyname_r_proto" in
11787         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11788         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11789         esac
11790         case "$gethostbyname_r_proto" in
11791         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11792         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11793         esac
11794         case "$gethostbyname_r_proto" in
11795         '')     d_gethostbyname_r=undef
11796                 gethostbyname_r_proto=0
11797                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11798         * )     case "$gethostbyname_r_proto" in
11799                 REENTRANT_PROTO*) ;;
11800                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11801                 esac
11802                 echo "Prototype: $try" ;;
11803         esac
11804         ;;
11805         *)      echo "You have gethostbyname_r but no prototype, not using it." >&4 ;;
11806         esac
11807         ;;
11808 *)      gethostbyname_r_proto=0
11809         ;;
11810 esac
11811
11812 : see if gethostent_r exists
11813 set gethostent_r d_gethostent_r
11814 eval $inlibc
11815 case "$d_gethostent_r" in
11816 "$define")
11817         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11818         case "$d_gethostent_r_proto" in
11819         '')     d_gethostent_r_proto=define
11820                 set d_gethostent_r_proto gethostent_r $hdrs
11821                 eval $hasproto ;;
11822         *)      ;;
11823         esac
11824         case "$d_gethostent_r_proto" in
11825         define)
11826         case "$gethostent_r_proto" in
11827         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11828         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11829         esac
11830         case "$gethostent_r_proto" in
11831         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11832         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11833         esac
11834         case "$gethostent_r_proto" in
11835         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11836         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11837         esac
11838         case "$gethostent_r_proto" in
11839         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11840         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11841         esac
11842         case "$gethostent_r_proto" in
11843         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11844         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11845         esac
11846         case "$gethostent_r_proto" in
11847         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11848         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11849         esac
11850         case "$gethostent_r_proto" in
11851         '')     d_gethostent_r=undef
11852                 gethostent_r_proto=0
11853                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11854         * )     case "$gethostent_r_proto" in
11855                 REENTRANT_PROTO*) ;;
11856                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11857                 esac
11858                 echo "Prototype: $try" ;;
11859         esac
11860         ;;
11861         *)      echo "You have gethostent_r but no prototype, not using it." >&4 ;;
11862         esac
11863         ;;
11864 *)      gethostent_r_proto=0
11865         ;;
11866 esac
11867
11868 : see if prototypes for various gethostxxx netdb.h functions are available
11869 echo " "
11870 set d_gethostprotos gethostent $i_netdb netdb.h
11871 eval $hasproto
11872
11873 : see if getitimer exists
11874 set getitimer d_getitimer
11875 eval $inlibc
11876
11877 : see if getlogin exists
11878 set getlogin d_getlogin
11879 eval $inlibc
11880
11881 : see if getlogin_r exists
11882 set getlogin_r d_getlogin_r
11883 eval $inlibc
11884 case "$d_getlogin_r" in
11885 "$define")
11886         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11887         case "$d_getlogin_r_proto" in
11888         '')     d_getlogin_r_proto=define
11889                 set d_getlogin_r_proto getlogin_r $hdrs
11890                 eval $hasproto ;;
11891         *)      ;;
11892         esac
11893         case "$d_getlogin_r_proto" in
11894         define)
11895         case "$getlogin_r_proto" in
11896         ''|0) try='int getlogin_r(char*, size_t);'
11897         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11898         esac
11899         case "$getlogin_r_proto" in
11900         ''|0) try='int getlogin_r(char*, int);'
11901         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11902         esac
11903         case "$getlogin_r_proto" in
11904         ''|0) try='char* getlogin_r(char*, size_t);'
11905         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11906         esac
11907         case "$getlogin_r_proto" in
11908         ''|0) try='char* getlogin_r(char*, int);'
11909         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11910         esac
11911         case "$getlogin_r_proto" in
11912         '')     d_getlogin_r=undef
11913                 getlogin_r_proto=0
11914                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
11915         * )     case "$getlogin_r_proto" in
11916                 REENTRANT_PROTO*) ;;
11917                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
11918                 esac
11919                 echo "Prototype: $try" ;;
11920         esac
11921         ;;
11922         *)      echo "You have getlogin_r but no prototype, not using it." >&4 ;;
11923         esac
11924         ;;
11925 *)      getlogin_r_proto=0
11926         ;;
11927 esac
11928
11929 : see if getmnt exists
11930 set getmnt d_getmnt
11931 eval $inlibc
11932
11933 : see if getmntent exists
11934 set getmntent d_getmntent
11935 eval $inlibc
11936
11937 : see if getnetbyaddr exists
11938 set getnetbyaddr d_getnbyaddr
11939 eval $inlibc
11940
11941 : see if getnetbyname exists
11942 set getnetbyname d_getnbyname
11943 eval $inlibc
11944
11945 : see if getnetent exists
11946 set getnetent d_getnent
11947 eval $inlibc
11948
11949 : see if getnetbyaddr_r exists
11950 set getnetbyaddr_r d_getnetbyaddr_r
11951 eval $inlibc
11952 case "$d_getnetbyaddr_r" in
11953 "$define")
11954         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11955         case "$d_getnetbyaddr_r_proto" in
11956         '')     d_getnetbyaddr_r_proto=define
11957                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
11958                 eval $hasproto ;;
11959         *)      ;;
11960         esac
11961         case "$d_getnetbyaddr_r_proto" in
11962         define)
11963         case "$getnetbyaddr_r_proto" in
11964         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
11965         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
11966         esac
11967         case "$getnetbyaddr_r_proto" in
11968         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
11969         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
11970         esac
11971         case "$getnetbyaddr_r_proto" in
11972         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
11973         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
11974         esac
11975         case "$getnetbyaddr_r_proto" in
11976         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
11977         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
11978         esac
11979         case "$getnetbyaddr_r_proto" in
11980         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
11981         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
11982         esac
11983         case "$getnetbyaddr_r_proto" in
11984         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
11985         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
11986         esac
11987         case "$getnetbyaddr_r_proto" in
11988         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
11989         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
11990         esac
11991         case "$getnetbyaddr_r_proto" in
11992         '')     d_getnetbyaddr_r=undef
11993                 getnetbyaddr_r_proto=0
11994                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
11995         * )     case "$getnetbyaddr_r_proto" in
11996                 REENTRANT_PROTO*) ;;
11997                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
11998                 esac
11999                 echo "Prototype: $try" ;;
12000         esac
12001         ;;
12002         *)      echo "You have getnetbyaddr_r but no prototype, not using it." >&4 ;;
12003         esac
12004         ;;
12005 *)      getnetbyaddr_r_proto=0
12006         ;;
12007 esac
12008
12009 : see if getnetbyname_r exists
12010 set getnetbyname_r d_getnetbyname_r
12011 eval $inlibc
12012 case "$d_getnetbyname_r" in
12013 "$define")
12014         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12015         case "$d_getnetbyname_r_proto" in
12016         '')     d_getnetbyname_r_proto=define
12017                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12018                 eval $hasproto ;;
12019         *)      ;;
12020         esac
12021         case "$d_getnetbyname_r_proto" in
12022         define)
12023         case "$getnetbyname_r_proto" in
12024         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12025         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12026         esac
12027         case "$getnetbyname_r_proto" in
12028         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12029         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12030         esac
12031         case "$getnetbyname_r_proto" in
12032         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12033         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12034         esac
12035         case "$getnetbyname_r_proto" in
12036         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12037         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12038         esac
12039         case "$getnetbyname_r_proto" in
12040         '')     d_getnetbyname_r=undef
12041                 getnetbyname_r_proto=0
12042                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12043         * )     case "$getnetbyname_r_proto" in
12044                 REENTRANT_PROTO*) ;;
12045                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12046                 esac
12047                 echo "Prototype: $try" ;;
12048         esac
12049         ;;
12050         *)      echo "You have getnetbyname_r but no prototype, not using it." >&4 ;;
12051         esac
12052         ;;
12053 *)      getnetbyname_r_proto=0
12054         ;;
12055 esac
12056
12057 : see if getnetent_r exists
12058 set getnetent_r d_getnetent_r
12059 eval $inlibc
12060 case "$d_getnetent_r" in
12061 "$define")
12062         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12063         case "$d_getnetent_r_proto" in
12064         '')     d_getnetent_r_proto=define
12065                 set d_getnetent_r_proto getnetent_r $hdrs
12066                 eval $hasproto ;;
12067         *)      ;;
12068         esac
12069         case "$d_getnetent_r_proto" in
12070         define)
12071         case "$getnetent_r_proto" in
12072         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12073         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12074         esac
12075         case "$getnetent_r_proto" in
12076         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12077         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12078         esac
12079         case "$getnetent_r_proto" in
12080         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12081         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12082         esac
12083         case "$getnetent_r_proto" in
12084         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12085         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12086         esac
12087         case "$getnetent_r_proto" in
12088         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12089         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12090         esac
12091         case "$getnetent_r_proto" in
12092         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12093         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12094         esac
12095         case "$getnetent_r_proto" in
12096         '')     d_getnetent_r=undef
12097                 getnetent_r_proto=0
12098                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12099         * )     case "$getnetent_r_proto" in
12100                 REENTRANT_PROTO*) ;;
12101                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12102                 esac
12103                 echo "Prototype: $try" ;;
12104         esac
12105         ;;
12106         *)      echo "You have getnetent_r but no prototype, not using it." >&4 ;;
12107         esac
12108         ;;
12109 *)      getnetent_r_proto=0
12110         ;;
12111 esac
12112
12113 : see if prototypes for various getnetxxx netdb.h functions are available
12114 echo " "
12115 set d_getnetprotos getnetent $i_netdb netdb.h
12116 eval $hasproto
12117
12118 : see if getpagesize exists
12119 set getpagesize d_getpagsz
12120 eval $inlibc
12121
12122
12123 : see if getprotobyname exists
12124 set getprotobyname d_getpbyname
12125 eval $inlibc
12126
12127 : see if getprotobynumber exists
12128 set getprotobynumber d_getpbynumber
12129 eval $inlibc
12130
12131 : see if getprotoent exists
12132 set getprotoent d_getpent
12133 eval $inlibc
12134
12135 : see if getpgid exists
12136 set getpgid d_getpgid
12137 eval $inlibc
12138
12139 : see if getpgrp2 exists
12140 set getpgrp2 d_getpgrp2
12141 eval $inlibc
12142
12143 : see if getppid exists
12144 set getppid d_getppid
12145 eval $inlibc
12146
12147 : see if getpriority exists
12148 set getpriority d_getprior
12149 eval $inlibc
12150
12151 : see if getprotobyname_r exists
12152 set getprotobyname_r d_getprotobyname_r
12153 eval $inlibc
12154 case "$d_getprotobyname_r" in
12155 "$define")
12156         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12157         case "$d_getprotobyname_r_proto" in
12158         '')     d_getprotobyname_r_proto=define
12159                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12160                 eval $hasproto ;;
12161         *)      ;;
12162         esac
12163         case "$d_getprotobyname_r_proto" in
12164         define)
12165         case "$getprotobyname_r_proto" in
12166         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12167         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12168         esac
12169         case "$getprotobyname_r_proto" in
12170         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12171         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12172         esac
12173         case "$getprotobyname_r_proto" in
12174         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12175         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12176         esac
12177         case "$getprotobyname_r_proto" in
12178         '')     d_getprotobyname_r=undef
12179                 getprotobyname_r_proto=0
12180                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12181         * )     case "$getprotobyname_r_proto" in
12182                 REENTRANT_PROTO*) ;;
12183                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12184                 esac
12185                 echo "Prototype: $try" ;;
12186         esac
12187         ;;
12188         *)      echo "You have getprotobyname_r but no prototype, not using it." >&4 ;;
12189         esac
12190         ;;
12191 *)      getprotobyname_r_proto=0
12192         ;;
12193 esac
12194
12195 : see if getprotobynumber_r exists
12196 set getprotobynumber_r d_getprotobynumber_r
12197 eval $inlibc
12198 case "$d_getprotobynumber_r" in
12199 "$define")
12200         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12201         case "$d_getprotobynumber_r_proto" in
12202         '')     d_getprotobynumber_r_proto=define
12203                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12204                 eval $hasproto ;;
12205         *)      ;;
12206         esac
12207         case "$d_getprotobynumber_r_proto" in
12208         define)
12209         case "$getprotobynumber_r_proto" in
12210         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12211         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12212         esac
12213         case "$getprotobynumber_r_proto" in
12214         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12215         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12216         esac
12217         case "$getprotobynumber_r_proto" in
12218         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12219         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12220         esac
12221         case "$getprotobynumber_r_proto" in
12222         '')     d_getprotobynumber_r=undef
12223                 getprotobynumber_r_proto=0
12224                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12225         * )     case "$getprotobynumber_r_proto" in
12226                 REENTRANT_PROTO*) ;;
12227                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12228                 esac
12229                 echo "Prototype: $try" ;;
12230         esac
12231         ;;
12232         *)      echo "You have getprotobynumber_r but no prototype, not using it." >&4 ;;
12233         esac
12234         ;;
12235 *)      getprotobynumber_r_proto=0
12236         ;;
12237 esac
12238
12239 : see if getprotoent_r exists
12240 set getprotoent_r d_getprotoent_r
12241 eval $inlibc
12242 case "$d_getprotoent_r" in
12243 "$define")
12244         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12245         case "$d_getprotoent_r_proto" in
12246         '')     d_getprotoent_r_proto=define
12247                 set d_getprotoent_r_proto getprotoent_r $hdrs
12248                 eval $hasproto ;;
12249         *)      ;;
12250         esac
12251         case "$d_getprotoent_r_proto" in
12252         define)
12253         case "$getprotoent_r_proto" in
12254         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12255         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12256         esac
12257         case "$getprotoent_r_proto" in
12258         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12259         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12260         esac
12261         case "$getprotoent_r_proto" in
12262         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12263         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12264         esac
12265         case "$getprotoent_r_proto" in
12266         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12267         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12268         esac
12269         case "$getprotoent_r_proto" in
12270         '')     d_getprotoent_r=undef
12271                 getprotoent_r_proto=0
12272                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12273         * )     case "$getprotoent_r_proto" in
12274                 REENTRANT_PROTO*) ;;
12275                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12276                 esac
12277                 echo "Prototype: $try" ;;
12278         esac
12279         ;;
12280         *)      echo "You have getprotoent_r but no prototype, not using it." >&4 ;;
12281         esac
12282         ;;
12283 *)      getprotoent_r_proto=0
12284         ;;
12285 esac
12286
12287 : see if prototypes for various getprotoxxx netdb.h functions are available
12288 echo " "
12289 set d_getprotoprotos getprotoent $i_netdb netdb.h
12290 eval $hasproto
12291
12292 : see if getprpwnam exists
12293 set getprpwnam d_getprpwnam
12294 eval $inlibc
12295
12296 : see if getpwent exists
12297 set getpwent d_getpwent
12298 eval $inlibc
12299
12300 : see if getpwent_r exists
12301 set getpwent_r d_getpwent_r
12302 eval $inlibc
12303 case "$d_getpwent_r" in
12304 "$define")
12305         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12306         case "$d_getpwent_r_proto" in
12307         '')     d_getpwent_r_proto=define
12308                 set d_getpwent_r_proto getpwent_r $hdrs
12309                 eval $hasproto ;;
12310         *)      ;;
12311         esac
12312         case "$d_getpwent_r_proto" in
12313         define)
12314         case "$getpwent_r_proto" in
12315         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12316         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12317         esac
12318         case "$getpwent_r_proto" in
12319         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12320         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12321         esac
12322         case "$getpwent_r_proto" in
12323         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12324         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12325         esac
12326         case "$getpwent_r_proto" in
12327         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12328         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12329         esac
12330         case "$getpwent_r_proto" in
12331         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12332         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12333         esac
12334         case "$getpwent_r_proto" in
12335         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12336         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12337         esac
12338         case "$getpwent_r_proto" in
12339         '')     d_getpwent_r=undef
12340                 getpwent_r_proto=0
12341                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12342         * )     case "$getpwent_r_proto" in
12343                 REENTRANT_PROTO*) ;;
12344                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12345                 esac
12346                 echo "Prototype: $try" ;;
12347         esac
12348         ;;
12349         *)      echo "You have getpwent_r but no prototype, not using it." >&4 ;;
12350         esac
12351         ;;
12352 *)      getpwent_r_proto=0
12353         ;;
12354 esac
12355
12356 : see if getpwnam_r exists
12357 set getpwnam_r d_getpwnam_r
12358 eval $inlibc
12359 case "$d_getpwnam_r" in
12360 "$define")
12361         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12362         case "$d_getpwnam_r_proto" in
12363         '')     d_getpwnam_r_proto=define
12364                 set d_getpwnam_r_proto getpwnam_r $hdrs
12365                 eval $hasproto ;;
12366         *)      ;;
12367         esac
12368         case "$d_getpwnam_r_proto" in
12369         define)
12370         case "$getpwnam_r_proto" in
12371         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12372         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12373         esac
12374         case "$getpwnam_r_proto" in
12375         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12376         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12377         esac
12378         case "$getpwnam_r_proto" in
12379         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12380         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12381         esac
12382         case "$getpwnam_r_proto" in
12383         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12384         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12385         esac
12386         case "$getpwnam_r_proto" in
12387         '')     d_getpwnam_r=undef
12388                 getpwnam_r_proto=0
12389                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12390         * )     case "$getpwnam_r_proto" in
12391                 REENTRANT_PROTO*) ;;
12392                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12393                 esac
12394                 echo "Prototype: $try" ;;
12395         esac
12396         ;;
12397         *)      echo "You have getpwnam_r but no prototype, not using it." >&4 ;;
12398         esac
12399         ;;
12400 *)      getpwnam_r_proto=0
12401         ;;
12402 esac
12403
12404 : see if getpwuid_r exists
12405 set getpwuid_r d_getpwuid_r
12406 eval $inlibc
12407 case "$d_getpwuid_r" in
12408 "$define")
12409         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12410         case "$d_getpwuid_r_proto" in
12411         '')     d_getpwuid_r_proto=define
12412                 set d_getpwuid_r_proto getpwuid_r $hdrs
12413                 eval $hasproto ;;
12414         *)      ;;
12415         esac
12416         case "$d_getpwuid_r_proto" in
12417         define)
12418         case "$getpwuid_r_proto" in
12419         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12420         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12421         esac
12422         case "$getpwuid_r_proto" in
12423         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12424         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12425         esac
12426         case "$getpwuid_r_proto" in
12427         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12428         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12429         esac
12430         case "$getpwuid_r_proto" in
12431         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12432         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12433         esac
12434         case "$getpwuid_r_proto" in
12435         '')     d_getpwuid_r=undef
12436                 getpwuid_r_proto=0
12437                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12438         * )     case "$getpwuid_r_proto" in
12439                 REENTRANT_PROTO*) ;;
12440                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12441                 esac
12442                 echo "Prototype: $try" ;;
12443         esac
12444         ;;
12445         *)      echo "You have getpwuid_r but no prototype, not using it." >&4 ;;
12446         esac
12447         ;;
12448 *)      getpwuid_r_proto=0
12449         ;;
12450 esac
12451
12452
12453 : see if getservbyname exists
12454 set getservbyname d_getsbyname
12455 eval $inlibc
12456
12457 : see if getservbyport exists
12458 set getservbyport d_getsbyport
12459 eval $inlibc
12460
12461 : see if getservent exists
12462 set getservent d_getsent
12463 eval $inlibc
12464
12465 : see if getservbyname_r exists
12466 set getservbyname_r d_getservbyname_r
12467 eval $inlibc
12468 case "$d_getservbyname_r" in
12469 "$define")
12470         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12471         case "$d_getservbyname_r_proto" in
12472         '')     d_getservbyname_r_proto=define
12473                 set d_getservbyname_r_proto getservbyname_r $hdrs
12474                 eval $hasproto ;;
12475         *)      ;;
12476         esac
12477         case "$d_getservbyname_r_proto" in
12478         define)
12479         case "$getservbyname_r_proto" in
12480         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12481         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12482         esac
12483         case "$getservbyname_r_proto" in
12484         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12485         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12486         esac
12487         case "$getservbyname_r_proto" in
12488         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12489         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12490         esac
12491         case "$getservbyname_r_proto" in
12492         '')     d_getservbyname_r=undef
12493                 getservbyname_r_proto=0
12494                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12495         * )     case "$getservbyname_r_proto" in
12496                 REENTRANT_PROTO*) ;;
12497                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12498                 esac
12499                 echo "Prototype: $try" ;;
12500         esac
12501         ;;
12502         *)      echo "You have getservbyname_r but no prototype, not using it." >&4 ;;
12503         esac
12504         ;;
12505 *)      getservbyname_r_proto=0
12506         ;;
12507 esac
12508
12509 : see if getservbyport_r exists
12510 set getservbyport_r d_getservbyport_r
12511 eval $inlibc
12512 case "$d_getservbyport_r" in
12513 "$define")
12514         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12515         case "$d_getservbyport_r_proto" in
12516         '')     d_getservbyport_r_proto=define
12517                 set d_getservbyport_r_proto getservbyport_r $hdrs
12518                 eval $hasproto ;;
12519         *)      ;;
12520         esac
12521         case "$d_getservbyport_r_proto" in
12522         define)
12523         case "$getservbyport_r_proto" in
12524         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12525         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12526         esac
12527         case "$getservbyport_r_proto" in
12528         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12529         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12530         esac
12531         case "$getservbyport_r_proto" in
12532         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12533         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12534         esac
12535         case "$getservbyport_r_proto" in
12536         '')     d_getservbyport_r=undef
12537                 getservbyport_r_proto=0
12538                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12539         * )     case "$getservbyport_r_proto" in
12540                 REENTRANT_PROTO*) ;;
12541                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12542                 esac
12543                 echo "Prototype: $try" ;;
12544         esac
12545         ;;
12546         *)      echo "You have getservbyport_r but no prototype, not using it." >&4 ;;
12547         esac
12548         ;;
12549 *)      getservbyport_r_proto=0
12550         ;;
12551 esac
12552
12553 : see if getservent_r exists
12554 set getservent_r d_getservent_r
12555 eval $inlibc
12556 case "$d_getservent_r" in
12557 "$define")
12558         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12559         case "$d_getservent_r_proto" in
12560         '')     d_getservent_r_proto=define
12561                 set d_getservent_r_proto getservent_r $hdrs
12562                 eval $hasproto ;;
12563         *)      ;;
12564         esac
12565         case "$d_getservent_r_proto" in
12566         define)
12567         case "$getservent_r_proto" in
12568         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12569         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12570         esac
12571         case "$getservent_r_proto" in
12572         ''|0) try='int getservent_r(struct servent*, char*, int);'
12573         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12574         esac
12575         case "$getservent_r_proto" in
12576         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12577         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12578         esac
12579         case "$getservent_r_proto" in
12580         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12581         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12582         esac
12583         case "$getservent_r_proto" in
12584         '')     d_getservent_r=undef
12585                 getservent_r_proto=0
12586                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12587         * )     case "$getservent_r_proto" in
12588                 REENTRANT_PROTO*) ;;
12589                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12590                 esac
12591                 echo "Prototype: $try" ;;
12592         esac
12593         ;;
12594         *)      echo "You have getservent_r but no prototype, not using it." >&4 ;;
12595         esac
12596         ;;
12597 *)      getservent_r_proto=0
12598         ;;
12599 esac
12600
12601 : see if prototypes for various getservxxx netdb.h functions are available
12602 echo " "
12603 set d_getservprotos getservent $i_netdb netdb.h
12604 eval $hasproto
12605
12606 : see if getspnam exists
12607 set getspnam d_getspnam
12608 eval $inlibc
12609
12610 : see if this is a shadow.h system
12611 set shadow.h i_shadow
12612 eval $inhdr
12613
12614 : see if getspnam_r exists
12615 set getspnam_r d_getspnam_r
12616 eval $inlibc
12617 case "$d_getspnam_r" in
12618 "$define")
12619         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12620         case "$d_getspnam_r_proto" in
12621         '')     d_getspnam_r_proto=define
12622                 set d_getspnam_r_proto getspnam_r $hdrs
12623                 eval $hasproto ;;
12624         *)      ;;
12625         esac
12626         case "$d_getspnam_r_proto" in
12627         define)
12628         case "$getspnam_r_proto" in
12629         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12630         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12631         esac
12632         case "$getspnam_r_proto" in
12633         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12634         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12635         esac
12636         case "$getspnam_r_proto" in
12637         '')     d_getspnam_r=undef
12638                 getspnam_r_proto=0
12639                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12640         * )     case "$getspnam_r_proto" in
12641                 REENTRANT_PROTO*) ;;
12642                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12643                 esac
12644                 echo "Prototype: $try" ;;
12645         esac
12646         ;;
12647         *)      echo "You have getspnam_r but no prototype, not using it." >&4 ;;
12648         esac
12649         ;;
12650 *)      getspnam_r_proto=0
12651         ;;
12652 esac
12653
12654 : see if gettimeofday or ftime exists
12655 set gettimeofday d_gettimeod
12656 eval $inlibc
12657 case "$d_gettimeod" in
12658 "$undef")
12659         set ftime d_ftime 
12660         eval $inlibc
12661         ;;
12662 *)
12663         val="$undef"; set d_ftime; eval $setvar
12664         ;;
12665 esac
12666 case "$d_gettimeod$d_ftime" in
12667 "$undef$undef")
12668         echo " "
12669         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12670         ;;
12671 esac
12672
12673 : see if gmtime_r exists
12674 set gmtime_r d_gmtime_r
12675 eval $inlibc
12676 case "$d_gmtime_r" in
12677 "$define")
12678         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
12679         case "$d_gmtime_r_proto" in
12680         '')     d_gmtime_r_proto=define
12681                 set d_gmtime_r_proto gmtime_r $hdrs
12682                 eval $hasproto ;;
12683         *)      ;;
12684         esac
12685         case "$d_gmtime_r_proto" in
12686         define)
12687         case "$gmtime_r_proto" in
12688         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12689         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12690         esac
12691         case "$gmtime_r_proto" in
12692         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12693         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12694         esac
12695         case "$gmtime_r_proto" in
12696         '')     d_gmtime_r=undef
12697                 gmtime_r_proto=0
12698                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12699         * )     case "$gmtime_r_proto" in
12700                 REENTRANT_PROTO*) ;;
12701                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12702                 esac
12703                 echo "Prototype: $try" ;;
12704         esac
12705         ;;
12706         *)      echo "You have gmtime_r but no prototype, not using it." >&4 ;;
12707         esac
12708         ;;
12709 *)      gmtime_r_proto=0
12710         ;;
12711 esac
12712
12713 : see if hasmntopt exists
12714 set hasmntopt d_hasmntopt
12715 eval $inlibc
12716
12717 : see if this is a netinet/in.h or sys/in.h system
12718 set netinet/in.h i_niin sys/in.h i_sysin
12719 eval $inhdr
12720
12721 : see if arpa/inet.h has to be included
12722 set arpa/inet.h i_arpainet
12723 eval $inhdr
12724
12725 : see if htonl --and friends-- exists
12726 val=''
12727 set htonl val
12728 eval $inlibc
12729
12730 : Maybe they are macros.
12731 case "$val" in
12732 $undef)
12733         $cat >htonl.c <<EOM
12734 #include <stdio.h>
12735 #include <sys/types.h>
12736 #$i_niin I_NETINET_IN
12737 #$i_sysin I_SYS_IN
12738 #$i_arpainet I_ARPA_INET
12739 #ifdef I_NETINET_IN
12740 #include <netinet/in.h>
12741 #endif
12742 #ifdef I_SYS_IN
12743 #include <sys/in.h>
12744 #endif
12745 #ifdef I_ARPA_INET
12746 #include <arpa/inet.h>
12747 #endif
12748 #ifdef htonl
12749 printf("Defined as a macro.");
12750 #endif
12751 EOM
12752         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12753         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12754                 val="$define"
12755                 echo "But it seems to be defined as a macro." >&4
12756         fi
12757         $rm -f htonl.?
12758         ;;
12759 esac
12760 set d_htonl
12761 eval $setvar
12762
12763 : index or strchr
12764 echo " "
12765 if set index val -f; eval $csym; $val; then
12766         if set strchr val -f d_strchr; eval $csym; $val; then
12767                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12768                         val="$define"
12769                         vali="$undef"
12770                         echo "strchr() found." >&4
12771                 else
12772                         val="$undef"
12773                         vali="$define"
12774                         echo "index() found." >&4
12775                 fi
12776         else
12777                 val="$undef"
12778                 vali="$define"
12779                 echo "index() found." >&4
12780         fi
12781 else
12782         if set strchr val -f d_strchr; eval $csym; $val; then
12783                 val="$define"
12784                 vali="$undef"
12785                 echo "strchr() found." >&4
12786         else
12787                 echo "No index() or strchr() found!" >&4
12788                 val="$undef"
12789                 vali="$undef"
12790         fi
12791 fi
12792 set d_strchr; eval $setvar
12793 val="$vali"
12794 set d_index; eval $setvar
12795
12796 : check whether inet_aton exists
12797 set inet_aton d_inetaton
12798 eval $inlibc
12799
12800 : Look for isascii
12801 echo " "
12802 $cat >isascii.c <<'EOCP'
12803 #include <stdio.h>
12804 #include <ctype.h>
12805 int main() {
12806         int c = 'A';
12807         if (isascii(c))
12808                 exit(0);
12809         else
12810                 exit(1);
12811 }
12812 EOCP
12813 set isascii
12814 if eval $compile; then
12815         echo "isascii() found." >&4
12816         val="$define"
12817 else
12818         echo "isascii() NOT found." >&4
12819         val="$undef"
12820 fi
12821 set d_isascii
12822 eval $setvar
12823 $rm -f isascii*
12824
12825 : see if isfinite exists
12826 set isfinite d_isfinite
12827 eval $inlibc
12828
12829 : see if isinf exists
12830 set isinf d_isinf
12831 eval $inlibc
12832
12833 : see if isnan exists
12834 set isnan d_isnan
12835 eval $inlibc
12836
12837 : see if isnanl exists
12838 set isnanl d_isnanl
12839 eval $inlibc
12840
12841 : see if killpg exists
12842 set killpg d_killpg
12843 eval $inlibc
12844
12845 : see if lchown exists
12846 echo " "
12847 $cat > try.c <<'EOCP'
12848 /* System header to define __stub macros and hopefully few prototypes,
12849     which can conflict with char lchown(); below.  */
12850 #include <assert.h>
12851 /* Override any gcc2 internal prototype to avoid an error.  */
12852 /* We use char because int might match the return type of a gcc2
12853    builtin and then its argument prototype would still apply.  */
12854 char lchown();
12855 int main() {
12856     /*  The GNU C library defines this for functions which it implements
12857         to always fail with ENOSYS.  Some functions are actually named
12858         something starting with __ and the normal name is an alias.  */
12859 #if defined (__stub_lchown) || defined (__stub___lchown)
12860 choke me
12861 #else
12862 lchown();
12863 #endif
12864 ; return 0; }
12865 EOCP
12866 set try
12867 if eval $compile; then
12868     $echo "lchown() found." >&4
12869     val="$define"
12870 else
12871     $echo "lchown() NOT found." >&4
12872     val="$undef"
12873 fi
12874 set d_lchown
12875 eval $setvar
12876
12877 : See if number of significant digits in a double precision number is known
12878 echo " "
12879 $cat >ldbl_dig.c <<EOM
12880 #$i_limits I_LIMITS
12881 #$i_float I_FLOAT
12882 #ifdef I_LIMITS
12883 #include <limits.h>
12884 #endif
12885 #ifdef I_FLOAT
12886 #include <float.h>
12887 #endif
12888 #ifdef LDBL_DIG
12889 printf("Contains LDBL_DIG");
12890 #endif
12891 EOM
12892 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
12893 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
12894         echo "LDBL_DIG found." >&4
12895         val="$define"
12896 else
12897         echo "LDBL_DIG NOT found." >&4
12898         val="$undef"
12899 fi
12900 $rm -f ldbl_dig.?
12901 set d_ldbl_dig
12902 eval $setvar
12903
12904 : see if link exists
12905 set link d_link
12906 eval $inlibc
12907
12908 : see if localtime_r exists
12909 set localtime_r d_localtime_r
12910 eval $inlibc
12911 case "$d_localtime_r" in
12912 "$define")
12913         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
12914         case "$d_localtime_r_proto" in
12915         '')     d_localtime_r_proto=define
12916                 set d_localtime_r_proto localtime_r $hdrs
12917                 eval $hasproto ;;
12918         *)      ;;
12919         esac
12920         case "$d_localtime_r_proto" in
12921         define)
12922         case "$localtime_r_proto" in
12923         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
12924         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
12925         esac
12926         case "$localtime_r_proto" in
12927         ''|0) try='int localtime_r(const time_t*, struct tm*);'
12928         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
12929         esac
12930         case "$localtime_r_proto" in
12931         '')     d_localtime_r=undef
12932                 localtime_r_proto=0
12933                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
12934         * )     case "$localtime_r_proto" in
12935                 REENTRANT_PROTO*) ;;
12936                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
12937                 esac
12938                 echo "Prototype: $try" ;;
12939         esac
12940         ;;
12941         *)      echo "You have localtime_r but no prototype, not using it." >&4 ;;
12942         esac
12943         ;;
12944 *)      localtime_r_proto=0
12945         ;;
12946 esac
12947
12948 : see if localeconv exists
12949 set localeconv d_locconv
12950 eval $inlibc
12951
12952 : see if lockf exists
12953 set lockf d_lockf
12954 eval $inlibc
12955
12956 : see if prototype for lseek is available
12957 echo " "
12958 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
12959 eval $hasproto
12960
12961 : see if lstat exists
12962 set lstat d_lstat
12963 eval $inlibc
12964
12965 : see if madvise exists
12966 set madvise d_madvise
12967 eval $inlibc
12968
12969 : see if mblen exists
12970 set mblen d_mblen
12971 eval $inlibc
12972
12973 : see if mbstowcs exists
12974 set mbstowcs d_mbstowcs
12975 eval $inlibc
12976
12977 : see if mbtowc exists
12978 set mbtowc d_mbtowc
12979 eval $inlibc
12980
12981 : see if memchr exists
12982 set memchr d_memchr
12983 eval $inlibc
12984
12985 : see if memcmp exists
12986 set memcmp d_memcmp
12987 eval $inlibc
12988
12989 : see if memcpy exists
12990 set memcpy d_memcpy
12991 eval $inlibc
12992
12993 : see if memmove exists
12994 set memmove d_memmove
12995 eval $inlibc
12996
12997 : see if memset exists
12998 set memset d_memset
12999 eval $inlibc
13000
13001 : see if mkdir exists
13002 set mkdir d_mkdir
13003 eval $inlibc
13004
13005 : see if mkdtemp exists
13006 set mkdtemp d_mkdtemp
13007 eval $inlibc
13008
13009 : see if mkfifo exists
13010 set mkfifo d_mkfifo
13011 eval $inlibc
13012
13013 : see if mkstemp exists
13014 set mkstemp d_mkstemp
13015 eval $inlibc
13016
13017 : see if mkstemps exists
13018 set mkstemps d_mkstemps
13019 eval $inlibc
13020
13021 : see if mktime exists
13022 set mktime d_mktime
13023 eval $inlibc
13024
13025 : see if this is a sys/mman.h system
13026 set sys/mman.h i_sysmman
13027 eval $inhdr
13028
13029 : see if mmap exists
13030 set mmap d_mmap
13031 eval $inlibc
13032 : see what shmat returns
13033 : default to something harmless
13034 mmaptype='void *'
13035 case "$i_sysmman$d_mmap" in
13036 "$define$define")
13037         $cat >mmap.c <<'END'
13038 #include <sys/mman.h>
13039 void *mmap();
13040 END
13041         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13042                 mmaptype='void *'
13043         else
13044                 mmaptype='caddr_t'
13045         fi
13046         echo "and it returns ($mmaptype)." >&4
13047         ;;
13048 esac
13049
13050
13051
13052 : see if mprotect exists
13053 set mprotect d_mprotect
13054 eval $inlibc
13055
13056 : see if msgctl exists
13057 set msgctl d_msgctl
13058 eval $inlibc
13059
13060 : see if msgget exists
13061 set msgget d_msgget
13062 eval $inlibc
13063
13064 : see if msgsnd exists
13065 set msgsnd d_msgsnd
13066 eval $inlibc
13067
13068 : see if msgrcv exists
13069 set msgrcv d_msgrcv
13070 eval $inlibc
13071
13072 : see how much of the 'msg*(2)' library is present.
13073 h_msg=true
13074 echo " "
13075 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13076 *"$undef"*) h_msg=false;;
13077 esac
13078 case "$osname" in
13079 freebsd)
13080     case "`ipcs 2>&1`" in
13081     "SVID messages"*"not configured"*)
13082         echo "Your $osname does not have the msg*(2) configured." >&4
13083         h_msg=false
13084         val="$undef"
13085         set msgctl d_msgctl
13086         eval $setvar
13087         set msgget d_msgget
13088         eval $setvar
13089         set msgsnd d_msgsnd
13090         eval $setvar
13091         set msgrcv d_msgrcv
13092         eval $setvar
13093         ;;
13094     esac
13095     ;;
13096 esac
13097 : we could also check for sys/ipc.h ...
13098 if $h_msg && $test `./findhdr sys/msg.h`; then
13099         echo "You have the full msg*(2) library." >&4
13100         val="$define"
13101 else
13102         echo "You don't have the full msg*(2) library." >&4
13103         val="$undef"
13104 fi
13105 set d_msg
13106 eval $setvar
13107
13108
13109 echo " "
13110 echo "Checking to see if your system supports struct msghdr..." >&4
13111 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13112 eval $hasstruct
13113 case "$d_msghdr_s" in
13114 "$define")      echo "Yes, it does."   ;;
13115 *)              echo "No, it doesn't." ;;
13116 esac
13117
13118
13119 : see if msync exists
13120 set msync d_msync
13121 eval $inlibc
13122
13123 : see if munmap exists
13124 set munmap d_munmap
13125 eval $inlibc
13126
13127 : see if nice exists
13128 set nice d_nice
13129 eval $inlibc
13130
13131 : see if this is a langinfo.h system
13132 set langinfo.h i_langinfo
13133 eval $inhdr
13134
13135 : see if nl_langinfo exists
13136 set nl_langinfo d_nl_langinfo
13137 eval $inlibc
13138
13139 : check for length of character
13140 echo " "
13141 case "$charsize" in
13142 '')
13143         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13144         $cat >try.c <<'EOCP'
13145 #include <stdio.h>
13146 int main()
13147 {
13148     printf("%d\n", (int)sizeof(char));
13149     exit(0);
13150 }
13151 EOCP
13152         set try
13153         if eval $compile_ok; then
13154                 dflt=`$run ./try`
13155         else
13156                 dflt='1'
13157                 echo "(I can't seem to compile the test program.  Guessing...)"
13158         fi
13159         ;;
13160 *)
13161         dflt="$charsize"
13162         ;;
13163 esac
13164 rp="What is the size of a character (in bytes)?"
13165 . ./myread
13166 charsize="$ans"
13167 $rm -f try.c try
13168
13169 : check for volatile keyword
13170 echo " "
13171 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13172 $cat >try.c <<'EOCP'
13173 int main()
13174 {
13175         typedef struct _goo_struct goo_struct;
13176         goo_struct * volatile goo = ((goo_struct *)0);
13177         struct _goo_struct {
13178                 long long_int;
13179                 int reg_int;
13180                 char char_var;
13181         };
13182         typedef unsigned short foo_t;
13183         char *volatile foo;
13184         volatile int bar;
13185         volatile foo_t blech;
13186         foo = foo;
13187 }
13188 EOCP
13189 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13190         val="$define"
13191         echo "Yup, it does."
13192 else
13193         val="$undef"
13194         echo "Nope, it doesn't."
13195 fi
13196 set d_volatile
13197 eval $setvar
13198 $rm -f try.*
13199
13200
13201 echo " "
13202 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13203
13204 case "$use64bitint:$d_quad:$quadtype" in
13205 define:define:?*)
13206         ivtype="$quadtype"
13207         uvtype="$uquadtype"
13208         ivsize=8
13209         uvsize=8
13210         ;;
13211 *)      ivtype="long"
13212         uvtype="unsigned long"
13213         ivsize=$longsize
13214         uvsize=$longsize
13215         ;;
13216 esac
13217
13218 case "$uselongdouble:$d_longdbl" in
13219 define:define)
13220         nvtype="long double"
13221         nvsize=$longdblsize
13222         ;;
13223 *)      nvtype=double
13224         nvsize=$doublesize
13225         ;;
13226 esac
13227
13228 $echo "(IV will be "$ivtype", $ivsize bytes)"
13229 $echo "(UV will be "$uvtype", $uvsize bytes)"
13230 $echo "(NV will be "$nvtype", $nvsize bytes)"
13231
13232 $cat >try.c <<EOCP
13233 #$i_inttypes I_INTTYPES
13234 #ifdef I_INTTYPES
13235 #include <inttypes.h>
13236 #endif
13237 #include <stdio.h>
13238 int main() {
13239 #ifdef INT8
13240    int8_t i =  INT8_MAX;
13241   uint8_t u = UINT8_MAX;
13242   printf("int8_t\n");
13243 #endif
13244 #ifdef INT16
13245    int16_t i =  INT16_MAX;
13246   uint16_t i = UINT16_MAX;
13247   printf("int16_t\n");
13248 #endif
13249 #ifdef INT32
13250    int32_t i =  INT32_MAX;
13251   uint32_t u = UINT32_MAX;
13252   printf("int32_t\n");
13253 #endif
13254 }
13255 EOCP
13256
13257 case "$i8type" in
13258 '')     case "$charsize" in
13259         1)      i8type=char
13260                 u8type="unsigned char"
13261                 i8size=$charsize
13262                 u8size=$charsize
13263                 ;;
13264         esac
13265         ;;
13266 esac
13267 case "$i8type" in
13268 '')     set try -DINT8
13269         if eval $compile; then
13270                 case "`$run ./try`" in
13271                 int8_t) i8type=int8_t
13272                         u8type=uint8_t
13273                         i8size=1
13274                         u8size=1
13275                         ;;
13276                 esac
13277         fi
13278         ;;
13279 esac
13280 case "$i8type" in
13281 '')     if $test $charsize -ge 1; then
13282                 i8type=char
13283                 u8type="unsigned char"
13284                 i8size=$charsize
13285                 u8size=$charsize
13286         fi
13287         ;;
13288 esac
13289
13290 case "$i16type" in
13291 '')     case "$shortsize" in
13292         2)      i16type=short
13293                 u16type="unsigned short"
13294                 i16size=$shortsize
13295                 u16size=$shortsize
13296                 ;;
13297         esac
13298         ;;
13299 esac
13300 case "$i16type" in
13301 '')     set try -DINT16
13302         if eval $compile; then
13303                 case "`$run ./try`" in
13304                 int16_t)
13305                         i16type=int16_t
13306                         u16type=uint16_t
13307                         i16size=2
13308                         u16size=2
13309                         ;;
13310                 esac
13311         fi
13312         ;;
13313 esac
13314 case "$i16type" in
13315 '')     if $test $shortsize -ge 2; then
13316                 i16type=short
13317                 u16type="unsigned short"
13318                 i16size=$shortsize
13319                 u16size=$shortsize
13320         fi
13321         ;;
13322 esac
13323
13324 case "$i32type" in
13325 '')     case "$longsize" in
13326         4)      i32type=long
13327                 u32type="unsigned long"
13328                 i32size=$longsize
13329                 u32size=$longsize
13330                 ;;
13331         *)      case "$intsize" in
13332                 4)      i32type=int
13333                         u32type="unsigned int"
13334                         i32size=$intsize
13335                         u32size=$intsize
13336                         ;;
13337                 esac
13338                 ;;
13339         esac
13340         ;;
13341 esac
13342 case "$i32type" in
13343 '')     set try -DINT32
13344         if eval $compile; then
13345                 case "`$run ./try`" in
13346                 int32_t)
13347                         i32type=int32_t
13348                         u32type=uint32_t
13349                         i32size=4
13350                         u32size=4
13351                         ;;
13352                 esac
13353         fi
13354         ;;
13355 esac
13356 case "$i32type" in
13357 '')     if $test $intsize -ge 4; then
13358                 i32type=int
13359                 u32type="unsigned int"
13360                 i32size=$intsize
13361                 u32size=$intsize
13362         fi
13363         ;;
13364 esac
13365
13366 case "$i64type" in
13367 '')     case "$d_quad:$quadtype" in
13368         define:?*)
13369                 i64type="$quadtype"
13370                 u64type="$uquadtype"
13371                 i64size=8
13372                 u64size=8
13373                 ;;
13374         esac
13375         ;;
13376 esac
13377
13378 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13379 : volatile so that the compiler has to store it out to memory.
13380 if test X"$d_volatile" = X"$define"; then
13381         volatile=volatile
13382 fi
13383 $cat <<EOP >try.c
13384 #include <stdio.h>
13385 #include <sys/types.h>
13386 #include <signal.h>
13387 #ifdef SIGFPE
13388 $volatile int bletched = 0;
13389 $signal_t blech(s) int s; { bletched = 1; }
13390 #endif
13391 int main() {
13392     $uvtype u = 0;
13393     $nvtype d;
13394     int     n = 8 * $uvsize;
13395     int     i;
13396 #ifdef SIGFPE
13397     signal(SIGFPE, blech);
13398 #endif
13399
13400     for (i = 0; i < n; i++) {
13401       u = u << 1 | ($uvtype)1;
13402       d = ($nvtype)u;
13403       if (($uvtype)d != u)
13404         break;
13405       if (d <= 0)
13406         break;
13407       d = ($nvtype)(u - 1);
13408       if (($uvtype)d != (u - 1))
13409         break;
13410 #ifdef SIGFPE
13411       if (bletched) {
13412         break;
13413 #endif
13414       } 
13415     }
13416     printf("%d\n", ((i == n) ? -n : i));
13417     exit(0);
13418 }
13419 EOP
13420 set try
13421
13422 d_nv_preserves_uv="$undef"
13423 if eval $compile; then
13424         d_nv_preserves_uv_bits="`$run ./try`"
13425 fi
13426 case "$d_nv_preserves_uv_bits" in
13427 \-[1-9]*)       
13428         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
13429         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
13430         d_nv_preserves_uv="$define"
13431         ;;
13432 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
13433         d_nv_preserves_uv="$undef" ;;
13434 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13435         d_nv_preserves_uv_bits="$undef" ;;
13436 esac
13437
13438 $rm -f try.* try
13439
13440
13441 : check for off64_t
13442 echo " "
13443 echo "Checking to see if you have off64_t..." >&4
13444 $cat >try.c <<EOCP
13445 #include <sys/types.h>
13446 #include <unistd.h>
13447 int main() { off64_t x = 7; }
13448 EOCP
13449 set try
13450 if eval $compile; then
13451         val="$define"
13452         echo "You have off64_t."
13453 else
13454         val="$undef"
13455         echo "You do not have off64_t."
13456         case "$lseeksize" in
13457         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13458         esac
13459 fi
13460 $rm -f try.* try
13461 set d_off64_t
13462 eval $setvar
13463
13464 : see if POSIX threads are available
13465 set pthread.h i_pthread
13466 eval $inhdr
13467
13468
13469
13470
13471 : how to create joinable pthreads
13472 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13473         echo " "
13474         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13475         $cat >try.c <<'EOCP'
13476 #include <pthread.h>
13477 int main() {
13478     int detachstate = JOINABLE;
13479 }
13480 EOCP
13481         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13482         if eval $compile; then
13483                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13484                 val="$undef" # Yes, undef.
13485                 set d_old_pthread_create_joinable
13486                 eval $setvar
13487                 val=""
13488                 set old_pthread_create_joinable
13489                 eval $setvar
13490         else
13491                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13492                 if eval $compile; then
13493                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13494                         val="$define"
13495                         set d_old_pthread_create_joinable
13496                         eval $setvar
13497                         val=PTHREAD_CREATE_UNDETACHED
13498                         set old_pthread_create_joinable
13499                         eval $setvar
13500                 else            
13501                         set try -DJOINABLE=__UNDETACHED
13502                         if eval $compile; then
13503                                 echo "You seem to use __UNDETACHED." >&4
13504                                 val="$define"
13505                                 set d_old_pthread_create_joinable
13506                                 eval $setvar
13507                                 val=__UNDETACHED
13508                                 set old_pthread_create_joinable
13509                                 eval $setvar
13510                         else
13511                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13512                                 val="$define"
13513                                 set d_old_pthread_create_joinable
13514                                 eval $setvar
13515                                 val=0
13516                                 set old_pthread_create_joinable
13517                                 eval $setvar
13518                         fi
13519                 fi
13520         fi
13521         $rm -f try try.*
13522 else
13523     d_old_pthread_create_joinable="$undef"
13524     old_pthread_create_joinable=""
13525 fi
13526
13527 : see if pause exists
13528 set pause d_pause
13529 eval $inlibc
13530
13531 : see if pipe exists
13532 set pipe d_pipe
13533 eval $inlibc
13534
13535 : see if poll exists
13536 set poll d_poll
13537 eval $inlibc
13538
13539 : see if readlink exists
13540 set readlink d_readlink
13541 eval $inlibc
13542
13543 echo " "
13544 procselfexe=''
13545 val="$undef"
13546 case "$d_readlink" in
13547 "$define")
13548         if $issymlink /proc/self/exe ; then
13549                 $ls -l /proc/self/exe > reflect
13550                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13551                         echo "You have Linux-like /proc/self/exe."
13552                         procselfexe='"/proc/self/exe"'
13553                         val="$define"
13554                 fi
13555         fi
13556         if $issymlink /proc/curproc/file ; then
13557                 $ls -l /proc/curproc/file > reflect
13558                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13559                         echo "You have BSD-like /proc/curproc/file."
13560                         procselfexe='"/proc/curproc/file"'
13561                         val="$define"
13562                 fi
13563         fi
13564         ;;
13565 esac
13566 $rm -f reflect
13567 set d_procselfexe
13568 eval $setvar
13569
13570 : see whether the pthread_atfork exists
13571 $cat >try.c <<EOP
13572 #include <pthread.h>
13573 #include <stdio.h>
13574 int main() {
13575 #ifdef  PTHREAD_ATFORK
13576         pthread_atfork(NULL,NULL,NULL);
13577 #endif
13578 }
13579 EOP
13580
13581 : see if pthread_atfork exists
13582 set try -DPTHREAD_ATFORK
13583 if eval $compile; then
13584     val="$define"
13585 else
13586     val="$undef"
13587 fi
13588 case "$usethreads" in
13589 $define)
13590         case "$val" in
13591         $define) echo 'pthread_atfork found.' >&4        ;;
13592         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13593         esac
13594 esac
13595 set d_pthread_atfork
13596 eval $setvar
13597
13598
13599 : see whether the various POSIXish _yields exist
13600 $cat >try.c <<EOP
13601 #include <pthread.h>
13602 #include <stdio.h>
13603 int main() {
13604 #ifdef SCHED_YIELD
13605         sched_yield();
13606 #else
13607 #ifdef PTHREAD_YIELD
13608         pthread_yield();
13609 #else
13610 #ifdef PTHREAD_YIELD_NULL
13611         pthread_yield(NULL);
13612 #endif
13613 #endif
13614 #endif
13615 }
13616 EOP
13617 : see if sched_yield exists
13618 set try -DSCHED_YIELD
13619 if eval $compile; then
13620     val="$define"
13621     sched_yield='sched_yield()'
13622 else
13623     val="$undef"
13624 fi
13625 case "$usethreads" in
13626 $define)
13627         case "$val" in
13628         $define) echo 'sched_yield() found.' >&4        ;;
13629         *)       echo 'sched_yield() NOT found.' >&4    ;;
13630         esac
13631 esac
13632 set d_sched_yield
13633 eval $setvar
13634
13635 : see if pthread_yield exists
13636 set try -DPTHREAD_YIELD
13637 if eval $compile; then
13638     val="$define"
13639     case "$sched_yield" in
13640     '') sched_yield='pthread_yield()' ;;
13641     esac
13642 else
13643     set try -DPTHREAD_YIELD_NULL
13644     if eval $compile; then
13645         val="$define"
13646         case "$sched_yield" in
13647         '') sched_yield='pthread_yield(NULL)' ;;
13648         esac
13649     else
13650         val="$undef"
13651     fi
13652 fi
13653 case "$usethreads" in
13654 $define)
13655         case "$val" in
13656         $define) echo 'pthread_yield() found.' >&4      ;;
13657         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13658         esac
13659         ;;
13660 esac
13661 set d_pthread_yield
13662 eval $setvar
13663
13664 case "$sched_yield" in
13665 '') sched_yield=undef ;;
13666 esac
13667
13668 $rm -f try try.*
13669
13670 : see if random_r exists
13671 set random_r d_random_r
13672 eval $inlibc
13673 case "$d_random_r" in
13674 "$define")
13675         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13676         case "$d_random_r_proto" in
13677         '')     d_random_r_proto=define
13678                 set d_random_r_proto random_r $hdrs
13679                 eval $hasproto ;;
13680         *)      ;;
13681         esac
13682         case "$d_random_r_proto" in
13683         define)
13684         case "$random_r_proto" in
13685         ''|0) try='int random_r(int*, struct random_data*);'
13686         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13687         esac
13688         case "$random_r_proto" in
13689         '')     d_random_r=undef
13690                 random_r_proto=0
13691                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13692         * )     case "$random_r_proto" in
13693                 REENTRANT_PROTO*) ;;
13694                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13695                 esac
13696                 echo "Prototype: $try" ;;
13697         esac
13698         ;;
13699         *)      echo "You have random_r but no prototype, not using it." >&4 ;;
13700         esac
13701         ;;
13702 *)      random_r_proto=0
13703         ;;
13704 esac
13705
13706 : see if readdir and friends exist
13707 set readdir d_readdir
13708 eval $inlibc
13709 set seekdir d_seekdir
13710 eval $inlibc
13711 set telldir d_telldir
13712 eval $inlibc
13713 set rewinddir d_rewinddir
13714 eval $inlibc
13715
13716 : see if readdir64_r exists
13717 set readdir64_r d_readdir64_r
13718 eval $inlibc
13719 case "$d_readdir64_r" in
13720 "$define")
13721         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13722         case "$d_readdir64_r_proto" in
13723         '')     d_readdir64_r_proto=define
13724                 set d_readdir64_r_proto readdir64_r $hdrs
13725                 eval $hasproto ;;
13726         *)      ;;
13727         esac
13728         case "$d_readdir64_r_proto" in
13729         define)
13730         case "$readdir64_r_proto" in
13731         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13732         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13733         esac
13734         case "$readdir64_r_proto" in
13735         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13736         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13737         esac
13738         case "$readdir64_r_proto" in
13739         '')     d_readdir64_r=undef
13740                 readdir64_r_proto=0
13741                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13742         * )     case "$readdir64_r_proto" in
13743                 REENTRANT_PROTO*) ;;
13744                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13745                 esac
13746                 echo "Prototype: $try" ;;
13747         esac
13748         ;;
13749         *)      echo "You have readdir64_r but no prototype, not using it." >&4 ;;
13750         esac
13751         ;;
13752 *)      readdir64_r_proto=0
13753         ;;
13754 esac
13755
13756 : see if readdir_r exists
13757 set readdir_r d_readdir_r
13758 eval $inlibc
13759 case "$d_readdir_r" in
13760 "$define")
13761         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13762         case "$d_readdir_r_proto" in
13763         '')     d_readdir_r_proto=define
13764                 set d_readdir_r_proto readdir_r $hdrs
13765                 eval $hasproto ;;
13766         *)      ;;
13767         esac
13768         case "$d_readdir_r_proto" in
13769         define)
13770         case "$readdir_r_proto" in
13771         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13772         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13773         esac
13774         case "$readdir_r_proto" in
13775         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13776         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13777         esac
13778         case "$readdir_r_proto" in
13779         '')     d_readdir_r=undef
13780                 readdir_r_proto=0
13781                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13782         * )     case "$readdir_r_proto" in
13783                 REENTRANT_PROTO*) ;;
13784                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13785                 esac
13786                 echo "Prototype: $try" ;;
13787         esac
13788         ;;
13789         *)      echo "You have readdir_r but no prototype, not using it." >&4 ;;
13790         esac
13791         ;;
13792 *)      readdir_r_proto=0
13793         ;;
13794 esac
13795
13796 : see if readv exists
13797 set readv d_readv
13798 eval $inlibc
13799
13800 : see if recvmsg exists
13801 set recvmsg d_recvmsg
13802 eval $inlibc
13803
13804 : see if rename exists
13805 set rename d_rename
13806 eval $inlibc
13807
13808 : see if rmdir exists
13809 set rmdir d_rmdir
13810 eval $inlibc
13811
13812 : see if memory.h is available.
13813 val=''
13814 set memory.h val
13815 eval $inhdr
13816
13817 : See if it conflicts with string.h
13818 case "$val" in
13819 $define)
13820         case "$strings" in
13821         '') ;;
13822         *)
13823                 $cppstdin $cppflags $cppminus < $strings > mem.h
13824                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13825                         echo " "
13826                         echo "We won't be including <memory.h>."
13827                         val="$undef"
13828                 fi
13829                 $rm -f mem.h
13830                 ;;
13831         esac
13832 esac
13833 set i_memory
13834 eval $setvar
13835
13836 : can bcopy handle overlapping blocks?
13837 echo " "
13838 val="$undef"
13839 case "$d_memmove" in
13840 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
13841 *)      case "$d_bcopy" in
13842         "$define")
13843                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
13844                 $cat >try.c <<EOCP
13845 #$i_memory I_MEMORY
13846 #$i_stdlib I_STDLIB
13847 #$i_string I_STRING
13848 #$i_unistd I_UNISTD
13849 EOCP
13850         $cat >>try.c <<'EOCP'
13851 #include <stdio.h>
13852 #ifdef I_MEMORY
13853 #  include <memory.h>
13854 #endif
13855 #ifdef I_STDLIB
13856 #  include <stdlib.h>
13857 #endif
13858 #ifdef I_STRING
13859 #  include <string.h>
13860 #else
13861 #  include <strings.h>
13862 #endif
13863 #ifdef I_UNISTD
13864 #  include <unistd.h>  /* Needed for NetBSD */
13865 #endif
13866 int main()
13867 {
13868 char buf[128], abc[128];
13869 char *b;
13870 int len;
13871 int off;
13872 int align;
13873
13874 /* Copy "abcde..." string to char abc[] so that gcc doesn't
13875    try to store the string in read-only memory. */
13876 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
13877
13878 for (align = 7; align >= 0; align--) {
13879         for (len = 36; len; len--) {
13880                 b = buf+align;
13881                 bcopy(abc, b, len);
13882                 for (off = 1; off <= len; off++) {
13883                         bcopy(b, b+off, len);
13884                         bcopy(b+off, b, len);
13885                         if (bcmp(b, abc, len))
13886                                 exit(1);
13887                 }
13888         }
13889 }
13890 exit(0);
13891 }
13892 EOCP
13893                 set try
13894                 if eval $compile_ok; then
13895                         if ./try 2>/dev/null; then
13896                                 echo "Yes, it can."
13897                                 val="$define"
13898                         else
13899                                 echo "It can't, sorry."
13900                         fi
13901                 else
13902                         echo "(I can't compile the test program, so we'll assume not...)"
13903                 fi
13904                 ;;
13905         esac
13906         $rm -f try.* try core
13907         ;;
13908 esac
13909 set d_safebcpy
13910 eval $setvar
13911
13912 : can memcpy handle overlapping blocks?
13913 echo " "
13914 val="$undef"
13915 case "$d_memmove" in
13916 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
13917 *)      case "$d_memcpy" in
13918         "$define")
13919                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
13920                 $cat >try.c <<EOCP
13921 #$i_memory I_MEMORY
13922 #$i_stdlib I_STDLIB
13923 #$i_string I_STRING
13924 #$i_unistd I_UNISTD
13925 EOCP
13926         $cat >>try.c <<'EOCP'
13927 #include <stdio.h>
13928 #ifdef I_MEMORY
13929 #  include <memory.h>
13930 #endif
13931 #ifdef I_STDLIB
13932 #  include <stdlib.h>
13933 #endif
13934 #ifdef I_STRING
13935 #  include <string.h>
13936 #else
13937 #  include <strings.h>
13938 #endif
13939 #ifdef I_UNISTD
13940 #  include <unistd.h>  /* Needed for NetBSD */
13941 #endif
13942 int main()
13943 {
13944 char buf[128], abc[128];
13945 char *b;
13946 int len;
13947 int off;
13948 int align;
13949
13950 /* Copy "abcde..." string to char abc[] so that gcc doesn't
13951    try to store the string in read-only memory. */
13952 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
13953
13954 for (align = 7; align >= 0; align--) {
13955         for (len = 36; len; len--) {
13956                 b = buf+align;
13957                 memcpy(b, abc, len);
13958                 for (off = 1; off <= len; off++) {
13959                         memcpy(b+off, b, len);
13960                         memcpy(b, b+off, len);
13961                         if (memcmp(b, abc, len))
13962                                 exit(1);
13963                 }
13964         }
13965 }
13966 exit(0);
13967 }
13968 EOCP
13969                 set try
13970                 if eval $compile_ok; then
13971                         if ./try 2>/dev/null; then
13972                                 echo "Yes, it can."
13973                                 val="$define"
13974                         else
13975                                 echo "It can't, sorry."
13976                         fi
13977                 else
13978                         echo "(I can't compile the test program, so we'll assume not...)"
13979                 fi
13980                 ;;
13981         esac
13982         $rm -f try.* try core
13983         ;;
13984 esac
13985 set d_safemcpy
13986 eval $setvar
13987
13988 : can memcmp be trusted to compare relative magnitude?
13989 val="$undef"
13990 case "$d_memcmp" in
13991 "$define")
13992         echo " "
13993         echo "Checking if your memcmp() can compare relative magnitude..." >&4
13994         $cat >try.c <<EOCP
13995 #$i_memory I_MEMORY
13996 #$i_stdlib I_STDLIB
13997 #$i_string I_STRING
13998 #$i_unistd I_UNISTD
13999 EOCP
14000         $cat >>try.c <<'EOCP'
14001 #include <stdio.h>
14002 #ifdef I_MEMORY
14003 #  include <memory.h>
14004 #endif
14005 #ifdef I_STDLIB
14006 #  include <stdlib.h>
14007 #endif
14008 #ifdef I_STRING
14009 #  include <string.h>
14010 #else
14011 #  include <strings.h>
14012 #endif
14013 #ifdef I_UNISTD
14014 #  include <unistd.h>  /* Needed for NetBSD */
14015 #endif
14016 int main()
14017 {
14018 char a = -1;
14019 char b = 0;
14020 if ((a < b) && memcmp(&a, &b, 1) < 0)
14021         exit(1);
14022 exit(0);
14023 }
14024 EOCP
14025         set try
14026         if eval $compile_ok; then
14027                 if $run ./try 2>/dev/null; then
14028                         echo "Yes, it can."
14029                         val="$define"
14030                 else
14031                         echo "No, it can't (it uses signed chars)."
14032                 fi
14033         else
14034                 echo "(I can't compile the test program, so we'll assume not...)"
14035         fi
14036         ;;
14037 esac
14038 $rm -f try.* try core
14039 set d_sanemcmp
14040 eval $setvar
14041
14042 : see if prototype for sbrk is available
14043 echo " "
14044 set d_sbrkproto sbrk $i_unistd unistd.h
14045 eval $hasproto
14046
14047 : see if select exists
14048 set select d_select
14049 eval $inlibc
14050
14051 : see if semctl exists
14052 set semctl d_semctl
14053 eval $inlibc
14054
14055 : see if semget exists
14056 set semget d_semget
14057 eval $inlibc
14058
14059 : see if semop exists
14060 set semop d_semop
14061 eval $inlibc
14062
14063 : see how much of the 'sem*(2)' library is present.
14064 h_sem=true
14065 echo " "
14066 case "$d_semctl$d_semget$d_semop" in
14067 *"$undef"*) h_sem=false;;
14068 esac
14069 case "$osname" in
14070 freebsd)
14071     case "`ipcs 2>&1`" in
14072     "SVID messages"*"not configured"*)
14073         echo "Your $osname does not have the sem*(2) configured." >&4
14074         h_sem=false
14075         val="$undef"
14076         set semctl d_semctl
14077         eval $setvar
14078         set semget d_semget
14079         eval $setvar
14080         set semop d_semop
14081         eval $setvar
14082         ;;
14083     esac
14084     ;;
14085 esac
14086 : we could also check for sys/ipc.h ...
14087 if $h_sem && $test `./findhdr sys/sem.h`; then
14088         echo "You have the full sem*(2) library." >&4
14089         val="$define"
14090 else
14091         echo "You don't have the full sem*(2) library." >&4
14092         val="$undef"
14093 fi
14094 set d_sem
14095 eval $setvar
14096
14097 : see whether sys/sem.h defines union semun
14098 echo " "
14099 $cat > try.c <<'END'
14100 #include <sys/types.h>
14101 #include <sys/ipc.h>
14102 #include <sys/sem.h>
14103 int main () { union semun semun; semun.buf = 0; }
14104 END
14105 set try
14106 if eval $compile; then
14107     echo "You have union semun in <sys/sem.h>." >&4
14108     val="$define"
14109 else
14110     echo "You do not have union semun in <sys/sem.h>." >&4
14111     val="$undef"
14112 fi
14113 $rm -f try try.c try.h
14114 set d_union_semun
14115 eval $setvar
14116
14117 : see how to do semctl IPC_STAT
14118 case "$d_sem" in
14119 $define)
14120     : see whether semctl IPC_STAT can use union semun
14121     echo " "
14122     $cat > try.h <<END
14123 #ifndef S_IRUSR
14124 #   ifdef S_IREAD
14125 #       define S_IRUSR S_IREAD
14126 #       define S_IWUSR S_IWRITE
14127 #       define S_IXUSR S_IEXEC
14128 #   else
14129 #       define S_IRUSR 0400
14130 #       define S_IWUSR 0200
14131 #       define S_IXUSR 0100
14132 #   endif
14133 #   define S_IRGRP (S_IRUSR>>3)
14134 #   define S_IWGRP (S_IWUSR>>3)
14135 #   define S_IXGRP (S_IXUSR>>3)
14136 #   define S_IROTH (S_IRUSR>>6)
14137 #   define S_IWOTH (S_IWUSR>>6)
14138 #   define S_IXOTH (S_IXUSR>>6)
14139 #endif
14140 #ifndef S_IRWXU
14141 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14142 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14143 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14144 #endif
14145 END
14146
14147     $cat > try.c <<END
14148 #include <sys/types.h>
14149 #include <sys/ipc.h>
14150 #include <sys/sem.h>
14151 #include <sys/stat.h>
14152 #include <stdio.h>
14153 #include <errno.h>
14154 #include "try.h"
14155 #ifndef errno
14156 extern int errno;
14157 #endif
14158 #$d_union_semun HAS_UNION_SEMUN
14159 int main() {
14160     union semun
14161 #ifndef HAS_UNION_SEMUN
14162     {
14163         int val;
14164         struct semid_ds *buf;
14165         unsigned short *array;
14166     }
14167 #endif
14168     arg;
14169     int sem, st;
14170
14171 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14172     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14173     if (sem > -1) {
14174         struct semid_ds argbuf;
14175         arg.buf = &argbuf;
14176 #       ifdef IPC_STAT
14177         st = semctl(sem, 0, IPC_STAT, arg);
14178         if (st == 0)
14179             printf("semun\n");
14180         else
14181 #       endif /* IPC_STAT */
14182             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14183 #       ifdef IPC_RMID
14184         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14185 #       endif /* IPC_RMID */
14186             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14187     } else
14188 #endif /* IPC_PRIVATE && ... */
14189         printf("semget failed: errno = %d\n", errno);
14190   return 0;
14191 }
14192 END
14193     val="$undef"
14194     set try
14195     if eval $compile; then
14196         xxx=`$run ./try`
14197         case "$xxx" in
14198         semun) val="$define" ;;
14199         esac
14200     fi
14201     $rm -f try try.c
14202     set d_semctl_semun
14203     eval $setvar
14204     case "$d_semctl_semun" in
14205     $define)
14206         echo "You can use union semun for semctl IPC_STAT." >&4
14207         also='also'
14208         ;;
14209     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14210         also=''
14211         ;;
14212     esac
14213
14214     : see whether semctl IPC_STAT can use struct semid_ds pointer
14215     $cat > try.c <<'END'
14216 #include <sys/types.h>
14217 #include <sys/ipc.h>
14218 #include <sys/sem.h>
14219 #include <sys/stat.h>
14220 #include "try.h"
14221 #include <stdio.h>
14222 #include <errno.h>
14223 #ifndef errno
14224 extern int errno;
14225 #endif
14226 int main() {
14227     struct semid_ds arg;
14228     int sem, st;
14229
14230 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14231     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14232     if (sem > -1) {
14233 #       ifdef IPC_STAT
14234         st = semctl(sem, 0, IPC_STAT, &arg);
14235         if (st == 0)
14236             printf("semid_ds\n");
14237         else
14238 #       endif /* IPC_STAT */
14239             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14240 #       ifdef IPC_RMID
14241         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14242 #       endif /* IPC_RMID */
14243             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14244     } else
14245 #endif /* IPC_PRIVATE && ... */
14246         printf("semget failed: errno = %d\n", errno);
14247
14248     return 0;
14249 }
14250 END
14251     val="$undef"
14252     set try
14253     if eval $compile; then
14254         xxx=`$run ./try`
14255         case "$xxx" in
14256         semid_ds) val="$define" ;;
14257         esac
14258     fi
14259     $rm -f try try.c
14260     set d_semctl_semid_ds
14261     eval $setvar
14262     case "$d_semctl_semid_ds" in
14263     $define)
14264         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14265         ;;
14266     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14267         ;;
14268     esac
14269     $rm -f try.h
14270     ;;
14271 *)  val="$undef"
14272
14273     # We do not have the full sem*(2) library, so assume we can not
14274     # use either.
14275
14276     set d_semctl_semun
14277     eval $setvar
14278
14279     set d_semctl_semid_ds
14280     eval $setvar
14281     ;;
14282 esac
14283
14284 : see if sendmsg exists
14285 set sendmsg d_sendmsg
14286 eval $inlibc
14287
14288 : see if setegid exists
14289 set setegid d_setegid
14290 eval $inlibc
14291
14292 : see if seteuid exists
14293 set seteuid d_seteuid
14294 eval $inlibc
14295
14296 : see if setgrent exists
14297 set setgrent d_setgrent
14298 eval $inlibc
14299
14300 : see if setgrent_r exists
14301 set setgrent_r d_setgrent_r
14302 eval $inlibc
14303 case "$d_setgrent_r" in
14304 "$define")
14305         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14306         case "$d_setgrent_r_proto" in
14307         '')     d_setgrent_r_proto=define
14308                 set d_setgrent_r_proto setgrent_r $hdrs
14309                 eval $hasproto ;;
14310         *)      ;;
14311         esac
14312         case "$d_setgrent_r_proto" in
14313         define)
14314         case "$setgrent_r_proto" in
14315         ''|0) try='int setgrent_r(FILE**);'
14316         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14317         esac
14318         case "$setgrent_r_proto" in
14319         ''|0) try='void setgrent_r(FILE**);'
14320         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14321         esac
14322         case "$setgrent_r_proto" in
14323         '')     d_setgrent_r=undef
14324                 setgrent_r_proto=0
14325                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14326         * )     case "$setgrent_r_proto" in
14327                 REENTRANT_PROTO*) ;;
14328                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14329                 esac
14330                 echo "Prototype: $try" ;;
14331         esac
14332         ;;
14333         *)      echo "You have setgrent_r but no prototype, not using it." >&4 ;;
14334         esac
14335         ;;
14336 *)      setgrent_r_proto=0
14337         ;;
14338 esac
14339
14340 : see if sethostent exists
14341 set sethostent d_sethent
14342 eval $inlibc
14343
14344 : see if sethostent_r exists
14345 set sethostent_r d_sethostent_r
14346 eval $inlibc
14347 case "$d_sethostent_r" in
14348 "$define")
14349         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14350         case "$d_sethostent_r_proto" in
14351         '')     d_sethostent_r_proto=define
14352                 set d_sethostent_r_proto sethostent_r $hdrs
14353                 eval $hasproto ;;
14354         *)      ;;
14355         esac
14356         case "$d_sethostent_r_proto" in
14357         define)
14358         case "$sethostent_r_proto" in
14359         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14360         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14361         esac
14362         case "$sethostent_r_proto" in
14363         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14364         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14365         esac
14366         case "$sethostent_r_proto" in
14367         '')     d_sethostent_r=undef
14368                 sethostent_r_proto=0
14369                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14370         * )     case "$sethostent_r_proto" in
14371                 REENTRANT_PROTO*) ;;
14372                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14373                 esac
14374                 echo "Prototype: $try" ;;
14375         esac
14376         ;;
14377         *)      echo "You have sethostent_r but no prototype, not using it." >&4 ;;
14378         esac
14379         ;;
14380 *)      sethostent_r_proto=0
14381         ;;
14382 esac
14383
14384 : see if setitimer exists
14385 set setitimer d_setitimer
14386 eval $inlibc
14387
14388 : see if setlinebuf exists
14389 set setlinebuf d_setlinebuf
14390 eval $inlibc
14391
14392 : see if setlocale exists
14393 set setlocale d_setlocale
14394 eval $inlibc
14395
14396 : see if locale.h is available
14397 set locale.h i_locale
14398 eval $inhdr
14399
14400 : see if setlocale_r exists
14401 set setlocale_r d_setlocale_r
14402 eval $inlibc
14403 case "$d_setlocale_r" in
14404 "$define")
14405         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14406         case "$d_setlocale_r_proto" in
14407         '')     d_setlocale_r_proto=define
14408                 set d_setlocale_r_proto setlocale_r $hdrs
14409                 eval $hasproto ;;
14410         *)      ;;
14411         esac
14412         case "$d_setlocale_r_proto" in
14413         define)
14414         case "$setlocale_r_proto" in
14415         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14416         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14417         esac
14418         case "$setlocale_r_proto" in
14419         '')     d_setlocale_r=undef
14420                 setlocale_r_proto=0
14421                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14422         * )     case "$setlocale_r_proto" in
14423                 REENTRANT_PROTO*) ;;
14424                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14425                 esac
14426                 echo "Prototype: $try" ;;
14427         esac
14428         ;;
14429         *)      echo "You have setlocale_r but no prototype, not using it." >&4 ;;
14430         esac
14431         ;;
14432 *)      setlocale_r_proto=0
14433         ;;
14434 esac
14435
14436 : see if setnetent exists
14437 set setnetent d_setnent
14438 eval $inlibc
14439
14440 : see if setnetent_r exists
14441 set setnetent_r d_setnetent_r
14442 eval $inlibc
14443 case "$d_setnetent_r" in
14444 "$define")
14445         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14446         case "$d_setnetent_r_proto" in
14447         '')     d_setnetent_r_proto=define
14448                 set d_setnetent_r_proto setnetent_r $hdrs
14449                 eval $hasproto ;;
14450         *)      ;;
14451         esac
14452         case "$d_setnetent_r_proto" in
14453         define)
14454         case "$setnetent_r_proto" in
14455         ''|0) try='int setnetent_r(int, struct netent_data*);'
14456         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14457         esac
14458         case "$setnetent_r_proto" in
14459         ''|0) try='void setnetent_r(int, struct netent_data*);'
14460         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14461         esac
14462         case "$setnetent_r_proto" in
14463         '')     d_setnetent_r=undef
14464                 setnetent_r_proto=0
14465                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14466         * )     case "$setnetent_r_proto" in
14467                 REENTRANT_PROTO*) ;;
14468                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14469                 esac
14470                 echo "Prototype: $try" ;;
14471         esac
14472         ;;
14473         *)      echo "You have setnetent_r but no prototype, not using it." >&4 ;;
14474         esac
14475         ;;
14476 *)      setnetent_r_proto=0
14477         ;;
14478 esac
14479
14480 : see if setprotoent exists
14481 set setprotoent d_setpent
14482 eval $inlibc
14483
14484 : see if setpgid exists
14485 set setpgid d_setpgid
14486 eval $inlibc
14487
14488 : see if setpgrp2 exists
14489 set setpgrp2 d_setpgrp2
14490 eval $inlibc
14491
14492 : see if setpriority exists
14493 set setpriority d_setprior
14494 eval $inlibc
14495
14496 : see if setproctitle exists
14497 set setproctitle d_setproctitle
14498 eval $inlibc
14499
14500 : see if setprotoent_r exists
14501 set setprotoent_r d_setprotoent_r
14502 eval $inlibc
14503 case "$d_setprotoent_r" in
14504 "$define")
14505         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14506         case "$d_setprotoent_r_proto" in
14507         '')     d_setprotoent_r_proto=define
14508                 set d_setprotoent_r_proto setprotoent_r $hdrs
14509                 eval $hasproto ;;
14510         *)      ;;
14511         esac
14512         case "$d_setprotoent_r_proto" in
14513         define)
14514         case "$setprotoent_r_proto" in
14515         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14516         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14517         esac
14518         case "$setprotoent_r_proto" in
14519         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14520         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14521         esac
14522         case "$setprotoent_r_proto" in
14523         '')     d_setprotoent_r=undef
14524                 setprotoent_r_proto=0
14525                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14526         * )     case "$setprotoent_r_proto" in
14527                 REENTRANT_PROTO*) ;;
14528                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14529                 esac
14530                 echo "Prototype: $try" ;;
14531         esac
14532         ;;
14533         *)      echo "You have setprotoent_r but no prototype, not using it." >&4 ;;
14534         esac
14535         ;;
14536 *)      setprotoent_r_proto=0
14537         ;;
14538 esac
14539
14540 : see if setpwent exists
14541 set setpwent d_setpwent
14542 eval $inlibc
14543
14544 : see if setpwent_r exists
14545 set setpwent_r d_setpwent_r
14546 eval $inlibc
14547 case "$d_setpwent_r" in
14548 "$define")
14549         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14550         case "$d_setpwent_r_proto" in
14551         '')     d_setpwent_r_proto=define
14552                 set d_setpwent_r_proto setpwent_r $hdrs
14553                 eval $hasproto ;;
14554         *)      ;;
14555         esac
14556         case "$d_setpwent_r_proto" in
14557         define)
14558         case "$setpwent_r_proto" in
14559         ''|0) try='int setpwent_r(FILE**);'
14560         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14561         esac
14562         case "$setpwent_r_proto" in
14563         ''|0) try='void setpwent_r(FILE**);'
14564         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14565         esac
14566         case "$setpwent_r_proto" in
14567         '')     d_setpwent_r=undef
14568                 setpwent_r_proto=0
14569                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14570         * )     case "$setpwent_r_proto" in
14571                 REENTRANT_PROTO*) ;;
14572                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14573                 esac
14574                 echo "Prototype: $try" ;;
14575         esac
14576         ;;
14577         *)      echo "You have setpwent_r but no prototype, not using it." >&4 ;;
14578         esac
14579         ;;
14580 *)      setpwent_r_proto=0
14581         ;;
14582 esac
14583
14584 : see if setregid exists
14585 set setregid d_setregid
14586 eval $inlibc
14587 set setresgid d_setresgid
14588 eval $inlibc
14589
14590 : see if setreuid exists
14591 set setreuid d_setreuid
14592 eval $inlibc
14593 set setresuid d_setresuid
14594 eval $inlibc
14595
14596 : see if setrgid exists
14597 set setrgid d_setrgid
14598 eval $inlibc
14599
14600 : see if setruid exists
14601 set setruid d_setruid
14602 eval $inlibc
14603
14604 : see if setservent exists
14605 set setservent d_setsent
14606 eval $inlibc
14607
14608 : see if setservent_r exists
14609 set setservent_r d_setservent_r
14610 eval $inlibc
14611 case "$d_setservent_r" in
14612 "$define")
14613         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14614         case "$d_setservent_r_proto" in
14615         '')     d_setservent_r_proto=define
14616                 set d_setservent_r_proto setservent_r $hdrs
14617                 eval $hasproto ;;
14618         *)      ;;
14619         esac
14620         case "$d_setservent_r_proto" in
14621         define)
14622         case "$setservent_r_proto" in
14623         ''|0) try='int setservent_r(int, struct servent_data*);'
14624         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14625         esac
14626         case "$setservent_r_proto" in
14627         ''|0) try='void setservent_r(int, struct servent_data*);'
14628         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14629         esac
14630         case "$setservent_r_proto" in
14631         '')     d_setservent_r=undef
14632                 setservent_r_proto=0
14633                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14634         * )     case "$setservent_r_proto" in
14635                 REENTRANT_PROTO*) ;;
14636                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14637                 esac
14638                 echo "Prototype: $try" ;;
14639         esac
14640         ;;
14641         *)      echo "You have setservent_r but no prototype, not using it." >&4 ;;
14642         esac
14643         ;;
14644 *)      setservent_r_proto=0
14645         ;;
14646 esac
14647
14648 : see if setsid exists
14649 set setsid d_setsid
14650 eval $inlibc
14651
14652 : see if setvbuf exists
14653 set setvbuf d_setvbuf
14654 eval $inlibc
14655
14656 : see if sfio.h is available
14657 set sfio.h i_sfio
14658 eval $inhdr
14659
14660
14661 : see if sfio library is available
14662 case "$i_sfio" in
14663 $define)
14664         val=''
14665         set sfreserve val
14666         eval $inlibc
14667         ;;
14668 *)
14669         val="$undef"
14670         ;;
14671 esac
14672 : Ok, but do we want to use it.
14673 case "$val" in
14674 $define)
14675         case "$usesfio" in
14676         true|$define|[yY]*) dflt='y';;
14677         *) dflt='n';;
14678         esac
14679         echo "$package can use the sfio library, but it is experimental."
14680         case "$useperlio" in
14681         "$undef")
14682             echo "For sfio also the PerlIO abstraction layer is needed."
14683             echo "Earlier you said you wouldn't want that."
14684             ;;
14685         esac
14686         rp="You seem to have sfio available, do you want to try using it?"
14687         . ./myread
14688         case "$ans" in
14689         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14690                 useperlio="$define"
14691                 val="$define"
14692                 ;;
14693         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14694                 val="$undef"
14695                 ;;
14696         esac
14697         ;;
14698 *)      case "$usesfio" in
14699         true|$define|[yY]*)
14700                 echo "Sorry, cannot find sfio on this machine." >&4
14701                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14702                 val="$undef"
14703                 ;;
14704         esac
14705         ;;
14706 esac
14707 set d_sfio
14708 eval $setvar
14709 case "$d_sfio" in
14710 $define) usesfio='true';;
14711 *) usesfio='false';;
14712 esac
14713 case "$d_sfio" in
14714 $define) ;;
14715 *)      : Remove sfio from list of libraries to use
14716         case "$libs" in
14717         *-lsfio*)
14718                 echo "Removing unneeded -lsfio from library list" >&4
14719                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14720                 shift
14721                 libs="$*"
14722                 echo "libs = $libs" >&4
14723                 ;;
14724         esac
14725 ;;
14726 esac
14727
14728
14729 : see if shmctl exists
14730 set shmctl d_shmctl
14731 eval $inlibc
14732
14733 : see if shmget exists
14734 set shmget d_shmget
14735 eval $inlibc
14736
14737 : see if shmat exists
14738 set shmat d_shmat
14739 eval $inlibc
14740 : see what shmat returns
14741 case "$d_shmat" in
14742 "$define")
14743         $cat >shmat.c <<'END'
14744 #include <sys/shm.h>
14745 void *shmat();
14746 END
14747         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14748                 shmattype='void *'
14749         else
14750                 shmattype='char *'
14751         fi
14752         echo "and it returns ($shmattype)." >&4
14753         : see if a prototype for shmat is available
14754         xxx=`./findhdr sys/shm.h`
14755         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14756         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14757                 val="$define"
14758         else
14759                 val="$undef"
14760         fi
14761         $rm -f shmat.[co]
14762         ;;
14763 *)
14764         val="$undef"
14765         ;;
14766 esac
14767 set d_shmatprototype
14768 eval $setvar
14769
14770 : see if shmdt exists
14771 set shmdt d_shmdt
14772 eval $inlibc
14773
14774 : see how much of the 'shm*(2)' library is present.
14775 h_shm=true
14776 echo " "
14777 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14778 *"$undef"*) h_shm=false;;
14779 esac
14780 case "$osname" in
14781 freebsd)
14782     case "`ipcs 2>&1`" in
14783     "SVID shared memory"*"not configured"*)
14784         echo "Your $osname does not have the shm*(2) configured." >&4
14785         h_shm=false
14786         val="$undef"
14787         set shmctl d_shmctl
14788         evat $setvar
14789         set shmget d_shmget
14790         evat $setvar
14791         set shmat d_shmat
14792         evat $setvar
14793         set shmdt d_shmdt
14794         evat $setvar
14795         ;;
14796     esac
14797     ;;
14798 esac
14799 : we could also check for sys/ipc.h ...
14800 if $h_shm && $test `./findhdr sys/shm.h`; then
14801         echo "You have the full shm*(2) library." >&4
14802         val="$define"
14803 else
14804         echo "You don't have the full shm*(2) library." >&4
14805         val="$undef"
14806 fi
14807 set d_shm
14808 eval $setvar
14809
14810 echo " "
14811 : see if we have sigaction
14812 if set sigaction val -f d_sigaction; eval $csym; $val; then
14813         echo 'sigaction() found.' >&4
14814         $cat > try.c <<'EOP'
14815 #include <stdio.h>
14816 #include <sys/types.h>
14817 #include <signal.h>
14818 int main()
14819 {
14820     struct sigaction act, oact;
14821     act.sa_flags = 0;
14822     oact.sa_handler = 0;
14823     /* so that act and oact are used */
14824     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
14825 }
14826 EOP
14827         set try
14828         if eval $compile_ok; then
14829                 val="$define"
14830         else
14831                 echo "But you don't seem to have a useable struct sigaction." >&4
14832                 val="$undef"
14833         fi
14834 else
14835         echo 'sigaction NOT found.' >&4
14836         val="$undef"
14837 fi
14838 set d_sigaction; eval $setvar
14839 $rm -f try try$_o try.c
14840
14841 : see if sigprocmask exists
14842 set sigprocmask d_sigprocmask
14843 eval $inlibc
14844
14845 : see if sigsetjmp exists
14846 echo " "
14847 case "$d_sigsetjmp" in
14848 '')
14849         $cat >try.c <<'EOP'
14850 #include <setjmp.h>
14851 sigjmp_buf env;
14852 int set = 1;
14853 int main()
14854 {
14855         if (sigsetjmp(env,1))
14856                 exit(set);
14857         set = 0;
14858         siglongjmp(env, 1);
14859         exit(1);
14860 }
14861 EOP
14862         set try
14863         if eval $compile; then
14864                 if $run ./try >/dev/null 2>&1; then
14865                         echo "POSIX sigsetjmp found." >&4
14866                         val="$define"
14867                 else
14868                         $cat >&4 <<EOM
14869 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
14870 I'll ignore them.
14871 EOM
14872                         val="$undef"
14873                 fi
14874         else
14875                 echo "sigsetjmp not found." >&4
14876                 val="$undef"
14877         fi
14878         ;;
14879 *) val="$d_sigsetjmp"
14880         case "$d_sigsetjmp" in
14881         $define) echo "POSIX sigsetjmp found." >&4;;
14882         $undef) echo "sigsetjmp not found." >&4;;
14883         esac
14884         ;;
14885 esac
14886 set d_sigsetjmp
14887 eval $setvar
14888 $rm -f try.c try
14889
14890 : see if sockatmark exists
14891 set sockatmark d_sockatmark
14892 eval $inlibc
14893
14894 : see if prototype for sockatmark is available
14895 echo " "
14896 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
14897 eval $hasproto
14898
14899 : see if socks5_init exists
14900 set socks5_init d_socks5_init
14901 eval $inlibc
14902
14903 : see if srand48_r exists
14904 set srand48_r d_srand48_r
14905 eval $inlibc
14906 case "$d_srand48_r" in
14907 "$define")
14908         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14909         case "$d_srand48_r_proto" in
14910         '')     d_srand48_r_proto=define
14911                 set d_srand48_r_proto srand48_r $hdrs
14912                 eval $hasproto ;;
14913         *)      ;;
14914         esac
14915         case "$d_srand48_r_proto" in
14916         define)
14917         case "$srand48_r_proto" in
14918         ''|0) try='int srand48_r(long, struct drand48_data*);'
14919         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
14920         esac
14921         case "$srand48_r_proto" in
14922         '')     d_srand48_r=undef
14923                 srand48_r_proto=0
14924                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
14925         * )     case "$srand48_r_proto" in
14926                 REENTRANT_PROTO*) ;;
14927                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
14928                 esac
14929                 echo "Prototype: $try" ;;
14930         esac
14931         ;;
14932         *)      echo "You have srand48_r but no prototype, not using it." >&4 ;;
14933         esac
14934         ;;
14935 *)      srand48_r_proto=0
14936         ;;
14937 esac
14938
14939 : see if srandom_r exists
14940 set srandom_r d_srandom_r
14941 eval $inlibc
14942 case "$d_srandom_r" in
14943 "$define")
14944         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14945         case "$d_srandom_r_proto" in
14946         '')     d_srandom_r_proto=define
14947                 set d_srandom_r_proto srandom_r $hdrs
14948                 eval $hasproto ;;
14949         *)      ;;
14950         esac
14951         case "$d_srandom_r_proto" in
14952         define)
14953         case "$srandom_r_proto" in
14954         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
14955         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
14956         esac
14957         case "$srandom_r_proto" in
14958         '')     d_srandom_r=undef
14959                 srandom_r_proto=0
14960                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
14961         * )     case "$srandom_r_proto" in
14962                 REENTRANT_PROTO*) ;;
14963                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
14964                 esac
14965                 echo "Prototype: $try" ;;
14966         esac
14967         ;;
14968         *)      echo "You have srandom_r but no prototype, not using it." >&4 ;;
14969         esac
14970         ;;
14971 *)      srandom_r_proto=0
14972         ;;
14973 esac
14974
14975 : see if prototype for setresgid is available
14976 echo " "
14977 set d_sresgproto setresgid $i_unistd unistd.h
14978 eval $hasproto
14979
14980 : see if prototype for setresuid is available
14981 echo " "
14982 set d_sresuproto setresuid $i_unistd unistd.h
14983 eval $hasproto
14984
14985 : see if sys/stat.h is available
14986 set sys/stat.h i_sysstat
14987 eval $inhdr
14988
14989
14990 : see if stat knows about block sizes
14991 echo " "
14992 echo "Checking to see if your struct stat has st_blocks field..." >&4
14993 set d_statblks stat st_blocks $i_sysstat sys/stat.h
14994 eval $hasfield
14995
14996
14997 : see if this is a sys/vfs.h system
14998 set sys/vfs.h i_sysvfs
14999 eval $inhdr
15000
15001
15002 : see if this is a sys/statfs.h system
15003 set sys/statfs.h i_sysstatfs
15004 eval $inhdr
15005
15006
15007 echo " "
15008 echo "Checking to see if your system supports struct statfs..." >&4
15009 set d_statfs_s statfs $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
15010 eval $hasstruct
15011 case "$d_statfs_s" in
15012 "$define")      echo "Yes, it does."   ;;
15013 *)              echo "No, it doesn't." ;;
15014 esac
15015
15016
15017
15018 : see if struct statfs knows about f_flags
15019 case "$d_statfs_s" in
15020 define) 
15021         echo " "
15022         echo "Checking to see if your struct statfs has f_flags field..." >&4
15023         set d_statfs_f_flags statfs f_flags $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h $i_sysvfs sys/vfs.h $i_sysstatfs sys/statfs.h
15024         eval $hasfield
15025         ;;
15026 *)      val="$undef"
15027         set d_statfs_f_flags
15028         eval $setvar
15029         ;;
15030 esac
15031 case "$d_statfs_f_flags" in
15032 "$define")      echo "Yes, it does."   ;;
15033 *)              echo "No, it doesn't." ;;
15034 esac
15035
15036 : see if _ptr and _cnt from stdio act std
15037 echo " "
15038
15039 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15040         echo "(Looks like you have stdio.h from BSD.)"
15041         case "$stdio_ptr" in
15042         '') stdio_ptr='((fp)->_p)'
15043                 ptr_lval=$define
15044                 ;;
15045         *)      ptr_lval=$d_stdio_ptr_lval;;
15046         esac
15047         case "$stdio_cnt" in
15048         '') stdio_cnt='((fp)->_r)'
15049                 cnt_lval=$define
15050                 ;;
15051         *)      cnt_lval=$d_stdio_cnt_lval;;
15052         esac
15053         case "$stdio_base" in
15054         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15055         esac
15056         case "$stdio_bufsiz" in
15057         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15058         esac
15059 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15060         echo "(Looks like you have stdio.h from Linux.)"
15061         case "$stdio_ptr" in
15062         '') stdio_ptr='((fp)->_IO_read_ptr)'
15063                 ptr_lval=$define
15064                 ;;
15065         *)      ptr_lval=$d_stdio_ptr_lval;;
15066         esac
15067         case "$stdio_cnt" in
15068         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15069                 cnt_lval=$undef
15070                 ;;
15071         *)      cnt_lval=$d_stdio_cnt_lval;;
15072         esac
15073         case "$stdio_base" in
15074         '') stdio_base='((fp)->_IO_read_base)';;
15075         esac
15076         case "$stdio_bufsiz" in
15077         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15078         esac
15079 else
15080         case "$stdio_ptr" in
15081         '') stdio_ptr='((fp)->_ptr)'
15082                 ptr_lval=$define
15083                 ;;
15084         *)      ptr_lval=$d_stdio_ptr_lval;;
15085         esac
15086         case "$stdio_cnt" in
15087         '') stdio_cnt='((fp)->_cnt)'
15088                 cnt_lval=$define
15089                 ;;
15090         *)      cnt_lval=$d_stdio_cnt_lval;;
15091         esac
15092         case "$stdio_base" in
15093         '') stdio_base='((fp)->_base)';;
15094         esac
15095         case "$stdio_bufsiz" in
15096         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15097         esac
15098 fi
15099
15100 : test whether _ptr and _cnt really work
15101 echo "Checking how std your stdio is..." >&4
15102 $cat >try.c <<EOP
15103 #include <stdio.h>
15104 #define FILE_ptr(fp)    $stdio_ptr
15105 #define FILE_cnt(fp)    $stdio_cnt
15106 int main() {
15107         FILE *fp = fopen("try.c", "r");
15108         char c = getc(fp);
15109         if (
15110                 18 <= FILE_cnt(fp) &&
15111                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15112         )
15113                 exit(0);
15114         exit(1);
15115 }
15116 EOP
15117 val="$undef"
15118 set try
15119 if eval $compile && $to try.c; then
15120         if $run ./try; then
15121                 echo "Your stdio acts pretty std."
15122                 val="$define"
15123         else
15124                 echo "Your stdio isn't very std."
15125         fi
15126 else
15127         echo "Your stdio doesn't appear very std."
15128 fi
15129 $rm -f try.c try
15130 set d_stdstdio
15131 eval $setvar
15132
15133 : Can _ptr be used as an lvalue?
15134 case "$d_stdstdio$ptr_lval" in
15135 $define$define) val=$define ;;
15136 *) val=$undef ;;
15137 esac
15138 set d_stdio_ptr_lval
15139 eval $setvar
15140
15141 : Can _cnt be used as an lvalue?
15142 case "$d_stdstdio$cnt_lval" in
15143 $define$define) val=$define ;;
15144 *) val=$undef ;;
15145 esac
15146 set d_stdio_cnt_lval
15147 eval $setvar
15148
15149
15150 : test whether setting _ptr sets _cnt as a side effect
15151 d_stdio_ptr_lval_sets_cnt="$undef"
15152 d_stdio_ptr_lval_nochange_cnt="$undef"
15153 case "$d_stdio_ptr_lval$d_stdstdio" in
15154 $define$define)
15155         echo "Checking to see what happens if we set the stdio ptr..." >&4
15156 $cat >try.c <<EOP
15157 #include <stdio.h>
15158 /* Can we scream? */
15159 /* Eat dust sed :-) */
15160 /* In the buffer space, no one can hear you scream. */
15161 #define FILE_ptr(fp)    $stdio_ptr
15162 #define FILE_cnt(fp)    $stdio_cnt
15163 #include <sys/types.h>
15164 int main() {
15165         FILE *fp = fopen("try.c", "r");
15166         int c;
15167         char *ptr;
15168         size_t cnt;
15169         if (!fp) {
15170             puts("Fail even to read");
15171             exit(1);
15172         }
15173         c = getc(fp); /* Read away the first # */
15174         if (c == EOF) {
15175             puts("Fail even to read");
15176             exit(1);
15177         }
15178         if (!(
15179                 18 <= FILE_cnt(fp) &&
15180                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15181         )) {
15182                 puts("Fail even to read");
15183                 exit (1);
15184         }
15185         ptr = (char*) FILE_ptr(fp);
15186         cnt = (size_t)FILE_cnt(fp);
15187
15188         FILE_ptr(fp) += 42;
15189
15190         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15191                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15192                 exit (1);
15193         }
15194         if (FILE_cnt(fp) <= 20) {
15195                 printf ("Fail (<20 chars to test)");
15196                 exit (1);
15197         }
15198         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15199                 puts("Fail compare");
15200                 exit (1);
15201         }
15202         if (cnt == FILE_cnt(fp)) {
15203                 puts("Pass_unchanged");
15204                 exit (0);
15205         }       
15206         if (FILE_cnt(fp) == (cnt - 42)) {
15207                 puts("Pass_changed");
15208                 exit (0);
15209         }
15210         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15211         return 1;
15212
15213 }
15214 EOP
15215         set try
15216         if eval $compile && $to try.c; then
15217                 case `$run ./try` in
15218                 Pass_changed)
15219                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15220                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15221                 Pass_unchanged)
15222                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15223                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15224                 Fail*)
15225                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15226                 *)
15227                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15228         esac
15229         else
15230                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15231         fi
15232         $rm -f try.c try
15233         ;;
15234 esac
15235
15236 : see if _base is also standard
15237 val="$undef"
15238 case "$d_stdstdio" in
15239 $define)
15240         $cat >try.c <<EOP
15241 #include <stdio.h>
15242 #define FILE_base(fp)   $stdio_base
15243 #define FILE_bufsiz(fp) $stdio_bufsiz
15244 int main() {
15245         FILE *fp = fopen("try.c", "r");
15246         char c = getc(fp);
15247         if (
15248                 19 <= FILE_bufsiz(fp) &&
15249                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15250         )
15251                 exit(0);
15252         exit(1);
15253 }
15254 EOP
15255         set try
15256         if eval $compile && $to try.c; then
15257                 if $run ./try; then
15258                         echo "And its _base field acts std."
15259                         val="$define"
15260                 else
15261                         echo "But its _base field isn't std."
15262                 fi
15263         else
15264                 echo "However, it seems to be lacking the _base field."
15265         fi
15266         $rm -f try.c try
15267         ;;
15268 esac
15269 set d_stdiobase
15270 eval $setvar
15271
15272 $cat >&4 <<EOM
15273 Checking how to access stdio streams by file descriptor number...
15274 EOM
15275 case "$stdio_stream_array" in
15276 '')     $cat >try.c <<EOCP
15277 #include <stdio.h>
15278 int main() {
15279   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15280     printf("yes\n");
15281 }
15282 EOCP
15283         for s in _iob __iob __sF
15284         do
15285                 set try -DSTDIO_STREAM_ARRAY=$s
15286                 if eval $compile; then
15287                         case "`$run ./try`" in
15288                         yes)    stdio_stream_array=$s; break ;;
15289                         esac
15290                 fi
15291         done
15292         $rm -f try.* try$exe_ext
15293 esac
15294 case "$stdio_stream_array" in
15295 '')     $cat >&4 <<EOM
15296 I can't figure out how to access stdio streams by file descriptor number.
15297 EOM
15298         d_stdio_stream_array="$undef"
15299         ;;
15300 *)      $cat >&4 <<EOM
15301 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15302 EOM
15303         d_stdio_stream_array="$define"
15304         ;;
15305 esac
15306
15307 : see if strcoll exists
15308 set strcoll d_strcoll
15309 eval $inlibc
15310
15311 : check for structure copying
15312 echo " "
15313 echo "Checking to see if your C compiler can copy structs..." >&4
15314 $cat >try.c <<'EOCP'
15315 int main()
15316 {
15317         struct blurfl {
15318                 int dyick;
15319         } foo, bar;
15320
15321         foo = bar;
15322 }
15323 EOCP
15324 if $cc -c try.c >/dev/null 2>&1 ; then
15325         val="$define"
15326         echo "Yup, it can."
15327 else
15328         val="$undef"
15329         echo "Nope, it can't."
15330 fi
15331 set d_strctcpy
15332 eval $setvar
15333 $rm -f try.*
15334
15335 : see if strerror and/or sys_errlist[] exist
15336 echo " "
15337 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15338     if set strerror val -f d_strerror; eval $csym; $val; then
15339                 echo 'strerror() found.' >&4
15340                 d_strerror="$define"
15341                 d_strerrm='strerror(e)'
15342                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15343                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15344                         d_syserrlst="$define"
15345                 else
15346                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15347                         d_syserrlst="$undef"
15348                 fi
15349     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15350                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15351                 echo 'strerror() found in string header.' >&4
15352                 d_strerror="$define"
15353                 d_strerrm='strerror(e)'
15354                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15355                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15356                                 d_syserrlst="$define"
15357                 else
15358                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15359                         d_syserrlst="$undef"
15360                 fi
15361     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15362                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15363                 d_strerror="$undef"
15364                 d_syserrlst="$define"
15365                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15366     else
15367                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15368                 d_strerror="$undef"
15369                 d_syserrlst="$undef"
15370                 d_strerrm='"unknown"'
15371     fi
15372 fi
15373
15374 : see if strerror_r exists
15375 set strerror_r d_strerror_r
15376 eval $inlibc
15377 case "$d_strerror_r" in
15378 "$define")
15379         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15380         case "$d_strerror_r_proto" in
15381         '')     d_strerror_r_proto=define
15382                 set d_strerror_r_proto strerror_r $hdrs
15383                 eval $hasproto ;;
15384         *)      ;;
15385         esac
15386         case "$d_strerror_r_proto" in
15387         define)
15388         case "$strerror_r_proto" in
15389         ''|0) try='int strerror_r(int, char*, size_t);'
15390         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15391         esac
15392         case "$strerror_r_proto" in
15393         ''|0) try='int strerror_r(int, char*, int);'
15394         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15395         esac
15396         case "$strerror_r_proto" in
15397         ''|0) try='char* strerror_r(int, char*, size_t);'
15398         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15399         esac
15400         case "$strerror_r_proto" in
15401         '')     d_strerror_r=undef
15402                 strerror_r_proto=0
15403                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15404         * )     case "$strerror_r_proto" in
15405                 REENTRANT_PROTO*) ;;
15406                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15407                 esac
15408                 echo "Prototype: $try" ;;
15409         esac
15410         ;;
15411         *)      echo "You have strerror_r but no prototype, not using it." >&4 ;;
15412         esac
15413         ;;
15414 *)      strerror_r_proto=0
15415         ;;
15416 esac
15417
15418 : see if strftime exists
15419 set strftime d_strftime
15420 eval $inlibc
15421
15422 : see if strtod exists
15423 set strtod d_strtod
15424 eval $inlibc
15425
15426 : see if strtol exists
15427 set strtol d_strtol
15428 eval $inlibc
15429
15430 : see if strtold exists
15431 set strtold d_strtold
15432 eval $inlibc
15433
15434 : see if strtoll exists
15435 set strtoll d_strtoll
15436 eval $inlibc
15437
15438 case "$d_longlong-$d_strtoll" in
15439 "$define-$define")
15440         $cat <<EOM
15441 Checking whether your strtoll() works okay...
15442 EOM
15443         $cat >try.c <<'EOCP'
15444 #include <errno.h>
15445 #ifdef __hpux
15446 #define strtoll __strtoll
15447 #endif
15448 #ifdef __EMX__
15449 #define strtoll _strtoll
15450 #endif
15451 #include <stdio.h>
15452 extern long long int strtoll(char *s, char **, int); 
15453 static int bad = 0;
15454 int check(char *s, long long ell, int een) {
15455         long long gll;
15456         errno = 0;
15457         gll = strtoll(s, 0, 10);
15458         if (!((gll == ell) && (errno == een)))
15459                 bad++;
15460 }
15461 int main() {
15462         check(" 1",                                      1LL, 0);
15463         check(" 0",                                      0LL, 0);
15464         check("-1",                                     -1LL, 0);
15465         check("-9223372036854775808", -9223372036854775808LL, 0);
15466         check("-9223372036854775808", -9223372036854775808LL, 0);
15467         check(" 9223372036854775807",  9223372036854775807LL, 0);
15468         check("-9223372036854775808", -9223372036854775808LL, 0);
15469         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15470         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15471         if (!bad)
15472                 printf("ok\n");
15473 }
15474 EOCP
15475         set try
15476         if eval $compile; then
15477                 yyy=`$run ./try`
15478                 case "$yyy" in
15479                 ok) echo "Your strtoll() seems to be working okay." ;;
15480                 *) cat <<EOM >&4
15481 Your strtoll() doesn't seem to be working okay.
15482 EOM
15483                    d_strtoll="$undef"
15484                    ;;
15485                 esac
15486         else
15487                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15488                 d_strtoll="$undef"
15489         fi
15490         ;;
15491 esac
15492
15493 : see if strtoq exists
15494 set strtoq d_strtoq
15495 eval $inlibc
15496
15497 : see if strtoul exists
15498 set strtoul d_strtoul
15499 eval $inlibc
15500
15501 case "$d_strtoul" in
15502 "$define")
15503         $cat <<EOM
15504 Checking whether your strtoul() works okay...
15505 EOM
15506         $cat >try.c <<'EOCP'
15507 #include <errno.h>
15508 #include <stdio.h>
15509 extern unsigned long int strtoul(char *s, char **, int); 
15510 static int bad = 0;
15511 void check(char *s, unsigned long eul, int een) {
15512         unsigned long gul;
15513         errno = 0;
15514         gul = strtoul(s, 0, 10);
15515         if (!((gul == eul) && (errno == een)))
15516                 bad++;
15517 }
15518 int main() {
15519         check(" 1", 1L, 0);
15520         check(" 0", 0L, 0);
15521 EOCP
15522         case "$longsize" in
15523         8)
15524             $cat >>try.c <<'EOCP'
15525         check("18446744073709551615", 18446744073709551615UL, 0);
15526         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15527 #if 0 /* strtoul() for /^-/ strings is undefined. */
15528         check("-1", 18446744073709551615UL, 0);
15529         check("-18446744073709551614", 2, 0);
15530         check("-18446744073709551615", 1, 0);
15531         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15532         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15533 #endif
15534 EOCP
15535                 ;;
15536         4)
15537                     $cat >>try.c <<'EOCP'
15538         check("4294967295", 4294967295UL, 0);
15539         check("4294967296", 4294967295UL, ERANGE);
15540 #if 0 /* strtoul() for /^-/ strings is undefined. */
15541         check("-1", 4294967295UL, 0);
15542         check("-4294967294", 2, 0);
15543         check("-4294967295", 1, 0);
15544         check("-4294967296", 4294967295UL, ERANGE);
15545         check("-4294967297", 4294967295UL, ERANGE);
15546 #endif
15547 EOCP
15548                 ;;
15549         *)
15550 : Should we write these tests to be more portable by sprintf-ing
15551 : ~0 and then manipulating that char string as input for strtol?
15552                 ;;
15553         esac
15554         $cat >>try.c <<'EOCP'
15555         if (!bad)
15556                 printf("ok\n");
15557         return 0;
15558 }
15559 EOCP
15560         set try
15561         if eval $compile; then
15562                 case "`$run ./try`" in
15563                 ok) echo "Your strtoul() seems to be working okay." ;;
15564                 *) cat <<EOM >&4
15565 Your strtoul() doesn't seem to be working okay.
15566 EOM
15567                    d_strtoul="$undef"
15568                    ;;
15569                 esac
15570         fi
15571         ;;
15572 esac
15573
15574 : see if strtoull exists
15575 set strtoull d_strtoull
15576 eval $inlibc
15577
15578 case "$d_longlong-$d_strtoull" in
15579 "$define-$define")
15580         $cat <<EOM
15581 Checking whether your strtoull() works okay...
15582 EOM
15583         $cat >try.c <<'EOCP'
15584 #include <errno.h>
15585 #ifdef __hpux
15586 #define strtoull __strtoull
15587 #endif
15588 #include <stdio.h>
15589 extern unsigned long long int strtoull(char *s, char **, int); 
15590 static int bad = 0;
15591 int check(char *s, long long eull, int een) {
15592         long long gull;
15593         errno = 0;
15594         gull = strtoull(s, 0, 10);
15595         if (!((gull == eull) && (errno == een)))
15596                 bad++;
15597 }
15598 int main() {
15599         check(" 1",                                        1LL, 0);
15600         check(" 0",                                        0LL, 0);
15601         check("18446744073709551615",  18446744073709551615ULL, 0);
15602         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15603 #if 0 /* strtoull() for /^-/ strings is undefined. */
15604         check("-1",                    18446744073709551615ULL, 0);
15605         check("-18446744073709551614",                     2LL, 0);
15606         check("-18446744073709551615",                     1LL, 0);
15607         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15608         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15609 #endif
15610         if (!bad)
15611                 printf("ok\n");
15612 }
15613 EOCP
15614         set try
15615         if eval $compile; then
15616                 case "`$run ./try`" in
15617                 ok) echo "Your strtoull() seems to be working okay." ;;
15618                 *) cat <<EOM >&4
15619 Your strtoull() doesn't seem to be working okay.
15620 EOM
15621                    d_strtoull="$undef"
15622                    ;;
15623                 esac
15624         fi
15625         ;;
15626 esac
15627
15628 : see if strtouq exists
15629 set strtouq d_strtouq
15630 eval $inlibc
15631
15632 case "$d_strtouq" in
15633 "$define")
15634         $cat <<EOM
15635 Checking whether your strtouq() works okay...
15636 EOM
15637         $cat >try.c <<'EOCP'
15638 #include <errno.h>
15639 #include <stdio.h>
15640 extern unsigned long long int strtouq(char *s, char **, int); 
15641 static int bad = 0;
15642 void check(char *s, unsigned long long eull, int een) {
15643         unsigned long long gull;
15644         errno = 0;
15645         gull = strtouq(s, 0, 10);
15646         if (!((gull == eull) && (errno == een)))
15647                 bad++;
15648 }
15649 int main() {
15650         check(" 1",                                        1LL, 0);
15651         check(" 0",                                        0LL, 0);
15652         check("18446744073709551615",  18446744073709551615ULL, 0);
15653         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15654 #if 0 /* strtouq() for /^-/ strings is undefined. */
15655         check("-1",                    18446744073709551615ULL, 0);
15656         check("-18446744073709551614",                     2LL, 0);
15657         check("-18446744073709551615",                     1LL, 0);
15658         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15659         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15660 #endif
15661         if (!bad)
15662                 printf("ok\n");
15663         return 0;
15664 }
15665 EOCP
15666         set try
15667         if eval $compile; then
15668                 case "`$run ./try`" in
15669                 ok) echo "Your strtouq() seems to be working okay." ;;
15670                 *) cat <<EOM >&4
15671 Your strtouq() doesn't seem to be working okay.
15672 EOM
15673                    d_strtouq="$undef"
15674                    ;;
15675                 esac
15676         fi
15677         ;;
15678 esac
15679
15680 : see if strxfrm exists
15681 set strxfrm d_strxfrm
15682 eval $inlibc
15683
15684 : see if symlink exists
15685 set symlink d_symlink
15686 eval $inlibc
15687
15688 : see if syscall exists
15689 set syscall d_syscall
15690 eval $inlibc
15691
15692 : see if prototype for syscall is available
15693 echo " "
15694 set d_syscallproto syscall $i_unistd unistd.h
15695 eval $hasproto
15696
15697 : see if sysconf exists
15698 set sysconf d_sysconf
15699 eval $inlibc
15700
15701 : see if system exists
15702 set system d_system
15703 eval $inlibc
15704
15705 : see if tcgetpgrp exists
15706 set tcgetpgrp d_tcgetpgrp
15707 eval $inlibc
15708
15709 : see if tcsetpgrp exists
15710 set tcsetpgrp d_tcsetpgrp
15711 eval $inlibc
15712
15713 : see if prototype for telldir is available
15714 echo " "
15715 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15716 eval $hasproto
15717
15718 : see if this is a sys/times.h system
15719 set sys/times.h i_systimes
15720 eval $inhdr
15721
15722 : see if times exists
15723 echo " "
15724 if set times val -f d_times; eval $csym; $val; then
15725         echo 'times() found.' >&4
15726         d_times="$define"
15727         inc=''
15728         case "$i_systimes" in
15729         "$define") inc='sys/times.h';;
15730         esac
15731         rp="What is the type returned by times() on this system?"
15732         set clock_t clocktype long stdio.h sys/types.h $inc
15733         eval $typedef_ask
15734 else
15735         echo 'times() NOT found, hope that will do.' >&4
15736         d_times="$undef"
15737         clocktype='int'
15738 fi
15739
15740 : see if tmpnam_r exists
15741 set tmpnam_r d_tmpnam_r
15742 eval $inlibc
15743 case "$d_tmpnam_r" in
15744 "$define")
15745         hdrs="$i_systypes sys/types.h define stdio.h $i_stdio stdio.h"
15746         case "$d_tmpnam_r_proto" in
15747         '')     d_tmpnam_r_proto=define
15748                 set d_tmpnam_r_proto tmpnam_r $hdrs
15749                 eval $hasproto ;;
15750         *)      ;;
15751         esac
15752         case "$d_tmpnam_r_proto" in
15753         define)
15754         case "$tmpnam_r_proto" in
15755         ''|0) try='char* tmpnam_r(char*);'
15756         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15757         esac
15758         case "$tmpnam_r_proto" in
15759         '')     d_tmpnam_r=undef
15760                 tmpnam_r_proto=0
15761                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
15762         * )     case "$tmpnam_r_proto" in
15763                 REENTRANT_PROTO*) ;;
15764                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
15765                 esac
15766                 echo "Prototype: $try" ;;
15767         esac
15768         ;;
15769         *)      echo "You have tmpnam_r but no prototype, not using it." >&4 ;;
15770         esac
15771         ;;
15772 *)      tmpnam_r_proto=0
15773         ;;
15774 esac
15775
15776 : see if truncate exists
15777 set truncate d_truncate
15778 eval $inlibc
15779
15780 : see if ttyname_r exists
15781 set ttyname_r d_ttyname_r
15782 eval $inlibc
15783 case "$d_ttyname_r" in
15784 "$define")
15785         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
15786         case "$d_ttyname_r_proto" in
15787         '')     d_ttyname_r_proto=define
15788                 set d_ttyname_r_proto ttyname_r $hdrs
15789                 eval $hasproto ;;
15790         *)      ;;
15791         esac
15792         case "$d_ttyname_r_proto" in
15793         define)
15794         case "$ttyname_r_proto" in
15795         ''|0) try='int ttyname_r(int, char*, size_t);'
15796         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
15797         esac
15798         case "$ttyname_r_proto" in
15799         ''|0) try='int ttyname_r(int, char*, int);'
15800         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
15801         esac
15802         case "$ttyname_r_proto" in
15803         ''|0) try='char* ttyname_r(int, char*, int);'
15804         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
15805         esac
15806         case "$ttyname_r_proto" in
15807         '')     d_ttyname_r=undef
15808                 ttyname_r_proto=0
15809                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
15810         * )     case "$ttyname_r_proto" in
15811                 REENTRANT_PROTO*) ;;
15812                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
15813                 esac
15814                 echo "Prototype: $try" ;;
15815         esac
15816         ;;
15817         *)      echo "You have ttyname_r but no prototype, not using it." >&4 ;;
15818         esac
15819         ;;
15820 *)      ttyname_r_proto=0
15821         ;;
15822 esac
15823
15824 : see if tzname[] exists
15825 echo " "
15826 if set tzname val -a d_tzname; eval $csym; $val; then
15827         val="$define"
15828         echo 'tzname[] found.' >&4
15829 else
15830         val="$undef"
15831         echo 'tzname[] NOT found.' >&4
15832 fi
15833 set d_tzname
15834 eval $setvar
15835
15836 case "$osname" in
15837 next|rhapsody|darwin) multiarch="$define" ;;
15838 esac
15839 case "$multiarch" in
15840 ''|[nN]*) multiarch="$undef" ;;
15841 esac
15842
15843 : check for ordering of bytes in a long
15844 echo " "
15845 case "$usecrosscompile$multiarch" in
15846 *$define*)
15847         $cat <<EOM
15848 You seem to be either cross-compiling or doing a multiarchitecture build,
15849 skipping the byteorder check.
15850
15851 EOM
15852         byteorder='ffff'
15853         ;;
15854 *)
15855         case "$byteorder" in
15856         '')
15857                 $cat <<'EOM'
15858 In the following, larger digits indicate more significance.  A big-endian
15859 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
15860 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
15861 machines may have weird orders like 3412.  A Cray will report 87654321,
15862 an Alpha will report 12345678. If the test program works the default is
15863 probably right.
15864 I'm now running the test program...
15865 EOM
15866                 $cat >try.c <<'EOCP'
15867 #include <stdio.h>
15868 int main()
15869 {
15870         int i;
15871         union {
15872                 unsigned long l;
15873                 char c[sizeof(long)];
15874         } u;
15875
15876         if (sizeof(long) > 4)
15877                 u.l = (0x08070605L << 32) | 0x04030201L;
15878         else
15879                 u.l = 0x04030201L;
15880         for (i = 0; i < sizeof(long); i++)
15881                 printf("%c", u.c[i]+'0');
15882         printf("\n");
15883         exit(0);
15884 }
15885 EOCP
15886                 xxx_prompt=y
15887                 set try
15888                 if eval $compile && ./try > /dev/null; then
15889                         dflt=`$run ./try`
15890                         case "$dflt" in
15891                         [1-4][1-4][1-4][1-4]|12345678|87654321)
15892                                 echo "(The test program ran ok.)"
15893                                 echo "byteorder=$dflt"
15894                                 xxx_prompt=n
15895                         ;;
15896                         ????|????????) echo "(The test program ran ok.)" ;;
15897                         *) echo "(The test program didn't run right for some reason.)" ;;
15898                         esac
15899                 else
15900                         dflt='4321'
15901                         cat <<'EOM'
15902 (I can't seem to compile the test program.  Guessing big-endian...)
15903 EOM
15904                 fi
15905                 case "$xxx_prompt" in
15906                 y)
15907                         rp="What is the order of bytes in a long?"
15908                         . ./myread
15909                         byteorder="$ans"
15910                         ;;
15911                 *)      byteorder=$dflt
15912                         ;;
15913                 esac
15914                 ;;
15915         esac
15916         $rm -f try.c try
15917         ;;
15918 esac
15919
15920
15921 $cat <<EOM
15922
15923 Checking to see whether you can access character data unalignedly...
15924 EOM
15925 case "$d_u32align" in
15926 '')   $cat >try.c <<EOCP
15927 #include <stdio.h>
15928 #define U32 $u32type
15929 #define BYTEORDER 0x$byteorder
15930 #define U8 $u8type
15931 #include <signal.h>
15932 #ifdef SIGBUS
15933 $signal_t bletch(s) int s; { exit(4); }
15934 #endif
15935 int main() {
15936 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
15937     U8 buf[8];
15938     U32 *up;
15939     int i;
15940
15941     if (sizeof(U32) != 4) {
15942         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
15943         exit(1);
15944     }
15945
15946     fflush(stdout);
15947
15948 #ifdef SIGBUS
15949     signal(SIGBUS, bletch);
15950 #endif
15951
15952     buf[0] = 0;
15953     buf[1] = 0;
15954     buf[2] = 0;
15955     buf[3] = 1;
15956     buf[5] = 0;
15957     buf[6] = 0;
15958     buf[7] = 0;
15959     buf[8] = 1;
15960
15961     for (i = 0; i < 4; i++) {
15962         up = (U32*)(buf + i);
15963         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
15964                (*up == 1 << (8*(3-i)))  /* little-endian */
15965               )
15966            )
15967         {
15968             printf("read failed (%x)\n", *up);
15969             exit(2);
15970         }
15971     }
15972
15973     /* write test */
15974     for (i = 0; i < 4; i++) {
15975         up = (U32*)(buf + i);
15976         *up = 0xBeef;
15977         if (*up != 0xBeef) {
15978             printf("write failed (%x)\n", *up);
15979             exit(3);
15980         }
15981     }
15982
15983     exit(0);
15984 #else
15985     printf("1\n");
15986     exit(1);
15987 #endif
15988     return 0;
15989 }
15990 EOCP
15991 set try
15992 if eval $compile_ok; then
15993         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
15994         $run ./try 2>&1 >/dev/null
15995         case "$?" in
15996         0)      cat >&4 <<EOM
15997 You can access character data pretty unalignedly.
15998 EOM
15999                 d_u32align="$undef"
16000                 ;;
16001         *)      cat >&4 <<EOM
16002 It seems that you must access character data in an aligned manner.
16003 EOM
16004                 d_u32align="$define"
16005                 ;;
16006         esac
16007 else
16008         rp='Can you access character data at unaligned addresses?'
16009         dflt='n'
16010         . ./myread
16011         case "$ans" in
16012         [yY]*)  d_u32align="$undef"  ;;
16013         *)      d_u32align="$define" ;;
16014         esac
16015 fi
16016 $rm -f core core.try.* try.core
16017 ;;
16018 esac
16019
16020 : see if ualarm exists
16021 set ualarm d_ualarm
16022 eval $inlibc
16023
16024 : see if umask exists
16025 set umask d_umask
16026 eval $inlibc
16027
16028 : see if unordered exists
16029 set unordered d_unordered
16030 eval $inlibc
16031
16032 : see if usleep exists
16033 set usleep d_usleep
16034 eval $inlibc
16035
16036 : see if prototype for usleep is available
16037 echo " "
16038 set d_usleepproto usleep $i_unistd unistd.h
16039 eval $hasproto
16040
16041 : see if ustat exists
16042 set ustat d_ustat
16043 eval $inlibc
16044
16045 : backward compatibility for d_hvfork
16046 if test X$d_hvfork != X; then
16047         d_vfork="$d_hvfork"
16048         d_hvfork=''
16049 fi
16050 : see if there is a vfork
16051 val=''
16052 set vfork val
16053 eval $inlibc
16054
16055 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16056 : perl on Solaris 2.x, and probably elsewhere.
16057 case "$val" in
16058 $define)
16059         echo " "
16060         case "$usevfork" in
16061         false) dflt='n';;
16062         *) dflt='y';;
16063         esac
16064         cat <<'EOM'
16065  
16066 Perl can only use a vfork() that doesn't suffer from strict
16067 restrictions on calling functions or modifying global data in
16068 the child.  For example, glibc-2.1 contains such a vfork()
16069 that is unsuitable.  If your system provides a proper fork()
16070 call, chances are that you do NOT want perl to use vfork().
16071
16072 EOM
16073         rp="Do you still want to use vfork()?"
16074         . ./myread
16075         case "$ans" in
16076         y|Y) ;;
16077         *)
16078                 echo "Ok, we won't use vfork()."
16079                 val="$undef"
16080                 ;;
16081         esac
16082         ;;
16083 esac
16084 set d_vfork
16085 eval $setvar
16086 case "$d_vfork" in
16087 $define) usevfork='true';;
16088 *) usevfork='false';;
16089 esac
16090
16091 : see if closedir exists
16092 set closedir d_closedir
16093 eval $inlibc
16094
16095 case "$d_closedir" in
16096 "$define")
16097         echo " "
16098         echo "Checking whether closedir() returns a status..." >&4
16099         cat > try.c <<EOM
16100 #$i_dirent I_DIRENT             /**/
16101 #$i_sysdir I_SYS_DIR            /**/
16102 #$i_sysndir I_SYS_NDIR          /**/
16103 #$i_systypes I_SYS_TYPES        /**/
16104
16105 #if defined(I_SYS_TYPES)
16106 #include <sys/types.h>
16107 #endif
16108 #if defined(I_DIRENT)
16109 #include <dirent.h>
16110 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16111 #include <sys/dir.h>
16112 #endif
16113 #else
16114 #ifdef I_SYS_NDIR
16115 #include <sys/ndir.h>
16116 #else
16117 #ifdef I_SYS_DIR
16118 #ifdef hp9000s500
16119 #include <ndir.h>       /* may be wrong in the future */
16120 #else
16121 #include <sys/dir.h>
16122 #endif
16123 #endif
16124 #endif
16125 #endif 
16126 int main() { return closedir(opendir(".")); }
16127 EOM
16128         set try
16129         if eval $compile_ok; then
16130                 if $run ./try > /dev/null 2>&1 ; then
16131                         echo "Yes, it does."
16132                         val="$undef"
16133                 else
16134                         echo "No, it doesn't."
16135                         val="$define"
16136                 fi
16137         else
16138                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16139                 val="$define"
16140         fi
16141         ;;
16142 *)
16143         val="$undef";
16144         ;;
16145 esac
16146 set d_void_closedir
16147 eval $setvar
16148 $rm -f try try.*
16149 : see if there is a wait4
16150 set wait4 d_wait4
16151 eval $inlibc
16152
16153 : see if waitpid exists
16154 set waitpid d_waitpid
16155 eval $inlibc
16156
16157 : see if wcstombs exists
16158 set wcstombs d_wcstombs
16159 eval $inlibc
16160
16161 : see if wctomb exists
16162 set wctomb d_wctomb
16163 eval $inlibc
16164
16165 : see if writev exists
16166 set writev d_writev
16167 eval $inlibc
16168
16169 : preserve RCS keywords in files with variable substitution, grrr
16170 Date='$Date'
16171 Id='$Id'
16172 Log='$Log'
16173 RCSfile='$RCSfile'
16174 Revision='$Revision'
16175
16176 : check for alignment requirements
16177 echo " "
16178 case "$usecrosscompile$multiarch" in
16179 *$define*)
16180         $cat <<EOM
16181 You seem to be either cross-compiling or doing a multiarchitecture build,
16182 skipping the memory alignment check.
16183
16184 EOM
16185         case "$alignbytes" in
16186         '') alignbytes=8 ;;
16187         esac
16188         ;;
16189 *)
16190         case "$alignbytes" in
16191         '') echo "Checking alignment constraints..." >&4
16192                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16193                         $cat >try.c <<'EOCP'
16194 typedef long double NV;
16195 EOCP
16196                 else
16197                         $cat >try.c <<'EOCP'
16198 typedef double NV;
16199 EOCP
16200                 fi
16201                 $cat >>try.c <<'EOCP'
16202 #include <stdio.h>
16203 struct foobar {
16204         char foo;
16205         NV bar;
16206 } try_algn;
16207 int main()
16208 {
16209     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16210     return(0);
16211 }
16212 EOCP
16213                 set try
16214                 if eval $compile_ok; then
16215                         dflt=`$run ./try`
16216                 else
16217                         dflt='8'
16218                         echo "(I can't seem to compile the test program...)"
16219                 fi
16220                 ;;
16221         *) dflt="$alignbytes"
16222                 ;;
16223         esac
16224         rp="Doubles must be aligned on a how-many-byte boundary?"
16225         . ./myread
16226         alignbytes="$ans"
16227         $rm -f try.c try
16228         ;;
16229 esac
16230
16231
16232 : set the base revision
16233 baserev=5.0
16234
16235 : how do we catenate cpp tokens here?
16236 echo " "
16237 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16238 $cat >cpp_stuff.c <<'EOCP'
16239 #define RCAT(a,b)a/**/b
16240 #define ACAT(a,b)a ## b
16241 RCAT(Rei,ser)
16242 ACAT(Cir,cus)
16243 EOCP
16244 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16245 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16246         echo "Oh!  Smells like ANSI's been here." >&4
16247         echo "We can catify or stringify, separately or together!"
16248         cpp_stuff=42
16249 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16250         echo "Ah, yes!  The good old days!" >&4
16251         echo "However, in the good old days we don't know how to stringify and"
16252         echo "catify at the same time."
16253         cpp_stuff=1
16254 else
16255         $cat >&4 <<EOM
16256 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16257 to have to edit the values of CAT[2-5] in config.h...
16258 EOM
16259         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16260 fi
16261 $rm -f cpp_stuff.*
16262
16263 : see if this is a db.h system
16264 set db.h i_db
16265 eval $inhdr
16266
16267 case "$i_db" in
16268 $define)
16269         : Check db version.
16270         echo " "
16271         echo "Checking Berkeley DB version ..." >&4
16272         $cat >try.c <<EOCP
16273 #$d_const HASCONST
16274 #ifndef HASCONST
16275 #define const
16276 #endif
16277 #include <sys/types.h>
16278 #include <stdio.h>
16279 #include <db.h>
16280 int main(int argc, char *argv[])
16281 {
16282 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16283     int Major, Minor, Patch ;
16284     unsigned long Version ;
16285     (void)db_version(&Major, &Minor, &Patch) ;
16286     if (argc == 2) {
16287         printf("%d %d %d %d %d %d\n",
16288                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16289                Major, Minor, Patch);
16290         exit(0);
16291     }
16292     printf("You have Berkeley DB Version 2 or greater.\n");
16293
16294     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16295                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16296     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16297                 Major, Minor, Patch) ;
16298
16299     /* check that db.h & libdb are compatible */
16300     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16301         printf("db.h and libdb are incompatible.\n") ;
16302         exit(3);        
16303     }
16304
16305     printf("db.h and libdb are compatible.\n") ;
16306
16307     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16308                 + DB_VERSION_PATCH ;
16309
16310     /* needs to be >= 2.3.4 */
16311     if (Version < 2003004) {
16312     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16313         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16314         exit(2);        
16315     }
16316
16317     exit(0);
16318 #else
16319 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16320     if (argc == 2) {
16321         printf("1 0 0\n");
16322         exit(0);
16323     }
16324     printf("You have Berkeley DB Version 1.\n");
16325     exit(0);    /* DB version < 2: the coast is clear. */
16326 #else
16327     exit(1);    /* <db.h> not Berkeley DB? */
16328 #endif
16329 #endif
16330 }
16331 EOCP
16332         set try
16333         if eval $compile_ok && $run ./try; then
16334                 echo 'Looks OK.' >&4
16335                 set `$run ./try 1`
16336                 db_version_major=$1
16337                 db_version_minor=$2
16338                 db_version_patch=$3
16339         else
16340                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16341                 i_db=$undef
16342                 case " $libs " in
16343                 *"-ldb "*)
16344                         : Remove db from list of libraries to use
16345                         echo "Removing unusable -ldb from library list" >&4
16346                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16347                         shift
16348                         libs="$*"
16349                         echo "libs = $libs" >&4
16350                         ;;
16351                 esac
16352         fi
16353         $rm -f try.*
16354         ;;
16355 esac
16356
16357 case "$i_db" in
16358 define)
16359         : Check the return type needed for hash 
16360         echo " "
16361         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16362         $cat >try.c <<EOCP
16363 #$d_const HASCONST
16364 #ifndef HASCONST
16365 #define const
16366 #endif
16367 #include <sys/types.h>
16368 #include <db.h>
16369
16370 #ifndef DB_VERSION_MAJOR
16371 u_int32_t hash_cb (ptr, size)
16372 const void *ptr;
16373 size_t size;
16374 {
16375 }
16376 HASHINFO info;
16377 int main()
16378 {
16379         info.hash = hash_cb;
16380 }
16381 #endif
16382 EOCP
16383         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16384                 if $contains warning try.out >>/dev/null 2>&1 ; then
16385                         db_hashtype='int'
16386                 else
16387                         db_hashtype='u_int32_t'
16388                 fi
16389         else
16390                 : XXX Maybe we should just give up here.
16391                 db_hashtype=u_int32_t
16392                 $cat try.out >&4
16393                 echo "Help:  I can't seem to compile the db test program." >&4
16394                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16395         fi
16396         $rm -f try.*
16397         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16398         ;;
16399 *)      db_hashtype=u_int32_t
16400         ;;
16401 esac
16402 case "$i_db" in
16403 define)
16404         : Check the return type needed for prefix 
16405         echo " "
16406         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16407         cat >try.c <<EOCP
16408 #$d_const HASCONST
16409 #ifndef HASCONST
16410 #define const
16411 #endif
16412 #include <sys/types.h>
16413 #include <db.h>
16414
16415 #ifndef DB_VERSION_MAJOR
16416 size_t prefix_cb (key1, key2)
16417 const DBT *key1;
16418 const DBT *key2;
16419 {
16420 }
16421 BTREEINFO info;
16422 int main()
16423 {
16424         info.prefix = prefix_cb;
16425 }
16426 #endif
16427 EOCP
16428         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16429                 if $contains warning try.out >>/dev/null 2>&1 ; then
16430                         db_prefixtype='int'
16431                 else
16432                         db_prefixtype='size_t'
16433                 fi
16434         else
16435                 db_prefixtype='size_t'
16436                 : XXX Maybe we should just give up here.
16437                 $cat try.out >&4
16438                 echo "Help:  I can't seem to compile the db test program." >&4
16439                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16440         fi
16441         $rm -f try.*
16442         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16443         ;;
16444 *)      db_prefixtype='size_t'
16445         ;;
16446 esac
16447
16448
16449 : How can we generate normalized random numbers ?
16450 echo " "
16451 echo "Looking for a random number function..." >&4
16452 case "$randfunc" in
16453 '')
16454         if set drand48 val -f; eval $csym; $val; then
16455                 dflt="drand48"
16456                 echo "Good, found drand48()." >&4
16457         elif set random val -f; eval $csym; $val; then
16458                 dflt="random"
16459                 echo "OK, found random()." >&4
16460         else
16461                 dflt="rand"
16462                 echo "Yick, looks like I have to use rand()." >&4
16463         fi
16464         echo " "
16465         ;;
16466 *)
16467         dflt="$randfunc"
16468         ;;
16469 esac
16470 cont=true
16471
16472 case "$ccflags" in
16473 *-Dmy_rand=*|*-Dmy_srand=*)
16474         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16475         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16476         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16477         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16478         ;;
16479 esac
16480
16481 while $test "$cont"; do
16482         rp="Use which function to generate random numbers?"
16483         . ./myread
16484         if $test "$ans" = "$dflt"; then
16485                 : null
16486         else
16487                 randbits=''
16488         fi
16489         randfunc="$ans"
16490         if set $ans val -f; eval $csym; $val; then
16491                 cont=''
16492         else
16493                 dflt=y
16494                 rp="I cannot find function $ans. Use that name anyway?"
16495                 . ./myread
16496                 dflt=rand
16497                 case "$ans" in
16498                         [yY]*) cont='';;
16499                 esac
16500         fi
16501         case "$cont" in
16502         '')
16503                 case "$randfunc" in
16504                 drand48)
16505                         drand01="drand48()"
16506                         seedfunc="srand48"
16507                         randbits=48
16508                         randseedtype=long
16509                         ;;
16510                 rand|random)
16511                         case "$randbits" in
16512                         '')
16513 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16514                                 $cat >try.c <<EOCP
16515 #$i_unistd I_UNISTD
16516 #$i_stdlib I_STDLIB
16517 #include <stdio.h>
16518 #ifdef I_UNISTD
16519 #  include <unistd.h>
16520 #endif
16521 #ifdef I_STDLIB
16522 #  include <stdlib.h>
16523 #endif
16524 int main()
16525 {
16526         register int i;
16527         register unsigned long tmp;
16528         register unsigned long max = 0L;
16529
16530         for (i = 1000; i; i--) {
16531                 tmp = (unsigned long) $randfunc();
16532                 if (tmp > max) max = tmp;
16533         }
16534         for (i = 0; max; i++)
16535                 max /= 2;
16536         printf("%d\n",i);
16537 }
16538 EOCP
16539                                 set try
16540                                 if eval $compile_ok; then
16541                                         dflt=`try`
16542                                 else
16543                                         dflt='?'
16544                                         echo "(I can't seem to compile the test program...)"
16545                                 fi
16546                                 ;;
16547                         *)
16548                                 dflt="$randbits"
16549                                 ;;
16550                         esac
16551                         rp="How many bits does your $randfunc() function produce?"
16552                         . ./myread
16553                         randbits="$ans"
16554                         $rm -f try.c try
16555                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16556                         seedfunc="s$randfunc"
16557                         randseedtype=unsigned
16558                         ;;
16559                 *)
16560                         dflt="31"
16561                         rp="How many bits does your $randfunc() function produce?"
16562                         . ./myread
16563                         randbits="$ans"
16564                         seedfunc="s$randfunc"
16565                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16566                         if set $seedfunc val -f; eval $csym; $val; then
16567                                 echo "(Using $seedfunc() to seed random generator)"
16568                         else
16569                                 echo "(Warning: no $seedfunc() to seed random generator)"
16570                                 seedfunc=rand
16571                         fi
16572                         randseedtype=unsigned
16573                         ;;
16574                 esac
16575                 ;;
16576         esac
16577 done
16578
16579 echo " "
16580 echo "Determining whether or not we are on an EBCDIC system..." >&4
16581 $cat >try.c <<'EOM'
16582 int main()
16583 {
16584   if ('M'==0xd4) return 0;
16585   return 1;
16586 }
16587 EOM
16588
16589 val=$undef
16590 set try
16591 if eval $compile_ok; then
16592         if $run ./try; then
16593                 echo "You seem to speak EBCDIC." >&4
16594                 val="$define"
16595         else
16596                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16597         fi
16598 else
16599         echo "I'm unable to compile the test program." >&4
16600         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16601 fi
16602 $rm -f try try.*
16603 set ebcdic
16604 eval $setvar
16605
16606 echo " "
16607 $cat >&4 <<EOM
16608 Checking how to flush all pending stdio output...
16609 EOM
16610 # I only know how to find the first 32 possibly open files on SunOS.
16611 # See also hints/sunos_4_1.sh and util.c  --AD
16612 case "$osname" in
16613 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16614 esac
16615 $cat >>try.c <<EOCP
16616 #include <stdio.h>
16617 #$i_unistd I_UNISTD
16618 #ifdef I_UNISTD
16619 # include <unistd.h>
16620 #endif
16621 #$d_sysconf HAS_SYSCONF
16622 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16623 #ifdef HAS_STDIO_STREAM_ARRAY
16624 # define STDIO_STREAM_ARRAY $stdio_stream_array
16625 #endif
16626 int main() {
16627   FILE* p;
16628   unlink("try.out");
16629   p = fopen("try.out", "w");
16630 #ifdef TRY_FPUTC
16631   fputc('x', p);
16632 #else
16633 # ifdef TRY_FPRINTF
16634   fprintf(p, "x");
16635 # endif
16636 #endif
16637 #ifdef TRY_FFLUSH_NULL
16638   fflush(NULL);
16639 #endif
16640 #ifdef TRY_FFLUSH_ALL
16641   {
16642     long open_max = -1;
16643 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16644     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16645 # else
16646 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16647     open_max = sysconf(_SC_OPEN_MAX);
16648 #  else
16649 #   ifdef FOPEN_MAX
16650     open_max = FOPEN_MAX;
16651 #   else
16652 #    ifdef OPEN_MAX
16653     open_max = OPEN_MAX;
16654 #    else
16655 #     ifdef _NFILE
16656     open_max = _NFILE;
16657 #     endif
16658 #    endif
16659 #   endif
16660 #  endif
16661 # endif 
16662 # ifdef HAS_STDIO_STREAM_ARRAY
16663     if (open_max > 0) {
16664       long i;
16665       for (i = 0; i < open_max; i++)
16666             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16667                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16668                 STDIO_STREAM_ARRAY[i]._flag)
16669                 fflush(&STDIO_STREAM_ARRAY[i]);
16670     }   
16671   }
16672 # endif
16673 #endif
16674   _exit(42);
16675 }
16676 EOCP
16677 : first we have to find out how _not_ to flush
16678 $to try.c
16679 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16680     output=''
16681     set try -DTRY_FPUTC
16682     if eval $compile; then
16683             $run ./try 2>/dev/null
16684             code="$?"
16685             $from try.out
16686             if $test ! -s try.out -a "X$code" = X42; then
16687                 output=-DTRY_FPUTC
16688             fi
16689     fi
16690     case "$output" in
16691     '')
16692             set try -DTRY_FPRINTF
16693             if eval $compile; then
16694                     $run ./try 2>/dev/null
16695                     code="$?"
16696                     $from try.out
16697                     if $test ! -s try.out -a "X$code" = X42; then
16698                         output=-DTRY_FPRINTF
16699                     fi
16700             fi
16701         ;;
16702     esac
16703 fi
16704 : check for fflush NULL behaviour
16705 case "$fflushNULL" in
16706 '')     set try -DTRY_FFLUSH_NULL $output
16707         if eval $compile; then
16708                 $run ./try 2>/dev/null
16709                 code="$?"
16710                 $from try.out
16711                 if $test -s try.out -a "X$code" = X42; then
16712                         fflushNULL="`$cat try.out`"
16713                 else
16714                         if $test "X$code" != X42; then
16715                                 $cat >&4 <<EOM
16716 (If this test failed, don't worry, we'll try another method shortly.)
16717 EOM
16718                         fi
16719                 fi
16720         fi
16721         $rm -f core try.core core.try.*
16722         case "$fflushNULL" in
16723         x)      $cat >&4 <<EOM
16724 Your fflush(NULL) works okay for output streams.
16725 Let's see if it clobbers input pipes...
16726 EOM
16727 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16728 # bug that improperly flushes the input end of pipes.  So we avoid the
16729 # autoflush on fork/system/exec support for now. :-(
16730 $cat >tryp.c <<EOCP
16731 #include <stdio.h>
16732 int
16733 main(int argc, char **argv)
16734 {
16735     char buf[1024];
16736     int i;
16737     char *bp = buf;
16738     while (1) {
16739         while ((i = getc(stdin)) != -1
16740                && (*bp++ = i) != '\n'
16741                && bp < &buf[1024])
16742         /* DO NOTHING */ ;
16743         *bp = '\0';
16744         fprintf(stdout, "%s", buf);
16745         fflush(NULL);
16746         if (i == -1)
16747             return 0;
16748         bp = buf;
16749     }
16750 }
16751 EOCP
16752                 fflushNULL="$define"
16753                 set tryp
16754                 if eval $compile; then
16755                     $rm -f tryp.out
16756                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
16757                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
16758                        $cat >&4 <<EOM
16759 fflush(NULL) seems to behave okay with input streams.
16760 EOM
16761                         fflushNULL="$define"
16762                     else
16763                         $cat >&4 <<EOM
16764 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
16765 EOM
16766                         fflushNULL="$undef"
16767                     fi
16768                 fi
16769                 $rm -f core tryp.c tryp.core core.tryp.*
16770                 ;;
16771         '')     $cat >&4 <<EOM
16772 Your fflush(NULL) isn't working (contrary to ANSI C).
16773 EOM
16774                 fflushNULL="$undef"
16775                 ;;
16776         *)      $cat >&4 <<EOM
16777 Cannot figure out whether your fflush(NULL) works or not.
16778 I'm assuming it doesn't (contrary to ANSI C).
16779 EOM
16780                 fflushNULL="$undef"
16781                 ;;
16782         esac
16783         ;;
16784 $define|true|[yY]*)
16785         fflushNULL="$define"
16786         ;;
16787 *)
16788         fflushNULL="$undef"
16789         ;;
16790 esac
16791 : check explicit looping only if NULL did not work, and if the pipe
16792 : bug does not show up on an explicit flush too
16793 case "$fflushNULL" in
16794 "$undef")
16795         $cat >tryp.c <<EOCP
16796 #include <stdio.h>
16797 int
16798 main(int argc, char **argv)
16799 {
16800     char buf[1024];
16801     int i;
16802     char *bp = buf;
16803     while (1) {
16804         while ((i = getc(stdin)) != -1
16805                && (*bp++ = i) != '\n'
16806                && bp < &buf[1024])
16807         /* DO NOTHING */ ;
16808         *bp = '\0';
16809         fprintf(stdout, "%s", buf);
16810         fflush(stdin);
16811         if (i == -1)
16812             return 0;
16813         bp = buf;
16814     }
16815 }
16816 EOCP
16817         set tryp
16818         if eval $compile; then
16819             $rm -f tryp.out
16820             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
16821             if cmp tryp.c tryp.out >/dev/null 2>&1; then
16822                $cat >&4 <<EOM
16823 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
16824 EOM
16825                 : now check for fflushall behaviour
16826                 case "$fflushall" in
16827                 '')     set try -DTRY_FFLUSH_ALL $output
16828                         if eval $compile; then
16829                                 $cat >&4 <<EOM
16830 (Now testing the other method--but note that this also may fail.)
16831 EOM
16832                                 $run ./try 2>/dev/null
16833                                 code=$?
16834                                 $from try.out
16835                                 if $test -s try.out -a "X$code" = X42; then
16836                                         fflushall="`$cat try.out`"
16837                                 fi
16838                         fi
16839                         $rm -f core try.core core.try.*
16840                         case "$fflushall" in
16841                         x)      $cat >&4 <<EOM
16842 Whew. Flushing explicitly all the stdio streams works.
16843 EOM
16844                                 fflushall="$define"
16845                                 ;;
16846                         '')     $cat >&4 <<EOM
16847 Sigh. Flushing explicitly all the stdio streams doesn't work.
16848 EOM
16849                                 fflushall="$undef"
16850                                 ;;
16851                         *)      $cat >&4 <<EOM
16852 Cannot figure out whether flushing stdio streams explicitly works or not.
16853 I'm assuming it doesn't.
16854 EOM
16855                                 fflushall="$undef"
16856                                 ;;
16857                         esac
16858                         ;;
16859                 "$define"|true|[yY]*)
16860                         fflushall="$define"
16861                         ;;
16862                 *)
16863                         fflushall="$undef"
16864                         ;;
16865                 esac
16866             else
16867                 $cat >&4 <<EOM
16868 All is futile.  Even fflush(stdin) clobbers input pipes!
16869 EOM
16870                 fflushall="$undef"
16871             fi
16872         else
16873             fflushall="$undef"
16874         fi
16875         $rm -f core tryp.c tryp.core core.tryp.*
16876         ;;
16877 *)      fflushall="$undef"
16878         ;;
16879 esac
16880
16881 case "$fflushNULL$fflushall" in
16882 undefundef)
16883         $cat <<EOM
16884 OK, I give up.  I cannot figure out how to flush pending stdio output.
16885 We won't be flushing handles at all before fork/exec/popen.
16886 EOM
16887         ;;
16888 esac
16889 $rm -f try.* try$exe_ext
16890
16891 : Store the full pathname to the ar program for use in the C program
16892 : Respect a hint or command line value for full_ar.
16893 case "$full_ar" in
16894 '') full_ar=$ar ;;
16895 esac
16896
16897 : Store the full pathname to the sed program for use in the C program
16898 full_sed=$sed
16899
16900 : see what type gids are declared as in the kernel
16901 echo " "
16902 echo "Looking for the type for group ids returned by getgid()."
16903 set gid_t gidtype xxx stdio.h sys/types.h
16904 eval $typedef
16905 case "$gidtype" in
16906 xxx)
16907         xxx=`./findhdr sys/user.h`
16908         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
16909         case $1 in
16910         unsigned) dflt="$1 $2" ;;
16911         *) dflt="$1" ;;
16912         esac
16913         ;;
16914 *) dflt="$gidtype";;
16915 esac
16916 case "$gidtype" in
16917 gid_t) echo "gid_t found." ;;
16918 *)      rp="What is the type for group ids returned by getgid()?"
16919         . ./myread
16920         gidtype="$ans"
16921         ;;
16922 esac
16923
16924 echo " "
16925 case "$gidtype" in
16926 *_t) zzz="$gidtype"     ;;
16927 *)   zzz="gid"          ;;
16928 esac
16929 echo "Checking the size of $zzz..." >&4 
16930 cat > try.c <<EOCP
16931 #include <sys/types.h>
16932 #include <stdio.h>
16933 int main() {
16934     printf("%d\n", (int)sizeof($gidtype));
16935     exit(0);
16936 }
16937 EOCP
16938 set try
16939 if eval $compile_ok; then
16940         yyy=`$run ./try`
16941         case "$yyy" in
16942         '')     gidsize=4
16943                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
16944                 ;;
16945         *)      gidsize=$yyy
16946                 echo "Your $zzz is $gidsize bytes long."
16947                 ;;
16948         esac
16949 else
16950         gidsize=4
16951         echo "(I can't compile the test program--guessing $gidsize.)" >&4
16952 fi
16953
16954
16955 echo " "
16956 case "$gidtype" in
16957 *_t) zzz="$gidtype"     ;;
16958 *)   zzz="gid"          ;;
16959 esac
16960 echo "Checking the sign of $zzz..." >&4 
16961 cat > try.c <<EOCP
16962 #include <sys/types.h>
16963 #include <stdio.h>
16964 int main() {
16965         $gidtype foo = -1;
16966         if (foo < 0)
16967                 printf("-1\n");
16968         else
16969                 printf("1\n");
16970 }
16971 EOCP
16972 set try
16973 if eval $compile; then
16974         yyy=`$run ./try`
16975         case "$yyy" in
16976         '')     gidsign=1
16977                 echo "(I can't execute the test program--guessing unsigned.)" >&4
16978                 ;;
16979         *)      gidsign=$yyy
16980                 case "$gidsign" in
16981                  1) echo "Your $zzz is unsigned." ;;
16982                 -1) echo "Your $zzz is signed."   ;;
16983                 esac
16984                 ;;
16985         esac
16986 else
16987         gidsign=1
16988         echo "(I can't compile the test program--guessing unsigned.)" >&4
16989 fi
16990
16991
16992 echo " "
16993
16994 if $test X"$quadtype" != X; then
16995
16996 echo "Checking how to print 64-bit integers..." >&4
16997
16998 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
16999         $cat >try.c <<'EOCP'
17000 #include <sys/types.h>
17001 #include <stdio.h>
17002 int main() {
17003   int q = 12345678901;
17004   printf("%ld\n", q);
17005 }
17006 EOCP
17007         set try
17008         if eval $compile; then
17009                 yyy=`$run ./try`
17010                 case "$yyy" in
17011                 12345678901)
17012                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17013                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17014                         echo "We will use %d."
17015                         ;;
17016                 esac
17017         fi
17018 fi
17019
17020 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17021         $cat >try.c <<'EOCP'
17022 #include <sys/types.h>
17023 #include <stdio.h>
17024 int main() {
17025   long q = 12345678901;
17026   printf("%ld\n", q);
17027 }
17028 EOCP
17029         set try
17030         if eval $compile; then
17031                 yyy=`$run ./try`
17032                 case "$yyy" in
17033                 12345678901)
17034                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17035                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17036                         echo "We will use %ld."
17037                         ;;
17038                 esac
17039         fi
17040 fi
17041
17042 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17043         $cat >try.c <<'EOCP'
17044 #include <sys/types.h>
17045 #include <inttypes.h>
17046 #include <stdio.h>
17047 int main() {
17048   int64_t q = 12345678901;
17049   printf("%" PRId64 "\n", q);
17050 }
17051 EOCP
17052         set try
17053         if eval $compile; then
17054                 yyy=`$run ./try`
17055                 case "$yyy" in
17056                 12345678901)
17057                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17058                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17059                         echo "We will use the C9X style."
17060                         ;;
17061                 esac
17062         fi
17063 fi
17064
17065 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17066         $cat >try.c <<EOCP
17067 #include <sys/types.h>
17068 #include <stdio.h>
17069 int main() {
17070   $quadtype q = 12345678901;
17071   printf("%Ld\n", q);
17072 }
17073 EOCP
17074         set try
17075         if eval $compile; then
17076                 yyy=`$run ./try`
17077                 case "$yyy" in
17078                 12345678901)
17079                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17080                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17081                         echo "We will use %Ld."
17082                         ;;
17083                 esac
17084         fi
17085 fi
17086
17087 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17088         $cat >try.c <<'EOCP'
17089 #include <sys/types.h>
17090 #include <stdio.h>
17091 int main() {
17092   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17093   printf("%lld\n", q);
17094 }
17095 EOCP
17096         set try
17097         if eval $compile; then
17098                 yyy=`$run ./try`
17099                 case "$yyy" in
17100                 12345678901)
17101                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17102                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17103                         echo "We will use the %lld style."
17104                         ;;
17105                 esac
17106         fi
17107 fi
17108
17109 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17110         $cat >try.c <<EOCP
17111 #include <sys/types.h>
17112 #include <stdio.h>
17113 int main() {
17114   $quadtype q = 12345678901;
17115   printf("%qd\n", q);
17116 }
17117 EOCP
17118         set try
17119         if eval $compile; then
17120                 yyy=`$run ./try`
17121                 case "$yyy" in
17122                 12345678901)
17123                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17124                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17125                         echo "We will use %qd."
17126                         ;;
17127                 esac
17128         fi
17129 fi
17130
17131 if $test X"$sPRId64" = X; then
17132         echo "Cannot figure out how to print 64-bit integers." >&4
17133 fi
17134
17135 $rm -f try try.*
17136
17137 fi
17138
17139 case "$sPRId64" in
17140 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17141         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17142         ;;
17143 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17144         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17145         ;;
17146 esac
17147
17148
17149 echo " "
17150 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17151
17152 if $test X"$ivsize" = X8; then
17153         ivdformat="$sPRId64"
17154         uvuformat="$sPRIu64"
17155         uvoformat="$sPRIo64"
17156         uvxformat="$sPRIx64"
17157         uvXUformat="$sPRIXU64"
17158 else
17159         if $test X"$ivsize" = X"$longsize"; then
17160                 ivdformat='"ld"'
17161                 uvuformat='"lu"'
17162                 uvoformat='"lo"'
17163                 uvxformat='"lx"'
17164                 uvXUformat='"lX"'
17165         else
17166                 if $test X"$ivsize" = X"$intsize"; then
17167                         ivdformat='"d"'
17168                         uvuformat='"u"'
17169                         uvoformat='"o"'
17170                         uvxformat='"x"'
17171                         uvXUformat='"X"'
17172                 else
17173                         : far out
17174                         if $test X"$ivsize" = X"$shortsize"; then
17175                                 ivdformat='"hd"'
17176                                 uvuformat='"hu"'
17177                                 uvoformat='"ho"'
17178                                 uvxformat='"hx"'
17179                                 uvXUformat='"hX"'
17180                         fi
17181                 fi
17182         fi
17183 fi
17184
17185 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17186         nveformat="$sPRIeldbl"
17187         nvfformat="$sPRIfldbl"
17188         nvgformat="$sPRIgldbl"
17189         nvEUformat="$sPRIEUldbl"
17190         nvFUformat="$sPRIFUldbl"
17191         nvGUformat="$sPRIGUldbl"
17192 else
17193         nveformat='"e"'
17194         nvfformat='"f"'
17195         nvgformat='"g"'
17196         nvEUformat='"E"'
17197         nvFUformat='"F"'
17198         nvGUformat='"G"'
17199 fi
17200
17201 case "$ivdformat" in
17202 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17203     exit 1
17204     ;;
17205 esac
17206
17207
17208 echo " "
17209 $echo "Checking the format string to be used for gids..." >&4
17210
17211 case "$gidsign" in
17212 -1)     if $test X"$gidsize" = X"$ivsize"; then
17213                 gidformat="$ivdformat"
17214         else
17215                 if $test X"$gidsize" = X"$longsize"; then
17216                         gidformat='"ld"'
17217                 else
17218                         if $test X"$gidsize" = X"$intsize"; then
17219                                 gidformat='"d"'
17220                         else
17221                                 if $test X"$gidsize" = X"$shortsize"; then
17222                                         gidformat='"hd"'
17223                                 fi
17224                         fi
17225                 fi
17226         fi
17227         ;;
17228 *)      if $test X"$gidsize" = X"$uvsize"; then
17229                 gidformat="$uvuformat"
17230         else
17231                 if $test X"$gidsize" = X"$longsize"; then
17232                         gidformat='"lu"'
17233                 else
17234                         if $test X"$gidsize" = X"$intsize"; then
17235                                 gidformat='"u"'
17236                         else
17237                                 if $test X"$gidsize" = X"$shortsize"; then
17238                                         gidformat='"hu"'
17239                                 fi
17240                         fi
17241                 fi
17242         fi
17243         ;;
17244 esac
17245
17246 : see if getgroups exists
17247 set getgroups d_getgrps
17248 eval $inlibc
17249
17250 : see if setgroups exists
17251 set setgroups d_setgrps
17252 eval $inlibc
17253
17254
17255 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17256 echo " "
17257 case "$d_getgrps$d_setgrps" in
17258 *define*)
17259         case "$groupstype" in
17260         '') dflt="$gidtype" ;;
17261         *)  dflt="$groupstype" ;;
17262         esac
17263         $cat <<EOM
17264 What type of pointer is the second argument to getgroups() and setgroups()?
17265 Usually this is the same as group ids, $gidtype, but not always.
17266
17267 EOM
17268         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17269         . ./myread
17270         groupstype="$ans"
17271         ;;
17272 *)  groupstype="$gidtype";;
17273 esac
17274
17275 echo " "
17276 echo "Checking if your $make program sets \$(MAKE)..." >&4
17277 case "$make_set_make" in
17278 '')
17279         $sed 's/^X //' > testmake.mak << 'EOF'
17280 Xall:
17281 X       @echo 'maketemp="$(MAKE)"'
17282 EOF
17283         case "`$make -f testmake.mak 2>/dev/null`" in
17284         *maketemp=*) make_set_make='#' ;;
17285         *)      make_set_make="MAKE=$make" ;;
17286         esac
17287         $rm -f testmake.mak
17288         ;;
17289 esac
17290 case "$make_set_make" in
17291 '#') echo "Yup, it does.";;
17292 *) echo "Nope, it doesn't.";;
17293 esac
17294
17295 : see what type is used for mode_t
17296 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17297 set mode_t modetype int stdio.h sys/types.h
17298 eval $typedef_ask
17299
17300 : see if stdarg is available
17301 echo " "
17302 if $test `./findhdr stdarg.h`; then
17303         echo "<stdarg.h> found." >&4
17304         valstd="$define"
17305 else
17306         echo "<stdarg.h> NOT found." >&4
17307         valstd="$undef"
17308 fi
17309
17310 : see if varags is available
17311 echo " "
17312 if $test `./findhdr varargs.h`; then
17313         echo "<varargs.h> found." >&4
17314 else
17315         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17316 fi
17317
17318 : set up the varargs testing programs
17319 $cat > varargs.c <<EOP
17320 #ifdef I_STDARG
17321 #include <stdarg.h>
17322 #endif
17323 #ifdef I_VARARGS
17324 #include <varargs.h>
17325 #endif
17326
17327 #ifdef I_STDARG
17328 int f(char *p, ...)
17329 #else
17330 int f(va_alist)
17331 va_dcl
17332 #endif
17333 {
17334         va_list ap;
17335 #ifndef I_STDARG
17336         char *p;
17337 #endif
17338 #ifdef I_STDARG
17339         va_start(ap,p);
17340 #else
17341         va_start(ap);
17342         p = va_arg(ap, char *);
17343 #endif
17344         va_end(ap);
17345 }
17346 EOP
17347 $cat > varargs <<EOP
17348 $startsh
17349 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17350         echo "true"
17351 else
17352         echo "false"
17353 fi
17354 $rm -f varargs$_o
17355 EOP
17356 chmod +x varargs
17357
17358 : now check which varargs header should be included
17359 echo " "
17360 i_varhdr=''
17361 case "$valstd" in
17362 "$define")
17363         if `./varargs I_STDARG`; then
17364                 val='stdarg.h'
17365         elif `./varargs I_VARARGS`; then
17366                 val='varargs.h'
17367         fi
17368         ;;
17369 *)
17370         if `./varargs I_VARARGS`; then
17371                 val='varargs.h'
17372         fi
17373         ;;
17374 esac
17375 case "$val" in
17376 '')
17377 echo "I could not find the definition for va_dcl... You have problems..." >&4
17378         val="$undef"; set i_stdarg; eval $setvar
17379         val="$undef"; set i_varargs; eval $setvar
17380         ;;
17381 *) 
17382         set i_varhdr
17383         eval $setvar
17384         case "$i_varhdr" in
17385         stdarg.h)
17386                 val="$define"; set i_stdarg; eval $setvar
17387                 val="$undef"; set i_varargs; eval $setvar
17388                 ;;
17389         varargs.h)
17390                 val="$undef"; set i_stdarg; eval $setvar
17391                 val="$define"; set i_varargs; eval $setvar
17392                 ;;
17393         esac
17394         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17395 esac
17396 $rm -f varargs*
17397
17398 : see if we need va_copy
17399 echo " "
17400 case "$i_stdarg" in
17401 "$define")
17402         $cat >try.c <<EOCP
17403 #include <stdarg.h>
17404 #include <stdio.h>
17405 #$i_stdlib I_STDLIB
17406 #ifdef I_STDLIB
17407 #include <stdlib.h>
17408 #endif
17409 #include <signal.h>
17410
17411 int
17412 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17413 {
17414   return vfprintf(f, fmt, *valp);
17415 }
17416  
17417 int    
17418 myvfprintf(FILE *f, const  char *fmt, va_list val)
17419 {
17420   return ivfprintf(f, fmt, &val);
17421 }
17422       
17423 int
17424 myprintf(char *fmt, ...) 
17425 {
17426   va_list val;
17427   va_start(val, fmt);
17428   return myvfprintf(stdout, fmt, val); 
17429 }         
17430
17431 int
17432 main(int ac, char **av)
17433 {
17434   signal(SIGSEGV, exit);
17435
17436   myprintf("%s%cs all right, then\n", "that", '\'');                            
17437   exit(0);      
17438 }
17439 EOCP
17440         set try
17441         if eval $compile && $run ./try 2>&1 >/dev/null; then
17442                 case "`$run ./try`" in
17443                 "that's all right, then")
17444                         okay=yes
17445                         ;;
17446                 esac
17447         fi
17448         case "$okay" in
17449         yes)    echo "It seems that you don't need va_copy()." >&4
17450                 need_va_copy="$undef"
17451                 ;;
17452         *)      echo "It seems that va_copy() or similar will be needed." >&4
17453                 need_va_copy="$define"
17454                 ;;
17455         esac
17456         $rm -f try.* core core.* *.core *.core.*
17457         ;;
17458 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17459         ;;
17460 esac
17461
17462 : see what type is used for size_t
17463 rp="What is the type used for the length parameter for string functions?"
17464 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17465 eval $typedef_ask
17466
17467 : check for type of arguments to gethostbyaddr. 
17468 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17469         case "$d_gethbyaddr" in
17470         $define)
17471                 $cat <<EOM
17472
17473 Checking to see what type of arguments are accepted by gethostbyaddr().
17474 EOM
17475                 hdrs="$define sys/types.h
17476                         $d_socket sys/socket.h 
17477                         $i_niin netinet/in.h 
17478                         $i_netdb netdb.h
17479                         $i_unistd unistd.h"
17480                 : The first arg can 'char *' or 'void *'
17481                 : The second arg is some of integral type
17482                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17483                         for yyy in size_t long int; do
17484                                 case "$netdb_host_type" in
17485                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17486                                         if ./protochk "$try" $hdrs; then
17487                                                 echo "Your system accepts $xxx for the first arg."
17488                                                 echo "...and $yyy for the second arg."
17489                                                 netdb_host_type="$xxx"
17490                                                 netdb_hlen_type="$yyy"
17491                                         fi
17492                                         ;;
17493                                 esac
17494                         done
17495                 done
17496                 : In case none of those worked, prompt the user.
17497                 case "$netdb_host_type" in
17498                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17499                         dflt='char *'
17500                         . ./myread
17501                         netdb_host_type=$ans
17502                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17503                         dflt="$sizetype"
17504                         . ./myread
17505                         netdb_hlen_type=$ans
17506                         ;;
17507                 esac
17508                 ;;
17509         *)      : no gethostbyaddr, so pick harmless defaults
17510                 netdb_host_type='char *'
17511                 netdb_hlen_type="$sizetype"
17512                 ;;
17513         esac
17514         # Remove the "const" if needed. -- but then we'll have a 
17515         # prototype clash!
17516         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17517 fi
17518
17519 : check for type of argument to gethostbyname. 
17520 if test "X$netdb_name_type" = X ; then
17521         case "$d_gethbyname" in
17522         $define)
17523                 $cat <<EOM
17524
17525 Checking to see what type of argument is accepted by gethostbyname().
17526 EOM
17527                 hdrs="$define sys/types.h
17528                         $d_socket sys/socket.h 
17529                         $i_niin netinet/in.h 
17530                         $i_netdb netdb.h
17531                         $i_unistd unistd.h"
17532                 for xxx in "const char *" "char *"; do
17533                         case "$netdb_name_type" in
17534                         '')     try="extern struct hostent *gethostbyname($xxx);"
17535                                 if ./protochk "$try" $hdrs; then
17536                                         echo "Your system accepts $xxx."
17537                                         netdb_name_type="$xxx"
17538                                 fi
17539                                 ;;
17540                         esac
17541                 done
17542                 : In case none of those worked, prompt the user.
17543                 case "$netdb_name_type" in
17544                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17545                         dflt='char *'
17546                         . ./myread
17547                         netdb_name_type=$ans
17548                         ;;
17549                 esac
17550                 ;;
17551         *)      : no gethostbyname, so pick harmless default
17552                 netdb_name_type='char *'
17553                 ;;
17554         esac
17555 fi
17556
17557 : check for type of 1st argument to getnetbyaddr. 
17558 if test "X$netdb_net_type" = X ; then
17559         case "$d_getnbyaddr" in
17560         $define)
17561                 $cat <<EOM
17562
17563 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17564 EOM
17565                 hdrs="$define sys/types.h
17566                         $d_socket sys/socket.h 
17567                         $i_niin netinet/in.h 
17568                         $i_netdb netdb.h
17569                         $i_unistd unistd.h"
17570                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17571                         case "$netdb_net_type" in
17572                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17573                                 if ./protochk "$try" $hdrs; then
17574                                         echo "Your system accepts $xxx."
17575                                         netdb_net_type="$xxx"
17576                                 fi
17577                                 ;;
17578                         esac
17579                 done
17580                 : In case none of those worked, prompt the user.
17581                 case "$netdb_net_type" in
17582                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17583                         dflt='long'
17584                         . ./myread
17585                         netdb_net_type=$ans
17586                         ;;
17587                 esac
17588                 ;;
17589         *)      : no getnetbyaddr, so pick harmless default
17590                 netdb_net_type='long'
17591                 ;;
17592         esac
17593 fi
17594 : locate the preferred pager for this system
17595 case "$pager" in
17596 '')
17597         dflt=''
17598         case "$pg" in
17599         /*) dflt=$pg;;
17600         [a-zA-Z]:/*) dflt=$pg;;
17601         esac
17602         case "$more" in
17603         /*) dflt=$more;;
17604         [a-zA-Z]:/*) dflt=$more;;
17605         esac
17606         case "$less" in
17607         /*) dflt=$less;;
17608         [a-zA-Z]:/*) dflt=$less;;
17609         esac
17610         case "$dflt" in
17611         '') dflt=/usr/ucb/more;;
17612         esac
17613         ;;
17614 *) dflt="$pager";;
17615 esac
17616 echo " "
17617 fn=f/
17618 rp='What pager is used on your system?'
17619 . ./getfile
17620 pager="$ans"
17621
17622 : see what type pids are declared as in the kernel
17623 rp="What is the type of process ids on this system?"
17624 set pid_t pidtype int stdio.h sys/types.h
17625 eval $typedef_ask
17626
17627 : Find earliest binary compatible site_perl subdirectory perl can use.
17628 case "$bincompat5005" in
17629 "$define") xs_apiversion='5.005' ;;
17630 *) xs_apiversion=$version ;;   # The current site_perl version.
17631 esac
17632 : Find earliest pure perl site_perl subdirectory perl can use.
17633 : The versioned directories started at 5.005.
17634 pm_apiversion='5.005'
17635
17636 : see if ar generates random libraries by itself
17637 echo " "
17638 echo "Checking how to generate random libraries on your machine..." >&4
17639 echo 'int bar1() { return bar2(); }' > bar1.c
17640 echo 'int bar2() { return 2; }' > bar2.c
17641 $cat > foo.c <<'EOP'
17642 int main() { printf("%d\n", bar1()); exit(0); }
17643 EOP
17644 $cc $ccflags -c bar1.c >/dev/null 2>&1
17645 $cc $ccflags -c bar2.c >/dev/null 2>&1
17646 $cc $ccflags -c foo.c >/dev/null 2>&1
17647 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17648 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17649         $run ./foobar >/dev/null 2>&1; then
17650         echo "$ar appears to generate random libraries itself."
17651         orderlib=false
17652         ranlib=":"
17653 elif $ar ts bar$_a >/dev/null 2>&1 &&
17654         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17655         $run ./foobar >/dev/null 2>&1; then
17656                 echo "a table of contents needs to be added with '$ar ts'."
17657                 orderlib=false
17658                 ranlib="$ar ts"
17659 else
17660         case "$ranlib" in
17661         :) ranlib='';;
17662         '')
17663                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17664                 $test -f $ranlib || ranlib=''
17665                 ;;
17666         esac
17667         if $test -n "$ranlib"; then
17668                 echo "your system has '$ranlib'; we'll use that."
17669                 orderlib=false
17670         else
17671                 echo "your system doesn't seem to support random libraries"
17672                 echo "so we'll use lorder and tsort to order the libraries."
17673                 orderlib=true
17674                 ranlib=":"
17675         fi
17676 fi
17677 $rm -f foo* bar* 
17678
17679 : check for type of arguments to select. 
17680 case "$selecttype" in
17681 '') case "$d_select" in
17682         $define)
17683                 echo " "
17684                 $cat <<EOM
17685 Checking to see what type of arguments are accepted by select().
17686 EOM
17687                 hdrs="$define sys/types.h
17688                         $i_systime sys/time.h 
17689                         $i_sysselct sys/select.h
17690                         $d_socket sys/socket.h"
17691                 : The first arg can be int, unsigned, or size_t
17692                 : The last arg may or may not be 'const'
17693                 val=''
17694                 : void pointer has been seen but using that
17695                 : breaks the selectminbits test
17696                 for xxx in 'fd_set *' 'int *'; do
17697                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17698                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17699                                         case "$val" in
17700                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17701                                                 if ./protochk "$try" $hdrs; then
17702                                                         echo "Your system accepts $xxx."
17703                                                         val="$xxx"
17704                                                 fi
17705                                                 ;;
17706                                         esac
17707                                 done
17708                         done
17709                 done
17710                 case "$val" in
17711                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17712                         case "$d_fd_set" in
17713                                 $define) dflt="fd_set *" ;;
17714                                 *)              dflt="int *" ;;
17715                         esac
17716                         . ./myread
17717                         val=$ans
17718                         ;;
17719                 esac
17720                 selecttype="$val"
17721                 ;;
17722         *)      : no select, so pick a harmless default
17723                 selecttype='int *'
17724                 ;;
17725         esac
17726         ;;
17727 esac
17728
17729 : check for the select 'width'
17730 case "$selectminbits" in
17731 '') case "$d_select" in
17732         $define)
17733                 $cat <<EOM
17734
17735 Checking to see on how many bits at a time your select() operates...
17736 EOM
17737                 $cat >try.c <<EOCP
17738 #include <sys/types.h>
17739 #$i_time I_TIME
17740 #$i_systime I_SYS_TIME
17741 #$i_systimek I_SYS_TIME_KERNEL
17742 #ifdef I_TIME
17743 #   include <time.h>
17744 #endif
17745 #ifdef I_SYS_TIME
17746 #   ifdef I_SYS_TIME_KERNEL
17747 #       define KERNEL
17748 #   endif
17749 #   include <sys/time.h>
17750 #   ifdef I_SYS_TIME_KERNEL
17751 #       undef KERNEL
17752 #   endif
17753 #endif
17754 #$i_sysselct I_SYS_SELECT
17755 #ifdef I_SYS_SELECT
17756 #include <sys/select.h>
17757 #endif
17758 #$d_socket HAS_SOCKET
17759 #ifdef HAS_SOCKET
17760 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
17761 #endif
17762 #include <stdio.h>
17763 $selecttype b;
17764 #define S sizeof(*(b))
17765 #define MINBITS 64
17766 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
17767 #define NBITS  (NBYTES * 8)
17768 int main() {
17769     char s[NBYTES];
17770     struct timeval t;
17771     int i;
17772     FILE* fp;
17773     int fd;
17774
17775     fclose(stdin);
17776     fp = fopen("try.c", "r");
17777     if (fp == 0)
17778       exit(1);
17779     fd = fileno(fp);
17780     if (fd < 0)
17781       exit(2);
17782     b = ($selecttype)s;
17783     for (i = 0; i < NBITS; i++)
17784         FD_SET(i, b);
17785     t.tv_sec  = 0;
17786     t.tv_usec = 0;
17787     select(fd + 1, b, 0, 0, &t);
17788     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
17789     printf("%d\n", i + 1);
17790     return 0;
17791 }
17792 EOCP
17793                 set try
17794                 if eval $compile_ok; then
17795                         selectminbits=`$run ./try`
17796                         case "$selectminbits" in
17797                         '')     cat >&4 <<EOM
17798 Cannot figure out on how many bits at a time your select() operates.
17799 I'll play safe and guess it is 32 bits.
17800 EOM
17801                                 selectminbits=32
17802                                 bits="32 bits"
17803                                 ;;
17804                         1)      bits="1 bit" ;;
17805                         *)      bits="$selectminbits bits" ;;
17806                         esac
17807                         echo "Your select() operates on $bits at a time." >&4
17808                 else
17809                         rp='What is the minimum number of bits your select() operates on?'
17810                         case "$byteorder" in
17811                         1234|12345678)  dflt=32 ;;
17812                         *)              dflt=1  ;;
17813                         esac
17814                         . ./myread
17815                         val=$ans
17816                         selectminbits="$val"
17817                 fi
17818                 $rm -f try.* try
17819                 ;;
17820         *)      : no select, so pick a harmless default
17821                 selectminbits='32'
17822                 ;;
17823         esac
17824         ;;
17825 esac
17826
17827 : Trace out the files included by signal.h, then look for SIGxxx names.
17828 : Remove SIGARRAYSIZE used by HPUX.
17829 : Remove SIGSTKSIZE used by Linux.
17830 : Remove SIGSTKSZ used by Posix.
17831 : Remove SIGTYP void lines used by OS2.
17832 : Some cpps, like os390, dont give the file name anywhere
17833 if [ "X$fieldn" = X ]; then
17834         : Just make some guesses.  We check them later.
17835         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
17836 else
17837         xxx=`echo '#include <signal.h>' |
17838         $cppstdin $cppminus $cppflags 2>/dev/null |
17839         $grep '^[       ]*#.*include' | 
17840         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
17841 fi
17842 : Check this list of files to be sure we have parsed the cpp output ok.
17843 : This will also avoid potentially non-existent files, such 
17844 : as ../foo/bar.h
17845 xxxfiles=''
17846 for xx in $xxx /dev/null ; do
17847         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
17848 done
17849 : If we have found no files, at least try signal.h
17850 case "$xxxfiles" in
17851 '')     xxxfiles=`./findhdr signal.h` ;;
17852 esac
17853 xxx=`awk '
17854 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
17855         print substr($2, 4, 20)
17856 }
17857 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
17858         print substr($3, 4, 20)
17859 }' $xxxfiles`
17860 : Append some common names just in case the awk scan failed.
17861 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
17862 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
17863 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
17864 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
17865 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
17866
17867 : generate a few handy files for later
17868 $cat > signal.c <<'EOCP'
17869 #include <sys/types.h>
17870 #include <signal.h>
17871 #include <stdio.h>
17872 int main() {
17873
17874 /* Strange style to avoid deeply-nested #if/#else/#endif */
17875 #ifndef NSIG
17876 #  ifdef _NSIG
17877 #    define NSIG (_NSIG)
17878 #  endif
17879 #endif
17880
17881 #ifndef NSIG
17882 #  ifdef SIGMAX
17883 #    define NSIG (SIGMAX+1)
17884 #  endif
17885 #endif
17886
17887 #ifndef NSIG
17888 #  ifdef SIG_MAX
17889 #    define NSIG (SIG_MAX+1)
17890 #  endif
17891 #endif
17892
17893 #ifndef NSIG
17894 #  ifdef MAXSIG
17895 #    define NSIG (MAXSIG+1)
17896 #  endif
17897 #endif
17898
17899 #ifndef NSIG
17900 #  ifdef MAX_SIG
17901 #    define NSIG (MAX_SIG+1)
17902 #  endif
17903 #endif
17904
17905 #ifndef NSIG
17906 #  ifdef SIGARRAYSIZE
17907 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
17908 #  endif
17909 #endif
17910
17911 #ifndef NSIG
17912 #  ifdef _sys_nsig
17913 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
17914 #  endif
17915 #endif
17916
17917 /* Default to some arbitrary number that's big enough to get most
17918    of the common signals.
17919 */
17920 #ifndef NSIG
17921 #    define NSIG 50
17922 #endif
17923
17924 printf("NSIG %d\n", NSIG);
17925
17926 #ifndef JUST_NSIG
17927
17928 EOCP
17929
17930 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
17931 {
17932         printf "#ifdef SIG"; printf $1; printf "\n"
17933         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
17934         printf $1; printf ");\n"
17935         printf "#endif\n"
17936 }
17937 END {
17938         printf "#endif /* JUST_NSIG */\n";
17939         printf "exit(0);\n}\n";
17940 }
17941 ' >>signal.c
17942 $cat >signal.awk <<'EOP'
17943 BEGIN { ndups = 0 }
17944 $1 ~ /^NSIG$/ { nsig = $2 }
17945 ($1 !~ /^NSIG$/) && (NF == 2) {
17946     if ($2 > maxsig) { maxsig = $2 }
17947     if (sig_name[$2]) {
17948         dup_name[ndups] = $1
17949         dup_num[ndups] = $2
17950         ndups++ 
17951     }
17952     else {
17953         sig_name[$2] = $1
17954         sig_num[$2] = $2
17955     }
17956 }
17957 END { 
17958     if (nsig == 0) {
17959         nsig = maxsig + 1
17960     }
17961     printf("NSIG %d\n", nsig);
17962     for (n = 1; n < nsig; n++) {
17963         if (sig_name[n]) {
17964             printf("%s %d\n", sig_name[n], sig_num[n])
17965         }
17966         else {
17967             printf("NUM%d %d\n", n, n) 
17968         }
17969     }
17970     for (n = 0; n < ndups; n++) {
17971         printf("%s %d\n", dup_name[n], dup_num[n])
17972     }
17973 }
17974 EOP
17975 $cat >signal_cmd <<EOS
17976 $startsh
17977 if $test -s signal.lst; then
17978     echo "Using your existing signal.lst file"
17979         exit 0
17980 fi
17981 xxx="$xxx"
17982 EOS
17983 $cat >>signal_cmd <<'EOS'
17984
17985 set signal
17986 if eval $compile_ok; then
17987         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
17988 else
17989         echo "(I can't seem be able to compile the whole test program)" >&4
17990         echo "(I'll try it in little pieces.)" >&4
17991         set signal -DJUST_NSIG
17992         if eval $compile_ok; then
17993                 $run ./signal$_exe > signal.nsg
17994                 $cat signal.nsg
17995         else
17996                 echo "I can't seem to figure out how many signals you have." >&4
17997                 echo "Guessing 50." >&4
17998                 echo 'NSIG 50' > signal.nsg
17999         fi
18000         : Now look at all the signal names, one at a time.
18001         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18002                 $cat > signal.c <<EOCP
18003 #include <sys/types.h>
18004 #include <signal.h>
18005 #include <stdio.h>
18006 int main() {
18007 printf("$xx %d\n", SIG${xx});
18008 return 0;
18009 }
18010 EOCP
18011                 set signal
18012                 if eval $compile; then
18013                         echo "SIG${xx} found."
18014                         $run ./signal$_exe  >> signal.ls1
18015                 else
18016                         echo "SIG${xx} NOT found."
18017                 fi
18018         done
18019         if $test -s signal.ls1; then
18020                 $cat signal.nsg signal.ls1 |
18021                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18022         fi
18023
18024 fi
18025 if $test -s signal.lst; then
18026         :
18027 else
18028         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18029         echo 'kill -l' >signal
18030         set X `csh -f <signal`
18031         $rm -f signal
18032         shift
18033         case $# in
18034         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18035         esac
18036         echo $@ | $tr ' ' $trnl | \
18037             $awk '{ printf "%s %d\n", $1, ++s; }
18038                   END { printf "NSIG %d\n", ++s }' >signal.lst
18039 fi
18040 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18041 EOS
18042 chmod a+x signal_cmd
18043 $eunicefix signal_cmd
18044
18045 : generate list of signal names
18046 echo " "
18047 case "$sig_name_init" in
18048 '') doinit=yes ;;
18049 *)  case "$sig_num_init" in
18050     ''|*,*) doinit=yes ;;
18051     esac ;;
18052 esac
18053 case "$doinit" in
18054 yes)
18055         echo "Generating a list of signal names and numbers..." >&4
18056         . ./signal_cmd
18057         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18058         sig_name=`$awk 'BEGIN { printf "ZERO " }
18059                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18060         sig_num=`$awk  'BEGIN { printf "0 " }
18061                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18062         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18063                              !/^NSIG/   { printf "\"%s\", ", $1 }
18064                              END        { printf "0\n" }' signal.lst`
18065         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18066                              !/^NSIG/   { printf "%d, ", $2}
18067                              END        { printf "0\n"}' signal.lst`
18068         ;;
18069 esac
18070 echo "The following $sig_count signals are available:"
18071 echo " "
18072 echo $sig_name | $awk \
18073 'BEGIN { linelen = 0 }
18074 {
18075         for (i = 1; i <= NF; i++) {
18076                 name = "SIG" $i " "
18077                 linelen = linelen + length(name)
18078                 if (linelen > 70) {
18079                         printf "\n"
18080                         linelen = length(name)
18081                 }
18082                 printf "%s", name
18083         }
18084         printf "\n"
18085 }'
18086 sig_size=`echo $sig_name | awk '{print NF}'`
18087 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18088
18089 echo " "
18090 case "$sizetype" in
18091 *_t) zzz="$sizetype"    ;;
18092 *)   zzz="filesize"     ;;
18093 esac
18094 echo "Checking the size of $zzz..." >&4 
18095 cat > try.c <<EOCP
18096 #include <sys/types.h>
18097 #include <stdio.h>
18098 int main() {
18099     printf("%d\n", (int)sizeof($sizetype));
18100     exit(0);
18101 }
18102 EOCP
18103 set try
18104 if eval $compile_ok; then
18105         yyy=`$run ./try`
18106         case "$yyy" in
18107         '')     sizesize=4
18108                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18109                 ;;
18110         *)      sizesize=$yyy
18111                 echo "Your $zzz size is $sizesize bytes."
18112                 ;;
18113         esac
18114 else
18115         sizesize=4
18116         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18117 fi
18118
18119
18120 : check for socklen_t
18121 echo " "
18122 echo "Checking to see if you have socklen_t..." >&4
18123 $cat >try.c <<EOCP
18124 #include <sys/types.h>
18125 #$d_socket HAS_SOCKET
18126 #ifdef HAS_SOCKET
18127 #include <sys/socket.h>
18128 #endif
18129 int main() { socklen_t x = 16; }
18130 EOCP
18131 set try
18132 if eval $compile; then
18133         val="$define"
18134         echo "You have socklen_t."
18135 else
18136         val="$undef"
18137         echo "You do not have socklen_t."
18138         case "$sizetype" in
18139         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18140         esac
18141 fi
18142 $rm -f try try.*
18143 set d_socklen_t
18144 eval $setvar
18145
18146 : see if this is a socks.h system
18147 set socks.h i_socks
18148 eval $inhdr
18149
18150 : check for type of the size argument to socket calls
18151 case "$d_socket" in
18152 "$define")
18153         $cat <<EOM
18154
18155 Checking to see what type is the last argument of accept().
18156 EOM
18157         yyy=''
18158         case "$d_socklen_t" in
18159         "$define") yyy="$yyy socklen_t"
18160         esac
18161         yyy="$yyy $sizetype int long unsigned"
18162         for xxx in $yyy; do
18163                 case "$socksizetype" in
18164                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18165                         case "$usesocks" in
18166                         "$define")
18167                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18168                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18169                                         socksizetype="$xxx"
18170                                 fi
18171                                 ;;
18172                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18173                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18174                                         socksizetype="$xxx"
18175                                 fi
18176                                 ;;
18177                         esac
18178                         ;;
18179                 esac
18180         done
18181 : In case none of those worked, prompt the user.
18182         case "$socksizetype" in
18183         '')     rp='What is the type for socket address structure sizes?'
18184                 dflt='int'
18185                 . ./myread
18186                 socksizetype=$ans
18187                 ;;
18188         esac
18189         ;;
18190 *)      : no sockets, so pick relatively harmless default
18191         socksizetype='int'
18192         ;;
18193 esac
18194
18195 : see what type is used for signed size_t
18196 set ssize_t ssizetype int stdio.h sys/types.h
18197 eval $typedef
18198 dflt="$ssizetype"
18199 $cat > try.c <<EOM
18200 #include <stdio.h>
18201 #include <sys/types.h>
18202 #define Size_t $sizetype
18203 #define SSize_t $dflt
18204 int main()
18205 {
18206         if (sizeof(Size_t) == sizeof(SSize_t))
18207                 printf("$dflt\n");
18208         else if (sizeof(Size_t) == sizeof(int))
18209                 printf("int\n");
18210         else 
18211                 printf("long\n");
18212         exit(0);
18213 }
18214 EOM
18215 echo " "
18216 set try
18217 if eval $compile_ok && $run ./try > /dev/null; then
18218         ssizetype=`$run ./try`
18219         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18220 else
18221         $cat >&4 <<EOM
18222 Help! I can't compile and run the ssize_t test program: please enlighten me!
18223 (This is probably a misconfiguration in your system or libraries, and
18224 you really ought to fix it.  Still, I'll try anyway.)
18225
18226 I need a type that is the same size as $sizetype, but is guaranteed to
18227 be signed.  Common values are ssize_t, int and long.
18228
18229 EOM
18230         rp="What signed type is the same size as $sizetype?"
18231         . ./myread
18232         ssizetype="$ans"
18233 fi
18234 $rm -f try try.*
18235
18236 : see what type of char stdio uses.
18237 echo " "
18238 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18239 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18240         echo "Your stdio uses unsigned chars." >&4
18241         stdchar="unsigned char"
18242 else
18243         echo "Your stdio uses signed chars." >&4
18244         stdchar="char"
18245 fi
18246 $rm -f stdioh
18247
18248
18249
18250 : see if time exists
18251 echo " "
18252 if test "X$d_time" = X -o X"$timetype" = X; then
18253     if set time val -f d_time; eval $csym; $val; then
18254                 echo 'time() found.' >&4
18255                 val="$define"
18256                 rp="What is the type returned by time() on this system?"
18257                 set time_t timetype long stdio.h sys/types.h
18258                 eval $typedef_ask
18259     else
18260                 echo 'time() not found, hope that will do.' >&4
18261                 val="$undef"
18262                 timetype='int';
18263     fi
18264     set d_time
18265     eval $setvar
18266 fi
18267
18268 : see what type uids are declared as in the kernel
18269 echo " "
18270 echo "Looking for the type for user ids returned by getuid()."
18271 set uid_t uidtype xxx stdio.h sys/types.h
18272 eval $typedef
18273 case "$uidtype" in
18274 xxx)
18275         xxx=`./findhdr sys/user.h`
18276         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18277         case $1 in
18278         unsigned) dflt="$1 $2" ;;
18279         *) dflt="$1" ;;
18280         esac
18281         ;;
18282 *) dflt="$uidtype";;
18283 esac
18284 case "$uidtype" in
18285 uid_t)  echo "uid_t found." ;;
18286 *)      rp="What is the type for user ids returned by getuid()?"
18287         . ./myread
18288         uidtype="$ans"
18289         ;;
18290 esac
18291
18292 echo " "
18293 case "$uidtype" in
18294 *_t) zzz="$uidtype"     ;;
18295 *)   zzz="uid"          ;;
18296 esac
18297 echo "Checking the size of $zzz..." >&4 
18298 cat > try.c <<EOCP
18299 #include <sys/types.h>
18300 #include <stdio.h>
18301 int main() {
18302     printf("%d\n", (int)sizeof($uidtype));
18303     exit(0);
18304 }
18305 EOCP
18306 set try
18307 if eval $compile_ok; then
18308         yyy=`$run ./try`
18309         case "$yyy" in
18310         '')     uidsize=4
18311                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18312                 ;;
18313         *)      uidsize=$yyy
18314                 echo "Your $zzz is $uidsize bytes long."
18315                 ;;
18316         esac
18317 else
18318         uidsize=4
18319         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18320 fi
18321
18322 echo " "
18323 case "$uidtype" in
18324 *_t) zzz="$uidtype"     ;;
18325 *)   zzz="uid"          ;;
18326 esac
18327 echo "Checking the sign of $zzz..." >&4
18328 cat > try.c <<EOCP
18329 #include <sys/types.h>
18330 #include <stdio.h>
18331 int main() {
18332         $uidtype foo = -1;
18333         if (foo < 0)
18334                 printf("-1\n");
18335         else
18336                 printf("1\n");
18337 }
18338 EOCP
18339 set try
18340 if eval $compile; then
18341         yyy=`$run ./try`
18342         case "$yyy" in
18343         '')     uidsign=1
18344                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18345                 ;;
18346         *)      uidsign=$yyy
18347                 case "$uidsign" in
18348                  1) echo "Your $zzz is unsigned." ;;
18349                 -1) echo "Your $zzz is signed."   ;;
18350                 esac
18351                 ;;
18352         esac
18353 else
18354         uidsign=1
18355         echo "(I can't compile the test program--guessing unsigned.)" >&4
18356 fi
18357
18358
18359
18360 echo " "
18361 $echo "Checking the format string to be used for uids..." >&4
18362
18363 case "$uidsign" in
18364 -1)     if $test X"$uidsize" = X"$ivsize"; then
18365                 uidformat="$ivdformat"
18366         else
18367                 if $test X"$uidsize" = X"$longsize"; then
18368                         uidformat='"ld"'
18369                 else
18370                         if $test X"$uidsize" = X"$intsize"; then
18371                                 uidformat='"d"'
18372                         else
18373                                 if $test X"$uidsize" = X"$shortsize"; then
18374                                         uidformat='"hd"'
18375                                 fi
18376                         fi
18377                 fi
18378         fi
18379         ;;
18380 *)      if $test X"$uidsize" = X"$uvsize"; then
18381                 uidformat="$uvuformat"
18382         else
18383                 if $test X"$uidsize" = X"$longsize"; then
18384                         uidformat='"lu"'
18385                 else
18386                         if $test X"$uidsize" = X"$intsize"; then
18387                                 uidformat='"u"'
18388                         else
18389                                 if $test X"$uidsize" = X"$shortsize"; then
18390                                         uidformat='"hu"'
18391                                 fi
18392                         fi
18393                 fi
18394         fi
18395         ;;
18396 esac
18397
18398 : determine compiler compiler
18399 case "$yacc" in
18400 '')
18401         dflt=yacc;;
18402 *)
18403         dflt="$yacc";;
18404 esac
18405 echo " "
18406 comp='yacc'
18407 if $test -f "$byacc$_exe"; then
18408         dflt="$byacc"
18409         comp="byacc or $comp"
18410 fi
18411 if $test -f "$bison$_exe"; then
18412         comp="$comp or bison -y"
18413 fi
18414 rp="Which compiler compiler ($comp) shall I use?"
18415 . ./myread
18416 yacc="$ans"
18417 case "$yacc" in
18418 *bis*)
18419         case "$yacc" in
18420         *-y*) ;;
18421         *)
18422                 yacc="$yacc -y"
18423                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18424                 ;;
18425         esac
18426         ;;
18427 esac
18428
18429 : see if this is a fp.h system
18430 set fp.h i_fp
18431 eval $inhdr
18432
18433 : see if this is a fp_class.h system
18434 set fp_class.h i_fp_class
18435 eval $inhdr
18436
18437 : see if this is a ieeefp.h system
18438 case "$i_ieeefp" in
18439 '' ) set ieeefp.h i_ieeefp
18440      eval $inhdr
18441      ;;
18442 esac
18443
18444 : see if this is a libutil.h system
18445 set libutil.h i_libutil
18446 eval $inhdr
18447
18448 : see if mach cthreads are available
18449 if test "X$usethreads" = "X$define"; then
18450         set mach/cthreads.h i_machcthr
18451         eval $inhdr
18452 else
18453         i_machcthr="$undef"
18454 fi
18455
18456
18457
18458 : see if this is a math.h system
18459 set math.h i_math
18460 eval $inhdr
18461
18462 : see if this is a mntent.h system
18463 set mntent.h i_mntent
18464 eval $inhdr
18465
18466 : see if ndbm.h is available
18467 set ndbm.h t_ndbm
18468 eval $inhdr
18469
18470 case "$t_ndbm" in
18471 $undef)
18472     # Some Linux distributions such as RedHat 7.1 put the
18473     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18474     if $test -f /usr/include/gdbm/ndbm.h; then
18475         echo '<gdbm/ndbm.h> found.'
18476         ccflags="$ccflags -I/usr/include/gdbm"
18477         cppflags="$cppflags -I/usr/include/gdbm"
18478         t_ndbm=$define
18479     fi
18480     ;;
18481 esac
18482
18483 case "$t_ndbm" in
18484 $define)
18485         : see if dbm_open exists
18486         set dbm_open d_dbm_open
18487         eval $inlibc
18488         case "$d_dbm_open" in
18489         $undef)
18490                 t_ndbm="$undef"
18491                 echo "We won't be including <ndbm.h>"
18492                 ;;
18493         esac
18494         ;;
18495 esac
18496 val="$t_ndbm"
18497 set i_ndbm
18498 eval $setvar
18499
18500 : see if net/errno.h is available
18501 val=''
18502 set net/errno.h val
18503 eval $inhdr
18504
18505 : Unfortunately, it causes problems on some systems.  Arrgh.
18506 case "$val" in
18507 $define)
18508         cat > try.c <<'EOM'
18509 #include <stdio.h>
18510 #include <errno.h>
18511 #include <net/errno.h>
18512 int func()
18513 {
18514         return ENOTSOCK;
18515 }
18516 EOM
18517         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18518                 echo "We'll be including <net/errno.h>." >&4
18519         else
18520                 echo "We won't be including <net/errno.h>." >&4
18521                 val="$undef"
18522         fi
18523         $rm -f try.* try
18524         ;;
18525 esac
18526 set i_neterrno
18527 eval $setvar
18528
18529 : see if netinet/tcp.h is available
18530 set netinet/tcp.h i_netinettcp
18531 eval $inhdr
18532
18533 : see if this is a poll.h system
18534 set poll.h i_poll
18535 eval $inhdr
18536
18537 : see if this is a prot.h system
18538 set prot.h i_prot
18539 eval $inhdr
18540
18541 echo " "
18542 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18543 $cat <<'EOSH' > Cppsym.know
18544 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18545 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18546 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18547 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18548 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18549 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18550 bull c cadmus clipper CMU COFF COMPILER_VERSION
18551 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18552 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18553 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18554 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18555 GLIBC GLIBC_MINOR
18556 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18557 H3050R H3050RX hbullx20 hcx host_mips
18558 hp200 hp300 hp700 HP700 hp800 hp9000
18559 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18560 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18561 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18562 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18563 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18564 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18565 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18566 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18567 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18568 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18569 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18570 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18571 MATH_HAS_NO_SIDE_EFFECTS
18572 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18573 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18574 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18575 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18576 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18577 NetBSD news1500 news1700 news1800 news1900 news3700
18578 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18579 ns32016 ns32332 ns32k nsc32000
18580 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18581 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18582 pc532 pdp11 PGC PIC plexus PORTAR posix
18583 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18584 POSIX_C_SOURCE POSIX_SOURCE POWER
18585 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18586 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18587 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18588 sony sony_news sonyrisc sparc sparclite spectrum
18589 stardent stdc STDC_EXT stratos sun sun3 sun386
18590 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18591 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18592 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18593 sysV68 sysV88 Tek4132 Tek4300 titan
18594 TM3200 TM5400 TM5600
18595 tower tower32 tower32_200 tower32_600 tower32_700
18596 tower32_800 tower32_850 tss
18597 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18598 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18599 unix UNIX95 UNIX99 unixpc unos
18600 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18601 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18602 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18603 USGr4 USGr4_2
18604 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18605 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18606 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18607 z8000
18608 EOSH
18609 # Maybe put other stuff here too.
18610 cat <<EOSH >>Cppsym.know
18611 $osname
18612 EOSH
18613 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18614 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18615 $cat Cppsym.know > Cppsym.c
18616 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18617 $rm -f Cppsym.a Cppsym.b Cppsym.c
18618 cat <<EOSH > Cppsym
18619 $startsh
18620 if $test \$# -gt 0; then
18621     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18622     if $test -s Cppsym.got; then
18623         $rm -f Cppsym.got
18624         exit 0
18625     fi
18626     $rm -f Cppsym.got
18627     exit 1
18628 else
18629     $tr " " "$trnl" | ./Cppsym.try
18630     exit 0
18631 fi
18632 EOSH
18633 chmod +x Cppsym
18634 $eunicefix Cppsym
18635 cat <<EOSH > Cppsym.try
18636 $startsh
18637 cat <<'EOCP' > try.c
18638 #include <stdio.h>
18639 int main() {
18640 EOCP
18641 $awk \\
18642 EOSH
18643 cat <<'EOSH' >> Cppsym.try
18644 'length($1) > 0 {
18645     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18646     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18647     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18648     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
18649 }'       >> try.c
18650 echo 'return 0;}' >> try.c
18651 EOSH
18652 cat <<EOSH >> Cppsym.try
18653 ccflags="$ccflags"
18654 case "$osname-$gccversion" in
18655 irix-) ccflags="\$ccflags -woff 1178" ;;
18656 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18657 esac
18658 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18659 EOSH
18660 chmod +x Cppsym.try
18661 $eunicefix Cppsym.try
18662 ./Cppsym < Cppsym.know > Cppsym.true
18663 : now check the C compiler for additional symbols
18664 postprocess_cc_v=''
18665 case "$osname" in
18666 aix) postprocess_cc_v="|$tr , ' '" ;;
18667 esac
18668 $cat >ccsym <<EOS
18669 $startsh
18670 $cat >tmp.c <<EOF
18671 extern int foo;
18672 EOF
18673 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18674 do
18675         case "\$i" in
18676         -D*) echo "\$i" | $sed 's/^-D//';;
18677         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
18678         esac
18679 done
18680 $rm -f try.c
18681 EOS
18682 postprocess_cc_v=''
18683 chmod +x ccsym
18684 $eunicefix ccsym
18685 ./ccsym > ccsym1.raw
18686 if $test -s ccsym1.raw; then
18687        $sort ccsym1.raw | $uniq >ccsym.raw
18688 else
18689        mv ccsym1.raw ccsym.raw
18690 fi
18691
18692 $awk '/\=/ { print $0; next }
18693         { print $0"=1" }' ccsym.raw >ccsym.list
18694 $awk '/\=/ { print $0; next }
18695         { print $0"=1" }' Cppsym.true >ccsym.true
18696 $comm -13 ccsym.true ccsym.list >ccsym.own
18697 $comm -12 ccsym.true ccsym.list >ccsym.com
18698 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18699 also=''
18700 if $test -z ccsym.raw; then
18701         echo "Your C compiler doesn't seem to define any symbols!" >&4
18702         echo " "
18703         echo "However, your C preprocessor defines the following symbols:"
18704         $cat Cppsym.true
18705         ccsymbols=''
18706         cppsymbols=`$cat Cppsym.true`
18707         cppsymbols=`echo $cppsymbols`
18708         cppccsymbols="$cppsymbols"
18709 else
18710         if $test -s ccsym.com; then
18711                 echo "Your C compiler and pre-processor define these symbols:"
18712                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18713                 also='also '
18714                 symbols='ones'
18715                 cppccsymbols=`$cat ccsym.com`
18716                 cppccsymbols=`echo $cppccsymbols`
18717                 $test "$silent" || sleep 1
18718         fi
18719         if $test -s ccsym.cpp; then
18720                 $test "$also" && echo " "
18721                 echo "Your C pre-processor ${also}defines the following symbols:"
18722                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18723                 also='further '
18724                 cppsymbols=`$cat ccsym.cpp`
18725                 cppsymbols=`echo $cppsymbols`
18726                 $test "$silent" || sleep 1
18727         fi
18728         if $test -s ccsym.own; then
18729                 $test "$also" && echo " "
18730                 echo "Your C compiler ${also}defines the following cpp symbols:"
18731                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18732                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18733                 ccsymbols=`$cat ccsym.own`
18734                 ccsymbols=`echo $ccsymbols`
18735                 $test "$silent" || sleep 1
18736         fi
18737 fi
18738
18739 : see if this is a termio system
18740 val="$undef"
18741 val2="$undef"
18742 val3="$undef"
18743 if $test `./findhdr termios.h`; then
18744         set tcsetattr i_termios
18745         eval $inlibc
18746         val3="$i_termios"
18747 fi
18748 echo " "
18749 case "$val3" in
18750 "$define") echo "You have POSIX termios.h... good!" >&4;;
18751 *) if ./Cppsym pyr; then
18752                 case "`/bin/universe`" in
18753                 ucb) if $test `./findhdr sgtty.h`; then
18754                                 val2="$define"
18755                                 echo "<sgtty.h> found." >&4
18756                         else
18757                                 echo "System is pyramid with BSD universe."
18758                                 echo "<sgtty.h> not found--you could have problems." >&4
18759                         fi;;
18760                 *) if $test `./findhdr termio.h`; then
18761                                 val="$define"
18762                                 echo "<termio.h> found." >&4
18763                         else
18764                                 echo "System is pyramid with USG universe."
18765                                 echo "<termio.h> not found--you could have problems." >&4
18766                         fi;;
18767                 esac
18768         elif ./usg; then
18769                 if $test `./findhdr termio.h`; then
18770                         echo "<termio.h> found." >&4
18771                         val="$define"
18772                 elif $test `./findhdr sgtty.h`; then
18773                         echo "<sgtty.h> found." >&4
18774                         val2="$define"
18775                 else
18776 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
18777                 fi
18778         else
18779                 if $test `./findhdr sgtty.h`; then
18780                         echo "<sgtty.h> found." >&4
18781                         val2="$define"
18782                 elif $test `./findhdr termio.h`; then
18783                         echo "<termio.h> found." >&4
18784                         val="$define"
18785                 else
18786 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
18787                 fi
18788         fi;;
18789 esac
18790 set i_termio; eval $setvar
18791 val=$val2; set i_sgtty; eval $setvar
18792 val=$val3; set i_termios; eval $setvar
18793
18794 : see if stddef is available
18795 set stddef.h i_stddef
18796 eval $inhdr
18797
18798 : see if this is a sunmath.h system
18799 set sunmath.h i_sunmath
18800 eval $inhdr
18801
18802 : see if sys/access.h is available
18803 set sys/access.h i_sysaccess
18804 eval $inhdr
18805
18806 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
18807 set sys/filio.h i_sysfilio
18808 eval $inhdr
18809 echo " "
18810 if $test `./findhdr sys/ioctl.h`; then
18811         val="$define"
18812         echo '<sys/ioctl.h> found.' >&4
18813 else
18814         val="$undef"
18815         if $test $i_sysfilio = "$define"; then
18816             echo '<sys/ioctl.h> NOT found.' >&4
18817         else
18818                 $test $i_sgtty = "$define" && xxx="sgtty.h"
18819                 $test $i_termio = "$define" && xxx="termio.h"
18820                 $test $i_termios = "$define" && xxx="termios.h"
18821 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
18822         fi
18823 fi
18824 set i_sysioctl
18825 eval $setvar
18826
18827 : see if socket ioctl defs are in sys/sockio.h
18828 echo " "
18829 xxx=`./findhdr sys/sockio.h`
18830 if $test "$xxx"; then
18831         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
18832                 val="$define"
18833                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
18834         else
18835                 val="$undef"
18836                 echo "No socket ioctls found in <sys/sockio.h>." >&4
18837         fi
18838 else
18839         val="$undef"
18840         $cat <<EOM
18841 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
18842 EOM
18843 fi
18844 set i_syssockio
18845 eval $setvar
18846
18847
18848 : see if this is a syslog.h system
18849 set syslog.h i_syslog
18850 eval $inhdr
18851
18852
18853 : see if this is a sys/mode.h system
18854 set sys/mode.h i_sysmode
18855 eval $inhdr
18856
18857 : see if sys/resource.h has to be included
18858 set sys/resource.h i_sysresrc
18859 eval $inhdr
18860
18861 : see if sys/security.h is available
18862 set sys/security.h i_syssecrt
18863 eval $inhdr
18864
18865 : see if this is a sys/statvfs.h system
18866 set sys/statvfs.h i_sysstatvfs
18867 eval $inhdr
18868
18869 : see if this is a sys/un.h system
18870 set sys/un.h i_sysun
18871 eval $inhdr
18872
18873
18874 : see if this is a sys/utsname.h system
18875 set sys/utsname.h i_sysutsname
18876 eval $inhdr
18877
18878 : see if this is a syswait system
18879 set sys/wait.h i_syswait
18880 eval $inhdr
18881
18882 : see if this is a ustat.h system
18883 set ustat.h i_ustat
18884 eval $inhdr
18885
18886 : see if this is an utime system
18887 set utime.h i_utime
18888 eval $inhdr
18889
18890 : see if this is a values.h system
18891 set values.h i_values
18892 eval $inhdr
18893
18894 : see if this is a vfork system
18895 case "$d_vfork" in
18896 "$define")
18897         set vfork.h i_vfork
18898         eval $inhdr
18899         ;;
18900 *)
18901         i_vfork="$undef"
18902         ;;
18903 esac
18904
18905 : see if gdbm.h is available
18906 set gdbm.h t_gdbm
18907 eval $inhdr
18908 case "$t_gdbm" in
18909 $define)
18910         : see if gdbm_open exists
18911         set gdbm_open d_gdbm_open
18912         eval $inlibc
18913         case "$d_gdbm_open" in
18914         $undef)
18915                 t_gdbm="$undef"
18916                 echo "We won't be including <gdbm.h>"
18917                 ;;
18918         esac
18919         ;;
18920 esac
18921 val="$t_gdbm"
18922 set i_gdbm
18923 eval $setvar
18924
18925 echo " "
18926 echo "Looking for extensions..." >&4
18927 : If we are using the old config.sh, known_extensions may contain
18928 : old or inaccurate or duplicate values.
18929 known_extensions=''
18930 nonxs_extensions=''
18931 : We do not use find because it might not be available.
18932 : We do not just use MANIFEST because the user may have dropped
18933 : some additional extensions into the source tree and expect them
18934 : to be built.
18935
18936 : Function to recursively find available extensions, ignoring DynaLoader
18937 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
18938 find_extensions='
18939     for xxx in *; do
18940        case "$xxx" in
18941            DynaLoader|dynaload) ;;
18942            *)
18943            if $test -f $xxx/$xxx.xs; then
18944                known_extensions="$known_extensions $1$xxx";
18945            elif $test -f $xxx/Makefile.PL; then
18946                nonxs_extensions="$nonxs_extensions $1$xxx";
18947            else
18948                if $test -d $xxx -a $# -lt 10; then
18949                    set $1$xxx/ $*;
18950                    cd "$xxx";
18951                    eval $find_extensions;
18952                    cd ..;
18953                    shift;
18954                fi;
18955            fi
18956            ;;
18957        esac;
18958     done'
18959 tdir=`pwd`
18960 cd "$rsrc/ext"
18961 set X
18962 shift
18963 eval $find_extensions
18964 # Special case:  Add in threads/shared since it is not picked up by the
18965 # recursive find above (and adding in general recursive finding breaks
18966 # SDBM_File/sdbm).  A.D.  10/25/2001.
18967 # Encode::XX need explicit mentions for the same reason.
18968 # --jhi 2002-03-04
18969 known_extensions="$known_extensions threads/shared Encode/CN Encode/JP Encode/KR Encode/TW"
18970 set X $nonxs_extensions
18971 shift
18972 nonxs_extensions="$*"
18973 set X $known_extensions
18974 shift
18975 known_extensions="$*"
18976 cd "$tdir"
18977
18978 : Now see which are supported on this system.
18979 avail_ext=''
18980 for xxx in $known_extensions ; do
18981         case "$xxx" in
18982         DB_File|db_file)
18983                 case "$i_db" in
18984                 $define) avail_ext="$avail_ext $xxx" ;;
18985                 esac
18986                 ;;
18987         GDBM_File|gdbm_fil)
18988                 case "$i_gdbm" in 
18989                 $define) avail_ext="$avail_ext $xxx" ;;
18990                 esac
18991                 ;;
18992         I18N/Langinfo|i18n_lan)
18993                 case "$i_langinfo$d_nl_langinfo" in 
18994                 $define$define) avail_ext="$avail_ext $xxx" ;;
18995                 esac
18996                 ;;
18997         NDBM_File|ndbm_fil)
18998                 case "$i_ndbm" in
18999                 $define)
19000                     case "$osname-$use64bitint" in
19001                     cygwin-*|hpux-define)
19002                         case "$libs" in
19003                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19004                         esac
19005                         ;;
19006                     *) avail_ext="$avail_ext $xxx" ;;
19007                     esac
19008                     ;;
19009                 esac
19010                 ;;
19011         ODBM_File|odbm_fil) 
19012                 case "${i_dbm}${i_rpcsvcdbm}" in
19013                 *"${define}"*)
19014                     case "$osname-$use64bitint" in
19015                     cygwin-*|hpux-define)
19016                         case "$libs" in
19017                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19018                         esac
19019                         ;;
19020                     *) avail_ext="$avail_ext $xxx" ;;
19021                     esac
19022                     ;;
19023                 esac
19024                 ;;
19025         POSIX|posix)
19026                 case "$useposix" in
19027                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19028                 esac
19029                 ;;
19030         Opcode|opcode)
19031                 case "$useopcode" in
19032                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19033                 esac
19034                 ;;
19035         Socket|socket)
19036                 case "$d_socket" in 
19037                 true|$define|y)
19038                     case "$osname" in
19039                     beos) ;; # not unless BONE
19040                     *) avail_ext="$avail_ext $xxx" ;;
19041                     esac
19042                     ;;
19043                 esac
19044                 ;;
19045         Sys/Syslog|sys/syslog)
19046                 : XXX syslog requires socket
19047                 case "$d_socket" in 
19048                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19049                 esac
19050                 ;;
19051         Thread|thread)
19052                 case "$usethreads" in
19053                 true|$define|y)
19054                         case "$useithreads" in
19055                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19056                         esac
19057                 esac
19058                 ;;
19059         threads|threads/shared)
19060                 case "$usethreads" in
19061                 true|$define|y)
19062                         case "$useithreads" in
19063                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
19064                         esac
19065                 esac
19066                 ;;
19067         IPC/SysV|ipc/sysv)
19068                 : XXX Do we need a useipcsysv variable here
19069                 case "${d_msg}${d_sem}${d_shm}" in 
19070                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19071                 esac
19072                 ;;
19073         *)      avail_ext="$avail_ext $xxx"
19074                 ;;
19075         esac
19076 done
19077
19078 set X $avail_ext
19079 shift
19080 avail_ext="$*"
19081
19082 : Now see which nonxs extensions are supported on this system.
19083 : For now assume all are.
19084 nonxs_ext=''
19085 for xxx in $nonxs_extensions ; do
19086         case "$xxx" in
19087         *)      nonxs_ext="$nonxs_ext $xxx"
19088                 ;;
19089         esac
19090 done
19091
19092 set X $nonxs_ext
19093 shift
19094 nonxs_ext="$*"
19095
19096 case $usedl in
19097 $define)
19098         $cat <<EOM
19099 A number of extensions are supplied with $package.  You may choose to
19100 compile these extensions for dynamic loading (the default), compile
19101 them into the $package executable (static loading), or not include
19102 them at all.  Answer "none" to include no extensions.
19103 Note that DynaLoader is always built and need not be mentioned here.
19104
19105 EOM
19106         case "$dynamic_ext" in
19107         '') dflt="$avail_ext" ;;
19108         *)      dflt="$dynamic_ext"
19109                 # Perhaps we are reusing an old out-of-date config.sh.
19110                 case "$hint" in
19111                 previous)
19112                         if test X"$dynamic_ext" != X"$avail_ext"; then
19113                                 $cat <<EOM
19114 NOTICE:  Your previous config.sh list may be incorrect. 
19115 The extensions now available to you are 
19116         ${avail_ext}
19117 but the default list from your previous config.sh is
19118         ${dynamic_ext} 
19119
19120 EOM
19121                         fi
19122                         ;;
19123                 esac
19124                 ;;
19125         esac
19126         case "$dflt" in
19127         '')     dflt=none;;
19128         esac
19129         rp="What extensions do you wish to load dynamically?"
19130         . ./myread
19131         case "$ans" in
19132         none) dynamic_ext=' ' ;;
19133         *) dynamic_ext="$ans" ;;
19134         esac
19135
19136         case "$static_ext" in
19137         '')
19138                 : Exclude those already listed in dynamic linking
19139                 dflt=''
19140                 for xxx in $avail_ext; do
19141                         case " $dynamic_ext " in
19142                         *" $xxx "*) ;;
19143                         *) dflt="$dflt $xxx" ;;
19144                         esac
19145                 done
19146                 set X $dflt
19147                 shift
19148                 dflt="$*"
19149                 ;;
19150         *)  dflt="$static_ext" 
19151                 ;;
19152         esac
19153
19154         case "$dflt" in
19155         '')     dflt=none;;
19156         esac
19157         rp="What extensions do you wish to load statically?"
19158         . ./myread
19159         case "$ans" in
19160         none) static_ext=' ' ;;
19161         *) static_ext="$ans" ;;
19162         esac
19163         ;;
19164 *)
19165         $cat <<EOM
19166 A number of extensions are supplied with $package.  Answer "none" 
19167 to include no extensions. 
19168 Note that DynaLoader is always built and need not be mentioned here.
19169
19170 EOM
19171         case "$static_ext" in
19172         '') dflt="$avail_ext" ;;
19173         *)      dflt="$static_ext"
19174                 # Perhaps we are reusing an old out-of-date config.sh.
19175                 case "$hint" in
19176                 previous)
19177                         if test X"$static_ext" != X"$avail_ext"; then
19178                                 $cat <<EOM
19179 NOTICE:  Your previous config.sh list may be incorrect. 
19180 The extensions now available to you are 
19181         ${avail_ext}
19182 but the default list from your previous config.sh is
19183         ${static_ext} 
19184
19185 EOM
19186                         fi
19187                         ;;
19188                 esac
19189                 ;;
19190         esac
19191         : Exclude those that are not xs extensions
19192         case "$dflt" in
19193         '')     dflt=none;;
19194         esac
19195         rp="What extensions do you wish to include?"
19196         . ./myread
19197         case "$ans" in
19198         none) static_ext=' ' ;;
19199         *) static_ext="$ans" ;;
19200         esac
19201         ;;
19202 esac
19203
19204 set X $dynamic_ext $static_ext $nonxs_ext
19205 shift
19206 extensions="$*"
19207
19208 : Remove libraries needed only for extensions
19209 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19210 : The exception is SunOS 4.x, which needs them.
19211 case "${osname}X${osvers}" in
19212 sunos*X4*)
19213     perllibs="$libs"
19214     ;;
19215 *) case "$usedl" in
19216     $define|true|[yY]*)
19217             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19218             shift
19219             perllibs="$*"
19220             ;;
19221     *)  perllibs="$libs"
19222             ;;
19223     esac
19224     ;;
19225 esac
19226
19227 : Remove build directory name from cppstdin so it can be used from
19228 : either the present location or the final installed location.
19229 echo " "
19230 : Get out of the UU directory to get correct path name.
19231 cd ..
19232 case "$cppstdin" in
19233 `pwd`/cppstdin)
19234         echo "Stripping down cppstdin path name"
19235         cppstdin=cppstdin
19236         ;;
19237 esac
19238 cd UU
19239
19240 : end of configuration questions
19241 echo " "
19242 echo "End of configuration questions."
19243 echo " "
19244
19245 : back to where it started
19246 if test -d ../UU; then
19247         cd ..
19248 fi
19249
19250 : configuration may be patched via a 'config.arch' file
19251 if $test -f config.arch; then
19252         echo "I see a config.arch file, loading it."
19253         . ./config.arch
19254 fi
19255
19256 : configuration may be patched via a 'config.over' file
19257 if $test -f config.over; then
19258         echo " "
19259         dflt=y
19260         rp='I see a config.over file.  Do you wish to load it?'
19261         . UU/myread
19262         case "$ans" in
19263         n*) echo "OK, I'll ignore it.";;
19264         *)      . ./config.over
19265                 echo "Configuration override changes have been loaded."
19266                 ;;
19267         esac
19268 fi
19269
19270 : in case they want portability, strip down executable paths
19271 case "$d_portable" in
19272 "$define")
19273         echo " "
19274         echo "Stripping down executable paths..." >&4
19275         for file in $loclist $trylist; do
19276                 eval temp=\$$file
19277                 eval $file=`basename $temp`
19278         done
19279         ;;
19280 esac
19281
19282 : create config.sh file
19283 echo " "
19284 echo "Creating config.sh..." >&4
19285 $spitshell <<EOT >config.sh
19286 $startsh
19287 #
19288 # This file was produced by running the Configure script. It holds all the
19289 # definitions figured out by Configure. Should you modify one of these values,
19290 # do not forget to propagate your changes by running "Configure -der". You may
19291 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19292 #
19293
19294 # Package name      : $package
19295 # Source directory  : $src
19296 # Configuration time: $cf_time
19297 # Configured by     : $cf_by
19298 # Target system     : $myuname
19299
19300 Author='$Author'
19301 Date='$Date'
19302 Header='$Header'
19303 Id='$Id'
19304 Locker='$Locker'
19305 Log='$Log'
19306 Mcc='$Mcc'
19307 RCSfile='$RCSfile'
19308 Revision='$Revision'
19309 Source='$Source'
19310 State='$State'
19311 _a='$_a'
19312 _exe='$_exe'
19313 _o='$_o'
19314 afs='$afs'
19315 afsroot='$afsroot'
19316 alignbytes='$alignbytes'
19317 ansi2knr='$ansi2knr'
19318 aphostname='$aphostname'
19319 api_revision='$api_revision'
19320 api_subversion='$api_subversion'
19321 api_version='$api_version'
19322 api_versionstring='$api_versionstring'
19323 ar='$ar'
19324 archlib='$archlib'
19325 archlibexp='$archlibexp'
19326 archname64='$archname64'
19327 archname='$archname'
19328 archobjs='$archobjs'
19329 asctime_r_proto='$asctime_r_proto'
19330 awk='$awk'
19331 baserev='$baserev'
19332 bash='$bash'
19333 bin='$bin'
19334 bincompat5005='$bincompat5005'
19335 binexp='$binexp'
19336 bison='$bison'
19337 byacc='$byacc'
19338 byteorder='$byteorder'
19339 c='$c'
19340 castflags='$castflags'
19341 cat='$cat'
19342 cc='$cc'
19343 cccdlflags='$cccdlflags'
19344 ccdlflags='$ccdlflags'
19345 ccflags='$ccflags'
19346 ccflags_uselargefiles='$ccflags_uselargefiles'
19347 ccname='$ccname'
19348 ccsymbols='$ccsymbols'
19349 ccversion='$ccversion'
19350 cf_by='$cf_by'
19351 cf_email='$cf_email'
19352 cf_time='$cf_time'
19353 charsize='$charsize'
19354 chgrp='$chgrp'
19355 chmod='$chmod'
19356 chown='$chown'
19357 clocktype='$clocktype'
19358 comm='$comm'
19359 compress='$compress'
19360 contains='$contains'
19361 cp='$cp'
19362 cpio='$cpio'
19363 cpp='$cpp'
19364 cpp_stuff='$cpp_stuff'
19365 cppccsymbols='$cppccsymbols'
19366 cppflags='$cppflags'
19367 cpplast='$cpplast'
19368 cppminus='$cppminus'
19369 cpprun='$cpprun'
19370 cppstdin='$cppstdin'
19371 cppsymbols='$cppsymbols'
19372 crypt_r_proto='$crypt_r_proto'
19373 cryptlib='$cryptlib'
19374 csh='$csh'
19375 ctermid_r_proto='$ctermid_r_proto'
19376 ctime_r_proto='$ctime_r_proto'
19377 d_Gconvert='$d_Gconvert'
19378 d_PRIEUldbl='$d_PRIEUldbl'
19379 d_PRIFUldbl='$d_PRIFUldbl'
19380 d_PRIGUldbl='$d_PRIGUldbl'
19381 d_PRIXU64='$d_PRIXU64'
19382 d_PRId64='$d_PRId64'
19383 d_PRIeldbl='$d_PRIeldbl'
19384 d_PRIfldbl='$d_PRIfldbl'
19385 d_PRIgldbl='$d_PRIgldbl'
19386 d_PRIi64='$d_PRIi64'
19387 d_PRIo64='$d_PRIo64'
19388 d_PRIu64='$d_PRIu64'
19389 d_PRIx64='$d_PRIx64'
19390 d_SCNfldbl='$d_SCNfldbl'
19391 d__fwalk='$d__fwalk'
19392 d_access='$d_access'
19393 d_accessx='$d_accessx'
19394 d_alarm='$d_alarm'
19395 d_archlib='$d_archlib'
19396 d_asctime_r='$d_asctime_r'
19397 d_atolf='$d_atolf'
19398 d_atoll='$d_atoll'
19399 d_attribut='$d_attribut'
19400 d_bcmp='$d_bcmp'
19401 d_bcopy='$d_bcopy'
19402 d_bincompat5005='$d_bincompat5005'
19403 d_bsd='$d_bsd'
19404 d_bsdgetpgrp='$d_bsdgetpgrp'
19405 d_bsdsetpgrp='$d_bsdsetpgrp'
19406 d_bzero='$d_bzero'
19407 d_casti32='$d_casti32'
19408 d_castneg='$d_castneg'
19409 d_charvspr='$d_charvspr'
19410 d_chown='$d_chown'
19411 d_chroot='$d_chroot'
19412 d_chsize='$d_chsize'
19413 d_class='$d_class'
19414 d_closedir='$d_closedir'
19415 d_cmsghdr_s='$d_cmsghdr_s'
19416 d_const='$d_const'
19417 d_crypt='$d_crypt'
19418 d_crypt_r='$d_crypt_r'
19419 d_csh='$d_csh'
19420 d_ctermid_r='$d_ctermid_r'
19421 d_ctime_r='$d_ctime_r'
19422 d_cuserid='$d_cuserid'
19423 d_dbl_dig='$d_dbl_dig'
19424 d_dbminitproto='$d_dbminitproto'
19425 d_difftime='$d_difftime'
19426 d_dirfd='$d_dirfd'
19427 d_dirnamlen='$d_dirnamlen'
19428 d_dlerror='$d_dlerror'
19429 d_dlopen='$d_dlopen'
19430 d_dlsymun='$d_dlsymun'
19431 d_dosuid='$d_dosuid'
19432 d_drand48_r='$d_drand48_r'
19433 d_drand48proto='$d_drand48proto'
19434 d_dup2='$d_dup2'
19435 d_eaccess='$d_eaccess'
19436 d_endgrent='$d_endgrent'
19437 d_endgrent_r='$d_endgrent_r'
19438 d_endhent='$d_endhent'
19439 d_endhostent_r='$d_endhostent_r'
19440 d_endnent='$d_endnent'
19441 d_endnetent_r='$d_endnetent_r'
19442 d_endpent='$d_endpent'
19443 d_endprotoent_r='$d_endprotoent_r'
19444 d_endpwent='$d_endpwent'
19445 d_endpwent_r='$d_endpwent_r'
19446 d_endsent='$d_endsent'
19447 d_endservent_r='$d_endservent_r'
19448 d_eofnblk='$d_eofnblk'
19449 d_eunice='$d_eunice'
19450 d_fchdir='$d_fchdir'
19451 d_fchmod='$d_fchmod'
19452 d_fchown='$d_fchown'
19453 d_fcntl='$d_fcntl'
19454 d_fcntl_can_lock='$d_fcntl_can_lock'
19455 d_fd_macros='$d_fd_macros'
19456 d_fd_set='$d_fd_set'
19457 d_fds_bits='$d_fds_bits'
19458 d_fgetpos='$d_fgetpos'
19459 d_finite='$d_finite'
19460 d_finitel='$d_finitel'
19461 d_flexfnam='$d_flexfnam'
19462 d_flock='$d_flock'
19463 d_flockproto='$d_flockproto'
19464 d_fork='$d_fork'
19465 d_fp_class='$d_fp_class'
19466 d_fpathconf='$d_fpathconf'
19467 d_fpclass='$d_fpclass'
19468 d_fpclassify='$d_fpclassify'
19469 d_fpclassl='$d_fpclassl'
19470 d_fpos64_t='$d_fpos64_t'
19471 d_frexpl='$d_frexpl'
19472 d_fs_data_s='$d_fs_data_s'
19473 d_fseeko='$d_fseeko'
19474 d_fsetpos='$d_fsetpos'
19475 d_fstatfs='$d_fstatfs'
19476 d_fstatvfs='$d_fstatvfs'
19477 d_fsync='$d_fsync'
19478 d_ftello='$d_ftello'
19479 d_ftime='$d_ftime'
19480 d_getcwd='$d_getcwd'
19481 d_getespwnam='$d_getespwnam'
19482 d_getfsstat='$d_getfsstat'
19483 d_getgrent='$d_getgrent'
19484 d_getgrent_r='$d_getgrent_r'
19485 d_getgrgid_r='$d_getgrgid_r'
19486 d_getgrnam_r='$d_getgrnam_r'
19487 d_getgrps='$d_getgrps'
19488 d_gethbyaddr='$d_gethbyaddr'
19489 d_gethbyname='$d_gethbyname'
19490 d_gethent='$d_gethent'
19491 d_gethname='$d_gethname'
19492 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19493 d_gethostbyname_r='$d_gethostbyname_r'
19494 d_gethostent_r='$d_gethostent_r'
19495 d_gethostprotos='$d_gethostprotos'
19496 d_getitimer='$d_getitimer'
19497 d_getlogin='$d_getlogin'
19498 d_getlogin_r='$d_getlogin_r'
19499 d_getmnt='$d_getmnt'
19500 d_getmntent='$d_getmntent'
19501 d_getnbyaddr='$d_getnbyaddr'
19502 d_getnbyname='$d_getnbyname'
19503 d_getnent='$d_getnent'
19504 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19505 d_getnetbyname_r='$d_getnetbyname_r'
19506 d_getnetent_r='$d_getnetent_r'
19507 d_getnetprotos='$d_getnetprotos'
19508 d_getpagsz='$d_getpagsz'
19509 d_getpbyname='$d_getpbyname'
19510 d_getpbynumber='$d_getpbynumber'
19511 d_getpent='$d_getpent'
19512 d_getpgid='$d_getpgid'
19513 d_getpgrp2='$d_getpgrp2'
19514 d_getpgrp='$d_getpgrp'
19515 d_getppid='$d_getppid'
19516 d_getprior='$d_getprior'
19517 d_getprotobyname_r='$d_getprotobyname_r'
19518 d_getprotobynumber_r='$d_getprotobynumber_r'
19519 d_getprotoent_r='$d_getprotoent_r'
19520 d_getprotoprotos='$d_getprotoprotos'
19521 d_getprpwnam='$d_getprpwnam'
19522 d_getpwent='$d_getpwent'
19523 d_getpwent_r='$d_getpwent_r'
19524 d_getpwnam_r='$d_getpwnam_r'
19525 d_getpwuid_r='$d_getpwuid_r'
19526 d_getsbyname='$d_getsbyname'
19527 d_getsbyport='$d_getsbyport'
19528 d_getsent='$d_getsent'
19529 d_getservbyname_r='$d_getservbyname_r'
19530 d_getservbyport_r='$d_getservbyport_r'
19531 d_getservent_r='$d_getservent_r'
19532 d_getservprotos='$d_getservprotos'
19533 d_getspnam='$d_getspnam'
19534 d_getspnam_r='$d_getspnam_r'
19535 d_gettimeod='$d_gettimeod'
19536 d_gmtime_r='$d_gmtime_r'
19537 d_gnulibc='$d_gnulibc'
19538 d_grpasswd='$d_grpasswd'
19539 d_hasmntopt='$d_hasmntopt'
19540 d_htonl='$d_htonl'
19541 d_index='$d_index'
19542 d_inetaton='$d_inetaton'
19543 d_int64_t='$d_int64_t'
19544 d_isascii='$d_isascii'
19545 d_isfinite='$d_isfinite'
19546 d_isinf='$d_isinf'
19547 d_isnan='$d_isnan'
19548 d_isnanl='$d_isnanl'
19549 d_killpg='$d_killpg'
19550 d_lchown='$d_lchown'
19551 d_ldbl_dig='$d_ldbl_dig'
19552 d_link='$d_link'
19553 d_localtime_r='$d_localtime_r'
19554 d_locconv='$d_locconv'
19555 d_lockf='$d_lockf'
19556 d_longdbl='$d_longdbl'
19557 d_longlong='$d_longlong'
19558 d_lseekproto='$d_lseekproto'
19559 d_lstat='$d_lstat'
19560 d_madvise='$d_madvise'
19561 d_mblen='$d_mblen'
19562 d_mbstowcs='$d_mbstowcs'
19563 d_mbtowc='$d_mbtowc'
19564 d_memchr='$d_memchr'
19565 d_memcmp='$d_memcmp'
19566 d_memcpy='$d_memcpy'
19567 d_memmove='$d_memmove'
19568 d_memset='$d_memset'
19569 d_mkdir='$d_mkdir'
19570 d_mkdtemp='$d_mkdtemp'
19571 d_mkfifo='$d_mkfifo'
19572 d_mkstemp='$d_mkstemp'
19573 d_mkstemps='$d_mkstemps'
19574 d_mktime='$d_mktime'
19575 d_mmap='$d_mmap'
19576 d_modfl='$d_modfl'
19577 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19578 d_mprotect='$d_mprotect'
19579 d_msg='$d_msg'
19580 d_msg_ctrunc='$d_msg_ctrunc'
19581 d_msg_dontroute='$d_msg_dontroute'
19582 d_msg_oob='$d_msg_oob'
19583 d_msg_peek='$d_msg_peek'
19584 d_msg_proxy='$d_msg_proxy'
19585 d_msgctl='$d_msgctl'
19586 d_msgget='$d_msgget'
19587 d_msghdr_s='$d_msghdr_s'
19588 d_msgrcv='$d_msgrcv'
19589 d_msgsnd='$d_msgsnd'
19590 d_msync='$d_msync'
19591 d_munmap='$d_munmap'
19592 d_mymalloc='$d_mymalloc'
19593 d_nice='$d_nice'
19594 d_nl_langinfo='$d_nl_langinfo'
19595 d_nv_preserves_uv='$d_nv_preserves_uv'
19596 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
19597 d_off64_t='$d_off64_t'
19598 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19599 d_oldpthreads='$d_oldpthreads'
19600 d_oldsock='$d_oldsock'
19601 d_open3='$d_open3'
19602 d_pathconf='$d_pathconf'
19603 d_pause='$d_pause'
19604 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19605 d_phostname='$d_phostname'
19606 d_pipe='$d_pipe'
19607 d_poll='$d_poll'
19608 d_portable='$d_portable'
19609 d_procselfexe='$d_procselfexe'
19610 d_pthread_atfork='$d_pthread_atfork'
19611 d_pthread_yield='$d_pthread_yield'
19612 d_pwage='$d_pwage'
19613 d_pwchange='$d_pwchange'
19614 d_pwclass='$d_pwclass'
19615 d_pwcomment='$d_pwcomment'
19616 d_pwexpire='$d_pwexpire'
19617 d_pwgecos='$d_pwgecos'
19618 d_pwpasswd='$d_pwpasswd'
19619 d_pwquota='$d_pwquota'
19620 d_qgcvt='$d_qgcvt'
19621 d_quad='$d_quad'
19622 d_random_r='$d_random_r'
19623 d_readdir64_r='$d_readdir64_r'
19624 d_readdir='$d_readdir'
19625 d_readdir_r='$d_readdir_r'
19626 d_readlink='$d_readlink'
19627 d_readv='$d_readv'
19628 d_recvmsg='$d_recvmsg'
19629 d_rename='$d_rename'
19630 d_rewinddir='$d_rewinddir'
19631 d_rmdir='$d_rmdir'
19632 d_safebcpy='$d_safebcpy'
19633 d_safemcpy='$d_safemcpy'
19634 d_sanemcmp='$d_sanemcmp'
19635 d_sbrkproto='$d_sbrkproto'
19636 d_sched_yield='$d_sched_yield'
19637 d_scm_rights='$d_scm_rights'
19638 d_seekdir='$d_seekdir'
19639 d_select='$d_select'
19640 d_sem='$d_sem'
19641 d_semctl='$d_semctl'
19642 d_semctl_semid_ds='$d_semctl_semid_ds'
19643 d_semctl_semun='$d_semctl_semun'
19644 d_semget='$d_semget'
19645 d_semop='$d_semop'
19646 d_sendmsg='$d_sendmsg'
19647 d_setegid='$d_setegid'
19648 d_seteuid='$d_seteuid'
19649 d_setgrent='$d_setgrent'
19650 d_setgrent_r='$d_setgrent_r'
19651 d_setgrps='$d_setgrps'
19652 d_sethent='$d_sethent'
19653 d_sethostent_r='$d_sethostent_r'
19654 d_setitimer='$d_setitimer'
19655 d_setlinebuf='$d_setlinebuf'
19656 d_setlocale='$d_setlocale'
19657 d_setlocale_r='$d_setlocale_r'
19658 d_setnent='$d_setnent'
19659 d_setnetent_r='$d_setnetent_r'
19660 d_setpent='$d_setpent'
19661 d_setpgid='$d_setpgid'
19662 d_setpgrp2='$d_setpgrp2'
19663 d_setpgrp='$d_setpgrp'
19664 d_setprior='$d_setprior'
19665 d_setproctitle='$d_setproctitle'
19666 d_setprotoent_r='$d_setprotoent_r'
19667 d_setpwent='$d_setpwent'
19668 d_setpwent_r='$d_setpwent_r'
19669 d_setregid='$d_setregid'
19670 d_setresgid='$d_setresgid'
19671 d_setresuid='$d_setresuid'
19672 d_setreuid='$d_setreuid'
19673 d_setrgid='$d_setrgid'
19674 d_setruid='$d_setruid'
19675 d_setsent='$d_setsent'
19676 d_setservent_r='$d_setservent_r'
19677 d_setsid='$d_setsid'
19678 d_setvbuf='$d_setvbuf'
19679 d_sfio='$d_sfio'
19680 d_shm='$d_shm'
19681 d_shmat='$d_shmat'
19682 d_shmatprototype='$d_shmatprototype'
19683 d_shmctl='$d_shmctl'
19684 d_shmdt='$d_shmdt'
19685 d_shmget='$d_shmget'
19686 d_sigaction='$d_sigaction'
19687 d_sigprocmask='$d_sigprocmask'
19688 d_sigsetjmp='$d_sigsetjmp'
19689 d_sockatmark='$d_sockatmark'
19690 d_sockatmarkproto='$d_sockatmarkproto'
19691 d_socket='$d_socket'
19692 d_socklen_t='$d_socklen_t'
19693 d_sockpair='$d_sockpair'
19694 d_socks5_init='$d_socks5_init'
19695 d_sqrtl='$d_sqrtl'
19696 d_srand48_r='$d_srand48_r'
19697 d_srandom_r='$d_srandom_r'
19698 d_sresgproto='$d_sresgproto'
19699 d_sresuproto='$d_sresuproto'
19700 d_statblks='$d_statblks'
19701 d_statfs_f_flags='$d_statfs_f_flags'
19702 d_statfs_s='$d_statfs_s'
19703 d_statvfs='$d_statvfs'
19704 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19705 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19706 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19707 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19708 d_stdio_stream_array='$d_stdio_stream_array'
19709 d_stdiobase='$d_stdiobase'
19710 d_stdstdio='$d_stdstdio'
19711 d_strchr='$d_strchr'
19712 d_strcoll='$d_strcoll'
19713 d_strctcpy='$d_strctcpy'
19714 d_strerrm='$d_strerrm'
19715 d_strerror='$d_strerror'
19716 d_strerror_r='$d_strerror_r'
19717 d_strftime='$d_strftime'
19718 d_strtod='$d_strtod'
19719 d_strtol='$d_strtol'
19720 d_strtold='$d_strtold'
19721 d_strtoll='$d_strtoll'
19722 d_strtoq='$d_strtoq'
19723 d_strtoul='$d_strtoul'
19724 d_strtoull='$d_strtoull'
19725 d_strtouq='$d_strtouq'
19726 d_strxfrm='$d_strxfrm'
19727 d_suidsafe='$d_suidsafe'
19728 d_symlink='$d_symlink'
19729 d_syscall='$d_syscall'
19730 d_syscallproto='$d_syscallproto'
19731 d_sysconf='$d_sysconf'
19732 d_sysernlst='$d_sysernlst'
19733 d_syserrlst='$d_syserrlst'
19734 d_system='$d_system'
19735 d_tcgetpgrp='$d_tcgetpgrp'
19736 d_tcsetpgrp='$d_tcsetpgrp'
19737 d_telldir='$d_telldir'
19738 d_telldirproto='$d_telldirproto'
19739 d_time='$d_time'
19740 d_times='$d_times'
19741 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19742 d_tm_tm_zone='$d_tm_tm_zone'
19743 d_tmpnam_r='$d_tmpnam_r'
19744 d_truncate='$d_truncate'
19745 d_ttyname_r='$d_ttyname_r'
19746 d_tzname='$d_tzname'
19747 d_u32align='$d_u32align'
19748 d_ualarm='$d_ualarm'
19749 d_umask='$d_umask'
19750 d_uname='$d_uname'
19751 d_union_semun='$d_union_semun'
19752 d_unordered='$d_unordered'
19753 d_usleep='$d_usleep'
19754 d_usleepproto='$d_usleepproto'
19755 d_ustat='$d_ustat'
19756 d_vendorarch='$d_vendorarch'
19757 d_vendorbin='$d_vendorbin'
19758 d_vendorlib='$d_vendorlib'
19759 d_vfork='$d_vfork'
19760 d_void_closedir='$d_void_closedir'
19761 d_voidsig='$d_voidsig'
19762 d_voidtty='$d_voidtty'
19763 d_volatile='$d_volatile'
19764 d_vprintf='$d_vprintf'
19765 d_wait4='$d_wait4'
19766 d_waitpid='$d_waitpid'
19767 d_wcstombs='$d_wcstombs'
19768 d_wctomb='$d_wctomb'
19769 d_writev='$d_writev'
19770 d_xenix='$d_xenix'
19771 date='$date'
19772 db_hashtype='$db_hashtype'
19773 db_prefixtype='$db_prefixtype'
19774 db_version_major='$db_version_major'
19775 db_version_minor='$db_version_minor'
19776 db_version_patch='$db_version_patch'
19777 defvoidused='$defvoidused'
19778 direntrytype='$direntrytype'
19779 dlext='$dlext'
19780 dlsrc='$dlsrc'
19781 doublesize='$doublesize'
19782 drand01='$drand01'
19783 drand48_r_proto='$drand48_r_proto'
19784 dynamic_ext='$dynamic_ext'
19785 eagain='$eagain'
19786 ebcdic='$ebcdic'
19787 echo='$echo'
19788 egrep='$egrep'
19789 emacs='$emacs'
19790 endgrent_r_proto='$endgrent_r_proto'
19791 endhostent_r_proto='$endhostent_r_proto'
19792 endnetent_r_proto='$endnetent_r_proto'
19793 endprotoent_r_proto='$endprotoent_r_proto'
19794 endpwent_r_proto='$endpwent_r_proto'
19795 endservent_r_proto='$endservent_r_proto'
19796 eunicefix='$eunicefix'
19797 exe_ext='$exe_ext'
19798 expr='$expr'
19799 extensions='$extensions'
19800 extras='$extras'
19801 fflushNULL='$fflushNULL'
19802 fflushall='$fflushall'
19803 find='$find'
19804 firstmakefile='$firstmakefile'
19805 flex='$flex'
19806 fpossize='$fpossize'
19807 fpostype='$fpostype'
19808 freetype='$freetype'
19809 from='$from'
19810 full_ar='$full_ar'
19811 full_csh='$full_csh'
19812 full_sed='$full_sed'
19813 gccosandvers='$gccosandvers'
19814 gccversion='$gccversion'
19815 getgrent_r_proto='$getgrent_r_proto'
19816 getgrgid_r_proto='$getgrgid_r_proto'
19817 getgrnam_r_proto='$getgrnam_r_proto'
19818 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
19819 gethostbyname_r_proto='$gethostbyname_r_proto'
19820 gethostent_r_proto='$gethostent_r_proto'
19821 getlogin_r_proto='$getlogin_r_proto'
19822 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
19823 getnetbyname_r_proto='$getnetbyname_r_proto'
19824 getnetent_r_proto='$getnetent_r_proto'
19825 getprotobyname_r_proto='$getprotobyname_r_proto'
19826 getprotobynumber_r_proto='$getprotobynumber_r_proto'
19827 getprotoent_r_proto='$getprotoent_r_proto'
19828 getpwent_r_proto='$getpwent_r_proto'
19829 getpwnam_r_proto='$getpwnam_r_proto'
19830 getpwuid_r_proto='$getpwuid_r_proto'
19831 getservbyname_r_proto='$getservbyname_r_proto'
19832 getservbyport_r_proto='$getservbyport_r_proto'
19833 getservent_r_proto='$getservent_r_proto'
19834 getspnam_r_proto='$getspnam_r_proto'
19835 gidformat='$gidformat'
19836 gidsign='$gidsign'
19837 gidsize='$gidsize'
19838 gidtype='$gidtype'
19839 glibpth='$glibpth'
19840 gmake='$gmake'
19841 gmtime_r_proto='$gmtime_r_proto'
19842 grep='$grep'
19843 groupcat='$groupcat'
19844 groupstype='$groupstype'
19845 gzip='$gzip'
19846 h_fcntl='$h_fcntl'
19847 h_sysfile='$h_sysfile'
19848 hint='$hint'
19849 hostcat='$hostcat'
19850 i16size='$i16size'
19851 i16type='$i16type'
19852 i32size='$i32size'
19853 i32type='$i32type'
19854 i64size='$i64size'
19855 i64type='$i64type'
19856 i8size='$i8size'
19857 i8type='$i8type'
19858 i_arpainet='$i_arpainet'
19859 i_bsdioctl='$i_bsdioctl'
19860 i_crypt='$i_crypt'
19861 i_db='$i_db'
19862 i_dbm='$i_dbm'
19863 i_dirent='$i_dirent'
19864 i_dld='$i_dld'
19865 i_dlfcn='$i_dlfcn'
19866 i_fcntl='$i_fcntl'
19867 i_float='$i_float'
19868 i_fp='$i_fp'
19869 i_fp_class='$i_fp_class'
19870 i_gdbm='$i_gdbm'
19871 i_grp='$i_grp'
19872 i_ieeefp='$i_ieeefp'
19873 i_inttypes='$i_inttypes'
19874 i_langinfo='$i_langinfo'
19875 i_libutil='$i_libutil'
19876 i_limits='$i_limits'
19877 i_locale='$i_locale'
19878 i_machcthr='$i_machcthr'
19879 i_malloc='$i_malloc'
19880 i_math='$i_math'
19881 i_memory='$i_memory'
19882 i_mntent='$i_mntent'
19883 i_ndbm='$i_ndbm'
19884 i_netdb='$i_netdb'
19885 i_neterrno='$i_neterrno'
19886 i_netinettcp='$i_netinettcp'
19887 i_niin='$i_niin'
19888 i_poll='$i_poll'
19889 i_prot='$i_prot'
19890 i_pthread='$i_pthread'
19891 i_pwd='$i_pwd'
19892 i_rpcsvcdbm='$i_rpcsvcdbm'
19893 i_sfio='$i_sfio'
19894 i_sgtty='$i_sgtty'
19895 i_shadow='$i_shadow'
19896 i_socks='$i_socks'
19897 i_stdarg='$i_stdarg'
19898 i_stddef='$i_stddef'
19899 i_stdlib='$i_stdlib'
19900 i_string='$i_string'
19901 i_sunmath='$i_sunmath'
19902 i_sysaccess='$i_sysaccess'
19903 i_sysdir='$i_sysdir'
19904 i_sysfile='$i_sysfile'
19905 i_sysfilio='$i_sysfilio'
19906 i_sysin='$i_sysin'
19907 i_sysioctl='$i_sysioctl'
19908 i_syslog='$i_syslog'
19909 i_sysmman='$i_sysmman'
19910 i_sysmode='$i_sysmode'
19911 i_sysmount='$i_sysmount'
19912 i_sysndir='$i_sysndir'
19913 i_sysparam='$i_sysparam'
19914 i_sysresrc='$i_sysresrc'
19915 i_syssecrt='$i_syssecrt'
19916 i_sysselct='$i_sysselct'
19917 i_syssockio='$i_syssockio'
19918 i_sysstat='$i_sysstat'
19919 i_sysstatfs='$i_sysstatfs'
19920 i_sysstatvfs='$i_sysstatvfs'
19921 i_systime='$i_systime'
19922 i_systimek='$i_systimek'
19923 i_systimes='$i_systimes'
19924 i_systypes='$i_systypes'
19925 i_sysuio='$i_sysuio'
19926 i_sysun='$i_sysun'
19927 i_sysutsname='$i_sysutsname'
19928 i_sysvfs='$i_sysvfs'
19929 i_syswait='$i_syswait'
19930 i_termio='$i_termio'
19931 i_termios='$i_termios'
19932 i_time='$i_time'
19933 i_unistd='$i_unistd'
19934 i_ustat='$i_ustat'
19935 i_utime='$i_utime'
19936 i_values='$i_values'
19937 i_varargs='$i_varargs'
19938 i_varhdr='$i_varhdr'
19939 i_vfork='$i_vfork'
19940 ignore_versioned_solibs='$ignore_versioned_solibs'
19941 inc_version_list='$inc_version_list'
19942 inc_version_list_init='$inc_version_list_init'
19943 incpath='$incpath'
19944 inews='$inews'
19945 installarchlib='$installarchlib'
19946 installbin='$installbin'
19947 installman1dir='$installman1dir'
19948 installman3dir='$installman3dir'
19949 installprefix='$installprefix'
19950 installprefixexp='$installprefixexp'
19951 installprivlib='$installprivlib'
19952 installscript='$installscript'
19953 installsitearch='$installsitearch'
19954 installsitebin='$installsitebin'
19955 installsitelib='$installsitelib'
19956 installstyle='$installstyle'
19957 installusrbinperl='$installusrbinperl'
19958 installvendorarch='$installvendorarch'
19959 installvendorbin='$installvendorbin'
19960 installvendorlib='$installvendorlib'
19961 intsize='$intsize'
19962 issymlink='$issymlink'
19963 ivdformat='$ivdformat'
19964 ivsize='$ivsize'
19965 ivtype='$ivtype'
19966 known_extensions='$known_extensions'
19967 ksh='$ksh'
19968 ld='$ld'
19969 lddlflags='$lddlflags'
19970 ldflags='$ldflags'
19971 ldflags_uselargefiles='$ldflags_uselargefiles'
19972 ldlibpthname='$ldlibpthname'
19973 less='$less'
19974 lib_ext='$lib_ext'
19975 libc='$libc'
19976 libperl='$libperl'
19977 libpth='$libpth'
19978 libs='$libs'
19979 libsdirs='$libsdirs'
19980 libsfiles='$libsfiles'
19981 libsfound='$libsfound'
19982 libspath='$libspath'
19983 libswanted='$libswanted'
19984 libswanted_uselargefiles='$libswanted_uselargefiles'
19985 line='$line'
19986 lint='$lint'
19987 lkflags='$lkflags'
19988 ln='$ln'
19989 lns='$lns'
19990 localtime_r_proto='$localtime_r_proto'
19991 locincpth='$locincpth'
19992 loclibpth='$loclibpth'
19993 longdblsize='$longdblsize'
19994 longlongsize='$longlongsize'
19995 longsize='$longsize'
19996 lp='$lp'
19997 lpr='$lpr'
19998 ls='$ls'
19999 lseeksize='$lseeksize'
20000 lseektype='$lseektype'
20001 mail='$mail'
20002 mailx='$mailx'
20003 make='$make'
20004 make_set_make='$make_set_make'
20005 mallocobj='$mallocobj'
20006 mallocsrc='$mallocsrc'
20007 malloctype='$malloctype'
20008 man1dir='$man1dir'
20009 man1direxp='$man1direxp'
20010 man1ext='$man1ext'
20011 man3dir='$man3dir'
20012 man3direxp='$man3direxp'
20013 man3ext='$man3ext'
20014 mips_type='$mips_type'
20015 mkdir='$mkdir'
20016 mmaptype='$mmaptype'
20017 modetype='$modetype'
20018 more='$more'
20019 multiarch='$multiarch'
20020 mv='$mv'
20021 myarchname='$myarchname'
20022 mydomain='$mydomain'
20023 myhostname='$myhostname'
20024 myuname='$myuname'
20025 n='$n'
20026 need_va_copy='$need_va_copy'
20027 netdb_hlen_type='$netdb_hlen_type'
20028 netdb_host_type='$netdb_host_type'
20029 netdb_name_type='$netdb_name_type'
20030 netdb_net_type='$netdb_net_type'
20031 nm='$nm'
20032 nm_opt='$nm_opt'
20033 nm_so_opt='$nm_so_opt'
20034 nonxs_ext='$nonxs_ext'
20035 nroff='$nroff'
20036 nvEUformat='$nvEUformat'
20037 nvFUformat='$nvFUformat'
20038 nvGUformat='$nvGUformat'
20039 nveformat='$nveformat'
20040 nvfformat='$nvfformat'
20041 nvgformat='$nvgformat'
20042 nvsize='$nvsize'
20043 nvtype='$nvtype'
20044 o_nonblock='$o_nonblock'
20045 obj_ext='$obj_ext'
20046 old_pthread_create_joinable='$old_pthread_create_joinable'
20047 optimize='$optimize'
20048 orderlib='$orderlib'
20049 osname='$osname'
20050 osvers='$osvers'
20051 otherlibdirs='$otherlibdirs'
20052 package='$package'
20053 pager='$pager'
20054 passcat='$passcat'
20055 patchlevel='$patchlevel'
20056 path_sep='$path_sep'
20057 perl5='$perl5'
20058 perl='$perl'
20059 perl_patchlevel='$perl_patchlevel'
20060 perladmin='$perladmin'
20061 perllibs='$perllibs'
20062 perlpath='$perlpath'
20063 pg='$pg'
20064 phostname='$phostname'
20065 pidtype='$pidtype'
20066 plibpth='$plibpth'
20067 pm_apiversion='$pm_apiversion'
20068 pmake='$pmake'
20069 pr='$pr'
20070 prefix='$prefix'
20071 prefixexp='$prefixexp'
20072 privlib='$privlib'
20073 privlibexp='$privlibexp'
20074 procselfexe='$procselfexe'
20075 prototype='$prototype'
20076 ptrsize='$ptrsize'
20077 quadkind='$quadkind'
20078 quadtype='$quadtype'
20079 randbits='$randbits'
20080 randfunc='$randfunc'
20081 random_r_proto='$random_r_proto'
20082 randseedtype='$randseedtype'
20083 ranlib='$ranlib'
20084 rd_nodata='$rd_nodata'
20085 readdir64_r_proto='$readdir64_r_proto'
20086 readdir_r_proto='$readdir_r_proto'
20087 revision='$revision'
20088 rm='$rm'
20089 rmail='$rmail'
20090 run='$run'
20091 runnm='$runnm'
20092 sPRIEUldbl='$sPRIEUldbl'
20093 sPRIFUldbl='$sPRIFUldbl'
20094 sPRIGUldbl='$sPRIGUldbl'
20095 sPRIXU64='$sPRIXU64'
20096 sPRId64='$sPRId64'
20097 sPRIeldbl='$sPRIeldbl'
20098 sPRIfldbl='$sPRIfldbl'
20099 sPRIgldbl='$sPRIgldbl'
20100 sPRIi64='$sPRIi64'
20101 sPRIo64='$sPRIo64'
20102 sPRIu64='$sPRIu64'
20103 sPRIx64='$sPRIx64'
20104 sSCNfldbl='$sSCNfldbl'
20105 sched_yield='$sched_yield'
20106 scriptdir='$scriptdir'
20107 scriptdirexp='$scriptdirexp'
20108 sed='$sed'
20109 seedfunc='$seedfunc'
20110 selectminbits='$selectminbits'
20111 selecttype='$selecttype'
20112 sendmail='$sendmail'
20113 setgrent_r_proto='$setgrent_r_proto'
20114 sethostent_r_proto='$sethostent_r_proto'
20115 setlocale_r_proto='$setlocale_r_proto'
20116 setnetent_r_proto='$setnetent_r_proto'
20117 setprotoent_r_proto='$setprotoent_r_proto'
20118 setpwent_r_proto='$setpwent_r_proto'
20119 setservent_r_proto='$setservent_r_proto'
20120 sh='$sh'
20121 shar='$shar'
20122 sharpbang='$sharpbang'
20123 shmattype='$shmattype'
20124 shortsize='$shortsize'
20125 shrpenv='$shrpenv'
20126 shsharp='$shsharp'
20127 sig_count='$sig_count'
20128 sig_name='$sig_name'
20129 sig_name_init='$sig_name_init'
20130 sig_num='$sig_num'
20131 sig_num_init='$sig_num_init'
20132 sig_size='$sig_size'
20133 signal_t='$signal_t'
20134 sitearch='$sitearch'
20135 sitearchexp='$sitearchexp'
20136 sitebin='$sitebin'
20137 sitebinexp='$sitebinexp'
20138 sitelib='$sitelib'
20139 sitelib_stem='$sitelib_stem'
20140 sitelibexp='$sitelibexp'
20141 siteprefix='$siteprefix'
20142 siteprefixexp='$siteprefixexp'
20143 sizesize='$sizesize'
20144 sizetype='$sizetype'
20145 sleep='$sleep'
20146 smail='$smail'
20147 so='$so'
20148 sockethdr='$sockethdr'
20149 socketlib='$socketlib'
20150 socksizetype='$socksizetype'
20151 sort='$sort'
20152 spackage='$spackage'
20153 spitshell='$spitshell'
20154 srand48_r_proto='$srand48_r_proto'
20155 srandom_r_proto='$srandom_r_proto'
20156 src='$src'
20157 ssizetype='$ssizetype'
20158 startperl='$startperl'
20159 startsh='$startsh'
20160 static_ext='$static_ext'
20161 stdchar='$stdchar'
20162 stdio_base='$stdio_base'
20163 stdio_bufsiz='$stdio_bufsiz'
20164 stdio_cnt='$stdio_cnt'
20165 stdio_filbuf='$stdio_filbuf'
20166 stdio_ptr='$stdio_ptr'
20167 stdio_stream_array='$stdio_stream_array'
20168 strerror_r_proto='$strerror_r_proto'
20169 strings='$strings'
20170 submit='$submit'
20171 subversion='$subversion'
20172 sysman='$sysman'
20173 tail='$tail'
20174 tar='$tar'
20175 targetarch='$targetarch'
20176 tbl='$tbl'
20177 tee='$tee'
20178 test='$test'
20179 timeincl='$timeincl'
20180 timetype='$timetype'
20181 tmpnam_r_proto='$tmpnam_r_proto'
20182 to='$to'
20183 touch='$touch'
20184 tr='$tr'
20185 trnl='$trnl'
20186 troff='$troff'
20187 ttyname_r_proto='$ttyname_r_proto'
20188 u16size='$u16size'
20189 u16type='$u16type'
20190 u32size='$u32size'
20191 u32type='$u32type'
20192 u64size='$u64size'
20193 u64type='$u64type'
20194 u8size='$u8size'
20195 u8type='$u8type'
20196 uidformat='$uidformat'
20197 uidsign='$uidsign'
20198 uidsize='$uidsize'
20199 uidtype='$uidtype'
20200 uname='$uname'
20201 uniq='$uniq'
20202 uquadtype='$uquadtype'
20203 use5005threads='$use5005threads'
20204 use64bitall='$use64bitall'
20205 use64bitint='$use64bitint'
20206 usecrosscompile='$usecrosscompile'
20207 usedl='$usedl'
20208 useithreads='$useithreads'
20209 uselargefiles='$uselargefiles'
20210 uselongdouble='$uselongdouble'
20211 usemorebits='$usemorebits'
20212 usemultiplicity='$usemultiplicity'
20213 usemymalloc='$usemymalloc'
20214 usenm='$usenm'
20215 useopcode='$useopcode'
20216 useperlio='$useperlio'
20217 useposix='$useposix'
20218 usereentrant='$usereentrant'
20219 usesfio='$usesfio'
20220 useshrplib='$useshrplib'
20221 usesocks='$usesocks'
20222 usethreads='$usethreads'
20223 usevendorprefix='$usevendorprefix'
20224 usevfork='$usevfork'
20225 usrinc='$usrinc'
20226 uuname='$uuname'
20227 uvXUformat='$uvXUformat'
20228 uvoformat='$uvoformat'
20229 uvsize='$uvsize'
20230 uvtype='$uvtype'
20231 uvuformat='$uvuformat'
20232 uvxformat='$uvxformat'
20233 vendorarch='$vendorarch'
20234 vendorarchexp='$vendorarchexp'
20235 vendorbin='$vendorbin'
20236 vendorbinexp='$vendorbinexp'
20237 vendorlib='$vendorlib'
20238 vendorlib_stem='$vendorlib_stem'
20239 vendorlibexp='$vendorlibexp'
20240 vendorprefix='$vendorprefix'
20241 vendorprefixexp='$vendorprefixexp'
20242 version='$version'
20243 version_patchlevel_string='$version_patchlevel_string'
20244 versiononly='$versiononly'
20245 vi='$vi'
20246 voidflags='$voidflags'
20247 xlibpth='$xlibpth'
20248 xs_apiversion='$xs_apiversion'
20249 yacc='$yacc'
20250 yaccflags='$yaccflags'
20251 zcat='$zcat'
20252 zip='$zip'
20253 EOT
20254
20255 : Add in command line options if available
20256 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20257
20258 : add special variables
20259 $test -f $src/patchlevel.h && \
20260 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20261 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20262 echo "PERL_CONFIG_SH=true" >>config.sh
20263
20264 : propagate old symbols
20265 if $test -f UU/config.sh; then
20266         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20267         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20268         $sort | $uniq -u >UU/oldsyms
20269         set X `cat UU/oldsyms`
20270         shift
20271         case $# in
20272         0) ;;
20273         *)
20274                 cat <<EOM
20275 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20276 EOM
20277                 echo "# Variables propagated from previous config.sh file." >>config.sh
20278                 for sym in `cat UU/oldsyms`; do
20279                         echo "    Propagating $hint variable "'$'"$sym..."
20280                         eval 'tmp="$'"${sym}"'"'
20281                         echo "$tmp" | \
20282                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20283                 done
20284                 ;;
20285         esac
20286 fi
20287
20288 : Finish up by extracting the .SH files
20289 case "$alldone" in
20290 exit)
20291         $rm -rf UU
20292         echo "Extraction done."
20293         exit 0
20294         ;;
20295 cont)
20296         ;;
20297 '')
20298         dflt=''
20299         nostick=true
20300         $cat <<EOM
20301
20302 If you'd like to make any changes to the config.sh file before I begin
20303 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20304
20305 EOM
20306         rp="Press return or use a shell escape to edit config.sh:"
20307         . UU/myread
20308         nostick=''
20309         case "$ans" in
20310         '') ;;
20311         *) : in case they cannot read
20312                 sh 1>&4 -c "$ans";;
20313         esac
20314         ;;
20315 esac
20316
20317 : if this fails, just run all the .SH files by hand
20318 . ./config.sh
20319
20320 echo " "
20321 exec 1>&4
20322 pwd=`pwd`
20323 . ./UU/extract
20324 cd "$pwd"
20325
20326 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20327         dflt=y
20328         case "$silent" in
20329         true) ;;
20330         *)
20331                 $cat <<EOM
20332
20333 Now you need to generate make dependencies by running "$make depend".
20334 You might prefer to run it in background: "$make depend > makedepend.out &"
20335 It can take a while, so you might not want to run it right now.
20336
20337 EOM
20338                 ;;
20339         esac
20340         rp="Run $make depend now?"
20341         . UU/myread
20342         case "$ans" in
20343         y*)
20344                 $make depend && echo "Now you must run '$make'."
20345                 ;;
20346         *)
20347                 echo "You must run '$make depend' then '$make'."
20348                 ;;
20349         esac
20350 elif test -f [Mm]akefile; then
20351         echo " "
20352         echo "Now you must run a $make."
20353 else
20354         echo "Configure done."
20355 fi
20356
20357 if $test -f Policy.sh; then
20358     $cat <<EOM
20359
20360 If you compile $package on a different machine or from a different object
20361 directory, copy the Policy.sh file from this object directory to the
20362 new one before you run Configure -- this will help you with most of
20363 the policy defaults.
20364
20365 EOM
20366 fi
20367 if $test -f config.msg; then
20368     echo "Hmm.  I also noted the following information while running:"
20369     echo " "
20370     $cat config.msg >&4
20371     $rm -f config.msg
20372 fi
20373 $rm -f kit*isdone ark*isdone
20374 $rm -rf UU
20375
20376 : End of Configure
20377