Re: hints/linux.sh & stdio
[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 Wed Jun  5 04:17:01 EET DST 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 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 gnulibc_version=''
499 d_hasmntopt=''
500 d_htonl=''
501 d_inetaton=''
502 d_int64_t=''
503 d_isascii=''
504 d_isfinite=''
505 d_isinf=''
506 d_isnan=''
507 d_isnanl=''
508 d_killpg=''
509 d_lchown=''
510 d_ldbl_dig=''
511 d_link=''
512 d_localtime_r=''
513 localtime_r_proto=''
514 d_locconv=''
515 d_lockf=''
516 d_longdbl=''
517 longdblsize=''
518 d_longlong=''
519 longlongsize=''
520 d_lseekproto=''
521 d_lstat=''
522 d_madvise=''
523 d_mblen=''
524 d_mbstowcs=''
525 d_mbtowc=''
526 d_memchr=''
527 d_memcmp=''
528 d_memcpy=''
529 d_memmove=''
530 d_memset=''
531 d_mkdir=''
532 d_mkdtemp=''
533 d_mkfifo=''
534 d_mkstemp=''
535 d_mkstemps=''
536 d_mktime=''
537 d_mmap=''
538 mmaptype=''
539 d_modfl=''
540 d_modfl_pow32_bug=''
541 d_mprotect=''
542 d_msg=''
543 d_msgctl=''
544 d_msgget=''
545 d_msghdr_s=''
546 d_msgrcv=''
547 d_msgsnd=''
548 d_msync=''
549 d_munmap=''
550 d_nice=''
551 d_nl_langinfo=''
552 d_off64_t=''
553 d_open3=''
554 d_fpathconf=''
555 d_pathconf=''
556 d_pause=''
557 d_pipe=''
558 d_poll=''
559 d_portable=''
560 d_procselfexe=''
561 procselfexe=''
562 d_old_pthread_create_joinable=''
563 old_pthread_create_joinable=''
564 d_pthread_atfork=''
565 d_pthread_yield=''
566 d_sched_yield=''
567 sched_yield=''
568 d_qgcvt=''
569 d_random_r=''
570 random_r_proto=''
571 d_readdir64_r=''
572 readdir64_r_proto=''
573 d_readdir=''
574 d_rewinddir=''
575 d_seekdir=''
576 d_telldir=''
577 d_readdir_r=''
578 readdir_r_proto=''
579 d_readlink=''
580 d_readv=''
581 d_recvmsg=''
582 d_rename=''
583 d_rmdir=''
584 d_safebcpy=''
585 d_safemcpy=''
586 d_sanemcmp=''
587 d_sbrkproto=''
588 d_select=''
589 d_sem=''
590 d_semctl=''
591 d_semget=''
592 d_semop=''
593 d_sendmsg=''
594 d_setegid=''
595 d_seteuid=''
596 d_setgrent=''
597 d_setgrent_r=''
598 setgrent_r_proto=''
599 d_setgrps=''
600 d_sethent=''
601 d_sethostent_r=''
602 sethostent_r_proto=''
603 d_setitimer=''
604 d_setlinebuf=''
605 d_setlocale=''
606 d_setlocale_r=''
607 setlocale_r_proto=''
608 d_setnent=''
609 d_setnetent_r=''
610 setnetent_r_proto=''
611 d_setpent=''
612 d_setpgid=''
613 d_setpgrp2=''
614 d_bsdsetpgrp=''
615 d_setpgrp=''
616 d_setprior=''
617 d_setproctitle=''
618 d_setprotoent_r=''
619 setprotoent_r_proto=''
620 d_setpwent=''
621 d_setpwent_r=''
622 setpwent_r_proto=''
623 d_setregid=''
624 d_setresgid=''
625 d_setresuid=''
626 d_setreuid=''
627 d_setrgid=''
628 d_setruid=''
629 d_setsent=''
630 d_setservent_r=''
631 setservent_r_proto=''
632 d_setsid=''
633 d_setvbuf=''
634 d_sfio=''
635 usesfio=''
636 d_shm=''
637 d_shmat=''
638 d_shmatprototype=''
639 shmattype=''
640 d_shmctl=''
641 d_shmdt=''
642 d_shmget=''
643 d_sigaction=''
644 d_sigprocmask=''
645 d_sigsetjmp=''
646 d_sockatmark=''
647 d_sockatmarkproto=''
648 d_msg_ctrunc=''
649 d_msg_dontroute=''
650 d_msg_oob=''
651 d_msg_peek=''
652 d_msg_proxy=''
653 d_oldsock=''
654 d_scm_rights=''
655 d_socket=''
656 d_sockpair=''
657 sockethdr=''
658 socketlib=''
659 d_socklen_t=''
660 d_socks5_init=''
661 d_sqrtl=''
662 d_srand48_r=''
663 srand48_r_proto=''
664 d_srandom_r=''
665 srandom_r_proto=''
666 d_sresgproto=''
667 d_sresuproto=''
668 d_statblks=''
669 d_statfs_f_flags=''
670 d_statfs_s=''
671 d_fstatvfs=''
672 d_statvfs=''
673 d_stdio_cnt_lval=''
674 d_stdio_ptr_lval=''
675 d_stdio_ptr_lval_nochange_cnt=''
676 d_stdio_ptr_lval_sets_cnt=''
677 d_stdiobase=''
678 d_stdstdio=''
679 stdio_base=''
680 stdio_bufsiz=''
681 stdio_cnt=''
682 stdio_filbuf=''
683 stdio_ptr=''
684 d_index=''
685 d_strchr=''
686 d_strcoll=''
687 d_strctcpy=''
688 d_strerrm=''
689 d_strerror=''
690 d_sysernlst=''
691 d_syserrlst=''
692 d_strerror_r=''
693 strerror_r_proto=''
694 d_strftime=''
695 d_strtod=''
696 d_strtol=''
697 d_strtold=''
698 d_strtoll=''
699 d_strtoq=''
700 d_strtoul=''
701 d_strtoull=''
702 d_strtouq=''
703 d_strxfrm=''
704 d_symlink=''
705 d_syscall=''
706 d_syscallproto=''
707 d_sysconf=''
708 d_system=''
709 d_tcgetpgrp=''
710 d_tcsetpgrp=''
711 d_telldirproto=''
712 d_time=''
713 timetype=''
714 clocktype=''
715 d_times=''
716 d_tmpnam_r=''
717 tmpnam_r_proto=''
718 d_truncate=''
719 d_ttyname_r=''
720 ttyname_r_proto=''
721 d_tzname=''
722 d_u32align=''
723 d_ualarm=''
724 d_umask=''
725 d_semctl_semid_ds=''
726 d_semctl_semun=''
727 d_union_semun=''
728 d_unordered=''
729 d_usleep=''
730 d_usleepproto=''
731 d_ustat=''
732 d_vfork=''
733 usevfork=''
734 d_voidsig=''
735 signal_t=''
736 d_volatile=''
737 d_charvspr=''
738 d_vprintf=''
739 d_wait4=''
740 d_waitpid=''
741 d_wcstombs=''
742 d_wctomb=''
743 d_writev=''
744 dlext=''
745 cccdlflags=''
746 ccdlflags=''
747 dlsrc=''
748 ld=''
749 lddlflags=''
750 usedl=''
751 doublesize=''
752 ebcdic=''
753 fflushNULL=''
754 fflushall=''
755 fpossize=''
756 fpostype=''
757 gccosandvers=''
758 gccversion=''
759 gidformat=''
760 gidsign=''
761 gidsize=''
762 gidtype=''
763 groupstype=''
764 h_fcntl=''
765 h_sysfile=''
766 i_arpainet=''
767 i_crypt=''
768 db_hashtype=''
769 db_prefixtype=''
770 db_version_major=''
771 db_version_minor=''
772 db_version_patch=''
773 i_db=''
774 i_dbm=''
775 i_rpcsvcdbm=''
776 d_dirnamlen=''
777 direntrytype=''
778 i_dirent=''
779 i_dld=''
780 i_dlfcn=''
781 i_fcntl=''
782 i_float=''
783 i_fp=''
784 i_fp_class=''
785 i_gdbm=''
786 d_grpasswd=''
787 i_grp=''
788 i_ieeefp=''
789 i_inttypes=''
790 i_langinfo=''
791 i_libutil=''
792 i_limits=''
793 i_locale=''
794 i_machcthr=''
795 i_malloc=''
796 i_math=''
797 i_memory=''
798 i_mntent=''
799 i_ndbm=''
800 i_netdb=''
801 i_neterrno=''
802 i_netinettcp=''
803 i_niin=''
804 i_sysin=''
805 i_poll=''
806 i_prot=''
807 i_pthread=''
808 d_pwage=''
809 d_pwchange=''
810 d_pwclass=''
811 d_pwcomment=''
812 d_pwexpire=''
813 d_pwgecos=''
814 d_pwpasswd=''
815 d_pwquota=''
816 i_pwd=''
817 i_sfio=''
818 i_shadow=''
819 i_socks=''
820 i_stddef=''
821 i_stdlib=''
822 i_string=''
823 strings=''
824 i_sunmath=''
825 i_sysaccess=''
826 i_sysdir=''
827 i_sysfile=''
828 d_voidtty=''
829 i_bsdioctl=''
830 i_sysfilio=''
831 i_sysioctl=''
832 i_syssockio=''
833 i_syslog=''
834 i_sysmman=''
835 i_sysmode=''
836 i_sysmount=''
837 i_sysndir=''
838 i_sysparam=''
839 i_sysresrc=''
840 i_syssecrt=''
841 i_sysselct=''
842 i_sysstat=''
843 i_sysstatfs=''
844 i_sysstatvfs=''
845 i_systimes=''
846 i_systypes=''
847 i_sysuio=''
848 i_sysun=''
849 i_sysutsname=''
850 i_sysvfs=''
851 i_syswait=''
852 i_sgtty=''
853 i_termio=''
854 i_termios=''
855 d_tm_tm_gmtoff=''
856 d_tm_tm_zone=''
857 i_systime=''
858 i_systimek=''
859 i_time=''
860 timeincl=''
861 i_unistd=''
862 i_ustat=''
863 i_utime=''
864 i_values=''
865 i_stdarg=''
866 i_varargs=''
867 i_varhdr=''
868 i_vfork=''
869 inc_version_list=''
870 inc_version_list_init=''
871 installprefix=''
872 installprefixexp=''
873 installstyle=''
874 installusrbinperl=''
875 intsize=''
876 longsize=''
877 shortsize=''
878 issymlink=''
879 libc=''
880 ldlibpthname=''
881 libperl=''
882 shrpenv=''
883 useshrplib=''
884 glibpth=''
885 libpth=''
886 loclibpth=''
887 plibpth=''
888 xlibpth=''
889 ignore_versioned_solibs=''
890 libs=''
891 libsdirs=''
892 libsfiles=''
893 libsfound=''
894 libspath=''
895 lns=''
896 d_PRIEUldbl=''
897 d_PRIFUldbl=''
898 d_PRIGUldbl=''
899 d_PRIeldbl=''
900 d_PRIfldbl=''
901 d_PRIgldbl=''
902 d_SCNfldbl=''
903 sPRIEUldbl=''
904 sPRIFUldbl=''
905 sPRIGUldbl=''
906 sPRIeldbl=''
907 sPRIfldbl=''
908 sPRIgldbl=''
909 sSCNfldbl=''
910 lseeksize=''
911 lseektype=''
912 make_set_make=''
913 d_mymalloc=''
914 freetype=''
915 mallocobj=''
916 mallocsrc=''
917 malloctype=''
918 usemymalloc=''
919 installman1dir=''
920 man1dir=''
921 man1direxp=''
922 man1ext=''
923 installman3dir=''
924 man3dir=''
925 man3direxp=''
926 man3ext=''
927 modetype=''
928 multiarch=''
929 mydomain=''
930 myhostname=''
931 phostname=''
932 c=''
933 n=''
934 d_eofnblk=''
935 eagain=''
936 o_nonblock=''
937 rd_nodata=''
938 need_va_copy=''
939 netdb_hlen_type=''
940 netdb_host_type=''
941 netdb_name_type=''
942 netdb_net_type=''
943 groupcat=''
944 hostcat=''
945 passcat=''
946 orderlib=''
947 ranlib=''
948 d_perl_otherlibdirs=''
949 otherlibdirs=''
950 package=''
951 spackage=''
952 pager=''
953 api_revision=''
954 api_subversion=''
955 api_version=''
956 api_versionstring=''
957 patchlevel=''
958 perl_patchlevel=''
959 revision=''
960 subversion=''
961 version=''
962 version_patchlevel_string=''
963 perl5=''
964 perladmin=''
965 perlpath=''
966 d_nv_preserves_uv=''
967 i16size=''
968 i16type=''
969 i32size=''
970 i32type=''
971 i64size=''
972 i64type=''
973 i8size=''
974 i8type=''
975 ivsize=''
976 ivtype=''
977 nv_preserves_uv_bits=''
978 nvsize=''
979 nvtype=''
980 u16size=''
981 u16type=''
982 u32size=''
983 u32type=''
984 u64size=''
985 u64type=''
986 u8size=''
987 u8type=''
988 uvsize=''
989 uvtype=''
990 ivdformat=''
991 nvEUformat=''
992 nvFUformat=''
993 nvGUformat=''
994 nveformat=''
995 nvfformat=''
996 nvgformat=''
997 uvXUformat=''
998 uvoformat=''
999 uvuformat=''
1000 uvxformat=''
1001 pidtype=''
1002 prefix=''
1003 prefixexp=''
1004 installprivlib=''
1005 privlib=''
1006 privlibexp=''
1007 prototype=''
1008 ptrsize=''
1009 d_PRIXU64=''
1010 d_PRId64=''
1011 d_PRIi64=''
1012 d_PRIo64=''
1013 d_PRIu64=''
1014 d_PRIx64=''
1015 sPRIXU64=''
1016 sPRId64=''
1017 sPRIi64=''
1018 sPRIo64=''
1019 sPRIu64=''
1020 sPRIx64=''
1021 d_quad=''
1022 quadkind=''
1023 quadtype=''
1024 uquadtype=''
1025 drand01=''
1026 randbits=''
1027 randfunc=''
1028 randseedtype=''
1029 seedfunc=''
1030 installscript=''
1031 scriptdir=''
1032 scriptdirexp=''
1033 selectminbits=''
1034 selecttype=''
1035 sh=''
1036 sig_count=''
1037 sig_name=''
1038 sig_name_init=''
1039 sig_num=''
1040 sig_num_init=''
1041 sig_size=''
1042 installsitearch=''
1043 sitearch=''
1044 sitearchexp=''
1045 installsitebin=''
1046 sitebin=''
1047 sitebinexp=''
1048 installsitelib=''
1049 sitelib=''
1050 sitelib_stem=''
1051 sitelibexp=''
1052 siteprefix=''
1053 siteprefixexp=''
1054 sizesize=''
1055 sizetype=''
1056 so=''
1057 socksizetype=''
1058 sharpbang=''
1059 shsharp=''
1060 spitshell=''
1061 src=''
1062 ssizetype=''
1063 startperl=''
1064 startsh=''
1065 stdchar=''
1066 d_stdio_stream_array=''
1067 stdio_stream_array=''
1068 sysman=''
1069 trnl=''
1070 uidformat=''
1071 uidsign=''
1072 uidsize=''
1073 uidtype=''
1074 archname64=''
1075 use64bitall=''
1076 use64bitint=''
1077 ccflags_uselargefiles=''
1078 ldflags_uselargefiles=''
1079 libswanted_uselargefiles=''
1080 uselargefiles=''
1081 uselongdouble=''
1082 usemorebits=''
1083 usemultiplicity=''
1084 nm_opt=''
1085 nm_so_opt=''
1086 runnm=''
1087 usenm=''
1088 useperlio=''
1089 usesocks=''
1090 d_oldpthreads=''
1091 use5005threads=''
1092 useithreads=''
1093 usereentrant=''
1094 usethreads=''
1095 incpath=''
1096 mips_type=''
1097 usrinc=''
1098 d_vendorarch=''
1099 installvendorarch=''
1100 vendorarch=''
1101 vendorarchexp=''
1102 d_vendorbin=''
1103 installvendorbin=''
1104 vendorbin=''
1105 vendorbinexp=''
1106 d_vendorlib=''
1107 installvendorlib=''
1108 vendorlib=''
1109 vendorlib_stem=''
1110 vendorlibexp=''
1111 usevendorprefix=''
1112 vendorprefix=''
1113 vendorprefixexp=''
1114 versiononly=''
1115 defvoidused=''
1116 voidflags=''
1117 pm_apiversion=''
1118 xs_apiversion=''
1119 yacc=''
1120 yaccflags=''
1121 CONFIG=''
1122
1123 define='define'
1124 undef='undef'
1125 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1126 rmlist=''
1127
1128 : We must find out about Eunice early
1129 eunicefix=':'
1130 if test -f /etc/unixtovms; then
1131         eunicefix=/etc/unixtovms
1132 fi
1133 if test -f /etc/unixtovms.exe; then
1134         eunicefix=/etc/unixtovms.exe
1135 fi
1136
1137 : Set executable suffix now -- needed before hints available
1138 if test -f "/libs/version.library"; then
1139 : Amiga OS
1140     _exe=""
1141 elif test -f "/system/gnu_library/bin/ar.pm"; then
1142 : Stratus VOS
1143     _exe=".pm"
1144 elif test -n "$DJGPP"; then
1145 : DOS DJGPP
1146     _exe=".exe"
1147 elif test -d c:/. ; then
1148 : OS/2 or cygwin
1149     _exe=".exe"
1150 fi
1151
1152 i_whoami=''
1153 ccname=''
1154 ccversion=''
1155 perllibs=''
1156 : set useposix=false in your hint file to disable the POSIX extension.
1157 useposix=true
1158 : set useopcode=false in your hint file to disable the Opcode extension.
1159 useopcode=true
1160 : Trailing extension.  Override this in a hint file, if needed.
1161 : Extra object files, if any, needed on this platform.
1162 archobjs=''
1163 archname=''
1164 : Possible local include directories to search.
1165 : Set locincpth to "" in a hint file to defeat local include searches.
1166 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1167 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1168 :
1169 : no include file wanted by default
1170 inclwanted=''
1171
1172 groupstype=''
1173 libnames=''
1174 : change the next line if compiling for Xenix/286 on Xenix/386
1175 xlibpth='/usr/lib/386 /lib/386'
1176 : Possible local library directories to search.
1177 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1178 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1179
1180 : general looking path for locating libraries
1181 glibpth="/lib /usr/lib $xlibpth"
1182 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1183 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1184 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1185
1186 : Private path used by Configure to find libraries.  Its value
1187 : is prepended to libpth. This variable takes care of special
1188 : machines, like the mips.  Usually, it should be empty.
1189 plibpth=''
1190
1191 : default library list
1192 libswanted=''
1193 : some systems want to use only the non-versioned libso:s
1194 ignore_versioned_solibs=''
1195 archname64=''
1196 ccflags_uselargefiles=''
1197 ldflags_uselargefiles=''
1198 libswanted_uselargefiles=''
1199 : set usemultiplicity on the Configure command line to enable multiplicity.
1200 : set usesocks on the Configure command line to enable socks.
1201 : set usethreads on the Configure command line to enable threads.
1202 usereentrant='undef'
1203 : full support for void wanted by default
1204 defvoidused=15
1205
1206 : List of libraries we want.
1207 : If anyone needs -lnet, put it in a hint file.
1208 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1209 libswanted="$libswanted dld ld sun m c cposix posix"
1210 libswanted="$libswanted ndir dir crypt sec"
1211 libswanted="$libswanted ucb bsd BSD PW x util"
1212 : We probably want to search /usr/shlib before most other libraries.
1213 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1214 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1215 glibpth="/usr/shlib $glibpth"
1216 : Do not use vfork unless overridden by a hint file.
1217 usevfork=false
1218
1219 : Find the basic shell for Bourne shell scripts
1220 case "$sh" in
1221 '')
1222         case "$SYSTYPE" in
1223         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1224         *) xxx='/bin/sh';;
1225         esac
1226         if test -f "$xxx"; then
1227                 sh="$xxx"
1228         else
1229                 : Build up a list and do a single loop so we can 'break' out.
1230                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1231                 for xxx in sh bash ksh pdksh ash; do
1232                         for p in $pth; do
1233                                 try="$try ${p}/${xxx}"
1234                         done
1235                 done
1236                 for xxx in $try; do
1237                         if test -f "$xxx"; then
1238                                 sh="$xxx";
1239                                 break
1240                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1241                                 sh="$xxx";
1242                                 break
1243                         elif test -f "$xxx.exe"; then
1244                                 sh="$xxx";
1245                                 break
1246                         fi
1247                 done
1248         fi
1249         ;;
1250 esac
1251
1252 case "$sh" in
1253 '')     cat >&2 <<EOM
1254 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1255
1256 Usually it's in /bin/sh.  How did you even get this far?
1257 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1258 we'll try to straighten this all out.
1259 EOM
1260         exit 1
1261         ;;
1262 esac
1263
1264 : see if sh knows # comments
1265 if `$sh -c '#' >/dev/null 2>&1`; then
1266         shsharp=true
1267         spitshell=cat
1268         xcat=/bin/cat
1269         test -f $xcat$_exe || xcat=/usr/bin/cat
1270         if test ! -f $xcat$_exe; then
1271                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1272                         if test -f $p/cat$_exe; then
1273                                 xcat=$p/cat
1274                                 break
1275                         fi
1276                 done
1277                 if test ! -f $xcat$_exe; then
1278                         echo "Can't find cat anywhere!"
1279                         exit 1
1280                 fi
1281         fi
1282         echo "#!$xcat" >sharp
1283         $eunicefix sharp
1284         chmod +x sharp
1285         ./sharp > today
1286         if test -s today; then
1287                 sharpbang='#!'
1288         else
1289                 echo "#! $xcat" > sharp
1290                 $eunicefix sharp
1291                 chmod +x sharp
1292                 ./sharp > today
1293                 if test -s today; then
1294                         sharpbang='#! '
1295                 else
1296                         sharpbang=': use '
1297                 fi
1298         fi
1299 else
1300         echo " "
1301         echo "Your $sh doesn't grok # comments--I will strip them later on."
1302         shsharp=false
1303         cd ..
1304         echo "exec grep -v '^[  ]*#'" >spitshell
1305         chmod +x spitshell
1306         $eunicefix spitshell
1307         spitshell=`pwd`/spitshell
1308         cd UU
1309         echo "I presume that if # doesn't work, #! won't work either!"
1310         sharpbang=': use '
1311 fi
1312 rm -f sharp today
1313
1314 : figure out how to guarantee sh startup
1315 case "$startsh" in
1316 '') startsh=${sharpbang}${sh} ;;
1317 *)
1318 esac
1319 cat >sharp <<EOSS
1320 $startsh
1321 set abc
1322 test "$?abc" != 1
1323 EOSS
1324
1325 chmod +x sharp
1326 $eunicefix sharp
1327 if ./sharp; then
1328         : echo "Yup, it does."
1329 else
1330         echo "Hmm... '$startsh' does not guarantee sh startup..."
1331         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1332 fi
1333 rm -f sharp
1334
1335
1336 : Save command line options in file UU/cmdline.opt for later use in
1337 : generating config.sh.
1338 cat > cmdline.opt <<EOSH
1339 # Configure command line arguments.
1340 config_arg0='$0'
1341 config_args='$*'
1342 config_argc=$#
1343 EOSH
1344 argn=1
1345 args_exp=''
1346 args_sep=''
1347 for arg in "$@"; do
1348         cat >>cmdline.opt <<EOSH
1349 config_arg$argn='$arg'
1350 EOSH
1351         # Extreme backslashitis: replace each ' by '"'"'
1352         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1353 $arg
1354 EOC
1355         arg_exp=`cat cmdl.opt`
1356         args_exp="$args_exp$args_sep'$arg_exp'"
1357         argn=`expr $argn + 1`
1358         args_sep=' '
1359 done
1360 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1361 # used by ./hints/os2.sh
1362 rm -f cmdl.opt
1363
1364 : produce awk script to parse command line options
1365 cat >options.awk <<'EOF'
1366 BEGIN {
1367         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1368
1369         len = length(optstr);
1370         for (i = 1; i <= len; i++) {
1371                 c = substr(optstr, i, 1);
1372                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1373                 if (a == ":") {
1374                         arg[c] = 1;
1375                         i++;
1376                 }
1377                 opt[c] = 1;
1378         }
1379 }
1380 {
1381         expect = 0;
1382         str = $0;
1383         if (substr(str, 1, 1) != "-") {
1384                 printf("'%s'\n", str);
1385                 next;
1386         }
1387         len = length($0);
1388         for (i = 2; i <= len; i++) {
1389                 c = substr(str, i, 1);
1390                 if (!opt[c]) {
1391                         printf("-%s\n", substr(str, i));
1392                         next;
1393                 }
1394                 printf("-%s\n", c);
1395                 if (arg[c]) {
1396                         if (i < len)
1397                                 printf("'%s'\n", substr(str, i + 1));
1398                         else
1399                                 expect = 1;
1400                         next;
1401                 }
1402         }
1403 }
1404 END {
1405         if (expect)
1406                 print "?";
1407 }
1408 EOF
1409
1410 : process the command line options
1411 set X `for arg in "$@"; do echo "X$arg"; done |
1412         sed -e s/X// | awk -f options.awk`
1413 eval "set $*"
1414 shift
1415 rm -f options.awk
1416
1417 : set up default values
1418 fastread=''
1419 reuseval=false
1420 config_sh=''
1421 alldone=''
1422 error=''
1423 silent=''
1424 extractsh=''
1425 override=''
1426 knowitall=''
1427 rm -f optdef.sh posthint.sh
1428 cat >optdef.sh <<EOS
1429 $startsh
1430 EOS
1431
1432
1433 : option parsing
1434 while test $# -gt 0; do
1435         case "$1" in
1436         -d) shift; fastread=yes;;
1437         -e) shift; alldone=cont;;
1438         -f)
1439                 shift
1440                 cd ..
1441                 if test -r "$1"; then
1442                         config_sh="$1"
1443                 else
1444                         echo "$me: cannot read config file $1." >&2
1445                         error=true
1446                 fi
1447                 cd UU
1448                 shift;;
1449         -h) shift; error=true;;
1450         -r) shift; reuseval=true;;
1451         -s) shift; silent=true; realsilent=true;;
1452         -E) shift; alldone=exit;;
1453         -K) shift; knowitall=true;;
1454         -O) shift; override=true;;
1455         -S) shift; silent=true; extractsh=true;;
1456         -D)
1457                 shift
1458                 case "$1" in
1459                 *=)
1460                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1461                         echo "$me: ignoring -D $1" >&2
1462                         ;;
1463                 *=*) echo "$1" | \
1464                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1465                 *) echo "$1='define'" >> optdef.sh;;
1466                 esac
1467                 shift
1468                 ;;
1469         -U)
1470                 shift
1471                 case "$1" in
1472                 *=) echo "$1" >> optdef.sh;;
1473                 *=*)
1474                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1475                         echo "$me: ignoring -U $1" >&2
1476                         ;;
1477                 *) echo "$1='undef'" >> optdef.sh;;
1478                 esac
1479                 shift
1480                 ;;
1481         -A)
1482             shift
1483             xxx=''
1484             yyy="$1"
1485             zzz=''
1486             uuu=undef
1487             case "$yyy" in
1488             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1489                  case "$zzz" in
1490                  *:*) zzz='' ;;
1491                  *)   xxx=append
1492                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1493                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1494                  esac
1495                  ;;
1496             esac
1497             case "$xxx" in
1498             '')  case "$yyy" in
1499                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1500                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1501                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1502                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1503                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1504                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1505                  esac
1506                  ;;       
1507             esac
1508             case "$xxx" in
1509             append)
1510                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1511             clear)
1512                 echo "$yyy=''"                  >> posthint.sh ;;
1513             define)
1514                 case "$zzz" in
1515                 '') zzz=define ;;
1516                 esac
1517                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1518             eval)
1519                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1520             prepend)
1521                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1522             undef)
1523                 case "$zzz" in
1524                 '') zzz="$uuu" ;;
1525                 esac
1526                 echo "$yyy=$zzz"                >> posthint.sh ;;
1527             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1528             esac
1529             shift
1530             ;;
1531         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1532             exit 0;;
1533         --) break;;
1534         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1535         *) break;;
1536         esac
1537 done
1538
1539 case "$error" in
1540 true)
1541         cat >&2 <<EOM
1542 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1543                  [-U symbol] [-U symbol=] [-A command:symbol...]
1544   -d : use defaults for all answers.
1545   -e : go on without questioning past the production of config.sh.
1546   -f : specify an alternate default configuration file.
1547   -h : print this help message and exit (with an error status).
1548   -r : reuse C symbols value if possible (skips costly nm extraction).
1549   -s : silent mode, only echoes questions and essential information.
1550   -D : define symbol to have some value:
1551          -D symbol         symbol gets the value 'define'
1552          -D symbol=value   symbol gets the value 'value'
1553   -E : stop at the end of questions, after having produced config.sh.
1554   -K : do not use unless you know what you are doing.
1555   -O : let -D and -U override definitions from loaded configuration file.
1556   -S : perform variable substitutions on all .SH files (can mix with -f)
1557   -U : undefine symbol:
1558          -U symbol    symbol gets the value 'undef'
1559          -U symbol=   symbol gets completely empty
1560   -A : manipulate symbol after the platform specific hints have been applied:
1561          -A symbol=value                append " "value to symbol
1562          -A append:symbol=value         append value to symbol
1563          -A define:symbol=value         define symbol to have value
1564          -A clear:symbol                define symbol to be ''
1565          -A define:symbol               define symbol to be 'define'
1566          -A eval:symbol=value           define symbol to be eval of value
1567          -A prepend:symbol=value        prepend value to symbol
1568          -A undef:symbol                define symbol to be 'undef'
1569          -A undef:symbol=               define symbol to be ''
1570   -V : print version number and exit (with a zero status).
1571 EOM
1572         exit 1
1573         ;;
1574 esac
1575
1576 : Sanity checks
1577 case "$fastread$alldone" in
1578 yescont|yesexit) ;;
1579 *)
1580         case "$extractsh" in
1581         true) ;;
1582         *)
1583                 if test ! -t 0; then
1584                         echo "Say 'sh Configure', not 'sh <Configure'"
1585                         exit 1
1586                 fi
1587                 ;;
1588         esac
1589         ;;
1590 esac
1591
1592 exec 4>&1
1593 case "$silent" in
1594 true) exec 1>/dev/null;;
1595 esac
1596
1597 : run the defines and the undefines, if any, but leave the file out there...
1598 touch optdef.sh
1599 . ./optdef.sh
1600 : create the posthint manipulation script and leave the file out there...
1601 touch posthint.sh
1602
1603 : set package name
1604 package=perl5
1605 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1606 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1607 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1608 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1609 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1610 esac
1611
1612 : Some greps do not return status, grrr.
1613 echo "grimblepritz" >grimble
1614 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1615         contains=contains
1616 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1617         contains=grep
1618 else
1619         contains=contains
1620 fi
1621 rm -f grimble
1622 : the following should work in any shell
1623 case "$contains" in
1624 contains*)
1625         echo " "
1626         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1627         cat >contains <<'EOSS'
1628 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1629 EOSS
1630 chmod +x contains
1631 esac
1632
1633 : Find the path to the source tree
1634 case "$src" in
1635 '') case "$0" in
1636     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1637          case "$src" in
1638          /*)    ;;
1639          .)     ;;
1640          *)     src=`cd ../$src && pwd` ;;
1641          esac
1642          ;;
1643     *)   src='.';;
1644     esac;;
1645 esac
1646 case "$src" in
1647 '')     src=/
1648         rsrc=/
1649         ;;
1650 /*) rsrc="$src";;
1651 *) rsrc="../$src";;
1652 esac
1653 if test -f $rsrc/Configure && \
1654         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1655 then
1656    : found it, so we are ok.
1657 else
1658         rsrc=''
1659         for src in . .. ../.. ../../.. ../../../..; do
1660                 if test -f ../$src/Configure && \
1661                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1662                 then
1663                         rsrc=../$src
1664                         break
1665                 fi
1666         done
1667 fi
1668 case "$rsrc" in
1669 '')
1670         cat <<EOM >&4
1671
1672 Sorry, I can't seem to locate the source dir for $package.  Please start
1673 Configure with an explicit path -- i.e. /some/path/Configure.
1674
1675 EOM
1676         exit 1
1677         ;;
1678 ../.)   rsrc='..';;
1679 *)
1680         echo " "
1681         echo "Sources for $package found in \"$src\"." >&4
1682         ;;
1683 esac
1684
1685 : script used to extract .SH files with variable substitutions
1686 cat >extract <<'EOS'
1687 PERL_CONFIG_SH=true
1688 echo "Doing variable substitutions on .SH files..."
1689 if test -f MANIFEST; then
1690         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1691 else
1692         echo "(Looking for .SH files under the source directory.)"
1693         set x `(cd "$src"; find . -name "*.SH" -print)`
1694 fi
1695 shift
1696 case $# in
1697 0) set x `(cd "$src"; echo *.SH)`; shift;;
1698 esac
1699 if test ! -f "$src/$1"; then
1700         shift
1701 fi
1702 mkdir_p='
1703 name=$1;
1704 create="";
1705 while test $name; do
1706         if test ! -d "$name"; then
1707                 create="$name $create";
1708                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1709                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1710         else
1711                 name="";
1712         fi;
1713 done;
1714 for file in $create; do
1715         mkdir $file;
1716 done
1717 '
1718 for file in $*; do
1719         case "$src" in
1720         ".")
1721                 case "$file" in
1722                 */*)
1723                         dir=`expr X$file : 'X\(.*\)/'`
1724                         file=`expr X$file : 'X.*/\(.*\)'`
1725                         (cd "$dir" && . ./$file)
1726                         ;;
1727                 *)
1728                         . ./$file
1729                         ;;
1730                 esac
1731                 ;;
1732         *)
1733                 case "$file" in
1734                 */*)
1735                         dir=`expr X$file : 'X\(.*\)/'`
1736                         file=`expr X$file : 'X.*/\(.*\)'`
1737                         (set x $dir; shift; eval $mkdir_p)
1738                         sh <"$src/$dir/$file"
1739                         ;;
1740                 *)
1741                         sh <"$src/$file"
1742                         ;;
1743                 esac
1744                 ;;
1745         esac
1746 done
1747 if test -f "$src/config_h.SH"; then
1748         if test ! -f config.h; then
1749         : oops, they left it out of MANIFEST, probably, so do it anyway.
1750         . "$src/config_h.SH"
1751         fi
1752 fi
1753 EOS
1754
1755 : extract files and exit if asked to do so
1756 case "$extractsh" in
1757 true)
1758         case "$realsilent" in
1759         true) ;;
1760         *) exec 1>&4;;
1761         esac
1762         case "$config_sh" in
1763         '') config_sh='config.sh';;
1764         esac
1765         echo " "
1766         echo "Fetching answers from $config_sh..."
1767         cd ..
1768         . $config_sh
1769         test "$override" && . ./optdef.sh
1770         echo " "
1771         . UU/extract
1772         rm -rf UU
1773         echo "Extraction done."
1774         exit 0
1775         ;;
1776 esac
1777
1778 : Eunice requires " " instead of "", can you believe it
1779 echo " "
1780 : Here we go...
1781 echo "Beginning of configuration questions for $package."
1782
1783 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1784
1785 : first determine how to suppress newline on echo command
1786 echo " "
1787 echo "Checking echo to see how to suppress newlines..."
1788 (echo "hi there\c" ; echo " ") >.echotmp
1789 if $contains c .echotmp >/dev/null 2>&1 ; then
1790         echo "...using -n."
1791         n='-n'
1792         c=''
1793 else
1794         cat <<'EOM'
1795 ...using \c
1796 EOM
1797         n=''
1798         c='\c'
1799 fi
1800 echo $n "The star should be here-->$c"
1801 echo '*'
1802 rm -f .echotmp
1803
1804 : Now test for existence of everything in MANIFEST
1805 echo " "
1806 if test -f "$rsrc/MANIFEST"; then
1807         echo "First let's make sure your kit is complete.  Checking..." >&4
1808         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1809         rm -f missing
1810         tmppwd=`pwd`
1811         for filelist in x??; do
1812                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1813         done
1814         if test -s missing; then
1815                 cat missing >&4
1816                 cat >&4 <<'EOM'
1817
1818 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1819
1820 You have the option of continuing the configuration process, despite the
1821 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1822 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1823 and contact the author (perlbug@perl.org).
1824
1825 EOM
1826                 echo $n "Continue? [n] $c" >&4
1827                 read ans
1828                 case "$ans" in
1829                 y*)
1830                         echo "Continuing..." >&4
1831                         rm -f missing
1832                         ;;
1833                 *)
1834                         echo "ABORTING..." >&4
1835                         kill $$
1836                         ;;
1837                 esac
1838         else
1839                 echo "Looks good..."
1840         fi
1841 else
1842         echo "There is no MANIFEST file.  I hope your kit is complete !"
1843 fi
1844 rm -f missing x??
1845
1846 echo " "
1847 : Find the appropriate value for a newline for tr
1848 if test -n "$DJGPP"; then
1849        trnl='\012'
1850 fi
1851 if test X"$trnl" = X; then
1852         case "`echo foo|tr '\n' x 2>/dev/null`" in
1853         foox) trnl='\n' ;;
1854         esac
1855 fi
1856 if test X"$trnl" = X; then
1857         case "`echo foo|tr '\012' x 2>/dev/null`" in
1858         foox) trnl='\012' ;;
1859         esac
1860 fi
1861 if test X"$trnl" = X; then
1862        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1863        fooxy) trnl='\n\r' ;;
1864        esac
1865 fi
1866 if test X"$trnl" = X; then
1867         cat <<EOM >&2
1868
1869 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1870
1871 EOM
1872         exit 1
1873 fi
1874
1875 : compute the number of columns on the terminal for proper question formatting
1876 case "$COLUMNS" in
1877 '') COLUMNS='80';;
1878 esac
1879
1880 : set up the echo used in my read
1881 myecho="case \"\$xxxm\" in
1882 '') echo $n \"\$rp $c\" >&4;;
1883 *) case \"\$rp\" in
1884         '') echo $n \"[\$xxxm] $c\";;
1885         *)
1886                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1887                         echo \"\$rp\" >&4
1888                         echo $n \"[\$xxxm] $c\" >&4
1889                 else
1890                         echo $n \"\$rp [\$xxxm] $c\" >&4
1891                 fi
1892                 ;;
1893         esac;;
1894 esac"
1895
1896 : now set up to do reads with possible shell escape and default assignment
1897 cat <<EOSC >myread
1898 $startsh
1899 xxxm=\$dflt
1900 $myecho
1901 ans='!'
1902 case "\$fastread" in
1903 yes) case "\$dflt" in
1904         '') ;;
1905         *) ans='';
1906                 case "\$silent-\$rp" in
1907                 true-) ;;
1908                 *) echo " " >&4;;
1909                 esac;;
1910         esac;;
1911 *) case "\$silent" in
1912         true) case "\$rp" in
1913                 '') ans='';;
1914                 esac;;
1915         esac;;
1916 esac
1917 while expr "X\$ans" : "X!" >/dev/null; do
1918         read answ
1919         set x \$xxxm
1920         shift
1921         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1922         case  "\$answ" in
1923         "!")
1924                 sh 1>&4
1925                 echo " "
1926                 $myecho
1927                 ;;
1928         !*)
1929                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1930                 shift
1931                 sh 1>&4 -c "\$*"
1932                 echo " "
1933                 $myecho
1934                 ;;
1935         "\$ans")
1936                 case "\$ans" in
1937                 \\&*)
1938                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1939                         shift
1940                         case "\$1" in
1941                         -d)
1942                                 fastread=yes
1943                                 echo "(OK, I'll run with -d after this question.)" >&4
1944                                 ;;
1945                         -*)
1946                                 echo "*** Sorry, \$1 not supported yet." >&4
1947                                 ;;
1948                         esac
1949                         $myecho
1950                         ans=!
1951                         ;;
1952                 esac;;
1953         *)
1954                 case "\$aok" in
1955                 y)
1956                         echo "*** Substitution done -- please confirm."
1957                         xxxm="\$ans"
1958                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1959                         xxxm="\$ans"
1960                         ans=!
1961                         ;;
1962                 *)
1963                         echo "*** Error -- try again."
1964                         ans=!
1965                         ;;
1966                 esac
1967                 $myecho
1968                 ;;
1969         esac
1970         case "\$ans\$xxxm\$nostick" in
1971         '')
1972                 ans=!
1973                 $myecho
1974                 ;;
1975         esac
1976 done
1977 case "\$ans" in
1978 '') ans="\$xxxm";;
1979 esac
1980 EOSC
1981
1982 : create .config dir to save info across Configure sessions
1983 test -d ../.config || mkdir ../.config
1984 cat >../.config/README <<EOF
1985 This directory created by Configure to save information that should
1986 persist across sessions for $package.
1987
1988 You may safely delete it if you wish.
1989 EOF
1990
1991 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1992 case "$usedevel" in
1993 $define|true|[yY]*) ;;
1994 *) case "$xversion" in
1995    *[13579])
1996         cat >&4 <<EOH
1997 *** WHOA THERE!!! ***
1998
1999     This is an UNSTABLE DEVELOPMENT release.
2000     The version of this $package distribution is $xversion, that is, odd,
2001     (as opposed to even) and that signifies a development release.
2002     If you want a maintenance release, you want an even-numbered version.
2003
2004     Do ***NOT*** install this into production use.
2005     Data corruption and crashes are possible.
2006
2007     It is most seriously suggested that you do not continue any further
2008     unless you want to help in developing and debugging Perl.
2009
2010     If you *still* want to build perl, you can answer 'y' now,
2011     or pass -Dusedevel to Configure.
2012
2013 EOH
2014         rp='Do you really want to continue?'
2015         dflt='n'
2016         . ./myread
2017         case "$ans" in
2018         [yY]) echo >&4 "Okay, continuing."
2019               usedevel="$define" ;;
2020         *) echo >&4 "Okay, bye."
2021            exit 1
2022            ;;
2023         esac
2024         ;;
2025     esac
2026     ;;
2027 esac
2028 case "$usedevel" in
2029 $define|true|[yY]*)
2030         case "$versiononly" in
2031         '') versiononly="$define" ;;
2032         esac
2033         case "$installusrbinperl" in
2034         '') installusrbinperl="$undef" ;;
2035         esac
2036         ;;
2037 esac
2038
2039 : general instructions
2040 needman=true
2041 firsttime=true
2042 user=`(logname) 2>/dev/null`
2043 case "$user" in
2044 '') user=`whoami 2>&1`;;
2045 esac
2046 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2047         firsttime=false
2048         echo " "
2049         rp='Would you like to see the instructions?'
2050         dflt=n
2051         . ./myread
2052         case "$ans" in
2053         [yY]*) ;;
2054         *) needman=false;;
2055         esac
2056 fi
2057 if $needman; then
2058         cat <<EOH
2059
2060 This installation shell script will examine your system and ask you questions
2061 to determine how the perl5 package should be installed. If you get
2062 stuck on a question, you may use a ! shell escape to start a subshell or
2063 execute a command.  Many of the questions will have default answers in square
2064 brackets; typing carriage return will give you the default.
2065
2066 On some of the questions which ask for file or directory names you are allowed
2067 to use the ~name construct to specify the login directory belonging to "name",
2068 even if you don't have a shell which knows about that.  Questions where this is
2069 allowed will be marked "(~name ok)".
2070
2071 EOH
2072         rp=''
2073         dflt='Type carriage return to continue'
2074         . ./myread
2075         cat <<'EOH'
2076
2077 The prompter used in this script allows you to use shell variables and
2078 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2079 in the default answer, as if the default line was a set of arguments given to a
2080 script shell.  This means you may also use $* to repeat the whole default line,
2081 so you do not have to re-type everything to add something to the default.
2082
2083 Everytime there is a substitution, you will have to confirm.  If there is an
2084 error (e.g. an unmatched backtick), the default answer will remain unchanged
2085 and you will be prompted again.
2086
2087 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2088 the questions and use the computed defaults (or the previous answers if there
2089 was already a config.sh file). Type 'Configure -h' for a list of options.
2090 You may also start interactively and then answer '& -d' at any prompt to turn
2091 on the non-interactive behaviour for the remainder of the execution.
2092
2093 EOH
2094         . ./myread
2095         cat <<EOH
2096
2097 Much effort has been expended to ensure that this shell script will run on any
2098 Unix system.  If despite that it blows up on yours, your best bet is to edit
2099 Configure and run it again.  If you can't run Configure for some reason,
2100 you'll have to generate a config.sh file by hand.  Whatever problems you
2101 have, let me (perlbug@perl.org) know how I blew it.
2102
2103 This installation script affects things in two ways:
2104
2105 1) it may do direct variable substitutions on some of the files included
2106    in this kit.
2107 2) it builds a config.h file for inclusion in C programs.  You may edit
2108    any of these files as the need arises after running this script.
2109
2110 If you make a mistake on a question, there is no easy way to back up to it
2111 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2112 files.  Configure will offer to let you do this before it runs the SH files.
2113
2114 EOH
2115         dflt='Type carriage return to continue'
2116         . ./myread
2117         case "$firsttime" in
2118         true) echo $user >>../.config/instruct;;
2119         esac
2120 fi
2121
2122 : find out where common programs are
2123 echo " "
2124 echo "Locating common programs..." >&4
2125 cat <<EOSC >loc
2126 $startsh
2127 case \$# in
2128 0) exit 1;;
2129 esac
2130 thing=\$1
2131 shift
2132 dflt=\$1
2133 shift
2134 for dir in \$*; do
2135         case "\$thing" in
2136         .)
2137         if test -d \$dir/\$thing; then
2138                 echo \$dir
2139                 exit 0
2140         fi
2141         ;;
2142         *)
2143         for thisthing in \$dir/\$thing; do
2144                 : just loop through to pick last item
2145         done
2146         if test -f \$thisthing; then
2147                 echo \$thisthing
2148                 exit 0
2149         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2150                 echo \$thisthing
2151                 exit 0
2152         elif test -f \$dir/\$thing.exe; then
2153                 if test -n "$DJGPP"; then
2154                         echo \$dir/\$thing.exe
2155                 else
2156                         : on Eunice apparently
2157                         echo \$dir/\$thing
2158                 fi
2159                 exit 0
2160         fi
2161         ;;
2162         esac
2163 done
2164 echo \$dflt
2165 exit 1
2166 EOSC
2167 chmod +x loc
2168 $eunicefix loc
2169 loclist="
2170 awk
2171 cat
2172 chmod
2173 comm
2174 cp
2175 echo
2176 expr
2177 grep
2178 ls
2179 mkdir
2180 rm
2181 sed
2182 sort
2183 touch
2184 tr
2185 uniq
2186 "
2187 trylist="
2188 Mcc
2189 ar
2190 bison
2191 byacc
2192 cpp
2193 csh
2194 date
2195 egrep
2196 gmake
2197 gzip
2198 less
2199 ln
2200 make
2201 more
2202 nm
2203 nroff
2204 pg
2205 test
2206 uname
2207 zip
2208 "
2209 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2210 pth="$pth /lib /usr/lib"
2211 for file in $loclist; do
2212         eval xxx=\$$file
2213         case "$xxx" in
2214         /*|?:[\\/]*)
2215                 if test -f "$xxx"; then
2216                         : ok
2217                 else
2218                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2219                         xxx=`./loc $file $file $pth`
2220                 fi
2221                 ;;
2222         '') xxx=`./loc $file $file $pth`;;
2223         *) xxx=`./loc $xxx $xxx $pth`;;
2224         esac
2225         eval $file=$xxx$_exe
2226         eval _$file=$xxx
2227         case "$xxx" in
2228         /*)
2229                 echo $file is in $xxx.
2230                 ;;
2231         ?:[\\/]*)
2232                 echo $file is in $xxx.
2233                 ;;
2234         *)
2235                 echo "I don't know where '$file' is, and my life depends on it." >&4
2236                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2237                 exit 1
2238                 ;;
2239         esac
2240 done
2241 echo " "
2242 echo "Don't worry if any of the following aren't found..."
2243 say=offhand
2244 for file in $trylist; do
2245         eval xxx=\$$file
2246         case "$xxx" in
2247         /*|?:[\\/]*)
2248                 if test -f "$xxx"; then
2249                         : ok
2250                 else
2251                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2252                         xxx=`./loc $file $file $pth`
2253                 fi
2254                 ;;
2255         '') xxx=`./loc $file $file $pth`;;
2256         *) xxx=`./loc $xxx $xxx $pth`;;
2257         esac
2258         eval $file=$xxx$_exe
2259         eval _$file=$xxx
2260         case "$xxx" in
2261         /*)
2262                 echo $file is in $xxx.
2263                 ;;
2264         ?:[\\/]*)
2265                 echo $file is in $xxx.
2266                 ;;
2267         *)
2268                 echo "I don't see $file out there, $say."
2269                 say=either
2270                 ;;
2271         esac
2272 done
2273 case "$egrep" in
2274 egrep)
2275         echo "Substituting grep for egrep."
2276         egrep=$grep
2277         _egrep=$grep
2278         ;;
2279 esac
2280 case "$ln" in
2281 ln)
2282         echo "Substituting cp for ln."
2283         ln=$cp
2284         _ln=$cp
2285         ;;
2286 esac
2287 case "$make" in
2288 make)   
2289         case "$gmake" in
2290         gmake)
2291         echo "I can't find make or gmake, and my life depends on it." >&4
2292         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2293         exit 1
2294         ;;
2295         esac
2296         ;;
2297 esac    
2298 case "$gmake" in
2299 gmake)  ;;
2300 *)      # We can't have osname yet.
2301         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2302                 # Assume that gmake, if found, is definitely GNU make
2303                 # and prefer it over the system make.
2304                 echo "Substituting gmake for make."
2305                 make=$gmake
2306                 _make=$gmake
2307         fi
2308         ;;
2309 esac
2310 case "$test" in
2311 test)
2312         echo "Hopefully test is built into your sh."
2313         ;;
2314 *)
2315         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2316                 echo "Using the test built into your sh."
2317                 test=test
2318                 _test=test
2319         fi
2320         ;;
2321 esac
2322 case "$echo" in
2323 echo)
2324         echo "Hopefully echo is built into your sh."
2325         ;;
2326 '') ;;
2327 *)
2328         echo " "
2329 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2330         $echo $n "hi there$c" >foo1
2331         echo $n "hi there$c" >foo2
2332         if cmp foo1 foo2 >/dev/null 2>&1; then
2333                 echo "They are compatible.  In fact, they may be identical."
2334         else
2335                 case "$n" in
2336                 '-n') n='' c='\c';;
2337                 *) n='-n' c='';;
2338                 esac
2339                 cat <<FOO
2340 They are not compatible!  You are probably running ksh on a non-USG system.
2341 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2342 have echo built in and we may have to run some Bourne shell scripts.  That
2343 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2344
2345 FOO
2346                 $echo $n "The star should be here-->$c"
2347                 $echo "*"
2348         fi
2349         $rm -f foo1 foo2
2350         ;;
2351 esac
2352
2353 cat <<EOS >trygcc
2354 $startsh
2355 EOS
2356 cat <<'EOSC' >>trygcc
2357 case "$cc" in
2358 '') ;;
2359 *)  $rm -f try try.*
2360     $cat >try.c <<EOM
2361 int main(int argc, char *argv[]) {
2362   return 0;
2363 }
2364 EOM
2365     if $cc -o try $ccflags $ldflags try.c; then
2366        :
2367     else
2368         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2369         despair=yes
2370         trygcc=yes
2371         case "$cc" in
2372         *gcc*) trygcc=no ;;
2373         esac
2374         case "`$cc -v -c try.c 2>&1`" in
2375         *gcc*) trygcc=no ;;
2376         esac
2377         if $test X"$trygcc" = Xyes; then
2378             if gcc -o try -c try.c; then
2379                 echo " "
2380                 echo "You seem to have a working gcc, though." >&4
2381                 rp="Would you like to use it?"
2382                 dflt=y
2383                 if $test -f myread; then
2384                     . ./myread
2385                 else
2386                     if $test -f UU/myread; then
2387                         . ./UU/myread
2388                     else
2389                         echo "Cannot find myread, sorry.  Aborting." >&2
2390                         exit 1
2391                     fi
2392                 fi  
2393                 case "$ans" in
2394                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2395                        if $test -f usethreads.cbu; then
2396                            $cat >&4 <<EOM 
2397
2398 *** However, any setting of the C compiler flags (e.g. for thread support)
2399 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2400 *** (together with e.g. -Dusethreads).
2401
2402 EOM
2403                        fi;;
2404                 esac
2405             fi
2406         fi
2407     fi
2408     $rm -f try try.*
2409     ;;
2410 esac
2411 EOSC
2412
2413 cat <<EOS >checkcc
2414 $startsh
2415 EOS
2416 cat <<'EOSC' >>checkcc
2417 case "$cc" in        
2418 '') ;;
2419 *)  $rm -f try try.*              
2420     $cat >try.c <<EOM
2421 int main(int argc, char *argv[]) {
2422   return 0;
2423 }
2424 EOM
2425     if $cc -o try $ccflags $ldflags try.c; then
2426        :
2427     else
2428         if $test X"$despair" = Xyes; then
2429            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2430         fi
2431         $cat >&4 <<EOM         
2432 You need to find a working C compiler.
2433 Either (purchase and) install the C compiler supplied by your OS vendor,
2434 or for a free C compiler try http://gcc.gnu.org/
2435 I cannot continue any further, aborting.
2436 EOM
2437         exit 1
2438     fi
2439     $rm -f try try.*
2440     ;;
2441 esac
2442 EOSC
2443
2444 : determine whether symbolic links are supported
2445 echo " "
2446 $touch blurfl
2447 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2448         echo "Symbolic links are supported." >&4
2449         lns="$ln -s"
2450 else
2451         echo "Symbolic links are NOT supported." >&4
2452         lns="$ln"
2453 fi
2454 $rm -f blurfl sym
2455
2456 : determine whether symbolic links are supported
2457 echo " "
2458 case "$lns" in
2459 *"ln"*" -s")
2460         echo "Checking how to test for symbolic links..." >&4
2461         $lns blurfl sym
2462         if $test "X$issymlink" = X; then
2463                 case "$newsh" in
2464                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2465                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2466                 esac
2467                 if test $? = 0; then
2468                         issymlink="test -h"
2469                 else
2470                         echo "Your builtin 'test -h' may be broken." >&4
2471                         case "$test" in
2472                         /*)     ;;
2473                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2474                                 for p in $pth
2475                                 do
2476                                         if test -f "$p/$test"; then
2477                                                 test="$p/$test"
2478                                                 break
2479                                         fi
2480                                 done
2481                                 ;;
2482                         esac
2483                         case "$test" in
2484                         /*)
2485                                 echo "Trying external '$test -h'." >&4
2486                                 issymlink="$test -h"
2487                                 if $test ! -h sym >/dev/null 2>&1; then
2488                                         echo "External '$test -h' is broken, too." >&4
2489                                         issymlink=''
2490                                 fi
2491                                 ;;
2492                         *)      issymlink='' ;;
2493                         esac
2494                 fi              
2495         fi
2496         if $test "X$issymlink" = X; then
2497                 if $test -L sym 2>/dev/null; then
2498                         issymlink="$test -L"
2499                         echo "The builtin '$test -L' worked." >&4
2500                 fi
2501         fi
2502         if $test "X$issymlink" != X; then
2503                 echo "You can test for symbolic links with '$issymlink'." >&4
2504         else
2505                 echo "I do not know how you can test for symbolic links." >&4
2506         fi
2507         $rm -f blurfl sym
2508         ;;
2509 *)      echo "No symbolic links, so not testing for their testing..." >&4
2510         ;;
2511 esac
2512 echo " "
2513
2514
2515 case "$mksymlinks" in
2516 $define|true|[yY]*)
2517         case "$src" in
2518         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2519                 exit 1
2520                 ;;
2521         *)      case "$lns:$issymlink" in
2522                 *"ln"*" -s:"*"test -"?)
2523                         echo "Creating the symbolic links..." >&4
2524                         echo "(First creating the subdirectories...)" >&4
2525                         cd ..
2526                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2527                                 read directory
2528                                 test -z "$directory" && break
2529                                 mkdir -p $directory
2530                         done
2531                         # Sanity check 1.
2532                         if test ! -d t/base; then
2533                                 echo "Failed to create the subdirectories.  Aborting." >&4
2534                                 exit 1
2535                         fi
2536                         echo "(Then creating the symlinks...)" >&4
2537                         awk '{print $1}' $src/MANIFEST | while true; do
2538                                 read filename
2539                                 test -z "$filename" && break
2540                                 if test -f $filename; then
2541                                         if $issymlink $filename; then
2542                                                 rm -f $filename
2543                                         fi
2544                                 fi
2545                                 if test -f $filename; then
2546                                         echo "$filename already exists, not symlinking."
2547                                 else
2548                                         ln -s $src/$filename $filename
2549                                 fi
2550                         done
2551                         # Sanity check 2.
2552                         if test ! -f t/base/lex.t; then
2553                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2554                                 exit 1
2555                         fi
2556                         cd UU
2557                         ;;
2558                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2559                         ;;
2560                 esac
2561                 ;;
2562         esac
2563         ;;
2564 esac
2565
2566
2567 case "$usecrosscompile" in
2568 $define|true|[yY]*)
2569         $echo "Cross-compiling..."
2570         croak=''
2571         case "$cc" in
2572         *-*-gcc) # A cross-compiling gcc, probably.
2573             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2574             ar=$targetarch-ar
2575             # leave out ld, choosing it is more complex
2576             nm=$targetarch-nm
2577             ranlib=$targetarch-ranlib
2578             $echo 'extern int foo;' > try.c
2579             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2580             shift
2581             if $test $# -gt 0; then
2582                 incpth="$incpth $*"
2583                 incpth="`$echo $incpth|$sed 's/^ //'`"
2584                 echo "Guessing incpth '$incpth'." >&4
2585                 for i in $*; do
2586                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2587                     if $test -d $j; then
2588                         libpth="$libpth $j"
2589                     fi
2590                 done   
2591                 libpth="`$echo $libpth|$sed 's/^ //'`"
2592                 echo "Guessing libpth '$libpth'." >&4
2593             fi
2594             $rm -f try.c
2595             ;;
2596         esac
2597         case "$targetarch" in
2598         '') echo "Targetarch not defined." >&4; croak=y ;;
2599         *)  echo "Using targetarch $targetarch." >&4 ;;
2600         esac
2601         case "$incpth" in
2602         '') echo "Incpth not defined." >&4; croak=y ;;
2603         *)  echo "Using incpth '$incpth'." >&4 ;;
2604         esac
2605         case "$libpth" in
2606         '') echo "Libpth not defined." >&4; croak=y ;;
2607         *)  echo "Using libpth '$libpth'." >&4 ;;
2608         esac
2609         case "$usrinc" in
2610         '') for i in $incpth; do
2611                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2612                     usrinc=$i
2613                     echo "Guessing usrinc $usrinc." >&4
2614                     break
2615                 fi
2616             done
2617             case "$usrinc" in
2618             '') echo "Usrinc not defined." >&4; croak=y ;;
2619             esac
2620             ;;
2621         *)  echo "Using usrinc $usrinc." >&4 ;;
2622         esac
2623         case "$targethost" in
2624         '') echo "Targethost not defined." >&4; croak=y ;;
2625         *)  echo "Using targethost $targethost." >&4
2626         esac
2627         locincpth=' '
2628         loclibpth=' '
2629         case "$croak" in
2630         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2631         esac
2632         case "$src" in
2633         /*) run=$src/Cross/run
2634             targetmkdir=$src/Cross/mkdir
2635             to=$src/Cross/to
2636             from=$src/Cross/from
2637             ;;
2638         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2639             run=$pwd/Cross/run
2640             targetmkdir=$pwd/Cross/mkdir
2641             to=$pwd/Cross/to
2642             from=$pwd/Cross/from
2643             ;;
2644         esac
2645         case "$targetrun" in
2646         '') targetrun=ssh ;;
2647         esac
2648         case "$targetto" in
2649         '') targetto=scp ;;
2650         esac
2651         case "$targetfrom" in
2652         '') targetfrom=scp ;;
2653         esac
2654         run=$run-$targetrun
2655         to=$to-$targetto
2656         from=$from-$targetfrom
2657         case "$targetdir" in
2658         '')  targetdir=/tmp
2659              echo "Guessing targetdir $targetdir." >&4
2660              ;;
2661         esac
2662         case "$targetuser" in
2663         '')  targetuser=root
2664              echo "Guessing targetuser $targetuser." >&4
2665              ;;
2666         esac
2667         case "$targetfrom" in
2668         scp)    q=-q ;;
2669         *)      q='' ;;
2670         esac
2671         case "$targetrun" in
2672         ssh|rsh)
2673             cat >$run <<EOF
2674 #!/bin/sh
2675 case "\$1" in
2676 -cwd)
2677   shift
2678   cwd=\$1
2679   shift
2680   ;;
2681 esac
2682 case "\$cwd" in
2683 '') cwd=$targetdir ;;
2684 esac
2685 exe=\$1
2686 shift
2687 if $test ! -f \$exe.xok; then
2688   $to \$exe
2689   $touch \$exe.xok
2690 fi
2691 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2692 EOF
2693             ;;
2694         *)  echo "Unknown targetrun '$targetrun'" >&4
2695             exit 1
2696             ;;
2697         esac
2698         case "$targetmkdir" in
2699         */Cross/mkdir)
2700             cat >$targetmkdir <<EOF
2701 #!/bin/sh
2702 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2703 EOF
2704             $chmod a+rx $targetmkdir
2705             ;;
2706         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2707             exit 1
2708             ;;
2709         esac
2710         case "$targetto" in
2711         scp|rcp)
2712             cat >$to <<EOF
2713 #!/bin/sh
2714 for f in \$@
2715 do
2716   case "\$f" in
2717   /*)
2718     $targetmkdir \`dirname \$f\`
2719     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2720     ;;
2721   *)
2722     $targetmkdir $targetdir/\`dirname \$f\`
2723     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2724     ;;
2725   esac
2726 done
2727 exit 0
2728 EOF
2729             ;;
2730         cp) cat >$to <<EOF
2731 #!/bin/sh
2732 for f in \$@
2733 do
2734   case "\$f" in
2735   /*)
2736     $mkdir -p $targetdir/\`dirname \$f\`
2737     $cp \$f $targetdir/\$f || exit 1
2738     ;;
2739   *)
2740     $targetmkdir $targetdir/\`dirname \$f\`
2741     $cp \$f $targetdir/\$f || exit 1
2742     ;;
2743   esac
2744 done
2745 exit 0
2746 EOF
2747             ;;
2748         *)  echo "Unknown targetto '$targetto'" >&4
2749             exit 1
2750             ;;
2751         esac
2752         case "$targetfrom" in
2753         scp|rcp)
2754           cat >$from <<EOF
2755 #!/bin/sh
2756 for f in \$@
2757 do
2758   $rm -f \$f
2759   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2760 done
2761 exit 0
2762 EOF
2763             ;;
2764         cp) cat >$from <<EOF
2765 #!/bin/sh
2766 for f in \$@
2767 do
2768   $rm -f \$f
2769   cp $targetdir/\$f . || exit 1
2770 done
2771 exit 0
2772 EOF
2773             ;;
2774         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2775             exit 1
2776             ;;
2777         esac
2778         if $test ! -f $run; then
2779             echo "Target 'run' script '$run' not found." >&4
2780         else
2781             $chmod a+rx $run
2782         fi
2783         if $test ! -f $to; then
2784             echo "Target 'to' script '$to' not found." >&4
2785         else
2786             $chmod a+rx $to
2787         fi
2788         if $test ! -f $from; then
2789             echo "Target 'from' script '$from' not found." >&4
2790         else
2791             $chmod a+rx $from
2792         fi
2793         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2794             exit 1
2795         fi
2796         cat >&4 <<EOF
2797 Using '$run' for remote execution,
2798 and '$from' and '$to'
2799 for remote file transfer.
2800 EOF
2801         ;;
2802 *)      run=''
2803         to=:
2804         from=:
2805         usecrosscompile='undef'
2806         targetarch=''
2807         ;;
2808 esac
2809
2810 : see whether [:lower:] and [:upper:] are supported character classes
2811 echo " "
2812 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2813 ABYZ)
2814         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2815         up='[:upper:]'
2816         low='[:lower:]'
2817         ;;
2818 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2819         # (0xc9 and 0xd1), therefore that is a nice testing point.
2820         if test "X$up" = X -o "X$low" = X; then
2821             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2822             ij) up='[A-Z]'
2823                 low='[a-z]'
2824                 ;;
2825             esac
2826         fi
2827         if test "X$up" = X -o "X$low" = X; then
2828             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2829             ij) up='A-Z'
2830                 low='a-z'
2831                 ;;
2832             esac
2833         fi
2834         if test "X$up" = X -o "X$low" = X; then
2835             case "`echo IJ | od -x 2>/dev/null`" in
2836             *C9D1*|*c9d1*)
2837                 echo "Hey, this might be EBCDIC." >&4
2838                 if test "X$up" = X -o "X$low" = X; then
2839                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2840                     ij) up='[A-IJ-RS-Z]'
2841                         low='[a-ij-rs-z]'
2842                         ;;
2843                     esac
2844                 fi
2845                 if test "X$up" = X -o "X$low" = X; then
2846                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2847                     ij) up='A-IJ-RS-Z'
2848                         low='a-ij-rs-z'
2849                         ;;
2850                     esac
2851                 fi
2852                 ;;
2853             esac
2854         fi
2855 esac
2856 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2857 ij)
2858     echo "Using $up and $low to convert case." >&4
2859     ;;
2860 *)
2861     echo "I don't know how to translate letters from upper to lower case." >&4
2862     echo "Your tr is not acting any way I know of." >&4
2863     exit 1
2864     ;;
2865 esac
2866 : set up the translation script tr, must be called with ./tr of course
2867 cat >tr <<EOSC
2868 $startsh
2869 case "\$1\$2" in
2870 '[A-Z][a-z]') exec $tr '$up' '$low';;
2871 '[a-z][A-Z]') exec $tr '$low' '$up';;
2872 esac
2873 exec $tr "\$@"
2874 EOSC
2875 chmod +x tr
2876 $eunicefix tr
2877
2878 : Try to determine whether config.sh was made on this system
2879 case "$config_sh" in
2880 '')
2881 myuname=`$uname -a 2>/dev/null`
2882 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2883 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2884 # because the A-Z/a-z are not consecutive.
2885 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2886         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2887 newmyuname="$myuname"
2888 dflt=n
2889 case "$knowitall" in
2890 '')
2891         if test -f ../config.sh; then
2892                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2893                         eval "`grep myuname= ../config.sh`"
2894                 fi
2895                 if test "X$myuname" = "X$newmyuname"; then
2896                         dflt=y
2897                 fi
2898         fi
2899         ;;
2900 *) dflt=y;;
2901 esac
2902
2903 : Get old answers from old config file if Configure was run on the
2904 : same system, otherwise use the hints.
2905 hint=default
2906 cd ..
2907 if test -f config.sh; then
2908         echo " "
2909         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2910         . UU/myread
2911         case "$ans" in
2912         n*|N*) echo "OK, I'll ignore it."
2913                 mv config.sh config.sh.old
2914                 myuname="$newmyuname"
2915                 ;;
2916         *)  echo "Fetching default answers from your old config.sh file..." >&4
2917                 tmp_n="$n"
2918                 tmp_c="$c"
2919                 tmp_sh="$sh"
2920                 . ./config.sh
2921                 cp config.sh UU
2922                 n="$tmp_n"
2923                 c="$tmp_c"
2924                 : Older versions did not always set $sh.  Catch re-use of such
2925                 : an old config.sh.
2926                 case "$sh" in
2927                 '') sh="$tmp_sh" ;;
2928                 esac
2929                 hint=previous
2930                 ;;
2931         esac
2932 fi
2933 . ./UU/checkcc
2934 if test ! -f config.sh; then
2935         $cat <<EOM
2936
2937 First time through, eh?  I have some defaults handy for some systems
2938 that need some extra help getting the Configure answers right:
2939
2940 EOM
2941         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2942         dflt=''
2943         : Half the following guesses are probably wrong... If you have better
2944         : tests or hints, please send them to perlbug@perl.org
2945         : The metaconfig authors would also appreciate a copy...
2946         $test -f /irix && osname=irix
2947         $test -f /xenix && osname=sco_xenix
2948         $test -f /dynix && osname=dynix
2949         $test -f /dnix && osname=dnix
2950         $test -f /lynx.os && osname=lynxos
2951         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2952         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2953         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2954         $test -f /bin/mips && /bin/mips && osname=mips
2955         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2956                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2957         $test -d /usr/apollo/bin && osname=apollo
2958         $test -f /etc/saf/_sactab && osname=svr4
2959         $test -d /usr/include/minix && osname=minix
2960         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2961         if $test -d /MachTen -o -d /MachTen_Folder; then
2962                 osname=machten
2963                 if $test -x /sbin/version; then
2964                         osvers=`/sbin/version | $awk '{print $2}' |
2965                         $sed -e 's/[A-Za-z]$//'`
2966                 elif $test -x /usr/etc/version; then
2967                         osvers=`/usr/etc/version | $awk '{print $2}' |
2968                         $sed -e 's/[A-Za-z]$//'`
2969                 else
2970                         osvers="$2.$3"
2971                 fi
2972         fi
2973
2974         $test -f /sys/posix.dll &&
2975                 $test -f /usr/bin/what &&
2976                 set X `/usr/bin/what /sys/posix.dll` &&
2977                 $test "$3" = UWIN &&
2978                 osname=uwin &&
2979                 osvers="$5"
2980
2981         if $test -f $uname; then
2982                 set X $myuname
2983                 shift
2984
2985                 case "$5" in
2986                 fps*) osname=fps ;;
2987                 mips*)
2988                         case "$4" in
2989                         umips) osname=umips ;;
2990                         *) osname=mips ;;
2991                         esac;;
2992                 [23]100) osname=mips ;;
2993                 next*) osname=next ;;
2994                 i386*)
2995                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2996                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2997                                 osname='sco'
2998                                 osvers=$tmp
2999                         elif $test -f /etc/kconfig; then
3000                                 osname=isc
3001                                 if test "$lns" = "$ln -s"; then
3002                                         osvers=4
3003                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3004                                         osvers=3
3005                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3006                                         osvers=2
3007                                 fi
3008                         fi
3009                         tmp=''
3010                         ;;
3011                 pc*)
3012                         if test -n "$DJGPP"; then
3013                                 osname=dos
3014                                 osvers=djgpp
3015                         fi
3016                         ;;
3017                 esac
3018
3019                 case "$1" in
3020                 aix) osname=aix
3021                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3022                         case "$tmp" in
3023                         'not found') osvers="$4"."$3" ;;
3024                         '<3240'|'<>3240') osvers=3.2.0 ;;
3025                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3026                         '=3250'|'>3250') osvers=3.2.5 ;;
3027                         *) osvers=$tmp;;
3028                         esac
3029                         ;;
3030                 bsd386) osname=bsd386
3031                         osvers=`$uname -r`
3032                         ;;
3033                 cygwin*) osname=cygwin
3034                         osvers="$3"
3035                         ;;
3036                 *dc.osx) osname=dcosx
3037                         osvers="$3"
3038                         ;;
3039                 dnix) osname=dnix
3040                         osvers="$3"
3041                         ;;
3042                 domainos) osname=apollo
3043                         osvers="$3"
3044                         ;;
3045                 dgux) osname=dgux 
3046                         osvers="$3"
3047                         ;;
3048                 dynixptx*) osname=dynixptx
3049                         osvers=`echo "$4"|sed 's/^v//'`
3050                         ;;
3051                 freebsd) osname=freebsd 
3052                         osvers="$3" ;;
3053                 genix) osname=genix ;;
3054                 hp*) osname=hpux 
3055                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3056                         ;;
3057                 irix*) osname=irix
3058                         case "$3" in
3059                         4*) osvers=4 ;;
3060                         5*) osvers=5 ;;
3061                         *)      osvers="$3" ;;
3062                         esac
3063                         ;;
3064                 linux) osname=linux
3065                         case "$3" in
3066                         *)      osvers="$3" ;;
3067                         esac
3068                         ;;
3069                 MiNT) osname=mint
3070                         ;;
3071                 netbsd*) osname=netbsd
3072                         osvers="$3"
3073                         ;;
3074                 news-os) osvers="$3"
3075                         case "$3" in
3076                         4*) osname=newsos4 ;;
3077                         *) osname=newsos ;;
3078                         esac
3079                         ;;
3080                 next*) osname=next ;;
3081                 nonstop-ux) osname=nonstopux ;;
3082                 openbsd) osname=openbsd
3083                         osvers="$3"
3084                         ;;
3085                 POSIX-BC | posix-bc ) osname=posix-bc
3086                         osvers="$3"
3087                         ;;
3088                 powerux | power_ux | powermax_os | powermaxos | \
3089                 powerunix | power_unix) osname=powerux
3090                         osvers="$3"
3091                         ;;
3092                 qnx) osname=qnx
3093                         osvers="$4"
3094                         ;;
3095                 solaris) osname=solaris
3096                         case "$3" in
3097                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3098                         *)      osvers="$3" ;;
3099                         esac
3100                         ;;
3101                 sunos) osname=sunos
3102                         case "$3" in
3103                         5*) osname=solaris
3104                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3105                         *)      osvers="$3" ;;
3106                         esac
3107                         ;;
3108                 titanos) osname=titanos
3109                         case "$3" in
3110                         1*) osvers=1 ;;
3111                         2*) osvers=2 ;;
3112                         3*) osvers=3 ;;
3113                         4*) osvers=4 ;;
3114                         *)      osvers="$3" ;;
3115                         esac
3116                         ;;
3117                 ultrix) osname=ultrix
3118                         osvers="$3"
3119                         ;;
3120                 osf1|mls+)      case "$5" in
3121                                 alpha)
3122                                         osname=dec_osf
3123                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3124                                         case "$osvers" in
3125                                         [1-9].[0-9]*) ;;
3126                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3127                                         esac
3128                                         ;;
3129                         hp*)    osname=hp_osf1  ;;
3130                         mips)   osname=mips_osf1 ;;
3131                         esac
3132                         ;;
3133                 unixware) osname=svr5
3134                         osvers="$4"
3135                         ;;
3136                 uts)    osname=uts
3137                         osvers="$3"
3138                         ;;
3139                 vos) osvers="$3"
3140                         ;;
3141                 $2) case "$osname" in
3142                         *isc*) ;;
3143                         *freebsd*) ;;
3144                         svr*)
3145                                 : svr4.x or possibly later
3146                                 case "svr$3" in 
3147                                 ${osname}*)
3148                                         osname=svr$3
3149                                         osvers=$4
3150                                         ;;
3151                                 esac
3152                                 case "$osname" in
3153                                 svr4.0)
3154                                         : Check for ESIX
3155                                         if test -f /stand/boot ; then
3156                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3157                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3158                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3159                                                         if test -n "$isesix"; then
3160                                                                 osname=esix4
3161                                                         fi
3162                                                 fi
3163                                         fi
3164                                         ;;
3165                                 esac
3166                                 ;;
3167                         *)      if test -f /etc/systemid; then
3168                                         osname=sco
3169                                         set `echo $3 | $sed 's/\./ /g'` $4
3170                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3171                                                 osvers=$1.$2.$3
3172                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3173                                                 osvers=$1.$2
3174                                         elif $test -f $src/hints/sco_$1.sh; then
3175                                                 osvers=$1
3176                                         fi
3177                                 else
3178                                         case "$osname" in
3179                                         '') : Still unknown.  Probably a generic Sys V.
3180                                                 osname="sysv"
3181                                                 osvers="$3"
3182                                                 ;;
3183                                         esac
3184                                 fi
3185                                 ;;
3186                         esac
3187                         ;;
3188                 *)      case "$osname" in
3189                         '') : Still unknown.  Probably a generic BSD.
3190                                 osname="$1"
3191                                 osvers="$3"
3192                                 ;;
3193                         esac
3194                         ;;
3195                 esac
3196         else
3197                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3198                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3199                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3200                                 osname=news_os
3201                         fi
3202                         $rm -f UU/kernel.what
3203                 elif test -d c:/.; then
3204                         set X $myuname
3205                         osname=os2
3206                         osvers="$5"
3207                 fi
3208         fi
3209         
3210         case "$targetarch" in
3211         '') ;;
3212         *)  hostarch=$osname
3213             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3214             osvers=''
3215             ;;
3216         esac
3217
3218         : Now look for a hint file osname_osvers, unless one has been
3219         : specified already.
3220         case "$hintfile" in
3221         ''|' ')
3222                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3223                 : Also try without trailing minor version numbers.
3224                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3225                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3226                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3227                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3228                 case "$file" in
3229                 '') dflt=none ;;
3230                 *)  case "$osvers" in
3231                         '') dflt=$file
3232                                 ;;
3233                         *)  if $test -f $src/hints/$file.sh ; then
3234                                         dflt=$file
3235                                 elif $test -f $src/hints/$xfile.sh ; then
3236                                         dflt=$xfile
3237                                 elif $test -f $src/hints/$xxfile.sh ; then
3238                                         dflt=$xxfile
3239                                 elif $test -f $src/hints/$xxxfile.sh ; then
3240                                         dflt=$xxxfile
3241                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3242                                         dflt=$xxxxfile
3243                                 elif $test -f "$src/hints/${osname}.sh" ; then
3244                                         dflt="${osname}"
3245                                 else
3246                                         dflt=none
3247                                 fi
3248                                 ;;
3249                         esac
3250                         ;;
3251                 esac
3252                 if $test -f Policy.sh ; then
3253                         case "$dflt" in
3254                         *Policy*) ;;
3255                         none) dflt="Policy" ;;
3256                         *) dflt="Policy $dflt" ;;
3257                         esac
3258                 fi
3259                 ;;
3260         *)
3261                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3262                 ;;
3263         esac
3264
3265         if $test -f Policy.sh ; then
3266                 $cat <<EOM
3267
3268 There's also a Policy hint file available, which should make the
3269 site-specific (policy) questions easier to answer.
3270 EOM
3271
3272         fi
3273
3274         $cat <<EOM
3275
3276 You may give one or more space-separated answers, or "none" if appropriate.
3277 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3278 is a good thing.  DO NOT give a wrong version or a wrong OS.
3279
3280 EOM
3281
3282         rp="Which of these apply, if any?"
3283         . UU/myread
3284         tans=$ans
3285         for file in $tans; do
3286                 if $test X$file = XPolicy -a -f Policy.sh; then
3287                         . Policy.sh
3288                         $cat Policy.sh >> UU/config.sh
3289                 elif $test -f $src/hints/$file.sh; then
3290                         . $src/hints/$file.sh
3291                         $cat $src/hints/$file.sh >> UU/config.sh
3292                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3293                         : nothing
3294                 else
3295                         : Give one chance to correct a possible typo.
3296                         echo "$file.sh does not exist"
3297                         dflt=$file
3298                         rp="hint to use instead?"
3299                         . UU/myread
3300                         for file in $ans; do
3301                                 if $test -f "$src/hints/$file.sh"; then
3302                                         . $src/hints/$file.sh
3303                                         $cat $src/hints/$file.sh >> UU/config.sh
3304                                 elif $test X$ans = X -o X$ans = Xnone ; then
3305                                         : nothing
3306                                 else
3307                                         echo "$file.sh does not exist -- ignored."
3308                                 fi
3309                         done
3310                 fi
3311         done
3312
3313         hint=recommended
3314         : Remember our hint file for later.
3315         if $test -f "$src/hints/$file.sh" ; then
3316                 hintfile="$file"
3317         else
3318                 hintfile=''
3319         fi
3320 fi
3321 cd UU
3322 ;;
3323 *)
3324         echo " "
3325         echo "Fetching default answers from $config_sh..." >&4
3326         tmp_n="$n"
3327         tmp_c="$c"
3328         cd ..
3329         cp $config_sh config.sh 2>/dev/null
3330         chmod +w config.sh
3331         . ./config.sh
3332         cd UU
3333         cp ../config.sh .
3334         n="$tmp_n"
3335         c="$tmp_c"
3336         hint=previous
3337         ;;
3338 esac
3339 test "$override" && . ./optdef.sh
3340
3341 : Restore computed paths
3342 for file in $loclist $trylist; do
3343         eval $file="\$_$file"
3344 done
3345
3346 cat << EOM
3347
3348 Configure uses the operating system name and version to set some defaults.
3349 The default value is probably right if the name rings a bell. Otherwise,
3350 since spelling matters for me, either accept the default or answer "none"
3351 to leave it blank.
3352
3353 EOM
3354 case "$osname" in
3355         ''|' ')
3356                 case "$hintfile" in
3357                 ''|' '|none) dflt=none ;;
3358                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3359                 esac
3360                 ;;
3361         *) dflt="$osname" ;;
3362 esac
3363 rp="Operating system name?"
3364 . ./myread
3365 case "$ans" in
3366 none)  osname='' ;;
3367 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3368 esac
3369 echo " "
3370 case "$osvers" in
3371         ''|' ')
3372                 case "$hintfile" in
3373                 ''|' '|none) dflt=none ;;
3374                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3375                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3376                         case "$dflt" in
3377                         ''|' ') dflt=none ;;
3378                         esac
3379                         ;;
3380                 esac
3381                 ;;
3382         *) dflt="$osvers" ;;
3383 esac
3384 rp="Operating system version?"
3385 . ./myread
3386 case "$ans" in
3387 none)  osvers='' ;;
3388 *) osvers="$ans" ;;
3389 esac
3390
3391
3392 . ./posthint.sh
3393
3394 : who configured the system
3395 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3396 cf_by=`(logname) 2>/dev/null`
3397 case "$cf_by" in
3398 "")
3399         cf_by=`(whoami) 2>/dev/null`
3400         case "$cf_by" in
3401         "") cf_by=unknown ;;
3402         esac ;;
3403 esac
3404
3405 : set up the script used to warn in case of inconsistency
3406 cat <<EOS >whoa
3407 $startsh
3408 EOS
3409 cat <<'EOSC' >>whoa
3410 dflt=y
3411 echo " "
3412 echo "*** WHOA THERE!!! ***" >&4
3413 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3414 rp="    Keep the $hint value?"
3415 . ./myread
3416 case "$ans" in
3417 y) td=$was; tu=$was;;
3418 esac
3419 EOSC
3420
3421 : function used to set $1 to $val
3422 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3423 case "$val$was" in
3424 $define$undef) . ./whoa; eval "$var=\$td";;
3425 $undef$define) . ./whoa; eval "$var=\$tu";;
3426 *) eval "$var=$val";;
3427 esac'
3428
3429 case "$usethreads" in
3430 $define|true|[yY]*)     dflt='y';;
3431 *)     # Catch case where user specified ithreads or 5005threads but
3432        # forgot -Dusethreads (A.D. 4/2002)
3433        case "$useithreads$use5005threads" in
3434        *$define*)      dflt='y' ;;
3435        *)      dflt='n';;
3436        esac
3437        ;;
3438 esac
3439 cat <<EOM
3440
3441 Perl can be built to take advantage of threads on some systems.
3442 To do so, Configure can be run with -Dusethreads.
3443
3444 Note that Perl built with threading support runs slightly slower
3445 and uses more memory than plain Perl. The current implementation
3446 is believed to be stable, but it is fairly new, and so should be
3447 treated with caution.
3448
3449 If this doesn't make any sense to you, just accept the default '$dflt'.
3450 EOM
3451 rp='Build a threading Perl?'
3452 . ./myread
3453 case "$ans" in
3454 y|Y)    val="$define" ;;
3455 *)      val="$undef" ;;
3456 esac
3457 set usethreads
3458 eval $setvar
3459
3460 case "$usethreads" in
3461 $define)
3462         $cat <<EOM
3463
3464 Since release 5.6, Perl has had two different threading implementations,
3465 the newer interpreter-based version (ithreads) with one interpreter per
3466 thread, and the older 5.005 version (5005threads).
3467 The 5005threads version is effectively unmaintained and will probably be
3468 removed in Perl 5.10, so there should be no need to build a Perl using it
3469 unless needed for backwards compatibility with some existing 5.005threads
3470 code.
3471
3472 EOM
3473         : Default to ithreads unless overridden on command line or with
3474         : old config.sh
3475         dflt='y'
3476         case "$use5005threads" in
3477                 $define|true|[yY]*) dflt='n';;
3478         esac
3479         case "$useithreads" in
3480                 $undef|false|[nN]*) dflt='n';;
3481         esac
3482         rp='Use the newer interpreter-based ithreads?'
3483         . ./myread
3484         case "$ans" in
3485         y|Y)    val="$define" ;;
3486         *)      val="$undef" ;;
3487         esac
3488         set useithreads
3489         eval $setvar
3490         : Now set use5005threads to the opposite value.
3491         case "$useithreads" in
3492         $define) val="$undef" ;;
3493         *) val="$define" ;;
3494         esac
3495         set use5005threads
3496         eval $setvar
3497         ;;
3498 *)
3499         useithreads="$undef"
3500         use5005threads="$undef"
3501         ;;
3502 esac
3503
3504 case "$useithreads$use5005threads" in
3505 "$define$define")
3506         $cat >&4 <<EOM
3507
3508 You cannot have both the ithreads and the 5.005 threads enabled
3509 at the same time.  Disabling the 5.005 threads since they are
3510 much less stable than the ithreads.
3511
3512 EOM
3513         use5005threads="$undef"
3514         ;;
3515 esac
3516
3517 case "$d_oldpthreads" in
3518 '')     : Configure tests would be welcome here.  For now, assume undef.
3519         val="$undef" ;;
3520 *)      val="$d_oldpthreads" ;;
3521 esac
3522 set d_oldpthreads
3523 eval $setvar
3524
3525
3526 case "$usethreads" in
3527 "$define"|true|[yY]*)
3528 : Look for a hint-file generated 'call-back-unit'.  If the
3529 : user has specified that a threading perl is to be built,
3530 : we may need to set or change some other defaults.
3531         if $test -f usethreads.cbu; then
3532                 echo "Your platform has some specific hints for threaded builds, using them..."
3533                 . ./usethreads.cbu
3534         else
3535                 $cat <<EOM
3536 (Your platform doesn't have any specific hints for threaded builds.
3537  Assuming POSIX threads, then.)
3538 EOM
3539         fi
3540         ;;
3541 esac
3542
3543 cat <<EOM
3544
3545 Perl can be built so that multiple Perl interpreters can coexist
3546 within the same Perl executable.
3547 EOM
3548
3549 case "$useithreads" in
3550 $define)
3551         cat <<EOM
3552 This multiple interpreter support is required for interpreter-based threads.
3553 EOM
3554         val="$define"
3555         ;;
3556 *)      case "$usemultiplicity" in
3557         $define|true|[yY]*)     dflt='y';;
3558         *) dflt='n';;
3559         esac
3560         echo " "
3561         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3562         rp='Build Perl for multiplicity?'
3563         . ./myread
3564         case "$ans" in
3565         y|Y)    val="$define" ;;
3566         *)      val="$undef" ;;
3567         esac
3568         ;;
3569 esac
3570 set usemultiplicity
3571 eval $setvar
3572
3573
3574 case "$usemorebits" in
3575 "$define"|true|[yY]*)
3576         use64bitint="$define"
3577         uselongdouble="$define"
3578         usemorebits="$define"
3579         ;;
3580 *)      usemorebits="$undef"
3581         ;;
3582 esac
3583
3584 : make some quick guesses about what we are up against
3585 echo " "
3586 $echo $n "Hmm...  $c"
3587 echo exit 1 >bsd
3588 echo exit 1 >usg
3589 echo exit 1 >v7
3590 echo exit 1 >osf1
3591 echo exit 1 >eunice
3592 echo exit 1 >xenix
3593 echo exit 1 >venix
3594 echo exit 1 >os2
3595 d_bsd="$undef"
3596 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3597 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3598 then
3599         echo "Looks kind of like an OSF/1 system, but we'll see..."
3600         echo exit 0 >osf1
3601 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3602         xxx=`./loc addbib blurfl $pth`
3603         if $test -f $xxx; then
3604         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3605                 echo exit 0 >bsd
3606                 echo exit 0 >usg
3607         else
3608                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3609                         echo "Looks kind of like an extended USG system, but we'll see..."
3610                 else
3611                         echo "Looks kind of like a USG system, but we'll see..."
3612                 fi
3613                 echo exit 0 >usg
3614         fi
3615 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3616         echo "Looks kind of like a BSD system, but we'll see..."
3617         d_bsd="$define"
3618         echo exit 0 >bsd
3619 else
3620         echo "Looks kind of like a Version 7 system, but we'll see..."
3621         echo exit 0 >v7
3622 fi
3623 case "$eunicefix" in
3624 *unixtovms*)
3625         $cat <<'EOI'
3626 There is, however, a strange, musty smell in the air that reminds me of
3627 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3628 EOI
3629         echo exit 0 >eunice
3630         d_eunice="$define"
3631 : it so happens the Eunice I know will not run shell scripts in Unix format
3632         ;;
3633 *)
3634         echo " "
3635         echo "Congratulations.  You aren't running Eunice."
3636         d_eunice="$undef"
3637         ;;
3638 esac
3639 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3640 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3641 : semicolon as a patch separator
3642 case "$p_" in
3643 :) ;;
3644 *)
3645         $cat <<'EOI'
3646 I have the feeling something is not exactly right, however...don't tell me...
3647 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3648 (Or you may be running DOS with DJGPP.)
3649 EOI
3650         echo exit 0 >os2
3651         ;;
3652 esac
3653 if test -f /xenix; then
3654         echo "Actually, this looks more like a XENIX system..."
3655         echo exit 0 >xenix
3656         d_xenix="$define"
3657 else
3658         echo " "
3659         echo "It's not Xenix..."
3660         d_xenix="$undef"
3661 fi
3662 chmod +x xenix
3663 $eunicefix xenix
3664 if test -f /venix; then
3665         echo "Actually, this looks more like a VENIX system..."
3666         echo exit 0 >venix
3667 else
3668         echo " "
3669         if ./xenix; then
3670                 : null
3671         else
3672                 echo "Nor is it Venix..."
3673         fi
3674 fi
3675 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3676 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3677 $rm -f foo
3678
3679 case "$cc" in
3680 '') dflt=cc;;
3681 *) dflt="$cc";;
3682 esac
3683 rp="Use which C compiler?"
3684 . ./myread
3685 cc="$ans"
3686
3687 : See if they have not cc but they do have gcc
3688 . ./trygcc
3689 : Look for a hint-file generated 'call-back-unit'.  Now that the
3690 : user has specified the compiler, we may need to set or change some
3691 : other defaults.
3692 if $test -f cc.cbu; then
3693     . ./cc.cbu
3694 fi
3695 . ./checkcc
3696
3697 echo " "
3698 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3699 $cat >try.c <<EOM
3700 #include <stdio.h>
3701 int main() {
3702 #ifdef __GNUC__
3703 #ifdef __VERSION__
3704         printf("%s\n", __VERSION__);
3705 #else
3706         printf("%s\n", "1");
3707 #endif
3708 #endif
3709         exit(0);
3710 }
3711 EOM
3712 if $cc -o try $ccflags $ldflags try.c; then
3713         gccversion=`$run ./try`
3714         case "$gccversion" in
3715         '') echo "You are not using GNU cc." ;;
3716         *)  echo "You are using GNU cc $gccversion."
3717             ccname=gcc  
3718             ;;
3719         esac
3720 else
3721         echo " "
3722         echo "*** WHOA THERE!!! ***" >&4
3723         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3724         case "$knowitall" in
3725         '')
3726         echo "    You'd better start hunting for one and let me know about it." >&4
3727                 exit 1
3728                 ;;
3729         esac
3730 fi
3731 $rm -f try try.*
3732 case "$gccversion" in
3733 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3734 esac
3735 case "$gccversion" in
3736 '') gccosandvers='' ;;
3737 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3738    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3739    gccshortvers=''
3740    case "$gccosandvers" in
3741    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3742    $osname$osvers) ;; # looking good
3743    $osname*) cat <<EOM >&4
3744
3745 *** WHOA THERE!!! ***
3746
3747     Your gcc has not been compiled for the exact release of
3748     your operating system ($gccosandvers versus $osname$osvers).
3749
3750     In general it is a good idea to keep gcc synchronized with
3751     the operating system because otherwise serious problems
3752     may ensue when trying to compile software, like Perl.
3753
3754     I'm trying to be optimistic here, though, and will continue.
3755     If later during the configuration and build icky compilation
3756     problems appear (headerfile conflicts being the most common
3757     manifestation), I suggest reinstalling the gcc to match
3758     your operating system release.
3759
3760 EOM
3761       ;;
3762    *) gccosandvers='' ;; # failed to parse, better be silent
3763    esac
3764    ;;
3765 esac
3766 case "$ccname" in
3767 '') ccname="$cc" ;;
3768 esac
3769
3770 # gcc 3.1 complains about adding -Idirectories that it already knows about,
3771 # so we will take those off from locincpth.
3772 case "$gccversion" in
3773 3*)
3774     echo "main(){}">try.c
3775     for incdir in `$cc -v -c try.c 2>&1 | \
3776        sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
3777        locincpth=`echo $locincpth | sed s!$incdir!!`
3778     done
3779     $rm -f try try.*
3780 esac
3781
3782 : decide how portable to be.  Allow command line overrides.
3783 case "$d_portable" in
3784 "$undef") ;;
3785 *)      d_portable="$define" ;;
3786 esac
3787
3788 : set up shell script to do ~ expansion
3789 cat >filexp <<EOSS
3790 $startsh
3791 : expand filename
3792 case "\$1" in
3793  ~/*|~)
3794         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3795         ;;
3796  ~*)
3797         if $test -f /bin/csh; then
3798                 /bin/csh -f -c "glob \$1"
3799                 failed=\$?
3800                 echo ""
3801                 exit \$failed
3802         else
3803                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3804                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3805                 if $test ! -d "\$dir"; then
3806                         me=\`basename \$0\`
3807                         echo "\$me: can't locate home directory for: \$name" >&2
3808                         exit 1
3809                 fi
3810                 case "\$1" in
3811                 */*)
3812                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3813                         ;;
3814                 *)
3815                         echo \$dir
3816                         ;;
3817                 esac
3818         fi
3819         ;;
3820 *)
3821         echo \$1
3822         ;;
3823 esac
3824 EOSS
3825 chmod +x filexp
3826 $eunicefix filexp
3827
3828 : now set up to get a file name
3829 cat <<EOS >getfile
3830 $startsh
3831 EOS
3832 cat <<'EOSC' >>getfile
3833 tilde=''
3834 fullpath=''
3835 already=''
3836 skip=''
3837 none_ok=''
3838 exp_file=''
3839 nopath_ok=''
3840 orig_rp="$rp"
3841 orig_dflt="$dflt"
3842 case "$gfpth" in
3843 '') gfpth='.' ;;
3844 esac
3845
3846 case "$fn" in
3847 *\(*)
3848         : getfile will accept an answer from the comma-separated list
3849         : enclosed in parentheses even if it does not meet other criteria.
3850         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3851         fn=`echo $fn | sed 's/(.*)//'`
3852         ;;
3853 esac
3854
3855 case "$fn" in
3856 *:*)
3857         loc_file=`expr $fn : '.*:\(.*\)'`
3858         fn=`expr $fn : '\(.*\):.*'`
3859         ;;
3860 esac
3861
3862 case "$fn" in
3863 *~*) tilde=true;;
3864 esac
3865 case "$fn" in
3866 */*) fullpath=true;;
3867 esac
3868 case "$fn" in
3869 *+*) skip=true;;
3870 esac
3871 case "$fn" in
3872 *n*) none_ok=true;;
3873 esac
3874 case "$fn" in
3875 *e*) exp_file=true;;
3876 esac
3877 case "$fn" in
3878 *p*) nopath_ok=true;;
3879 esac
3880
3881 case "$fn" in
3882 *f*) type='File';;
3883 *d*) type='Directory';;
3884 *l*) type='Locate';;
3885 esac
3886
3887 what="$type"
3888 case "$what" in
3889 Locate) what='File';;
3890 esac
3891
3892 case "$exp_file" in
3893 '')
3894         case "$d_portable" in
3895         "$define") ;;
3896         *) exp_file=true;;
3897         esac
3898         ;;
3899 esac
3900
3901 cd ..
3902 while test "$type"; do
3903         redo=''
3904         rp="$orig_rp"
3905         dflt="$orig_dflt"
3906         case "$tilde" in
3907         true) rp="$rp (~name ok)";;
3908         esac
3909         . UU/myread
3910         if test -f UU/getfile.ok && \
3911                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3912         then
3913                 value="$ans"
3914                 ansexp="$ans"
3915                 break
3916         fi
3917         case "$ans" in
3918         none)
3919                 value=''
3920                 ansexp=''
3921                 case "$none_ok" in
3922                 true) type='';;
3923                 esac
3924                 ;;
3925         *)
3926                 case "$tilde" in
3927                 '') value="$ans"
3928                         ansexp="$ans";;
3929                 *)
3930                         value=`UU/filexp $ans`
3931                         case $? in
3932                         0)
3933                                 if test "$ans" != "$value"; then
3934                                         echo "(That expands to $value on this system.)"
3935                                 fi
3936                                 ;;
3937                         *) value="$ans";;
3938                         esac
3939                         ansexp="$value"
3940                         case "$exp_file" in
3941                         '') value="$ans";;
3942                         esac
3943                         ;;
3944                 esac
3945                 case "$fullpath" in
3946                 true)
3947                         case "$ansexp" in
3948                         /*) value="$ansexp" ;;
3949                         [a-zA-Z]:/*) value="$ansexp" ;;
3950                         *)
3951                                 redo=true
3952                                 case "$already" in
3953                                 true)
3954                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3955                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3956                                         ;;
3957                                 *)
3958                                 echo "Please give a full path name, starting with slash." >&4
3959                                         case "$tilde" in
3960                                         true)
3961                                 echo "Note that using ~name is ok provided it expands well." >&4
3962                                                 already=true
3963                                                 ;;
3964                                         esac
3965                                 esac
3966                                 ;;
3967                         esac
3968                         ;;
3969                 esac
3970                 case "$redo" in
3971                 '')
3972                         case "$type" in
3973                         File)
3974                                 for fp in $gfpth; do
3975                                         if test "X$fp" = X.; then
3976                                             pf="$ansexp"
3977                                         else    
3978                                             pf="$fp/$ansexp"
3979                                         fi
3980                                         if test -f "$pf"; then
3981                                                 type=''
3982                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3983                                         then
3984                                                 echo "($value is not a plain file, but that's ok.)"
3985                                                 type=''
3986                                         fi
3987                                         if test X"$type" = X; then
3988                                             value="$pf"
3989                                             break
3990                                         fi
3991                                 done
3992                                 ;;
3993                         Directory)
3994                                 for fp in $gfpth; do
3995                                         if test "X$fp" = X.; then
3996                                             dir="$ans"
3997                                             direxp="$ansexp"
3998                                         else    
3999                                             dir="$fp/$ansexp"
4000                                             direxp="$fp/$ansexp"
4001                                         fi
4002                                         if test -d "$direxp"; then
4003                                                 type=''
4004                                                 value="$dir"
4005                                                 break
4006                                         fi
4007                                 done
4008                                 ;;
4009                         Locate)
4010                                 if test -d "$ansexp"; then
4011                                         echo "(Looking for $loc_file in directory $value.)"
4012                                         value="$value/$loc_file"
4013                                         ansexp="$ansexp/$loc_file"
4014                                 fi
4015                                 if test -f "$ansexp"; then
4016                                         type=''
4017                                 fi
4018                                 case "$nopath_ok" in
4019                                 true)   case "$value" in
4020                                         */*) ;;
4021                                         *)      echo "Assuming $value will be in people's path."
4022                                                 type=''
4023                                                 ;;
4024                                         esac
4025                                         ;;
4026                                 esac
4027                                 ;;
4028                         esac
4029
4030                         case "$skip" in
4031                         true) type='';
4032                         esac
4033
4034                         case "$type" in
4035                         '') ;;
4036                         *)
4037                                 if test "$fastread" = yes; then
4038                                         dflt=y
4039                                 else
4040                                         dflt=n
4041                                 fi
4042                                 rp="$what $value doesn't exist.  Use that name anyway?"
4043                                 . UU/myread
4044                                 dflt=''
4045                                 case "$ans" in
4046                                 y*) type='';;
4047                                 *) echo " ";;
4048                                 esac
4049                                 ;;
4050                         esac
4051                         ;;
4052                 esac
4053                 ;;
4054         esac
4055 done
4056 cd UU
4057 ans="$value"
4058 rp="$orig_rp"
4059 dflt="$orig_dflt"
4060 rm -f getfile.ok
4061 test "X$gfpthkeep" != Xy && gfpth=""
4062 EOSC
4063
4064 : What should the include directory be ?
4065 echo " "
4066 $echo $n "Hmm...  $c"
4067 dflt='/usr/include'
4068 incpath=''
4069 mips_type=''
4070 if $test -f /bin/mips && /bin/mips; then
4071         echo "Looks like a MIPS system..."
4072         $cat >usr.c <<'EOCP'
4073 #ifdef SYSTYPE_BSD43
4074 /bsd43
4075 #endif
4076 EOCP
4077         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4078                 dflt='/bsd43/usr/include'
4079                 incpath='/bsd43'
4080                 mips_type='BSD 4.3'
4081         else
4082                 mips_type='System V'
4083         fi
4084         $rm -f usr.c usr.out
4085         echo "and you're compiling with the $mips_type compiler and libraries."
4086         xxx_prompt=y
4087         echo "exit 0" >mips
4088 else
4089         echo "Doesn't look like a MIPS system."
4090         xxx_prompt=n
4091         echo "exit 1" >mips
4092 fi
4093 chmod +x mips
4094 $eunicefix mips
4095 case "$usrinc" in
4096 '') ;;
4097 *) dflt="$usrinc";;
4098 esac
4099 case "$xxx_prompt" in
4100 y)      fn=d/
4101         echo " "
4102         rp='Where are the include files you want to use?'
4103         . ./getfile
4104         usrinc="$ans"
4105         ;;
4106 *)      usrinc="$dflt"
4107         ;;
4108 esac
4109
4110 : see how we invoke the C preprocessor
4111 echo " "
4112 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4113 cat <<'EOT' >testcpp.c
4114 #define ABC abc
4115 #define XYZ xyz
4116 ABC.XYZ
4117 EOT
4118 cd ..
4119 if test ! -f cppstdin; then
4120         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4121                 # AIX cc -E doesn't show the absolute headerfile
4122                 # locations but we'll cheat by using the -M flag.
4123                 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
4124         else
4125                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4126         fi
4127 else
4128         echo "Keeping your $hint cppstdin wrapper."
4129 fi
4130 chmod 755 cppstdin
4131 wrapper=`pwd`/cppstdin
4132 ok='false'
4133 cd UU
4134
4135 if $test "X$cppstdin" != "X" && \
4136         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4137         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4138 then
4139         echo "You used to use $cppstdin $cppminus so we'll use that again."
4140         case "$cpprun" in
4141         '') echo "But let's see if we can live without a wrapper..." ;;
4142         *)
4143                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4144                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4145                 then
4146                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4147                         ok='true'
4148                 else
4149                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4150                 fi
4151                 ;;
4152         esac
4153 else
4154         case "$cppstdin" in
4155         '') ;;
4156         *)
4157                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4158                 ;;
4159         esac
4160 fi
4161
4162 if $ok; then
4163         : nothing
4164 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4165         $cc -E <testcpp.c >testcpp.out 2>&1; \
4166         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4167         echo "Yup, it does."
4168         x_cpp="$cc -E"
4169         x_minus='';
4170 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4171         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4172         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4173         echo "Yup, it does."
4174         x_cpp="$cc -E"
4175         x_minus='-';
4176 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4177         $cc -P <testcpp.c >testcpp.out 2>&1; \
4178         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4179         echo "Yipee, that works!"
4180         x_cpp="$cc -P"
4181         x_minus='';
4182 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4183         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4184         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4185         echo "At long last!"
4186         x_cpp="$cc -P"
4187         x_minus='-';
4188 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4189         $cpp <testcpp.c >testcpp.out 2>&1; \
4190         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4191         echo "It works!"
4192         x_cpp="$cpp"
4193         x_minus='';
4194 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4195         $cpp - <testcpp.c >testcpp.out 2>&1; \
4196         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4197         echo "Hooray, it works!  I was beginning to wonder."
4198         x_cpp="$cpp"
4199         x_minus='-';
4200 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4201         $wrapper <testcpp.c >testcpp.out 2>&1; \
4202         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4203         x_cpp="$wrapper"
4204         x_minus=''
4205         echo "Eureka!"
4206 else
4207         dflt=''
4208         rp="No dice.  I can't find a C preprocessor.  Name one:"
4209         . ./myread
4210         x_cpp="$ans"
4211         x_minus=''
4212         $x_cpp <testcpp.c >testcpp.out 2>&1
4213         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4214                 echo "OK, that will do." >&4
4215         else
4216 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4217                 exit 1
4218         fi
4219 fi
4220
4221 case "$ok" in
4222 false)
4223         cppstdin="$x_cpp"
4224         cppminus="$x_minus"
4225         cpprun="$x_cpp"
4226         cpplast="$x_minus"
4227         set X $x_cpp
4228         shift
4229         case "$1" in
4230         "$cpp")
4231                 echo "Perhaps can we force $cc -E using a wrapper..."
4232                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4233                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4234                 then
4235                         echo "Yup, we can."
4236                         cppstdin="$wrapper"
4237                         cppminus='';
4238                 else
4239                         echo "Nope, we'll have to live without it..."
4240                 fi
4241                 ;;
4242         esac
4243         case "$cpprun" in
4244         "$wrapper")
4245                 cpprun=''
4246                 cpplast=''
4247                 ;;
4248         esac
4249         ;;
4250 esac
4251
4252 case "$cppstdin" in
4253 "$wrapper"|'cppstdin') ;;
4254 *) $rm -f $wrapper;;
4255 esac
4256 $rm -f testcpp.c testcpp.out
4257
4258 : Set private lib path
4259 case "$plibpth" in
4260 '') if ./mips; then
4261                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4262         fi;;
4263 esac
4264 case "$libpth" in
4265 ' ') dlist='';;
4266 '') dlist="$loclibpth $plibpth $glibpth";;
4267 *) dlist="$libpth";;
4268 esac
4269
4270 : Now check and see which directories actually exist, avoiding duplicates
4271 libpth=''
4272 for xxx in $dlist
4273 do
4274     if $test -d $xxx; then
4275                 case " $libpth " in
4276                 *" $xxx "*) ;;
4277                 *) libpth="$libpth $xxx";;
4278                 esac
4279     fi
4280 done
4281 $cat <<'EOM'
4282
4283 Some systems have incompatible or broken versions of libraries.  Among
4284 the directories listed in the question below, please remove any you
4285 know not to be holding relevant libraries, and add any that are needed.
4286 Say "none" for none.
4287
4288 EOM
4289 case "$libpth" in
4290 '') dflt='none';;
4291 *)
4292         set X $libpth
4293         shift
4294         dflt=${1+"$@"}
4295         ;;
4296 esac
4297 rp="Directories to use for library searches?"
4298 . ./myread
4299 case "$ans" in
4300 none) libpth=' ';;
4301 *) libpth="$ans";;
4302 esac
4303
4304 : compute shared library extension
4305 case "$so" in
4306 '')
4307         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4308                 dflt='sl'
4309         else
4310                 dflt='so'
4311         fi
4312         ;;
4313 *) dflt="$so";;
4314 esac
4315 $cat <<EOM
4316
4317 On some systems, shared libraries may be available.  Answer 'none' if
4318 you want to suppress searching of shared libraries for the remainder
4319 of this configuration.
4320
4321 EOM
4322 rp='What is the file extension used for shared libraries?'
4323 . ./myread
4324 so="$ans"
4325
4326 : Define several unixisms.
4327 : Hints files or command line option can be used to override them.
4328 : The convoluted testing is in case hints files set either the old
4329 : or the new name.
4330 case "$_exe" in
4331 '')     case "$exe_ext" in
4332         '')     ;;
4333         *)      _exe="$exe_ext" ;;
4334         esac
4335         ;;
4336 esac
4337 case "$_a" in
4338 '')     case "$lib_ext" in
4339     '') _a='.a';;
4340         *)      _a="$lib_ext" ;;
4341         esac
4342         ;;
4343 esac
4344 case "$_o" in
4345 '') case "$obj_ext" in
4346         '')     _o='.o';;
4347         *)      _o="$obj_ext";;
4348         esac
4349         ;;
4350 esac
4351 case "$p_" in
4352 '') case "$path_sep" in
4353         '')     p_=':';;
4354         *)      p_="$path_sep";;
4355         esac
4356         ;;
4357 esac
4358 exe_ext=$_exe
4359 lib_ext=$_a
4360 obj_ext=$_o
4361 path_sep=$p_
4362
4363 : Which makefile gets called first.  This is used by make depend.
4364 case "$firstmakefile" in
4365 '') firstmakefile='makefile';;
4366 esac
4367
4368 case "$usesocks" in
4369 $define|true|[yY]*)     dflt='y';;
4370 *) dflt='n';;
4371 esac
4372 cat <<EOM
4373
4374 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4375 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4376 to use the PerlIO abstraction layer, this will be implicitly selected.
4377
4378 If this doesn't make any sense to you, just accept the default '$dflt'.
4379 EOM
4380 rp='Build Perl for SOCKS?'
4381 . ./myread
4382 case "$ans" in
4383 y|Y)    val="$define" ;;     
4384 *)      val="$undef" ;;
4385 esac
4386 set usesocks
4387 eval $setvar
4388
4389 case "$usesocks" in
4390 $define|true|[yY]*) useperlio="$define";;
4391 esac
4392
4393 : Looking for optional libraries
4394 echo " "
4395 echo "Checking for optional libraries..." >&4
4396 case "$libs" in
4397 ' '|'') dflt='';;
4398 *) dflt="$libs";;
4399 esac
4400 case "$libswanted" in
4401 '') libswanted='c_s';;
4402 esac
4403 case "$usesocks" in
4404 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4405 esac
4406 libsfound=''
4407 libsfiles=''
4408 libsdirs=''
4409 libspath=''
4410 for thisdir in $libpth $xlibpth; do
4411   test -d $thisdir && libspath="$libspath $thisdir"
4412 done
4413 for thislib in $libswanted; do
4414         for thisdir in $libspath; do
4415             xxx=''
4416             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4417                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4418                 $test -f "$xxx" && eval $libscheck
4419                 $test -f "$xxx" && libstyle=shared
4420             fi
4421             if test ! -f "$xxx"; then
4422                 xxx=$thisdir/lib$thislib.$so
4423                 $test -f "$xxx" && eval $libscheck
4424                 $test -f "$xxx" && libstyle=shared
4425             fi  
4426             if test ! -f "$xxx"; then
4427                 xxx=$thisdir/lib$thislib$_a
4428                 $test -f "$xxx" && eval $libscheck
4429                 $test -f "$xxx" && libstyle=static
4430             fi
4431             if test ! -f "$xxx"; then
4432                 xxx=$thisdir/$thislib$_a
4433                 $test -f "$xxx" && eval $libscheck
4434                 $test -f "$xxx" && libstyle=static
4435             fi
4436             if test ! -f "$xxx"; then
4437                 xxx=$thisdir/lib${thislib}_s$_a
4438                 $test -f "$xxx" && eval $libscheck
4439                 $test -f "$xxx" && libstyle=static
4440                 $test -f "$xxx" && thislib=${thislib}_s
4441             fi
4442             if test ! -f "$xxx"; then
4443                 xxx=$thisdir/Slib$thislib$_a
4444                 $test -f "$xxx" && eval $libscheck
4445                 $test -f "$xxx" && libstyle=static
4446             fi
4447             if $test -f "$xxx"; then
4448                 case "$libstyle" in
4449                 shared) echo "Found -l$thislib (shared)." ;;
4450                 static) echo "Found -l$thislib." ;;
4451                 *)      echo "Found -l$thislib ($libstyle)." ;;
4452                 esac
4453                 case " $dflt " in
4454                 *"-l$thislib "*);;
4455                 *) dflt="$dflt -l$thislib"
4456                    libsfound="$libsfound $xxx"
4457                    yyy=`basename $xxx`
4458                    libsfiles="$libsfiles $yyy"
4459                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4460                    case " $libsdirs " in
4461                    *" $yyy "*) ;;
4462                    *) libsdirs="$libsdirs $yyy" ;;
4463                    esac
4464                    ;;
4465                 esac
4466                 break
4467             fi  
4468         done
4469         if $test ! -f "$xxx"; then
4470             echo "No -l$thislib."
4471         fi
4472 done
4473 set X $dflt
4474 shift
4475 dflt="$*"
4476 case "$libs" in
4477 '') dflt="$dflt";;
4478 *) dflt="$libs";;
4479 esac
4480 case "$dflt" in
4481 ' '|'') dflt='none';;
4482 esac
4483
4484 $cat <<EOM
4485
4486 In order to compile $package on your machine, a number of libraries
4487 are usually needed.  Include any other special libraries here as well.
4488 Say "none" for none.  The default list is almost always right.
4489 EOM
4490
4491 echo " "
4492 rp="What libraries to use?"
4493 . ./myread
4494 case "$ans" in
4495 none) libs=' ';;
4496 *) libs="$ans";;
4497 esac
4498
4499 : determine optimization, if desired, or use for debug flag also
4500 case "$optimize" in
4501 ' '|$undef) dflt='none';;
4502 '') dflt='-O';;
4503 *) dflt="$optimize";;
4504 esac
4505 $cat <<EOH
4506
4507 By default, $package compiles with the -O flag to use the optimizer.
4508 Alternately, you might want to use the symbolic debugger, which uses
4509 the -g flag (on traditional Unix systems).  Either flag can be
4510 specified here.  To use neither flag, specify the word "none".
4511
4512 EOH
4513 rp="What optimizer/debugger flag should be used?"
4514 . ./myread
4515 optimize="$ans"
4516 case "$optimize" in
4517 'none') optimize=" ";;
4518 esac
4519
4520 dflt=''
4521 : We will not override a previous value, but we might want to
4522 : augment a hint file
4523 case "$hint" in
4524 default|recommended)
4525         case "$gccversion" in
4526         1*) dflt='-fpcc-struct-return' ;;
4527         esac
4528         case "$optimize" in
4529         *-g*) dflt="$dflt -DDEBUGGING";;
4530         esac
4531         case "$gccversion" in
4532         2*) if test -d /etc/conf/kconfig.d &&
4533                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4534                 then
4535                         dflt="$dflt -posix"
4536                 fi
4537                 ;;
4538         esac
4539         case "$gccversion" in
4540         1*) ;;
4541         2.[0-8]*) ;;
4542         ?*)     echo " "
4543                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4544                 echo 'int main(void) { return 0; }' > gcctest.c
4545                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4546                         echo "Yes, it does." 2>&1
4547                         case "$ccflags" in
4548                         *strict-aliasing*) 
4549                                 echo "Leaving current flags $ccflags alone." 2>&1
4550                                 ;;
4551                         *) dflt="$dflt -fno-strict-aliasing" ;;
4552                         esac
4553                 else
4554                         echo "Nope, it doesn't, but that's ok." 2>&1
4555                 fi
4556                 ;;
4557         esac
4558         ;;
4559 esac
4560
4561 case "$mips_type" in
4562 *BSD*|'') inclwanted="$locincpth $usrinc";;
4563 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4564 esac
4565 for thisincl in $inclwanted; do
4566         if $test -d $thisincl; then
4567                 if $test x$thisincl != x$usrinc; then
4568                         case "$dflt" in
4569                         *" -I$thisincl "*);;
4570                         *) dflt="$dflt -I$thisincl ";;
4571                         esac
4572                 fi
4573         fi
4574 done
4575
4576 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4577         xxx=true;
4578 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4579         xxx=true;
4580 else
4581         xxx=false;
4582 fi;
4583 if $xxx; then
4584         case "$dflt" in
4585         *$2*);;
4586         *) dflt="$dflt -D$2";;
4587         esac;
4588 fi'
4589
4590 set signal.h LANGUAGE_C; eval $inctest
4591
4592 case "$usesocks" in
4593 $define)
4594         ccflags="$ccflags -DSOCKS"
4595         ;;
4596 esac
4597
4598 case "$hint" in
4599 default|recommended) dflt="$ccflags $dflt" ;;
4600 *) dflt="$ccflags";;
4601 esac
4602
4603 case "$dflt" in
4604 ''|' ') dflt=none;;
4605 esac
4606
4607 $cat <<EOH
4608
4609 Your C compiler may want other flags.  For this question you should include
4610 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4611 but you should NOT include libraries or ld flags like -lwhatever.  If you
4612 want $package to honor its debug switch, you should include -DDEBUGGING here.
4613 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4614
4615 To use no flags, specify the word "none".
4616
4617 EOH
4618 set X $dflt
4619 shift
4620 dflt=${1+"$@"}
4621 rp="Any additional cc flags?"
4622 . ./myread
4623 case "$ans" in
4624 none) ccflags='';;
4625 *) ccflags="$ans";;
4626 esac
4627
4628 : the following weeds options from ccflags that are of no interest to cpp
4629 case "$cppflags" in
4630 '') cppflags="$ccflags" ;;
4631 *)  cppflags="$cppflags $ccflags" ;;
4632 esac
4633 case "$gccversion" in
4634 1*) cppflags="$cppflags -D__GNUC__"
4635 esac
4636 case "$mips_type" in
4637 '');;
4638 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4639 esac
4640 case "$cppflags" in
4641 '');;
4642 *)
4643         echo " "
4644         echo "Let me guess what the preprocessor flags are..." >&4
4645         set X $cppflags
4646         shift
4647         cppflags=''
4648         $cat >cpp.c <<'EOM'
4649 #define BLURFL foo
4650
4651 BLURFL xx LFRULB
4652 EOM
4653         previous=''
4654         for flag in $*
4655         do
4656                 case "$flag" in
4657                 -*) ftry="$flag";;
4658                 *) ftry="$previous $flag";;
4659                 esac
4660                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4661                         >cpp1.out 2>/dev/null && \
4662                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4663                         >cpp2.out 2>/dev/null && \
4664                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4665                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4666                 then
4667                         cppflags="$cppflags $ftry"
4668                         previous=''
4669                 else
4670                         previous="$flag"
4671                 fi
4672         done
4673         set X $cppflags
4674         shift
4675         cppflags=${1+"$@"}
4676         case "$cppflags" in
4677         *-*)  echo "They appear to be: $cppflags";;
4678         esac
4679         $rm -f cpp.c cpp?.out
4680         ;;
4681 esac
4682
4683 : flags used in final linking phase
4684 case "$ldflags" in
4685 '') if ./venix; then
4686                 dflt='-i -z'
4687         else
4688                 dflt=''
4689         fi
4690         case "$ccflags" in
4691         *-posix*) dflt="$dflt -posix" ;;
4692         esac
4693         ;;
4694 *) dflt="$ldflags";;
4695 esac
4696
4697 : Try to guess additional flags to pick up local libraries.
4698 for thislibdir in $libpth; do
4699         case " $loclibpth " in
4700         *" $thislibdir "*)
4701                 case "$dflt " in 
4702                 *"-L$thislibdir "*) ;;
4703                 *)  dflt="$dflt -L$thislibdir" ;;
4704                 esac
4705                 ;;
4706         esac
4707 done
4708
4709 case "$dflt" in
4710 '') dflt='none' ;;
4711 esac
4712
4713 $cat <<EOH
4714
4715 Your C linker may need flags.  For this question you should
4716 include -L/whatever and any other flags used by the C linker, but you
4717 should NOT include libraries like -lwhatever.
4718
4719 Make sure you include the appropriate -L/path flags if your C linker
4720 does not normally search all of the directories you specified above,
4721 namely
4722         $libpth
4723 To use no flags, specify the word "none".
4724
4725 EOH
4726
4727 rp="Any additional ld flags (NOT including libraries)?"
4728 . ./myread
4729 case "$ans" in
4730 none) ldflags='';;
4731 *) ldflags="$ans";;
4732 esac
4733 rmlist="$rmlist pdp11"
4734
4735 : coherency check
4736 echo " "
4737 echo "Checking your choice of C compiler and flags for coherency..." >&4
4738 $cat > try.c <<'EOF'
4739 #include <stdio.h>
4740 int main() { printf("Ok\n"); exit(0); }
4741 EOF
4742 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4743 shift
4744 $cat >try.msg <<'EOM'
4745 I've tried to compile and run the following simple program:
4746
4747 EOM
4748 $cat try.c >> try.msg
4749
4750 $cat >> try.msg <<EOM
4751
4752 I used the command:
4753
4754         $*
4755         $run ./try
4756
4757 and I got the following output:
4758
4759 EOM
4760 dflt=y
4761 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4762         if $sh -c "$run ./try" >>try.msg 2>&1; then
4763                 xxx=`$run ./try`
4764                 case "$xxx" in
4765                 "Ok") dflt=n ;;
4766                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4767                         case " $libs " in
4768                         *" -lsfio "*)
4769                                 cat >> try.msg <<'EOQS'
4770 If $libs contains -lsfio, and sfio is mis-configured, then it
4771 sometimes (apparently) runs and exits with a 0 status, but with no
4772 output!  It may have to do with sfio's use of _exit vs. exit.
4773
4774 EOQS
4775                                 rp="You have a big problem.  Shall I abort Configure"
4776                                 dflt=y
4777                                 ;;
4778                         esac
4779                         ;;
4780                 esac
4781         else
4782                 echo "The program compiled OK, but exited with status $?." >>try.msg
4783                 rp="You have a problem.  Shall I abort Configure"
4784                 dflt=y
4785         fi
4786 else
4787         echo "I can't compile the test program." >>try.msg
4788         rp="You have a BIG problem.  Shall I abort Configure"
4789         dflt=y
4790 fi
4791 case "$dflt" in
4792 y)
4793         $cat try.msg >&4
4794         case "$knowitall" in
4795         '')
4796                 echo "(The supplied flags or libraries might be incorrect.)"
4797                 ;;
4798         *) dflt=n;;
4799         esac
4800         echo " "
4801         . ./myread
4802         case "$ans" in
4803         n*|N*) ;;
4804         *)      echo "Ok.  Stopping Configure." >&4
4805                 exit 1
4806                 ;;
4807         esac
4808         ;;
4809 n) echo "OK, that should do.";;
4810 esac
4811 $rm -f try try.* core
4812
4813 : define a shorthand compile call
4814 compile='
4815 mc_file=$1;
4816 shift;
4817 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4818 : define a shorthand compile call for compilations that should be ok.
4819 compile_ok='
4820 mc_file=$1;
4821 shift;
4822 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4823
4824 : check for lengths of integral types
4825 echo " "
4826 case "$intsize" in
4827 '')
4828         echo "Checking to see how big your integers are..." >&4
4829         $cat >try.c <<'EOCP'
4830 #include <stdio.h>
4831 int main()
4832 {
4833         printf("intsize=%d;\n", (int)sizeof(int));
4834         printf("longsize=%d;\n", (int)sizeof(long));
4835         printf("shortsize=%d;\n", (int)sizeof(short));
4836         exit(0);
4837 }
4838 EOCP
4839         set try
4840         if eval $compile_ok && $run ./try > /dev/null; then
4841                 eval `$run ./try`
4842                 echo "Your integers are $intsize bytes long."
4843                 echo "Your long integers are $longsize bytes long."
4844                 echo "Your short integers are $shortsize bytes long."
4845         else
4846                 $cat >&4 <<EOM
4847 !
4848 Help! I can't compile and run the intsize test program: please enlighten me!
4849 (This is probably a misconfiguration in your system or libraries, and
4850 you really ought to fix it.  Still, I'll try anyway.)
4851 !
4852 EOM
4853                 dflt=4
4854                 rp="What is the size of an integer (in bytes)?"
4855                 . ./myread
4856                 intsize="$ans"
4857                 dflt=$intsize
4858                 rp="What is the size of a long integer (in bytes)?"
4859                 . ./myread
4860                 longsize="$ans"
4861                 dflt=2
4862                 rp="What is the size of a short integer (in bytes)?"
4863                 . ./myread
4864                 shortsize="$ans"
4865         fi
4866         ;;
4867 esac
4868 $rm -f try try.*
4869
4870 : check for long long
4871 echo " "
4872 echo "Checking to see if you have long long..." >&4
4873 echo 'int main() { long long x = 7; return 0; }' > try.c
4874 set try
4875 if eval $compile; then
4876         val="$define"
4877         echo "You have long long."
4878 else
4879         val="$undef"
4880         echo "You do not have long long."
4881 fi
4882 $rm try.*
4883 set d_longlong
4884 eval $setvar
4885
4886 : check for length of long long
4887 case "${d_longlong}${longlongsize}" in
4888 $define)
4889         echo " "
4890         echo "Checking to see how big your long longs are..." >&4
4891         $cat >try.c <<'EOCP'
4892 #include <stdio.h>
4893 int main()
4894 {
4895     printf("%d\n", (int)sizeof(long long));
4896     return(0);
4897 }
4898 EOCP
4899         set try
4900         if eval $compile_ok; then
4901                 longlongsize=`$run ./try`
4902                 echo "Your long longs are $longlongsize bytes long."
4903         else
4904                 dflt='8'
4905                 echo " "
4906                 echo "(I can't seem to compile the test program.  Guessing...)"
4907                 rp="What is the size of a long long (in bytes)?"
4908                 . ./myread
4909                 longlongsize="$ans"
4910         fi
4911         if $test "X$longsize" = "X$longlongsize"; then
4912                 echo "(That isn't any different from an ordinary long.)"
4913         fi      
4914         ;;
4915 esac
4916 $rm -f try.* try
4917
4918 : determine filename position in cpp output
4919 echo " "
4920 echo "Computing filename position in cpp output for #include directives..." >&4
4921 case "$osname" in
4922 vos) testaccess=-e ;;
4923 *)   testaccess=-r ;;
4924 esac
4925 echo '#include <stdio.h>' > foo.c
4926 $cat >fieldn <<EOF
4927 $startsh
4928 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4929 $grep '^[       ]*#.*stdio\.h' | \
4930 while read cline; do
4931         pos=1
4932         set \$cline
4933         while $test \$# -gt 0; do
4934                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4935                         echo "\$pos"
4936                         exit 0
4937                 fi
4938                 shift
4939                 pos=\`expr \$pos + 1\`
4940         done
4941 done
4942 EOF
4943 chmod +x fieldn
4944 fieldn=`./fieldn`
4945 $rm -f foo.c fieldn
4946 case $fieldn in
4947 '') pos='???';;
4948 1) pos=first;;
4949 2) pos=second;;
4950 3) pos=third;;
4951 *) pos="${fieldn}th";;
4952 esac
4953 echo "Your cpp writes the filename in the $pos field of the line."
4954
4955 case "$osname" in
4956 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4957 *)   cppfilter='' ;;
4958 esac
4959 : locate header file
4960 $cat >findhdr <<EOF
4961 $startsh
4962 wanted=\$1
4963 name=''
4964 for usrincdir in $usrinc
4965 do
4966         if test -f \$usrincdir/\$wanted; then
4967                 echo "\$usrincdir/\$wanted"
4968                 exit 0
4969         fi
4970 done
4971 awkprg='{ print \$$fieldn }'
4972 echo "#include <\$wanted>" > foo\$\$.c
4973 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4974 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4975 while read cline; do
4976         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4977         case "\$name" in
4978         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4979         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4980         *) exit 2;;
4981         esac;
4982 done;
4983 #
4984 # status = 0: grep returned 0 lines, case statement not executed
4985 # status = 1: headerfile found
4986 # status = 2: while loop executed, no headerfile found
4987 #
4988 status=\$?
4989 $rm -f foo\$\$.c;
4990 if test \$status -eq 1; then
4991         exit 0;
4992 fi
4993 exit 1
4994 EOF
4995 chmod +x findhdr
4996
4997 : define an alternate in-header-list? function
4998 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4999 cont=true; xxf="echo \"<\$1> found.\" >&4";
5000 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5001 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5002 esac;
5003 case $# in 4) instead=instead;; *) instead="at last";; esac;
5004 while $test "$cont"; do
5005         xxx=`./findhdr $1`
5006         var=$2; eval "was=\$$2";
5007         if $test "$xxx" && $test -r "$xxx";
5008         then eval $xxf;
5009         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5010                 cont="";
5011         else eval $xxnf;
5012         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5013         set $yyy; shift; shift; yyy=$@;
5014         case $# in 0) cont="";;
5015         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5016                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5017         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5018                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5019         esac;
5020 done;
5021 while $test "$yyy";
5022 do set $yyy; var=$2; eval "was=\$$2";
5023         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5024         set $yyy; shift; shift; yyy=$@;
5025 done'
5026
5027 : see if inttypes.h is available
5028 : we want a real compile instead of Inhdr because some systems
5029 : have an inttypes.h which includes non-existent headers
5030 echo " "
5031 $cat >try.c <<EOCP
5032 #include <inttypes.h>
5033 int main() {
5034         static int32_t foo32 = 0x12345678;
5035 }
5036 EOCP
5037 set try
5038 if eval $compile; then
5039         echo "<inttypes.h> found." >&4
5040         val="$define"
5041 else
5042         echo "<inttypes.h> NOT found." >&4
5043         val="$undef"
5044 fi
5045 $rm -f try.c try
5046 set i_inttypes
5047 eval $setvar
5048
5049 : check for int64_t
5050 echo " "
5051 echo "Checking to see if you have int64_t..." >&4
5052 $cat >try.c <<EOCP
5053 #include <sys/types.h>
5054 #$i_inttypes I_INTTYPES
5055 #ifdef I_INTTYPES
5056 #include <inttypes.h>
5057 #endif
5058 int main() { int64_t x = 7; }
5059 EOCP
5060 set try
5061 if eval $compile; then
5062         val="$define"
5063         echo "You have int64_t."
5064 else
5065         val="$undef"
5066         echo "You do not have int64_t."
5067 fi
5068 $rm -f try try.*
5069 set d_int64_t
5070 eval $setvar
5071
5072
5073 echo " "
5074 echo "Checking which 64-bit integer type we could use..." >&4
5075
5076 case "$intsize" in
5077 8) val=int
5078    set quadtype
5079    eval $setvar
5080    val='"unsigned int"'
5081    set uquadtype
5082    eval $setvar
5083    quadkind=1
5084    ;;
5085 *) case "$longsize" in
5086    8) val=long
5087       set quadtype
5088       eval $setvar
5089       val='"unsigned long"'
5090       set uquadtype
5091       eval $setvar
5092       quadkind=2
5093       ;;
5094    *) case "$d_longlong:$longlongsize" in
5095       define:8)
5096         val='"long long"'
5097         set quadtype
5098         eval $setvar
5099         val='"unsigned long long"'
5100         set uquadtype
5101         eval $setvar
5102         quadkind=3
5103         ;;
5104       *) case "$d_int64_t" in
5105          define)
5106            val=int64_t
5107            set quadtype
5108            eval $setvar
5109            val=uint64_t
5110            set uquadtype
5111            eval $setvar
5112            quadkind=4
5113            ;;
5114          esac
5115          ;;
5116       esac
5117       ;;
5118    esac
5119    ;;
5120 esac
5121
5122 case "$quadtype" in
5123 '')     echo "Alas, no 64-bit integer types in sight." >&4
5124         d_quad="$undef"
5125         ;;
5126 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5127         d_quad="$define"
5128         ;;
5129 esac
5130
5131
5132 case "$uselonglong" in
5133 "$define"|true|[yY]*)
5134         cat <<EOM >&4
5135
5136 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5137 EOM
5138         use64bitint="$define"
5139         ;;
5140 esac                          
5141 case "$use64bits" in
5142 "$define"|true|[yY]*)
5143         cat <<EOM >&4
5144
5145 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5146 EOM
5147         use64bitint="$define"
5148         ;;
5149 esac                          
5150 case "$use64bitints" in
5151 "$define"|true|[yY]*)
5152         cat <<EOM >&4
5153
5154 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5155 EOM
5156         use64bitint="$define"
5157         ;;
5158 esac                          
5159 case "$use64bitsint" in
5160 "$define"|true|[yY]*)
5161         cat <<EOM >&4
5162
5163 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5164 EOM
5165         use64bitint="$define"
5166         ;;
5167 esac                          
5168 case "$uselonglongs" in
5169 "$define"|true|[yY]*)
5170         cat <<EOM >&4
5171
5172 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5173 EOM
5174         use64bitint="$define"
5175         ;;
5176 esac                          
5177 case "$use64bitsall" in
5178 "$define"|true|[yY]*)
5179         cat <<EOM >&4
5180
5181 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5182 EOM
5183         use64bitall="$define"
5184         ;;
5185 esac                          
5186
5187 case "$ccflags" in
5188 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5189 esac
5190 case "$use64bitall" in
5191 "$define"|true|[yY]*) use64bitint="$define" ;;
5192 esac
5193
5194 case "$longsize" in
5195 8) cat <<EOM
5196
5197 You have natively 64-bit long integers.
5198 EOM
5199    val="$define"
5200    ;;
5201 *) case "$use64bitint" in
5202    "$define"|true|[yY]*) dflt='y';;
5203    *) dflt='n';;
5204    esac
5205    case "$d_quad" in
5206    "$define") ;;
5207    *) dflt='n' ;;
5208    esac
5209    cat <<EOM
5210
5211 Perl can be built to take advantage of 64-bit integer types
5212 on some systems.  To do so, Configure can be run with -Duse64bitint.
5213 Choosing this option will most probably introduce binary incompatibilities.
5214
5215 If this doesn't make any sense to you, just accept the default '$dflt'.
5216 (The default has been chosen based on your configuration.)
5217 EOM
5218    rp='Try to use 64-bit integers, if available?'
5219    . ./myread
5220    case "$ans" in
5221    [yY]*) val="$define" ;;
5222    *)     val="$undef"  ;;
5223    esac
5224    ;;
5225 esac
5226 set use64bitint
5227 eval $setvar
5228
5229 case "$use64bitall" in
5230 "$define"|true|[yY]*) dflt='y' ;;
5231 *) case "$longsize" in
5232    8) dflt='y' ;;
5233    *) dflt='n' ;;
5234    esac
5235    ;;
5236 esac    
5237 cat <<EOM
5238
5239 You may also choose to try maximal 64-bitness.  It means using as much
5240 64-bitness as possible on the platform.  This in turn means even more
5241 binary incompatibilities.  On the other hand, your platform may not
5242 have any more 64-bitness available than what you already have chosen.
5243
5244 If this doesn't make any sense to you, just accept the default '$dflt'.
5245 (The default has been chosen based on your configuration.)
5246 EOM
5247 rp='Try to use maximal 64-bit support, if available?'
5248 . ./myread
5249 case "$ans" in
5250 [yY]*) val="$define" ;;
5251 *)     val="$undef"  ;;
5252 esac
5253 set use64bitall
5254 eval $setvar
5255 case "$use64bitall" in
5256 "$define")
5257         case "$use64bitint" in
5258         "$undef")
5259                 cat <<EOM
5260
5261 Since you have chosen a maximally 64-bit build, I'm also turning on
5262 the use of 64-bit integers.
5263 EOM
5264                 use64bitint="$define" ;;
5265         esac
5266         ;;
5267 esac
5268
5269 case "$use64bitint" in
5270 "$define"|true|[yY]*)
5271 : Look for a hint-file generated 'call-back-unit'.  If the
5272 : user has specified that a 64-bit perl is to be built,
5273 : we may need to set or change some other defaults.
5274         if $test -f use64bitint.cbu; then
5275                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5276                 . ./use64bitint.cbu
5277         fi
5278         case "$longsize" in
5279         4) case "$archname64" in
5280            '') archname64=64int ;;
5281            esac
5282            ;;
5283         esac
5284         ;;
5285 esac
5286
5287 case "$use64bitall" in
5288 "$define"|true|[yY]*)
5289 : Look for a hint-file generated 'call-back-unit'.  If the
5290 : user has specified that a maximally 64-bit perl is to be built,
5291 : we may need to set or change some other defaults.
5292         if $test -f use64bitall.cbu; then
5293                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5294                 . ./use64bitall.cbu
5295         fi
5296         case "$longsize" in
5297         4) case "$archname64" in
5298            ''|64int) archname64=64all ;;
5299            esac
5300            ;;
5301         esac
5302         ;;
5303 esac
5304
5305 echo " "
5306 echo "Checking for GNU C Library..." >&4
5307 cat >try.c <<'EOCP'
5308 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5309    alone are insufficient to distinguish different versions, such as
5310    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5311    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5312 */
5313 #include <stdio.h>
5314 int main(void)
5315 {
5316 #ifdef __GLIBC__
5317 #   ifdef __GLIBC_MINOR__
5318 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5319 #           include <gnu/libc-version.h>
5320             printf("%s\n",  gnu_get_libc_version());
5321 #       else
5322             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5323 #       endif
5324 #   else
5325         printf("%d\n",  __GLIBC__);
5326 #   endif
5327     return 0;
5328 #else
5329     return 1;
5330 #endif
5331 }
5332 EOCP
5333 set try
5334 if eval $compile_ok && $run ./try > glibc.ver; then
5335         val="$define"
5336         gnulibc_version=`$cat glibc.ver`
5337         echo "You are using the GNU C Library version $gnulibc_version"
5338 else
5339         val="$undef"
5340         gnulibc_version=''
5341         echo "You are not using the GNU C Library"
5342 fi
5343 $rm -f try try.* glibc.ver
5344 set d_gnulibc
5345 eval $setvar
5346
5347 : see if nm is to be used to determine whether a symbol is defined or not
5348 case "$usenm" in
5349 '')
5350         dflt=''
5351         case "$d_gnulibc" in
5352         "$define")
5353                 echo " "
5354                 echo "nm probably won't work on the GNU C Library." >&4
5355                 dflt=n
5356                 ;;
5357         esac
5358         case "$dflt" in
5359         '') 
5360                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5361                         echo " "
5362                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5363                         echo "'nm' won't be sufficient on this sytem." >&4
5364                         dflt=n
5365                 fi
5366                 ;;
5367         esac
5368         case "$dflt" in
5369         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5370                 if $test $dflt -gt 20; then
5371                         dflt=y
5372                 else
5373                         dflt=n
5374                 fi
5375                 ;;
5376         esac
5377         ;;
5378 *)
5379         case "$usenm" in
5380         true|$define) dflt=y;;
5381         *) dflt=n;;
5382         esac
5383         ;;
5384 esac
5385 $cat <<EOM
5386
5387 I can use $nm to extract the symbols from your C libraries. This
5388 is a time consuming task which may generate huge output on the disk (up
5389 to 3 megabytes) but that should make the symbols extraction faster. The
5390 alternative is to skip the 'nm' extraction part and to compile a small
5391 test program instead to determine whether each symbol is present. If
5392 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5393 this may be the best solution.
5394
5395 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5396
5397 EOM
5398 rp="Shall I use $nm to extract C symbols from the libraries?"
5399 . ./myread
5400 case "$ans" in
5401 [Nn]*) usenm=false;;
5402 *) usenm=true;;
5403 esac
5404
5405 runnm=$usenm
5406 case "$reuseval" in
5407 true) runnm=false;;
5408 esac
5409
5410 : nm options which may be necessary
5411 case "$nm_opt" in
5412 '') if $test -f /mach_boot; then
5413                 nm_opt=''       # Mach
5414         elif $test -d /usr/ccs/lib; then
5415                 nm_opt='-p'     # Solaris (and SunOS?)
5416         elif $test -f /dgux; then
5417                 nm_opt='-p'     # DG-UX
5418         elif $test -f /lib64/rld; then
5419                 nm_opt='-p'     # 64-bit Irix
5420         else
5421                 nm_opt=''
5422         fi;;
5423 esac
5424
5425 : nm options which may be necessary for shared libraries but illegal
5426 : for archive libraries.  Thank you, Linux.
5427 case "$nm_so_opt" in
5428 '')     case "$myuname" in
5429         *linux*)
5430                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5431                         nm_so_opt='--dynamic'
5432                 fi
5433                 ;;
5434         esac
5435         ;;
5436 esac
5437
5438 case "$runnm" in
5439 true)
5440 : get list of predefined functions in a handy place
5441 echo " "
5442 case "$libc" in
5443 '') libc=unknown
5444         case "$libs" in
5445         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5446         esac
5447         ;;
5448 esac
5449 case "$libs" in
5450 '') ;;
5451 *)  for thislib in $libs; do
5452         case "$thislib" in
5453         -lc|-lc_s)
5454                 : Handle C library specially below.
5455                 ;;
5456         -l*)
5457                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5458                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5459                         :
5460                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5461                         :
5462                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5463                         :
5464                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5465                         :
5466                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5467                         :
5468                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5469                         :
5470                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5471                         :
5472                 else
5473                         try=''
5474                 fi
5475                 libnames="$libnames $try"
5476                 ;;
5477         *) libnames="$libnames $thislib" ;;
5478         esac
5479         done
5480         ;;
5481 esac
5482 xxx=normal
5483 case "$libc" in
5484 unknown)
5485         set /lib/libc.$so
5486         for xxx in $libpth; do
5487                 $test -r $1 || set $xxx/libc.$so
5488                 : The messy sed command sorts on library version numbers.
5489                 $test -r $1 || \
5490                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5491                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5492                                 h
5493                                 s/[0-9][0-9]*/0000&/g
5494                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5495                                 G
5496                                 s/\n/ /' | \
5497                          $sort | $sed -e 's/^.* //'`
5498                 eval set \$$#
5499         done
5500         $test -r $1 || set /usr/ccs/lib/libc.$so
5501         $test -r $1 || set /lib/libsys_s$_a
5502         ;;
5503 *)
5504         set blurfl
5505         ;;
5506 esac
5507 if $test -r "$1"; then
5508         echo "Your (shared) C library seems to be in $1."
5509         libc="$1"
5510 elif $test -r /lib/libc && $test -r /lib/clib; then
5511         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5512         xxx=apollo
5513         libc='/lib/clib /lib/libc'
5514         if $test -r /lib/syslib; then
5515                 echo "(Your math library is in /lib/syslib.)"
5516                 libc="$libc /lib/syslib"
5517         fi
5518 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5519         echo "Your C library seems to be in $libc, as you said before."
5520 elif $test -r $incpath/usr/lib/libc$_a; then
5521         libc=$incpath/usr/lib/libc$_a;
5522         echo "Your C library seems to be in $libc.  That's fine."
5523 elif $test -r /lib/libc$_a; then
5524         libc=/lib/libc$_a;
5525         echo "Your C library seems to be in $libc.  You're normal."
5526 else
5527         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5528                 :
5529         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5530                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5531         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5532                 :
5533         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5534                 :
5535         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5536                 :
5537         else
5538                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5539         fi
5540         if $test -r "$tans"; then
5541                 echo "Your C library seems to be in $tans, of all places."
5542                 libc=$tans
5543         else
5544                 libc='blurfl'
5545         fi
5546 fi
5547 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5548         dflt="$libc"
5549         cat <<EOM
5550
5551 If the guess above is wrong (which it might be if you're using a strange
5552 compiler, or your machine supports multiple models), you can override it here.
5553
5554 EOM
5555 else
5556         dflt=''
5557         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5558         cat >&4 <<EOM
5559 I can't seem to find your C library.  I've looked in the following places:
5560
5561 EOM
5562         $sed 's/^/      /' libpath
5563         cat <<EOM
5564
5565 None of these seems to contain your C library. I need to get its name...
5566
5567 EOM
5568 fi
5569 fn=f
5570 rp='Where is your C library?'
5571 . ./getfile
5572 libc="$ans"
5573
5574 echo " "
5575 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5576 set X `cat libnames`
5577 shift
5578 xxx=files
5579 case $# in 1) xxx=file; esac
5580 echo "Extracting names from the following $xxx for later perusal:" >&4
5581 echo " "
5582 $sed 's/^/      /' libnames >&4
5583 echo " "
5584 $echo $n "This may take a while...$c" >&4
5585
5586 for file in $*; do
5587         case $file in
5588         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5589         *) $nm $nm_opt $file 2>/dev/null;;
5590         esac
5591 done >libc.tmp
5592
5593 $echo $n ".$c"
5594 $grep fprintf libc.tmp > libc.ptf
5595 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5596 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5597 xxx='[ADTSIW]'
5598 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5599         eval $xscan;\
5600         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5601                 eval $xrun
5602 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5603         eval $xscan;\
5604         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5605                 eval $xrun
5606 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5607         eval $xscan;\
5608         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5609                 eval $xrun
5610 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5611         eval $xscan;\
5612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5613                 eval $xrun
5614 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5615         eval $xscan;\
5616         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5617                 eval $xrun
5618 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5619         eval $xscan;\
5620         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5621                 eval $xrun
5622 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5623                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5624         eval $xscan;\
5625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5626                 eval $xrun
5627 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5628         eval $xscan;\
5629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5630                 eval $xrun
5631 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5632         eval $xscan;\
5633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5634                 eval $xrun
5635 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5636         eval $xscan;\
5637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5638                 eval $xrun
5639 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5640         eval $xscan;\
5641         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5642                 eval $xrun
5643 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5644         eval $xscan;\
5645         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5646                 eval $xrun
5647 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5648         eval $xscan;\
5649         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5650                 eval $xrun
5651 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5652         eval $xscan;\
5653         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5654                 eval $xrun
5655 else
5656         $nm -p $* 2>/dev/null >libc.tmp
5657         $grep fprintf libc.tmp > libc.ptf
5658         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5659                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5660         then
5661                 nm_opt='-p'
5662                 eval $xrun
5663         else
5664                 echo " "
5665                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5666                 com=''
5667                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5668                         for thisname in $libnames $libc; do
5669                                 $ar t $thisname >>libc.tmp
5670                         done
5671                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5672                         echo "Ok." >&4
5673                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5674                         # Repeat libc to extract forwarders to DLL entries too
5675                         for thisname in $libnames $libc; do
5676                                 $ar tv $thisname >>libc.tmp
5677                                 # Revision 50 of EMX has bug in $ar.
5678                                 # it will not extract forwarders to DLL entries
5679                                 # Use emximp which will extract exactly them.
5680                                 emximp -o tmp.imp $thisname \
5681                                     2>/dev/null && \
5682                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5683                                     < tmp.imp >>libc.tmp
5684                                 $rm tmp.imp
5685                         done
5686                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5687                         echo "Ok." >&4
5688                 else
5689                         echo "$ar didn't seem to work right." >&4
5690                         echo "Maybe this is a Cray...trying bld instead..." >&4
5691                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5692                         then
5693                                 for thisname in $libnames; do
5694                                         bld t $libnames | \
5695                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5696                                         $ar t $thisname >>libc.tmp
5697                                 done
5698                                 echo "Ok." >&4
5699                         else
5700                                 echo "That didn't work either.  Giving up." >&4
5701                                 exit 1
5702                         fi
5703                 fi
5704         fi
5705 fi
5706 nm_extract="$com"
5707 if $test -f /lib/syscalls.exp; then
5708         echo " "
5709         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5710         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5711 fi
5712 ;;
5713 esac
5714 $rm -f libnames libpath
5715
5716 : is a C symbol defined?
5717 csym='tlook=$1;
5718 case "$3" in
5719 -v) tf=libc.tmp; tc=""; tdc="";;
5720 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5721 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5722 esac;
5723 tx=yes;
5724 case "$reuseval-$4" in
5725 true-) ;;
5726 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5727 esac;
5728 case "$tx" in
5729 yes)
5730         case "$runnm" in
5731         true)
5732                 if $contains $tlook $tf >/dev/null 2>&1;
5733                 then tval=true;
5734                 else tval=false;
5735                 fi;;
5736         *)
5737                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5738                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5739                 then tval=true;
5740                 else tval=false;
5741                 fi;
5742                 $rm -f t t.c;;
5743         esac;;
5744 *)
5745         case "$tval" in
5746         $define) tval=true;;
5747         *) tval=false;;
5748         esac;;
5749 esac;
5750 eval "$2=$tval"'
5751
5752 : define an is-in-libc? function
5753 inlibc='echo " "; td=$define; tu=$undef;
5754 sym=$1; var=$2; eval "was=\$$2";
5755 tx=yes;
5756 case "$reuseval$was" in
5757 true) ;;
5758 true*) tx=no;;
5759 esac;
5760 case "$tx" in
5761 yes)
5762         set $sym tres -f;
5763         eval $csym;
5764         case "$tres" in
5765         true)
5766                 echo "$sym() found." >&4;
5767                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5768         *)
5769                 echo "$sym() NOT found." >&4;
5770                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5771         esac;;
5772 *)
5773         case "$was" in
5774         $define) echo "$sym() found." >&4;;
5775         *) echo "$sym() NOT found." >&4;;
5776         esac;;
5777 esac'
5778
5779 : see if sqrtl exists
5780 set sqrtl d_sqrtl
5781 eval $inlibc
5782
5783 : check for length of double
5784 echo " "
5785 case "$doublesize" in
5786 '')
5787         echo "Checking to see how big your double precision numbers are..." >&4
5788         $cat >try.c <<'EOCP'
5789 #include <stdio.h>
5790 int main()
5791 {
5792     printf("%d\n", (int)sizeof(double));
5793     exit(0);
5794 }
5795 EOCP
5796         set try
5797         if eval $compile_ok; then
5798                 doublesize=`$run ./try`
5799                 echo "Your double is $doublesize bytes long."
5800         else
5801                 dflt='8'
5802                 echo "(I can't seem to compile the test program.  Guessing...)"
5803                 rp="What is the size of a double precision number (in bytes)?"
5804                 . ./myread
5805                 doublesize="$ans"
5806         fi
5807         ;;
5808 esac
5809 $rm -f try.c try
5810
5811 : check for long doubles
5812 echo " "
5813 echo "Checking to see if you have long double..." >&4
5814 echo 'int main() { long double x = 7.0; }' > try.c
5815 set try
5816 if eval $compile; then
5817         val="$define"
5818         echo "You have long double."
5819 else
5820         val="$undef"
5821         echo "You do not have long double."
5822 fi
5823 $rm try.*
5824 set d_longdbl
5825 eval $setvar
5826
5827 : check for length of long double
5828 case "${d_longdbl}${longdblsize}" in
5829 $define)
5830         echo " "
5831         echo "Checking to see how big your long doubles are..." >&4
5832         $cat >try.c <<'EOCP'
5833 #include <stdio.h>
5834 int main()
5835 {
5836         printf("%d\n", sizeof(long double));
5837 }
5838 EOCP
5839         set try
5840         set try
5841         if eval $compile; then
5842                 longdblsize=`$run ./try`
5843                 echo "Your long doubles are $longdblsize bytes long."
5844         else
5845                 dflt='8'
5846                 echo " "
5847                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5848                 rp="What is the size of a long double (in bytes)?"
5849                 . ./myread
5850                 longdblsize="$ans"
5851         fi
5852         if $test "X$doublesize" = "X$longdblsize"; then
5853                 echo "(That isn't any different from an ordinary double.)"
5854         fi      
5855         ;;
5856 esac
5857 $rm -f try.* try
5858
5859 echo " "
5860
5861 if $test X"$d_longdbl" = X"$define"; then
5862
5863 echo "Checking how to print long doubles..." >&4
5864
5865 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5866         $cat >try.c <<'EOCP'
5867 #include <sys/types.h>
5868 #include <stdio.h>
5869 int main() {
5870   double d = 123.456;
5871   printf("%.3f\n", d);
5872 }
5873 EOCP
5874         set try
5875         if eval $compile; then
5876                 yyy=`$run ./try`
5877                 case "$yyy" in
5878                 123.456)
5879                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5880                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5881                         echo "We will use %f."
5882                         ;;
5883                 esac
5884         fi
5885 fi
5886
5887 if $test X"$sPRIfldbl" = X; then
5888         $cat >try.c <<'EOCP'
5889 #include <sys/types.h>
5890 #include <stdio.h>
5891 int main() {
5892   long double d = 123.456;
5893   printf("%.3Lf\n", d);
5894 }
5895 EOCP
5896         set try
5897         if eval $compile; then
5898                 yyy=`$run ./try`
5899                 case "$yyy" in
5900                 123.456)
5901                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5902                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5903                         echo "We will use %Lf."
5904                         ;;
5905                 esac
5906         fi
5907 fi
5908
5909 if $test X"$sPRIfldbl" = X; then
5910         $cat >try.c <<'EOCP'
5911 #include <sys/types.h>
5912 #include <stdio.h>
5913 int main() {
5914   long double d = 123.456;
5915   printf("%.3llf\n", d);
5916 }
5917 EOCP
5918         set try
5919         if eval $compile; then
5920                 yyy=`$run ./try`
5921                 case "$yyy" in
5922                 123.456)
5923                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5924                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5925                         echo "We will use %llf."
5926                         ;;
5927                 esac
5928         fi
5929 fi
5930
5931 if $test X"$sPRIfldbl" = X; then
5932         $cat >try.c <<'EOCP'
5933 #include <sys/types.h>
5934 #include <stdio.h>
5935 int main() {
5936   long double d = 123.456;
5937   printf("%.3lf\n", d);
5938 }
5939 EOCP
5940         set try
5941         if eval $compile; then
5942                 yyy=`$run ./try`
5943                 case "$yyy" in
5944                 123.456)
5945                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
5946                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
5947                         echo "We will use %lf."
5948                         ;;
5949                 esac
5950         fi
5951 fi
5952
5953 if $test X"$sPRIfldbl" = X; then
5954         echo "Cannot figure out how to print long doubles." >&4
5955 else
5956         sSCNfldbl=$sPRIfldbl    # expect consistency
5957 fi
5958
5959 $rm -f try try.*
5960
5961 fi # d_longdbl
5962
5963 case "$sPRIfldbl" in
5964 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
5965         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
5966         d_SCNfldbl="$undef";
5967         ;;
5968 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
5969         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
5970         d_SCNfldbl="$define";
5971         ;;
5972 esac
5973
5974 : see if modfl exists
5975 set modfl d_modfl
5976 eval $inlibc
5977
5978 d_modfl_pow32_bug="$undef"
5979
5980 case "$d_longdbl$d_modfl" in
5981 $define$define)
5982         $cat <<EOM
5983 Checking to see whether your modfl() is okay for large values...
5984 EOM
5985 $cat >try.c <<EOCP
5986 #include <math.h> 
5987 #include <stdio.h>
5988 int main() {
5989     long double nv = 4294967303.15;
5990     long double v, w;
5991     v = modfl(nv, &w);         
5992 #ifdef __GLIBC__
5993     printf("glibc");
5994 #endif
5995     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
5996     return 0;
5997 }
5998 EOCP
5999         case "$osname:$gccversion" in
6000         aix:)   saveccflags="$ccflags"
6001                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6002         esac
6003         set try
6004         if eval $compile; then
6005                 foo=`$run ./try`
6006                 case "$foo" in
6007                 *" 4294967303.150000 1.150000 4294967302.000000")
6008                         echo >&4 "Your modfl() is broken for large values."
6009                         d_modfl_pow32_bug="$define"
6010                         case "$foo" in
6011                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6012                         ;;
6013                         esac
6014                         ;;
6015                 *" 4294967303.150000 0.150000 4294967303.000000")
6016                         echo >&4 "Your modfl() seems okay for large values."
6017                         ;;
6018                 *)      echo >&4 "I don't understand your modfl() at all."
6019                         d_modfl="$undef"
6020                         ;;
6021                 esac
6022                 $rm -f try.* try core core.try.*
6023         else
6024                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6025                 d_modfl="$undef"
6026         fi
6027         case "$osname:$gccversion" in
6028         aix:)   ccflags="$saveccflags" ;; # restore
6029         esac
6030         ;;
6031 esac
6032
6033 case "$ccflags" in
6034 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6035 esac
6036
6037 case "$uselongdouble" in
6038 $define|true|[yY]*)     dflt='y';;
6039 *) dflt='n';;
6040 esac
6041 cat <<EOM
6042
6043 Perl can be built to take advantage of long doubles which
6044 (if available) may give more accuracy and range for floating point numbers.
6045
6046 If this doesn't make any sense to you, just accept the default '$dflt'.
6047 EOM
6048 rp='Try to use long doubles if available?'
6049 . ./myread
6050 case "$ans" in
6051 y|Y)    val="$define"   ;;
6052 *)      val="$undef"    ;;
6053 esac
6054 set uselongdouble
6055 eval $setvar
6056
6057 case "$uselongdouble" in
6058 true|[yY]*) uselongdouble="$define" ;;
6059 esac
6060
6061 case "$uselongdouble" in
6062 $define)
6063 : Look for a hint-file generated 'call-back-unit'.  If the
6064 : user has specified that long doubles should be used,
6065 : we may need to set or change some other defaults.
6066         if $test -f uselongdouble.cbu; then
6067                 echo "Your platform has some specific hints for long doubles, using them..."
6068                 . ./uselongdouble.cbu
6069         else
6070                 $cat <<EOM
6071 (Your platform doesn't have any specific hints for long doubles.)
6072 EOM
6073         fi
6074         ;;
6075 esac
6076
6077 message=X
6078 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6079 $define:$define:$define)
6080         : You have both
6081         ;;
6082 $define:$define:$undef)
6083         message="I could not find modfl"
6084         ;;
6085 $define:$undef:$define)
6086         message="I could not find sqrtl"
6087         ;;
6088 $define:$undef:$undef)
6089         message="I found neither sqrtl nor modfl"
6090         ;;
6091 esac
6092
6093 if $test "$message" != X; then
6094         $cat <<EOM >&4
6095
6096 *** You requested the use of long doubles but you do not seem to have
6097 *** the mathematic functions for long doubles.
6098 *** ($message)
6099 *** I'm disabling the use of long doubles.
6100
6101 EOM
6102
6103         uselongdouble=$undef
6104 fi
6105
6106 case "$useperlio" in
6107 $define|true|[yY]*|'')  dflt='y';;
6108 *) dflt='n';;
6109 esac
6110 cat <<EOM
6111
6112 Previous version of $package used the standard IO mechanisms as
6113 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6114 alternate IO mechanisms via the PerlIO abstraction layer, but the
6115 stdio mechanism is still available if needed.  The abstraction layer
6116 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6117 Using PerlIO with sfio may cause problems with some extension modules.
6118
6119 If this doesn't make any sense to you, just accept the default '$dflt'.
6120 EOM
6121 rp='Use the PerlIO abstraction layer?'
6122 . ./myread
6123 case "$ans" in
6124 y|Y) 
6125         val="$define"
6126         ;;
6127 *)      
6128         echo "Ok, doing things the stdio way."
6129         val="$undef"
6130         ;;
6131 esac
6132 set useperlio
6133 eval $setvar 
6134
6135 case "$usesocks" in
6136 $define|true|[yY]*)
6137         case "$useperlio" in
6138         $define|true|[yY]*) ;;
6139         *)      cat >&4 <<EOM
6140
6141 You are using the SOCKS proxy protocol library which means that you
6142 should also use the PerlIO layer.  You may be headed for trouble.
6143
6144 EOM
6145                 ;;
6146         esac
6147         ;;
6148 esac
6149
6150         
6151 : determine the architecture name
6152 echo " "
6153 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6154         tarch=`arch`"-$osname"
6155 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6156         if uname -m > tmparch 2>&1 ; then
6157                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6158                         -e 's/$/'"-$osname/" tmparch`
6159         else
6160                 tarch="$osname"
6161         fi
6162         $rm -f tmparch
6163 else
6164         tarch="$osname"
6165 fi
6166 case "$myarchname" in
6167 ''|"$tarch") ;;
6168 *)
6169         echo "(Your architecture name used to be $myarchname.)"
6170         archname=''
6171         ;;
6172 esac
6173 case "$targetarch" in
6174 '') ;;
6175 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6176 esac
6177 myarchname="$tarch"
6178 case "$archname" in
6179 '') dflt="$tarch";;
6180 *) dflt="$archname";;
6181 esac
6182 rp='What is your architecture name'
6183 . ./myread
6184 archname="$ans"
6185 case "$usethreads" in
6186 $define)
6187         echo "Threads selected." >&4
6188         case "$archname" in
6189         *-thread*) echo "...and architecture name already has -thread." >&4
6190                 ;;
6191         *)      archname="$archname-thread"
6192                 echo "...setting architecture name to $archname." >&4
6193                 ;;
6194         esac
6195         ;;
6196 esac
6197 case "$usemultiplicity" in
6198 $define)
6199         echo "Multiplicity selected." >&4
6200         case "$archname" in
6201         *-multi*) echo "...and architecture name already has -multi." >&4
6202                 ;;
6203         *)      archname="$archname-multi"
6204                 echo "...setting architecture name to $archname." >&4
6205                 ;;
6206         esac
6207         ;;
6208 esac
6209 case "$use64bitint$use64bitall" in
6210 *"$define"*)
6211         case "$archname64" in
6212         '')
6213                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6214                 ;;
6215         *)
6216                 case "$use64bitint" in
6217                 "$define") echo "64 bit integers selected." >&4 ;;
6218                 esac
6219                 case "$use64bitall" in
6220                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6221                 esac
6222                 case "$archname" in
6223                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6224                         ;;
6225                 *)      archname="$archname-$archname64"
6226                         echo "...setting architecture name to $archname." >&4
6227                         ;;
6228                 esac
6229                 ;;
6230         esac
6231 esac
6232 case "$uselongdouble" in
6233 $define)
6234         echo "Long doubles selected." >&4
6235         case "$longdblsize" in
6236         $doublesize)
6237                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6238                 ;;
6239         *)
6240                 case "$archname" in
6241                 *-ld*) echo "...and architecture name already has -ld." >&4
6242                         ;;
6243                 *)      archname="$archname-ld"
6244                         echo "...setting architecture name to $archname." >&4
6245                         ;;
6246                 esac
6247                 ;;
6248         esac
6249         ;;
6250 esac
6251 case "$useperlio" in
6252 $define)
6253         echo "Perlio selected." >&4
6254         ;;
6255 *)
6256         echo "Perlio not selected, using stdio." >&4
6257         case "$archname" in
6258         *-stdio*) echo "...and architecture name already has -stdio." >&4
6259                 ;;
6260         *)      archname="$archname-stdio"
6261                 echo "...setting architecture name to $archname." >&4
6262                 ;;
6263         esac
6264         ;;
6265 esac
6266
6267 : determine root of directory hierarchy where package will be installed.
6268 case "$prefix" in
6269 '')
6270         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6271         ;;
6272 *)
6273         dflt="$prefix"
6274         ;;
6275 esac
6276 $cat <<EOM
6277
6278 By default, $package will be installed in $dflt/bin, manual pages
6279 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6280 installation directories. Typically this is something like /usr/local.
6281 If you wish to have binaries under /usr/bin but other parts of the
6282 installation under /usr/local, that's ok: you will be prompted
6283 separately for each of the installation directories, the prefix being
6284 only used to set the defaults.
6285
6286 EOM
6287 fn=d~
6288 rp='Installation prefix to use?'
6289 . ./getfile
6290 oldprefix=''
6291 case "$prefix" in
6292 '') ;;
6293 *)
6294         case "$ans" in
6295         "$prefix") ;;
6296         *) oldprefix="$prefix";;
6297         esac
6298         ;;
6299 esac
6300 prefix="$ans"
6301 prefixexp="$ansexp"
6302
6303 case "$afsroot" in
6304 '')     afsroot=/afs ;;
6305 *)      afsroot=$afsroot ;;
6306 esac
6307
6308 : is AFS running?
6309 echo " "
6310 case "$afs" in
6311 $define|true)   afs=true ;;
6312 $undef|false)   afs=false ;;
6313 *)      if test -d $afsroot; then
6314                 afs=true
6315         else
6316                 afs=false
6317         fi
6318         ;;
6319 esac
6320 if $afs; then
6321         echo "AFS may be running... I'll be extra cautious then..." >&4
6322 else
6323         echo "AFS does not seem to be running..." >&4
6324 fi
6325
6326 : determine installation prefix for where package is to be installed.
6327 if $afs; then 
6328 $cat <<EOM
6329
6330 Since you are running AFS, I need to distinguish the directory in which
6331 files will reside from the directory in which they are installed (and from
6332 which they are presumably copied to the former directory by occult means).
6333
6334 EOM
6335         case "$installprefix" in
6336         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6337         *) dflt="$installprefix";;
6338         esac
6339 else
6340 $cat <<EOM
6341
6342 In some special cases, particularly when building $package for distribution,
6343 it is convenient to distinguish between the directory in which files should 
6344 be installed from the directory ($prefix) in which they 
6345 will eventually reside.  For most users, these two directories are the same.
6346
6347 EOM
6348         case "$installprefix" in
6349         '') dflt=$prefix ;;
6350         *) dflt=$installprefix;;
6351         esac
6352 fi
6353 fn=d~
6354 rp='What installation prefix should I use for installing files?'
6355 . ./getfile
6356 installprefix="$ans"
6357 installprefixexp="$ansexp"
6358
6359 : set the prefixit variable, to compute a suitable default value
6360 prefixit='case "$3" in
6361 ""|none)
6362         case "$oldprefix" in
6363         "") eval "$1=\"\$$2\"";;
6364         *)
6365                 case "$3" in
6366                 "") eval "$1=";;
6367                 none)
6368                         eval "tp=\"\$$2\"";
6369                         case "$tp" in
6370                         ""|" ") eval "$1=\"\$$2\"";;
6371                         *) eval "$1=";;
6372                         esac;;
6373                 esac;;
6374         esac;;
6375 *)
6376         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6377         case "$tp" in
6378         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6379         /*-$oldprefix/*|\~*-$oldprefix/*)
6380                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6381         *) eval "$1=\"\$$2\"";;
6382         esac;;
6383 esac'
6384
6385 : get the patchlevel
6386 echo " "
6387 echo "Getting the current patchlevel..." >&4
6388 if $test -r $rsrc/patchlevel.h;then
6389         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6390         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6391         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6392         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6393         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6394         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6395        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6396 else
6397         revision=0
6398         patchlevel=0
6399         subversion=0
6400         api_revision=0
6401         api_version=0
6402         api_subversion=0
6403         perl_patchlevel=0
6404         $echo "(You do not have patchlevel.h.  Eek.)"
6405 fi
6406 if $test -r $rsrc/.patch ; then  
6407         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6408                 perl_patchlevel=`cat $rsrc/.patch`
6409         fi
6410 fi
6411 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6412 version_patchlevel_string="version $patchlevel subversion $subversion"
6413 case "$perl_patchlevel" in
6414 0|'') ;;
6415 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6416 esac
6417
6418 $echo "(You have $package $version_patchlevel_string.)"
6419
6420 case "$osname" in
6421 dos|vms)
6422         : XXX Should be a Configure test for double-dots in filenames.
6423         version=`echo $revision $patchlevel $subversion | \
6424                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6425         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6426                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6427         ;;
6428 *)
6429         version=`echo $revision $patchlevel $subversion | \
6430                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6431         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6432                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6433         ;;
6434 esac
6435 : Special case the 5.005_xx maintenance series, which used 5.005
6436 : without any subversion label as a subdirectory in $sitelib
6437 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6438         api_versionstring='5.005'
6439 fi
6440
6441 : determine installation style
6442 : For now, try to deduce it from prefix unless it is already set.
6443 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6444 case "$installstyle" in
6445 '')     case "$prefix" in
6446                 *perl*) dflt='lib';;
6447                 *) dflt='lib/perl5' ;;
6448         esac
6449         ;;
6450 *)      dflt="$installstyle" ;;
6451 esac
6452 : Probably not worth prompting for this since we prompt for all
6453 : the directories individually, and the prompt would be too long and
6454 : confusing anyway.
6455 installstyle=$dflt
6456
6457 : determine where private library files go
6458 : Usual default is /usr/local/lib/perl5/$version.
6459 : Also allow things like /opt/perl/lib/$version, since 
6460 : /opt/perl/lib/perl5... would be redundant.
6461 : The default "style" setting is made in installstyle.U
6462 case "$installstyle" in
6463 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6464 *)       set dflt privlib lib/$version ;;
6465 esac
6466 eval $prefixit
6467 $cat <<EOM
6468
6469 There are some auxiliary files for $package that need to be put into a
6470 private library directory that is accessible by everyone.
6471
6472 EOM
6473 fn=d~+
6474 rp='Pathname where the private library files will reside?'
6475 . ./getfile
6476 privlib="$ans"
6477 privlibexp="$ansexp"
6478 : Change installation prefix, if necessary.
6479 if $test X"$prefix" != X"$installprefix"; then
6480         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6481 else
6482         installprivlib="$privlibexp"
6483 fi
6484
6485 : set the prefixup variable, to restore leading tilda escape
6486 prefixup='case "$prefixexp" in
6487 "$prefix") ;;
6488 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6489 esac'
6490
6491 : determine where public architecture dependent libraries go
6492 set archlib archlib
6493 eval $prefixit
6494 : privlib default is /usr/local/lib/$package/$version
6495 : archlib default is /usr/local/lib/$package/$version/$archname
6496 : privlib may have an optional trailing /share.
6497 tdflt=`echo $privlib | $sed 's,/share$,,'`
6498 tdflt=$tdflt/$archname
6499 case "$archlib" in
6500 '')     dflt=$tdflt
6501         ;;
6502 *)      dflt="$archlib"
6503     ;;
6504 esac
6505 $cat <<EOM
6506
6507 $spackage contains architecture-dependent library files.  If you are
6508 sharing libraries in a heterogeneous environment, you might store
6509 these files in a separate location.  Otherwise, you can just include
6510 them with the rest of the public library files.
6511
6512 EOM
6513 fn=d+~
6514 rp='Where do you want to put the public architecture-dependent libraries?'
6515 . ./getfile
6516 archlib="$ans"
6517 archlibexp="$ansexp"
6518 if $test X"$archlib" = X"$privlib"; then
6519         d_archlib="$undef"
6520 else
6521         d_archlib="$define"
6522 fi
6523 : Change installation prefix, if necessary.
6524 if $test X"$prefix" != X"$installprefix"; then
6525         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6526 else
6527         installarchlib="$archlibexp"
6528 fi
6529
6530 : see if setuid scripts can be secure
6531 $cat <<EOM
6532
6533 Some kernels have a bug that prevents setuid #! scripts from being
6534 secure.  Some sites have disabled setuid #! scripts because of this.
6535
6536 First let's decide if your kernel supports secure setuid #! scripts.
6537 (If setuid #! scripts would be secure but have been disabled anyway,
6538 don't say that they are secure if asked.)
6539
6540 EOM
6541
6542 val="$undef"
6543 if $test -d /dev/fd; then
6544         echo "#!$ls" >reflect
6545         chmod +x,u+s reflect
6546         ./reflect >flect 2>&1
6547         if $contains "/dev/fd" flect >/dev/null; then
6548                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6549                 val="$define"
6550         else
6551                 $cat <<EOM
6552 If you are not sure if they are secure, I can check but I'll need a
6553 username and password different from the one you are using right now.
6554 If you don't have such a username or don't want me to test, simply
6555 enter 'none'.
6556
6557 EOM
6558                 rp='Other username to test security of setuid scripts with?'
6559                 dflt='none'
6560                 . ./myread
6561                 case "$ans" in
6562                 n|none)
6563                         case "$d_suidsafe" in
6564                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6565                                 dflt=n;;
6566                         "$undef")
6567                                 echo "Well, the $hint value is *not* secure." >&4
6568                                 dflt=n;;
6569                         *)      echo "Well, the $hint value *is* secure." >&4
6570                                 dflt=y;;
6571                         esac
6572                         ;;
6573                 *)
6574                         $rm -f reflect flect
6575                         echo "#!$ls" >reflect
6576                         chmod +x,u+s reflect
6577                         echo >flect
6578                         chmod a+w flect
6579                         echo '"su" will (probably) prompt you for '"$ans's password."
6580                         su $ans -c './reflect >flect'
6581                         if $contains "/dev/fd" flect >/dev/null; then
6582                                 echo "Okay, it looks like setuid scripts are secure." >&4
6583                                 dflt=y
6584                         else
6585                                 echo "I don't think setuid scripts are secure." >&4
6586                                 dflt=n
6587                         fi
6588                         ;;
6589                 esac
6590                 rp='Does your kernel have *secure* setuid scripts?'
6591                 . ./myread
6592                 case "$ans" in
6593                 [yY]*)  val="$define";;
6594                 *)      val="$undef";;
6595                 esac
6596         fi
6597 else
6598         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6599         echo "(That's for file descriptors, not floppy disks.)"
6600         val="$undef"
6601 fi
6602 set d_suidsafe
6603 eval $setvar
6604
6605 $rm -f reflect flect
6606
6607 : now see if they want to do setuid emulation
6608 echo " "
6609 val="$undef"
6610 case "$d_suidsafe" in
6611 "$define")
6612         val="$undef"
6613         echo "No need to emulate SUID scripts since they are secure here." >&4
6614         ;;
6615 *)
6616         $cat <<EOM
6617 Some systems have disabled setuid scripts, especially systems where
6618 setuid scripts cannot be secure.  On systems where setuid scripts have
6619 been disabled, the setuid/setgid bits on scripts are currently
6620 useless.  It is possible for $package to detect those bits and emulate
6621 setuid/setgid in a secure fashion.  This emulation will only work if
6622 setuid scripts have been disabled in your kernel.
6623
6624 EOM
6625         case "$d_dosuid" in
6626         "$define") dflt=y ;;
6627         *) dflt=n ;;
6628         esac
6629         rp="Do you want to do setuid/setgid emulation?"
6630         . ./myread
6631         case "$ans" in
6632         [yY]*)  val="$define";;
6633         *)      val="$undef";;
6634         esac
6635         ;;
6636 esac
6637 set d_dosuid
6638 eval $setvar
6639
6640 : see if this is a malloc.h system
6641 set malloc.h i_malloc
6642 eval $inhdr
6643
6644 : see if stdlib is available
6645 set stdlib.h i_stdlib
6646 eval $inhdr
6647
6648 : check for void type
6649 echo " "
6650 echo "Checking to see how well your C compiler groks the void type..." >&4
6651 case "$voidflags" in
6652 '')
6653         $cat >try.c <<'EOCP'
6654 #if TRY & 1
6655 void sub() {
6656 #else
6657 sub() {
6658 #endif
6659         extern void moo();      /* function returning void */
6660         void (*goo)();          /* ptr to func returning void */
6661 #if TRY & 8
6662         void *hue;              /* generic ptr */
6663 #endif
6664 #if TRY & 2
6665         void (*foo[10])();
6666 #endif
6667
6668 #if TRY & 4
6669         if(goo == moo) {
6670                 exit(0);
6671         }
6672 #endif
6673         exit(0);
6674 }
6675 int main() { sub(); }
6676 EOCP
6677         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6678                 voidflags=$defvoidused
6679         echo "Good.  It appears to support void to the level $package wants.">&4
6680                 if $contains warning .out >/dev/null 2>&1; then
6681                         echo "However, you might get some warnings that look like this:"
6682                         $cat .out
6683                 fi
6684         else
6685 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6686                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6687                         echo "It supports 1..."
6688                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6689                                 echo "It also supports 2..."
6690                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6691                                         voidflags=7
6692                                         echo "And it supports 4 but not 8 definitely."
6693                                 else
6694                                         echo "It doesn't support 4..."
6695                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6696                                                 voidflags=11
6697                                                 echo "But it supports 8."
6698                                         else
6699                                                 voidflags=3
6700                                                 echo "Neither does it support 8."
6701                                         fi
6702                                 fi
6703                         else
6704                                 echo "It does not support 2..."
6705                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6706                                         voidflags=13
6707                                         echo "But it supports 4 and 8."
6708                                 else
6709                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6710                                                 voidflags=5
6711                                                 echo "And it supports 4 but has not heard about 8."
6712                                         else
6713                                                 echo "However it supports 8 but not 4."
6714                                         fi
6715                                 fi
6716                         fi
6717                 else
6718                         echo "There is no support at all for void."
6719                         voidflags=0
6720                 fi
6721         fi
6722 esac
6723 case "$voidflags" in
6724 "$defvoidused") ;;
6725 *)      $cat >&4 <<'EOM'
6726   Support flag bits are:
6727     1: basic void declarations.
6728     2: arrays of pointers to functions returning void.
6729     4: operations between pointers to and addresses of void functions.
6730     8: generic void pointers.
6731 EOM
6732         dflt="$voidflags";
6733         rp="Your void support flags add up to what?"
6734         . ./myread
6735         voidflags="$ans"
6736         ;;
6737 esac
6738 $rm -f try.* .out
6739
6740 : check for length of pointer
6741 echo " "
6742 case "$ptrsize" in
6743 '')
6744         echo "Checking to see how big your pointers are..." >&4
6745         if test "$voidflags" -gt 7; then
6746                 echo '#define VOID_PTR char *' > try.c
6747         else
6748                 echo '#define VOID_PTR void *' > try.c
6749         fi
6750         $cat >>try.c <<'EOCP'
6751 #include <stdio.h>
6752 int main()
6753 {
6754     printf("%d\n", (int)sizeof(VOID_PTR));
6755     exit(0);
6756 }
6757 EOCP
6758         set try
6759         if eval $compile_ok; then
6760                 ptrsize=`$run ./try`
6761                 echo "Your pointers are $ptrsize bytes long."
6762         else
6763                 dflt='4'
6764                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6765                 rp="What is the size of a pointer (in bytes)?"
6766                 . ./myread
6767                 ptrsize="$ans"
6768         fi
6769         ;;
6770 esac
6771 $rm -f try.c try
6772 case "$use64bitall" in
6773 "$define"|true|[yY]*)
6774         case "$ptrsize" in
6775         4)      cat <<EOM >&4
6776
6777 *** You have chosen a maximally 64-bit build, but your pointers
6778 *** are only 4 bytes wide, disabling maximal 64-bitness.
6779
6780 EOM
6781                 use64bitall="$undef"
6782                 case "$use64bitint" in
6783                 "$define"|true|[yY]*) ;;
6784                 *)      cat <<EOM >&4
6785
6786 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6787
6788 EOM
6789                         use64bitint="$define"
6790                         ;;
6791                 esac
6792                 ;;
6793         esac
6794         ;;
6795 esac
6796
6797
6798 : determine which malloc to compile in
6799 echo " "
6800 case "$usemymalloc" in
6801 [yY]*|true|$define)     dflt='y' ;;
6802 [nN]*|false|$undef)     dflt='n' ;;
6803 *)      case "$ptrsize" in
6804         4) dflt='y' ;;
6805         *) dflt='n' ;;
6806         esac
6807         ;;
6808 esac
6809 rp="Do you wish to attempt to use the malloc that comes with $package?"
6810 . ./myread
6811 usemymalloc="$ans"
6812 case "$ans" in
6813 y*|true)
6814         usemymalloc='y'
6815         mallocsrc='malloc.c'
6816         mallocobj="malloc$_o"
6817         d_mymalloc="$define"
6818         case "$libs" in
6819         *-lmalloc*)
6820                 : Remove malloc from list of libraries to use
6821                 echo "Removing unneeded -lmalloc from library list" >&4
6822                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6823                 shift
6824                 libs="$*"
6825                 echo "libs = $libs" >&4
6826                 ;;
6827         esac
6828         ;;
6829 *)
6830         usemymalloc='n'
6831         mallocsrc=''
6832         mallocobj=''
6833         d_mymalloc="$undef"
6834         ;;
6835 esac
6836
6837 : compute the return types of malloc and free
6838 echo " "
6839 $cat >malloc.c <<END
6840 #$i_malloc I_MALLOC
6841 #$i_stdlib I_STDLIB
6842 #include <stdio.h>
6843 #include <sys/types.h>
6844 #ifdef I_MALLOC
6845 #include <malloc.h>
6846 #endif
6847 #ifdef I_STDLIB
6848 #include <stdlib.h>
6849 #endif
6850 #ifdef TRY_MALLOC
6851 void *malloc();
6852 #endif
6853 #ifdef TRY_FREE
6854 void free();
6855 #endif
6856 END
6857 case "$malloctype" in
6858 '')
6859         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6860                 malloctype='void *'
6861         else
6862                 malloctype='char *'
6863         fi
6864         ;;
6865 esac
6866 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6867
6868 case "$freetype" in
6869 '')
6870         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6871                 freetype='void'
6872         else
6873                 freetype='int'
6874         fi
6875         ;;
6876 esac
6877 echo "Your system uses $freetype free(), it would seem." >&4
6878 $rm -f malloc.[co]
6879 $cat <<EOM
6880
6881 After $package is installed, you may wish to install various
6882 add-on modules and utilities.  Typically, these add-ons will
6883 be installed under $prefix with the rest
6884 of this package.  However, you may wish to install such add-ons
6885 elsewhere under a different prefix.
6886
6887 If you do not wish to put everything under a single prefix, that's
6888 ok.  You will be prompted for the individual locations; this siteprefix
6889 is only used to suggest the defaults.
6890
6891 The default should be fine for most people.
6892
6893 EOM
6894 fn=d~+
6895 rp='Installation prefix to use for add-on modules and utilities?'
6896 : XXX Here might be another good place for an installstyle setting.
6897 case "$siteprefix" in
6898 '') dflt=$prefix ;;
6899 *)  dflt=$siteprefix ;;
6900 esac
6901 . ./getfile
6902 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6903 oldsiteprefix=''
6904 case "$siteprefix" in
6905 '') ;;
6906 *)      case "$ans" in
6907         "$prefix") ;;
6908         *) oldsiteprefix="$prefix";;
6909         esac
6910         ;;
6911 esac
6912 siteprefix="$ans"
6913 siteprefixexp="$ansexp"
6914
6915 : determine where site specific libraries go.
6916 : Usual default is /usr/local/lib/perl5/site_perl/$version
6917 : The default "style" setting is made in installstyle.U
6918 : XXX No longer works with Prefixit stuff.
6919 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6920 case "$sitelib" in
6921 '') case "$installstyle" in
6922         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6923         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6924         esac
6925         ;;
6926 *)      dflt="$sitelib"
6927         ;;
6928 esac
6929 $cat <<EOM
6930
6931 The installation process will create a directory for
6932 site-specific extensions and modules.  Most users find it convenient
6933 to place all site-specific files in this directory rather than in the
6934 main distribution directory.
6935
6936 EOM
6937 fn=d~+
6938 rp='Pathname for the site-specific library files?'
6939 . ./getfile
6940 sitelib="$ans"
6941 sitelibexp="$ansexp"
6942 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6943 : Change installation prefix, if necessary.
6944 if $test X"$prefix" != X"$installprefix"; then
6945         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6946 else
6947         installsitelib="$sitelibexp"
6948 fi
6949
6950 : determine where site specific architecture-dependent libraries go.
6951 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6952 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6953 : sitelib may have an optional trailing /share.
6954 case "$sitearch" in
6955 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6956         dflt="$dflt/$archname"
6957         ;;
6958 *)      dflt="$sitearch"
6959         ;;
6960 esac
6961 set sitearch sitearch none
6962 eval $prefixit
6963 $cat <<EOM
6964
6965 The installation process will also create a directory for
6966 architecture-dependent site-specific extensions and modules.
6967
6968 EOM
6969 fn=d~+
6970 rp='Pathname for the site-specific architecture-dependent library files?'
6971 . ./getfile
6972 sitearch="$ans"
6973 sitearchexp="$ansexp"
6974 : Change installation prefix, if necessary.
6975 if $test X"$prefix" != X"$installprefix"; then
6976         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6977 else
6978         installsitearch="$sitearchexp"
6979 fi
6980
6981 $cat <<EOM
6982
6983 The installation process will also create a directory for
6984 vendor-supplied add-ons.  Vendors who supply perl with their system
6985 may find it convenient to place all vendor-supplied files in this
6986 directory rather than in the main distribution directory.  This will
6987 ease upgrades between binary-compatible maintenance versions of perl.
6988
6989 Of course you may also use these directories in whatever way you see
6990 fit.  For example, you might use them to access modules shared over a
6991 company-wide network.
6992
6993 The default answer should be fine for most people.
6994 This causes further questions about vendor add-ons to be skipped
6995 and no vendor-specific directories will be configured for perl.
6996
6997 EOM
6998 rp='Do you want to configure vendor-specific add-on directories?'
6999 case "$usevendorprefix" in
7000 define|true|[yY]*) dflt=y ;;
7001 *)      : User may have set vendorprefix directly on Configure command line.
7002         case "$vendorprefix" in
7003         ''|' ') dflt=n ;;
7004         *)      dflt=y ;;
7005         esac
7006         ;;
7007 esac
7008 . ./myread
7009 case "$ans" in
7010 [yY]*)  fn=d~+
7011         rp='Installation prefix to use for vendor-supplied add-ons?'
7012         case "$vendorprefix" in
7013         '') dflt='' ;;
7014         *)  dflt=$vendorprefix ;;
7015         esac
7016         . ./getfile
7017         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7018         oldvendorprefix=''
7019         case "$vendorprefix" in
7020         '') ;;
7021         *)      case "$ans" in
7022                 "$prefix") ;;
7023                 *) oldvendorprefix="$prefix";;
7024                 esac
7025                 ;;
7026         esac
7027         usevendorprefix="$define"
7028         vendorprefix="$ans"
7029         vendorprefixexp="$ansexp"
7030         ;;
7031 *)      usevendorprefix="$undef"
7032         vendorprefix=''
7033         vendorprefixexp=''
7034         ;;
7035 esac
7036
7037 case "$vendorprefix" in
7038 '')     d_vendorlib="$undef"
7039         vendorlib=''
7040         vendorlibexp=''
7041         ;;
7042 *)      d_vendorlib="$define"
7043         : determine where vendor-supplied modules go.
7044         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7045         case "$vendorlib" in
7046         '')
7047                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7048                 case "$installstyle" in
7049                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7050                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7051                 esac
7052                 ;;
7053         *)      dflt="$vendorlib"
7054                 ;;
7055         esac
7056         fn=d~+
7057         rp='Pathname for the vendor-supplied library files?'
7058         . ./getfile
7059         vendorlib="$ans"
7060         vendorlibexp="$ansexp"
7061         ;;
7062 esac
7063 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7064 : Change installation prefix, if necessary.
7065 if $test X"$prefix" != X"$installprefix"; then
7066         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7067 else
7068         installvendorlib="$vendorlibexp"
7069 fi
7070
7071 case "$vendorprefix" in
7072 '')     d_vendorarch="$undef"
7073         vendorarch=''
7074         vendorarchexp=''
7075         ;;
7076 *)      d_vendorarch="$define"
7077         : determine where vendor-supplied architecture-dependent libraries go.
7078         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7079         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7080         : vendorlib may have an optional trailing /share.
7081         case "$vendorarch" in
7082         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7083                 dflt="$dflt/$archname"
7084                 ;;
7085         *)      dflt="$vendorarch" ;;
7086         esac
7087         fn=d~+
7088         rp='Pathname for vendor-supplied architecture-dependent files?'
7089         . ./getfile
7090         vendorarch="$ans"
7091         vendorarchexp="$ansexp"
7092         ;;
7093 esac
7094 : Change installation prefix, if necessary.
7095 if $test X"$prefix" != X"$installprefix"; then
7096         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7097 else
7098         installvendorarch="$vendorarchexp"
7099 fi
7100
7101 : Final catch-all directories to search
7102 $cat <<EOM
7103
7104 Lastly, you can have perl look in other directories for extensions and
7105 modules in addition to those already specified.
7106 These directories will be searched after 
7107         $sitearch 
7108         $sitelib 
7109 EOM
7110 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7111 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7112 echo ' '
7113 case "$otherlibdirs" in
7114 ''|' ') dflt='none' ;;
7115 *)      dflt="$otherlibdirs" ;;
7116 esac
7117 $cat <<EOM
7118 Enter a colon-separated set of extra paths to include in perl's @INC
7119 search path, or enter 'none' for no extra paths.
7120
7121 EOM
7122
7123 rp='Colon-separated list of additional directories for perl to search?'
7124 . ./myread
7125 case "$ans" in
7126 ' '|''|none)    otherlibdirs=' ' ;;     
7127 *)      otherlibdirs="$ans" ;;
7128 esac
7129 case "$otherlibdirs" in
7130 ' ') val=$undef ;;
7131 *)      val=$define ;;
7132 esac
7133 set d_perl_otherlibdirs
7134 eval $setvar
7135
7136 : Cruising for prototypes
7137 echo " "
7138 echo "Checking out function prototypes..." >&4
7139 $cat >prototype.c <<'EOCP'
7140 int main(int argc, char *argv[]) {
7141         exit(0);}
7142 EOCP
7143 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7144         echo "Your C compiler appears to support function prototypes."
7145         val="$define"
7146 else
7147         echo "Your C compiler doesn't seem to understand function prototypes."
7148         val="$undef"
7149 fi
7150 set prototype
7151 eval $setvar
7152 $rm -f prototype*
7153
7154 case "$prototype" in
7155 "$define") ;;
7156 *)      ansi2knr='ansi2knr'
7157         echo " "
7158         cat <<EOM >&4
7159
7160 $me:  FATAL ERROR:
7161 This version of $package can only be compiled by a compiler that 
7162 understands function prototypes.  Unfortunately, your C compiler 
7163         $cc $ccflags
7164 doesn't seem to understand them.  Sorry about that.
7165
7166 If GNU cc is available for your system, perhaps you could try that instead.  
7167
7168 Eventually, we hope to support building Perl with pre-ANSI compilers.
7169 If you would like to help in that effort, please contact <perlbug@perl.org>.
7170
7171 Aborting Configure now.
7172 EOM
7173         exit 2
7174         ;;
7175 esac
7176
7177 : determine where public executables go
7178 echo " "
7179 set dflt bin bin
7180 eval $prefixit
7181 fn=d~
7182 rp='Pathname where the public executables will reside?'
7183 . ./getfile
7184 if $test "X$ansexp" != "X$binexp"; then
7185         installbin=''
7186 fi
7187 bin="$ans"
7188 binexp="$ansexp"
7189 : Change installation prefix, if necessary.
7190 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7191 if $test X"$prefix" != X"$installprefix"; then
7192         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7193 else
7194         installbin="$binexp"
7195 fi
7196
7197 echo " "
7198 case "$extras" in
7199 '') dflt='n';;
7200 *) dflt='y';;
7201 esac
7202 cat <<EOM
7203 Perl can be built with extra modules or bundles of modules which
7204 will be fetched from the CPAN and installed alongside Perl.
7205
7206 Notice that you will need access to the CPAN; either via the Internet,
7207 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7208 be asked later to configure the CPAN.pm module which will in turn do
7209 the installation of the rest of the extra modules or bundles.)
7210
7211 Notice also that if the modules require any external software such as
7212 libraries and headers (the libz library and the zlib.h header for the
7213 Compress::Zlib module, for example) you MUST have any such software
7214 already installed, this configuration process will NOT install such
7215 things for you.
7216
7217 If this doesn't make any sense to you, just accept the default '$dflt'.
7218 EOM
7219 rp='Install any extra modules (y or n)?'
7220 . ./myread
7221 case "$ans" in
7222 y|Y)
7223         cat <<EOM
7224
7225 Please list any extra modules or bundles to be installed from CPAN,
7226 with spaces between the names.  The names can be in any format the
7227 'install' command of CPAN.pm will understand.  (Answer 'none',
7228 without the quotes, to install no extra modules or bundles.)
7229 EOM
7230         rp='Extras?'
7231         dflt="$extras"
7232         . ./myread
7233         extras="$ans"
7234 esac
7235 case "$extras" in
7236 ''|'none')
7237         val=''
7238         $rm -f ../extras.lst
7239         ;;
7240 *)      echo "(Saving the list of extras for later...)"
7241         echo "$extras" > ../extras.lst
7242         val="'$extras'"
7243         ;;
7244 esac
7245 set extras
7246 eval $setvar
7247 echo " "
7248
7249 : Find perl5.005 or later.
7250 echo "Looking for a previously installed perl5.005 or later... "
7251 case "$perl5" in
7252 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7253                 : Check if this perl is recent and can load a simple module
7254                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7255                         perl5=$tdir/perl
7256                         break;
7257                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7258                         perl5=$tdir/perl5
7259                         break;
7260                 fi
7261         done
7262         ;;
7263 *)      perl5="$perl5"
7264         ;;
7265 esac
7266 case "$perl5" in
7267 '')     echo "None found.  That's ok.";;
7268 *)      echo "Using $perl5." ;;
7269 esac
7270
7271 : Determine list of previous versions to include in @INC
7272 $cat > getverlist <<EOPL
7273 #!$perl5 -w
7274 use File::Basename;
7275 \$api_versionstring = "$api_versionstring";
7276 \$version = "$version";
7277 \$stem = "$sitelib_stem";
7278 \$archname = "$archname";
7279 EOPL
7280         $cat >> getverlist <<'EOPL'
7281 # Can't have leading @ because metaconfig interprets it as a command!
7282 ;@inc_version_list=();
7283 # XXX Redo to do opendir/readdir? 
7284 if (-d $stem) {
7285     chdir($stem);
7286     ;@candidates = glob("5.*");
7287 }
7288 else {
7289     ;@candidates = ();
7290 }
7291
7292 # XXX ToDo:  These comparisons must be reworked when two-digit
7293 # subversions come along, so that 5.7.10 compares as greater than
7294 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7295 # widespread that we can use the built-in version vectors rather
7296 # than reinventing them here.  For 5.6.0, however, we must
7297 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7298 foreach $d (@candidates) {
7299     if ($d lt $version) {
7300         if ($d ge $api_versionstring) {
7301             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7302         }
7303         elsif ($d ge "5.005") {
7304             unshift(@inc_version_list, grep { -d } $d);
7305         }
7306     }
7307     else {
7308         # Skip newer version.  I.e. don't look in
7309         # 5.7.0 if we're installing 5.6.1.
7310     }
7311 }
7312
7313 if (@inc_version_list) {
7314     print join(' ', @inc_version_list);
7315 }
7316 else {
7317     # Blank space to preserve value for next Configure run.
7318     print " ";
7319 }
7320 EOPL
7321 chmod +x getverlist
7322 case "$inc_version_list" in
7323 '')     if test -x "$perl5$exe_ext"; then
7324                 dflt=`$perl5 getverlist`
7325         else
7326                 dflt='none'
7327         fi
7328         ;;
7329 $undef) dflt='none' ;;
7330 *)  eval dflt=\"$inc_version_list\" ;;
7331 esac
7332 case "$dflt" in
7333 ''|' ') dflt=none ;;
7334 esac
7335 case "$dflt" in
7336 5.005) dflt=none ;;
7337 esac
7338 $cat <<'EOM'
7339
7340 In order to ease the process of upgrading, this version of perl 
7341 can be configured to use modules built and installed with earlier 
7342 versions of perl that were installed under $prefix.  Specify here
7343 the list of earlier versions that this version of perl should check.
7344 If Configure detected no earlier versions of perl installed under
7345 $prefix, then the list will be empty.  Answer 'none' to tell perl
7346 to not search earlier versions.
7347
7348 The default should almost always be sensible, so if you're not sure,
7349 just accept the default.
7350 EOM
7351
7352 rp='List of earlier versions to include in @INC?'
7353 . ./myread
7354 case "$ans" in
7355 [Nn]one|''|' ') inc_version_list=' ' ;;
7356 *) inc_version_list="$ans" ;;
7357 esac
7358 case "$inc_version_list" in
7359 ''|' ') 
7360         inc_version_list_init='0';;
7361 *)      inc_version_list_init=`echo $inc_version_list |
7362                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7363         ;;
7364 esac
7365 $rm -f getverlist
7366
7367 : determine whether to install perl also as /usr/bin/perl
7368
7369 echo " "
7370 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7371         $cat <<EOM
7372 Many scripts expect perl to be installed as /usr/bin/perl.
7373 I can install the perl you are about to compile also as /usr/bin/perl
7374 (in addition to $installbin/perl).
7375 EOM
7376         case "$installusrbinperl" in
7377         "$undef"|[nN]*) dflt='n';;
7378         *)              dflt='y';;
7379         esac
7380         rp="Do you want to install perl as /usr/bin/perl?"
7381         . ./myread
7382         case "$ans" in
7383         [yY]*)  val="$define";;
7384         *)      val="$undef" ;;
7385         esac
7386 else
7387         val="$undef"
7388 fi
7389 set installusrbinperl
7390 eval $setvar
7391
7392 : see if dld is available
7393 set dld.h i_dld
7394 eval $inhdr
7395
7396 : see if dlopen exists
7397 xxx_runnm="$runnm"
7398 runnm=false
7399 set dlopen d_dlopen
7400 eval $inlibc
7401 runnm="$xxx_runnm"
7402
7403 : determine which dynamic loading, if any, to compile in
7404 echo " "
7405 dldir="ext/DynaLoader"
7406 case "$usedl" in
7407 $define|y|true)
7408         dflt='y'
7409         usedl="$define"
7410         ;;
7411 $undef|n|false)
7412         dflt='n'
7413         usedl="$undef"
7414         ;;
7415 *) 
7416         dflt='n'
7417         case "$d_dlopen" in
7418             $define) dflt='y' ;;
7419         esac
7420         case "$i_dld" in
7421             $define) dflt='y' ;;
7422         esac
7423         : Does a dl_xxx.xs file exist for this operating system
7424         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7425         ;;
7426 esac
7427 rp="Do you wish to use dynamic loading?"
7428 . ./myread
7429 usedl="$ans"
7430 case "$ans" in
7431 y*) usedl="$define"
7432         case "$dlsrc" in
7433         '')
7434                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7435                         dflt="$dldir/dl_${osname}.xs"
7436                 elif $test "$d_dlopen" = "$define" ; then
7437                         dflt="$dldir/dl_dlopen.xs"
7438                 elif $test "$i_dld" = "$define" ; then
7439                         dflt="$dldir/dl_dld.xs"
7440                 else
7441                         dflt=''
7442                 fi
7443                 ;;
7444         *)      dflt="$dldir/$dlsrc"
7445                 ;;
7446         esac
7447     echo "The following dynamic loading files are available:"
7448         : Can not go over to $dldir because getfile has path hard-coded in.
7449         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7450         rp="Source file to use for dynamic loading"
7451         fn="fne"
7452         gfpth="$src"
7453         . ./getfile
7454         usedl="$define"
7455         : emulate basename
7456         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7457
7458         $cat << EOM
7459
7460 Some systems may require passing special flags to $cc -c to
7461 compile modules that will be used to create a shared library.
7462 To use no flags, say "none".
7463
7464 EOM
7465     case "$cccdlflags" in
7466     '') case "$gccversion" in
7467                 '') case "$osname" in
7468                         hpux)   dflt='+z' ;;
7469                         next)   dflt='none' ;;
7470                         irix*)  dflt='-KPIC' ;;
7471                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7472                         sunos)  dflt='-pic' ;;
7473                         *)      dflt='none' ;;
7474                     esac
7475                         ;;
7476                 *)  case "$osname" in
7477                         darwin) dflt='none' ;;
7478                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7479                         *)      dflt='-fpic' ;;
7480                     esac ;;
7481             esac ;;
7482         ' ') dflt='none' ;;
7483     *)  dflt="$cccdlflags" ;;
7484     esac
7485     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7486     . ./myread
7487     case "$ans" in
7488     none) cccdlflags=' ' ;;
7489     *) cccdlflags="$ans" ;;
7490     esac
7491
7492     cat << EOM
7493
7494 Some systems use ld to create libraries that can be dynamically loaded,
7495 while other systems (such as those using ELF) use $cc.
7496
7497 EOM
7498         case "$ld" in
7499         '')     $cat >try.c <<'EOM'
7500 /* Test for whether ELF binaries are produced */
7501 #include <fcntl.h>
7502 #include <stdlib.h>
7503 int main() {
7504         char b[4];
7505         int i = open("a.out",O_RDONLY);
7506         if(i == -1) 
7507                 exit(1); /* fail */
7508         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7509                 exit(0); /* succeed (yes, it's ELF) */
7510         else
7511                 exit(1); /* fail */
7512 }
7513 EOM
7514                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7515                         cat <<EOM
7516 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7517 EOM
7518                         dflt="$cc"
7519                 else
7520                         echo "I'll use ld to build dynamic libraries."
7521                         dflt='ld'
7522                 fi
7523                 rm -f try.c a.out
7524                 ;;
7525         *)      dflt="$ld"
7526                 ;;
7527         esac
7528
7529     rp="What command should be used to create dynamic libraries?"
7530     . ./myread
7531         ld="$ans"
7532
7533     cat << EOM
7534
7535 Some systems may require passing special flags to $ld to create a
7536 library that can be dynamically loaded.  If your ld flags include
7537 -L/other/path options to locate libraries outside your loader's normal
7538 search path, you may need to specify those -L options here as well.  To
7539 use no flags, say "none".
7540
7541 EOM
7542     case "$lddlflags" in
7543     '') case "$osname" in
7544                         beos) dflt='-nostart' ;;
7545                         hpux) dflt='-b';
7546                               case "$gccversion" in
7547                               '') dflt="$dflt +vnocompatwarnings" ;;
7548                               esac
7549                               ;;        
7550                         linux|irix*)    dflt='-shared' ;;
7551                         next)  dflt='none' ;;
7552                         solaris) dflt='-G' ;;
7553                         sunos) dflt='-assert nodefinitions' ;;
7554                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7555                 *)     dflt='none' ;;
7556                         esac
7557                         ;;
7558     *) dflt="$lddlflags" ;;
7559     esac
7560
7561         : Try to guess additional flags to pick up local libraries.
7562         : Be careful not to append to a plain 'none'
7563         case "$dflt" in
7564         none) dflt='' ;;
7565         esac
7566         for thisflag in $ldflags; do
7567                 case "$thisflag" in
7568                 -L*|-R*|-Wl,-R*)
7569                         case " $dflt " in
7570                         *" $thisflag "*) ;;
7571                         *) dflt="$dflt $thisflag" ;;
7572                         esac
7573                         ;;
7574                 esac
7575         done
7576
7577         case "$dflt" in
7578         ''|' ') dflt='none' ;;
7579         esac
7580
7581     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7582     . ./myread
7583     case "$ans" in
7584     none) lddlflags=' ' ;;
7585     *) lddlflags="$ans" ;;
7586     esac
7587
7588         cat <<EOM
7589
7590 Some systems may require passing special flags to $cc to indicate that
7591 the resulting executable will use dynamic linking.  To use no flags,
7592 say "none".
7593
7594 EOM
7595     case "$ccdlflags" in
7596     '') case "$osname" in
7597                 hpux)   dflt='-Wl,-E' ;;
7598                 linux)  dflt='-rdynamic' ;;
7599                 next)   dflt='none' ;;
7600                 sunos)  dflt='none' ;;
7601                 *)      dflt='none' ;;
7602             esac ;;
7603     ' ')  dflt='none' ;;
7604     *)  dflt="$ccdlflags" ;;
7605     esac
7606     rp="Any special flags to pass to $cc to use dynamic linking?"
7607     . ./myread
7608     case "$ans" in
7609     none) ccdlflags=' ' ;;
7610     *) ccdlflags="$ans" ;;
7611     esac
7612     ;;
7613 *)  usedl="$undef"
7614         ld='ld'
7615     dlsrc='dl_none.xs'
7616     lddlflags=''
7617     ccdlflags=''
7618     ;;
7619 esac
7620
7621 also=''
7622 case "$usedl" in
7623 $undef)
7624         # No dynamic loading being used, so don't bother even to prompt.
7625         useshrplib='false'
7626         ;;
7627 *)      case "$useshrplib" in
7628         '')     case "$osname" in
7629                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7630                         dflt=y
7631                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7632                         ;;
7633                 next*)
7634                         case "$osvers" in
7635                         4*)     dflt=y
7636                                 also='Building a shared libperl is needed for MAB support.'
7637                                 ;;
7638                         *)      dflt=n
7639                                 ;;
7640                         esac
7641                         ;;
7642                 *)      dflt=n
7643                         ;;
7644                 esac
7645                 ;;
7646         $define|true|[Yy]*)
7647                 dflt=y
7648                 ;;
7649         *)      dflt=n
7650                 ;;
7651         esac
7652         $cat << EOM
7653
7654 The perl executable is normally obtained by linking perlmain.c with
7655 libperl${_a}, any static extensions (usually just DynaLoader), and
7656 any other libraries needed on this system (such as -lm, etc.).  Since
7657 your system supports dynamic loading, it is probably possible to build
7658 a shared libperl.$so.  If you will have more than one executable linked
7659 to libperl.$so, this will significantly reduce the size of each
7660 executable, but it may have a noticeable affect on performance.  The
7661 default is probably sensible for your system.
7662 $also
7663
7664 EOM
7665         rp="Build a shared libperl.$so (y/n)"
7666         . ./myread
7667         case "$ans" in
7668         true|$define|[Yy]*)
7669                 useshrplib='true'  ;;
7670         *)      useshrplib='false' ;;
7671         esac
7672         ;;
7673 esac
7674
7675 case "$useshrplib" in
7676 true)
7677         case "$libperl" in
7678         '')
7679                 # Figure out a good name for libperl.so.  Since it gets stored in
7680                 # a version-specific architecture-dependent library, the version
7681                 # number isn't really that important, except for making cc/ld happy.
7682                 #
7683                 # A name such as libperl.so.3.1
7684                 majmin="libperl.$so.$patchlevel.$subversion"
7685                 # A name such as libperl.so.301
7686                 majonly=`echo $patchlevel $subversion |
7687                         $awk '{printf "%d%02d", $1, $2}'`
7688                 majonly=libperl.$so.$majonly
7689                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7690                 # rely on figuring it out from the naming of libc.
7691                 case "${osname}${osvers}" in
7692                 next4*)
7693                         dflt=libperl.5.$so
7694                         # XXX How handle the --version stuff for MAB?
7695                         ;;
7696                 linux*)  # ld won't link with a bare -lperl otherwise.
7697                         dflt=libperl.$so
7698                         ;;
7699                 cygwin*) # ld links against an importlib
7700                         dflt=libperl$lib_ext
7701                         ;;
7702                 *)      # Try to guess based on whether libc has major.minor.
7703                         case "$libc" in
7704                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7705                         *libc.$so.[0-9]*) dflt=$majonly ;;
7706                         *)      dflt=libperl.$so ;;
7707                         esac
7708                         ;;
7709                 esac
7710                 ;;
7711         *)      dflt=$libperl
7712                 ;;
7713         esac
7714         cat << EOM
7715
7716 I need to select a good name for the shared libperl.  If your system uses
7717 library names with major and minor numbers, then you might want something
7718 like $majmin.  Alternatively, if your system uses a single version
7719 number for shared libraries, then you might want to use $majonly.
7720 Or, your system might be quite happy with a simple libperl.$so.
7721
7722 Since the shared libperl will get installed into a version-specific
7723 architecture-dependent directory, the version number of the shared perl
7724 library probably isn't important, so the default should be o.k.
7725
7726 EOM
7727         rp='What name do you want to give to the shared libperl?'
7728         . ./myread
7729         libperl=$ans
7730         echo "Ok, I'll use $libperl"
7731         ;;
7732 *)
7733         libperl="libperl${_a}"
7734         ;;
7735 esac
7736
7737 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7738 case "$shrpdir" in
7739 '') ;;
7740 *)      $cat >&4 <<EOM
7741 WARNING:  Use of the shrpdir variable for the installation location of
7742 the shared $libperl is not supported.  It was never documented and
7743 will not work in this version.  Let me (perlbug@perl.org)
7744 know of any problems this may cause.
7745
7746 EOM
7747         case "$shrpdir" in
7748         "$archlibexp/CORE")
7749                 $cat >&4 <<EOM
7750 But your current setting of $shrpdir is
7751 the default anyway, so it's harmless.
7752 EOM
7753                 ;;
7754         *)
7755                 $cat >&4 <<EOM
7756 Further, your current attempted setting of $shrpdir
7757 conflicts with the value of $archlibexp/CORE
7758 that installperl will use.
7759 EOM
7760                 ;;
7761         esac
7762         ;;
7763 esac
7764
7765 # How will the perl executable find the installed shared $libperl?
7766 # Add $xxx to ccdlflags.
7767 # If we can't figure out a command-line option, use $shrpenv to
7768 # set env LD_RUN_PATH.  The main perl makefile uses this.
7769 shrpdir=$archlibexp/CORE
7770 xxx=''
7771 tmp_shrpenv=''
7772 if "$useshrplib"; then
7773     case "$osname" in 
7774         aix)
7775                 # We'll set it in Makefile.SH...
7776                 ;;
7777         solaris)
7778                 xxx="-R $shrpdir"
7779                 ;;
7780         freebsd|netbsd)
7781                 xxx="-Wl,-R$shrpdir"
7782                 ;;
7783         bsdos|linux|irix*|dec_osf)
7784                 xxx="-Wl,-rpath,$shrpdir"
7785                 ;;
7786         next)
7787                 # next doesn't like the default...
7788                 ;;
7789         beos)
7790                 # beos doesn't like the default, either.
7791                 ;;
7792         hpux*)
7793                 # hpux doesn't like the default, either.
7794                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7795                 ;;
7796         *)
7797                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7798                 ;;
7799         esac
7800         case "$xxx" in
7801         '') ;;
7802         *)      
7803                 # Only add $xxx if it isn't already in ccdlflags.
7804                 case " $ccdlflags " in
7805                 *" $xxx "*)     ;;
7806                 *)      ccdlflags="$ccdlflags $xxx"
7807                         cat <<EOM >&4
7808
7809 Adding $xxx to the flags
7810 passed to $ld so that the perl executable will find the 
7811 installed shared $libperl.
7812
7813 EOM
7814                         ;;
7815                 esac
7816                 ;;
7817         esac
7818 fi
7819 # Fix ccdlflags in AIX for building external extensions.
7820 # (For building Perl itself bare -bE:perl.exp is needed,
7821 #  Makefile.SH takes care of this.)
7822 case "$osname" in
7823 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7824 esac
7825 # Respect a hint or command-line value.
7826 case "$shrpenv" in
7827 '') shrpenv="$tmp_shrpenv" ;;
7828 esac
7829 case "$ldlibpthname" in
7830 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7831 none)   ldlibpthname='' ;;
7832 esac
7833
7834 : determine where manual pages are on this system
7835 echo " "
7836 case "$sysman" in
7837 '') 
7838         syspath='/usr/share/man/man1 /usr/man/man1'
7839         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7840         syspath="$syspath /usr/man/u_man/man1"
7841         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7842         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7843         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7844         sysman=`./loc . /usr/man/man1 $syspath`
7845         ;;
7846 esac
7847 if $test -d "$sysman"; then
7848         echo "System manual is in $sysman." >&4
7849 else
7850         echo "Could not find manual pages in source form." >&4
7851 fi
7852
7853 : determine where manual pages go
7854 set man1dir man1dir none
7855 eval $prefixit
7856 $cat <<EOM
7857
7858 $spackage has manual pages available in source form.
7859 EOM
7860 case "$nroff" in
7861 nroff)
7862         echo "However, you don't have nroff, so they're probably useless to you."
7863         case "$man1dir" in
7864         '') man1dir="none";;
7865         esac;;
7866 esac
7867 echo "If you don't want the manual sources installed, answer 'none'."
7868 case "$man1dir" in
7869 ' ') dflt=none
7870         ;;
7871 '')
7872         lookpath="$prefixexp/share/man/man1"
7873         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7874         lookpath="$lookpath $prefixexp/man/p_man/man1"
7875         lookpath="$lookpath $prefixexp/man/u_man/man1"
7876         lookpath="$lookpath $prefixexp/man/man.1"
7877         case "$sysman" in
7878         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7879         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7880         esac
7881         set dflt
7882         eval $prefixup
7883         ;;
7884 *)  dflt="$man1dir"
7885         ;;
7886 esac
7887 echo " "
7888 fn=dn+~
7889 rp="Where do the main $spackage manual pages (source) go?"
7890 . ./getfile
7891 if $test "X$man1direxp" != "X$ansexp"; then
7892         installman1dir=''
7893 fi
7894 man1dir="$ans"
7895 man1direxp="$ansexp"
7896 case "$man1dir" in
7897 '')     man1dir=' '
7898         installman1dir='';;
7899 esac
7900
7901 : Change installation prefix, if necessary.
7902 if $test X"$prefix" != X"$installprefix"; then
7903         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7904 else
7905         installman1dir="$man1direxp"
7906 fi
7907
7908 : What suffix to use on installed man pages
7909
7910 case "$man1dir" in
7911 ' ')
7912         man1ext='0'
7913         ;;
7914 *)
7915         rp="What suffix should be used for the main $spackage man pages?"
7916         case "$man1ext" in
7917         '')     case "$man1dir" in
7918                 *1)  dflt=1 ;;
7919                 *1p) dflt=1p ;;
7920                 *1pm) dflt=1pm ;;
7921                 *l) dflt=l;;
7922                 *n) dflt=n;;
7923                 *o) dflt=o;;
7924                 *p) dflt=p;;
7925                 *C) dflt=C;;
7926                 *L) dflt=L;;
7927                 *L1) dflt=L1;;
7928                 *) dflt=1;;
7929                 esac
7930                 ;;
7931         *)      dflt="$man1ext";;
7932         esac
7933         . ./myread
7934         man1ext="$ans"
7935         ;;
7936 esac
7937
7938 : see if we can have long filenames
7939 echo " "
7940 first=123456789abcdef
7941 $rm -f $first
7942 if (echo hi >$first) 2>/dev/null; then
7943         if $test -f 123456789abcde; then
7944                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7945                 val="$undef"
7946         else
7947                 echo 'You can have filenames longer than 14 characters.'>&4
7948                 val="$define"
7949         fi
7950 else
7951         $cat <<'EOM'
7952 You can't have filenames longer than 14 chars.
7953 You can't even think about them!
7954 EOM
7955         val="$undef"
7956 fi 
7957 set d_flexfnam
7958 eval $setvar
7959 $rm -rf 123456789abcde*
7960
7961 : determine where library module manual pages go
7962 set man3dir man3dir none
7963 eval $prefixit
7964 $cat <<EOM
7965
7966 $spackage has manual pages for many of the library modules.
7967 EOM
7968
7969 case "$nroff" in
7970 nroff)
7971         $cat <<'EOM'
7972 However, you don't have nroff, so they're probably useless to you.
7973 EOM
7974         case "$man3dir" in
7975         '') man3dir="none";;
7976         esac;;
7977 esac
7978
7979 case "$d_flexfnam" in
7980 undef)
7981         $cat <<'EOM'
7982 However, your system can't handle the long file names like File::Basename.3. 
7983 EOM
7984         case "$man3dir" in
7985         '') man3dir="none";;
7986         esac;;
7987 esac
7988
7989 echo "If you don't want the manual sources installed, answer 'none'."
7990 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7991 case "$man3dir" in
7992 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7993         if $test -d "$privlib/man/man3"; then
7994                 cat <<EOM >&4
7995
7996 WARNING:  Previous versions of perl installed man3 pages into
7997 $privlib/man/man3.  This version will suggest a 
7998 new default of $dflt.  
7999 EOM
8000                 tdflt=$dflt
8001                 dflt='n'
8002                 rp='Do you wish to preserve the old behavior?(y/n)'
8003                 . ./myread
8004                 case "$ans" in
8005                 y*) dflt="$privlib/man/man3" ;;
8006                 *)  dflt=$tdflt ;;
8007                 esac
8008     fi
8009         ;;
8010 *)      dflt="$man3dir" ;;
8011 esac
8012 case "$dflt" in
8013 ' ') dflt=none ;;
8014 esac
8015 echo " "
8016 fn=dn+~
8017 rp="Where do the $package library man pages (source) go?"
8018 . ./getfile
8019 man3dir="$ans"
8020 man3direxp="$ansexp"
8021 case "$man3dir" in
8022 '')     man3dir=' '
8023         installman3dir='';;
8024 esac
8025
8026 : Change installation prefix, if necessary.
8027 if $test X"$prefix" != X"$installprefix"; then
8028         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8029 else
8030         installman3dir="$man3direxp"
8031 fi
8032
8033 : What suffix to use on installed man pages
8034 case "$man3dir" in
8035 ' ')
8036         man3ext='0'
8037         ;;
8038 *)
8039         rp="What suffix should be used for the $package library man pages?"
8040         case "$man3ext" in
8041         '')     case "$man3dir" in
8042                 *3)  dflt=3 ;;
8043                 *3p) dflt=3p ;;
8044                 *3pm) dflt=3pm ;;
8045                 *l) dflt=l;;
8046                 *n) dflt=n;;
8047                 *o) dflt=o;;
8048                 *p) dflt=p;;
8049                 *C) dflt=C;;
8050                 *L) dflt=L;;
8051                 *L3) dflt=L3;;
8052                 *) dflt=3;;
8053                 esac
8054                 ;;
8055         *)      dflt="$man3ext";;
8056         esac
8057         . ./myread
8058         man3ext="$ans"
8059         ;;
8060 esac
8061
8062 : see if we have to deal with yellow pages, now NIS.
8063 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8064         if $test -f /usr/etc/nibindd; then
8065                 echo " "
8066                 echo "I'm fairly confident you're on a NeXT."
8067                 echo " "
8068                 rp='Do you get the hosts file via NetInfo?'
8069                 dflt=y
8070                 case "$hostcat" in
8071                 nidump*) ;;
8072                 '') ;;
8073                 *) dflt=n;;
8074                 esac
8075                 . ./myread
8076                 case "$ans" in
8077                 y*) hostcat='nidump hosts .';;
8078                 *)      case "$hostcat" in
8079                         nidump*) hostcat='';;
8080                         esac
8081                         ;;
8082                 esac
8083         fi
8084         case "$hostcat" in
8085         nidump*) ;;
8086         *)
8087                 case "$hostcat" in
8088                 *ypcat*) dflt=y;;
8089                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8090                                 dflt=y
8091                         else
8092                                 dflt=n
8093                         fi;;
8094                 *) dflt=n;;
8095                 esac
8096                 echo " "
8097                 rp='Are you getting the hosts file via yellow pages?'
8098                 . ./myread
8099                 case "$ans" in
8100                 y*) hostcat='ypcat hosts';;
8101                 *) hostcat='cat /etc/hosts';;
8102                 esac
8103                 ;;
8104         esac
8105 fi
8106 case "$hostcat" in
8107 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8108 esac
8109 case "$groupcat" in
8110 '') test -f /etc/group && groupcat='cat /etc/group';;
8111 esac
8112 case "$passcat" in
8113 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8114 esac
8115
8116 : now get the host name
8117 echo " "
8118 echo "Figuring out host name..." >&4
8119 case "$myhostname" in
8120 '') cont=true
8121         echo 'Maybe "hostname" will work...'
8122         if tans=`sh -c hostname 2>&1` ; then
8123                 myhostname=$tans
8124                 phostname=hostname
8125                 cont=''
8126         fi
8127         ;;
8128 *) cont='';;
8129 esac
8130 if $test "$cont"; then
8131         if ./xenix; then
8132                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8133                 if tans=`cat /etc/systemid 2>&1` ; then
8134                         myhostname=$tans
8135                         phostname='cat /etc/systemid'
8136                         echo "Whadyaknow.  Xenix always was a bit strange..."
8137                         cont=''
8138                 fi
8139         elif $test -r /etc/systemid; then
8140                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8141         fi
8142 fi
8143 if $test "$cont"; then
8144         echo 'No, maybe "uuname -l" will work...'
8145         if tans=`sh -c 'uuname -l' 2>&1` ; then
8146                 myhostname=$tans
8147                 phostname='uuname -l'
8148         else
8149                 echo 'Strange.  Maybe "uname -n" will work...'
8150                 if tans=`sh -c 'uname -n' 2>&1` ; then
8151                         myhostname=$tans
8152                         phostname='uname -n'
8153                 else
8154                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8155                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8156                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8157                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8158                         else
8159                                 case "$myhostname" in
8160                                 '') echo "Does this machine have an identity crisis or something?"
8161                                         phostname='';;
8162                                 *)
8163                                         echo "Well, you said $myhostname before..."
8164                                         phostname='echo $myhostname';;
8165                                 esac
8166                         fi
8167                 fi
8168         fi
8169 fi
8170 case "$myhostname" in
8171 '') myhostname=noname ;;
8172 esac
8173 : you do not want to know about this
8174 set $myhostname
8175 myhostname=$1
8176
8177 : verify guess
8178 if $test "$myhostname" ; then
8179         dflt=y
8180         rp='Your host name appears to be "'$myhostname'".'" Right?"
8181         . ./myread
8182         case "$ans" in
8183         y*) ;;
8184         *) myhostname='';;
8185         esac
8186 fi
8187
8188 : bad guess or no guess
8189 while $test "X$myhostname" = X ; do
8190         dflt=''
8191         rp="Please type the (one word) name of your host:"
8192         . ./myread
8193         myhostname="$ans"
8194 done
8195
8196 : translate upper to lower if necessary
8197 case "$myhostname" in
8198 *[A-Z]*)
8199         echo "(Normalizing case in your host name)"
8200         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8201         ;;
8202 esac
8203
8204 case "$myhostname" in
8205 *.*)
8206         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8207         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8208         echo "(Trimming domain name from host name--host name is now $myhostname)"
8209         ;;
8210 *) case "$mydomain" in
8211         '')
8212                 {
8213                         test "X$hostcat" = "Xypcat hosts" &&
8214                         ypmatch "$myhostname" hosts 2>/dev/null |\
8215                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8216                         $test -s hosts
8217                 } || {
8218                         test "X$hostcat" != "X" &&
8219                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8220                                         /[       ]$myhostname[  . ]/p" > hosts
8221                 }
8222                 tmp_re="[       . ]"
8223                 if $test -f hosts; then
8224                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8225                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8226                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8227                                 hosts | $sort | $uniq | \
8228                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8229                         case `$echo X$dflt` in
8230                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8231                                 dflt=.
8232                                 ;;
8233                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8234                                 ;;
8235                         esac
8236                 else
8237                         echo "(I cannot locate a hosts database anywhere)"
8238                         dflt=.
8239                 fi
8240                 case "$dflt" in
8241                 .)
8242                         tans=`./loc resolv.conf X /etc /usr/etc`
8243                         if $test -f "$tans"; then
8244                                 echo "(Attempting domain name extraction from $tans)"
8245                                 dflt=.`$sed -n -e 's/   / /g' \
8246                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8247                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8248                                 case "$dflt" in
8249                                 .) dflt=.`$sed -n -e 's/        / /g' \
8250                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8251                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8252                                         ;;
8253                                 esac
8254                         fi
8255                         ;;
8256                 esac
8257                 case "$dflt" in
8258                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8259                         dflt=.`sh -c domainname 2>/dev/null`
8260                         case "$dflt" in
8261                         '') dflt='.';;
8262                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8263                         esac
8264                         ;;
8265                 esac
8266                 case "$dflt$osname" in
8267                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8268                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8269                         ;;
8270                 esac
8271                 case "$dflt" in
8272                 .) echo "(Lost all hope -- silly guess then)"
8273                         dflt='.nonet'
8274                         ;;
8275                 esac
8276                 $rm -f hosts
8277                 ;;
8278         *) dflt="$mydomain";;
8279         esac;;
8280 esac
8281 echo " "
8282 rp="What is your domain name?"
8283 . ./myread
8284 tans="$ans"
8285 case "$ans" in
8286 '') ;;
8287 .*) ;;
8288 *) tans=".$tans";;
8289 esac
8290 mydomain="$tans"
8291
8292 : translate upper to lower if necessary
8293 case "$mydomain" in
8294 *[A-Z]*)
8295         echo "(Normalizing case in your domain name)"
8296         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8297         ;;
8298 esac
8299
8300 : a little sanity check here
8301 case "$phostname" in
8302 '') ;;
8303 *)
8304         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8305         $myhostname$mydomain|$myhostname) ;;
8306         *)
8307                 case "$phostname" in
8308                 sed*)
8309                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8310                         ;;
8311                 *)
8312                         echo "(That doesn't agree with your $phostname command, by the way.)"
8313                         ;;
8314                 esac
8315         ;;
8316         esac
8317         ;;
8318 esac
8319
8320 $cat <<EOM
8321
8322 I need to get your e-mail address in Internet format if possible, i.e.
8323 something like user@host.domain. Please answer accurately since I have
8324 no easy means to double check it. The default value provided below
8325 is most probably close to reality but may not be valid from outside
8326 your organization...
8327
8328 EOM
8329 cont=x
8330 while test "$cont"; do
8331         case "$cf_email" in
8332         '') dflt="$cf_by@$myhostname$mydomain";;
8333         *) dflt="$cf_email";;
8334         esac
8335         rp='What is your e-mail address?'
8336         . ./myread
8337         cf_email="$ans"
8338         case "$cf_email" in
8339         *@*.*) cont='' ;;
8340         *)
8341                 rp='Address does not look like an Internet one.  Use it anyway?'
8342                 case "$fastread" in
8343                 yes) dflt=y ;;
8344                 *) dflt=n ;;
8345                 esac
8346                 . ./myread
8347                 case "$ans" in
8348                 y*) cont='' ;;
8349                 *) echo " " ;;
8350                 esac
8351                 ;;
8352         esac
8353 done
8354
8355 $cat <<EOM
8356
8357 If you or somebody else will be maintaining perl at your site, please
8358 fill in the correct e-mail address here so that they may be contacted
8359 if necessary. Currently, the "perlbug" program included with perl
8360 will send mail to this address in addition to perlbug@perl.org. You may
8361 enter "none" for no administrator.
8362
8363 EOM
8364 case "$perladmin" in
8365 '') dflt="$cf_email";;
8366 *) dflt="$perladmin";;
8367 esac
8368 rp='Perl administrator e-mail address'
8369 . ./myread
8370 perladmin="$ans"
8371
8372 : determine whether to only install version-specific parts.
8373 echo " "
8374 $cat <<EOM
8375 Do you want to install only the version-specific parts of the perl
8376 distribution?  Usually you do *not* want to do this.
8377 EOM
8378 case "$versiononly" in
8379 "$define"|[Yy]*|true) dflt='y' ;;
8380 *) dflt='n';
8381 esac
8382 rp="Do you want to install only the version-specific parts of perl?"
8383 . ./myread
8384 case "$ans" in
8385 [yY]*)  val="$define";;
8386 *)      val="$undef" ;;
8387 esac
8388 set versiononly
8389 eval $setvar
8390
8391 case "$versiononly" in
8392 "$define") inc_version_list=''
8393            inc_version_list_init=0
8394            ;;
8395 esac
8396
8397 : figure out how to guarantee perl startup
8398 case "$startperl" in
8399 '')
8400         case "$sharpbang" in
8401         *!)
8402                 $cat <<EOH
8403
8404 I can use the #! construct to start perl on your system. This will
8405 make startup of perl scripts faster, but may cause problems if you
8406 want to share those scripts and perl is not in a standard place
8407 ($binexp/perl) on all your platforms. The alternative is to force
8408 a shell by starting the script with a single ':' character.
8409
8410 EOH
8411                 case "$versiononly" in
8412                 "$define")      dflt="$binexp/perl$version";;  
8413                 *)              dflt="$binexp/perl";;
8414                 esac
8415                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8416                 . ./myread
8417                 case "$ans" in
8418                 none)   startperl=": # use perl";;
8419                 *)      startperl="#!$ans"
8420                         if $test 30 -lt `echo "$ans" | wc -c`; then
8421                                 $cat >&4 <<EOM
8422
8423 WARNING:  Some systems limit the #! command to 32 characters.
8424 If you experience difficulty running Perl scripts with #!, try
8425 installing Perl in a directory with a shorter pathname.
8426
8427 EOM
8428                         fi ;;
8429                 esac
8430                 ;;
8431         *) startperl=": # use perl"
8432                 ;;
8433         esac
8434         ;;
8435 esac
8436 echo "I'll use $startperl to start perl scripts."
8437
8438 : figure best path for perl in scripts
8439 case "$perlpath" in
8440 '')
8441         case "$versiononly" in
8442         "$define")      perlpath="$binexp/perl$version";;
8443         *)              perlpath="$binexp/perl";;
8444         esac
8445         case "$startperl" in
8446         *!*) ;;
8447         *)
8448                 $cat <<EOH
8449
8450 I will use the "eval 'exec'" idiom to start Perl on your system.
8451 I can use the full path of your Perl binary for this purpose, but
8452 doing so may cause problems if you want to share those scripts and
8453 Perl is not always in a standard place ($binexp/perl).
8454
8455 EOH
8456                 dflt="$binexp/perl"
8457                 rp="What path shall I use in \"eval 'exec'\"?"
8458                 . ./myread
8459                 perlpath="$ans"
8460                 ;;
8461         esac
8462         ;;
8463 esac
8464 case "$startperl" in
8465 *!*)    ;;
8466 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8467 esac
8468
8469 : determine where public executable scripts go
8470 set scriptdir scriptdir
8471 eval $prefixit
8472 case "$scriptdir" in
8473 '')
8474         dflt="$bin"
8475         : guess some guesses
8476         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8477         $test -d /usr/share/bin     && dflt=/usr/share/bin
8478         $test -d /usr/local/script  && dflt=/usr/local/script
8479         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8480         $test -d $prefixexp/script  && dflt=$prefixexp/script
8481         set dflt
8482         eval $prefixup
8483         ;;
8484 *)  dflt="$scriptdir"
8485         ;;
8486 esac
8487 $cat <<EOM
8488  
8489 Some installations have a separate directory just for executable scripts so
8490 that they can mount it across multiple architectures but keep the scripts in
8491 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8492 Or you might just lump your scripts in with all your other executables.
8493  
8494 EOM
8495 fn=d~
8496 rp='Where do you keep publicly executable scripts?'
8497 . ./getfile
8498 if $test "X$ansexp" != "X$scriptdirexp"; then
8499         installscript=''
8500 fi
8501 scriptdir="$ans"
8502 scriptdirexp="$ansexp"
8503 : Change installation prefix, if necessary.
8504 if $test X"$prefix" != X"$installprefix"; then
8505         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8506 else
8507         installscript="$scriptdirexp"
8508 fi
8509
8510 : determine where add-on public executables go
8511 case "$sitebin" in
8512 '')     dflt=$siteprefix/bin ;;
8513 *)      dflt=$sitebin ;;
8514 esac
8515 fn=d~
8516 rp='Pathname where the add-on public executables should be installed?'
8517 . ./getfile
8518 sitebin="$ans"
8519 sitebinexp="$ansexp"
8520 : Change installation prefix, if necessary.
8521 if $test X"$prefix" != X"$installprefix"; then
8522         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8523 else
8524         installsitebin="$sitebinexp"
8525 fi
8526
8527 : define an is-a-typedef? function
8528 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8529 case "$inclist" in
8530 "") inclist="sys/types.h";;
8531 esac;
8532 eval "varval=\$$var";
8533 case "$varval" in
8534 "")
8535         $rm -f temp.c;
8536         for inc in $inclist; do
8537                 echo "#include <$inc>" >>temp.c;
8538         done;
8539         echo "#ifdef $type" >> temp.c;
8540         echo "printf(\"We have $type\");" >> temp.c;
8541         echo "#endif" >> temp.c;
8542         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8543         if $contains $type temp.E >/dev/null 2>&1; then
8544                 eval "$var=\$type";
8545         else
8546                 eval "$var=\$def";
8547         fi;
8548         $rm -f temp.?;;
8549 *) eval "$var=\$varval";;
8550 esac'
8551
8552 : define an is-a-typedef? function that prompts if the type is not available.
8553 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8554 case "$inclist" in
8555 "") inclist="sys/types.h";;
8556 esac;
8557 eval "varval=\$$var";
8558 case "$varval" in
8559 "")
8560         $rm -f temp.c;
8561         for inc in $inclist; do
8562                 echo "#include <$inc>" >>temp.c;
8563         done;
8564         echo "#ifdef $type" >> temp.c;
8565         echo "printf(\"We have $type\");" >> temp.c;
8566         echo "#endif" >> temp.c;
8567         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8568         echo " " ;
8569         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8570         if $contains $type temp.E >/dev/null 2>&1; then
8571                 echo "$type found." >&4;
8572                 eval "$var=\$type";
8573         else
8574                 echo "$type NOT found." >&4;
8575                 dflt="$def";
8576                 . ./myread ;
8577                 eval "$var=\$ans";
8578         fi;
8579         $rm -f temp.?;;
8580 *) eval "$var=\$varval";;
8581 esac'
8582
8583 : see what type lseek is declared as in the kernel
8584 rp="What is the type used for lseek's offset on this system?"
8585 set off_t lseektype long stdio.h sys/types.h
8586 eval $typedef_ask
8587
8588 echo " "
8589 echo "Checking to see how big your file offsets are..." >&4
8590 $cat >try.c <<EOCP
8591 #include <sys/types.h>
8592 #include <stdio.h>
8593 int main()
8594 {
8595     printf("%d\n", (int)sizeof($lseektype));
8596     return(0); 
8597 }
8598 EOCP
8599 set try
8600 if eval $compile_ok; then
8601         lseeksize=`$run ./try`
8602         echo "Your file offsets are $lseeksize bytes long."
8603 else
8604         dflt=$longsize
8605         echo " "
8606         echo "(I can't seem to compile the test program.  Guessing...)"
8607         rp="What is the size of your file offsets (in bytes)?"
8608         . ./myread
8609         lseeksize="$ans"
8610 fi
8611 $rm -f try.c try
8612
8613 : see what type file positions are declared as in the library
8614 rp="What is the type for file position used by fsetpos()?"
8615 set fpos_t fpostype long stdio.h sys/types.h
8616 eval $typedef_ask
8617
8618 echo " "
8619 case "$fpostype" in
8620 *_t) zzz="$fpostype"    ;;
8621 *)   zzz="fpos_t"       ;;
8622 esac
8623 echo "Checking the size of $zzz..." >&4 
8624 cat > try.c <<EOCP
8625 #include <sys/types.h>
8626 #include <stdio.h>
8627 int main() {
8628     printf("%d\n", (int)sizeof($fpostype));
8629     exit(0);
8630 }
8631 EOCP
8632 set try
8633 if eval $compile_ok; then
8634         yyy=`$run ./try`
8635         case "$yyy" in
8636         '')     fpossize=4
8637                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8638                 ;;
8639         *)      fpossize=$yyy
8640                 echo "Your $zzz is $fpossize bytes long."
8641                 ;;
8642         esac
8643 else
8644         dflt="$longsize"
8645         echo " " >&4
8646         echo "(I can't compile the test program.  Guessing...)" >&4
8647         rp="What is the size of your file positions (in bytes)?"
8648         . ./myread
8649         fpossize="$ans"
8650 fi
8651
8652
8653
8654 # Backward compatibility (uselfs is deprecated).
8655 case "$uselfs" in
8656 "$define"|true|[yY]*)
8657         cat <<EOM >&4
8658
8659 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8660 EOM
8661         uselargefiles="$define"
8662         ;;
8663 esac                          
8664
8665 case "$lseeksize:$fpossize" in
8666 8:8) cat <<EOM
8667
8668 You can have files larger than 2 gigabytes.
8669 EOM
8670    val="$define" ;;
8671 *)    case "$uselargefiles" in
8672    "$undef"|false|[nN]*) dflt='n' ;;
8673    *)   dflt='y' ;;
8674    esac
8675    cat <<EOM
8676
8677 Perl can be built to understand large files (files larger than 2 gigabytes)
8678 on some systems.  To do so, Configure can be run with -Duselargefiles.
8679
8680 If this doesn't make any sense to you, just accept the default '$dflt'.
8681 EOM
8682    rp='Try to understand large files, if available?'
8683    . ./myread
8684    case "$ans" in
8685    y|Y)         val="$define" ;;
8686    *)           val="$undef"  ;;
8687    esac
8688    ;;
8689 esac
8690 set uselargefiles
8691 eval $setvar
8692 case "$uselargefiles" in
8693 "$define")
8694 : Look for a hint-file generated 'call-back-unit'.  If the
8695 : user has specified that a large files perl is to be built,
8696 : we may need to set or change some other defaults.
8697         if $test -f uselargefiles.cbu; then
8698                 echo "Your platform has some specific hints for large file builds, using them..."
8699                 . ./uselargefiles.cbu
8700                 echo " "
8701                 echo "Rechecking to see how big your file offsets are..." >&4
8702                 $cat >try.c <<EOCP
8703 #include <sys/types.h>
8704 #include <stdio.h>
8705 int main()
8706 {
8707     printf("%d\n", (int)sizeof($lseektype));
8708     return(0); 
8709 }
8710 EOCP
8711                 set try
8712                 if eval $compile_ok; then
8713                         lseeksize=`$run ./try`
8714                         $echo "Your file offsets are now $lseeksize bytes long."
8715                 else
8716                         dflt="$lseeksize"
8717                         echo " "
8718                         echo "(I can't seem to compile the test program.  Guessing...)"
8719                         rp="What is the size of your file offsets (in bytes)?"
8720                         . ./myread
8721                         lseeksize="$ans"
8722                 fi
8723                 case "$fpostype" in
8724                 *_t) zzz="$fpostype"    ;;
8725                 *)   zzz="fpos_t"       ;;
8726                 esac
8727                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8728                 $cat > try.c <<EOCP
8729 #include <sys/types.h>
8730 #include <stdio.h>
8731 int main() {
8732     printf("%d\n", (int)sizeof($fpostype));
8733     exit(0);
8734 }
8735 EOCP
8736                 set try
8737                 if eval $compile_ok; then
8738                         yyy=`$run ./try`
8739                         dflt="$lseeksize"
8740                         case "$yyy" in
8741                         '')     echo " "
8742                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8743                                 ;;
8744                         *)      fpossize=$yyy
8745                                 echo " $fpossize bytes." >&4
8746                                 ;;
8747                         esac
8748                 else
8749                         dflt="$fpossize"
8750                         echo " "
8751                         echo "(I can't compile the test program.  Guessing...)" >&4
8752                         rp="What is the size of your file positions (in bytes)?"
8753                         . ./myread
8754                         fpossize="$ans"
8755                 fi
8756                 $rm -f try.c try
8757         fi
8758         ;;
8759 esac
8760
8761 case "$vendorprefix" in
8762 '')     d_vendorbin="$undef"
8763         vendorbin=''
8764         vendorbinexp=''
8765         ;;
8766 *)      d_vendorbin="$define"
8767         : determine where vendor-supplied executables go.
8768         case "$vendorbin" in
8769         '') dflt=$vendorprefix/bin ;;
8770         *)      dflt="$vendorbin" ;;
8771         esac
8772         fn=d~+
8773         rp='Pathname for the vendor-supplied executables directory?'
8774         . ./getfile
8775         vendorbin="$ans"
8776         vendorbinexp="$ansexp"
8777         ;;
8778 esac
8779 : Change installation prefix, if necessary.
8780 if $test X"$prefix" != X"$installprefix"; then
8781         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8782 else
8783         installvendorbin="$vendorbinexp"
8784 fi
8785
8786 : see if qgcvt exists
8787 set qgcvt d_qgcvt
8788 eval $inlibc
8789
8790 : Check how to convert floats to strings.
8791
8792 if test "X$d_Gconvert" = X; then
8793
8794 echo " "
8795 echo "Checking for an efficient way to convert floats to strings."
8796 echo " " > try.c
8797 case "$uselongdouble" in
8798 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8799 esac
8800 case "$d_longdbl" in
8801 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8802 esac
8803 case "$d_PRIgldbl" in
8804 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8805 esac
8806 $cat >>try.c <<EOP
8807 #ifdef TRY_gconvert
8808 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8809 char *myname = "gconvert";
8810 #endif
8811 #ifdef TRY_gcvt
8812 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8813 char *myname = "gcvt";
8814 #endif
8815 #ifdef TRY_qgcvt
8816 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8817 char *myname = "qgcvt";
8818 #define DOUBLETYPE long double
8819 #endif
8820 #ifdef TRY_sprintf
8821 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8822 #ifdef HAS_PRIgldbl
8823 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8824 #else
8825 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8826 #endif
8827 #else
8828 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8829 #endif
8830 char *myname = "sprintf";
8831 #endif
8832
8833 #ifndef DOUBLETYPE
8834 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8835 #define DOUBLETYPE long double
8836 #else
8837 #define DOUBLETYPE double
8838 #endif
8839 #endif
8840
8841 #include <stdio.h>
8842
8843 #define I_STDLIB $i_stdlib
8844 #ifdef I_STDLIB
8845 #include <stdlib.h>
8846 #endif
8847
8848 int
8849 checkit(expect, got)
8850 char *expect;
8851 char *got;
8852 {
8853     if (strcmp(expect, got)) {
8854                 printf("%s oddity:  Expected %s, got %s\n",
8855                         myname, expect, got);
8856                 exit(1);
8857         }
8858 }
8859
8860 int main()
8861
8862         char buf[64]; 
8863         buf[63] = '\0';
8864
8865         /* This must be 1st test on (which?) platform */
8866         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8867         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8868         checkit("0.1", buf);
8869
8870         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8871         checkit("0.01", buf);
8872
8873         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8874         checkit("0.001", buf);
8875
8876         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8877         checkit("0.0001", buf);
8878
8879         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8880         if (strlen(buf) > 5)
8881             checkit("9e-005", buf); /* for Microsoft ?? */
8882         else
8883             checkit("9e-05", buf);
8884
8885         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8886         checkit("1", buf);
8887
8888         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8889         checkit("1.1", buf);
8890
8891         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8892         checkit("1.01", buf);
8893
8894         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8895         checkit("1.001", buf);
8896
8897         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8898         checkit("1.0001", buf);
8899
8900         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8901         checkit("1.00001", buf);
8902
8903         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8904         checkit("1.000001", buf);
8905
8906         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8907         checkit("0", buf);
8908
8909         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8910         checkit("-1", buf);
8911
8912         /* Some Linux gcvt's give 1.e+5 here. */
8913         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8914         checkit("100000", buf);
8915         
8916         /* Some Linux gcvt's give -1.e+5 here. */
8917         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8918         checkit("-100000", buf);
8919
8920         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8921         checkit("123.456", buf);
8922
8923         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8924         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8925         /* 34 should be enough to scare even long double
8926          * places into using the e notation. */
8927         if (strlen(buf) > 5)
8928             checkit("1e+034", buf); /* for Microsoft */
8929         else
8930             checkit("1e+34", buf);
8931
8932         /* For Perl, if you add additional tests here, also add them to
8933          * t/base/num.t for benefit of platforms not using Configure or
8934          * overriding d_Gconvert */
8935
8936         exit(0);
8937 }
8938 EOP
8939 : first add preferred functions to our list
8940 xxx_list=""
8941 for xxx_convert in $gconvert_preference; do
8942     case $xxx_convert in
8943     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8944     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8945     esac 
8946 done
8947 : then add any others
8948 for xxx_convert in gconvert gcvt sprintf; do
8949     case "$xxx_list" in
8950     *$xxx_convert*) ;;
8951     *) xxx_list="$xxx_list $xxx_convert" ;;
8952     esac 
8953 done
8954
8955 case "$d_longdbl$uselongdouble" in
8956 "$define$define")
8957     : again, add prefered functions to our list first
8958     xxx_ld_list=""
8959     for xxx_convert in $gconvert_ld_preference; do
8960         case $xxx_convert in
8961         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8962         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8963         esac
8964     done
8965     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8966     for xxx_convert in qgcvt sprintf $xxx_list; do
8967         case "$xxx_ld_list" in
8968         $xxx_convert*|*" $xxx_convert"*) ;;
8969         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8970         esac
8971     done
8972     : if sprintf cannot do long doubles, move it to the end
8973     if test "$d_PRIgldbl" != "$define"; then
8974         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8975     fi
8976     : if no qgcvt, remove it
8977     if test "$d_qgcvt" != "$define"; then
8978         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8979     fi
8980     : use the ld_list
8981     xxx_list="$xxx_ld_list"
8982     ;;
8983 esac
8984
8985 for xxx_convert in $xxx_list; do
8986         echo "Trying $xxx_convert..."
8987         $rm -f try try$_o
8988         set try -DTRY_$xxx_convert
8989         if eval $compile; then
8990                 echo "$xxx_convert() found." >&4
8991                 if $run ./try; then
8992                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8993                         break;
8994                 else
8995                         echo "...But $xxx_convert didn't work as I expected."
8996                         xxx_convert=''
8997                 fi
8998         else
8999                 echo "$xxx_convert NOT found." >&4
9000         fi
9001 done
9002
9003 if test X$xxx_convert = X; then
9004     echo "*** WHOA THERE!!! ***" >&4
9005     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9006     xxx_convert=sprintf
9007 fi
9008
9009 case "$xxx_convert" in
9010 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9011 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9012 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9013 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9014    "$define$define$define")
9015       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9016    "$define$define$undef")
9017       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9018    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9019    esac
9020    ;;  
9021 esac
9022
9023 fi
9024
9025 : see if _fwalk exists
9026 set fwalk d__fwalk
9027 eval $inlibc
9028
9029 : Initialize h_fcntl
9030 h_fcntl=false
9031
9032 : Initialize h_sysfile
9033 h_sysfile=false
9034
9035 : access call always available on UNIX
9036 set access d_access
9037 eval $inlibc
9038
9039 : locate the flags for 'access()'
9040 case "$d_access" in
9041 "$define")
9042         echo " "
9043         $cat >access.c <<'EOCP'
9044 #include <sys/types.h>
9045 #ifdef I_FCNTL
9046 #include <fcntl.h>
9047 #endif
9048 #ifdef I_SYS_FILE
9049 #include <sys/file.h>
9050 #endif
9051 #ifdef I_UNISTD
9052 #include <unistd.h>
9053 #endif
9054 int main() {
9055         exit(R_OK);
9056 }
9057 EOCP
9058         : check sys/file.h first, no particular reason here
9059         if $test `./findhdr sys/file.h` && \
9060                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9061                 h_sysfile=true;
9062                 echo "<sys/file.h> defines the *_OK access constants." >&4
9063         elif $test `./findhdr fcntl.h` && \
9064                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9065                 h_fcntl=true;
9066                 echo "<fcntl.h> defines the *_OK access constants." >&4
9067         elif $test `./findhdr unistd.h` && \
9068                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9069                 echo "<unistd.h> defines the *_OK access constants." >&4
9070         else
9071                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9072         fi
9073         ;;
9074 esac
9075 $rm -f access*
9076
9077 : see if accessx exists
9078 set accessx d_accessx
9079 eval $inlibc
9080
9081 : see if alarm exists
9082 set alarm d_alarm
9083 eval $inlibc
9084
9085 : see if POSIX threads are available
9086 set pthread.h i_pthread
9087 eval $inhdr
9088
9089 : define a fucntion to check prototypes
9090 $cat > protochk <<EOSH
9091 $startsh
9092 cc="$cc"
9093 optimize="$optimize"
9094 ccflags="$ccflags"
9095 prototype="$prototype"
9096 define="$define"
9097 rm=$rm
9098 usethreads=$usethreads
9099 i_pthread=$i_pthread
9100 pthread_h_first=$pthread_h_first
9101 EOSH
9102
9103 $cat >> protochk <<'EOSH'
9104
9105 $rm -f try.c
9106 foo="$1"
9107 shift
9108 while test $# -ge 2; do
9109         case "$1" in
9110                 $define) echo "#include <$2>" >> try.c ;;
9111                 literal) echo "$2" >> try.c ;;
9112         esac
9113     # Extra magic for the benefit of systems that need pthread.h
9114     # to be included early to correctly detect threadsafe functions.
9115     # Such functions must guarantee themselves, though, that the usethreads
9116     # and i_pthread have been defined, before calling protochk.
9117     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9118         echo "#include <pthread.h>" >> try.c
9119         pthread_h_done=yes
9120     fi
9121     shift 2
9122 done
9123 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9124 cat >> try.c <<'EOCP'
9125 #ifdef CAN_PROTOTYPE
9126 #define _(args) args
9127 #else
9128 #define _(args) ()
9129 #endif
9130 EOCP
9131 echo "$foo" >> try.c
9132 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9133 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9134 status=$?
9135 $rm -f try.[co]
9136 exit $status
9137 EOSH
9138 chmod +x protochk
9139 $eunicefix protochk
9140
9141 hasproto='varname=$1; func=$2; 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 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9149 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9150         echo "$func() prototype found.";
9151         val="$define";
9152 else
9153         echo "$func() prototype NOT found.";
9154         val="$undef";
9155 fi;
9156 set $varname;
9157 eval $setvar;
9158 $rm -f try.c tryout.c'
9159
9160 : see if sys/types.h has to be included
9161 set sys/types.h i_systypes
9162 eval $inhdr
9163
9164 : see if sys/select.h has to be included
9165 set sys/select.h i_sysselct
9166 eval $inhdr
9167
9168 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9169 while $test $# -ge 2; do
9170         case "$1" in
9171         $define) echo "#include <$2>";;
9172         esac ;
9173     shift 2;
9174 done > try.c;
9175 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9176 set try;
9177 if eval $compile; then
9178         val="$define";
9179 else
9180         val="$undef";
9181 fi;
9182 set $varname;
9183 eval $setvar;
9184 $rm -f try.c try.o'
9185
9186 : see if we should include time.h, sys/time.h, or both
9187 echo " "
9188 if test "X$timeincl" = X; then
9189         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9190         $echo $n "I'm now running the test program...$c"
9191         $cat >try.c <<'EOCP'
9192 #include <sys/types.h>
9193 #ifdef I_TIME
9194 #include <time.h>
9195 #endif
9196 #ifdef I_SYSTIME
9197 #ifdef SYSTIMEKERNEL
9198 #define KERNEL
9199 #endif
9200 #include <sys/time.h>
9201 #endif
9202 #ifdef I_SYSSELECT
9203 #include <sys/select.h>
9204 #endif
9205 int main()
9206 {
9207         struct tm foo;
9208 #ifdef S_TIMEVAL
9209         struct timeval bar;
9210 #endif
9211 #ifdef S_TIMEZONE
9212         struct timezone tzp;
9213 #endif
9214         if (foo.tm_sec == foo.tm_sec)
9215                 exit(0);
9216 #ifdef S_TIMEVAL
9217         if (bar.tv_sec == bar.tv_sec)
9218                 exit(0);
9219 #endif
9220         exit(1);
9221 }
9222 EOCP
9223         flags=''
9224         for s_timezone in '-DS_TIMEZONE' ''; do
9225         sysselect=''
9226         for s_timeval in '-DS_TIMEVAL' ''; do
9227         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9228         for i_time in '' '-DI_TIME'; do
9229         for i_systime in '-DI_SYSTIME' ''; do
9230                 case "$flags" in
9231                 '') $echo $n ".$c"
9232                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9233                         if eval $compile; then
9234                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9235                                 shift
9236                                 flags="$*"
9237                                 echo " "
9238                                 $echo $n "Succeeded with $flags$c"
9239                         fi
9240                         ;;
9241                 esac
9242         done
9243         done
9244         done
9245         done
9246         done
9247         timeincl=''
9248         echo " "
9249         case "$flags" in
9250         *SYSTIMEKERNEL*) i_systimek="$define"
9251                 timeincl=`./findhdr sys/time.h`
9252                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9253         *) i_systimek="$undef";;
9254         esac
9255         case "$flags" in
9256         *I_TIME*) i_time="$define"
9257                 timeincl=`./findhdr time.h`" $timeincl"
9258                 echo "We'll include <time.h>." >&4;;
9259         *) i_time="$undef";;
9260         esac
9261         case "$flags" in
9262         *I_SYSTIME*) i_systime="$define"
9263                 timeincl=`./findhdr sys/time.h`" $timeincl"
9264                 echo "We'll include <sys/time.h>." >&4;;
9265         *) i_systime="$undef";;
9266         esac
9267         $rm -f try.c try
9268 fi
9269 : see if struct tm knows about tm_zone
9270 case "$i_systime$i_time" in
9271 *$define*) 
9272         echo " "
9273         echo "Checking to see if your struct tm has tm_zone field..." >&4
9274         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9275         eval $hasfield
9276         ;;
9277 *)      val="$undef"
9278         set d_tm_tm_zone
9279         eval $setvar
9280         ;;
9281 esac
9282 case "$d_tm_tm_zone" in
9283 "$define")      echo "Yes, it does."   ;;
9284 *)              echo "No, it doesn't." ;;
9285 esac
9286 : see if struct tm knows about tm_gmtoff
9287 case "$i_systime$i_time" in
9288 *$define*) 
9289         echo " "
9290         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9291         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9292         eval $hasfield
9293         ;;
9294 *)      val="$undef"
9295         set d_tm_tm_gmtoff
9296         eval $setvar
9297         ;;
9298 esac
9299 case "$d_tm_tm_gmtoff" in
9300 "$define")      echo "Yes, it does."   ;;
9301 *)              echo "No, it doesn't." ;;
9302 esac
9303
9304 : see if asctime_r exists
9305 set asctime_r d_asctime_r
9306 eval $inlibc
9307 case "$d_asctime_r" in
9308 "$define")
9309         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9310         case "$d_asctime_r_proto:$usethreads" in
9311         ":define")      d_asctime_r_proto=define
9312                 set d_asctime_r_proto asctime_r $hdrs
9313                 eval $hasproto ;;
9314         *)      ;;
9315         esac
9316         case "$d_asctime_r_proto" in
9317         define)
9318         case "$asctime_r_proto" in
9319         ''|0) try='char* asctime_r(const struct tm*, char*);'
9320         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9321         esac
9322         case "$asctime_r_proto" in
9323         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9324         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9325         esac
9326         case "$asctime_r_proto" in
9327         ''|0) try='int asctime_r(const struct tm*, char*);'
9328         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9329         esac
9330         case "$asctime_r_proto" in
9331         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9332         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9333         esac
9334         case "$asctime_r_proto" in
9335         ''|0)   d_asctime_r=undef
9336                 asctime_r_proto=0
9337                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9338         * )     case "$asctime_r_proto" in
9339                 REENTRANT_PROTO*) ;;
9340                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9341                 esac
9342                 echo "Prototype: $try" ;;
9343         esac
9344         ;;
9345         *)      case "$usethreads" in
9346                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9347                 esac
9348                 d_asctime_r=undef
9349                 asctime_r_proto=0
9350                 ;;
9351         esac
9352         ;;
9353 *)      asctime_r_proto=0
9354         ;;
9355 esac
9356
9357 : see if atolf exists
9358 set atolf d_atolf
9359 eval $inlibc
9360
9361 : see if atoll exists
9362 set atoll d_atoll
9363 eval $inlibc
9364
9365 : Look for GNU-cc style attribute checking
9366 echo " "
9367 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9368 $cat >attrib.c <<'EOCP'
9369 #include <stdio.h>
9370 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9371 EOCP
9372 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9373         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9374                 echo "Your C compiler doesn't fully support __attribute__."
9375                 val="$undef"
9376         else
9377                 echo "Your C compiler supports __attribute__."
9378                 val="$define"
9379         fi
9380 else
9381         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9382         val="$undef"
9383 fi
9384 set d_attribut
9385 eval $setvar
9386 $rm -f attrib*
9387
9388 : see if bcmp exists
9389 set bcmp d_bcmp
9390 eval $inlibc
9391
9392 : see if bcopy exists
9393 set bcopy d_bcopy
9394 eval $inlibc
9395
9396 : see if this is a unistd.h system
9397 set unistd.h i_unistd
9398 eval $inhdr
9399
9400 : see if getpgrp exists
9401 set getpgrp d_getpgrp
9402 eval $inlibc
9403
9404 case "$d_getpgrp" in
9405 "$define")
9406         echo " "
9407         echo "Checking to see which flavor of getpgrp is in use..."
9408         $cat >try.c <<EOP
9409 #$i_unistd I_UNISTD
9410 #include <sys/types.h>
9411 #ifdef I_UNISTD
9412 #  include <unistd.h>
9413 #endif
9414 int main()
9415 {
9416         if (getuid() == 0) {
9417                 printf("(I see you are running Configure as super-user...)\n");
9418                 setuid(1);
9419         }
9420 #ifdef TRY_BSD_PGRP
9421         if (getpgrp(1) == 0)
9422                 exit(0);
9423 #else
9424         if (getpgrp() > 0)
9425                 exit(0);
9426 #endif
9427         exit(1);
9428 }
9429 EOP
9430         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9431                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9432                 val="$define"
9433         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9434                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9435                 val="$undef"
9436         else
9437                 echo "I can't seem to compile and run the test program."
9438                 if ./usg; then
9439                         xxx="a USG one, i.e. you use getpgrp()."
9440                 else
9441                         # SVR4 systems can appear rather BSD-ish.
9442                         case "$i_unistd" in
9443                         $undef)
9444                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9445                                 val="$define"
9446                                 ;;
9447                         $define)
9448                                 xxx="probably a USG one, i.e. you use getpgrp()."
9449                                 val="$undef"
9450                                 ;;
9451                         esac
9452                 fi
9453                 echo "Assuming your getpgrp is $xxx" >&4
9454         fi
9455         ;;
9456 *) val="$undef";;
9457 esac
9458 set d_bsdgetpgrp
9459 eval $setvar
9460 $rm -f try try.*
9461
9462 : see if setpgrp exists
9463 set setpgrp d_setpgrp
9464 eval $inlibc
9465
9466 case "$d_setpgrp" in
9467 "$define")
9468         echo " "
9469         echo "Checking to see which flavor of setpgrp is in use..."
9470         $cat >try.c <<EOP
9471 #$i_unistd I_UNISTD
9472 #include <sys/types.h>
9473 #ifdef I_UNISTD
9474 #  include <unistd.h>
9475 #endif
9476 int main()
9477 {
9478         if (getuid() == 0) {
9479                 printf("(I see you are running Configure as super-user...)\n");
9480                 setuid(1);
9481         }
9482 #ifdef TRY_BSD_PGRP
9483         if (-1 == setpgrp(1, 1))
9484                 exit(0);
9485 #else
9486         if (setpgrp() != -1)
9487                 exit(0);
9488 #endif
9489         exit(1);
9490 }
9491 EOP
9492         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9493                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9494                 val="$define"
9495         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9496                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9497                 val="$undef"
9498         else
9499                 echo "(I can't seem to compile and run the test program.)"
9500                 if ./usg; then
9501                         xxx="a USG one, i.e. you use setpgrp()."
9502                 else
9503                         # SVR4 systems can appear rather BSD-ish.
9504                         case "$i_unistd" in
9505                         $undef)
9506                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9507                                 val="$define"
9508                                 ;;
9509                         $define)
9510                                 xxx="probably a USG one, i.e. you use setpgrp()."
9511                                 val="$undef"
9512                                 ;;
9513                         esac
9514                 fi
9515                 echo "Assuming your setpgrp is $xxx" >&4
9516         fi
9517         ;;
9518 *) val="$undef";;
9519 esac
9520 set d_bsdsetpgrp
9521 eval $setvar
9522 $rm -f try try.*
9523 : see if bzero exists
9524 set bzero d_bzero
9525 eval $inlibc
9526
9527 : see if signal is declared as pointer to function returning int or void
9528 echo " "
9529 xxx=`./findhdr signal.h`
9530 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9531 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9532         echo "You have int (*signal())() instead of void." >&4
9533         val="$undef"
9534 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9535         echo "You have void (*signal())()." >&4
9536         val="$define"
9537 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9538         echo "You have int (*signal())() instead of void." >&4
9539         val="$undef"
9540 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9541         echo "You have void (*signal())()." >&4
9542         val="$define"
9543 else
9544         case "$d_voidsig" in
9545         '')
9546         echo "I can't determine whether signal handler returns void or int..." >&4
9547                 dflt=void
9548                 rp="What type does your signal handler return?"
9549                 . ./myread
9550                 case "$ans" in
9551                 v*) val="$define";;
9552                 *) val="$undef";;
9553                 esac;;
9554         "$define")
9555                 echo "As you already told me, signal handler returns void." >&4
9556                 val="$define"
9557                 ;;
9558         *)      echo "As you already told me, signal handler returns int." >&4
9559                 val="$undef"
9560                 ;;
9561         esac
9562 fi
9563 set d_voidsig
9564 eval $setvar
9565 case "$d_voidsig" in
9566 "$define") signal_t="void";;
9567 *) signal_t="int";;
9568 esac
9569 $rm -f $$.tmp
9570
9571 : check for ability to cast large floats to 32-bit ints.
9572 echo " "
9573 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9574 if $test "$intsize" -ge 4; then
9575         xxx=int
9576 else
9577         xxx=long
9578 fi
9579 $cat >try.c <<EOCP
9580 #include <stdio.h>
9581 #include <sys/types.h>
9582 #include <signal.h>
9583 $signal_t blech(s) int s; { exit(3); }
9584 int main()
9585 {
9586         $xxx i32;
9587         double f, g;
9588         int result = 0;
9589         char str[16];
9590         signal(SIGFPE, blech);
9591
9592         /* Don't let compiler optimize the test away.  Store the number 
9593            in a writable string for gcc to pass to sscanf under HP/UX.
9594         */
9595         sprintf(str, "2147483647");
9596         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9597         g = 10 * f;
9598         i32  = ($xxx) g;
9599
9600         /* x86 processors will probably give 0x8000 0000, which is a
9601        sign change.  We don't want that.  We want to mimic SPARC
9602            behavior here, which is to preserve the sign and give
9603            back 0x7fff ffff.
9604         */
9605         if (i32 != ($xxx) f)
9606                 result |= 1;
9607         exit(result);
9608 }
9609 EOCP
9610 set try
9611 if eval $compile_ok; then
9612         $run ./try
9613         yyy=$?
9614 else
9615         echo "(I can't seem to compile the test program--assuming it can't)"
9616         yyy=1
9617 fi
9618 case "$yyy" in
9619 0)      val="$define"
9620         echo "Yup, it can."
9621         ;;
9622 *)      val="$undef"
9623         echo "Nope, it can't."
9624         ;;
9625 esac
9626 set d_casti32
9627 eval $setvar
9628 $rm -f try try.*
9629
9630 : check for ability to cast negative floats to unsigned
9631 echo " "
9632 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9633 $cat >try.c <<EOCP
9634 #include <stdio.h>
9635 #include <sys/types.h>
9636 #include <signal.h>
9637 $signal_t blech(s) int s; { exit(7); }
9638 $signal_t blech_in_list(s) int s; { exit(4); }
9639 unsigned long dummy_long(p) unsigned long p; { return p; }
9640 unsigned int dummy_int(p) unsigned int p; { return p; }
9641 unsigned short dummy_short(p) unsigned short p; { return p; }
9642 int main()
9643 {
9644         double f;
9645         unsigned long along;
9646         unsigned int aint;
9647         unsigned short ashort;
9648         int result = 0;
9649         char str[16];
9650         
9651         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9652            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9653            optimized the whole file away
9654         */
9655         /* Store the number in a writable string for gcc to pass to 
9656            sscanf under HP/UX.
9657         */
9658         sprintf(str, "-123");
9659         sscanf(str, "%lf", &f);  /* f = -123.; */
9660
9661         signal(SIGFPE, blech);
9662         along = (unsigned long)f;
9663         aint = (unsigned int)f;
9664         ashort = (unsigned short)f;
9665         if (along != (unsigned long)-123)
9666                 result |= 1;
9667         if (aint != (unsigned int)-123)
9668                 result |= 1;
9669         if (ashort != (unsigned short)-123)
9670                 result |= 1;
9671         sprintf(str, "1073741824.");
9672         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9673         f = f + f;
9674         along = 0;
9675         along = (unsigned long)f;
9676         if (along != 0x80000000)
9677                 result |= 2;
9678         f -= 1.;
9679         along = 0;
9680         along = (unsigned long)f;
9681         if (along != 0x7fffffff)
9682                 result |= 1;
9683         f += 2.;
9684         along = 0;
9685         along = (unsigned long)f;
9686         if (along != 0x80000001)
9687                 result |= 2;
9688         if (result)
9689                 exit(result);
9690         signal(SIGFPE, blech_in_list);
9691         sprintf(str, "123.");
9692         sscanf(str, "%lf", &f);  /* f = 123.; */
9693         along = dummy_long((unsigned long)f);
9694         aint = dummy_int((unsigned int)f);
9695         ashort = dummy_short((unsigned short)f);
9696         if (along != (unsigned long)123)
9697                 result |= 4;
9698         if (aint != (unsigned int)123)
9699                 result |= 4;
9700         if (ashort != (unsigned short)123)
9701                 result |= 4;
9702         exit(result);
9703
9704 }
9705 EOCP
9706 set try
9707 if eval $compile_ok; then
9708         $run ./try
9709         castflags=$?
9710 else
9711         echo "(I can't seem to compile the test program--assuming it can't)"
9712         castflags=7
9713 fi
9714 case "$castflags" in
9715 0)      val="$define"
9716         echo "Yup, it can."
9717         ;;
9718 *)      val="$undef"
9719         echo "Nope, it can't."
9720         ;;
9721 esac
9722 set d_castneg
9723 eval $setvar
9724 $rm -f try.*
9725
9726 : see if vprintf exists
9727 echo " "
9728 if set vprintf val -f d_vprintf; eval $csym; $val; then
9729         echo 'vprintf() found.' >&4
9730         val="$define"
9731         $cat >try.c <<'EOF'
9732 #include <varargs.h>
9733
9734 int main() { xxx("foo"); }
9735
9736 xxx(va_alist)
9737 va_dcl
9738 {
9739         va_list args;
9740         char buf[10];
9741
9742         va_start(args);
9743         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9744 }
9745 EOF
9746         set try
9747         if eval $compile && $run ./try; then
9748                 echo "Your vsprintf() returns (int)." >&4
9749                 val2="$undef"
9750         else
9751                 echo "Your vsprintf() returns (char*)." >&4
9752                 val2="$define"
9753         fi
9754 else
9755         echo 'vprintf() NOT found.' >&4
9756                 val="$undef"
9757                 val2="$undef"
9758 fi
9759 $rm -f try try.*
9760 set d_vprintf
9761 eval $setvar
9762 val=$val2
9763 set d_charvspr
9764 eval $setvar
9765
9766 : see if chown exists
9767 set chown d_chown
9768 eval $inlibc
9769
9770 : see if chroot exists
9771 set chroot d_chroot
9772 eval $inlibc
9773
9774 : see if chsize exists
9775 set chsize d_chsize
9776 eval $inlibc
9777
9778 : see if class exists
9779 set class d_class
9780 eval $inlibc
9781
9782 hasstruct='varname=$1; struct=$2; shift; shift;
9783 while $test $# -ge 2; do
9784         case "$1" in
9785         $define) echo "#include <$2>";;
9786         esac ;
9787     shift 2;
9788 done > try.c;
9789 echo "int main () { struct $struct foo; }" >> try.c;
9790 set try;
9791 if eval $compile; then
9792         val="$define";
9793 else
9794         val="$undef";
9795 fi;
9796 set $varname;
9797 eval $setvar;
9798 $rm -f try.c try.o'
9799
9800 socketlib=''
9801 sockethdr=''
9802 : see whether socket exists
9803 echo " "
9804 $echo $n "Hmm... $c" >&4
9805 if set socket val -f d_socket; eval $csym; $val; then
9806         echo "Looks like you have Berkeley networking support." >&4
9807         d_socket="$define"
9808         if set setsockopt val -f; eval $csym; $val; then
9809                 d_oldsock="$undef"
9810         else
9811                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9812                 d_oldsock="$define"
9813         fi
9814 else
9815         if $contains socklib libc.list >/dev/null 2>&1; then
9816                 echo "Looks like you have Berkeley networking support." >&4
9817                 d_socket="$define"
9818                 : we will have to assume that it supports the 4.2 BSD interface
9819                 d_oldsock="$undef"
9820         else
9821                 echo "You don't have Berkeley networking in libc$_a..." >&4
9822                 if test "X$d_socket" = "X$define"; then
9823                    echo "...but you seem to believe that you have sockets." >&4
9824                 else
9825                         for net in net socket
9826                         do
9827                                 if test -f /usr/lib/lib$net$_a; then
9828                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9829                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9830                                         if $contains socket libc.list >/dev/null 2>&1; then
9831                                                 d_socket="$define"
9832                                                 socketlib="-l$net"
9833                                                 case "$net" in
9834                                                 net)
9835                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9836                                                         sockethdr="-I/usr/netinclude"
9837                                                         ;;
9838                                                 esac
9839                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9840                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9841                                                         d_oldsock="$undef"
9842                                                 else
9843                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9844                                                         d_oldsock="$define"
9845                                                 fi
9846                                                 break
9847                                         fi
9848                                 fi
9849                         done
9850                         if test "X$d_socket" != "X$define"; then
9851                            echo "or anywhere else I see." >&4
9852                            d_socket="$undef"
9853                            d_oldsock="$undef"
9854                         fi
9855                 fi
9856         fi
9857 fi
9858
9859 : see if socketpair exists
9860 set socketpair d_sockpair
9861 eval $inlibc
9862
9863
9864 echo " "
9865 echo "Checking the availability of certain socket constants..." >&4
9866 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9867         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9868         $cat >try.c <<EOF
9869 #include <sys/types.h>
9870 #include <sys/socket.h>
9871 int main() {
9872     int i = $ENUM;
9873 }
9874 EOF
9875         val="$undef"
9876         set try; if eval $compile; then
9877                 val="$define"
9878         fi
9879         set d_${enum}; eval $setvar
9880         $rm -f try.c try
9881 done
9882
9883 : see if this is a sys/uio.h system
9884 set sys/uio.h i_sysuio
9885 eval $inhdr
9886
9887
9888 echo " "
9889 echo "Checking to see if your system supports struct cmsghdr..." >&4
9890 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9891 eval $hasstruct
9892 case "$d_cmsghdr_s" in
9893 "$define")      echo "Yes, it does."   ;;
9894 *)              echo "No, it doesn't." ;;
9895 esac
9896
9897
9898 : check for const keyword
9899 echo " "
9900 echo 'Checking to see if your C compiler knows about "const"...' >&4
9901 $cat >const.c <<'EOCP'
9902 typedef struct spug { int drokk; } spug;
9903 int main()
9904 {
9905         const char *foo;
9906         const spug y;
9907 }
9908 EOCP
9909 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9910         val="$define"
9911         echo "Yup, it does."
9912 else
9913         val="$undef"
9914         echo "Nope, it doesn't."
9915 fi
9916 set d_const
9917 eval $setvar
9918
9919 : see if crypt exists
9920 echo " "
9921 set crypt d_crypt
9922 eval $inlibc
9923 case "$d_crypt" in
9924 $define) cryptlib='' ;;
9925 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9926                 echo 'crypt() found.' >&4
9927                 val="$define"
9928                 cryptlib=''
9929         else
9930                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9931                 if $test -z "$cryptlib"; then
9932                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9933                 else
9934                         cryptlib=-lcrypt
9935                 fi
9936                 if $test -z "$cryptlib"; then
9937                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9938                 else
9939                         cryptlib=-lcrypt
9940                 fi
9941                 if $test -z "$cryptlib"; then
9942                         cryptlib=`./loc libcrypt$_a "" $libpth`
9943                 else
9944                         cryptlib=-lcrypt
9945                 fi
9946                 if $test -z "$cryptlib"; then
9947                         echo 'crypt() NOT found.' >&4
9948                         val="$undef"
9949                 else
9950                         val="$define"
9951                 fi
9952         fi
9953         set d_crypt
9954         eval $setvar
9955         ;;
9956 esac
9957
9958 : see if this is a crypt.h system
9959 set crypt.h i_crypt
9960 eval $inhdr
9961
9962 : see if crypt_r exists
9963 set crypt_r d_crypt_r
9964 eval $inlibc
9965 case "$d_crypt_r" in
9966 "$define")
9967         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9968         case "$d_crypt_r_proto:$usethreads" in
9969         ":define")      d_crypt_r_proto=define
9970                 set d_crypt_r_proto crypt_r $hdrs
9971                 eval $hasproto ;;
9972         *)      ;;
9973         esac
9974         case "$d_crypt_r_proto" in
9975         define)
9976         case "$crypt_r_proto" in
9977         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9978         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9979         esac
9980         case "$crypt_r_proto" in
9981         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9982         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9983         esac
9984         case "$crypt_r_proto" in
9985         ''|0)   d_crypt_r=undef
9986                 crypt_r_proto=0
9987                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9988         * )     case "$crypt_r_proto" in
9989                 REENTRANT_PROTO*) ;;
9990                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9991                 esac
9992                 echo "Prototype: $try" ;;
9993         esac
9994         ;;
9995         *)      case "$usethreads" in
9996                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9997                 esac
9998                 d_crypt_r=undef
9999                 crypt_r_proto=0
10000                 ;;
10001         esac
10002         ;;
10003 *)      crypt_r_proto=0
10004         ;;
10005 esac
10006
10007 : get csh whereabouts
10008 case "$csh" in
10009 'csh') val="$undef" ;;
10010 *) val="$define" ;;
10011 esac
10012 set d_csh
10013 eval $setvar
10014 : Respect a hint or command line value for full_csh.
10015 case "$full_csh" in
10016 '') full_csh=$csh ;;
10017 esac
10018
10019 : see if ctermid_r exists
10020 set ctermid_r d_ctermid_r
10021 eval $inlibc
10022 case "$d_ctermid_r" in
10023 "$define")
10024         hdrs="$i_systypes sys/types.h define stdio.h "
10025         case "$d_ctermid_r_proto:$usethreads" in
10026         ":define")      d_ctermid_r_proto=define
10027                 set d_ctermid_r_proto ctermid_r $hdrs
10028                 eval $hasproto ;;
10029         *)      ;;
10030         esac
10031         case "$d_ctermid_r_proto" in
10032         define)
10033         case "$ctermid_r_proto" in
10034         ''|0) try='char* ctermid_r(char*);'
10035         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10036         esac
10037         case "$ctermid_r_proto" in
10038         ''|0)   d_ctermid_r=undef
10039                 ctermid_r_proto=0
10040                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10041         * )     case "$ctermid_r_proto" in
10042                 REENTRANT_PROTO*) ;;
10043                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10044                 esac
10045                 echo "Prototype: $try" ;;
10046         esac
10047         ;;
10048         *)      case "$usethreads" in
10049                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10050                 esac
10051                 d_ctermid_r=undef
10052                 ctermid_r_proto=0
10053                 ;;
10054         esac
10055         ;;
10056 *)      ctermid_r_proto=0
10057         ;;
10058 esac
10059
10060 : see if ctime_r exists
10061 set ctime_r d_ctime_r
10062 eval $inlibc
10063 case "$d_ctime_r" in
10064 "$define")
10065         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10066         case "$d_ctime_r_proto:$usethreads" in
10067         ":define")      d_ctime_r_proto=define
10068                 set d_ctime_r_proto ctime_r $hdrs
10069                 eval $hasproto ;;
10070         *)      ;;
10071         esac
10072         case "$d_ctime_r_proto" in
10073         define)
10074         case "$ctime_r_proto" in
10075         ''|0) try='char* ctime_r(const time_t*, char*);'
10076         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10077         esac
10078         case "$ctime_r_proto" in
10079         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10080         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10081         esac
10082         case "$ctime_r_proto" in
10083         ''|0) try='int ctime_r(const time_t*, char*);'
10084         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10085         esac
10086         case "$ctime_r_proto" in
10087         ''|0) try='int ctime_r(const time_t*, char*, int);'
10088         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10089         esac
10090         case "$ctime_r_proto" in
10091         ''|0)   d_ctime_r=undef
10092                 ctime_r_proto=0
10093                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10094         * )     case "$ctime_r_proto" in
10095                 REENTRANT_PROTO*) ;;
10096                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10097                 esac
10098                 echo "Prototype: $try" ;;
10099         esac
10100         ;;
10101         *)      case "$usethreads" in
10102                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10103                 esac
10104                 d_ctime_r=undef
10105                 ctime_r_proto=0
10106                 ;;
10107         esac
10108         ;;
10109 *)      ctime_r_proto=0
10110         ;;
10111 esac
10112
10113 : see if cuserid exists
10114 set cuserid d_cuserid
10115 eval $inlibc
10116
10117 : see if this is a limits.h system
10118 set limits.h i_limits
10119 eval $inhdr
10120
10121 : see if this is a float.h system
10122 set float.h i_float
10123 eval $inhdr
10124
10125 : See if number of significant digits in a double precision number is known
10126 echo " "
10127 $cat >dbl_dig.c <<EOM
10128 #$i_limits I_LIMITS
10129 #$i_float I_FLOAT
10130 #ifdef I_LIMITS
10131 #include <limits.h>
10132 #endif
10133 #ifdef I_FLOAT
10134 #include <float.h>
10135 #endif
10136 #ifdef DBL_DIG
10137 printf("Contains DBL_DIG");
10138 #endif
10139 EOM
10140 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10141 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10142         echo "DBL_DIG found." >&4
10143         val="$define"
10144 else
10145         echo "DBL_DIG NOT found." >&4
10146         val="$undef"
10147 fi
10148 $rm -f dbl_dig.?
10149 set d_dbl_dig
10150 eval $setvar
10151
10152 : see if dbm.h is available
10153 : see if dbmclose exists
10154 set dbmclose d_dbmclose
10155 eval $inlibc
10156
10157 case "$d_dbmclose" in
10158 $define)
10159         set dbm.h i_dbm
10160         eval $inhdr
10161         case "$i_dbm" in
10162         $define)
10163                 val="$undef"
10164                 set i_rpcsvcdbm
10165                 eval $setvar
10166                 ;;
10167         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10168                 eval $inhdr
10169                 ;;
10170         esac
10171         ;;
10172 *)      echo "We won't be including <dbm.h>"
10173         val="$undef"
10174         set i_dbm
10175         eval $setvar
10176         val="$undef"
10177         set i_rpcsvcdbm
10178         eval $setvar
10179         ;;
10180 esac
10181
10182 : see if prototype for dbminit is available
10183 echo " "
10184 set d_dbminitproto dbminit $i_dbm dbm.h
10185 eval $hasproto
10186
10187 : see if difftime exists
10188 set difftime d_difftime
10189 eval $inlibc
10190
10191 : see if this is a dirent system
10192 echo " "
10193 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10194         val="$define"
10195         echo "<dirent.h> found." >&4
10196 else
10197         val="$undef"
10198         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10199                 echo "<sys/dir.h> found." >&4
10200                 echo " "
10201         else
10202                 xinc=`./findhdr sys/ndir.h`
10203         fi
10204         echo "<dirent.h> NOT found." >&4
10205 fi
10206 set i_dirent
10207 eval $setvar
10208
10209 : Look for type of directory structure.
10210 echo " "
10211 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10212
10213 case "$direntrytype" in
10214 ''|' ')
10215         case "$i_dirent" in
10216         $define) guess1='struct dirent' ;;
10217         *) guess1='struct direct'  ;;
10218         esac
10219         ;;
10220 *)      guess1="$direntrytype"
10221         ;;
10222 esac
10223
10224 case "$guess1" in
10225 'struct dirent') guess2='struct direct' ;;
10226 *) guess2='struct dirent' ;;
10227 esac
10228                 
10229 if $contains "$guess1" try.c >/dev/null 2>&1; then
10230         direntrytype="$guess1"
10231         echo "Your directory entries are $direntrytype." >&4
10232 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10233         direntrytype="$guess2"
10234         echo "Your directory entries seem to be $direntrytype." >&4
10235 else
10236         echo "I don't recognize your system's directory entries." >&4
10237         rp="What type is used for directory entries on this system?"
10238         dflt="$guess1"
10239         . ./myread
10240         direntrytype="$ans"
10241 fi
10242 $rm -f try.c
10243
10244
10245 : see if the directory entry stores field length
10246 echo " "
10247 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10248 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10249         echo "Good, your directory entry keeps length information in d_namlen." >&4
10250         val="$define"
10251 else
10252         echo "Your directory entry does not know about the d_namlen field." >&4
10253         val="$undef"
10254 fi
10255 set d_dirnamlen
10256 eval $setvar
10257 $rm -f try.c
10258
10259 : see if this is an sysdir system
10260 set sys/dir.h i_sysdir
10261 eval $inhdr
10262
10263 : see if this is an sysndir system
10264 set sys/ndir.h i_sysndir
10265 eval $inhdr
10266
10267 : Look for dirfd
10268 echo " "
10269 $cat >dirfd.c <<EOM
10270 #include <stdio.h>
10271 #$i_dirent I_DIRENT             /**/
10272 #$i_sysdir I_SYS_DIR            /**/
10273 #$i_sysndir I_SYS_NDIR          /**/
10274 #$i_systypes I_SYS_TYPES        /**/
10275 #if defined(I_SYS_TYPES)
10276 #include <sys/types.h>
10277 #endif
10278 #if defined(I_DIRENT)
10279 #include <dirent.h>
10280 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10281 #include <sys/dir.h>
10282 #endif
10283 #else
10284 #ifdef I_SYS_NDIR
10285 #include <sys/ndir.h>
10286 #else
10287 #ifdef I_SYS_DIR
10288 #ifdef hp9000s500
10289 #include <ndir.h>       /* may be wrong in the future */
10290 #else
10291 #include <sys/dir.h>
10292 #endif
10293 #endif
10294 #endif
10295 #endif 
10296 int main() {
10297         DIR *dirp = opendir(".");
10298         if (dirfd(dirp) >= 0)
10299                 exit(0);
10300         else
10301                 exit(1);
10302 }
10303 EOM
10304 set dirfd
10305 if eval $compile; then
10306         val="$define"
10307 fi
10308 case "$val" in
10309 $define)        echo "dirfd() found." >&4       ;;
10310 *)              echo "dirfd() NOT found." >&4   ;;
10311 esac
10312 set d_dirfd
10313 eval $setvar
10314 $rm -f dirfd*
10315
10316 : see if dlerror exists
10317 xxx_runnm="$runnm"
10318 runnm=false
10319 set dlerror d_dlerror
10320 eval $inlibc
10321 runnm="$xxx_runnm"
10322
10323 : see if dlfcn is available
10324 set dlfcn.h i_dlfcn
10325 eval $inhdr
10326
10327 case "$usedl" in
10328 $define|y|true)
10329         $cat << EOM
10330
10331 On a few systems, the dynamically loaded modules that perl generates and uses
10332 will need a different extension than shared libs. The default will probably
10333 be appropriate.
10334
10335 EOM
10336         case "$dlext" in
10337         '')     dflt="$so" ;;
10338         *)      dflt="$dlext" ;;
10339         esac
10340         rp='What is the extension of dynamically loaded modules'
10341         . ./myread
10342         dlext="$ans"
10343         ;;
10344 *)
10345         dlext="none"
10346         ;;
10347 esac
10348
10349 : Check if dlsym need a leading underscore
10350 echo " "
10351 val="$undef"
10352
10353 case "$dlsrc" in
10354 dl_dlopen.xs)
10355         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10356         $cat >dyna.c <<'EOM'
10357 fred () { }
10358 EOM
10359
10360 $cat >fred.c<<EOM
10361
10362 #include <stdio.h>
10363 #$i_dlfcn I_DLFCN
10364 #ifdef I_DLFCN
10365 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10366 #else
10367 #include <sys/types.h>
10368 #include <nlist.h>
10369 #include <link.h>
10370 #endif
10371
10372 extern int fred() ;
10373
10374 int main()
10375 {
10376     void * handle ;
10377     void * symbol ;
10378 #ifndef RTLD_LAZY
10379     int mode = 1 ;
10380 #else
10381     int mode = RTLD_LAZY ;
10382 #endif
10383     handle = dlopen("./dyna.$dlext", mode) ;
10384     if (handle == NULL) {
10385         printf ("1\n") ;
10386         fflush (stdout) ;
10387         exit(0);
10388     }
10389     symbol = dlsym(handle, "fred") ;
10390     if (symbol == NULL) {
10391         /* try putting a leading underscore */
10392         symbol = dlsym(handle, "_fred") ;
10393         if (symbol == NULL) {
10394             printf ("2\n") ;
10395             fflush (stdout) ;
10396             exit(0);
10397         }
10398         printf ("3\n") ;
10399     }
10400     else
10401         printf ("4\n") ;
10402     fflush (stdout) ;
10403     exit(0);
10404 }
10405 EOM
10406         : Call the object file tmp-dyna.o in case dlext=o.
10407         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10408                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10409                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10410                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10411                 xxx=`$run ./fred`
10412                 case $xxx in
10413                 1)      echo "Test program failed using dlopen." >&4
10414                         echo "Perhaps you should not use dynamic loading." >&4;;
10415                 2)      echo "Test program failed using dlsym." >&4
10416                         echo "Perhaps you should not use dynamic loading." >&4;;
10417                 3)      echo "dlsym needs a leading underscore" >&4
10418                         val="$define" ;;
10419                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10420                 esac
10421         else
10422                 echo "I can't compile and run the test program." >&4
10423                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10424         fi
10425         ;;
10426 esac
10427                 
10428 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10429
10430 set d_dlsymun
10431 eval $setvar
10432
10433 : see if drand48_r exists
10434 set drand48_r d_drand48_r
10435 eval $inlibc
10436 case "$d_drand48_r" in
10437 "$define")
10438         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10439         case "$d_drand48_r_proto:$usethreads" in
10440         ":define")      d_drand48_r_proto=define
10441                 set d_drand48_r_proto drand48_r $hdrs
10442                 eval $hasproto ;;
10443         *)      ;;
10444         esac
10445         case "$d_drand48_r_proto" in
10446         define)
10447         case "$drand48_r_proto" in
10448         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10449         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10450         esac
10451         case "$drand48_r_proto" in
10452         ''|0)   d_drand48_r=undef
10453                 drand48_r_proto=0
10454                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10455         * )     case "$drand48_r_proto" in
10456                 REENTRANT_PROTO*) ;;
10457                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10458                 esac
10459                 echo "Prototype: $try" ;;
10460         esac
10461         ;;
10462         *)      case "$usethreads" in
10463                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10464                 esac
10465                 d_drand48_r=undef
10466                 drand48_r_proto=0
10467                 ;;
10468         esac
10469         ;;
10470 *)      drand48_r_proto=0
10471         ;;
10472 esac
10473
10474 : see if prototype for drand48 is available
10475 echo " "
10476 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10477 eval $hasproto
10478
10479 : see if dup2 exists
10480 set dup2 d_dup2
10481 eval $inlibc
10482
10483 : see if eaccess exists
10484 set eaccess d_eaccess
10485 eval $inlibc
10486
10487 : see if endgrent exists
10488 set endgrent d_endgrent
10489 eval $inlibc
10490
10491 : see if this is an grp system
10492 set grp.h i_grp
10493 eval $inhdr
10494
10495 case "$i_grp" in
10496 $define)
10497         xxx=`./findhdr grp.h`
10498         $cppstdin $cppflags $cppminus < $xxx >$$.h
10499
10500         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10501                 val="$define"
10502         else
10503                 val="$undef"
10504         fi
10505         set d_grpasswd
10506         eval $setvar
10507
10508         $rm -f $$.h
10509         ;;
10510 *)
10511         val="$undef";
10512         set d_grpasswd; eval $setvar
10513         ;;
10514 esac
10515
10516 : see if endgrent_r exists
10517 set endgrent_r d_endgrent_r
10518 eval $inlibc
10519 case "$d_endgrent_r" in
10520 "$define")
10521         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10522         case "$d_endgrent_r_proto:$usethreads" in
10523         ":define")      d_endgrent_r_proto=define
10524                 set d_endgrent_r_proto endgrent_r $hdrs
10525                 eval $hasproto ;;
10526         *)      ;;
10527         esac
10528         case "$d_endgrent_r_proto" in
10529         define)
10530         case "$endgrent_r_proto" in
10531         ''|0) try='int endgrent_r(FILE**);'
10532         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10533         esac
10534         case "$endgrent_r_proto" in
10535         ''|0) try='void endgrent_r(FILE**);'
10536         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10537         esac
10538         case "$endgrent_r_proto" in
10539         ''|0)   d_endgrent_r=undef
10540                 endgrent_r_proto=0
10541                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10542         * )     case "$endgrent_r_proto" in
10543                 REENTRANT_PROTO*) ;;
10544                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10545                 esac
10546                 echo "Prototype: $try" ;;
10547         esac
10548         ;;
10549         *)      case "$usethreads" in
10550                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10551                 esac
10552                 d_endgrent_r=undef
10553                 endgrent_r_proto=0
10554                 ;;
10555         esac
10556         ;;
10557 *)      endgrent_r_proto=0
10558         ;;
10559 esac
10560
10561 : see if endhostent exists
10562 set endhostent d_endhent
10563 eval $inlibc
10564
10565 : see if this is a netdb.h system
10566 set netdb.h i_netdb
10567 eval $inhdr
10568
10569 : see if endhostent_r exists
10570 set endhostent_r d_endhostent_r
10571 eval $inlibc
10572 case "$d_endhostent_r" in
10573 "$define")
10574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10575         case "$d_endhostent_r_proto:$usethreads" in
10576         ":define")      d_endhostent_r_proto=define
10577                 set d_endhostent_r_proto endhostent_r $hdrs
10578                 eval $hasproto ;;
10579         *)      ;;
10580         esac
10581         case "$d_endhostent_r_proto" in
10582         define)
10583         case "$endhostent_r_proto" in
10584         ''|0) try='int endhostent_r(struct hostent_data*);'
10585         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10586         esac
10587         case "$endhostent_r_proto" in
10588         ''|0) try='void endhostent_r(struct hostent_data*);'
10589         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10590         esac
10591         case "$endhostent_r_proto" in
10592         ''|0)   d_endhostent_r=undef
10593                 endhostent_r_proto=0
10594                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10595         * )     case "$endhostent_r_proto" in
10596                 REENTRANT_PROTO*) ;;
10597                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10598                 esac
10599                 echo "Prototype: $try" ;;
10600         esac
10601         ;;
10602         *)      case "$usethreads" in
10603                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10604                 esac
10605                 d_endhostent_r=undef
10606                 endhostent_r_proto=0
10607                 ;;
10608         esac
10609         ;;
10610 *)      endhostent_r_proto=0
10611         ;;
10612 esac
10613
10614 : see if endnetent exists
10615 set endnetent d_endnent
10616 eval $inlibc
10617
10618 : see if endnetent_r exists
10619 set endnetent_r d_endnetent_r
10620 eval $inlibc
10621 case "$d_endnetent_r" in
10622 "$define")
10623         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10624         case "$d_endnetent_r_proto:$usethreads" in
10625         ":define")      d_endnetent_r_proto=define
10626                 set d_endnetent_r_proto endnetent_r $hdrs
10627                 eval $hasproto ;;
10628         *)      ;;
10629         esac
10630         case "$d_endnetent_r_proto" in
10631         define)
10632         case "$endnetent_r_proto" in
10633         ''|0) try='int endnetent_r(struct netent_data*);'
10634         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10635         esac
10636         case "$endnetent_r_proto" in
10637         ''|0) try='void endnetent_r(struct netent_data*);'
10638         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10639         esac
10640         case "$endnetent_r_proto" in
10641         ''|0)   d_endnetent_r=undef
10642                 endnetent_r_proto=0
10643                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10644         * )     case "$endnetent_r_proto" in
10645                 REENTRANT_PROTO*) ;;
10646                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10647                 esac
10648                 echo "Prototype: $try" ;;
10649         esac
10650         ;;
10651         *)      case "$usethreads" in
10652                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10653                 esac
10654                 d_endnetent_r=undef
10655                 endnetent_r_proto=0
10656                 ;;
10657         esac
10658         ;;
10659 *)      endnetent_r_proto=0
10660         ;;
10661 esac
10662
10663 : see if endprotoent exists
10664 set endprotoent d_endpent
10665 eval $inlibc
10666
10667 : see if endprotoent_r exists
10668 set endprotoent_r d_endprotoent_r
10669 eval $inlibc
10670 case "$d_endprotoent_r" in
10671 "$define")
10672         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10673         case "$d_endprotoent_r_proto:$usethreads" in
10674         ":define")      d_endprotoent_r_proto=define
10675                 set d_endprotoent_r_proto endprotoent_r $hdrs
10676                 eval $hasproto ;;
10677         *)      ;;
10678         esac
10679         case "$d_endprotoent_r_proto" in
10680         define)
10681         case "$endprotoent_r_proto" in
10682         ''|0) try='int endprotoent_r(struct protoent_data*);'
10683         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10684         esac
10685         case "$endprotoent_r_proto" in
10686         ''|0) try='void endprotoent_r(struct protoent_data*);'
10687         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10688         esac
10689         case "$endprotoent_r_proto" in
10690         ''|0)   d_endprotoent_r=undef
10691                 endprotoent_r_proto=0
10692                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10693         * )     case "$endprotoent_r_proto" in
10694                 REENTRANT_PROTO*) ;;
10695                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10696                 esac
10697                 echo "Prototype: $try" ;;
10698         esac
10699         ;;
10700         *)      case "$usethreads" in
10701                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10702                 esac
10703                 d_endprotoent_r=undef
10704                 endprotoent_r_proto=0
10705                 ;;
10706         esac
10707         ;;
10708 *)      endprotoent_r_proto=0
10709         ;;
10710 esac
10711
10712 : see if endpwent exists
10713 set endpwent d_endpwent
10714 eval $inlibc
10715
10716 : see if this is a pwd.h system
10717 set pwd.h i_pwd
10718 eval $inhdr
10719
10720 case "$i_pwd" in
10721 $define)
10722         xxx=`./findhdr pwd.h`
10723         $cppstdin $cppflags $cppminus < $xxx >$$.h
10724
10725         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10726                 val="$define"
10727         else
10728                 val="$undef"
10729         fi
10730         set d_pwquota
10731         eval $setvar
10732
10733         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10734                 val="$define"
10735         else
10736                 val="$undef"
10737         fi
10738         set d_pwage
10739         eval $setvar
10740
10741         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10742                 val="$define"
10743         else
10744                 val="$undef"
10745         fi
10746         set d_pwchange
10747         eval $setvar
10748
10749         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10750                 val="$define"
10751         else
10752                 val="$undef"
10753         fi
10754         set d_pwclass
10755         eval $setvar
10756
10757         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10758                 val="$define"
10759         else
10760                 val="$undef"
10761         fi
10762         set d_pwexpire
10763         eval $setvar
10764
10765         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10766                 val="$define"
10767         else
10768                 val="$undef"
10769         fi
10770         set d_pwcomment
10771         eval $setvar
10772
10773         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10774                 val="$define"
10775         else
10776                 val="$undef"
10777         fi
10778         set d_pwgecos
10779         eval $setvar
10780
10781         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10782                 val="$define"
10783         else
10784                 val="$undef"
10785         fi
10786         set d_pwpasswd
10787         eval $setvar
10788
10789         $rm -f $$.h
10790         ;;
10791 *)
10792         val="$undef"; 
10793         set d_pwquota; eval $setvar
10794         set d_pwage; eval $setvar
10795         set d_pwchange; eval $setvar
10796         set d_pwclass; eval $setvar
10797         set d_pwexpire; eval $setvar
10798         set d_pwcomment; eval $setvar
10799         set d_pwgecos; eval $setvar
10800         set d_pwpasswd; eval $setvar
10801         ;;
10802 esac
10803
10804 : see if endpwent_r exists
10805 set endpwent_r d_endpwent_r
10806 eval $inlibc
10807 case "$d_endpwent_r" in
10808 "$define")
10809         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10810         case "$d_endpwent_r_proto:$usethreads" in
10811         ":define")      d_endpwent_r_proto=define
10812                 set d_endpwent_r_proto endpwent_r $hdrs
10813                 eval $hasproto ;;
10814         *)      ;;
10815         esac
10816         case "$d_endpwent_r_proto" in
10817         define)
10818         case "$endpwent_r_proto" in
10819         ''|0) try='int endpwent_r(FILE**);'
10820         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10821         esac
10822         case "$endpwent_r_proto" in
10823         ''|0) try='void endpwent_r(FILE**);'
10824         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10825         esac
10826         case "$endpwent_r_proto" in
10827         ''|0)   d_endpwent_r=undef
10828                 endpwent_r_proto=0
10829                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10830         * )     case "$endpwent_r_proto" in
10831                 REENTRANT_PROTO*) ;;
10832                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10833                 esac
10834                 echo "Prototype: $try" ;;
10835         esac
10836         ;;
10837         *)      case "$usethreads" in
10838                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10839                 esac
10840                 d_endpwent_r=undef
10841                 endpwent_r_proto=0
10842                 ;;
10843         esac
10844         ;;
10845 *)      endpwent_r_proto=0
10846         ;;
10847 esac
10848
10849 : see if endservent exists
10850 set endservent d_endsent
10851 eval $inlibc
10852
10853 : see if endservent_r exists
10854 set endservent_r d_endservent_r
10855 eval $inlibc
10856 case "$d_endservent_r" in
10857 "$define")
10858         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10859         case "$d_endservent_r_proto:$usethreads" in
10860         ":define")      d_endservent_r_proto=define
10861                 set d_endservent_r_proto endservent_r $hdrs
10862                 eval $hasproto ;;
10863         *)      ;;
10864         esac
10865         case "$d_endservent_r_proto" in
10866         define)
10867         case "$endservent_r_proto" in
10868         ''|0) try='int endservent_r(struct servent_data*);'
10869         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10870         esac
10871         case "$endservent_r_proto" in
10872         ''|0) try='void endservent_r(struct servent_data*);'
10873         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10874         esac
10875         case "$endservent_r_proto" in
10876         ''|0)   d_endservent_r=undef
10877                 endservent_r_proto=0
10878                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10879         * )     case "$endservent_r_proto" in
10880                 REENTRANT_PROTO*) ;;
10881                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10882                 esac
10883                 echo "Prototype: $try" ;;
10884         esac
10885         ;;
10886         *)      case "$usethreads" in
10887                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10888                 esac
10889                 d_endservent_r=undef
10890                 endservent_r_proto=0
10891                 ;;
10892         esac
10893         ;;
10894 *)      endservent_r_proto=0
10895         ;;
10896 esac
10897
10898 : Locate the flags for 'open()'
10899 echo " "
10900 $cat >try.c <<'EOCP'
10901 #include <sys/types.h>
10902 #ifdef I_FCNTL
10903 #include <fcntl.h>
10904 #endif
10905 #ifdef I_SYS_FILE
10906 #include <sys/file.h>
10907 #endif
10908 int main() {
10909         if(O_RDONLY);
10910 #ifdef O_TRUNC
10911         exit(0);
10912 #else
10913         exit(1);
10914 #endif
10915 }
10916 EOCP
10917 : check sys/file.h first to get FREAD on Sun
10918 if $test `./findhdr sys/file.h` && \
10919                 set try -DI_SYS_FILE && eval $compile; then
10920         h_sysfile=true;
10921         echo "<sys/file.h> defines the O_* constants..." >&4
10922         if $run ./try; then
10923                 echo "and you have the 3 argument form of open()." >&4
10924                 val="$define"
10925         else
10926                 echo "but not the 3 argument form of open().  Oh, well." >&4
10927                 val="$undef"
10928         fi
10929 elif $test `./findhdr fcntl.h` && \
10930                 set try -DI_FCNTL && eval $compile; then
10931         h_fcntl=true;
10932         echo "<fcntl.h> defines the O_* constants..." >&4
10933         if $run ./try; then
10934                 echo "and you have the 3 argument form of open()." >&4
10935                 val="$define"
10936         else
10937                 echo "but not the 3 argument form of open().  Oh, well." >&4
10938                 val="$undef"
10939         fi
10940 else
10941         val="$undef"
10942         echo "I can't find the O_* constant definitions!  You got problems." >&4
10943 fi
10944 set d_open3
10945 eval $setvar
10946 $rm -f try try.*
10947
10948 : see which of string.h or strings.h is needed
10949 echo " "
10950 strings=`./findhdr string.h`
10951 if $test "$strings" && $test -r "$strings"; then
10952         echo "Using <string.h> instead of <strings.h>." >&4
10953         val="$define"
10954 else
10955         val="$undef"
10956         strings=`./findhdr strings.h`
10957         if $test "$strings" && $test -r "$strings"; then
10958                 echo "Using <strings.h> instead of <string.h>." >&4
10959         else
10960                 echo "No string header found -- You'll surely have problems." >&4
10961         fi
10962 fi
10963 set i_string
10964 eval $setvar
10965 case "$i_string" in
10966 "$undef") strings=`./findhdr strings.h`;;
10967 *)        strings=`./findhdr string.h`;;
10968 esac
10969
10970 : see if this is a sys/file.h system
10971 val=''
10972 set sys/file.h val
10973 eval $inhdr
10974
10975 : do we need to include sys/file.h ?
10976 case "$val" in
10977 "$define")
10978         echo " "
10979         if $h_sysfile; then
10980                 val="$define"
10981                 echo "We'll be including <sys/file.h>." >&4
10982         else
10983                 val="$undef"
10984                 echo "We won't be including <sys/file.h>." >&4
10985         fi
10986         ;;
10987 *)
10988         h_sysfile=false
10989         ;;
10990 esac
10991 set i_sysfile
10992 eval $setvar
10993
10994 : see if fcntl.h is there
10995 val=''
10996 set fcntl.h val
10997 eval $inhdr
10998
10999 : see if we can include fcntl.h
11000 case "$val" in
11001 "$define")
11002         echo " "
11003         if $h_fcntl; then
11004                 val="$define"
11005                 echo "We'll be including <fcntl.h>." >&4
11006         else
11007                 val="$undef"
11008                 if $h_sysfile; then
11009         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11010                 else
11011                         echo "We won't be including <fcntl.h>." >&4
11012                 fi
11013         fi
11014         ;;
11015 *)
11016         h_fcntl=false
11017         val="$undef"
11018         ;;
11019 esac
11020 set i_fcntl
11021 eval $setvar
11022
11023 : check for non-blocking I/O stuff
11024 case "$h_sysfile" in
11025 true) echo "#include <sys/file.h>" > head.c;;
11026 *)
11027        case "$h_fcntl" in
11028        true) echo "#include <fcntl.h>" > head.c;;
11029        *) echo "#include <sys/fcntl.h>" > head.c;;
11030        esac
11031        ;;
11032 esac
11033 echo " "
11034 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11035 case "$o_nonblock" in
11036 '')
11037         $cat head.c > try.c
11038         $cat >>try.c <<EOCP
11039 #include <stdio.h>
11040 #include <stdlib.h>
11041 #$i_fcntl I_FCNTL
11042 #ifdef I_FCNTL
11043 #include <fcntl.h>
11044 #endif
11045 int main() {
11046 #ifdef O_NONBLOCK
11047         printf("O_NONBLOCK\n");
11048         exit(0);
11049 #endif
11050 #ifdef O_NDELAY
11051         printf("O_NDELAY\n");
11052         exit(0);
11053 #endif
11054 #ifdef FNDELAY
11055         printf("FNDELAY\n");
11056         exit(0);
11057 #endif
11058         exit(0);
11059 }
11060 EOCP
11061         set try
11062         if eval $compile_ok; then
11063                 o_nonblock=`$run ./try`
11064                 case "$o_nonblock" in
11065                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11066                 *) echo "Seems like we can use $o_nonblock.";;
11067                 esac
11068         else
11069                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11070         fi
11071         ;;
11072 *) echo "Using $hint value $o_nonblock.";;
11073 esac
11074 $rm -f try try.* .out core
11075
11076 echo " "
11077 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11078 case "$eagain" in
11079 '')
11080         $cat head.c > try.c
11081         $cat >>try.c <<EOCP
11082 #include <errno.h>
11083 #include <sys/types.h>
11084 #include <signal.h>
11085 #include <stdio.h> 
11086 #include <stdlib.h> 
11087 #$i_fcntl I_FCNTL
11088 #ifdef I_FCNTL
11089 #include <fcntl.h>
11090 #endif
11091 #define MY_O_NONBLOCK $o_nonblock
11092 #ifndef errno  /* XXX need better Configure test */
11093 extern int errno;
11094 #endif
11095 #$i_unistd I_UNISTD
11096 #ifdef I_UNISTD
11097 #include <unistd.h>
11098 #endif
11099 #$i_string I_STRING
11100 #ifdef I_STRING
11101 #include <string.h>
11102 #else
11103 #include <strings.h>
11104 #endif
11105 $signal_t blech(x) int x; { exit(3); }
11106 EOCP
11107         $cat >> try.c <<'EOCP'
11108 int main()
11109 {
11110         int pd[2];
11111         int pu[2];
11112         char buf[1];
11113         char string[100];
11114
11115         pipe(pd);       /* Down: child -> parent */
11116         pipe(pu);       /* Up: parent -> child */
11117         if (0 != fork()) {
11118                 int ret;
11119                 close(pd[1]);   /* Parent reads from pd[0] */
11120                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11121 #ifdef F_SETFL
11122                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11123                         exit(1);
11124 #else
11125                 exit(4);
11126 #endif
11127                 signal(SIGALRM, blech);
11128                 alarm(5);
11129                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11130                         exit(2);
11131                 sprintf(string, "%d\n", ret);
11132                 write(2, string, strlen(string));
11133                 alarm(0);
11134 #ifdef EAGAIN
11135                 if (errno == EAGAIN) {
11136                         printf("EAGAIN\n");
11137                         goto ok;
11138                 }
11139 #endif
11140 #ifdef EWOULDBLOCK
11141                 if (errno == EWOULDBLOCK)
11142                         printf("EWOULDBLOCK\n");
11143 #endif
11144         ok:
11145                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11146                 sleep(2);                               /* Give it time to close our pipe */
11147                 alarm(5);
11148                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11149                 alarm(0);
11150                 sprintf(string, "%d\n", ret);
11151                 write(4, string, strlen(string));
11152                 exit(0);
11153         }
11154
11155         close(pd[0]);                   /* We write to pd[1] */
11156         close(pu[1]);                   /* We read from pu[0] */
11157         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11158         close(pd[1]);                   /* Pipe pd is now fully closed! */
11159         exit(0);                                /* Bye bye, thank you for playing! */
11160 }
11161 EOCP
11162         set try
11163         if eval $compile_ok; then
11164                 echo "$startsh" >mtry
11165                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11166                 chmod +x mtry
11167                 ./mtry >/dev/null 2>&1
11168                 case $? in
11169                 0) eagain=`$cat try.out`;;
11170                 1) echo "Could not perform non-blocking setting!";;
11171                 2) echo "I did a successful read() for something that was not there!";;
11172                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11173                 4) echo "Could not find F_SETFL!";;
11174                 *) echo "Something terribly wrong happened during testing.";;
11175                 esac
11176                 rd_nodata=`$cat try.ret`
11177                 echo "A read() system call with no data present returns $rd_nodata."
11178                 case "$rd_nodata" in
11179                 0|-1) ;;
11180                 *)
11181                         echo "(That's peculiar, fixing that to be -1.)"
11182                         rd_nodata=-1
11183                         ;;
11184                 esac
11185                 case "$eagain" in
11186                 '')
11187                         echo "Forcing errno EAGAIN on read() with no data available."
11188                         eagain=EAGAIN
11189                         ;;
11190                 *)
11191                         echo "Your read() sets errno to $eagain when no data is available."
11192                         ;;
11193                 esac
11194                 status=`$cat try.err`
11195                 case "$status" in
11196                 0) echo "And it correctly returns 0 to signal EOF.";;
11197                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11198                 *) echo "However, your read() returns '$status' on EOF??";;
11199                 esac
11200                 val="$define"
11201                 if test "$status" = "$rd_nodata"; then
11202                         echo "WARNING: you can't distinguish between EOF and no data!"
11203                         val="$undef"
11204                 fi
11205         else
11206                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11207                 eagain=EAGAIN
11208         fi
11209         set d_eofnblk
11210         eval $setvar
11211         ;;
11212 *)
11213         echo "Using $hint value $eagain."
11214         echo "Your read() returns $rd_nodata when no data is present."
11215         case "$d_eofnblk" in
11216         "$define") echo "And you can see EOF because read() returns 0.";;
11217         "$undef") echo "But you can't see EOF status from read() returned value.";;
11218         *)
11219                 echo "(Assuming you can't see EOF status from read anyway.)"
11220                 d_eofnblk=$undef
11221                 ;;
11222         esac
11223         ;;
11224 esac
11225 $rm -f try try.* .out core head.c mtry
11226
11227 : see if fchdir exists
11228 set fchdir d_fchdir
11229 eval $inlibc
11230
11231 : see if fchmod exists
11232 set fchmod d_fchmod
11233 eval $inlibc
11234
11235 : see if fchown exists
11236 set fchown d_fchown
11237 eval $inlibc
11238
11239 : see if this is an fcntl system
11240 set fcntl d_fcntl
11241 eval $inlibc
11242
11243 echo " "
11244 : See if fcntl-based locking works.
11245 $cat >try.c <<EOCP
11246 #include <stdlib.h>
11247 #include <unistd.h>
11248 #include <fcntl.h>
11249 #include <signal.h>
11250 $signal_t blech(x) int x; { exit(3); }
11251 int main() {
11252 #if defined(F_SETLK) && defined(F_SETLKW)
11253      struct flock flock;
11254      int retval, fd;
11255      fd = open("try.c", O_RDONLY);
11256      flock.l_type = F_RDLCK;
11257      flock.l_whence = SEEK_SET;
11258      flock.l_start = flock.l_len = 0;
11259      signal(SIGALRM, blech);
11260      alarm(10);
11261      retval = fcntl(fd, F_SETLK, &flock);
11262      close(fd);
11263      (retval < 0 ? exit(2) : exit(0));
11264 #else
11265      exit(2);
11266 #endif
11267 }
11268 EOCP
11269 echo "Checking if fcntl-based file locking works... "
11270 case "$d_fcntl" in
11271 "$define")
11272         set try
11273         if eval $compile_ok; then
11274                 if $run ./try; then
11275                         echo "Yes, it seems to work."
11276                         val="$define"
11277                 else
11278                         echo "Nope, it didn't work."
11279                         val="$undef"
11280                         case "$?" in
11281                         3) $cat >&4 <<EOM
11282 ***
11283 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11284 *** This is (almost) impossible.
11285 *** If your NFS lock daemons are not feeling well, something like
11286 *** this may happen, please investigate.  Cannot continue, aborting.
11287 ***
11288 EOM
11289                                 exit 1
11290                                 ;;
11291                         esac
11292                 fi
11293         else
11294                 echo "I'm unable to compile the test program, so I'll assume not."
11295                 val="$undef"
11296         fi
11297         ;;
11298 *) val="$undef";
11299         echo "Nope, since you don't even have fcntl()."
11300         ;;
11301 esac
11302 set d_fcntl_can_lock
11303 eval $setvar
11304 $rm -f try*
11305
11306
11307 : check for fd_set items
11308 $cat <<EOM
11309
11310 Checking to see how well your C compiler handles fd_set and friends ...
11311 EOM
11312 $cat >try.c <<EOCP
11313 #$i_systime I_SYS_TIME
11314 #$i_sysselct I_SYS_SELECT
11315 #$d_socket HAS_SOCKET
11316 #include <sys/types.h>
11317 #ifdef HAS_SOCKET
11318 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11319 #endif
11320 #ifdef I_SYS_TIME
11321 #include <sys/time.h>
11322 #endif
11323 #ifdef I_SYS_SELECT
11324 #include <sys/select.h>
11325 #endif
11326 int main() {
11327         fd_set fds;
11328
11329 #ifdef TRYBITS
11330         if(fds.fds_bits);
11331 #endif
11332
11333 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11334         exit(0);
11335 #else
11336         exit(1);
11337 #endif
11338 }
11339 EOCP
11340 set try -DTRYBITS
11341 if eval $compile; then
11342         d_fds_bits="$define"
11343         d_fd_set="$define"
11344         echo "Well, your system knows about the normal fd_set typedef..." >&4
11345         if $run ./try; then
11346                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11347                 d_fd_macros="$define"
11348         else
11349                 $cat >&4 <<'EOM'
11350 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11351 EOM
11352                 d_fd_macros="$undef"
11353         fi
11354 else
11355         $cat <<'EOM'
11356 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11357 EOM
11358         set try
11359         if eval $compile; then
11360                 d_fds_bits="$undef"
11361                 d_fd_set="$define"
11362                 echo "Well, your system has some sort of fd_set available..." >&4
11363                 if $run ./try; then
11364                         echo "and you have the normal fd_set macros." >&4
11365                         d_fd_macros="$define"
11366                 else
11367                         $cat <<'EOM'
11368 but not the normal fd_set macros!  Gross!  More work for me...
11369 EOM
11370                         d_fd_macros="$undef"
11371                 fi
11372         else
11373         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11374                 d_fd_set="$undef"
11375                 d_fds_bits="$undef"
11376                 d_fd_macros="$undef"
11377         fi
11378 fi
11379 $rm -f try try.*
11380
11381 : see if fgetpos exists
11382 set fgetpos d_fgetpos
11383 eval $inlibc
11384
11385 : see if finite exists
11386 set finite d_finite
11387 eval $inlibc
11388
11389 : see if finitel exists
11390 set finitel d_finitel
11391 eval $inlibc
11392
11393 : see if flock exists
11394 set flock d_flock
11395 eval $inlibc
11396
11397 : see if prototype for flock is available
11398 echo " "
11399 set d_flockproto flock $i_sysfile sys/file.h
11400 eval $hasproto
11401
11402 : see if fork exists
11403 set fork d_fork
11404 eval $inlibc
11405
11406 : see if fp_class exists
11407 set fp_class d_fp_class
11408 eval $inlibc
11409
11410 : see if pathconf exists
11411 set pathconf d_pathconf
11412 eval $inlibc
11413
11414 : see if fpathconf exists
11415 set fpathconf d_fpathconf
11416 eval $inlibc
11417
11418 : see if fpclass exists
11419 set fpclass d_fpclass
11420 eval $inlibc
11421
11422 : see if fpclassify exists
11423 set fpclassify d_fpclassify
11424 eval $inlibc
11425
11426 : see if fpclassl exists
11427 set fpclassl d_fpclassl
11428 eval $inlibc
11429
11430
11431 : check for fpos64_t
11432 echo " "
11433 echo "Checking to see if you have fpos64_t..." >&4
11434 $cat >try.c <<EOCP
11435 #include <stdio.h>
11436 int main() { fpos64_t x = 7; }
11437 EOCP
11438 set try
11439 if eval $compile; then
11440         val="$define"
11441         echo "You have fpos64_t."
11442 else
11443         val="$undef"
11444         echo "You do not have fpos64_t."
11445         case "$fpossize" in
11446         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11447         esac
11448 fi
11449 $rm -f try.* try
11450 set d_fpos64_t
11451 eval $setvar
11452
11453 : see if frexpl exists
11454 set frexpl d_frexpl
11455 eval $inlibc
11456
11457 : see if this is a sys/param system
11458 set sys/param.h i_sysparam
11459 eval $inhdr
11460
11461 : see if this is a sys/mount.h system
11462 set sys/mount.h i_sysmount
11463 eval $inhdr
11464
11465
11466 echo " "
11467 echo "Checking to see if your system supports struct fs_data..." >&4
11468 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11469 eval $hasstruct
11470 case "$d_fs_data_s" in
11471 "$define")      echo "Yes, it does."   ;;
11472 *)              echo "No, it doesn't." ;;
11473 esac
11474
11475 : see if fseeko exists
11476 set fseeko d_fseeko
11477 eval $inlibc
11478 case "$longsize" in
11479 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11480 esac
11481
11482 : see if fsetpos exists
11483 set fsetpos d_fsetpos
11484 eval $inlibc
11485
11486
11487 : see if fstatfs exists
11488 set fstatfs d_fstatfs
11489 eval $inlibc
11490
11491
11492 : see if statvfs exists
11493 set statvfs d_statvfs
11494 eval $inlibc
11495
11496 : see if fstatvfs exists
11497 set fstatvfs d_fstatvfs
11498 eval $inlibc
11499
11500
11501 : see if fsync exists
11502 set fsync d_fsync
11503 eval $inlibc
11504
11505 : see if ftello exists
11506 set ftello d_ftello
11507 eval $inlibc
11508 case "$longsize" in
11509 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11510 esac
11511
11512 : see if getcwd exists
11513 set getcwd d_getcwd
11514 eval $inlibc
11515
11516 : see if getespwnam exists
11517 set getespwnam d_getespwnam
11518 eval $inlibc
11519
11520
11521 : see if getfsstat exists
11522 set getfsstat d_getfsstat
11523 eval $inlibc
11524
11525 : see if getgrent exists
11526 set getgrent d_getgrent
11527 eval $inlibc
11528
11529 : see if getgrent_r exists
11530 set getgrent_r d_getgrent_r
11531 eval $inlibc
11532 case "$d_getgrent_r" in
11533 "$define")
11534         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11535         case "$d_getgrent_r_proto:$usethreads" in
11536         ":define")      d_getgrent_r_proto=define
11537                 set d_getgrent_r_proto getgrent_r $hdrs
11538                 eval $hasproto ;;
11539         *)      ;;
11540         esac
11541         case "$d_getgrent_r_proto" in
11542         define)
11543         case "$getgrent_r_proto" in
11544         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11545         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11546         esac
11547         case "$getgrent_r_proto" in
11548         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11549         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11550         esac
11551         case "$getgrent_r_proto" in
11552         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11553         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11554         esac
11555         case "$getgrent_r_proto" in
11556         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11557         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11558         esac
11559         case "$getgrent_r_proto" in
11560         ''|0) try='int getgrent_r(struct group*, char*, int);'
11561         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11562         esac
11563         case "$getgrent_r_proto" in
11564         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11565         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11566         esac
11567         case "$getgrent_r_proto" in
11568         ''|0)   d_getgrent_r=undef
11569                 getgrent_r_proto=0
11570                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11571         * )     case "$getgrent_r_proto" in
11572                 REENTRANT_PROTO*) ;;
11573                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11574                 esac
11575                 echo "Prototype: $try" ;;
11576         esac
11577         ;;
11578         *)      case "$usethreads" in
11579                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11580                 esac
11581                 d_getgrent_r=undef
11582                 getgrent_r_proto=0
11583                 ;;
11584         esac
11585         ;;
11586 *)      getgrent_r_proto=0
11587         ;;
11588 esac
11589
11590 : see if getgrgid_r exists
11591 set getgrgid_r d_getgrgid_r
11592 eval $inlibc
11593 case "$d_getgrgid_r" in
11594 "$define")
11595         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11596         case "$d_getgrgid_r_proto:$usethreads" in
11597         ":define")      d_getgrgid_r_proto=define
11598                 set d_getgrgid_r_proto getgrgid_r $hdrs
11599                 eval $hasproto ;;
11600         *)      ;;
11601         esac
11602         case "$d_getgrgid_r_proto" in
11603         define)
11604         case "$getgrgid_r_proto" in
11605         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11606         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11607         esac
11608         case "$getgrgid_r_proto" in
11609         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11610         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11611         esac
11612         case "$getgrgid_r_proto" in
11613         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11614         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11615         esac
11616         case "$getgrgid_r_proto" in
11617         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11618         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11619         esac
11620         case "$getgrgid_r_proto" in
11621         ''|0)   d_getgrgid_r=undef
11622                 getgrgid_r_proto=0
11623                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11624         * )     case "$getgrgid_r_proto" in
11625                 REENTRANT_PROTO*) ;;
11626                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11627                 esac
11628                 echo "Prototype: $try" ;;
11629         esac
11630         ;;
11631         *)      case "$usethreads" in
11632                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11633                 esac
11634                 d_getgrgid_r=undef
11635                 getgrgid_r_proto=0
11636                 ;;
11637         esac
11638         ;;
11639 *)      getgrgid_r_proto=0
11640         ;;
11641 esac
11642
11643 : see if getgrnam_r exists
11644 set getgrnam_r d_getgrnam_r
11645 eval $inlibc
11646 case "$d_getgrnam_r" in
11647 "$define")
11648         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11649         case "$d_getgrnam_r_proto:$usethreads" in
11650         ":define")      d_getgrnam_r_proto=define
11651                 set d_getgrnam_r_proto getgrnam_r $hdrs
11652                 eval $hasproto ;;
11653         *)      ;;
11654         esac
11655         case "$d_getgrnam_r_proto" in
11656         define)
11657         case "$getgrnam_r_proto" in
11658         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11659         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11660         esac
11661         case "$getgrnam_r_proto" in
11662         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11663         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11664         esac
11665         case "$getgrnam_r_proto" in
11666         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11667         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11668         esac
11669         case "$getgrnam_r_proto" in
11670         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11671         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11672         esac
11673         case "$getgrnam_r_proto" in
11674         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11675         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11676         esac
11677         case "$getgrnam_r_proto" in
11678         ''|0)   d_getgrnam_r=undef
11679                 getgrnam_r_proto=0
11680                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11681         * )     case "$getgrnam_r_proto" in
11682                 REENTRANT_PROTO*) ;;
11683                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11684                 esac
11685                 echo "Prototype: $try" ;;
11686         esac
11687         ;;
11688         *)      case "$usethreads" in
11689                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11690                 esac
11691                 d_getgrnam_r=undef
11692                 getgrnam_r_proto=0
11693                 ;;
11694         esac
11695         ;;
11696 *)      getgrnam_r_proto=0
11697         ;;
11698 esac
11699
11700 : see if gethostbyaddr exists
11701 set gethostbyaddr d_gethbyaddr
11702 eval $inlibc
11703
11704 : see if gethostbyname exists
11705 set gethostbyname d_gethbyname
11706 eval $inlibc
11707
11708 : see if gethostent exists
11709 set gethostent d_gethent
11710 eval $inlibc
11711
11712 : see how we will look up host name
11713 echo " "
11714 call=''
11715 if set gethostname val -f d_gethname; eval $csym; $val; then
11716         echo 'gethostname() found.' >&4
11717         d_gethname="$define"
11718         call=gethostname
11719 fi
11720 if set uname val -f d_uname; eval $csym; $val; then
11721         if ./xenix; then
11722                 $cat <<'EOM'
11723 uname() was found, but you're running xenix, and older versions of xenix
11724 have a broken uname(). If you don't really know whether your xenix is old
11725 enough to have a broken system call, use the default answer.
11726
11727 EOM
11728                 dflt=y
11729                 case "$d_uname" in
11730                 "$define") dflt=n;;
11731                 esac
11732                 rp='Is your uname() broken?'
11733                 . ./myread
11734                 case "$ans" in
11735                 n*) d_uname="$define"; call=uname;;
11736                 esac
11737         else
11738                 echo 'uname() found.' >&4
11739                 d_uname="$define"
11740                 case "$call" in
11741                 '') call=uname ;;
11742                 esac
11743         fi
11744 fi
11745 case "$d_gethname" in
11746 '') d_gethname="$undef";;
11747 esac
11748 case "$d_uname" in
11749 '') d_uname="$undef";;
11750 esac
11751 case "$d_uname$d_gethname" in
11752 *define*)
11753         dflt=n
11754         cat <<EOM
11755  
11756 Every now and then someone has a $call() that lies about the hostname
11757 but can't be fixed for political or economic reasons.  If you wish, I can
11758 pretend $call() isn't there and maybe compute hostname at run-time
11759 thanks to the '$phostname' command.
11760
11761 EOM
11762         rp="Shall I ignore $call() from now on?"
11763         . ./myread
11764         case "$ans" in
11765         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11766         esac;;
11767 esac
11768 case "$phostname" in
11769 '') aphostname='';;
11770 *) case "$aphostname" in
11771         /*) ;;
11772         *) set X $phostname
11773                 shift
11774                 file=$1
11775                 shift
11776                 file=`./loc $file $file $pth`
11777                 aphostname=`echo $file $*`
11778                 ;;
11779         esac
11780         ;;
11781 esac
11782 case "$d_uname$d_gethname" in
11783 *define*) ;;
11784 *)
11785         case "$phostname" in
11786         '')
11787                 echo "There will be no way for $package to get your hostname." >&4;;
11788         *)
11789         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11790                 ;;
11791         esac;;
11792 esac
11793 case "$d_phostname" in
11794 '') d_phostname="$undef";;
11795 esac
11796
11797 : see if gethostbyaddr_r exists
11798 set gethostbyaddr_r d_gethostbyaddr_r
11799 eval $inlibc
11800 case "$d_gethostbyaddr_r" in
11801 "$define")
11802         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11803         case "$d_gethostbyaddr_r_proto:$usethreads" in
11804         ":define")      d_gethostbyaddr_r_proto=define
11805                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11806                 eval $hasproto ;;
11807         *)      ;;
11808         esac
11809         case "$d_gethostbyaddr_r_proto" in
11810         define)
11811         case "$gethostbyaddr_r_proto" in
11812         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11813         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11814         esac
11815         case "$gethostbyaddr_r_proto" in
11816         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11817         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11818         esac
11819         case "$gethostbyaddr_r_proto" in
11820         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11821         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11822         esac
11823         case "$gethostbyaddr_r_proto" in
11824         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11825         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11826         esac
11827         case "$gethostbyaddr_r_proto" in
11828         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11829         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11830         esac
11831         case "$gethostbyaddr_r_proto" in
11832         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11833         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11834         esac
11835         case "$gethostbyaddr_r_proto" in
11836         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11837         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11838         esac
11839         case "$gethostbyaddr_r_proto" in
11840         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11841         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11842         esac
11843         case "$gethostbyaddr_r_proto" in
11844         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11845         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11846         esac
11847         case "$gethostbyaddr_r_proto" in
11848         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11849         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11850         esac
11851         case "$gethostbyaddr_r_proto" in
11852         ''|0)   d_gethostbyaddr_r=undef
11853                 gethostbyaddr_r_proto=0
11854                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11855         * )     case "$gethostbyaddr_r_proto" in
11856                 REENTRANT_PROTO*) ;;
11857                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11858                 esac
11859                 echo "Prototype: $try" ;;
11860         esac
11861         ;;
11862         *)      case "$usethreads" in
11863                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11864                 esac
11865                 d_gethostbyaddr_r=undef
11866                 gethostbyaddr_r_proto=0
11867                 ;;
11868         esac
11869         ;;
11870 *)      gethostbyaddr_r_proto=0
11871         ;;
11872 esac
11873
11874 : see if gethostbyname_r exists
11875 set gethostbyname_r d_gethostbyname_r
11876 eval $inlibc
11877 case "$d_gethostbyname_r" in
11878 "$define")
11879         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11880         case "$d_gethostbyname_r_proto:$usethreads" in
11881         ":define")      d_gethostbyname_r_proto=define
11882                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11883                 eval $hasproto ;;
11884         *)      ;;
11885         esac
11886         case "$d_gethostbyname_r_proto" in
11887         define)
11888         case "$gethostbyname_r_proto" in
11889         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11890         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11891         esac
11892         case "$gethostbyname_r_proto" in
11893         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11894         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11895         esac
11896         case "$gethostbyname_r_proto" in
11897         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11898         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11899         esac
11900         case "$gethostbyname_r_proto" in
11901         ''|0)   d_gethostbyname_r=undef
11902                 gethostbyname_r_proto=0
11903                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11904         * )     case "$gethostbyname_r_proto" in
11905                 REENTRANT_PROTO*) ;;
11906                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11907                 esac
11908                 echo "Prototype: $try" ;;
11909         esac
11910         ;;
11911         *)      case "$usethreads" in
11912                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11913                 esac
11914                 d_gethostbyname_r=undef
11915                 gethostbyname_r_proto=0
11916                 ;;
11917         esac
11918         ;;
11919 *)      gethostbyname_r_proto=0
11920         ;;
11921 esac
11922
11923 : see if gethostent_r exists
11924 set gethostent_r d_gethostent_r
11925 eval $inlibc
11926 case "$d_gethostent_r" in
11927 "$define")
11928         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11929         case "$d_gethostent_r_proto:$usethreads" in
11930         ":define")      d_gethostent_r_proto=define
11931                 set d_gethostent_r_proto gethostent_r $hdrs
11932                 eval $hasproto ;;
11933         *)      ;;
11934         esac
11935         case "$d_gethostent_r_proto" in
11936         define)
11937         case "$gethostent_r_proto" in
11938         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11939         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11940         esac
11941         case "$gethostent_r_proto" in
11942         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11943         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11944         esac
11945         case "$gethostent_r_proto" in
11946         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11947         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11948         esac
11949         case "$gethostent_r_proto" in
11950         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11951         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11952         esac
11953         case "$gethostent_r_proto" in
11954         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11955         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11956         esac
11957         case "$gethostent_r_proto" in
11958         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11959         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11960         esac
11961         case "$gethostent_r_proto" in
11962         ''|0)   d_gethostent_r=undef
11963                 gethostent_r_proto=0
11964                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11965         * )     case "$gethostent_r_proto" in
11966                 REENTRANT_PROTO*) ;;
11967                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11968                 esac
11969                 echo "Prototype: $try" ;;
11970         esac
11971         ;;
11972         *)      case "$usethreads" in
11973                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11974                 esac
11975                 d_gethostent_r=undef
11976                 gethostent_r_proto=0
11977                 ;;
11978         esac
11979         ;;
11980 *)      gethostent_r_proto=0
11981         ;;
11982 esac
11983
11984 : see if prototypes for various gethostxxx netdb.h functions are available
11985 echo " "
11986 set d_gethostprotos gethostent $i_netdb netdb.h
11987 eval $hasproto
11988
11989 : see if getitimer exists
11990 set getitimer d_getitimer
11991 eval $inlibc
11992
11993 : see if getlogin exists
11994 set getlogin d_getlogin
11995 eval $inlibc
11996
11997 : see if getlogin_r exists
11998 set getlogin_r d_getlogin_r
11999 eval $inlibc
12000 case "$d_getlogin_r" in
12001 "$define")
12002         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12003         case "$d_getlogin_r_proto:$usethreads" in
12004         ":define")      d_getlogin_r_proto=define
12005                 set d_getlogin_r_proto getlogin_r $hdrs
12006                 eval $hasproto ;;
12007         *)      ;;
12008         esac
12009         case "$d_getlogin_r_proto" in
12010         define)
12011         case "$getlogin_r_proto" in
12012         ''|0) try='int getlogin_r(char*, size_t);'
12013         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12014         esac
12015         case "$getlogin_r_proto" in
12016         ''|0) try='int getlogin_r(char*, int);'
12017         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12018         esac
12019         case "$getlogin_r_proto" in
12020         ''|0) try='char* getlogin_r(char*, size_t);'
12021         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12022         esac
12023         case "$getlogin_r_proto" in
12024         ''|0) try='char* getlogin_r(char*, int);'
12025         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12026         esac
12027         case "$getlogin_r_proto" in
12028         ''|0)   d_getlogin_r=undef
12029                 getlogin_r_proto=0
12030                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12031         * )     case "$getlogin_r_proto" in
12032                 REENTRANT_PROTO*) ;;
12033                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12034                 esac
12035                 echo "Prototype: $try" ;;
12036         esac
12037         ;;
12038         *)      case "$usethreads" in
12039                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12040                 esac
12041                 d_getlogin_r=undef
12042                 getlogin_r_proto=0
12043                 ;;
12044         esac
12045         ;;
12046 *)      getlogin_r_proto=0
12047         ;;
12048 esac
12049
12050 : see if getmnt exists
12051 set getmnt d_getmnt
12052 eval $inlibc
12053
12054 : see if getmntent exists
12055 set getmntent d_getmntent
12056 eval $inlibc
12057
12058 : see if getnetbyaddr exists
12059 set getnetbyaddr d_getnbyaddr
12060 eval $inlibc
12061
12062 : see if getnetbyname exists
12063 set getnetbyname d_getnbyname
12064 eval $inlibc
12065
12066 : see if getnetent exists
12067 set getnetent d_getnent
12068 eval $inlibc
12069
12070 : see if getnetbyaddr_r exists
12071 set getnetbyaddr_r d_getnetbyaddr_r
12072 eval $inlibc
12073 case "$d_getnetbyaddr_r" in
12074 "$define")
12075         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12076         case "$d_getnetbyaddr_r_proto:$usethreads" in
12077         ":define")      d_getnetbyaddr_r_proto=define
12078                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12079                 eval $hasproto ;;
12080         *)      ;;
12081         esac
12082         case "$d_getnetbyaddr_r_proto" in
12083         define)
12084         case "$getnetbyaddr_r_proto" in
12085         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12086         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12087         esac
12088         case "$getnetbyaddr_r_proto" in
12089         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12090         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12091         esac
12092         case "$getnetbyaddr_r_proto" in
12093         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12094         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12095         esac
12096         case "$getnetbyaddr_r_proto" in
12097         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12098         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12099         esac
12100         case "$getnetbyaddr_r_proto" in
12101         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12102         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12103         esac
12104         case "$getnetbyaddr_r_proto" in
12105         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12106         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12107         esac
12108         case "$getnetbyaddr_r_proto" in
12109         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12110         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12111         esac
12112         case "$getnetbyaddr_r_proto" in
12113         ''|0)   d_getnetbyaddr_r=undef
12114                 getnetbyaddr_r_proto=0
12115                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12116         * )     case "$getnetbyaddr_r_proto" in
12117                 REENTRANT_PROTO*) ;;
12118                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12119                 esac
12120                 echo "Prototype: $try" ;;
12121         esac
12122         ;;
12123         *)      case "$usethreads" in
12124                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12125                 esac
12126                 d_getnetbyaddr_r=undef
12127                 getnetbyaddr_r_proto=0
12128                 ;;
12129         esac
12130         ;;
12131 *)      getnetbyaddr_r_proto=0
12132         ;;
12133 esac
12134
12135 : see if getnetbyname_r exists
12136 set getnetbyname_r d_getnetbyname_r
12137 eval $inlibc
12138 case "$d_getnetbyname_r" in
12139 "$define")
12140         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12141         case "$d_getnetbyname_r_proto:$usethreads" in
12142         ":define")      d_getnetbyname_r_proto=define
12143                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12144                 eval $hasproto ;;
12145         *)      ;;
12146         esac
12147         case "$d_getnetbyname_r_proto" in
12148         define)
12149         case "$getnetbyname_r_proto" in
12150         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12151         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12152         esac
12153         case "$getnetbyname_r_proto" in
12154         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12155         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12156         esac
12157         case "$getnetbyname_r_proto" in
12158         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12159         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12160         esac
12161         case "$getnetbyname_r_proto" in
12162         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12163         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12164         esac
12165         case "$getnetbyname_r_proto" in
12166         ''|0)   d_getnetbyname_r=undef
12167                 getnetbyname_r_proto=0
12168                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12169         * )     case "$getnetbyname_r_proto" in
12170                 REENTRANT_PROTO*) ;;
12171                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12172                 esac
12173                 echo "Prototype: $try" ;;
12174         esac
12175         ;;
12176         *)      case "$usethreads" in
12177                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12178                 esac
12179                 d_getnetbyname_r=undef
12180                 getnetbyname_r_proto=0
12181                 ;;
12182         esac
12183         ;;
12184 *)      getnetbyname_r_proto=0
12185         ;;
12186 esac
12187
12188 : see if getnetent_r exists
12189 set getnetent_r d_getnetent_r
12190 eval $inlibc
12191 case "$d_getnetent_r" in
12192 "$define")
12193         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12194         case "$d_getnetent_r_proto:$usethreads" in
12195         ":define")      d_getnetent_r_proto=define
12196                 set d_getnetent_r_proto getnetent_r $hdrs
12197                 eval $hasproto ;;
12198         *)      ;;
12199         esac
12200         case "$d_getnetent_r_proto" in
12201         define)
12202         case "$getnetent_r_proto" in
12203         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12204         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12205         esac
12206         case "$getnetent_r_proto" in
12207         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12208         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12209         esac
12210         case "$getnetent_r_proto" in
12211         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12212         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12213         esac
12214         case "$getnetent_r_proto" in
12215         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12216         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12217         esac
12218         case "$getnetent_r_proto" in
12219         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12220         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12221         esac
12222         case "$getnetent_r_proto" in
12223         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12224         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12225         esac
12226         case "$getnetent_r_proto" in
12227         ''|0)   d_getnetent_r=undef
12228                 getnetent_r_proto=0
12229                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12230         * )     case "$getnetent_r_proto" in
12231                 REENTRANT_PROTO*) ;;
12232                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12233                 esac
12234                 echo "Prototype: $try" ;;
12235         esac
12236         ;;
12237         *)      case "$usethreads" in
12238                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12239                 esac
12240                 d_getnetent_r=undef
12241                 getnetent_r_proto=0
12242                 ;;
12243         esac
12244         ;;
12245 *)      getnetent_r_proto=0
12246         ;;
12247 esac
12248
12249 : see if prototypes for various getnetxxx netdb.h functions are available
12250 echo " "
12251 set d_getnetprotos getnetent $i_netdb netdb.h
12252 eval $hasproto
12253
12254 : see if getpagesize exists
12255 set getpagesize d_getpagsz
12256 eval $inlibc
12257
12258
12259 : see if getprotobyname exists
12260 set getprotobyname d_getpbyname
12261 eval $inlibc
12262
12263 : see if getprotobynumber exists
12264 set getprotobynumber d_getpbynumber
12265 eval $inlibc
12266
12267 : see if getprotoent exists
12268 set getprotoent d_getpent
12269 eval $inlibc
12270
12271 : see if getpgid exists
12272 set getpgid d_getpgid
12273 eval $inlibc
12274
12275 : see if getpgrp2 exists
12276 set getpgrp2 d_getpgrp2
12277 eval $inlibc
12278
12279 : see if getppid exists
12280 set getppid d_getppid
12281 eval $inlibc
12282
12283 : see if getpriority exists
12284 set getpriority d_getprior
12285 eval $inlibc
12286
12287 : see if getprotobyname_r exists
12288 set getprotobyname_r d_getprotobyname_r
12289 eval $inlibc
12290 case "$d_getprotobyname_r" in
12291 "$define")
12292         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12293         case "$d_getprotobyname_r_proto:$usethreads" in
12294         ":define")      d_getprotobyname_r_proto=define
12295                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12296                 eval $hasproto ;;
12297         *)      ;;
12298         esac
12299         case "$d_getprotobyname_r_proto" in
12300         define)
12301         case "$getprotobyname_r_proto" in
12302         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12303         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12304         esac
12305         case "$getprotobyname_r_proto" in
12306         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12307         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12308         esac
12309         case "$getprotobyname_r_proto" in
12310         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12311         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12312         esac
12313         case "$getprotobyname_r_proto" in
12314         ''|0)   d_getprotobyname_r=undef
12315                 getprotobyname_r_proto=0
12316                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12317         * )     case "$getprotobyname_r_proto" in
12318                 REENTRANT_PROTO*) ;;
12319                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12320                 esac
12321                 echo "Prototype: $try" ;;
12322         esac
12323         ;;
12324         *)      case "$usethreads" in
12325                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12326                 esac
12327                 d_getprotobyname_r=undef
12328                 getprotobyname_r_proto=0
12329                 ;;
12330         esac
12331         ;;
12332 *)      getprotobyname_r_proto=0
12333         ;;
12334 esac
12335
12336 : see if getprotobynumber_r exists
12337 set getprotobynumber_r d_getprotobynumber_r
12338 eval $inlibc
12339 case "$d_getprotobynumber_r" in
12340 "$define")
12341         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12342         case "$d_getprotobynumber_r_proto:$usethreads" in
12343         ":define")      d_getprotobynumber_r_proto=define
12344                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12345                 eval $hasproto ;;
12346         *)      ;;
12347         esac
12348         case "$d_getprotobynumber_r_proto" in
12349         define)
12350         case "$getprotobynumber_r_proto" in
12351         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12352         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12353         esac
12354         case "$getprotobynumber_r_proto" in
12355         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12356         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12357         esac
12358         case "$getprotobynumber_r_proto" in
12359         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12360         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12361         esac
12362         case "$getprotobynumber_r_proto" in
12363         ''|0)   d_getprotobynumber_r=undef
12364                 getprotobynumber_r_proto=0
12365                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12366         * )     case "$getprotobynumber_r_proto" in
12367                 REENTRANT_PROTO*) ;;
12368                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12369                 esac
12370                 echo "Prototype: $try" ;;
12371         esac
12372         ;;
12373         *)      case "$usethreads" in
12374                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12375                 esac
12376                 d_getprotobynumber_r=undef
12377                 getprotobynumber_r_proto=0
12378                 ;;
12379         esac
12380         ;;
12381 *)      getprotobynumber_r_proto=0
12382         ;;
12383 esac
12384
12385 : see if getprotoent_r exists
12386 set getprotoent_r d_getprotoent_r
12387 eval $inlibc
12388 case "$d_getprotoent_r" in
12389 "$define")
12390         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12391         case "$d_getprotoent_r_proto:$usethreads" in
12392         ":define")      d_getprotoent_r_proto=define
12393                 set d_getprotoent_r_proto getprotoent_r $hdrs
12394                 eval $hasproto ;;
12395         *)      ;;
12396         esac
12397         case "$d_getprotoent_r_proto" in
12398         define)
12399         case "$getprotoent_r_proto" in
12400         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12401         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12402         esac
12403         case "$getprotoent_r_proto" in
12404         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12405         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12406         esac
12407         case "$getprotoent_r_proto" in
12408         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12409         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12410         esac
12411         case "$getprotoent_r_proto" in
12412         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12413         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12414         esac
12415         case "$getprotoent_r_proto" in
12416         ''|0)   d_getprotoent_r=undef
12417                 getprotoent_r_proto=0
12418                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12419         * )     case "$getprotoent_r_proto" in
12420                 REENTRANT_PROTO*) ;;
12421                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12422                 esac
12423                 echo "Prototype: $try" ;;
12424         esac
12425         ;;
12426         *)      case "$usethreads" in
12427                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12428                 esac
12429                 d_getprotoent_r=undef
12430                 getprotoent_r_proto=0
12431                 ;;
12432         esac
12433         ;;
12434 *)      getprotoent_r_proto=0
12435         ;;
12436 esac
12437
12438 : see if prototypes for various getprotoxxx netdb.h functions are available
12439 echo " "
12440 set d_getprotoprotos getprotoent $i_netdb netdb.h
12441 eval $hasproto
12442
12443 : see if getprpwnam exists
12444 set getprpwnam d_getprpwnam
12445 eval $inlibc
12446
12447 : see if getpwent exists
12448 set getpwent d_getpwent
12449 eval $inlibc
12450
12451 : see if getpwent_r exists
12452 set getpwent_r d_getpwent_r
12453 eval $inlibc
12454 case "$d_getpwent_r" in
12455 "$define")
12456         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12457         case "$d_getpwent_r_proto:$usethreads" in
12458         ":define")      d_getpwent_r_proto=define
12459                 set d_getpwent_r_proto getpwent_r $hdrs
12460                 eval $hasproto ;;
12461         *)      ;;
12462         esac
12463         case "$d_getpwent_r_proto" in
12464         define)
12465         case "$getpwent_r_proto" in
12466         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12467         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12468         esac
12469         case "$getpwent_r_proto" in
12470         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12471         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12472         esac
12473         case "$getpwent_r_proto" in
12474         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12475         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12476         esac
12477         case "$getpwent_r_proto" in
12478         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12479         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12480         esac
12481         case "$getpwent_r_proto" in
12482         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12483         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12484         esac
12485         case "$getpwent_r_proto" in
12486         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12487         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12488         esac
12489         case "$getpwent_r_proto" in
12490         ''|0)   d_getpwent_r=undef
12491                 getpwent_r_proto=0
12492                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12493         * )     case "$getpwent_r_proto" in
12494                 REENTRANT_PROTO*) ;;
12495                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12496                 esac
12497                 echo "Prototype: $try" ;;
12498         esac
12499         ;;
12500         *)      case "$usethreads" in
12501                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12502                 esac
12503                 d_getpwent_r=undef
12504                 getpwent_r_proto=0
12505                 ;;
12506         esac
12507         ;;
12508 *)      getpwent_r_proto=0
12509         ;;
12510 esac
12511
12512 : see if getpwnam_r exists
12513 set getpwnam_r d_getpwnam_r
12514 eval $inlibc
12515 case "$d_getpwnam_r" in
12516 "$define")
12517         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12518         case "$d_getpwnam_r_proto:$usethreads" in
12519         ":define")      d_getpwnam_r_proto=define
12520                 set d_getpwnam_r_proto getpwnam_r $hdrs
12521                 eval $hasproto ;;
12522         *)      ;;
12523         esac
12524         case "$d_getpwnam_r_proto" in
12525         define)
12526         case "$getpwnam_r_proto" in
12527         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12528         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12529         esac
12530         case "$getpwnam_r_proto" in
12531         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12532         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12533         esac
12534         case "$getpwnam_r_proto" in
12535         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12536         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12537         esac
12538         case "$getpwnam_r_proto" in
12539         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12540         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12541         esac
12542         case "$getpwnam_r_proto" in
12543         ''|0)   d_getpwnam_r=undef
12544                 getpwnam_r_proto=0
12545                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12546         * )     case "$getpwnam_r_proto" in
12547                 REENTRANT_PROTO*) ;;
12548                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12549                 esac
12550                 echo "Prototype: $try" ;;
12551         esac
12552         ;;
12553         *)      case "$usethreads" in
12554                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12555                 esac
12556                 d_getpwnam_r=undef
12557                 getpwnam_r_proto=0
12558                 ;;
12559         esac
12560         ;;
12561 *)      getpwnam_r_proto=0
12562         ;;
12563 esac
12564
12565 : see if getpwuid_r exists
12566 set getpwuid_r d_getpwuid_r
12567 eval $inlibc
12568 case "$d_getpwuid_r" in
12569 "$define")
12570         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12571         case "$d_getpwuid_r_proto:$usethreads" in
12572         ":define")      d_getpwuid_r_proto=define
12573                 set d_getpwuid_r_proto getpwuid_r $hdrs
12574                 eval $hasproto ;;
12575         *)      ;;
12576         esac
12577         case "$d_getpwuid_r_proto" in
12578         define)
12579         case "$getpwuid_r_proto" in
12580         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12581         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12582         esac
12583         case "$getpwuid_r_proto" in
12584         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12585         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12586         esac
12587         case "$getpwuid_r_proto" in
12588         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12589         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12590         esac
12591         case "$getpwuid_r_proto" in
12592         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12593         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12594         esac
12595         case "$getpwuid_r_proto" in
12596         ''|0)   d_getpwuid_r=undef
12597                 getpwuid_r_proto=0
12598                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12599         * )     case "$getpwuid_r_proto" in
12600                 REENTRANT_PROTO*) ;;
12601                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12602                 esac
12603                 echo "Prototype: $try" ;;
12604         esac
12605         ;;
12606         *)      case "$usethreads" in
12607                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12608                 esac
12609                 d_getpwuid_r=undef
12610                 getpwuid_r_proto=0
12611                 ;;
12612         esac
12613         ;;
12614 *)      getpwuid_r_proto=0
12615         ;;
12616 esac
12617
12618
12619 : see if getservbyname exists
12620 set getservbyname d_getsbyname
12621 eval $inlibc
12622
12623 : see if getservbyport exists
12624 set getservbyport d_getsbyport
12625 eval $inlibc
12626
12627 : see if getservent exists
12628 set getservent d_getsent
12629 eval $inlibc
12630
12631 : see if getservbyname_r exists
12632 set getservbyname_r d_getservbyname_r
12633 eval $inlibc
12634 case "$d_getservbyname_r" in
12635 "$define")
12636         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12637         case "$d_getservbyname_r_proto:$usethreads" in
12638         ":define")      d_getservbyname_r_proto=define
12639                 set d_getservbyname_r_proto getservbyname_r $hdrs
12640                 eval $hasproto ;;
12641         *)      ;;
12642         esac
12643         case "$d_getservbyname_r_proto" in
12644         define)
12645         case "$getservbyname_r_proto" in
12646         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12647         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12648         esac
12649         case "$getservbyname_r_proto" in
12650         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12651         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12652         esac
12653         case "$getservbyname_r_proto" in
12654         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12655         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12656         esac
12657         case "$getservbyname_r_proto" in
12658         ''|0)   d_getservbyname_r=undef
12659                 getservbyname_r_proto=0
12660                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12661         * )     case "$getservbyname_r_proto" in
12662                 REENTRANT_PROTO*) ;;
12663                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12664                 esac
12665                 echo "Prototype: $try" ;;
12666         esac
12667         ;;
12668         *)      case "$usethreads" in
12669                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12670                 esac
12671                 d_getservbyname_r=undef
12672                 getservbyname_r_proto=0
12673                 ;;
12674         esac
12675         ;;
12676 *)      getservbyname_r_proto=0
12677         ;;
12678 esac
12679
12680 : see if getservbyport_r exists
12681 set getservbyport_r d_getservbyport_r
12682 eval $inlibc
12683 case "$d_getservbyport_r" in
12684 "$define")
12685         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12686         case "$d_getservbyport_r_proto:$usethreads" in
12687         ":define")      d_getservbyport_r_proto=define
12688                 set d_getservbyport_r_proto getservbyport_r $hdrs
12689                 eval $hasproto ;;
12690         *)      ;;
12691         esac
12692         case "$d_getservbyport_r_proto" in
12693         define)
12694         case "$getservbyport_r_proto" in
12695         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12696         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12697         esac
12698         case "$getservbyport_r_proto" in
12699         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12700         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12701         esac
12702         case "$getservbyport_r_proto" in
12703         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12704         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12705         esac
12706         case "$getservbyport_r_proto" in
12707         ''|0)   d_getservbyport_r=undef
12708                 getservbyport_r_proto=0
12709                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12710         * )     case "$getservbyport_r_proto" in
12711                 REENTRANT_PROTO*) ;;
12712                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12713                 esac
12714                 echo "Prototype: $try" ;;
12715         esac
12716         ;;
12717         *)      case "$usethreads" in
12718                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12719                 esac
12720                 d_getservbyport_r=undef
12721                 getservbyport_r_proto=0
12722                 ;;
12723         esac
12724         ;;
12725 *)      getservbyport_r_proto=0
12726         ;;
12727 esac
12728
12729 : see if getservent_r exists
12730 set getservent_r d_getservent_r
12731 eval $inlibc
12732 case "$d_getservent_r" in
12733 "$define")
12734         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12735         case "$d_getservent_r_proto:$usethreads" in
12736         ":define")      d_getservent_r_proto=define
12737                 set d_getservent_r_proto getservent_r $hdrs
12738                 eval $hasproto ;;
12739         *)      ;;
12740         esac
12741         case "$d_getservent_r_proto" in
12742         define)
12743         case "$getservent_r_proto" in
12744         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12745         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12746         esac
12747         case "$getservent_r_proto" in
12748         ''|0) try='int getservent_r(struct servent*, char*, int);'
12749         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12750         esac
12751         case "$getservent_r_proto" in
12752         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12753         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12754         esac
12755         case "$getservent_r_proto" in
12756         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12757         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12758         esac
12759         case "$getservent_r_proto" in
12760         ''|0)   d_getservent_r=undef
12761                 getservent_r_proto=0
12762                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12763         * )     case "$getservent_r_proto" in
12764                 REENTRANT_PROTO*) ;;
12765                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12766                 esac
12767                 echo "Prototype: $try" ;;
12768         esac
12769         ;;
12770         *)      case "$usethreads" in
12771                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12772                 esac
12773                 d_getservent_r=undef
12774                 getservent_r_proto=0
12775                 ;;
12776         esac
12777         ;;
12778 *)      getservent_r_proto=0
12779         ;;
12780 esac
12781
12782 : see if prototypes for various getservxxx netdb.h functions are available
12783 echo " "
12784 set d_getservprotos getservent $i_netdb netdb.h
12785 eval $hasproto
12786
12787 : see if getspnam exists
12788 set getspnam d_getspnam
12789 eval $inlibc
12790
12791 : see if this is a shadow.h system
12792 set shadow.h i_shadow
12793 eval $inhdr
12794
12795 : see if getspnam_r exists
12796 set getspnam_r d_getspnam_r
12797 eval $inlibc
12798 case "$d_getspnam_r" in
12799 "$define")
12800         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12801         case "$d_getspnam_r_proto:$usethreads" in
12802         ":define")      d_getspnam_r_proto=define
12803                 set d_getspnam_r_proto getspnam_r $hdrs
12804                 eval $hasproto ;;
12805         *)      ;;
12806         esac
12807         case "$d_getspnam_r_proto" in
12808         define)
12809         case "$getspnam_r_proto" in
12810         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12811         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12812         esac
12813         case "$getspnam_r_proto" in
12814         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12815         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12816         esac
12817         case "$getspnam_r_proto" in
12818         ''|0)   d_getspnam_r=undef
12819                 getspnam_r_proto=0
12820                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12821         * )     case "$getspnam_r_proto" in
12822                 REENTRANT_PROTO*) ;;
12823                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12824                 esac
12825                 echo "Prototype: $try" ;;
12826         esac
12827         ;;
12828         *)      case "$usethreads" in
12829                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12830                 esac
12831                 d_getspnam_r=undef
12832                 getspnam_r_proto=0
12833                 ;;
12834         esac
12835         ;;
12836 *)      getspnam_r_proto=0
12837         ;;
12838 esac
12839
12840 : see if gettimeofday or ftime exists
12841 set gettimeofday d_gettimeod
12842 eval $inlibc
12843 case "$d_gettimeod" in
12844 "$undef")
12845         set ftime d_ftime 
12846         eval $inlibc
12847         ;;
12848 *)
12849         val="$undef"; set d_ftime; eval $setvar
12850         ;;
12851 esac
12852 case "$d_gettimeod$d_ftime" in
12853 "$undef$undef")
12854         echo " "
12855         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12856         ;;
12857 esac
12858
12859 : see if gmtime_r exists
12860 set gmtime_r d_gmtime_r
12861 eval $inlibc
12862 case "$d_gmtime_r" in
12863 "$define")
12864         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12865         case "$d_gmtime_r_proto:$usethreads" in
12866         ":define")      d_gmtime_r_proto=define
12867                 set d_gmtime_r_proto gmtime_r $hdrs
12868                 eval $hasproto ;;
12869         *)      ;;
12870         esac
12871         case "$d_gmtime_r_proto" in
12872         define)
12873         case "$gmtime_r_proto" in
12874         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12875         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12876         esac
12877         case "$gmtime_r_proto" in
12878         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12879         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12880         esac
12881         case "$gmtime_r_proto" in
12882         ''|0)   d_gmtime_r=undef
12883                 gmtime_r_proto=0
12884                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12885         * )     case "$gmtime_r_proto" in
12886                 REENTRANT_PROTO*) ;;
12887                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12888                 esac
12889                 echo "Prototype: $try" ;;
12890         esac
12891         ;;
12892         *)      case "$usethreads" in
12893                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12894                 esac
12895                 d_gmtime_r=undef
12896                 gmtime_r_proto=0
12897                 ;;
12898         esac
12899         ;;
12900 *)      gmtime_r_proto=0
12901         ;;
12902 esac
12903
12904 : see if hasmntopt exists
12905 set hasmntopt d_hasmntopt
12906 eval $inlibc
12907
12908 : see if this is a netinet/in.h or sys/in.h system
12909 set netinet/in.h i_niin sys/in.h i_sysin
12910 eval $inhdr
12911
12912 : see if arpa/inet.h has to be included
12913 set arpa/inet.h i_arpainet
12914 eval $inhdr
12915
12916 : see if htonl --and friends-- exists
12917 val=''
12918 set htonl val
12919 eval $inlibc
12920
12921 : Maybe they are macros.
12922 case "$val" in
12923 $undef)
12924         $cat >htonl.c <<EOM
12925 #include <stdio.h>
12926 #include <sys/types.h>
12927 #$i_niin I_NETINET_IN
12928 #$i_sysin I_SYS_IN
12929 #$i_arpainet I_ARPA_INET
12930 #ifdef I_NETINET_IN
12931 #include <netinet/in.h>
12932 #endif
12933 #ifdef I_SYS_IN
12934 #include <sys/in.h>
12935 #endif
12936 #ifdef I_ARPA_INET
12937 #include <arpa/inet.h>
12938 #endif
12939 #ifdef htonl
12940 printf("Defined as a macro.");
12941 #endif
12942 EOM
12943         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12944         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12945                 val="$define"
12946                 echo "But it seems to be defined as a macro." >&4
12947         fi
12948         $rm -f htonl.?
12949         ;;
12950 esac
12951 set d_htonl
12952 eval $setvar
12953
12954 : index or strchr
12955 echo " "
12956 if set index val -f; eval $csym; $val; then
12957         if set strchr val -f d_strchr; eval $csym; $val; then
12958                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12959                         val="$define"
12960                         vali="$undef"
12961                         echo "strchr() found." >&4
12962                 else
12963                         val="$undef"
12964                         vali="$define"
12965                         echo "index() found." >&4
12966                 fi
12967         else
12968                 val="$undef"
12969                 vali="$define"
12970                 echo "index() found." >&4
12971         fi
12972 else
12973         if set strchr val -f d_strchr; eval $csym; $val; then
12974                 val="$define"
12975                 vali="$undef"
12976                 echo "strchr() found." >&4
12977         else
12978                 echo "No index() or strchr() found!" >&4
12979                 val="$undef"
12980                 vali="$undef"
12981         fi
12982 fi
12983 set d_strchr; eval $setvar
12984 val="$vali"
12985 set d_index; eval $setvar
12986
12987 : check whether inet_aton exists
12988 set inet_aton d_inetaton
12989 eval $inlibc
12990
12991 : Look for isascii
12992 echo " "
12993 $cat >isascii.c <<'EOCP'
12994 #include <stdio.h>
12995 #include <ctype.h>
12996 int main() {
12997         int c = 'A';
12998         if (isascii(c))
12999                 exit(0);
13000         else
13001                 exit(1);
13002 }
13003 EOCP
13004 set isascii
13005 if eval $compile; then
13006         echo "isascii() found." >&4
13007         val="$define"
13008 else
13009         echo "isascii() NOT found." >&4
13010         val="$undef"
13011 fi
13012 set d_isascii
13013 eval $setvar
13014 $rm -f isascii*
13015
13016 : see if isfinite exists
13017 set isfinite d_isfinite
13018 eval $inlibc
13019
13020 : see if isinf exists
13021 set isinf d_isinf
13022 eval $inlibc
13023
13024 : see if isnan exists
13025 set isnan d_isnan
13026 eval $inlibc
13027
13028 : see if isnanl exists
13029 set isnanl d_isnanl
13030 eval $inlibc
13031
13032 : see if killpg exists
13033 set killpg d_killpg
13034 eval $inlibc
13035
13036 : see if lchown exists
13037 echo " "
13038 $cat > try.c <<'EOCP'
13039 /* System header to define __stub macros and hopefully few prototypes,
13040     which can conflict with char lchown(); below.  */
13041 #include <assert.h>
13042 /* Override any gcc2 internal prototype to avoid an error.  */
13043 /* We use char because int might match the return type of a gcc2
13044    builtin and then its argument prototype would still apply.  */
13045 char lchown();
13046 int main() {
13047     /*  The GNU C library defines this for functions which it implements
13048         to always fail with ENOSYS.  Some functions are actually named
13049         something starting with __ and the normal name is an alias.  */
13050 #if defined (__stub_lchown) || defined (__stub___lchown)
13051 choke me
13052 #else
13053 lchown();
13054 #endif
13055 ; return 0; }
13056 EOCP
13057 set try
13058 if eval $compile; then
13059     $echo "lchown() found." >&4
13060     val="$define"
13061 else
13062     $echo "lchown() NOT found." >&4
13063     val="$undef"
13064 fi
13065 set d_lchown
13066 eval $setvar
13067
13068 : See if number of significant digits in a double precision number is known
13069 echo " "
13070 $cat >ldbl_dig.c <<EOM
13071 #$i_limits I_LIMITS
13072 #$i_float I_FLOAT
13073 #ifdef I_LIMITS
13074 #include <limits.h>
13075 #endif
13076 #ifdef I_FLOAT
13077 #include <float.h>
13078 #endif
13079 #ifdef LDBL_DIG
13080 printf("Contains LDBL_DIG");
13081 #endif
13082 EOM
13083 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13084 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13085         echo "LDBL_DIG found." >&4
13086         val="$define"
13087 else
13088         echo "LDBL_DIG NOT found." >&4
13089         val="$undef"
13090 fi
13091 $rm -f ldbl_dig.?
13092 set d_ldbl_dig
13093 eval $setvar
13094
13095 : see if link exists
13096 set link d_link
13097 eval $inlibc
13098
13099 : see if localtime_r exists
13100 set localtime_r d_localtime_r
13101 eval $inlibc
13102 case "$d_localtime_r" in
13103 "$define")
13104         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13105         case "$d_localtime_r_proto:$usethreads" in
13106         ":define")      d_localtime_r_proto=define
13107                 set d_localtime_r_proto localtime_r $hdrs
13108                 eval $hasproto ;;
13109         *)      ;;
13110         esac
13111         case "$d_localtime_r_proto" in
13112         define)
13113         case "$localtime_r_proto" in
13114         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13115         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13116         esac
13117         case "$localtime_r_proto" in
13118         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13119         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13120         esac
13121         case "$localtime_r_proto" in
13122         ''|0)   d_localtime_r=undef
13123                 localtime_r_proto=0
13124                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13125         * )     case "$localtime_r_proto" in
13126                 REENTRANT_PROTO*) ;;
13127                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13128                 esac
13129                 echo "Prototype: $try" ;;
13130         esac
13131         ;;
13132         *)      case "$usethreads" in
13133                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13134                 esac
13135                 d_localtime_r=undef
13136                 localtime_r_proto=0
13137                 ;;
13138         esac
13139         ;;
13140 *)      localtime_r_proto=0
13141         ;;
13142 esac
13143
13144 : see if localeconv exists
13145 set localeconv d_locconv
13146 eval $inlibc
13147
13148 : see if lockf exists
13149 set lockf d_lockf
13150 eval $inlibc
13151
13152 : see if prototype for lseek is available
13153 echo " "
13154 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13155 eval $hasproto
13156
13157 : see if lstat exists
13158 set lstat d_lstat
13159 eval $inlibc
13160
13161 : see if madvise exists
13162 set madvise d_madvise
13163 eval $inlibc
13164
13165 : see if mblen exists
13166 set mblen d_mblen
13167 eval $inlibc
13168
13169 : see if mbstowcs exists
13170 set mbstowcs d_mbstowcs
13171 eval $inlibc
13172
13173 : see if mbtowc exists
13174 set mbtowc d_mbtowc
13175 eval $inlibc
13176
13177 : see if memchr exists
13178 set memchr d_memchr
13179 eval $inlibc
13180
13181 : see if memcmp exists
13182 set memcmp d_memcmp
13183 eval $inlibc
13184
13185 : see if memcpy exists
13186 set memcpy d_memcpy
13187 eval $inlibc
13188
13189 : see if memmove exists
13190 set memmove d_memmove
13191 eval $inlibc
13192
13193 : see if memset exists
13194 set memset d_memset
13195 eval $inlibc
13196
13197 : see if mkdir exists
13198 set mkdir d_mkdir
13199 eval $inlibc
13200
13201 : see if mkdtemp exists
13202 set mkdtemp d_mkdtemp
13203 eval $inlibc
13204
13205 : see if mkfifo exists
13206 set mkfifo d_mkfifo
13207 eval $inlibc
13208
13209 : see if mkstemp exists
13210 set mkstemp d_mkstemp
13211 eval $inlibc
13212
13213 : see if mkstemps exists
13214 set mkstemps d_mkstemps
13215 eval $inlibc
13216
13217 : see if mktime exists
13218 set mktime d_mktime
13219 eval $inlibc
13220
13221 : see if this is a sys/mman.h system
13222 set sys/mman.h i_sysmman
13223 eval $inhdr
13224
13225 : see if mmap exists
13226 set mmap d_mmap
13227 eval $inlibc
13228 : see what shmat returns
13229 : default to something harmless
13230 mmaptype='void *'
13231 case "$i_sysmman$d_mmap" in
13232 "$define$define")
13233         $cat >mmap.c <<'END'
13234 #include <sys/mman.h>
13235 void *mmap();
13236 END
13237         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13238                 mmaptype='void *'
13239         else
13240                 mmaptype='caddr_t'
13241         fi
13242         echo "and it returns ($mmaptype)." >&4
13243         ;;
13244 esac
13245
13246
13247
13248 : see if mprotect exists
13249 set mprotect d_mprotect
13250 eval $inlibc
13251
13252 : see if msgctl exists
13253 set msgctl d_msgctl
13254 eval $inlibc
13255
13256 : see if msgget exists
13257 set msgget d_msgget
13258 eval $inlibc
13259
13260 : see if msgsnd exists
13261 set msgsnd d_msgsnd
13262 eval $inlibc
13263
13264 : see if msgrcv exists
13265 set msgrcv d_msgrcv
13266 eval $inlibc
13267
13268 : see how much of the 'msg*(2)' library is present.
13269 h_msg=true
13270 echo " "
13271 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13272 *"$undef"*) h_msg=false;;
13273 esac
13274 case "$osname" in
13275 freebsd)
13276     case "`ipcs 2>&1`" in
13277     "SVID messages"*"not configured"*)
13278         echo "Your $osname does not have the msg*(2) configured." >&4
13279         h_msg=false
13280         val="$undef"
13281         set msgctl d_msgctl
13282         eval $setvar
13283         set msgget d_msgget
13284         eval $setvar
13285         set msgsnd d_msgsnd
13286         eval $setvar
13287         set msgrcv d_msgrcv
13288         eval $setvar
13289         ;;
13290     esac
13291     ;;
13292 esac
13293 : we could also check for sys/ipc.h ...
13294 if $h_msg && $test `./findhdr sys/msg.h`; then
13295         echo "You have the full msg*(2) library." >&4
13296         val="$define"
13297 else
13298         echo "You don't have the full msg*(2) library." >&4
13299         val="$undef"
13300 fi
13301 set d_msg
13302 eval $setvar
13303
13304
13305 echo " "
13306 echo "Checking to see if your system supports struct msghdr..." >&4
13307 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13308 eval $hasstruct
13309 case "$d_msghdr_s" in
13310 "$define")      echo "Yes, it does."   ;;
13311 *)              echo "No, it doesn't." ;;
13312 esac
13313
13314
13315 : see if msync exists
13316 set msync d_msync
13317 eval $inlibc
13318
13319 : see if munmap exists
13320 set munmap d_munmap
13321 eval $inlibc
13322
13323 : see if nice exists
13324 set nice d_nice
13325 eval $inlibc
13326
13327 : see if this is a langinfo.h system
13328 set langinfo.h i_langinfo
13329 eval $inhdr
13330
13331 : see if nl_langinfo exists
13332 set nl_langinfo d_nl_langinfo
13333 eval $inlibc
13334
13335 : check for length of character
13336 echo " "
13337 case "$charsize" in
13338 '')
13339         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13340         $cat >try.c <<'EOCP'
13341 #include <stdio.h>
13342 int main()
13343 {
13344     printf("%d\n", (int)sizeof(char));
13345     exit(0);
13346 }
13347 EOCP
13348         set try
13349         if eval $compile_ok; then
13350                 dflt=`$run ./try`
13351         else
13352                 dflt='1'
13353                 echo "(I can't seem to compile the test program.  Guessing...)"
13354         fi
13355         ;;
13356 *)
13357         dflt="$charsize"
13358         ;;
13359 esac
13360 rp="What is the size of a character (in bytes)?"
13361 . ./myread
13362 charsize="$ans"
13363 $rm -f try.c try
13364
13365 : check for volatile keyword
13366 echo " "
13367 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13368 $cat >try.c <<'EOCP'
13369 int main()
13370 {
13371         typedef struct _goo_struct goo_struct;
13372         goo_struct * volatile goo = ((goo_struct *)0);
13373         struct _goo_struct {
13374                 long long_int;
13375                 int reg_int;
13376                 char char_var;
13377         };
13378         typedef unsigned short foo_t;
13379         char *volatile foo;
13380         volatile int bar;
13381         volatile foo_t blech;
13382         foo = foo;
13383 }
13384 EOCP
13385 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13386         val="$define"
13387         echo "Yup, it does."
13388 else
13389         val="$undef"
13390         echo "Nope, it doesn't."
13391 fi
13392 set d_volatile
13393 eval $setvar
13394 $rm -f try.*
13395
13396
13397 echo " "
13398 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13399
13400 case "$use64bitint:$d_quad:$quadtype" in
13401 define:define:?*)
13402         ivtype="$quadtype"
13403         uvtype="$uquadtype"
13404         ivsize=8
13405         uvsize=8
13406         ;;
13407 *)      ivtype="long"
13408         uvtype="unsigned long"
13409         ivsize=$longsize
13410         uvsize=$longsize
13411         ;;
13412 esac
13413
13414 case "$uselongdouble:$d_longdbl" in
13415 define:define)
13416         nvtype="long double"
13417         nvsize=$longdblsize
13418         ;;
13419 *)      nvtype=double
13420         nvsize=$doublesize
13421         ;;
13422 esac
13423
13424 $echo "(IV will be "$ivtype", $ivsize bytes)"
13425 $echo "(UV will be "$uvtype", $uvsize bytes)"
13426 $echo "(NV will be "$nvtype", $nvsize bytes)"
13427
13428 $cat >try.c <<EOCP
13429 #$i_inttypes I_INTTYPES
13430 #ifdef I_INTTYPES
13431 #include <inttypes.h>
13432 #endif
13433 #include <stdio.h>
13434 int main() {
13435 #ifdef INT8
13436    int8_t i =  INT8_MAX;
13437   uint8_t u = UINT8_MAX;
13438   printf("int8_t\n");
13439 #endif
13440 #ifdef INT16
13441    int16_t i =  INT16_MAX;
13442   uint16_t i = UINT16_MAX;
13443   printf("int16_t\n");
13444 #endif
13445 #ifdef INT32
13446    int32_t i =  INT32_MAX;
13447   uint32_t u = UINT32_MAX;
13448   printf("int32_t\n");
13449 #endif
13450 }
13451 EOCP
13452
13453 case "$i8type" in
13454 '')     case "$charsize" in
13455         1)      i8type=char
13456                 u8type="unsigned char"
13457                 i8size=$charsize
13458                 u8size=$charsize
13459                 ;;
13460         esac
13461         ;;
13462 esac
13463 case "$i8type" in
13464 '')     set try -DINT8
13465         if eval $compile; then
13466                 case "`$run ./try`" in
13467                 int8_t) i8type=int8_t
13468                         u8type=uint8_t
13469                         i8size=1
13470                         u8size=1
13471                         ;;
13472                 esac
13473         fi
13474         ;;
13475 esac
13476 case "$i8type" in
13477 '')     if $test $charsize -ge 1; then
13478                 i8type=char
13479                 u8type="unsigned char"
13480                 i8size=$charsize
13481                 u8size=$charsize
13482         fi
13483         ;;
13484 esac
13485
13486 case "$i16type" in
13487 '')     case "$shortsize" in
13488         2)      i16type=short
13489                 u16type="unsigned short"
13490                 i16size=$shortsize
13491                 u16size=$shortsize
13492                 ;;
13493         esac
13494         ;;
13495 esac
13496 case "$i16type" in
13497 '')     set try -DINT16
13498         if eval $compile; then
13499                 case "`$run ./try`" in
13500                 int16_t)
13501                         i16type=int16_t
13502                         u16type=uint16_t
13503                         i16size=2
13504                         u16size=2
13505                         ;;
13506                 esac
13507         fi
13508         ;;
13509 esac
13510 case "$i16type" in
13511 '')     if $test $shortsize -ge 2; then
13512                 i16type=short
13513                 u16type="unsigned short"
13514                 i16size=$shortsize
13515                 u16size=$shortsize
13516         fi
13517         ;;
13518 esac
13519
13520 case "$i32type" in
13521 '')     case "$longsize" in
13522         4)      i32type=long
13523                 u32type="unsigned long"
13524                 i32size=$longsize
13525                 u32size=$longsize
13526                 ;;
13527         *)      case "$intsize" in
13528                 4)      i32type=int
13529                         u32type="unsigned int"
13530                         i32size=$intsize
13531                         u32size=$intsize
13532                         ;;
13533                 esac
13534                 ;;
13535         esac
13536         ;;
13537 esac
13538 case "$i32type" in
13539 '')     set try -DINT32
13540         if eval $compile; then
13541                 case "`$run ./try`" in
13542                 int32_t)
13543                         i32type=int32_t
13544                         u32type=uint32_t
13545                         i32size=4
13546                         u32size=4
13547                         ;;
13548                 esac
13549         fi
13550         ;;
13551 esac
13552 case "$i32type" in
13553 '')     if $test $intsize -ge 4; then
13554                 i32type=int
13555                 u32type="unsigned int"
13556                 i32size=$intsize
13557                 u32size=$intsize
13558         fi
13559         ;;
13560 esac
13561
13562 case "$i64type" in
13563 '')     case "$d_quad:$quadtype" in
13564         define:?*)
13565                 i64type="$quadtype"
13566                 u64type="$uquadtype"
13567                 i64size=8
13568                 u64size=8
13569                 ;;
13570         esac
13571         ;;
13572 esac
13573
13574 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13575 : volatile so that the compiler has to store it out to memory.
13576 if test X"$d_volatile" = X"$define"; then
13577         volatile=volatile
13578 fi
13579 $cat <<EOP >try.c
13580 #include <stdio.h>
13581 #include <sys/types.h>
13582 #include <signal.h>
13583 #ifdef SIGFPE
13584 $volatile int bletched = 0;
13585 $signal_t blech(s) int s; { bletched = 1; }
13586 #endif
13587 int main() {
13588     $uvtype u = 0;
13589     $nvtype d;
13590     int     n = 8 * $uvsize;
13591     int     i;
13592 #ifdef SIGFPE
13593     signal(SIGFPE, blech);
13594 #endif
13595
13596     for (i = 0; i < n; i++) {
13597       u = u << 1 | ($uvtype)1;
13598       d = ($nvtype)u;
13599       if (($uvtype)d != u)
13600         break;
13601       if (d <= 0)
13602         break;
13603       d = ($nvtype)(u - 1);
13604       if (($uvtype)d != (u - 1))
13605         break;
13606 #ifdef SIGFPE
13607       if (bletched) {
13608         break;
13609 #endif
13610       } 
13611     }
13612     printf("%d\n", ((i == n) ? -n : i));
13613     exit(0);
13614 }
13615 EOP
13616 set try
13617
13618 d_nv_preserves_uv="$undef"
13619 if eval $compile; then
13620         nv_preserves_uv_bits="`$run ./try`"
13621 fi
13622 case "$nv_preserves_uv_bits" in
13623 \-[1-9]*)       
13624         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13625         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13626         d_nv_preserves_uv="$define"
13627         ;;
13628 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13629         d_nv_preserves_uv="$undef" ;;
13630 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13631         nv_preserves_uv_bits="$undef" ;;
13632 esac
13633
13634 $rm -f try.* try
13635
13636
13637 : check for off64_t
13638 echo " "
13639 echo "Checking to see if you have off64_t..." >&4
13640 $cat >try.c <<EOCP
13641 #include <sys/types.h>
13642 #include <unistd.h>
13643 int main() { off64_t x = 7; }
13644 EOCP
13645 set try
13646 if eval $compile; then
13647         val="$define"
13648         echo "You have off64_t."
13649 else
13650         val="$undef"
13651         echo "You do not have off64_t."
13652         case "$lseeksize" in
13653         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13654         esac
13655 fi
13656 $rm -f try.* try
13657 set d_off64_t
13658 eval $setvar
13659
13660 : how to create joinable pthreads
13661 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13662         echo " "
13663         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13664         $cat >try.c <<'EOCP'
13665 #include <pthread.h>
13666 int main() {
13667     int detachstate = JOINABLE;
13668 }
13669 EOCP
13670         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13671         if eval $compile; then
13672                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13673                 val="$undef" # Yes, undef.
13674                 set d_old_pthread_create_joinable
13675                 eval $setvar
13676                 val=""
13677                 set old_pthread_create_joinable
13678                 eval $setvar
13679         else
13680                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13681                 if eval $compile; then
13682                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13683                         val="$define"
13684                         set d_old_pthread_create_joinable
13685                         eval $setvar
13686                         val=PTHREAD_CREATE_UNDETACHED
13687                         set old_pthread_create_joinable
13688                         eval $setvar
13689                 else            
13690                         set try -DJOINABLE=__UNDETACHED
13691                         if eval $compile; then
13692                                 echo "You seem to use __UNDETACHED." >&4
13693                                 val="$define"
13694                                 set d_old_pthread_create_joinable
13695                                 eval $setvar
13696                                 val=__UNDETACHED
13697                                 set old_pthread_create_joinable
13698                                 eval $setvar
13699                         else
13700                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13701                                 val="$define"
13702                                 set d_old_pthread_create_joinable
13703                                 eval $setvar
13704                                 val=0
13705                                 set old_pthread_create_joinable
13706                                 eval $setvar
13707                         fi
13708                 fi
13709         fi
13710         $rm -f try try.*
13711 else
13712     d_old_pthread_create_joinable="$undef"
13713     old_pthread_create_joinable=""
13714 fi
13715
13716 : see if pause exists
13717 set pause d_pause
13718 eval $inlibc
13719
13720 : see if pipe exists
13721 set pipe d_pipe
13722 eval $inlibc
13723
13724 : see if poll exists
13725 set poll d_poll
13726 eval $inlibc
13727
13728 : see if readlink exists
13729 set readlink d_readlink
13730 eval $inlibc
13731
13732 echo " "
13733 procselfexe=''
13734 val="$undef"
13735 case "$d_readlink" in
13736 "$define")
13737         if $issymlink /proc/self/exe ; then
13738                 $ls -l /proc/self/exe > reflect
13739                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13740                         echo "You have Linux-like /proc/self/exe."
13741                         procselfexe='"/proc/self/exe"'
13742                         val="$define"
13743                 fi
13744         fi
13745         if $issymlink /proc/curproc/file ; then
13746                 $ls -l /proc/curproc/file > reflect
13747                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13748                         echo "You have BSD-like /proc/curproc/file."
13749                         procselfexe='"/proc/curproc/file"'
13750                         val="$define"
13751                 fi
13752         fi
13753         ;;
13754 esac
13755 $rm -f reflect
13756 set d_procselfexe
13757 eval $setvar
13758
13759 : see whether the pthread_atfork exists
13760 $cat >try.c <<EOP
13761 #include <pthread.h>
13762 #include <stdio.h>
13763 int main() {
13764 #ifdef  PTHREAD_ATFORK
13765         pthread_atfork(NULL,NULL,NULL);
13766 #endif
13767 }
13768 EOP
13769
13770 : see if pthread_atfork exists
13771 set try -DPTHREAD_ATFORK
13772 if eval $compile; then
13773     val="$define"
13774 else
13775     val="$undef"
13776 fi
13777 case "$usethreads" in
13778 $define)
13779         case "$val" in
13780         $define) echo 'pthread_atfork found.' >&4        ;;
13781         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13782         esac
13783 esac
13784 set d_pthread_atfork
13785 eval $setvar
13786
13787
13788 : see whether the various POSIXish _yields exist
13789 $cat >try.c <<EOP
13790 #include <pthread.h>
13791 #include <stdio.h>
13792 int main() {
13793 #ifdef SCHED_YIELD
13794         sched_yield();
13795 #else
13796 #ifdef PTHREAD_YIELD
13797         pthread_yield();
13798 #else
13799 #ifdef PTHREAD_YIELD_NULL
13800         pthread_yield(NULL);
13801 #endif
13802 #endif
13803 #endif
13804 }
13805 EOP
13806 : see if sched_yield exists
13807 set try -DSCHED_YIELD
13808 if eval $compile; then
13809     val="$define"
13810     sched_yield='sched_yield()'
13811 else
13812     val="$undef"
13813 fi
13814 case "$usethreads" in
13815 $define)
13816         case "$val" in
13817         $define) echo 'sched_yield() found.' >&4        ;;
13818         *)       echo 'sched_yield() NOT found.' >&4    ;;
13819         esac
13820 esac
13821 set d_sched_yield
13822 eval $setvar
13823
13824 : see if pthread_yield exists
13825 set try -DPTHREAD_YIELD
13826 if eval $compile; then
13827     val="$define"
13828     case "$sched_yield" in
13829     '') sched_yield='pthread_yield()' ;;
13830     esac
13831 else
13832     set try -DPTHREAD_YIELD_NULL
13833     if eval $compile; then
13834         val="$define"
13835         case "$sched_yield" in
13836         '') sched_yield='pthread_yield(NULL)' ;;
13837         esac
13838     else
13839         val="$undef"
13840     fi
13841 fi
13842 case "$usethreads" in
13843 $define)
13844         case "$val" in
13845         $define) echo 'pthread_yield() found.' >&4      ;;
13846         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13847         esac
13848         ;;
13849 esac
13850 set d_pthread_yield
13851 eval $setvar
13852
13853 case "$sched_yield" in
13854 '') sched_yield=undef ;;
13855 esac
13856
13857 $rm -f try try.*
13858
13859 : see if random_r exists
13860 set random_r d_random_r
13861 eval $inlibc
13862 case "$d_random_r" in
13863 "$define")
13864         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13865         case "$d_random_r_proto:$usethreads" in
13866         ":define")      d_random_r_proto=define
13867                 set d_random_r_proto random_r $hdrs
13868                 eval $hasproto ;;
13869         *)      ;;
13870         esac
13871         case "$d_random_r_proto" in
13872         define)
13873         case "$random_r_proto" in
13874         ''|0) try='int random_r(int*, struct random_data*);'
13875         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13876         esac
13877         case "$random_r_proto" in
13878         ''|0)   d_random_r=undef
13879                 random_r_proto=0
13880                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13881         * )     case "$random_r_proto" in
13882                 REENTRANT_PROTO*) ;;
13883                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13884                 esac
13885                 echo "Prototype: $try" ;;
13886         esac
13887         ;;
13888         *)      case "$usethreads" in
13889                 define) echo "random_r has no prototype, not using it." >&4 ;;
13890                 esac
13891                 d_random_r=undef
13892                 random_r_proto=0
13893                 ;;
13894         esac
13895         ;;
13896 *)      random_r_proto=0
13897         ;;
13898 esac
13899
13900 : see if readdir and friends exist
13901 set readdir d_readdir
13902 eval $inlibc
13903 set seekdir d_seekdir
13904 eval $inlibc
13905 set telldir d_telldir
13906 eval $inlibc
13907 set rewinddir d_rewinddir
13908 eval $inlibc
13909
13910 : see if readdir64_r exists
13911 set readdir64_r d_readdir64_r
13912 eval $inlibc
13913 case "$d_readdir64_r" in
13914 "$define")
13915         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13916         case "$d_readdir64_r_proto:$usethreads" in
13917         ":define")      d_readdir64_r_proto=define
13918                 set d_readdir64_r_proto readdir64_r $hdrs
13919                 eval $hasproto ;;
13920         *)      ;;
13921         esac
13922         case "$d_readdir64_r_proto" in
13923         define)
13924         case "$readdir64_r_proto" in
13925         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13926         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13927         esac
13928         case "$readdir64_r_proto" in
13929         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13930         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13931         esac
13932         case "$readdir64_r_proto" in
13933         ''|0)   d_readdir64_r=undef
13934                 readdir64_r_proto=0
13935                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13936         * )     case "$readdir64_r_proto" in
13937                 REENTRANT_PROTO*) ;;
13938                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13939                 esac
13940                 echo "Prototype: $try" ;;
13941         esac
13942         ;;
13943         *)      case "$usethreads" in
13944                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13945                 esac
13946                 d_readdir64_r=undef
13947                 readdir64_r_proto=0
13948                 ;;
13949         esac
13950         ;;
13951 *)      readdir64_r_proto=0
13952         ;;
13953 esac
13954
13955 : see if readdir_r exists
13956 set readdir_r d_readdir_r
13957 eval $inlibc
13958 case "$d_readdir_r" in
13959 "$define")
13960         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13961         case "$d_readdir_r_proto:$usethreads" in
13962         ":define")      d_readdir_r_proto=define
13963                 set d_readdir_r_proto readdir_r $hdrs
13964                 eval $hasproto ;;
13965         *)      ;;
13966         esac
13967         case "$d_readdir_r_proto" in
13968         define)
13969         case "$readdir_r_proto" in
13970         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13971         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13972         esac
13973         case "$readdir_r_proto" in
13974         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13975         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13976         esac
13977         case "$readdir_r_proto" in
13978         ''|0)   d_readdir_r=undef
13979                 readdir_r_proto=0
13980                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13981         * )     case "$readdir_r_proto" in
13982                 REENTRANT_PROTO*) ;;
13983                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13984                 esac
13985                 echo "Prototype: $try" ;;
13986         esac
13987         ;;
13988         *)      case "$usethreads" in
13989                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13990                 esac
13991                 d_readdir_r=undef
13992                 readdir_r_proto=0
13993                 ;;
13994         esac
13995         ;;
13996 *)      readdir_r_proto=0
13997         ;;
13998 esac
13999
14000 : see if readv exists
14001 set readv d_readv
14002 eval $inlibc
14003
14004 : see if recvmsg exists
14005 set recvmsg d_recvmsg
14006 eval $inlibc
14007
14008 : see if rename exists
14009 set rename d_rename
14010 eval $inlibc
14011
14012 : see if rmdir exists
14013 set rmdir d_rmdir
14014 eval $inlibc
14015
14016 : see if memory.h is available.
14017 val=''
14018 set memory.h val
14019 eval $inhdr
14020
14021 : See if it conflicts with string.h
14022 case "$val" in
14023 $define)
14024         case "$strings" in
14025         '') ;;
14026         *)
14027                 $cppstdin $cppflags $cppminus < $strings > mem.h
14028                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14029                         echo " "
14030                         echo "We won't be including <memory.h>."
14031                         val="$undef"
14032                 fi
14033                 $rm -f mem.h
14034                 ;;
14035         esac
14036 esac
14037 set i_memory
14038 eval $setvar
14039
14040 : can bcopy handle overlapping blocks?
14041 echo " "
14042 val="$undef"
14043 case "$d_memmove" in
14044 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14045 *)      case "$d_bcopy" in
14046         "$define")
14047                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14048                 $cat >try.c <<EOCP
14049 #$i_memory I_MEMORY
14050 #$i_stdlib I_STDLIB
14051 #$i_string I_STRING
14052 #$i_unistd I_UNISTD
14053 EOCP
14054         $cat >>try.c <<'EOCP'
14055 #include <stdio.h>
14056 #ifdef I_MEMORY
14057 #  include <memory.h>
14058 #endif
14059 #ifdef I_STDLIB
14060 #  include <stdlib.h>
14061 #endif
14062 #ifdef I_STRING
14063 #  include <string.h>
14064 #else
14065 #  include <strings.h>
14066 #endif
14067 #ifdef I_UNISTD
14068 #  include <unistd.h>  /* Needed for NetBSD */
14069 #endif
14070 int main()
14071 {
14072 char buf[128], abc[128];
14073 char *b;
14074 int len;
14075 int off;
14076 int align;
14077
14078 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14079    try to store the string in read-only memory. */
14080 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14081
14082 for (align = 7; align >= 0; align--) {
14083         for (len = 36; len; len--) {
14084                 b = buf+align;
14085                 bcopy(abc, b, len);
14086                 for (off = 1; off <= len; off++) {
14087                         bcopy(b, b+off, len);
14088                         bcopy(b+off, b, len);
14089                         if (bcmp(b, abc, len))
14090                                 exit(1);
14091                 }
14092         }
14093 }
14094 exit(0);
14095 }
14096 EOCP
14097                 set try
14098                 if eval $compile_ok; then
14099                         if ./try 2>/dev/null; then
14100                                 echo "Yes, it can."
14101                                 val="$define"
14102                         else
14103                                 echo "It can't, sorry."
14104                         fi
14105                 else
14106                         echo "(I can't compile the test program, so we'll assume not...)"
14107                 fi
14108                 ;;
14109         esac
14110         $rm -f try.* try core
14111         ;;
14112 esac
14113 set d_safebcpy
14114 eval $setvar
14115
14116 : can memcpy handle overlapping blocks?
14117 echo " "
14118 val="$undef"
14119 case "$d_memmove" in
14120 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14121 *)      case "$d_memcpy" in
14122         "$define")
14123                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14124                 $cat >try.c <<EOCP
14125 #$i_memory I_MEMORY
14126 #$i_stdlib I_STDLIB
14127 #$i_string I_STRING
14128 #$i_unistd I_UNISTD
14129 EOCP
14130         $cat >>try.c <<'EOCP'
14131 #include <stdio.h>
14132 #ifdef I_MEMORY
14133 #  include <memory.h>
14134 #endif
14135 #ifdef I_STDLIB
14136 #  include <stdlib.h>
14137 #endif
14138 #ifdef I_STRING
14139 #  include <string.h>
14140 #else
14141 #  include <strings.h>
14142 #endif
14143 #ifdef I_UNISTD
14144 #  include <unistd.h>  /* Needed for NetBSD */
14145 #endif
14146 int main()
14147 {
14148 char buf[128], abc[128];
14149 char *b;
14150 int len;
14151 int off;
14152 int align;
14153
14154 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14155    try to store the string in read-only memory. */
14156 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14157
14158 for (align = 7; align >= 0; align--) {
14159         for (len = 36; len; len--) {
14160                 b = buf+align;
14161                 memcpy(b, abc, len);
14162                 for (off = 1; off <= len; off++) {
14163                         memcpy(b+off, b, len);
14164                         memcpy(b, b+off, len);
14165                         if (memcmp(b, abc, len))
14166                                 exit(1);
14167                 }
14168         }
14169 }
14170 exit(0);
14171 }
14172 EOCP
14173                 set try
14174                 if eval $compile_ok; then
14175                         if ./try 2>/dev/null; then
14176                                 echo "Yes, it can."
14177                                 val="$define"
14178                         else
14179                                 echo "It can't, sorry."
14180                         fi
14181                 else
14182                         echo "(I can't compile the test program, so we'll assume not...)"
14183                 fi
14184                 ;;
14185         esac
14186         $rm -f try.* try core
14187         ;;
14188 esac
14189 set d_safemcpy
14190 eval $setvar
14191
14192 : can memcmp be trusted to compare relative magnitude?
14193 val="$undef"
14194 case "$d_memcmp" in
14195 "$define")
14196         echo " "
14197         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14198         $cat >try.c <<EOCP
14199 #$i_memory I_MEMORY
14200 #$i_stdlib I_STDLIB
14201 #$i_string I_STRING
14202 #$i_unistd I_UNISTD
14203 EOCP
14204         $cat >>try.c <<'EOCP'
14205 #include <stdio.h>
14206 #ifdef I_MEMORY
14207 #  include <memory.h>
14208 #endif
14209 #ifdef I_STDLIB
14210 #  include <stdlib.h>
14211 #endif
14212 #ifdef I_STRING
14213 #  include <string.h>
14214 #else
14215 #  include <strings.h>
14216 #endif
14217 #ifdef I_UNISTD
14218 #  include <unistd.h>  /* Needed for NetBSD */
14219 #endif
14220 int main()
14221 {
14222 char a = -1;
14223 char b = 0;
14224 if ((a < b) && memcmp(&a, &b, 1) < 0)
14225         exit(1);
14226 exit(0);
14227 }
14228 EOCP
14229         set try
14230         if eval $compile_ok; then
14231                 if $run ./try 2>/dev/null; then
14232                         echo "Yes, it can."
14233                         val="$define"
14234                 else
14235                         echo "No, it can't (it uses signed chars)."
14236                 fi
14237         else
14238                 echo "(I can't compile the test program, so we'll assume not...)"
14239         fi
14240         ;;
14241 esac
14242 $rm -f try.* try core
14243 set d_sanemcmp
14244 eval $setvar
14245
14246 : see if prototype for sbrk is available
14247 echo " "
14248 set d_sbrkproto sbrk $i_unistd unistd.h
14249 eval $hasproto
14250
14251 : see if select exists
14252 set select d_select
14253 eval $inlibc
14254
14255 : see if semctl exists
14256 set semctl d_semctl
14257 eval $inlibc
14258
14259 : see if semget exists
14260 set semget d_semget
14261 eval $inlibc
14262
14263 : see if semop exists
14264 set semop d_semop
14265 eval $inlibc
14266
14267 : see how much of the 'sem*(2)' library is present.
14268 h_sem=true
14269 echo " "
14270 case "$d_semctl$d_semget$d_semop" in
14271 *"$undef"*) h_sem=false;;
14272 esac
14273 case "$osname" in
14274 freebsd)
14275     case "`ipcs 2>&1`" in
14276     "SVID messages"*"not configured"*)
14277         echo "Your $osname does not have the sem*(2) configured." >&4
14278         h_sem=false
14279         val="$undef"
14280         set semctl d_semctl
14281         eval $setvar
14282         set semget d_semget
14283         eval $setvar
14284         set semop d_semop
14285         eval $setvar
14286         ;;
14287     esac
14288     ;;
14289 esac
14290 : we could also check for sys/ipc.h ...
14291 if $h_sem && $test `./findhdr sys/sem.h`; then
14292         echo "You have the full sem*(2) library." >&4
14293         val="$define"
14294 else
14295         echo "You don't have the full sem*(2) library." >&4
14296         val="$undef"
14297 fi
14298 set d_sem
14299 eval $setvar
14300
14301 : see whether sys/sem.h defines union semun
14302 echo " "
14303 $cat > try.c <<'END'
14304 #include <sys/types.h>
14305 #include <sys/ipc.h>
14306 #include <sys/sem.h>
14307 int main () { union semun semun; semun.buf = 0; }
14308 END
14309 set try
14310 if eval $compile; then
14311     echo "You have union semun in <sys/sem.h>." >&4
14312     val="$define"
14313 else
14314     echo "You do not have union semun in <sys/sem.h>." >&4
14315     val="$undef"
14316 fi
14317 $rm -f try try.c try.h
14318 set d_union_semun
14319 eval $setvar
14320
14321 : see how to do semctl IPC_STAT
14322 case "$d_sem" in
14323 $define)
14324     : see whether semctl IPC_STAT can use union semun
14325     echo " "
14326     $cat > try.h <<END
14327 #ifndef S_IRUSR
14328 #   ifdef S_IREAD
14329 #       define S_IRUSR S_IREAD
14330 #       define S_IWUSR S_IWRITE
14331 #       define S_IXUSR S_IEXEC
14332 #   else
14333 #       define S_IRUSR 0400
14334 #       define S_IWUSR 0200
14335 #       define S_IXUSR 0100
14336 #   endif
14337 #   define S_IRGRP (S_IRUSR>>3)
14338 #   define S_IWGRP (S_IWUSR>>3)
14339 #   define S_IXGRP (S_IXUSR>>3)
14340 #   define S_IROTH (S_IRUSR>>6)
14341 #   define S_IWOTH (S_IWUSR>>6)
14342 #   define S_IXOTH (S_IXUSR>>6)
14343 #endif
14344 #ifndef S_IRWXU
14345 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14346 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14347 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14348 #endif
14349 END
14350
14351     $cat > try.c <<END
14352 #include <sys/types.h>
14353 #include <sys/ipc.h>
14354 #include <sys/sem.h>
14355 #include <sys/stat.h>
14356 #include <stdio.h>
14357 #include <errno.h>
14358 #include "try.h"
14359 #ifndef errno
14360 extern int errno;
14361 #endif
14362 #$d_union_semun HAS_UNION_SEMUN
14363 int main() {
14364     union semun
14365 #ifndef HAS_UNION_SEMUN
14366     {
14367         int val;
14368         struct semid_ds *buf;
14369         unsigned short *array;
14370     }
14371 #endif
14372     arg;
14373     int sem, st;
14374
14375 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14376     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14377     if (sem > -1) {
14378         struct semid_ds argbuf;
14379         arg.buf = &argbuf;
14380 #       ifdef IPC_STAT
14381         st = semctl(sem, 0, IPC_STAT, arg);
14382         if (st == 0)
14383             printf("semun\n");
14384         else
14385 #       endif /* IPC_STAT */
14386             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14387 #       ifdef IPC_RMID
14388         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14389 #       endif /* IPC_RMID */
14390             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14391     } else
14392 #endif /* IPC_PRIVATE && ... */
14393         printf("semget failed: errno = %d\n", errno);
14394   return 0;
14395 }
14396 END
14397     val="$undef"
14398     set try
14399     if eval $compile; then
14400         xxx=`$run ./try`
14401         case "$xxx" in
14402         semun) val="$define" ;;
14403         esac
14404     fi
14405     $rm -f try try.c
14406     set d_semctl_semun
14407     eval $setvar
14408     case "$d_semctl_semun" in
14409     $define)
14410         echo "You can use union semun for semctl IPC_STAT." >&4
14411         also='also'
14412         ;;
14413     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14414         also=''
14415         ;;
14416     esac
14417
14418     : see whether semctl IPC_STAT can use struct semid_ds pointer
14419     $cat > try.c <<'END'
14420 #include <sys/types.h>
14421 #include <sys/ipc.h>
14422 #include <sys/sem.h>
14423 #include <sys/stat.h>
14424 #include "try.h"
14425 #include <stdio.h>
14426 #include <errno.h>
14427 #ifndef errno
14428 extern int errno;
14429 #endif
14430 int main() {
14431     struct semid_ds arg;
14432     int sem, st;
14433
14434 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14435     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14436     if (sem > -1) {
14437 #       ifdef IPC_STAT
14438         st = semctl(sem, 0, IPC_STAT, &arg);
14439         if (st == 0)
14440             printf("semid_ds\n");
14441         else
14442 #       endif /* IPC_STAT */
14443             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14444 #       ifdef IPC_RMID
14445         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14446 #       endif /* IPC_RMID */
14447             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14448     } else
14449 #endif /* IPC_PRIVATE && ... */
14450         printf("semget failed: errno = %d\n", errno);
14451
14452     return 0;
14453 }
14454 END
14455     val="$undef"
14456     set try
14457     if eval $compile; then
14458         xxx=`$run ./try`
14459         case "$xxx" in
14460         semid_ds) val="$define" ;;
14461         esac
14462     fi
14463     $rm -f try try.c
14464     set d_semctl_semid_ds
14465     eval $setvar
14466     case "$d_semctl_semid_ds" in
14467     $define)
14468         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14469         ;;
14470     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14471         ;;
14472     esac
14473     $rm -f try.h
14474     ;;
14475 *)  val="$undef"
14476
14477     # We do not have the full sem*(2) library, so assume we can not
14478     # use either.
14479
14480     set d_semctl_semun
14481     eval $setvar
14482
14483     set d_semctl_semid_ds
14484     eval $setvar
14485     ;;
14486 esac
14487
14488 : see if sendmsg exists
14489 set sendmsg d_sendmsg
14490 eval $inlibc
14491
14492 : see if setegid exists
14493 set setegid d_setegid
14494 eval $inlibc
14495
14496 : see if seteuid exists
14497 set seteuid d_seteuid
14498 eval $inlibc
14499
14500 : see if setgrent exists
14501 set setgrent d_setgrent
14502 eval $inlibc
14503
14504 : see if setgrent_r exists
14505 set setgrent_r d_setgrent_r
14506 eval $inlibc
14507 case "$d_setgrent_r" in
14508 "$define")
14509         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14510         case "$d_setgrent_r_proto:$usethreads" in
14511         ":define")      d_setgrent_r_proto=define
14512                 set d_setgrent_r_proto setgrent_r $hdrs
14513                 eval $hasproto ;;
14514         *)      ;;
14515         esac
14516         case "$d_setgrent_r_proto" in
14517         define)
14518         case "$setgrent_r_proto" in
14519         ''|0) try='int setgrent_r(FILE**);'
14520         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14521         esac
14522         case "$setgrent_r_proto" in
14523         ''|0) try='void setgrent_r(FILE**);'
14524         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14525         esac
14526         case "$setgrent_r_proto" in
14527         ''|0)   d_setgrent_r=undef
14528                 setgrent_r_proto=0
14529                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14530         * )     case "$setgrent_r_proto" in
14531                 REENTRANT_PROTO*) ;;
14532                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14533                 esac
14534                 echo "Prototype: $try" ;;
14535         esac
14536         ;;
14537         *)      case "$usethreads" in
14538                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14539                 esac
14540                 d_setgrent_r=undef
14541                 setgrent_r_proto=0
14542                 ;;
14543         esac
14544         ;;
14545 *)      setgrent_r_proto=0
14546         ;;
14547 esac
14548
14549 : see if sethostent exists
14550 set sethostent d_sethent
14551 eval $inlibc
14552
14553 : see if sethostent_r exists
14554 set sethostent_r d_sethostent_r
14555 eval $inlibc
14556 case "$d_sethostent_r" in
14557 "$define")
14558         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14559         case "$d_sethostent_r_proto:$usethreads" in
14560         ":define")      d_sethostent_r_proto=define
14561                 set d_sethostent_r_proto sethostent_r $hdrs
14562                 eval $hasproto ;;
14563         *)      ;;
14564         esac
14565         case "$d_sethostent_r_proto" in
14566         define)
14567         case "$sethostent_r_proto" in
14568         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14569         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14570         esac
14571         case "$sethostent_r_proto" in
14572         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14573         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14574         esac
14575         case "$sethostent_r_proto" in
14576         ''|0)   d_sethostent_r=undef
14577                 sethostent_r_proto=0
14578                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14579         * )     case "$sethostent_r_proto" in
14580                 REENTRANT_PROTO*) ;;
14581                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14582                 esac
14583                 echo "Prototype: $try" ;;
14584         esac
14585         ;;
14586         *)      case "$usethreads" in
14587                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14588                 esac
14589                 d_sethostent_r=undef
14590                 sethostent_r_proto=0
14591                 ;;
14592         esac
14593         ;;
14594 *)      sethostent_r_proto=0
14595         ;;
14596 esac
14597
14598 : see if setitimer exists
14599 set setitimer d_setitimer
14600 eval $inlibc
14601
14602 : see if setlinebuf exists
14603 set setlinebuf d_setlinebuf
14604 eval $inlibc
14605
14606 : see if setlocale exists
14607 set setlocale d_setlocale
14608 eval $inlibc
14609
14610 : see if locale.h is available
14611 set locale.h i_locale
14612 eval $inhdr
14613
14614 : see if setlocale_r exists
14615 set setlocale_r d_setlocale_r
14616 eval $inlibc
14617 case "$d_setlocale_r" in
14618 "$define")
14619         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14620         case "$d_setlocale_r_proto:$usethreads" in
14621         ":define")      d_setlocale_r_proto=define
14622                 set d_setlocale_r_proto setlocale_r $hdrs
14623                 eval $hasproto ;;
14624         *)      ;;
14625         esac
14626         case "$d_setlocale_r_proto" in
14627         define)
14628         case "$setlocale_r_proto" in
14629         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14630         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14631         esac
14632         case "$setlocale_r_proto" in
14633         ''|0)   d_setlocale_r=undef
14634                 setlocale_r_proto=0
14635                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14636         * )     case "$setlocale_r_proto" in
14637                 REENTRANT_PROTO*) ;;
14638                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14639                 esac
14640                 echo "Prototype: $try" ;;
14641         esac
14642         ;;
14643         *)      case "$usethreads" in
14644                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14645                 esac
14646                 d_setlocale_r=undef
14647                 setlocale_r_proto=0
14648                 ;;
14649         esac
14650         ;;
14651 *)      setlocale_r_proto=0
14652         ;;
14653 esac
14654
14655 : see if setnetent exists
14656 set setnetent d_setnent
14657 eval $inlibc
14658
14659 : see if setnetent_r exists
14660 set setnetent_r d_setnetent_r
14661 eval $inlibc
14662 case "$d_setnetent_r" in
14663 "$define")
14664         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14665         case "$d_setnetent_r_proto:$usethreads" in
14666         ":define")      d_setnetent_r_proto=define
14667                 set d_setnetent_r_proto setnetent_r $hdrs
14668                 eval $hasproto ;;
14669         *)      ;;
14670         esac
14671         case "$d_setnetent_r_proto" in
14672         define)
14673         case "$setnetent_r_proto" in
14674         ''|0) try='int setnetent_r(int, struct netent_data*);'
14675         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14676         esac
14677         case "$setnetent_r_proto" in
14678         ''|0) try='void setnetent_r(int, struct netent_data*);'
14679         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14680         esac
14681         case "$setnetent_r_proto" in
14682         ''|0)   d_setnetent_r=undef
14683                 setnetent_r_proto=0
14684                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14685         * )     case "$setnetent_r_proto" in
14686                 REENTRANT_PROTO*) ;;
14687                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14688                 esac
14689                 echo "Prototype: $try" ;;
14690         esac
14691         ;;
14692         *)      case "$usethreads" in
14693                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14694                 esac
14695                 d_setnetent_r=undef
14696                 setnetent_r_proto=0
14697                 ;;
14698         esac
14699         ;;
14700 *)      setnetent_r_proto=0
14701         ;;
14702 esac
14703
14704 : see if setprotoent exists
14705 set setprotoent d_setpent
14706 eval $inlibc
14707
14708 : see if setpgid exists
14709 set setpgid d_setpgid
14710 eval $inlibc
14711
14712 : see if setpgrp2 exists
14713 set setpgrp2 d_setpgrp2
14714 eval $inlibc
14715
14716 : see if setpriority exists
14717 set setpriority d_setprior
14718 eval $inlibc
14719
14720 : see if setproctitle exists
14721 set setproctitle d_setproctitle
14722 eval $inlibc
14723
14724 : see if setprotoent_r exists
14725 set setprotoent_r d_setprotoent_r
14726 eval $inlibc
14727 case "$d_setprotoent_r" in
14728 "$define")
14729         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14730         case "$d_setprotoent_r_proto:$usethreads" in
14731         ":define")      d_setprotoent_r_proto=define
14732                 set d_setprotoent_r_proto setprotoent_r $hdrs
14733                 eval $hasproto ;;
14734         *)      ;;
14735         esac
14736         case "$d_setprotoent_r_proto" in
14737         define)
14738         case "$setprotoent_r_proto" in
14739         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14740         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14741         esac
14742         case "$setprotoent_r_proto" in
14743         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14744         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14745         esac
14746         case "$setprotoent_r_proto" in
14747         ''|0)   d_setprotoent_r=undef
14748                 setprotoent_r_proto=0
14749                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14750         * )     case "$setprotoent_r_proto" in
14751                 REENTRANT_PROTO*) ;;
14752                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14753                 esac
14754                 echo "Prototype: $try" ;;
14755         esac
14756         ;;
14757         *)      case "$usethreads" in
14758                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14759                 esac
14760                 d_setprotoent_r=undef
14761                 setprotoent_r_proto=0
14762                 ;;
14763         esac
14764         ;;
14765 *)      setprotoent_r_proto=0
14766         ;;
14767 esac
14768
14769 : see if setpwent exists
14770 set setpwent d_setpwent
14771 eval $inlibc
14772
14773 : see if setpwent_r exists
14774 set setpwent_r d_setpwent_r
14775 eval $inlibc
14776 case "$d_setpwent_r" in
14777 "$define")
14778         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14779         case "$d_setpwent_r_proto:$usethreads" in
14780         ":define")      d_setpwent_r_proto=define
14781                 set d_setpwent_r_proto setpwent_r $hdrs
14782                 eval $hasproto ;;
14783         *)      ;;
14784         esac
14785         case "$d_setpwent_r_proto" in
14786         define)
14787         case "$setpwent_r_proto" in
14788         ''|0) try='int setpwent_r(FILE**);'
14789         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14790         esac
14791         case "$setpwent_r_proto" in
14792         ''|0) try='void setpwent_r(FILE**);'
14793         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14794         esac
14795         case "$setpwent_r_proto" in
14796         ''|0)   d_setpwent_r=undef
14797                 setpwent_r_proto=0
14798                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14799         * )     case "$setpwent_r_proto" in
14800                 REENTRANT_PROTO*) ;;
14801                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14802                 esac
14803                 echo "Prototype: $try" ;;
14804         esac
14805         ;;
14806         *)      case "$usethreads" in
14807                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14808                 esac
14809                 d_setpwent_r=undef
14810                 setpwent_r_proto=0
14811                 ;;
14812         esac
14813         ;;
14814 *)      setpwent_r_proto=0
14815         ;;
14816 esac
14817
14818 : see if setregid exists
14819 set setregid d_setregid
14820 eval $inlibc
14821 set setresgid d_setresgid
14822 eval $inlibc
14823
14824 : see if setreuid exists
14825 set setreuid d_setreuid
14826 eval $inlibc
14827 set setresuid d_setresuid
14828 eval $inlibc
14829
14830 : see if setrgid exists
14831 set setrgid d_setrgid
14832 eval $inlibc
14833
14834 : see if setruid exists
14835 set setruid d_setruid
14836 eval $inlibc
14837
14838 : see if setservent exists
14839 set setservent d_setsent
14840 eval $inlibc
14841
14842 : see if setservent_r exists
14843 set setservent_r d_setservent_r
14844 eval $inlibc
14845 case "$d_setservent_r" in
14846 "$define")
14847         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14848         case "$d_setservent_r_proto:$usethreads" in
14849         ":define")      d_setservent_r_proto=define
14850                 set d_setservent_r_proto setservent_r $hdrs
14851                 eval $hasproto ;;
14852         *)      ;;
14853         esac
14854         case "$d_setservent_r_proto" in
14855         define)
14856         case "$setservent_r_proto" in
14857         ''|0) try='int setservent_r(int, struct servent_data*);'
14858         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14859         esac
14860         case "$setservent_r_proto" in
14861         ''|0) try='void setservent_r(int, struct servent_data*);'
14862         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14863         esac
14864         case "$setservent_r_proto" in
14865         ''|0)   d_setservent_r=undef
14866                 setservent_r_proto=0
14867                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14868         * )     case "$setservent_r_proto" in
14869                 REENTRANT_PROTO*) ;;
14870                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14871                 esac
14872                 echo "Prototype: $try" ;;
14873         esac
14874         ;;
14875         *)      case "$usethreads" in
14876                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14877                 esac
14878                 d_setservent_r=undef
14879                 setservent_r_proto=0
14880                 ;;
14881         esac
14882         ;;
14883 *)      setservent_r_proto=0
14884         ;;
14885 esac
14886
14887 : see if setsid exists
14888 set setsid d_setsid
14889 eval $inlibc
14890
14891 : see if setvbuf exists
14892 set setvbuf d_setvbuf
14893 eval $inlibc
14894
14895 : see if sfio.h is available
14896 set sfio.h i_sfio
14897 eval $inhdr
14898
14899
14900 : see if sfio library is available
14901 case "$i_sfio" in
14902 $define)
14903         val=''
14904         set sfreserve val
14905         eval $inlibc
14906         ;;
14907 *)
14908         val="$undef"
14909         ;;
14910 esac
14911 : Ok, but do we want to use it.
14912 case "$val" in
14913 $define)
14914         case "$usesfio" in
14915         true|$define|[yY]*) dflt='y';;
14916         *) dflt='n';;
14917         esac
14918         echo "$package can use the sfio library, but it is experimental."
14919         case "$useperlio" in
14920         "$undef")
14921             echo "For sfio also the PerlIO abstraction layer is needed."
14922             echo "Earlier you said you wouldn't want that."
14923             ;;
14924         esac
14925         rp="You seem to have sfio available, do you want to try using it?"
14926         . ./myread
14927         case "$ans" in
14928         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14929                 useperlio="$define"
14930                 val="$define"
14931                 ;;
14932         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14933                 val="$undef"
14934                 ;;
14935         esac
14936         ;;
14937 *)      case "$usesfio" in
14938         true|$define|[yY]*)
14939                 echo "Sorry, cannot find sfio on this machine." >&4
14940                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14941                 val="$undef"
14942                 ;;
14943         esac
14944         ;;
14945 esac
14946 set d_sfio
14947 eval $setvar
14948 case "$d_sfio" in
14949 $define) usesfio='true';;
14950 *) usesfio='false';;
14951 esac
14952 case "$d_sfio" in
14953 $define) ;;
14954 *)      : Remove sfio from list of libraries to use
14955         case "$libs" in
14956         *-lsfio*)
14957                 echo "Removing unneeded -lsfio from library list" >&4
14958                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14959                 shift
14960                 libs="$*"
14961                 echo "libs = $libs" >&4
14962                 ;;
14963         esac
14964 ;;
14965 esac
14966
14967
14968 : see if shmctl exists
14969 set shmctl d_shmctl
14970 eval $inlibc
14971
14972 : see if shmget exists
14973 set shmget d_shmget
14974 eval $inlibc
14975
14976 : see if shmat exists
14977 set shmat d_shmat
14978 eval $inlibc
14979 : see what shmat returns
14980 case "$d_shmat" in
14981 "$define")
14982         $cat >shmat.c <<'END'
14983 #include <sys/shm.h>
14984 void *shmat();
14985 END
14986         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14987                 shmattype='void *'
14988         else
14989                 shmattype='char *'
14990         fi
14991         echo "and it returns ($shmattype)." >&4
14992         : see if a prototype for shmat is available
14993         xxx=`./findhdr sys/shm.h`
14994         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14995         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14996                 val="$define"
14997         else
14998                 val="$undef"
14999         fi
15000         $rm -f shmat.[co]
15001         ;;
15002 *)
15003         val="$undef"
15004         ;;
15005 esac
15006 set d_shmatprototype
15007 eval $setvar
15008
15009 : see if shmdt exists
15010 set shmdt d_shmdt
15011 eval $inlibc
15012
15013 : see how much of the 'shm*(2)' library is present.
15014 h_shm=true
15015 echo " "
15016 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15017 *"$undef"*) h_shm=false;;
15018 esac
15019 case "$osname" in
15020 freebsd)
15021     case "`ipcs 2>&1`" in
15022     "SVID shared memory"*"not configured"*)
15023         echo "Your $osname does not have the shm*(2) configured." >&4
15024         h_shm=false
15025         val="$undef"
15026         set shmctl d_shmctl
15027         evat $setvar
15028         set shmget d_shmget
15029         evat $setvar
15030         set shmat d_shmat
15031         evat $setvar
15032         set shmdt d_shmdt
15033         evat $setvar
15034         ;;
15035     esac
15036     ;;
15037 esac
15038 : we could also check for sys/ipc.h ...
15039 if $h_shm && $test `./findhdr sys/shm.h`; then
15040         echo "You have the full shm*(2) library." >&4
15041         val="$define"
15042 else
15043         echo "You don't have the full shm*(2) library." >&4
15044         val="$undef"
15045 fi
15046 set d_shm
15047 eval $setvar
15048
15049 echo " "
15050 : see if we have sigaction
15051 if set sigaction val -f d_sigaction; eval $csym; $val; then
15052         echo 'sigaction() found.' >&4
15053         $cat > try.c <<'EOP'
15054 #include <stdio.h>
15055 #include <sys/types.h>
15056 #include <signal.h>
15057 int main()
15058 {
15059     struct sigaction act, oact;
15060     act.sa_flags = 0;
15061     oact.sa_handler = 0;
15062     /* so that act and oact are used */
15063     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15064 }
15065 EOP
15066         set try
15067         if eval $compile_ok; then
15068                 val="$define"
15069         else
15070                 echo "But you don't seem to have a useable struct sigaction." >&4
15071                 val="$undef"
15072         fi
15073 else
15074         echo 'sigaction NOT found.' >&4
15075         val="$undef"
15076 fi
15077 set d_sigaction; eval $setvar
15078 $rm -f try try$_o try.c
15079
15080 : see if sigprocmask exists
15081 set sigprocmask d_sigprocmask
15082 eval $inlibc
15083
15084 : see if sigsetjmp exists
15085 echo " "
15086 case "$d_sigsetjmp" in
15087 '')
15088         $cat >try.c <<'EOP'
15089 #include <setjmp.h>
15090 sigjmp_buf env;
15091 int set = 1;
15092 int main()
15093 {
15094         if (sigsetjmp(env,1))
15095                 exit(set);
15096         set = 0;
15097         siglongjmp(env, 1);
15098         exit(1);
15099 }
15100 EOP
15101         set try
15102         if eval $compile; then
15103                 if $run ./try >/dev/null 2>&1; then
15104                         echo "POSIX sigsetjmp found." >&4
15105                         val="$define"
15106                 else
15107                         $cat >&4 <<EOM
15108 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15109 I'll ignore them.
15110 EOM
15111                         val="$undef"
15112                 fi
15113         else
15114                 echo "sigsetjmp not found." >&4
15115                 val="$undef"
15116         fi
15117         ;;
15118 *) val="$d_sigsetjmp"
15119         case "$d_sigsetjmp" in
15120         $define) echo "POSIX sigsetjmp found." >&4;;
15121         $undef) echo "sigsetjmp not found." >&4;;
15122         esac
15123         ;;
15124 esac
15125 set d_sigsetjmp
15126 eval $setvar
15127 $rm -f try.c try
15128
15129 : see if sockatmark exists
15130 set sockatmark d_sockatmark
15131 eval $inlibc
15132
15133 : see if prototype for sockatmark is available
15134 echo " "
15135 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15136 eval $hasproto
15137
15138 : see if socks5_init exists
15139 set socks5_init d_socks5_init
15140 eval $inlibc
15141
15142 : see if srand48_r exists
15143 set srand48_r d_srand48_r
15144 eval $inlibc
15145 case "$d_srand48_r" in
15146 "$define")
15147         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15148         case "$d_srand48_r_proto:$usethreads" in
15149         ":define")      d_srand48_r_proto=define
15150                 set d_srand48_r_proto srand48_r $hdrs
15151                 eval $hasproto ;;
15152         *)      ;;
15153         esac
15154         case "$d_srand48_r_proto" in
15155         define)
15156         case "$srand48_r_proto" in
15157         ''|0) try='int srand48_r(long, struct drand48_data*);'
15158         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15159         esac
15160         case "$srand48_r_proto" in
15161         ''|0)   d_srand48_r=undef
15162                 srand48_r_proto=0
15163                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15164         * )     case "$srand48_r_proto" in
15165                 REENTRANT_PROTO*) ;;
15166                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15167                 esac
15168                 echo "Prototype: $try" ;;
15169         esac
15170         ;;
15171         *)      case "$usethreads" in
15172                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15173                 esac
15174                 d_srand48_r=undef
15175                 srand48_r_proto=0
15176                 ;;
15177         esac
15178         ;;
15179 *)      srand48_r_proto=0
15180         ;;
15181 esac
15182
15183 : see if srandom_r exists
15184 set srandom_r d_srandom_r
15185 eval $inlibc
15186 case "$d_srandom_r" in
15187 "$define")
15188         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15189         case "$d_srandom_r_proto:$usethreads" in
15190         ":define")      d_srandom_r_proto=define
15191                 set d_srandom_r_proto srandom_r $hdrs
15192                 eval $hasproto ;;
15193         *)      ;;
15194         esac
15195         case "$d_srandom_r_proto" in
15196         define)
15197         case "$srandom_r_proto" in
15198         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15199         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15200         esac
15201         case "$srandom_r_proto" in
15202         ''|0)   d_srandom_r=undef
15203                 srandom_r_proto=0
15204                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15205         * )     case "$srandom_r_proto" in
15206                 REENTRANT_PROTO*) ;;
15207                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15208                 esac
15209                 echo "Prototype: $try" ;;
15210         esac
15211         ;;
15212         *)      case "$usethreads" in
15213                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15214                 esac
15215                 d_srandom_r=undef
15216                 srandom_r_proto=0
15217                 ;;
15218         esac
15219         ;;
15220 *)      srandom_r_proto=0
15221         ;;
15222 esac
15223
15224 : see if prototype for setresgid is available
15225 echo " "
15226 set d_sresgproto setresgid $i_unistd unistd.h
15227 eval $hasproto
15228
15229 : see if prototype for setresuid is available
15230 echo " "
15231 set d_sresuproto setresuid $i_unistd unistd.h
15232 eval $hasproto
15233
15234 : see if sys/stat.h is available
15235 set sys/stat.h i_sysstat
15236 eval $inhdr
15237
15238
15239 : see if stat knows about block sizes
15240 echo " "
15241 echo "Checking to see if your struct stat has st_blocks field..." >&4
15242 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15243 eval $hasfield
15244
15245
15246 : see if this is a sys/vfs.h system
15247 set sys/vfs.h i_sysvfs
15248 eval $inhdr
15249
15250
15251 : see if this is a sys/statfs.h system
15252 set sys/statfs.h i_sysstatfs
15253 eval $inhdr
15254
15255
15256 echo " "
15257 echo "Checking to see if your system supports struct statfs..." >&4
15258 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
15259 eval $hasstruct
15260 case "$d_statfs_s" in
15261 "$define")      echo "Yes, it does."   ;;
15262 *)              echo "No, it doesn't." ;;
15263 esac
15264
15265
15266
15267 : see if struct statfs knows about f_flags
15268 case "$d_statfs_s" in
15269 define) 
15270         echo " "
15271         echo "Checking to see if your struct statfs has f_flags field..." >&4
15272         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
15273         eval $hasfield
15274         ;;
15275 *)      val="$undef"
15276         set d_statfs_f_flags
15277         eval $setvar
15278         ;;
15279 esac
15280 case "$d_statfs_f_flags" in
15281 "$define")      echo "Yes, it does."   ;;
15282 *)              echo "No, it doesn't." ;;
15283 esac
15284
15285 : see if _ptr and _cnt from stdio act std
15286 echo " "
15287
15288 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15289         echo "(Looks like you have stdio.h from BSD.)"
15290         case "$stdio_ptr" in
15291         '') stdio_ptr='((fp)->_p)'
15292                 ptr_lval=$define
15293                 ;;
15294         *)      ptr_lval=$d_stdio_ptr_lval;;
15295         esac
15296         case "$stdio_cnt" in
15297         '') stdio_cnt='((fp)->_r)'
15298                 cnt_lval=$define
15299                 ;;
15300         *)      cnt_lval=$d_stdio_cnt_lval;;
15301         esac
15302         case "$stdio_base" in
15303         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15304         esac
15305         case "$stdio_bufsiz" in
15306         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15307         esac
15308 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15309         echo "(Looks like you have stdio.h from Linux.)"
15310         case "$stdio_ptr" in
15311         '') stdio_ptr='((fp)->_IO_read_ptr)'
15312                 ptr_lval=$define
15313                 ;;
15314         *)      ptr_lval=$d_stdio_ptr_lval;;
15315         esac
15316         case "$stdio_cnt" in
15317         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15318                 cnt_lval=$undef
15319                 ;;
15320         *)      cnt_lval=$d_stdio_cnt_lval;;
15321         esac
15322         case "$stdio_base" in
15323         '') stdio_base='((fp)->_IO_read_base)';;
15324         esac
15325         case "$stdio_bufsiz" in
15326         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15327         esac
15328 else
15329         case "$stdio_ptr" in
15330         '') stdio_ptr='((fp)->_ptr)'
15331                 ptr_lval=$define
15332                 ;;
15333         *)      ptr_lval=$d_stdio_ptr_lval;;
15334         esac
15335         case "$stdio_cnt" in
15336         '') stdio_cnt='((fp)->_cnt)'
15337                 cnt_lval=$define
15338                 ;;
15339         *)      cnt_lval=$d_stdio_cnt_lval;;
15340         esac
15341         case "$stdio_base" in
15342         '') stdio_base='((fp)->_base)';;
15343         esac
15344         case "$stdio_bufsiz" in
15345         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15346         esac
15347 fi
15348
15349 : test whether _ptr and _cnt really work
15350 echo "Checking how std your stdio is..." >&4
15351 $cat >try.c <<EOP
15352 #include <stdio.h>
15353 #define FILE_ptr(fp)    $stdio_ptr
15354 #define FILE_cnt(fp)    $stdio_cnt
15355 int main() {
15356         FILE *fp = fopen("try.c", "r");
15357         char c = getc(fp);
15358         if (
15359                 18 <= FILE_cnt(fp) &&
15360                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15361         )
15362                 exit(0);
15363         exit(1);
15364 }
15365 EOP
15366 val="$undef"
15367 set try
15368 if eval $compile && $to try.c; then
15369         if $run ./try; then
15370                 echo "Your stdio acts pretty std."
15371                 val="$define"
15372         else
15373                 echo "Your stdio isn't very std."
15374         fi
15375 else
15376         echo "Your stdio doesn't appear very std."
15377 fi
15378 $rm -f try.c try
15379
15380 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15381 # direct buffer manipulation no longer works.  The Configure tests
15382 # should be changed to correctly detect this, but until then,
15383 # the following check should at least let perl compile and run.
15384 # (This quick fix should be updated before 5.8.1.)
15385 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15386 # A. Dougherty, June 3, 2002.
15387 case "$d_gnulibc" in
15388 $define)
15389         case "$gnulibc_version" in
15390         2.[01]*)  ;;
15391         2.2) ;;
15392         2.2.[0-9]) ;;
15393         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15394                 val="$undef"
15395                 ;;
15396         esac
15397         ;;
15398 esac
15399 set d_stdstdio
15400 eval $setvar
15401
15402 : Can _ptr be used as an lvalue?
15403 case "$d_stdstdio$ptr_lval" in
15404 $define$define) val=$define ;;
15405 *) val=$undef ;;
15406 esac
15407 set d_stdio_ptr_lval
15408 eval $setvar
15409
15410 : Can _cnt be used as an lvalue?
15411 case "$d_stdstdio$cnt_lval" in
15412 $define$define) val=$define ;;
15413 *) val=$undef ;;
15414 esac
15415 set d_stdio_cnt_lval
15416 eval $setvar
15417
15418
15419 : test whether setting _ptr sets _cnt as a side effect
15420 d_stdio_ptr_lval_sets_cnt="$undef"
15421 d_stdio_ptr_lval_nochange_cnt="$undef"
15422 case "$d_stdio_ptr_lval$d_stdstdio" in
15423 $define$define)
15424         echo "Checking to see what happens if we set the stdio ptr..." >&4
15425 $cat >try.c <<EOP
15426 #include <stdio.h>
15427 /* Can we scream? */
15428 /* Eat dust sed :-) */
15429 /* In the buffer space, no one can hear you scream. */
15430 #define FILE_ptr(fp)    $stdio_ptr
15431 #define FILE_cnt(fp)    $stdio_cnt
15432 #include <sys/types.h>
15433 int main() {
15434         FILE *fp = fopen("try.c", "r");
15435         int c;
15436         char *ptr;
15437         size_t cnt;
15438         if (!fp) {
15439             puts("Fail even to read");
15440             exit(1);
15441         }
15442         c = getc(fp); /* Read away the first # */
15443         if (c == EOF) {
15444             puts("Fail even to read");
15445             exit(1);
15446         }
15447         if (!(
15448                 18 <= FILE_cnt(fp) &&
15449                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15450         )) {
15451                 puts("Fail even to read");
15452                 exit (1);
15453         }
15454         ptr = (char*) FILE_ptr(fp);
15455         cnt = (size_t)FILE_cnt(fp);
15456
15457         FILE_ptr(fp) += 42;
15458
15459         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15460                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15461                 exit (1);
15462         }
15463         if (FILE_cnt(fp) <= 20) {
15464                 printf ("Fail (<20 chars to test)");
15465                 exit (1);
15466         }
15467         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15468                 puts("Fail compare");
15469                 exit (1);
15470         }
15471         if (cnt == FILE_cnt(fp)) {
15472                 puts("Pass_unchanged");
15473                 exit (0);
15474         }       
15475         if (FILE_cnt(fp) == (cnt - 42)) {
15476                 puts("Pass_changed");
15477                 exit (0);
15478         }
15479         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15480         return 1;
15481
15482 }
15483 EOP
15484         set try
15485         if eval $compile && $to try.c; then
15486                 case `$run ./try` in
15487                 Pass_changed)
15488                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15489                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15490                 Pass_unchanged)
15491                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15492                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15493                 Fail*)
15494                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15495                 *)
15496                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15497         esac
15498         else
15499                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15500         fi
15501         $rm -f try.c try
15502         ;;
15503 esac
15504
15505 : see if _base is also standard
15506 val="$undef"
15507 case "$d_stdstdio" in
15508 $define)
15509         $cat >try.c <<EOP
15510 #include <stdio.h>
15511 #define FILE_base(fp)   $stdio_base
15512 #define FILE_bufsiz(fp) $stdio_bufsiz
15513 int main() {
15514         FILE *fp = fopen("try.c", "r");
15515         char c = getc(fp);
15516         if (
15517                 19 <= FILE_bufsiz(fp) &&
15518                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15519         )
15520                 exit(0);
15521         exit(1);
15522 }
15523 EOP
15524         set try
15525         if eval $compile && $to try.c; then
15526                 if $run ./try; then
15527                         echo "And its _base field acts std."
15528                         val="$define"
15529                 else
15530                         echo "But its _base field isn't std."
15531                 fi
15532         else
15533                 echo "However, it seems to be lacking the _base field."
15534         fi
15535         $rm -f try.c try
15536         ;;
15537 esac
15538 set d_stdiobase
15539 eval $setvar
15540
15541 $cat >&4 <<EOM
15542 Checking how to access stdio streams by file descriptor number...
15543 EOM
15544 case "$stdio_stream_array" in
15545 '')     $cat >try.c <<EOCP
15546 #include <stdio.h>
15547 int main() {
15548   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15549     printf("yes\n");
15550 }
15551 EOCP
15552         for s in _iob __iob __sF
15553         do
15554                 set try -DSTDIO_STREAM_ARRAY=$s
15555                 if eval $compile; then
15556                         case "`$run ./try`" in
15557                         yes)    stdio_stream_array=$s; break ;;
15558                         esac
15559                 fi
15560         done
15561         $rm -f try.* try$exe_ext
15562 esac
15563 case "$stdio_stream_array" in
15564 '')     $cat >&4 <<EOM
15565 I can't figure out how to access stdio streams by file descriptor number.
15566 EOM
15567         d_stdio_stream_array="$undef"
15568         ;;
15569 *)      $cat >&4 <<EOM
15570 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15571 EOM
15572         d_stdio_stream_array="$define"
15573         ;;
15574 esac
15575
15576 : see if strcoll exists
15577 set strcoll d_strcoll
15578 eval $inlibc
15579
15580 : check for structure copying
15581 echo " "
15582 echo "Checking to see if your C compiler can copy structs..." >&4
15583 $cat >try.c <<'EOCP'
15584 int main()
15585 {
15586         struct blurfl {
15587                 int dyick;
15588         } foo, bar;
15589
15590         foo = bar;
15591 }
15592 EOCP
15593 if $cc -c try.c >/dev/null 2>&1 ; then
15594         val="$define"
15595         echo "Yup, it can."
15596 else
15597         val="$undef"
15598         echo "Nope, it can't."
15599 fi
15600 set d_strctcpy
15601 eval $setvar
15602 $rm -f try.*
15603
15604 : see if strerror and/or sys_errlist[] exist
15605 echo " "
15606 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15607     if set strerror val -f d_strerror; eval $csym; $val; then
15608                 echo 'strerror() found.' >&4
15609                 d_strerror="$define"
15610                 d_strerrm='strerror(e)'
15611                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15612                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15613                         d_syserrlst="$define"
15614                 else
15615                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15616                         d_syserrlst="$undef"
15617                 fi
15618     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15619                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15620                 echo 'strerror() found in string header.' >&4
15621                 d_strerror="$define"
15622                 d_strerrm='strerror(e)'
15623                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15624                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15625                                 d_syserrlst="$define"
15626                 else
15627                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15628                         d_syserrlst="$undef"
15629                 fi
15630     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15631                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15632                 d_strerror="$undef"
15633                 d_syserrlst="$define"
15634                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15635     else
15636                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15637                 d_strerror="$undef"
15638                 d_syserrlst="$undef"
15639                 d_strerrm='"unknown"'
15640     fi
15641 fi
15642
15643 : see if strerror_r exists
15644 set strerror_r d_strerror_r
15645 eval $inlibc
15646 case "$d_strerror_r" in
15647 "$define")
15648         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15649         case "$d_strerror_r_proto:$usethreads" in
15650         ":define")      d_strerror_r_proto=define
15651                 set d_strerror_r_proto strerror_r $hdrs
15652                 eval $hasproto ;;
15653         *)      ;;
15654         esac
15655         case "$d_strerror_r_proto" in
15656         define)
15657         case "$strerror_r_proto" in
15658         ''|0) try='int strerror_r(int, char*, size_t);'
15659         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15660         esac
15661         case "$strerror_r_proto" in
15662         ''|0) try='int strerror_r(int, char*, int);'
15663         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15664         esac
15665         case "$strerror_r_proto" in
15666         ''|0) try='char* strerror_r(int, char*, size_t);'
15667         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15668         esac
15669         case "$strerror_r_proto" in
15670         ''|0)   d_strerror_r=undef
15671                 strerror_r_proto=0
15672                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15673         * )     case "$strerror_r_proto" in
15674                 REENTRANT_PROTO*) ;;
15675                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15676                 esac
15677                 echo "Prototype: $try" ;;
15678         esac
15679         ;;
15680         *)      case "$usethreads" in
15681                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15682                 esac
15683                 d_strerror_r=undef
15684                 strerror_r_proto=0
15685                 ;;
15686         esac
15687         ;;
15688 *)      strerror_r_proto=0
15689         ;;
15690 esac
15691
15692 : see if strftime exists
15693 set strftime d_strftime
15694 eval $inlibc
15695
15696 : see if strtod exists
15697 set strtod d_strtod
15698 eval $inlibc
15699
15700 : see if strtol exists
15701 set strtol d_strtol
15702 eval $inlibc
15703
15704 : see if strtold exists
15705 set strtold d_strtold
15706 eval $inlibc
15707
15708 : see if strtoll exists
15709 set strtoll d_strtoll
15710 eval $inlibc
15711
15712 case "$d_longlong-$d_strtoll" in
15713 "$define-$define")
15714         $cat <<EOM
15715 Checking whether your strtoll() works okay...
15716 EOM
15717         $cat >try.c <<'EOCP'
15718 #include <errno.h>
15719 #ifdef __hpux
15720 #define strtoll __strtoll
15721 #endif
15722 #ifdef __EMX__
15723 #define strtoll _strtoll
15724 #endif
15725 #include <stdio.h>
15726 extern long long int strtoll(char *s, char **, int); 
15727 static int bad = 0;
15728 int check(char *s, long long ell, int een) {
15729         long long gll;
15730         errno = 0;
15731         gll = strtoll(s, 0, 10);
15732         if (!((gll == ell) && (errno == een)))
15733                 bad++;
15734 }
15735 int main() {
15736         check(" 1",                                      1LL, 0);
15737         check(" 0",                                      0LL, 0);
15738         check("-1",                                     -1LL, 0);
15739         check("-9223372036854775808", -9223372036854775808LL, 0);
15740         check("-9223372036854775808", -9223372036854775808LL, 0);
15741         check(" 9223372036854775807",  9223372036854775807LL, 0);
15742         check("-9223372036854775808", -9223372036854775808LL, 0);
15743         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15744         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15745         if (!bad)
15746                 printf("ok\n");
15747 }
15748 EOCP
15749         set try
15750         if eval $compile; then
15751                 yyy=`$run ./try`
15752                 case "$yyy" in
15753                 ok) echo "Your strtoll() seems to be working okay." ;;
15754                 *) cat <<EOM >&4
15755 Your strtoll() doesn't seem to be working okay.
15756 EOM
15757                    d_strtoll="$undef"
15758                    ;;
15759                 esac
15760         else
15761                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15762                 d_strtoll="$undef"
15763         fi
15764         ;;
15765 esac
15766
15767 : see if strtoq exists
15768 set strtoq d_strtoq
15769 eval $inlibc
15770
15771 : see if strtoul exists
15772 set strtoul d_strtoul
15773 eval $inlibc
15774
15775 case "$d_strtoul" in
15776 "$define")
15777         $cat <<EOM
15778 Checking whether your strtoul() works okay...
15779 EOM
15780         $cat >try.c <<'EOCP'
15781 #include <errno.h>
15782 #include <stdio.h>
15783 extern unsigned long int strtoul(char *s, char **, int); 
15784 static int bad = 0;
15785 void check(char *s, unsigned long eul, int een) {
15786         unsigned long gul;
15787         errno = 0;
15788         gul = strtoul(s, 0, 10);
15789         if (!((gul == eul) && (errno == een)))
15790                 bad++;
15791 }
15792 int main() {
15793         check(" 1", 1L, 0);
15794         check(" 0", 0L, 0);
15795 EOCP
15796         case "$longsize" in
15797         8)
15798             $cat >>try.c <<'EOCP'
15799         check("18446744073709551615", 18446744073709551615UL, 0);
15800         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15801 #if 0 /* strtoul() for /^-/ strings is undefined. */
15802         check("-1", 18446744073709551615UL, 0);
15803         check("-18446744073709551614", 2, 0);
15804         check("-18446744073709551615", 1, 0);
15805         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15806         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15807 #endif
15808 EOCP
15809                 ;;
15810         4)
15811                     $cat >>try.c <<'EOCP'
15812         check("4294967295", 4294967295UL, 0);
15813         check("4294967296", 4294967295UL, ERANGE);
15814 #if 0 /* strtoul() for /^-/ strings is undefined. */
15815         check("-1", 4294967295UL, 0);
15816         check("-4294967294", 2, 0);
15817         check("-4294967295", 1, 0);
15818         check("-4294967296", 4294967295UL, ERANGE);
15819         check("-4294967297", 4294967295UL, ERANGE);
15820 #endif
15821 EOCP
15822                 ;;
15823         *)
15824 : Should we write these tests to be more portable by sprintf-ing
15825 : ~0 and then manipulating that char string as input for strtol?
15826                 ;;
15827         esac
15828         $cat >>try.c <<'EOCP'
15829         if (!bad)
15830                 printf("ok\n");
15831         return 0;
15832 }
15833 EOCP
15834         set try
15835         if eval $compile; then
15836                 case "`$run ./try`" in
15837                 ok) echo "Your strtoul() seems to be working okay." ;;
15838                 *) cat <<EOM >&4
15839 Your strtoul() doesn't seem to be working okay.
15840 EOM
15841                    d_strtoul="$undef"
15842                    ;;
15843                 esac
15844         fi
15845         ;;
15846 esac
15847
15848 : see if strtoull exists
15849 set strtoull d_strtoull
15850 eval $inlibc
15851
15852 case "$d_longlong-$d_strtoull" in
15853 "$define-$define")
15854         $cat <<EOM
15855 Checking whether your strtoull() works okay...
15856 EOM
15857         $cat >try.c <<'EOCP'
15858 #include <errno.h>
15859 #ifdef __hpux
15860 #define strtoull __strtoull
15861 #endif
15862 #include <stdio.h>
15863 extern unsigned long long int strtoull(char *s, char **, int); 
15864 static int bad = 0;
15865 int check(char *s, long long eull, int een) {
15866         long long gull;
15867         errno = 0;
15868         gull = strtoull(s, 0, 10);
15869         if (!((gull == eull) && (errno == een)))
15870                 bad++;
15871 }
15872 int main() {
15873         check(" 1",                                        1LL, 0);
15874         check(" 0",                                        0LL, 0);
15875         check("18446744073709551615",  18446744073709551615ULL, 0);
15876         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15877 #if 0 /* strtoull() for /^-/ strings is undefined. */
15878         check("-1",                    18446744073709551615ULL, 0);
15879         check("-18446744073709551614",                     2LL, 0);
15880         check("-18446744073709551615",                     1LL, 0);
15881         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15882         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15883 #endif
15884         if (!bad)
15885                 printf("ok\n");
15886 }
15887 EOCP
15888         set try
15889         if eval $compile; then
15890                 case "`$run ./try`" in
15891                 ok) echo "Your strtoull() seems to be working okay." ;;
15892                 *) cat <<EOM >&4
15893 Your strtoull() doesn't seem to be working okay.
15894 EOM
15895                    d_strtoull="$undef"
15896                    ;;
15897                 esac
15898         fi
15899         ;;
15900 esac
15901
15902 : see if strtouq exists
15903 set strtouq d_strtouq
15904 eval $inlibc
15905
15906 case "$d_strtouq" in
15907 "$define")
15908         $cat <<EOM
15909 Checking whether your strtouq() works okay...
15910 EOM
15911         $cat >try.c <<'EOCP'
15912 #include <errno.h>
15913 #include <stdio.h>
15914 extern unsigned long long int strtouq(char *s, char **, int); 
15915 static int bad = 0;
15916 void check(char *s, unsigned long long eull, int een) {
15917         unsigned long long gull;
15918         errno = 0;
15919         gull = strtouq(s, 0, 10);
15920         if (!((gull == eull) && (errno == een)))
15921                 bad++;
15922 }
15923 int main() {
15924         check(" 1",                                        1LL, 0);
15925         check(" 0",                                        0LL, 0);
15926         check("18446744073709551615",  18446744073709551615ULL, 0);
15927         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15928 #if 0 /* strtouq() for /^-/ strings is undefined. */
15929         check("-1",                    18446744073709551615ULL, 0);
15930         check("-18446744073709551614",                     2LL, 0);
15931         check("-18446744073709551615",                     1LL, 0);
15932         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15933         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15934 #endif
15935         if (!bad)
15936                 printf("ok\n");
15937         return 0;
15938 }
15939 EOCP
15940         set try
15941         if eval $compile; then
15942                 case "`$run ./try`" in
15943                 ok) echo "Your strtouq() seems to be working okay." ;;
15944                 *) cat <<EOM >&4
15945 Your strtouq() doesn't seem to be working okay.
15946 EOM
15947                    d_strtouq="$undef"
15948                    ;;
15949                 esac
15950         fi
15951         ;;
15952 esac
15953
15954 : see if strxfrm exists
15955 set strxfrm d_strxfrm
15956 eval $inlibc
15957
15958 : see if symlink exists
15959 set symlink d_symlink
15960 eval $inlibc
15961
15962 : see if syscall exists
15963 set syscall d_syscall
15964 eval $inlibc
15965
15966 : see if prototype for syscall is available
15967 echo " "
15968 set d_syscallproto syscall $i_unistd unistd.h
15969 eval $hasproto
15970
15971 : see if sysconf exists
15972 set sysconf d_sysconf
15973 eval $inlibc
15974
15975 : see if system exists
15976 set system d_system
15977 eval $inlibc
15978
15979 : see if tcgetpgrp exists
15980 set tcgetpgrp d_tcgetpgrp
15981 eval $inlibc
15982
15983 : see if tcsetpgrp exists
15984 set tcsetpgrp d_tcsetpgrp
15985 eval $inlibc
15986
15987 : see if prototype for telldir is available
15988 echo " "
15989 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15990 eval $hasproto
15991
15992 : see if time exists
15993 echo " "
15994 if test "X$d_time" = X -o X"$timetype" = X; then
15995     if set time val -f d_time; eval $csym; $val; then
15996                 echo 'time() found.' >&4
15997                 val="$define"
15998                 rp="What is the type returned by time() on this system?"
15999                 set time_t timetype long stdio.h sys/types.h
16000                 eval $typedef_ask
16001     else
16002                 echo 'time() not found, hope that will do.' >&4
16003                 val="$undef"
16004                 timetype='int';
16005     fi
16006     set d_time
16007     eval $setvar
16008 fi
16009
16010 : see if this is a sys/times.h system
16011 set sys/times.h i_systimes
16012 eval $inhdr
16013
16014 : see if times exists
16015 echo " "
16016 if set times val -f d_times; eval $csym; $val; then
16017         echo 'times() found.' >&4
16018         d_times="$define"
16019         inc=''
16020         case "$i_systimes" in
16021         "$define") inc='sys/times.h';;
16022         esac
16023         rp="What is the type returned by times() on this system?"
16024         set clock_t clocktype long stdio.h sys/types.h $inc
16025         eval $typedef_ask
16026 else
16027         echo 'times() NOT found, hope that will do.' >&4
16028         d_times="$undef"
16029         clocktype='int'
16030 fi
16031
16032 : see if tmpnam_r exists
16033 set tmpnam_r d_tmpnam_r
16034 eval $inlibc
16035 case "$d_tmpnam_r" in
16036 "$define")
16037         hdrs="$i_systypes sys/types.h define stdio.h "
16038         case "$d_tmpnam_r_proto:$usethreads" in
16039         ":define")      d_tmpnam_r_proto=define
16040                 set d_tmpnam_r_proto tmpnam_r $hdrs
16041                 eval $hasproto ;;
16042         *)      ;;
16043         esac
16044         case "$d_tmpnam_r_proto" in
16045         define)
16046         case "$tmpnam_r_proto" in
16047         ''|0) try='char* tmpnam_r(char*);'
16048         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16049         esac
16050         case "$tmpnam_r_proto" in
16051         ''|0)   d_tmpnam_r=undef
16052                 tmpnam_r_proto=0
16053                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16054         * )     case "$tmpnam_r_proto" in
16055                 REENTRANT_PROTO*) ;;
16056                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16057                 esac
16058                 echo "Prototype: $try" ;;
16059         esac
16060         ;;
16061         *)      case "$usethreads" in
16062                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16063                 esac
16064                 d_tmpnam_r=undef
16065                 tmpnam_r_proto=0
16066                 ;;
16067         esac
16068         ;;
16069 *)      tmpnam_r_proto=0
16070         ;;
16071 esac
16072
16073 : see if truncate exists
16074 set truncate d_truncate
16075 eval $inlibc
16076
16077 : see if ttyname_r exists
16078 set ttyname_r d_ttyname_r
16079 eval $inlibc
16080 case "$d_ttyname_r" in
16081 "$define")
16082         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16083         case "$d_ttyname_r_proto:$usethreads" in
16084         ":define")      d_ttyname_r_proto=define
16085                 set d_ttyname_r_proto ttyname_r $hdrs
16086                 eval $hasproto ;;
16087         *)      ;;
16088         esac
16089         case "$d_ttyname_r_proto" in
16090         define)
16091         case "$ttyname_r_proto" in
16092         ''|0) try='int ttyname_r(int, char*, size_t);'
16093         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16094         esac
16095         case "$ttyname_r_proto" in
16096         ''|0) try='int ttyname_r(int, char*, int);'
16097         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16098         esac
16099         case "$ttyname_r_proto" in
16100         ''|0) try='char* ttyname_r(int, char*, int);'
16101         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16102         esac
16103         case "$ttyname_r_proto" in
16104         ''|0)   d_ttyname_r=undef
16105                 ttyname_r_proto=0
16106                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16107         * )     case "$ttyname_r_proto" in
16108                 REENTRANT_PROTO*) ;;
16109                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16110                 esac
16111                 echo "Prototype: $try" ;;
16112         esac
16113         ;;
16114         *)      case "$usethreads" in
16115                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16116                 esac
16117                 d_ttyname_r=undef
16118                 ttyname_r_proto=0
16119                 ;;
16120         esac
16121         ;;
16122 *)      ttyname_r_proto=0
16123         ;;
16124 esac
16125
16126 : see if tzname[] exists
16127 echo " "
16128 if set tzname val -a d_tzname; eval $csym; $val; then
16129         val="$define"
16130         echo 'tzname[] found.' >&4
16131 else
16132         val="$undef"
16133         echo 'tzname[] NOT found.' >&4
16134 fi
16135 set d_tzname
16136 eval $setvar
16137
16138 case "$osname" in
16139 next|rhapsody|darwin) multiarch="$define" ;;
16140 esac
16141 case "$multiarch" in
16142 ''|[nN]*) multiarch="$undef" ;;
16143 esac
16144
16145 : check for ordering of bytes in a UV
16146 echo " "
16147 case "$usecrosscompile$multiarch" in
16148 *$define*)
16149         $cat <<EOM
16150 You seem to be either cross-compiling or doing a multiarchitecture build,
16151 skipping the byteorder check.
16152
16153 EOM
16154         byteorder='ffff'
16155         ;;
16156 *)
16157         case "$byteorder" in
16158         '')
16159                 $cat <<'EOM'
16160 In the following, larger digits indicate more significance.  A big-endian
16161 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16162 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16163 machines may have weird orders like 3412.  A Cray will report 87654321,
16164 an Alpha will report 12345678. If the test program works the default is
16165 probably right.
16166 I'm now running the test program...
16167 EOM
16168                 $cat >try.c <<EOCP
16169 #include <stdio.h>
16170 #include <sys/types.h>
16171 typedef $uvtype UV;
16172 int main()
16173 {
16174         int i;
16175         union {
16176                 UV l;
16177                 char c[$uvsize];
16178         } u;
16179
16180         if ($uvsize > 4)
16181                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16182         else
16183                 u.l = (UV)0x04030201;
16184         for (i = 0; i < $uvsize; i++)
16185                 printf("%c", u.c[i]+'0');
16186         printf("\n");
16187         exit(0);
16188 }
16189 EOCP
16190                 xxx_prompt=y
16191                 set try
16192                 if eval $compile && ./try > /dev/null; then
16193                         dflt=`$run ./try`
16194                         case "$dflt" in
16195                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16196                                 echo "(The test program ran ok.)"
16197                                 echo "byteorder=$dflt"
16198                                 xxx_prompt=n
16199                         ;;
16200                         ????|????????) echo "(The test program ran ok.)" ;;
16201                         *) echo "(The test program didn't run right for some reason.)" ;;
16202                         esac
16203                 else
16204                         dflt='4321'
16205                         cat <<'EOM'
16206 (I can't seem to compile the test program.  Guessing big-endian...)
16207 EOM
16208                 fi
16209                 case "$xxx_prompt" in
16210                 y)
16211                         rp="What is the order of bytes in $uvtype?"
16212                         . ./myread
16213                         byteorder="$ans"
16214                         ;;
16215                 *)      byteorder=$dflt
16216                         ;;
16217                 esac
16218                 ;;
16219         esac
16220         $rm -f try.c try
16221         ;;
16222 esac
16223
16224
16225 $cat <<EOM
16226
16227 Checking to see whether you can access character data unalignedly...
16228 EOM
16229 case "$d_u32align" in
16230 '')   $cat >try.c <<EOCP
16231 #include <stdio.h>
16232 #define U32 $u32type
16233 #define BYTEORDER 0x$byteorder
16234 #define U8 $u8type
16235 #include <signal.h>
16236 #ifdef SIGBUS
16237 $signal_t bletch(s) int s; { exit(4); }
16238 #endif
16239 int main() {
16240 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16241     U8 buf[8];
16242     U32 *up;
16243     int i;
16244
16245     if (sizeof(U32) != 4) {
16246         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16247         exit(1);
16248     }
16249
16250     fflush(stdout);
16251
16252 #ifdef SIGBUS
16253     signal(SIGBUS, bletch);
16254 #endif
16255
16256     buf[0] = 0;
16257     buf[1] = 0;
16258     buf[2] = 0;
16259     buf[3] = 1;
16260     buf[5] = 0;
16261     buf[6] = 0;
16262     buf[7] = 0;
16263     buf[8] = 1;
16264
16265     for (i = 0; i < 4; i++) {
16266         up = (U32*)(buf + i);
16267         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16268                (*up == 1 << (8*(3-i)))  /* little-endian */
16269               )
16270            )
16271         {
16272             printf("read failed (%x)\n", *up);
16273             exit(2);
16274         }
16275     }
16276
16277     /* write test */
16278     for (i = 0; i < 4; i++) {
16279         up = (U32*)(buf + i);
16280         *up = 0xBeef;
16281         if (*up != 0xBeef) {
16282             printf("write failed (%x)\n", *up);
16283             exit(3);
16284         }
16285     }
16286
16287     exit(0);
16288 #else
16289     printf("1\n");
16290     exit(1);
16291 #endif
16292     return 0;
16293 }
16294 EOCP
16295 set try
16296 if eval $compile_ok; then
16297         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16298         $run ./try 2>&1 >/dev/null
16299         case "$?" in
16300         0)      cat >&4 <<EOM
16301 You can access character data pretty unalignedly.
16302 EOM
16303                 d_u32align="$undef"
16304                 ;;
16305         *)      cat >&4 <<EOM
16306 It seems that you must access character data in an aligned manner.
16307 EOM
16308                 d_u32align="$define"
16309                 ;;
16310         esac
16311 else
16312         rp='Can you access character data at unaligned addresses?'
16313         dflt='n'
16314         . ./myread
16315         case "$ans" in
16316         [yY]*)  d_u32align="$undef"  ;;
16317         *)      d_u32align="$define" ;;
16318         esac
16319 fi
16320 $rm -f core core.try.* try.core
16321 ;;
16322 esac
16323
16324 : see if ualarm exists
16325 set ualarm d_ualarm
16326 eval $inlibc
16327
16328 : see if umask exists
16329 set umask d_umask
16330 eval $inlibc
16331
16332 : see if unordered exists
16333 set unordered d_unordered
16334 eval $inlibc
16335
16336 : see if usleep exists
16337 set usleep d_usleep
16338 eval $inlibc
16339
16340 : see if prototype for usleep is available
16341 echo " "
16342 set d_usleepproto usleep $i_unistd unistd.h
16343 eval $hasproto
16344
16345 : see if ustat exists
16346 set ustat d_ustat
16347 eval $inlibc
16348
16349 : backward compatibility for d_hvfork
16350 if test X$d_hvfork != X; then
16351         d_vfork="$d_hvfork"
16352         d_hvfork=''
16353 fi
16354 : see if there is a vfork
16355 val=''
16356 set vfork val
16357 eval $inlibc
16358
16359 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16360 : perl on Solaris 2.x, and probably elsewhere.
16361 case "$val" in
16362 $define)
16363         echo " "
16364         case "$usevfork" in
16365         false) dflt='n';;
16366         *) dflt='y';;
16367         esac
16368         cat <<'EOM'
16369  
16370 Perl can only use a vfork() that doesn't suffer from strict
16371 restrictions on calling functions or modifying global data in
16372 the child.  For example, glibc-2.1 contains such a vfork()
16373 that is unsuitable.  If your system provides a proper fork()
16374 call, chances are that you do NOT want perl to use vfork().
16375
16376 EOM
16377         rp="Do you still want to use vfork()?"
16378         . ./myread
16379         case "$ans" in
16380         y|Y) ;;
16381         *)
16382                 echo "Ok, we won't use vfork()."
16383                 val="$undef"
16384                 ;;
16385         esac
16386         ;;
16387 esac
16388 set d_vfork
16389 eval $setvar
16390 case "$d_vfork" in
16391 $define) usevfork='true';;
16392 *) usevfork='false';;
16393 esac
16394
16395 : see if closedir exists
16396 set closedir d_closedir
16397 eval $inlibc
16398
16399 case "$d_closedir" in
16400 "$define")
16401         echo " "
16402         echo "Checking whether closedir() returns a status..." >&4
16403         cat > try.c <<EOM
16404 #$i_dirent I_DIRENT             /**/
16405 #$i_sysdir I_SYS_DIR            /**/
16406 #$i_sysndir I_SYS_NDIR          /**/
16407 #$i_systypes I_SYS_TYPES        /**/
16408
16409 #if defined(I_SYS_TYPES)
16410 #include <sys/types.h>
16411 #endif
16412 #if defined(I_DIRENT)
16413 #include <dirent.h>
16414 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16415 #include <sys/dir.h>
16416 #endif
16417 #else
16418 #ifdef I_SYS_NDIR
16419 #include <sys/ndir.h>
16420 #else
16421 #ifdef I_SYS_DIR
16422 #ifdef hp9000s500
16423 #include <ndir.h>       /* may be wrong in the future */
16424 #else
16425 #include <sys/dir.h>
16426 #endif
16427 #endif
16428 #endif
16429 #endif 
16430 int main() { return closedir(opendir(".")); }
16431 EOM
16432         set try
16433         if eval $compile_ok; then
16434                 if $run ./try > /dev/null 2>&1 ; then
16435                         echo "Yes, it does."
16436                         val="$undef"
16437                 else
16438                         echo "No, it doesn't."
16439                         val="$define"
16440                 fi
16441         else
16442                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16443                 val="$define"
16444         fi
16445         ;;
16446 *)
16447         val="$undef";
16448         ;;
16449 esac
16450 set d_void_closedir
16451 eval $setvar
16452 $rm -f try try.*
16453 : see if there is a wait4
16454 set wait4 d_wait4
16455 eval $inlibc
16456
16457 : see if waitpid exists
16458 set waitpid d_waitpid
16459 eval $inlibc
16460
16461 : see if wcstombs exists
16462 set wcstombs d_wcstombs
16463 eval $inlibc
16464
16465 : see if wctomb exists
16466 set wctomb d_wctomb
16467 eval $inlibc
16468
16469 : see if writev exists
16470 set writev d_writev
16471 eval $inlibc
16472
16473 : preserve RCS keywords in files with variable substitution, grrr
16474 Date='$Date'
16475 Id='$Id'
16476 Log='$Log'
16477 RCSfile='$RCSfile'
16478 Revision='$Revision'
16479
16480 : check for alignment requirements
16481 echo " "
16482 case "$usecrosscompile$multiarch" in
16483 *$define*)
16484         $cat <<EOM
16485 You seem to be either cross-compiling or doing a multiarchitecture build,
16486 skipping the memory alignment check.
16487
16488 EOM
16489         case "$alignbytes" in
16490         '') alignbytes=8 ;;
16491         esac
16492         ;;
16493 *)
16494         case "$alignbytes" in
16495         '') echo "Checking alignment constraints..." >&4
16496                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16497                         $cat >try.c <<'EOCP'
16498 typedef long double NV;
16499 EOCP
16500                 else
16501                         $cat >try.c <<'EOCP'
16502 typedef double NV;
16503 EOCP
16504                 fi
16505                 $cat >>try.c <<'EOCP'
16506 #include <stdio.h>
16507 struct foobar {
16508         char foo;
16509         NV bar;
16510 } try_algn;
16511 int main()
16512 {
16513     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16514     return(0);
16515 }
16516 EOCP
16517                 set try
16518                 if eval $compile_ok; then
16519                         dflt=`$run ./try`
16520                 else
16521                         dflt='8'
16522                         echo "(I can't seem to compile the test program...)"
16523                 fi
16524                 ;;
16525         *) dflt="$alignbytes"
16526                 ;;
16527         esac
16528         rp="Doubles must be aligned on a how-many-byte boundary?"
16529         . ./myread
16530         alignbytes="$ans"
16531         $rm -f try.c try
16532         ;;
16533 esac
16534
16535
16536 : set the base revision
16537 baserev=5.0
16538
16539 : how do we catenate cpp tokens here?
16540 echo " "
16541 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16542 $cat >cpp_stuff.c <<'EOCP'
16543 #define RCAT(a,b)a/**/b
16544 #define ACAT(a,b)a ## b
16545 RCAT(Rei,ser)
16546 ACAT(Cir,cus)
16547 EOCP
16548 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16549 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16550         echo "Oh!  Smells like ANSI's been here." >&4
16551         echo "We can catify or stringify, separately or together!"
16552         cpp_stuff=42
16553 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16554         echo "Ah, yes!  The good old days!" >&4
16555         echo "However, in the good old days we don't know how to stringify and"
16556         echo "catify at the same time."
16557         cpp_stuff=1
16558 else
16559         $cat >&4 <<EOM
16560 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16561 to have to edit the values of CAT[2-5] in config.h...
16562 EOM
16563         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16564 fi
16565 $rm -f cpp_stuff.*
16566
16567 : see if this is a db.h system
16568 set db.h i_db
16569 eval $inhdr
16570
16571 case "$i_db" in
16572 $define)
16573         : Check db version.
16574         echo " "
16575         echo "Checking Berkeley DB version ..." >&4
16576         $cat >try.c <<EOCP
16577 #$d_const HASCONST
16578 #ifndef HASCONST
16579 #define const
16580 #endif
16581 #include <sys/types.h>
16582 #include <stdio.h>
16583 #include <db.h>
16584 int main(int argc, char *argv[])
16585 {
16586 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16587     int Major, Minor, Patch ;
16588     unsigned long Version ;
16589     (void)db_version(&Major, &Minor, &Patch) ;
16590     if (argc == 2) {
16591         printf("%d %d %d %d %d %d\n",
16592                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16593                Major, Minor, Patch);
16594         exit(0);
16595     }
16596     printf("You have Berkeley DB Version 2 or greater.\n");
16597
16598     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16599                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16600     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16601                 Major, Minor, Patch) ;
16602
16603     /* check that db.h & libdb are compatible */
16604     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16605         printf("db.h and libdb are incompatible.\n") ;
16606         exit(3);        
16607     }
16608
16609     printf("db.h and libdb are compatible.\n") ;
16610
16611     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16612                 + DB_VERSION_PATCH ;
16613
16614     /* needs to be >= 2.3.4 */
16615     if (Version < 2003004) {
16616     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16617         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16618         exit(2);        
16619     }
16620
16621     exit(0);
16622 #else
16623 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16624     if (argc == 2) {
16625         printf("1 0 0\n");
16626         exit(0);
16627     }
16628     printf("You have Berkeley DB Version 1.\n");
16629     exit(0);    /* DB version < 2: the coast is clear. */
16630 #else
16631     exit(1);    /* <db.h> not Berkeley DB? */
16632 #endif
16633 #endif
16634 }
16635 EOCP
16636         set try
16637         if eval $compile_ok && $run ./try; then
16638                 echo 'Looks OK.' >&4
16639                 set `$run ./try 1`
16640                 db_version_major=$1
16641                 db_version_minor=$2
16642                 db_version_patch=$3
16643         else
16644                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16645                 i_db=$undef
16646                 case " $libs " in
16647                 *"-ldb "*)
16648                         : Remove db from list of libraries to use
16649                         echo "Removing unusable -ldb from library list" >&4
16650                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16651                         shift
16652                         libs="$*"
16653                         echo "libs = $libs" >&4
16654                         ;;
16655                 esac
16656         fi
16657         $rm -f try.*
16658         ;;
16659 esac
16660
16661 case "$i_db" in
16662 define)
16663         : Check the return type needed for hash 
16664         echo " "
16665         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16666         $cat >try.c <<EOCP
16667 #$d_const HASCONST
16668 #ifndef HASCONST
16669 #define const
16670 #endif
16671 #include <sys/types.h>
16672 #include <db.h>
16673
16674 #ifndef DB_VERSION_MAJOR
16675 u_int32_t hash_cb (ptr, size)
16676 const void *ptr;
16677 size_t size;
16678 {
16679 }
16680 HASHINFO info;
16681 int main()
16682 {
16683         info.hash = hash_cb;
16684 }
16685 #endif
16686 EOCP
16687         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16688                 if $contains warning try.out >>/dev/null 2>&1 ; then
16689                         db_hashtype='int'
16690                 else
16691                         db_hashtype='u_int32_t'
16692                 fi
16693         else
16694                 : XXX Maybe we should just give up here.
16695                 db_hashtype=u_int32_t
16696                 $cat try.out >&4
16697                 echo "Help:  I can't seem to compile the db test program." >&4
16698                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16699         fi
16700         $rm -f try.*
16701         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16702         ;;
16703 *)      db_hashtype=u_int32_t
16704         ;;
16705 esac
16706 case "$i_db" in
16707 define)
16708         : Check the return type needed for prefix 
16709         echo " "
16710         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16711         cat >try.c <<EOCP
16712 #$d_const HASCONST
16713 #ifndef HASCONST
16714 #define const
16715 #endif
16716 #include <sys/types.h>
16717 #include <db.h>
16718
16719 #ifndef DB_VERSION_MAJOR
16720 size_t prefix_cb (key1, key2)
16721 const DBT *key1;
16722 const DBT *key2;
16723 {
16724 }
16725 BTREEINFO info;
16726 int main()
16727 {
16728         info.prefix = prefix_cb;
16729 }
16730 #endif
16731 EOCP
16732         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16733                 if $contains warning try.out >>/dev/null 2>&1 ; then
16734                         db_prefixtype='int'
16735                 else
16736                         db_prefixtype='size_t'
16737                 fi
16738         else
16739                 db_prefixtype='size_t'
16740                 : XXX Maybe we should just give up here.
16741                 $cat try.out >&4
16742                 echo "Help:  I can't seem to compile the db test program." >&4
16743                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16744         fi
16745         $rm -f try.*
16746         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16747         ;;
16748 *)      db_prefixtype='size_t'
16749         ;;
16750 esac
16751
16752
16753 : How can we generate normalized random numbers ?
16754 echo " "
16755 echo "Looking for a random number function..." >&4
16756 case "$randfunc" in
16757 '')
16758         if set drand48 val -f; eval $csym; $val; then
16759                 dflt="drand48"
16760                 echo "Good, found drand48()." >&4
16761         elif set random val -f; eval $csym; $val; then
16762                 dflt="random"
16763                 echo "OK, found random()." >&4
16764         else
16765                 dflt="rand"
16766                 echo "Yick, looks like I have to use rand()." >&4
16767         fi
16768         echo " "
16769         ;;
16770 *)
16771         dflt="$randfunc"
16772         ;;
16773 esac
16774 cont=true
16775
16776 case "$ccflags" in
16777 *-Dmy_rand=*|*-Dmy_srand=*)
16778         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16779         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16780         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16781         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16782         ;;
16783 esac
16784
16785 while $test "$cont"; do
16786         rp="Use which function to generate random numbers?"
16787         . ./myread
16788         if $test "$ans" = "$dflt"; then
16789                 : null
16790         else
16791                 randbits=''
16792         fi
16793         randfunc="$ans"
16794         if set $ans val -f; eval $csym; $val; then
16795                 cont=''
16796         else
16797                 dflt=y
16798                 rp="I cannot find function $ans. Use that name anyway?"
16799                 . ./myread
16800                 dflt=rand
16801                 case "$ans" in
16802                         [yY]*) cont='';;
16803                 esac
16804         fi
16805         case "$cont" in
16806         '')
16807                 case "$randfunc" in
16808                 drand48)
16809                         drand01="drand48()"
16810                         seedfunc="srand48"
16811                         randbits=48
16812                         randseedtype=long
16813                         ;;
16814                 rand|random)
16815                         case "$randbits" in
16816                         '')
16817 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16818                                 $cat >try.c <<EOCP
16819 #$i_unistd I_UNISTD
16820 #$i_stdlib I_STDLIB
16821 #include <stdio.h>
16822 #ifdef I_UNISTD
16823 #  include <unistd.h>
16824 #endif
16825 #ifdef I_STDLIB
16826 #  include <stdlib.h>
16827 #endif
16828 int main()
16829 {
16830         register int i;
16831         register unsigned long tmp;
16832         register unsigned long max = 0L;
16833
16834         for (i = 1000; i; i--) {
16835                 tmp = (unsigned long) $randfunc();
16836                 if (tmp > max) max = tmp;
16837         }
16838         for (i = 0; max; i++)
16839                 max /= 2;
16840         printf("%d\n",i);
16841 }
16842 EOCP
16843                                 set try
16844                                 if eval $compile_ok; then
16845                                         dflt=`try`
16846                                 else
16847                                         dflt='?'
16848                                         echo "(I can't seem to compile the test program...)"
16849                                 fi
16850                                 ;;
16851                         *)
16852                                 dflt="$randbits"
16853                                 ;;
16854                         esac
16855                         rp="How many bits does your $randfunc() function produce?"
16856                         . ./myread
16857                         randbits="$ans"
16858                         $rm -f try.c try
16859                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16860                         seedfunc="s$randfunc"
16861                         randseedtype=unsigned
16862                         ;;
16863                 *)
16864                         dflt="31"
16865                         rp="How many bits does your $randfunc() function produce?"
16866                         . ./myread
16867                         randbits="$ans"
16868                         seedfunc="s$randfunc"
16869                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16870                         if set $seedfunc val -f; eval $csym; $val; then
16871                                 echo "(Using $seedfunc() to seed random generator)"
16872                         else
16873                                 echo "(Warning: no $seedfunc() to seed random generator)"
16874                                 seedfunc=rand
16875                         fi
16876                         randseedtype=unsigned
16877                         ;;
16878                 esac
16879                 ;;
16880         esac
16881 done
16882
16883 echo " "
16884 echo "Determining whether or not we are on an EBCDIC system..." >&4
16885 $cat >try.c <<'EOM'
16886 int main()
16887 {
16888   if ('M'==0xd4) return 0;
16889   return 1;
16890 }
16891 EOM
16892
16893 val=$undef
16894 set try
16895 if eval $compile_ok; then
16896         if $run ./try; then
16897                 echo "You seem to speak EBCDIC." >&4
16898                 val="$define"
16899         else
16900                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16901         fi
16902 else
16903         echo "I'm unable to compile the test program." >&4
16904         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16905 fi
16906 $rm -f try try.*
16907 set ebcdic
16908 eval $setvar
16909
16910 echo " "
16911 $cat >&4 <<EOM
16912 Checking how to flush all pending stdio output...
16913 EOM
16914 # I only know how to find the first 32 possibly open files on SunOS.
16915 # See also hints/sunos_4_1.sh and util.c  --AD
16916 case "$osname" in
16917 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16918 esac
16919 $cat >>try.c <<EOCP
16920 #include <stdio.h>
16921 #$i_unistd I_UNISTD
16922 #ifdef I_UNISTD
16923 # include <unistd.h>
16924 #endif
16925 #$d_sysconf HAS_SYSCONF
16926 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16927 #ifdef HAS_STDIO_STREAM_ARRAY
16928 # define STDIO_STREAM_ARRAY $stdio_stream_array
16929 #endif
16930 int main() {
16931   FILE* p;
16932   unlink("try.out");
16933   p = fopen("try.out", "w");
16934 #ifdef TRY_FPUTC
16935   fputc('x', p);
16936 #else
16937 # ifdef TRY_FPRINTF
16938   fprintf(p, "x");
16939 # endif
16940 #endif
16941 #ifdef TRY_FFLUSH_NULL
16942   fflush(NULL);
16943 #endif
16944 #ifdef TRY_FFLUSH_ALL
16945   {
16946     long open_max = -1;
16947 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16948     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16949 # else
16950 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16951     open_max = sysconf(_SC_OPEN_MAX);
16952 #  else
16953 #   ifdef FOPEN_MAX
16954     open_max = FOPEN_MAX;
16955 #   else
16956 #    ifdef OPEN_MAX
16957     open_max = OPEN_MAX;
16958 #    else
16959 #     ifdef _NFILE
16960     open_max = _NFILE;
16961 #     endif
16962 #    endif
16963 #   endif
16964 #  endif
16965 # endif 
16966 # ifdef HAS_STDIO_STREAM_ARRAY
16967     if (open_max > 0) {
16968       long i;
16969       for (i = 0; i < open_max; i++)
16970             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16971                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16972                 STDIO_STREAM_ARRAY[i]._flag)
16973                 fflush(&STDIO_STREAM_ARRAY[i]);
16974     }   
16975   }
16976 # endif
16977 #endif
16978   _exit(42);
16979 }
16980 EOCP
16981 : first we have to find out how _not_ to flush
16982 $to try.c
16983 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16984     output=''
16985     set try -DTRY_FPUTC
16986     if eval $compile; then
16987             $run ./try 2>/dev/null
16988             code="$?"
16989             $from try.out
16990             if $test ! -s try.out -a "X$code" = X42; then
16991                 output=-DTRY_FPUTC
16992             fi
16993     fi
16994     case "$output" in
16995     '')
16996             set try -DTRY_FPRINTF
16997             if eval $compile; then
16998                     $run ./try 2>/dev/null
16999                     code="$?"
17000                     $from try.out
17001                     if $test ! -s try.out -a "X$code" = X42; then
17002                         output=-DTRY_FPRINTF
17003                     fi
17004             fi
17005         ;;
17006     esac
17007 fi
17008 : check for fflush NULL behaviour
17009 case "$fflushNULL" in
17010 '')     set try -DTRY_FFLUSH_NULL $output
17011         if eval $compile; then
17012                 $run ./try 2>/dev/null
17013                 code="$?"
17014                 $from try.out
17015                 if $test -s try.out -a "X$code" = X42; then
17016                         fflushNULL="`$cat try.out`"
17017                 else
17018                         if $test "X$code" != X42; then
17019                                 $cat >&4 <<EOM
17020 (If this test failed, don't worry, we'll try another method shortly.)
17021 EOM
17022                         fi
17023                 fi
17024         fi
17025         $rm -f core try.core core.try.*
17026         case "$fflushNULL" in
17027         x)      $cat >&4 <<EOM
17028 Your fflush(NULL) works okay for output streams.
17029 Let's see if it clobbers input pipes...
17030 EOM
17031 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17032 # bug that improperly flushes the input end of pipes.  So we avoid the
17033 # autoflush on fork/system/exec support for now. :-(
17034 $cat >tryp.c <<EOCP
17035 #include <stdio.h>
17036 int
17037 main(int argc, char **argv)
17038 {
17039     char buf[1024];
17040     int i;
17041     char *bp = buf;
17042     while (1) {
17043         while ((i = getc(stdin)) != -1
17044                && (*bp++ = i) != '\n'
17045                && bp < &buf[1024])
17046         /* DO NOTHING */ ;
17047         *bp = '\0';
17048         fprintf(stdout, "%s", buf);
17049         fflush(NULL);
17050         if (i == -1)
17051             return 0;
17052         bp = buf;
17053     }
17054 }
17055 EOCP
17056                 fflushNULL="$define"
17057                 set tryp
17058                 if eval $compile; then
17059                     $rm -f tryp.out
17060                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17061                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17062                        $cat >&4 <<EOM
17063 fflush(NULL) seems to behave okay with input streams.
17064 EOM
17065                         fflushNULL="$define"
17066                     else
17067                         $cat >&4 <<EOM
17068 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17069 EOM
17070                         fflushNULL="$undef"
17071                     fi
17072                 fi
17073                 $rm -f core tryp.c tryp.core core.tryp.*
17074                 ;;
17075         '')     $cat >&4 <<EOM
17076 Your fflush(NULL) isn't working (contrary to ANSI C).
17077 EOM
17078                 fflushNULL="$undef"
17079                 ;;
17080         *)      $cat >&4 <<EOM
17081 Cannot figure out whether your fflush(NULL) works or not.
17082 I'm assuming it doesn't (contrary to ANSI C).
17083 EOM
17084                 fflushNULL="$undef"
17085                 ;;
17086         esac
17087         ;;
17088 $define|true|[yY]*)
17089         fflushNULL="$define"
17090         ;;
17091 *)
17092         fflushNULL="$undef"
17093         ;;
17094 esac
17095 : check explicit looping only if NULL did not work, and if the pipe
17096 : bug does not show up on an explicit flush too
17097 case "$fflushNULL" in
17098 "$undef")
17099         $cat >tryp.c <<EOCP
17100 #include <stdio.h>
17101 int
17102 main(int argc, char **argv)
17103 {
17104     char buf[1024];
17105     int i;
17106     char *bp = buf;
17107     while (1) {
17108         while ((i = getc(stdin)) != -1
17109                && (*bp++ = i) != '\n'
17110                && bp < &buf[1024])
17111         /* DO NOTHING */ ;
17112         *bp = '\0';
17113         fprintf(stdout, "%s", buf);
17114         fflush(stdin);
17115         if (i == -1)
17116             return 0;
17117         bp = buf;
17118     }
17119 }
17120 EOCP
17121         set tryp
17122         if eval $compile; then
17123             $rm -f tryp.out
17124             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17125             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17126                $cat >&4 <<EOM
17127 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17128 EOM
17129                 : now check for fflushall behaviour
17130                 case "$fflushall" in
17131                 '')     set try -DTRY_FFLUSH_ALL $output
17132                         if eval $compile; then
17133                                 $cat >&4 <<EOM
17134 (Now testing the other method--but note that this also may fail.)
17135 EOM
17136                                 $run ./try 2>/dev/null
17137                                 code=$?
17138                                 $from try.out
17139                                 if $test -s try.out -a "X$code" = X42; then
17140                                         fflushall="`$cat try.out`"
17141                                 fi
17142                         fi
17143                         $rm -f core try.core core.try.*
17144                         case "$fflushall" in
17145                         x)      $cat >&4 <<EOM
17146 Whew. Flushing explicitly all the stdio streams works.
17147 EOM
17148                                 fflushall="$define"
17149                                 ;;
17150                         '')     $cat >&4 <<EOM
17151 Sigh. Flushing explicitly all the stdio streams doesn't work.
17152 EOM
17153                                 fflushall="$undef"
17154                                 ;;
17155                         *)      $cat >&4 <<EOM
17156 Cannot figure out whether flushing stdio streams explicitly works or not.
17157 I'm assuming it doesn't.
17158 EOM
17159                                 fflushall="$undef"
17160                                 ;;
17161                         esac
17162                         ;;
17163                 "$define"|true|[yY]*)
17164                         fflushall="$define"
17165                         ;;
17166                 *)
17167                         fflushall="$undef"
17168                         ;;
17169                 esac
17170             else
17171                 $cat >&4 <<EOM
17172 All is futile.  Even fflush(stdin) clobbers input pipes!
17173 EOM
17174                 fflushall="$undef"
17175             fi
17176         else
17177             fflushall="$undef"
17178         fi
17179         $rm -f core tryp.c tryp.core core.tryp.*
17180         ;;
17181 *)      fflushall="$undef"
17182         ;;
17183 esac
17184
17185 case "$fflushNULL$fflushall" in
17186 undefundef)
17187         $cat <<EOM
17188 OK, I give up.  I cannot figure out how to flush pending stdio output.
17189 We won't be flushing handles at all before fork/exec/popen.
17190 EOM
17191         ;;
17192 esac
17193 $rm -f try.* try$exe_ext
17194
17195 : Store the full pathname to the ar program for use in the C program
17196 : Respect a hint or command line value for full_ar.
17197 case "$full_ar" in
17198 '') full_ar=$ar ;;
17199 esac
17200
17201 : Store the full pathname to the sed program for use in the C program
17202 full_sed=$sed
17203
17204 : see what type gids are declared as in the kernel
17205 echo " "
17206 echo "Looking for the type for group ids returned by getgid()."
17207 set gid_t gidtype xxx stdio.h sys/types.h
17208 eval $typedef
17209 case "$gidtype" in
17210 xxx)
17211         xxx=`./findhdr sys/user.h`
17212         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17213         case $1 in
17214         unsigned) dflt="$1 $2" ;;
17215         *) dflt="$1" ;;
17216         esac
17217         ;;
17218 *) dflt="$gidtype";;
17219 esac
17220 case "$gidtype" in
17221 gid_t) echo "gid_t found." ;;
17222 *)      rp="What is the type for group ids returned by getgid()?"
17223         . ./myread
17224         gidtype="$ans"
17225         ;;
17226 esac
17227
17228 echo " "
17229 case "$gidtype" in
17230 *_t) zzz="$gidtype"     ;;
17231 *)   zzz="gid"          ;;
17232 esac
17233 echo "Checking the size of $zzz..." >&4 
17234 cat > try.c <<EOCP
17235 #include <sys/types.h>
17236 #include <stdio.h>
17237 int main() {
17238     printf("%d\n", (int)sizeof($gidtype));
17239     exit(0);
17240 }
17241 EOCP
17242 set try
17243 if eval $compile_ok; then
17244         yyy=`$run ./try`
17245         case "$yyy" in
17246         '')     gidsize=4
17247                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17248                 ;;
17249         *)      gidsize=$yyy
17250                 echo "Your $zzz is $gidsize bytes long."
17251                 ;;
17252         esac
17253 else
17254         gidsize=4
17255         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17256 fi
17257
17258
17259 echo " "
17260 case "$gidtype" in
17261 *_t) zzz="$gidtype"     ;;
17262 *)   zzz="gid"          ;;
17263 esac
17264 echo "Checking the sign of $zzz..." >&4 
17265 cat > try.c <<EOCP
17266 #include <sys/types.h>
17267 #include <stdio.h>
17268 int main() {
17269         $gidtype foo = -1;
17270         if (foo < 0)
17271                 printf("-1\n");
17272         else
17273                 printf("1\n");
17274 }
17275 EOCP
17276 set try
17277 if eval $compile; then
17278         yyy=`$run ./try`
17279         case "$yyy" in
17280         '')     gidsign=1
17281                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17282                 ;;
17283         *)      gidsign=$yyy
17284                 case "$gidsign" in
17285                  1) echo "Your $zzz is unsigned." ;;
17286                 -1) echo "Your $zzz is signed."   ;;
17287                 esac
17288                 ;;
17289         esac
17290 else
17291         gidsign=1
17292         echo "(I can't compile the test program--guessing unsigned.)" >&4
17293 fi
17294
17295
17296 echo " "
17297
17298 if $test X"$quadtype" != X; then
17299
17300 echo "Checking how to print 64-bit integers..." >&4
17301
17302 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17303         $cat >try.c <<'EOCP'
17304 #include <sys/types.h>
17305 #include <stdio.h>
17306 int main() {
17307   int q = 12345678901;
17308   printf("%ld\n", q);
17309 }
17310 EOCP
17311         set try
17312         if eval $compile; then
17313                 yyy=`$run ./try`
17314                 case "$yyy" in
17315                 12345678901)
17316                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17317                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17318                         echo "We will use %d."
17319                         ;;
17320                 esac
17321         fi
17322 fi
17323
17324 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17325         $cat >try.c <<'EOCP'
17326 #include <sys/types.h>
17327 #include <stdio.h>
17328 int main() {
17329   long q = 12345678901;
17330   printf("%ld\n", q);
17331 }
17332 EOCP
17333         set try
17334         if eval $compile; then
17335                 yyy=`$run ./try`
17336                 case "$yyy" in
17337                 12345678901)
17338                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17339                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17340                         echo "We will use %ld."
17341                         ;;
17342                 esac
17343         fi
17344 fi
17345
17346 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17347         $cat >try.c <<'EOCP'
17348 #include <sys/types.h>
17349 #include <inttypes.h>
17350 #include <stdio.h>
17351 int main() {
17352   int64_t q = 12345678901;
17353   printf("%" PRId64 "\n", q);
17354 }
17355 EOCP
17356         set try
17357         if eval $compile; then
17358                 yyy=`$run ./try`
17359                 case "$yyy" in
17360                 12345678901)
17361                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17362                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17363                         echo "We will use the C9X style."
17364                         ;;
17365                 esac
17366         fi
17367 fi
17368
17369 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17370         $cat >try.c <<EOCP
17371 #include <sys/types.h>
17372 #include <stdio.h>
17373 int main() {
17374   $quadtype q = 12345678901;
17375   printf("%Ld\n", q);
17376 }
17377 EOCP
17378         set try
17379         if eval $compile; then
17380                 yyy=`$run ./try`
17381                 case "$yyy" in
17382                 12345678901)
17383                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17384                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17385                         echo "We will use %Ld."
17386                         ;;
17387                 esac
17388         fi
17389 fi
17390
17391 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17392         $cat >try.c <<'EOCP'
17393 #include <sys/types.h>
17394 #include <stdio.h>
17395 int main() {
17396   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17397   printf("%lld\n", q);
17398 }
17399 EOCP
17400         set try
17401         if eval $compile; then
17402                 yyy=`$run ./try`
17403                 case "$yyy" in
17404                 12345678901)
17405                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17406                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17407                         echo "We will use the %lld style."
17408                         ;;
17409                 esac
17410         fi
17411 fi
17412
17413 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17414         $cat >try.c <<EOCP
17415 #include <sys/types.h>
17416 #include <stdio.h>
17417 int main() {
17418   $quadtype q = 12345678901;
17419   printf("%qd\n", q);
17420 }
17421 EOCP
17422         set try
17423         if eval $compile; then
17424                 yyy=`$run ./try`
17425                 case "$yyy" in
17426                 12345678901)
17427                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17428                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17429                         echo "We will use %qd."
17430                         ;;
17431                 esac
17432         fi
17433 fi
17434
17435 if $test X"$sPRId64" = X; then
17436         echo "Cannot figure out how to print 64-bit integers." >&4
17437 fi
17438
17439 $rm -f try try.*
17440
17441 fi
17442
17443 case "$sPRId64" in
17444 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17445         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17446         ;;
17447 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17448         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17449         ;;
17450 esac
17451
17452
17453 echo " "
17454 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17455
17456 if $test X"$ivsize" = X8; then
17457         ivdformat="$sPRId64"
17458         uvuformat="$sPRIu64"
17459         uvoformat="$sPRIo64"
17460         uvxformat="$sPRIx64"
17461         uvXUformat="$sPRIXU64"
17462 else
17463         if $test X"$ivsize" = X"$longsize"; then
17464                 ivdformat='"ld"'
17465                 uvuformat='"lu"'
17466                 uvoformat='"lo"'
17467                 uvxformat='"lx"'
17468                 uvXUformat='"lX"'
17469         else
17470                 if $test X"$ivsize" = X"$intsize"; then
17471                         ivdformat='"d"'
17472                         uvuformat='"u"'
17473                         uvoformat='"o"'
17474                         uvxformat='"x"'
17475                         uvXUformat='"X"'
17476                 else
17477                         : far out
17478                         if $test X"$ivsize" = X"$shortsize"; then
17479                                 ivdformat='"hd"'
17480                                 uvuformat='"hu"'
17481                                 uvoformat='"ho"'
17482                                 uvxformat='"hx"'
17483                                 uvXUformat='"hX"'
17484                         fi
17485                 fi
17486         fi
17487 fi
17488
17489 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17490         nveformat="$sPRIeldbl"
17491         nvfformat="$sPRIfldbl"
17492         nvgformat="$sPRIgldbl"
17493         nvEUformat="$sPRIEUldbl"
17494         nvFUformat="$sPRIFUldbl"
17495         nvGUformat="$sPRIGUldbl"
17496 else
17497         nveformat='"e"'
17498         nvfformat='"f"'
17499         nvgformat='"g"'
17500         nvEUformat='"E"'
17501         nvFUformat='"F"'
17502         nvGUformat='"G"'
17503 fi
17504
17505 case "$ivdformat" in
17506 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17507     exit 1
17508     ;;
17509 esac
17510
17511
17512 echo " "
17513 $echo "Checking the format string to be used for gids..." >&4
17514
17515 case "$gidsign" in
17516 -1)     if $test X"$gidsize" = X"$ivsize"; then
17517                 gidformat="$ivdformat"
17518         else
17519                 if $test X"$gidsize" = X"$longsize"; then
17520                         gidformat='"ld"'
17521                 else
17522                         if $test X"$gidsize" = X"$intsize"; then
17523                                 gidformat='"d"'
17524                         else
17525                                 if $test X"$gidsize" = X"$shortsize"; then
17526                                         gidformat='"hd"'
17527                                 fi
17528                         fi
17529                 fi
17530         fi
17531         ;;
17532 *)      if $test X"$gidsize" = X"$uvsize"; then
17533                 gidformat="$uvuformat"
17534         else
17535                 if $test X"$gidsize" = X"$longsize"; then
17536                         gidformat='"lu"'
17537                 else
17538                         if $test X"$gidsize" = X"$intsize"; then
17539                                 gidformat='"u"'
17540                         else
17541                                 if $test X"$gidsize" = X"$shortsize"; then
17542                                         gidformat='"hu"'
17543                                 fi
17544                         fi
17545                 fi
17546         fi
17547         ;;
17548 esac
17549
17550 : see if getgroups exists
17551 set getgroups d_getgrps
17552 eval $inlibc
17553
17554 : see if setgroups exists
17555 set setgroups d_setgrps
17556 eval $inlibc
17557
17558
17559 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17560 echo " "
17561 case "$d_getgrps$d_setgrps" in
17562 *define*)
17563         case "$groupstype" in
17564         '') dflt="$gidtype" ;;
17565         *)  dflt="$groupstype" ;;
17566         esac
17567         $cat <<EOM
17568 What type of pointer is the second argument to getgroups() and setgroups()?
17569 Usually this is the same as group ids, $gidtype, but not always.
17570
17571 EOM
17572         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17573         . ./myread
17574         groupstype="$ans"
17575         ;;
17576 *)  groupstype="$gidtype";;
17577 esac
17578
17579 echo " "
17580 echo "Checking if your $make program sets \$(MAKE)..." >&4
17581 case "$make_set_make" in
17582 '')
17583         $sed 's/^X //' > testmake.mak << 'EOF'
17584 Xall:
17585 X       @echo 'maketemp="$(MAKE)"'
17586 EOF
17587         case "`$make -f testmake.mak 2>/dev/null`" in
17588         *maketemp=*) make_set_make='#' ;;
17589         *)      make_set_make="MAKE=$make" ;;
17590         esac
17591         $rm -f testmake.mak
17592         ;;
17593 esac
17594 case "$make_set_make" in
17595 '#') echo "Yup, it does.";;
17596 *) echo "Nope, it doesn't.";;
17597 esac
17598
17599 : see what type is used for mode_t
17600 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17601 set mode_t modetype int stdio.h sys/types.h
17602 eval $typedef_ask
17603
17604 : see if stdarg is available
17605 echo " "
17606 if $test `./findhdr stdarg.h`; then
17607         echo "<stdarg.h> found." >&4
17608         valstd="$define"
17609 else
17610         echo "<stdarg.h> NOT found." >&4
17611         valstd="$undef"
17612 fi
17613
17614 : see if varags is available
17615 echo " "
17616 if $test `./findhdr varargs.h`; then
17617         echo "<varargs.h> found." >&4
17618 else
17619         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17620 fi
17621
17622 : set up the varargs testing programs
17623 $cat > varargs.c <<EOP
17624 #ifdef I_STDARG
17625 #include <stdarg.h>
17626 #endif
17627 #ifdef I_VARARGS
17628 #include <varargs.h>
17629 #endif
17630
17631 #ifdef I_STDARG
17632 int f(char *p, ...)
17633 #else
17634 int f(va_alist)
17635 va_dcl
17636 #endif
17637 {
17638         va_list ap;
17639 #ifndef I_STDARG
17640         char *p;
17641 #endif
17642 #ifdef I_STDARG
17643         va_start(ap,p);
17644 #else
17645         va_start(ap);
17646         p = va_arg(ap, char *);
17647 #endif
17648         va_end(ap);
17649 }
17650 EOP
17651 $cat > varargs <<EOP
17652 $startsh
17653 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17654         echo "true"
17655 else
17656         echo "false"
17657 fi
17658 $rm -f varargs$_o
17659 EOP
17660 chmod +x varargs
17661
17662 : now check which varargs header should be included
17663 echo " "
17664 i_varhdr=''
17665 case "$valstd" in
17666 "$define")
17667         if `./varargs I_STDARG`; then
17668                 val='stdarg.h'
17669         elif `./varargs I_VARARGS`; then
17670                 val='varargs.h'
17671         fi
17672         ;;
17673 *)
17674         if `./varargs I_VARARGS`; then
17675                 val='varargs.h'
17676         fi
17677         ;;
17678 esac
17679 case "$val" in
17680 '')
17681 echo "I could not find the definition for va_dcl... You have problems..." >&4
17682         val="$undef"; set i_stdarg; eval $setvar
17683         val="$undef"; set i_varargs; eval $setvar
17684         ;;
17685 *) 
17686         set i_varhdr
17687         eval $setvar
17688         case "$i_varhdr" in
17689         stdarg.h)
17690                 val="$define"; set i_stdarg; eval $setvar
17691                 val="$undef"; set i_varargs; eval $setvar
17692                 ;;
17693         varargs.h)
17694                 val="$undef"; set i_stdarg; eval $setvar
17695                 val="$define"; set i_varargs; eval $setvar
17696                 ;;
17697         esac
17698         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17699 esac
17700 $rm -f varargs*
17701
17702 : see if we need va_copy
17703 echo " "
17704 case "$i_stdarg" in
17705 "$define")
17706         $cat >try.c <<EOCP
17707 #include <stdarg.h>
17708 #include <stdio.h>
17709 #$i_stdlib I_STDLIB
17710 #ifdef I_STDLIB
17711 #include <stdlib.h>
17712 #endif
17713 #include <signal.h>
17714
17715 int
17716 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17717 {
17718   return vfprintf(f, fmt, *valp);
17719 }
17720  
17721 int    
17722 myvfprintf(FILE *f, const  char *fmt, va_list val)
17723 {
17724   return ivfprintf(f, fmt, &val);
17725 }
17726       
17727 int
17728 myprintf(char *fmt, ...) 
17729 {
17730   va_list val;
17731   va_start(val, fmt);
17732   return myvfprintf(stdout, fmt, val); 
17733 }         
17734
17735 int
17736 main(int ac, char **av)
17737 {
17738   signal(SIGSEGV, exit);
17739
17740   myprintf("%s%cs all right, then\n", "that", '\'');                            
17741   exit(0);      
17742 }
17743 EOCP
17744         set try
17745         if eval $compile && $run ./try 2>&1 >/dev/null; then
17746                 case "`$run ./try`" in
17747                 "that's all right, then")
17748                         okay=yes
17749                         ;;
17750                 esac
17751         fi
17752         case "$okay" in
17753         yes)    echo "It seems that you don't need va_copy()." >&4
17754                 need_va_copy="$undef"
17755                 ;;
17756         *)      echo "It seems that va_copy() or similar will be needed." >&4
17757                 need_va_copy="$define"
17758                 ;;
17759         esac
17760         $rm -f try.* core core.* *.core *.core.*
17761         ;;
17762 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17763         ;;
17764 esac
17765
17766 : see what type is used for size_t
17767 rp="What is the type used for the length parameter for string functions?"
17768 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17769 eval $typedef_ask
17770
17771 : check for type of arguments to gethostbyaddr. 
17772 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17773         case "$d_gethbyaddr" in
17774         $define)
17775                 $cat <<EOM
17776
17777 Checking to see what type of arguments are accepted by gethostbyaddr().
17778 EOM
17779                 hdrs="$define sys/types.h
17780                         $d_socket sys/socket.h 
17781                         $i_niin netinet/in.h 
17782                         $i_netdb netdb.h
17783                         $i_unistd unistd.h"
17784                 : The first arg can 'char *' or 'void *'
17785                 : The second arg is some of integral type
17786                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17787                         for yyy in size_t long int; do
17788                                 case "$netdb_host_type" in
17789                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17790                                         if ./protochk "$try" $hdrs; then
17791                                                 echo "Your system accepts $xxx for the first arg."
17792                                                 echo "...and $yyy for the second arg."
17793                                                 netdb_host_type="$xxx"
17794                                                 netdb_hlen_type="$yyy"
17795                                         fi
17796                                         ;;
17797                                 esac
17798                         done
17799                 done
17800                 : In case none of those worked, prompt the user.
17801                 case "$netdb_host_type" in
17802                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17803                         dflt='char *'
17804                         . ./myread
17805                         netdb_host_type=$ans
17806                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17807                         dflt="$sizetype"
17808                         . ./myread
17809                         netdb_hlen_type=$ans
17810                         ;;
17811                 esac
17812                 ;;
17813         *)      : no gethostbyaddr, so pick harmless defaults
17814                 netdb_host_type='char *'
17815                 netdb_hlen_type="$sizetype"
17816                 ;;
17817         esac
17818         # Remove the "const" if needed. -- but then we'll have a 
17819         # prototype clash!
17820         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17821 fi
17822
17823 : check for type of argument to gethostbyname. 
17824 if test "X$netdb_name_type" = X ; then
17825         case "$d_gethbyname" in
17826         $define)
17827                 $cat <<EOM
17828
17829 Checking to see what type of argument is accepted by gethostbyname().
17830 EOM
17831                 hdrs="$define sys/types.h
17832                         $d_socket sys/socket.h 
17833                         $i_niin netinet/in.h 
17834                         $i_netdb netdb.h
17835                         $i_unistd unistd.h"
17836                 for xxx in "const char *" "char *"; do
17837                         case "$netdb_name_type" in
17838                         '')     try="extern struct hostent *gethostbyname($xxx);"
17839                                 if ./protochk "$try" $hdrs; then
17840                                         echo "Your system accepts $xxx."
17841                                         netdb_name_type="$xxx"
17842                                 fi
17843                                 ;;
17844                         esac
17845                 done
17846                 : In case none of those worked, prompt the user.
17847                 case "$netdb_name_type" in
17848                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17849                         dflt='char *'
17850                         . ./myread
17851                         netdb_name_type=$ans
17852                         ;;
17853                 esac
17854                 ;;
17855         *)      : no gethostbyname, so pick harmless default
17856                 netdb_name_type='char *'
17857                 ;;
17858         esac
17859 fi
17860
17861 : check for type of 1st argument to getnetbyaddr. 
17862 if test "X$netdb_net_type" = X ; then
17863         case "$d_getnbyaddr" in
17864         $define)
17865                 $cat <<EOM
17866
17867 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17868 EOM
17869                 hdrs="$define sys/types.h
17870                         $d_socket sys/socket.h 
17871                         $i_niin netinet/in.h 
17872                         $i_netdb netdb.h
17873                         $i_unistd unistd.h"
17874                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17875                         case "$netdb_net_type" in
17876                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17877                                 if ./protochk "$try" $hdrs; then
17878                                         echo "Your system accepts $xxx."
17879                                         netdb_net_type="$xxx"
17880                                 fi
17881                                 ;;
17882                         esac
17883                 done
17884                 : In case none of those worked, prompt the user.
17885                 case "$netdb_net_type" in
17886                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17887                         dflt='long'
17888                         . ./myread
17889                         netdb_net_type=$ans
17890                         ;;
17891                 esac
17892                 ;;
17893         *)      : no getnetbyaddr, so pick harmless default
17894                 netdb_net_type='long'
17895                 ;;
17896         esac
17897 fi
17898 : locate the preferred pager for this system
17899 fn=f/
17900 case "$pager" in
17901 '')
17902         dflt=''
17903         case "$pg" in
17904         /*) dflt=$pg;;
17905         [a-zA-Z]:/*) dflt=$pg;;
17906         esac
17907         case "$more" in
17908         /*) dflt=$more;;
17909         [a-zA-Z]:/*) dflt=$more;;
17910         esac
17911         case "$less" in
17912         /*) dflt=$less;;
17913         [a-zA-Z]:/*) dflt=$less;;
17914         esac
17915         case "$dflt" in
17916         '') dflt=/usr/ucb/more;;
17917         esac
17918         ;;
17919 *)      dflt="$pager"
17920         : Instruct ./getfile to trust the hinted or previous pager value,
17921         : even if it does not begin with a slash.  For example, on os2,
17922         : pager might be cmd /c more.  See comments in UU/getfile.
17923         fn="f/($pager)"
17924         ;;
17925 esac
17926 echo " "
17927 rp='What pager is used on your system?'
17928 . ./getfile
17929 pager="$ans"
17930
17931 : see what type pids are declared as in the kernel
17932 rp="What is the type of process ids on this system?"
17933 set pid_t pidtype int stdio.h sys/types.h
17934 eval $typedef_ask
17935
17936 : Find earliest binary compatible site_perl subdirectory perl can use.
17937 xs_apiversion=$version # The current site_perl version.
17938 : Find earliest pure perl site_perl subdirectory perl can use.
17939 : The versioned directories started at 5.005.
17940 pm_apiversion='5.005'
17941
17942 : see if ar generates random libraries by itself
17943 echo " "
17944 echo "Checking how to generate random libraries on your machine..." >&4
17945 echo 'int bar1() { return bar2(); }' > bar1.c
17946 echo 'int bar2() { return 2; }' > bar2.c
17947 $cat > foo.c <<'EOP'
17948 int main() { printf("%d\n", bar1()); exit(0); }
17949 EOP
17950 $cc $ccflags -c bar1.c >/dev/null 2>&1
17951 $cc $ccflags -c bar2.c >/dev/null 2>&1
17952 $cc $ccflags -c foo.c >/dev/null 2>&1
17953 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17954 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17955         $run ./foobar >/dev/null 2>&1; then
17956         echo "$ar appears to generate random libraries itself."
17957         orderlib=false
17958         ranlib=":"
17959 elif $ar ts bar$_a >/dev/null 2>&1 &&
17960         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17961         $run ./foobar >/dev/null 2>&1; then
17962                 echo "a table of contents needs to be added with '$ar ts'."
17963                 orderlib=false
17964                 ranlib="$ar ts"
17965 else
17966         case "$ranlib" in
17967         :) ranlib='';;
17968         '')
17969                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17970                 $test -f $ranlib || ranlib=''
17971                 ;;
17972         esac
17973         if $test -n "$ranlib"; then
17974                 echo "your system has '$ranlib'; we'll use that."
17975                 orderlib=false
17976         else
17977                 echo "your system doesn't seem to support random libraries"
17978                 echo "so we'll use lorder and tsort to order the libraries."
17979                 orderlib=true
17980                 ranlib=":"
17981         fi
17982 fi
17983 $rm -f foo* bar* 
17984
17985 : check for type of arguments to select. 
17986 case "$selecttype" in
17987 '') case "$d_select" in
17988         $define)
17989                 echo " "
17990                 $cat <<EOM
17991 Checking to see what type of arguments are accepted by select().
17992 EOM
17993                 hdrs="$define sys/types.h
17994                         $i_systime sys/time.h 
17995                         $i_sysselct sys/select.h
17996                         $d_socket sys/socket.h"
17997                 : The first arg can be int, unsigned, or size_t
17998                 : The last arg may or may not be 'const'
17999                 val=''
18000                 : void pointer has been seen but using that
18001                 : breaks the selectminbits test
18002                 for xxx in 'fd_set *' 'int *'; do
18003                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18004                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18005                                         case "$val" in
18006                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18007                                                 if ./protochk "$try" $hdrs; then
18008                                                         echo "Your system accepts $xxx."
18009                                                         val="$xxx"
18010                                                 fi
18011                                                 ;;
18012                                         esac
18013                                 done
18014                         done
18015                 done
18016                 case "$val" in
18017                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18018                         case "$d_fd_set" in
18019                                 $define) dflt="fd_set *" ;;
18020                                 *)              dflt="int *" ;;
18021                         esac
18022                         . ./myread
18023                         val=$ans
18024                         ;;
18025                 esac
18026                 selecttype="$val"
18027                 ;;
18028         *)      : no select, so pick a harmless default
18029                 selecttype='int *'
18030                 ;;
18031         esac
18032         ;;
18033 esac
18034
18035 : check for the select 'width'
18036 case "$selectminbits" in
18037 '') case "$d_select" in
18038         $define)
18039                 $cat <<EOM
18040
18041 Checking to see on how many bits at a time your select() operates...
18042 EOM
18043                 $cat >try.c <<EOCP
18044 #include <sys/types.h>
18045 #$i_time I_TIME
18046 #$i_systime I_SYS_TIME
18047 #$i_systimek I_SYS_TIME_KERNEL
18048 #ifdef I_TIME
18049 #   include <time.h>
18050 #endif
18051 #ifdef I_SYS_TIME
18052 #   ifdef I_SYS_TIME_KERNEL
18053 #       define KERNEL
18054 #   endif
18055 #   include <sys/time.h>
18056 #   ifdef I_SYS_TIME_KERNEL
18057 #       undef KERNEL
18058 #   endif
18059 #endif
18060 #$i_sysselct I_SYS_SELECT
18061 #ifdef I_SYS_SELECT
18062 #include <sys/select.h>
18063 #endif
18064 #$d_socket HAS_SOCKET
18065 #ifdef HAS_SOCKET
18066 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18067 #endif
18068 #include <stdio.h>
18069 $selecttype b;
18070 #define S sizeof(*(b))
18071 #define MINBITS 64
18072 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18073 #define NBITS  (NBYTES * 8)
18074 int main() {
18075     char s[NBYTES];
18076     struct timeval t;
18077     int i;
18078     FILE* fp;
18079     int fd;
18080
18081     fclose(stdin);
18082     fp = fopen("try.c", "r");
18083     if (fp == 0)
18084       exit(1);
18085     fd = fileno(fp);
18086     if (fd < 0)
18087       exit(2);
18088     b = ($selecttype)s;
18089     for (i = 0; i < NBITS; i++)
18090         FD_SET(i, b);
18091     t.tv_sec  = 0;
18092     t.tv_usec = 0;
18093     select(fd + 1, b, 0, 0, &t);
18094     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18095     printf("%d\n", i + 1);
18096     return 0;
18097 }
18098 EOCP
18099                 set try
18100                 if eval $compile_ok; then
18101                         selectminbits=`$run ./try`
18102                         case "$selectminbits" in
18103                         '')     cat >&4 <<EOM
18104 Cannot figure out on how many bits at a time your select() operates.
18105 I'll play safe and guess it is 32 bits.
18106 EOM
18107                                 selectminbits=32
18108                                 bits="32 bits"
18109                                 ;;
18110                         1)      bits="1 bit" ;;
18111                         *)      bits="$selectminbits bits" ;;
18112                         esac
18113                         echo "Your select() operates on $bits at a time." >&4
18114                 else
18115                         rp='What is the minimum number of bits your select() operates on?'
18116                         case "$byteorder" in
18117                         1234|12345678)  dflt=32 ;;
18118                         *)              dflt=1  ;;
18119                         esac
18120                         . ./myread
18121                         val=$ans
18122                         selectminbits="$val"
18123                 fi
18124                 $rm -f try.* try
18125                 ;;
18126         *)      : no select, so pick a harmless default
18127                 selectminbits='32'
18128                 ;;
18129         esac
18130         ;;
18131 esac
18132
18133 : Trace out the files included by signal.h, then look for SIGxxx names.
18134 : Remove SIGARRAYSIZE used by HPUX.
18135 : Remove SIGSTKSIZE used by Linux.
18136 : Remove SIGSTKSZ used by Posix.
18137 : Remove SIGTYP void lines used by OS2.
18138 : Some cpps, like os390, dont give the file name anywhere
18139 if [ "X$fieldn" = X ]; then
18140         : Just make some guesses.  We check them later.
18141         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18142 else
18143         xxx=`echo '#include <signal.h>' |
18144         $cppstdin $cppminus $cppflags 2>/dev/null |
18145         $grep '^[       ]*#.*include' | 
18146         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18147 fi
18148 : Check this list of files to be sure we have parsed the cpp output ok.
18149 : This will also avoid potentially non-existent files, such 
18150 : as ../foo/bar.h
18151 xxxfiles=''
18152 for xx in $xxx /dev/null ; do
18153         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18154 done
18155 : If we have found no files, at least try signal.h
18156 case "$xxxfiles" in
18157 '')     xxxfiles=`./findhdr signal.h` ;;
18158 esac
18159 xxx=`awk '
18160 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18161         print substr($2, 4, 20)
18162 }
18163 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18164         print substr($3, 4, 20)
18165 }' $xxxfiles`
18166 : Append some common names just in case the awk scan failed.
18167 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18168 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18169 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18170 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18171 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18172
18173 : generate a few handy files for later
18174 $cat > signal.c <<'EOCP'
18175 #include <sys/types.h>
18176 #include <signal.h>
18177 #include <stdio.h>
18178 int main() {
18179
18180 /* Strange style to avoid deeply-nested #if/#else/#endif */
18181 #ifndef NSIG
18182 #  ifdef _NSIG
18183 #    define NSIG (_NSIG)
18184 #  endif
18185 #endif
18186
18187 #ifndef NSIG
18188 #  ifdef SIGMAX
18189 #    define NSIG (SIGMAX+1)
18190 #  endif
18191 #endif
18192
18193 #ifndef NSIG
18194 #  ifdef SIG_MAX
18195 #    define NSIG (SIG_MAX+1)
18196 #  endif
18197 #endif
18198
18199 #ifndef NSIG
18200 #  ifdef MAXSIG
18201 #    define NSIG (MAXSIG+1)
18202 #  endif
18203 #endif
18204
18205 #ifndef NSIG
18206 #  ifdef MAX_SIG
18207 #    define NSIG (MAX_SIG+1)
18208 #  endif
18209 #endif
18210
18211 #ifndef NSIG
18212 #  ifdef SIGARRAYSIZE
18213 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18214 #  endif
18215 #endif
18216
18217 #ifndef NSIG
18218 #  ifdef _sys_nsig
18219 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18220 #  endif
18221 #endif
18222
18223 /* Default to some arbitrary number that's big enough to get most
18224    of the common signals.
18225 */
18226 #ifndef NSIG
18227 #    define NSIG 50
18228 #endif
18229
18230 printf("NSIG %d\n", NSIG);
18231
18232 #ifndef JUST_NSIG
18233
18234 EOCP
18235
18236 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18237 {
18238         printf "#ifdef SIG"; printf $1; printf "\n"
18239         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18240         printf $1; printf ");\n"
18241         printf "#endif\n"
18242 }
18243 END {
18244         printf "#endif /* JUST_NSIG */\n";
18245         printf "exit(0);\n}\n";
18246 }
18247 ' >>signal.c
18248 $cat >signal.awk <<'EOP'
18249 BEGIN { ndups = 0 }
18250 $1 ~ /^NSIG$/ { nsig = $2 }
18251 ($1 !~ /^NSIG$/) && (NF == 2) {
18252     if ($2 > maxsig) { maxsig = $2 }
18253     if (sig_name[$2]) {
18254         dup_name[ndups] = $1
18255         dup_num[ndups] = $2
18256         ndups++ 
18257     }
18258     else {
18259         sig_name[$2] = $1
18260         sig_num[$2] = $2
18261     }
18262 }
18263 END { 
18264     if (nsig == 0) {
18265         nsig = maxsig + 1
18266     }
18267     printf("NSIG %d\n", nsig);
18268     for (n = 1; n < nsig; n++) {
18269         if (sig_name[n]) {
18270             printf("%s %d\n", sig_name[n], sig_num[n])
18271         }
18272         else {
18273             printf("NUM%d %d\n", n, n) 
18274         }
18275     }
18276     for (n = 0; n < ndups; n++) {
18277         printf("%s %d\n", dup_name[n], dup_num[n])
18278     }
18279 }
18280 EOP
18281 $cat >signal_cmd <<EOS
18282 $startsh
18283 if $test -s signal.lst; then
18284     echo "Using your existing signal.lst file"
18285         exit 0
18286 fi
18287 xxx="$xxx"
18288 EOS
18289 $cat >>signal_cmd <<'EOS'
18290
18291 set signal
18292 if eval $compile_ok; then
18293         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18294 else
18295         echo "(I can't seem be able to compile the whole test program)" >&4
18296         echo "(I'll try it in little pieces.)" >&4
18297         set signal -DJUST_NSIG
18298         if eval $compile_ok; then
18299                 $run ./signal$_exe > signal.nsg
18300                 $cat signal.nsg
18301         else
18302                 echo "I can't seem to figure out how many signals you have." >&4
18303                 echo "Guessing 50." >&4
18304                 echo 'NSIG 50' > signal.nsg
18305         fi
18306         : Now look at all the signal names, one at a time.
18307         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18308                 $cat > signal.c <<EOCP
18309 #include <sys/types.h>
18310 #include <signal.h>
18311 #include <stdio.h>
18312 int main() {
18313 printf("$xx %d\n", SIG${xx});
18314 return 0;
18315 }
18316 EOCP
18317                 set signal
18318                 if eval $compile; then
18319                         echo "SIG${xx} found."
18320                         $run ./signal$_exe  >> signal.ls1
18321                 else
18322                         echo "SIG${xx} NOT found."
18323                 fi
18324         done
18325         if $test -s signal.ls1; then
18326                 $cat signal.nsg signal.ls1 |
18327                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18328         fi
18329
18330 fi
18331 if $test -s signal.lst; then
18332         :
18333 else
18334         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18335         echo 'kill -l' >signal
18336         set X `csh -f <signal`
18337         $rm -f signal
18338         shift
18339         case $# in
18340         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18341         esac
18342         echo $@ | $tr ' ' $trnl | \
18343             $awk '{ printf "%s %d\n", $1, ++s; }
18344                   END { printf "NSIG %d\n", ++s }' >signal.lst
18345 fi
18346 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18347 EOS
18348 chmod a+x signal_cmd
18349 $eunicefix signal_cmd
18350
18351 : generate list of signal names
18352 echo " "
18353 case "$sig_name_init" in
18354 '') doinit=yes ;;
18355 *)  case "$sig_num_init" in
18356     ''|*,*) doinit=yes ;;
18357     esac ;;
18358 esac
18359 case "$doinit" in
18360 yes)
18361         echo "Generating a list of signal names and numbers..." >&4
18362         . ./signal_cmd
18363         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18364         sig_name=`$awk 'BEGIN { printf "ZERO " }
18365                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18366         sig_num=`$awk  'BEGIN { printf "0 " }
18367                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18368         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18369                              !/^NSIG/   { printf "\"%s\", ", $1 }
18370                              END        { printf "0\n" }' signal.lst`
18371         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18372                              !/^NSIG/   { printf "%d, ", $2}
18373                              END        { printf "0\n"}' signal.lst`
18374         ;;
18375 esac
18376 echo "The following $sig_count signals are available:"
18377 echo " "
18378 echo $sig_name | $awk \
18379 'BEGIN { linelen = 0 }
18380 {
18381         for (i = 1; i <= NF; i++) {
18382                 name = "SIG" $i " "
18383                 linelen = linelen + length(name)
18384                 if (linelen > 70) {
18385                         printf "\n"
18386                         linelen = length(name)
18387                 }
18388                 printf "%s", name
18389         }
18390         printf "\n"
18391 }'
18392 sig_size=`echo $sig_name | awk '{print NF}'`
18393 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18394
18395 echo " "
18396 case "$sizetype" in
18397 *_t) zzz="$sizetype"    ;;
18398 *)   zzz="filesize"     ;;
18399 esac
18400 echo "Checking the size of $zzz..." >&4 
18401 cat > try.c <<EOCP
18402 #include <sys/types.h>
18403 #include <stdio.h>
18404 int main() {
18405     printf("%d\n", (int)sizeof($sizetype));
18406     exit(0);
18407 }
18408 EOCP
18409 set try
18410 if eval $compile_ok; then
18411         yyy=`$run ./try`
18412         case "$yyy" in
18413         '')     sizesize=4
18414                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18415                 ;;
18416         *)      sizesize=$yyy
18417                 echo "Your $zzz size is $sizesize bytes."
18418                 ;;
18419         esac
18420 else
18421         sizesize=4
18422         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18423 fi
18424
18425
18426 : check for socklen_t
18427 echo " "
18428 echo "Checking to see if you have socklen_t..." >&4
18429 $cat >try.c <<EOCP
18430 #include <sys/types.h>
18431 #$d_socket HAS_SOCKET
18432 #ifdef HAS_SOCKET
18433 #include <sys/socket.h>
18434 #endif
18435 int main() { socklen_t x = 16; }
18436 EOCP
18437 set try
18438 if eval $compile; then
18439         val="$define"
18440         echo "You have socklen_t."
18441 else
18442         val="$undef"
18443         echo "You do not have socklen_t."
18444         case "$sizetype" in
18445         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18446         esac
18447 fi
18448 $rm -f try try.*
18449 set d_socklen_t
18450 eval $setvar
18451
18452 : see if this is a socks.h system
18453 set socks.h i_socks
18454 eval $inhdr
18455
18456 : check for type of the size argument to socket calls
18457 case "$d_socket" in
18458 "$define")
18459         $cat <<EOM
18460
18461 Checking to see what type is the last argument of accept().
18462 EOM
18463         yyy=''
18464         case "$d_socklen_t" in
18465         "$define") yyy="$yyy socklen_t"
18466         esac
18467         yyy="$yyy $sizetype int long unsigned"
18468         for xxx in $yyy; do
18469                 case "$socksizetype" in
18470                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18471                         case "$usesocks" in
18472                         "$define")
18473                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18474                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18475                                         socksizetype="$xxx"
18476                                 fi
18477                                 ;;
18478                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18479                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18480                                         socksizetype="$xxx"
18481                                 fi
18482                                 ;;
18483                         esac
18484                         ;;
18485                 esac
18486         done
18487 : In case none of those worked, prompt the user.
18488         case "$socksizetype" in
18489         '')     rp='What is the type for socket address structure sizes?'
18490                 dflt='int'
18491                 . ./myread
18492                 socksizetype=$ans
18493                 ;;
18494         esac
18495         ;;
18496 *)      : no sockets, so pick relatively harmless default
18497         socksizetype='int'
18498         ;;
18499 esac
18500
18501 : see what type is used for signed size_t
18502 set ssize_t ssizetype int stdio.h sys/types.h
18503 eval $typedef
18504 dflt="$ssizetype"
18505 $cat > try.c <<EOM
18506 #include <stdio.h>
18507 #include <sys/types.h>
18508 #define Size_t $sizetype
18509 #define SSize_t $dflt
18510 int main()
18511 {
18512         if (sizeof(Size_t) == sizeof(SSize_t))
18513                 printf("$dflt\n");
18514         else if (sizeof(Size_t) == sizeof(int))
18515                 printf("int\n");
18516         else 
18517                 printf("long\n");
18518         exit(0);
18519 }
18520 EOM
18521 echo " "
18522 set try
18523 if eval $compile_ok && $run ./try > /dev/null; then
18524         ssizetype=`$run ./try`
18525         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18526 else
18527         $cat >&4 <<EOM
18528 Help! I can't compile and run the ssize_t test program: please enlighten me!
18529 (This is probably a misconfiguration in your system or libraries, and
18530 you really ought to fix it.  Still, I'll try anyway.)
18531
18532 I need a type that is the same size as $sizetype, but is guaranteed to
18533 be signed.  Common values are ssize_t, int and long.
18534
18535 EOM
18536         rp="What signed type is the same size as $sizetype?"
18537         . ./myread
18538         ssizetype="$ans"
18539 fi
18540 $rm -f try try.*
18541
18542 : see what type of char stdio uses.
18543 echo " "
18544 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18545 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18546         echo "Your stdio uses unsigned chars." >&4
18547         stdchar="unsigned char"
18548 else
18549         echo "Your stdio uses signed chars." >&4
18550         stdchar="char"
18551 fi
18552 $rm -f stdioh
18553
18554
18555
18556 : see what type uids are declared as in the kernel
18557 echo " "
18558 echo "Looking for the type for user ids returned by getuid()."
18559 set uid_t uidtype xxx stdio.h sys/types.h
18560 eval $typedef
18561 case "$uidtype" in
18562 xxx)
18563         xxx=`./findhdr sys/user.h`
18564         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18565         case $1 in
18566         unsigned) dflt="$1 $2" ;;
18567         *) dflt="$1" ;;
18568         esac
18569         ;;
18570 *) dflt="$uidtype";;
18571 esac
18572 case "$uidtype" in
18573 uid_t)  echo "uid_t found." ;;
18574 *)      rp="What is the type for user ids returned by getuid()?"
18575         . ./myread
18576         uidtype="$ans"
18577         ;;
18578 esac
18579
18580 echo " "
18581 case "$uidtype" in
18582 *_t) zzz="$uidtype"     ;;
18583 *)   zzz="uid"          ;;
18584 esac
18585 echo "Checking the size of $zzz..." >&4 
18586 cat > try.c <<EOCP
18587 #include <sys/types.h>
18588 #include <stdio.h>
18589 int main() {
18590     printf("%d\n", (int)sizeof($uidtype));
18591     exit(0);
18592 }
18593 EOCP
18594 set try
18595 if eval $compile_ok; then
18596         yyy=`$run ./try`
18597         case "$yyy" in
18598         '')     uidsize=4
18599                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18600                 ;;
18601         *)      uidsize=$yyy
18602                 echo "Your $zzz is $uidsize bytes long."
18603                 ;;
18604         esac
18605 else
18606         uidsize=4
18607         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18608 fi
18609
18610 echo " "
18611 case "$uidtype" in
18612 *_t) zzz="$uidtype"     ;;
18613 *)   zzz="uid"          ;;
18614 esac
18615 echo "Checking the sign of $zzz..." >&4
18616 cat > try.c <<EOCP
18617 #include <sys/types.h>
18618 #include <stdio.h>
18619 int main() {
18620         $uidtype foo = -1;
18621         if (foo < 0)
18622                 printf("-1\n");
18623         else
18624                 printf("1\n");
18625 }
18626 EOCP
18627 set try
18628 if eval $compile; then
18629         yyy=`$run ./try`
18630         case "$yyy" in
18631         '')     uidsign=1
18632                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18633                 ;;
18634         *)      uidsign=$yyy
18635                 case "$uidsign" in
18636                  1) echo "Your $zzz is unsigned." ;;
18637                 -1) echo "Your $zzz is signed."   ;;
18638                 esac
18639                 ;;
18640         esac
18641 else
18642         uidsign=1
18643         echo "(I can't compile the test program--guessing unsigned.)" >&4
18644 fi
18645
18646
18647
18648 echo " "
18649 $echo "Checking the format string to be used for uids..." >&4
18650
18651 case "$uidsign" in
18652 -1)     if $test X"$uidsize" = X"$ivsize"; then
18653                 uidformat="$ivdformat"
18654         else
18655                 if $test X"$uidsize" = X"$longsize"; then
18656                         uidformat='"ld"'
18657                 else
18658                         if $test X"$uidsize" = X"$intsize"; then
18659                                 uidformat='"d"'
18660                         else
18661                                 if $test X"$uidsize" = X"$shortsize"; then
18662                                         uidformat='"hd"'
18663                                 fi
18664                         fi
18665                 fi
18666         fi
18667         ;;
18668 *)      if $test X"$uidsize" = X"$uvsize"; then
18669                 uidformat="$uvuformat"
18670         else
18671                 if $test X"$uidsize" = X"$longsize"; then
18672                         uidformat='"lu"'
18673                 else
18674                         if $test X"$uidsize" = X"$intsize"; then
18675                                 uidformat='"u"'
18676                         else
18677                                 if $test X"$uidsize" = X"$shortsize"; then
18678                                         uidformat='"hu"'
18679                                 fi
18680                         fi
18681                 fi
18682         fi
18683         ;;
18684 esac
18685
18686 : determine compiler compiler
18687 case "$yacc" in
18688 '')
18689         dflt=yacc;;
18690 *)
18691         dflt="$yacc";;
18692 esac
18693 echo " "
18694 comp='yacc'
18695 if $test -f "$byacc$_exe"; then
18696         dflt="$byacc"
18697         comp="byacc or $comp"
18698 fi
18699 if $test -f "$bison$_exe"; then
18700         comp="$comp or bison -y"
18701 fi
18702 rp="Which compiler compiler ($comp) shall I use?"
18703 . ./myread
18704 yacc="$ans"
18705 case "$yacc" in
18706 *bis*)
18707         case "$yacc" in
18708         *-y*) ;;
18709         *)
18710                 yacc="$yacc -y"
18711                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18712                 ;;
18713         esac
18714         ;;
18715 esac
18716
18717 : see if this is a fp.h system
18718 set fp.h i_fp
18719 eval $inhdr
18720
18721 : see if this is a fp_class.h system
18722 set fp_class.h i_fp_class
18723 eval $inhdr
18724
18725 : see if this is a ieeefp.h system
18726 case "$i_ieeefp" in
18727 '' ) set ieeefp.h i_ieeefp
18728      eval $inhdr
18729      ;;
18730 esac
18731
18732 : see if this is a libutil.h system
18733 set libutil.h i_libutil
18734 eval $inhdr
18735
18736 : see if mach cthreads are available
18737 if test "X$usethreads" = "X$define"; then
18738         set mach/cthreads.h i_machcthr
18739         eval $inhdr
18740 else
18741         i_machcthr="$undef"
18742 fi
18743
18744
18745
18746 : see if this is a math.h system
18747 set math.h i_math
18748 eval $inhdr
18749
18750 : see if this is a mntent.h system
18751 set mntent.h i_mntent
18752 eval $inhdr
18753
18754 : see if ndbm.h is available
18755 set ndbm.h t_ndbm
18756 eval $inhdr
18757
18758 case "$t_ndbm" in
18759 $undef)
18760     # Some Linux distributions such as RedHat 7.1 put the
18761     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18762     if $test -f /usr/include/gdbm/ndbm.h; then
18763         echo '<gdbm/ndbm.h> found.'
18764         ccflags="$ccflags -I/usr/include/gdbm"
18765         cppflags="$cppflags -I/usr/include/gdbm"
18766         t_ndbm=$define
18767     fi
18768     ;;
18769 esac
18770
18771 case "$t_ndbm" in
18772 $define)
18773         : see if dbm_open exists
18774         set dbm_open d_dbm_open
18775         eval $inlibc
18776         case "$d_dbm_open" in
18777         $undef)
18778                 t_ndbm="$undef"
18779                 echo "We won't be including <ndbm.h>"
18780                 ;;
18781         esac
18782         ;;
18783 esac
18784 val="$t_ndbm"
18785 set i_ndbm
18786 eval $setvar
18787
18788 : see if net/errno.h is available
18789 val=''
18790 set net/errno.h val
18791 eval $inhdr
18792
18793 : Unfortunately, it causes problems on some systems.  Arrgh.
18794 case "$val" in
18795 $define)
18796         cat > try.c <<'EOM'
18797 #include <stdio.h>
18798 #include <errno.h>
18799 #include <net/errno.h>
18800 int func()
18801 {
18802         return ENOTSOCK;
18803 }
18804 EOM
18805         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18806                 echo "We'll be including <net/errno.h>." >&4
18807         else
18808                 echo "We won't be including <net/errno.h>." >&4
18809                 val="$undef"
18810         fi
18811         $rm -f try.* try
18812         ;;
18813 esac
18814 set i_neterrno
18815 eval $setvar
18816
18817 : see if netinet/tcp.h is available
18818 set netinet/tcp.h i_netinettcp
18819 eval $inhdr
18820
18821 : see if this is a poll.h system
18822 set poll.h i_poll
18823 eval $inhdr
18824
18825 : see if this is a prot.h system
18826 set prot.h i_prot
18827 eval $inhdr
18828
18829 echo " "
18830 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18831 $cat <<'EOSH' > Cppsym.know
18832 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18833 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18834 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18835 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18836 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18837 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18838 bull c cadmus clipper CMU COFF COMPILER_VERSION
18839 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18840 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18841 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18842 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18843 GLIBC GLIBC_MINOR
18844 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18845 H3050R H3050RX hbullx20 hcx host_mips
18846 hp200 hp300 hp700 HP700 hp800 hp9000
18847 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18848 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18849 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18850 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18851 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18852 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18853 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18854 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18855 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18856 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18857 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18858 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18859 MATH_HAS_NO_SIDE_EFFECTS
18860 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18861 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18862 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18863 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18864 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18865 NetBSD news1500 news1700 news1800 news1900 news3700
18866 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18867 ns32016 ns32332 ns32k nsc32000
18868 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18869 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18870 pc532 pdp11 PGC PIC plexus PORTAR posix
18871 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18872 POSIX_C_SOURCE POSIX_SOURCE POWER
18873 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18874 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18875 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18876 sony sony_news sonyrisc sparc sparclite spectrum
18877 stardent stdc STDC_EXT stratos sun sun3 sun386
18878 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18879 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18880 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18881 sysV68 sysV88 Tek4132 Tek4300 titan
18882 TM3200 TM5400 TM5600
18883 tower tower32 tower32_200 tower32_600 tower32_700
18884 tower32_800 tower32_850 tss
18885 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18886 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18887 unix UNIX95 UNIX99 unixpc unos
18888 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18889 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18890 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18891 USGr4 USGr4_2
18892 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18893 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18894 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18895 z8000
18896 EOSH
18897 # Maybe put other stuff here too.
18898 cat <<EOSH >>Cppsym.know
18899 $osname
18900 EOSH
18901 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18902 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18903 $cat Cppsym.know > Cppsym.c
18904 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18905 $rm -f Cppsym.a Cppsym.b Cppsym.c
18906 cat <<EOSH > Cppsym
18907 $startsh
18908 if $test \$# -gt 0; then
18909     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18910     if $test -s Cppsym.got; then
18911         $rm -f Cppsym.got
18912         exit 0
18913     fi
18914     $rm -f Cppsym.got
18915     exit 1
18916 else
18917     $tr " " "$trnl" | ./Cppsym.try
18918     exit 0
18919 fi
18920 EOSH
18921 chmod +x Cppsym
18922 $eunicefix Cppsym
18923 cat <<EOSH > Cppsym.try
18924 $startsh
18925 cat <<'EOCP' > try.c
18926 #include <stdio.h>
18927 int main() {
18928 EOCP
18929 $awk \\
18930 EOSH
18931 cat <<'EOSH' >> Cppsym.try
18932 'length($1) > 0 {
18933     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
18934     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
18935     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
18936     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
18937 }'       >> try.c
18938 echo 'return 0;}' >> try.c
18939 EOSH
18940 cat <<EOSH >> Cppsym.try
18941 ccflags="$ccflags"
18942 case "$osname-$gccversion" in
18943 irix-) ccflags="\$ccflags -woff 1178" ;;
18944 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18945 esac
18946 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18947 EOSH
18948 chmod +x Cppsym.try
18949 $eunicefix Cppsym.try
18950 ./Cppsym < Cppsym.know > Cppsym.true
18951 : now check the C compiler for additional symbols
18952 postprocess_cc_v=''
18953 case "$osname" in
18954 aix) postprocess_cc_v="|$tr , ' '" ;;
18955 esac
18956 $cat >ccsym <<EOS
18957 $startsh
18958 $cat >tmp.c <<EOF
18959 extern int foo;
18960 EOF
18961 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18962 do
18963         case "\$i" in
18964         -D*) echo "\$i" | $sed 's/^-D//';;
18965         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18966         esac
18967 done
18968 $rm -f try.c
18969 EOS
18970 postprocess_cc_v=''
18971 chmod +x ccsym
18972 $eunicefix ccsym
18973 ./ccsym > ccsym1.raw
18974 if $test -s ccsym1.raw; then
18975        $sort ccsym1.raw | $uniq >ccsym.raw
18976 else
18977        mv ccsym1.raw ccsym.raw
18978 fi
18979
18980 $awk '/\=/ { print $0; next }
18981         { print $0"=1" }' ccsym.raw >ccsym.list
18982 $awk '/\=/ { print $0; next }
18983         { print $0"=1" }' Cppsym.true >ccsym.true
18984 $comm -13 ccsym.true ccsym.list >ccsym.own
18985 $comm -12 ccsym.true ccsym.list >ccsym.com
18986 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18987 also=''
18988 if $test -z ccsym.raw; then
18989         echo "Your C compiler doesn't seem to define any symbols!" >&4
18990         echo " "
18991         echo "However, your C preprocessor defines the following symbols:"
18992         $cat Cppsym.true
18993         ccsymbols=''
18994         cppsymbols=`$cat Cppsym.true`
18995         cppsymbols=`echo $cppsymbols`
18996         cppccsymbols="$cppsymbols"
18997 else
18998         if $test -s ccsym.com; then
18999                 echo "Your C compiler and pre-processor define these symbols:"
19000                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19001                 also='also '
19002                 symbols='ones'
19003                 cppccsymbols=`$cat ccsym.com`
19004                 cppccsymbols=`echo $cppccsymbols`
19005                 $test "$silent" || sleep 1
19006         fi
19007         if $test -s ccsym.cpp; then
19008                 $test "$also" && echo " "
19009                 echo "Your C pre-processor ${also}defines the following symbols:"
19010                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19011                 also='further '
19012                 cppsymbols=`$cat ccsym.cpp`
19013                 cppsymbols=`echo $cppsymbols`
19014                 $test "$silent" || sleep 1
19015         fi
19016         if $test -s ccsym.own; then
19017                 $test "$also" && echo " "
19018                 echo "Your C compiler ${also}defines the following cpp symbols:"
19019                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19020                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19021                 ccsymbols=`$cat ccsym.own`
19022                 ccsymbols=`echo $ccsymbols`
19023                 $test "$silent" || sleep 1
19024         fi
19025 fi
19026
19027 : see if this is a termio system
19028 val="$undef"
19029 val2="$undef"
19030 val3="$undef"
19031 if $test `./findhdr termios.h`; then
19032         set tcsetattr i_termios
19033         eval $inlibc
19034         val3="$i_termios"
19035 fi
19036 echo " "
19037 case "$val3" in
19038 "$define") echo "You have POSIX termios.h... good!" >&4;;
19039 *) if ./Cppsym pyr; then
19040                 case "`/bin/universe`" in
19041                 ucb) if $test `./findhdr sgtty.h`; then
19042                                 val2="$define"
19043                                 echo "<sgtty.h> found." >&4
19044                         else
19045                                 echo "System is pyramid with BSD universe."
19046                                 echo "<sgtty.h> not found--you could have problems." >&4
19047                         fi;;
19048                 *) if $test `./findhdr termio.h`; then
19049                                 val="$define"
19050                                 echo "<termio.h> found." >&4
19051                         else
19052                                 echo "System is pyramid with USG universe."
19053                                 echo "<termio.h> not found--you could have problems." >&4
19054                         fi;;
19055                 esac
19056         elif ./usg; then
19057                 if $test `./findhdr termio.h`; then
19058                         echo "<termio.h> found." >&4
19059                         val="$define"
19060                 elif $test `./findhdr sgtty.h`; then
19061                         echo "<sgtty.h> found." >&4
19062                         val2="$define"
19063                 else
19064 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19065                 fi
19066         else
19067                 if $test `./findhdr sgtty.h`; then
19068                         echo "<sgtty.h> found." >&4
19069                         val2="$define"
19070                 elif $test `./findhdr termio.h`; then
19071                         echo "<termio.h> found." >&4
19072                         val="$define"
19073                 else
19074 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19075                 fi
19076         fi;;
19077 esac
19078 set i_termio; eval $setvar
19079 val=$val2; set i_sgtty; eval $setvar
19080 val=$val3; set i_termios; eval $setvar
19081
19082 : see if stddef is available
19083 set stddef.h i_stddef
19084 eval $inhdr
19085
19086 : see if this is a sunmath.h system
19087 set sunmath.h i_sunmath
19088 eval $inhdr
19089
19090 : see if sys/access.h is available
19091 set sys/access.h i_sysaccess
19092 eval $inhdr
19093
19094 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19095 set sys/filio.h i_sysfilio
19096 eval $inhdr
19097 echo " "
19098 if $test `./findhdr sys/ioctl.h`; then
19099         val="$define"
19100         echo '<sys/ioctl.h> found.' >&4
19101 else
19102         val="$undef"
19103         if $test $i_sysfilio = "$define"; then
19104             echo '<sys/ioctl.h> NOT found.' >&4
19105         else
19106                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19107                 $test $i_termio = "$define" && xxx="termio.h"
19108                 $test $i_termios = "$define" && xxx="termios.h"
19109 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19110         fi
19111 fi
19112 set i_sysioctl
19113 eval $setvar
19114
19115 : see if socket ioctl defs are in sys/sockio.h
19116 echo " "
19117 xxx=`./findhdr sys/sockio.h`
19118 if $test "$xxx"; then
19119         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19120                 val="$define"
19121                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19122         else
19123                 val="$undef"
19124                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19125         fi
19126 else
19127         val="$undef"
19128         $cat <<EOM
19129 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19130 EOM
19131 fi
19132 set i_syssockio
19133 eval $setvar
19134
19135
19136 : see if this is a syslog.h system
19137 set syslog.h i_syslog
19138 eval $inhdr
19139
19140
19141 : see if this is a sys/mode.h system
19142 set sys/mode.h i_sysmode
19143 eval $inhdr
19144
19145 : see if sys/resource.h has to be included
19146 set sys/resource.h i_sysresrc
19147 eval $inhdr
19148
19149 : see if sys/security.h is available
19150 set sys/security.h i_syssecrt
19151 eval $inhdr
19152
19153 : see if this is a sys/statvfs.h system
19154 set sys/statvfs.h i_sysstatvfs
19155 eval $inhdr
19156
19157 : see if this is a sys/un.h system
19158 set sys/un.h i_sysun
19159 eval $inhdr
19160
19161
19162 : see if this is a sys/utsname.h system
19163 set sys/utsname.h i_sysutsname
19164 eval $inhdr
19165
19166 : see if this is a syswait system
19167 set sys/wait.h i_syswait
19168 eval $inhdr
19169
19170 : see if this is a ustat.h system
19171 set ustat.h i_ustat
19172 eval $inhdr
19173
19174 : see if this is an utime system
19175 set utime.h i_utime
19176 eval $inhdr
19177
19178 : see if this is a values.h system
19179 set values.h i_values
19180 eval $inhdr
19181
19182 : see if this is a vfork system
19183 case "$d_vfork" in
19184 "$define")
19185         set vfork.h i_vfork
19186         eval $inhdr
19187         ;;
19188 *)
19189         i_vfork="$undef"
19190         ;;
19191 esac
19192
19193 : see if gdbm.h is available
19194 set gdbm.h t_gdbm
19195 eval $inhdr
19196 case "$t_gdbm" in
19197 $define)
19198         : see if gdbm_open exists
19199         set gdbm_open d_gdbm_open
19200         eval $inlibc
19201         case "$d_gdbm_open" in
19202         $undef)
19203                 t_gdbm="$undef"
19204                 echo "We won't be including <gdbm.h>"
19205                 ;;
19206         esac
19207         ;;
19208 esac
19209 val="$t_gdbm"
19210 set i_gdbm
19211 eval $setvar
19212
19213 echo " "
19214 echo "Looking for extensions..." >&4
19215 : If we are using the old config.sh, known_extensions may contain
19216 : old or inaccurate or duplicate values.
19217 known_extensions=''
19218 nonxs_extensions=''
19219 : We do not use find because it might not be available.
19220 : We do not just use MANIFEST because the user may have dropped
19221 : some additional extensions into the source tree and expect them
19222 : to be built.
19223
19224 : Function to recursively find available extensions, ignoring DynaLoader
19225 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19226 find_extensions='
19227     for xxx in *; do
19228        case "$xxx" in
19229            DynaLoader|dynaload) ;;
19230            *)
19231            if $test -f $xxx/$xxx.xs; then
19232                known_extensions="$known_extensions $1$xxx";
19233            elif $test -f $xxx/Makefile.PL; then
19234                nonxs_extensions="$nonxs_extensions $1$xxx";
19235            else
19236                if $test -d $xxx -a $# -lt 10; then
19237                    set $1$xxx/ $*;
19238                    cd "$xxx";
19239                    eval $find_extensions;
19240                    cd ..;
19241                    shift;
19242                fi;
19243            fi
19244            ;;
19245        esac;
19246     done'
19247 tdir=`pwd`
19248 cd "$rsrc/ext"
19249 set X
19250 shift
19251 eval $find_extensions
19252 # Special case:  Add in threads/shared since it is not picked up by the
19253 # recursive find above (and adding in general recursive finding breaks
19254 # SDBM_File/sdbm).  A.D.  10/25/2001.
19255 known_extensions="$known_extensions threads/shared"
19256 set X $nonxs_extensions
19257 shift
19258 nonxs_extensions="$*"
19259 set X $known_extensions
19260 shift
19261 known_extensions="$*"
19262 cd "$tdir"
19263
19264 : Now see which are supported on this system.
19265 avail_ext=''
19266 for xxx in $known_extensions ; do
19267         case "$xxx" in
19268         DB_File|db_file)
19269                 case "$i_db" in
19270                 $define) avail_ext="$avail_ext $xxx" ;;
19271                 esac
19272                 ;;
19273         GDBM_File|gdbm_fil)
19274                 case "$i_gdbm" in 
19275                 $define) avail_ext="$avail_ext $xxx" ;;
19276                 esac
19277                 ;;
19278         I18N/Langinfo|i18n_lan)
19279                 case "$i_langinfo$d_nl_langinfo" in 
19280                 $define$define) avail_ext="$avail_ext $xxx" ;;
19281                 esac
19282                 ;;
19283         NDBM_File|ndbm_fil)
19284                 case "$i_ndbm" in
19285                 $define)
19286                     case "$osname-$use64bitint" in
19287                     cygwin-*|hpux-define)
19288                         case "$libs" in
19289                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19290                         esac
19291                         ;;
19292                     *) avail_ext="$avail_ext $xxx" ;;
19293                     esac
19294                     ;;
19295                 esac
19296                 ;;
19297         ODBM_File|odbm_fil) 
19298                 case "${i_dbm}${i_rpcsvcdbm}" in
19299                 *"${define}"*)
19300                     case "$osname-$use64bitint" in
19301                     cygwin-*|hpux-define)
19302                         case "$libs" in
19303                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19304                         esac
19305                         ;;
19306                     *) avail_ext="$avail_ext $xxx" ;;
19307                     esac
19308                     ;;
19309                 esac
19310                 ;;
19311         POSIX|posix)
19312                 case "$useposix" in
19313                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19314                 esac
19315                 ;;
19316         Opcode|opcode)
19317                 case "$useopcode" in
19318                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19319                 esac
19320                 ;;
19321         Socket|socket)
19322                 case "$d_socket" in 
19323                 true|$define|y)
19324                     case "$osname" in
19325                     beos) ;; # not unless BONE
19326                     *) avail_ext="$avail_ext $xxx" ;;
19327                     esac
19328                     ;;
19329                 esac
19330                 ;;
19331         Sys/Syslog|sys/syslog)
19332                 : XXX syslog requires socket
19333                 case "$d_socket" in 
19334                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19335                 esac
19336                 ;;
19337         Thread|thread)
19338                 case "$usethreads" in
19339                 true|$define|y)
19340                         case "$useithreads" in
19341                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19342                         esac
19343                 esac
19344                 ;;
19345         threads|threads/shared)
19346                 # threads and threads::shared are special cases.
19347                 # To stop people from asking "Perl 5.8.0 was supposed
19348                 # to have this new fancy threads implementation but my
19349                 # perl doesn't have it" and from people trying to
19350                 # (re)install the threads module using CPAN.pm and
19351                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19352                 # the threads.pm and threads/shared.pm will always be
19353                 # there, croaking informatively ("you need to rebuild
19354                 # all of Perl with threads, sorry") when threads haven't
19355                 # been compiled in.
19356                 # --jhi
19357                 avail_ext="$avail_ext $xxx"
19358                 ;;
19359         IPC/SysV|ipc/sysv)
19360                 : XXX Do we need a useipcsysv variable here
19361                 case "${d_msg}${d_sem}${d_shm}" in 
19362                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19363                 esac
19364                 ;;
19365         *)      avail_ext="$avail_ext $xxx"
19366                 ;;
19367         esac
19368 done
19369
19370 set X $avail_ext
19371 shift
19372 avail_ext="$*"
19373
19374 : Now see which nonxs extensions are supported on this system.
19375 : For now assume all are.
19376 nonxs_ext=''
19377 for xxx in $nonxs_extensions ; do
19378         case "$xxx" in
19379         *)      nonxs_ext="$nonxs_ext $xxx"
19380                 ;;
19381         esac
19382 done
19383
19384 set X $nonxs_ext
19385 shift
19386 nonxs_ext="$*"
19387
19388 case $usedl in
19389 $define)
19390         $cat <<EOM
19391 A number of extensions are supplied with $package.  You may choose to
19392 compile these extensions for dynamic loading (the default), compile
19393 them into the $package executable (static loading), or not include
19394 them at all.  Answer "none" to include no extensions.
19395 Note that DynaLoader is always built and need not be mentioned here.
19396
19397 EOM
19398         case "$dynamic_ext" in
19399         '') dflt="$avail_ext" ;;
19400         *)      dflt="$dynamic_ext"
19401                 # Perhaps we are reusing an old out-of-date config.sh.
19402                 case "$hint" in
19403                 previous)
19404                         if test X"$dynamic_ext" != X"$avail_ext"; then
19405                                 $cat <<EOM
19406 NOTICE:  Your previous config.sh list may be incorrect. 
19407 The extensions now available to you are 
19408         ${avail_ext}
19409 but the default list from your previous config.sh is
19410         ${dynamic_ext} 
19411
19412 EOM
19413                         fi
19414                         ;;
19415                 esac
19416                 ;;
19417         esac
19418         case "$dflt" in
19419         '')     dflt=none;;
19420         esac
19421         rp="What extensions do you wish to load dynamically?"
19422         . ./myread
19423         case "$ans" in
19424         none) dynamic_ext=' ' ;;
19425         *) dynamic_ext="$ans" ;;
19426         esac
19427
19428         case "$static_ext" in
19429         '')
19430                 : Exclude those already listed in dynamic linking
19431                 dflt=''
19432                 for xxx in $avail_ext; do
19433                         case " $dynamic_ext " in
19434                         *" $xxx "*) ;;
19435                         *) dflt="$dflt $xxx" ;;
19436                         esac
19437                 done
19438                 set X $dflt
19439                 shift
19440                 dflt="$*"
19441                 ;;
19442         *)  dflt="$static_ext" 
19443                 ;;
19444         esac
19445
19446         case "$dflt" in
19447         '')     dflt=none;;
19448         esac
19449         rp="What extensions do you wish to load statically?"
19450         . ./myread
19451         case "$ans" in
19452         none) static_ext=' ' ;;
19453         *) static_ext="$ans" ;;
19454         esac
19455         ;;
19456 *)
19457         $cat <<EOM
19458 A number of extensions are supplied with $package.  Answer "none" 
19459 to include no extensions. 
19460 Note that DynaLoader is always built and need not be mentioned here.
19461
19462 EOM
19463         case "$static_ext" in
19464         '') dflt="$avail_ext" ;;
19465         *)      dflt="$static_ext"
19466                 # Perhaps we are reusing an old out-of-date config.sh.
19467                 case "$hint" in
19468                 previous)
19469                         if test X"$static_ext" != X"$avail_ext"; then
19470                                 $cat <<EOM
19471 NOTICE:  Your previous config.sh list may be incorrect. 
19472 The extensions now available to you are 
19473         ${avail_ext}
19474 but the default list from your previous config.sh is
19475         ${static_ext} 
19476
19477 EOM
19478                         fi
19479                         ;;
19480                 esac
19481                 ;;
19482         esac
19483         : Exclude those that are not xs extensions
19484         case "$dflt" in
19485         '')     dflt=none;;
19486         esac
19487         rp="What extensions do you wish to include?"
19488         . ./myread
19489         case "$ans" in
19490         none) static_ext=' ' ;;
19491         *) static_ext="$ans" ;;
19492         esac
19493         ;;
19494 esac
19495 #        
19496 # Encode is a special case.  If we are building Encode as a static
19497 # extension, we need to explicitly list its subextensions as well.
19498 # For other nested extensions, this is handled automatically by
19499 # the appropriate Makefile.PL.
19500 case " $static_ext " in
19501         *" Encode "*) # Add the subextensions of Encode
19502         cd "$rsrc/ext"
19503         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19504                 static_ext="$static_ext Encode/$xxx"
19505         done
19506         cd "$tdir"
19507         ;;
19508 esac
19509
19510 set X $dynamic_ext $static_ext $nonxs_ext
19511 shift
19512 extensions="$*"
19513
19514 : Remove libraries needed only for extensions
19515 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19516 : The exception is SunOS 4.x, which needs them.
19517 case "${osname}X${osvers}" in
19518 sunos*X4*)
19519     perllibs="$libs"
19520     ;;
19521 *) case "$usedl" in
19522     $define|true|[yY]*)
19523             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19524             shift
19525             perllibs="$*"
19526             ;;
19527     *)  perllibs="$libs"
19528             ;;
19529     esac
19530     ;;
19531 esac
19532
19533 : Remove build directory name from cppstdin so it can be used from
19534 : either the present location or the final installed location.
19535 echo " "
19536 : Get out of the UU directory to get correct path name.
19537 cd ..
19538 case "$cppstdin" in
19539 `pwd`/cppstdin)
19540         echo "Stripping down cppstdin path name"
19541         cppstdin=cppstdin
19542         ;;
19543 esac
19544 cd UU
19545
19546 : end of configuration questions
19547 echo " "
19548 echo "End of configuration questions."
19549 echo " "
19550
19551 : back to where it started
19552 if test -d ../UU; then
19553         cd ..
19554 fi
19555
19556 : configuration may be patched via a 'config.arch' file
19557 if $test -f config.arch; then
19558         echo "I see a config.arch file, loading it."
19559         . ./config.arch
19560 fi
19561
19562 : configuration may be patched via a 'config.over' file
19563 if $test -f config.over; then
19564         echo " "
19565         dflt=y
19566         rp='I see a config.over file.  Do you wish to load it?'
19567         . UU/myread
19568         case "$ans" in
19569         n*) echo "OK, I'll ignore it.";;
19570         *)      . ./config.over
19571                 echo "Configuration override changes have been loaded."
19572                 ;;
19573         esac
19574 fi
19575
19576 : in case they want portability, strip down executable paths
19577 case "$d_portable" in
19578 "$define")
19579         echo " "
19580         echo "Stripping down executable paths..." >&4
19581         for file in $loclist $trylist; do
19582                 eval temp=\$$file
19583                 eval $file=`basename $temp`
19584         done
19585         ;;
19586 esac
19587
19588 : create config.sh file
19589 echo " "
19590 echo "Creating config.sh..." >&4
19591 $spitshell <<EOT >config.sh
19592 $startsh
19593 #
19594 # This file was produced by running the Configure script. It holds all the
19595 # definitions figured out by Configure. Should you modify one of these values,
19596 # do not forget to propagate your changes by running "Configure -der". You may
19597 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19598 #
19599
19600 # Package name      : $package
19601 # Source directory  : $src
19602 # Configuration time: $cf_time
19603 # Configured by     : $cf_by
19604 # Target system     : $myuname
19605
19606 Author='$Author'
19607 Date='$Date'
19608 Header='$Header'
19609 Id='$Id'
19610 Locker='$Locker'
19611 Log='$Log'
19612 Mcc='$Mcc'
19613 RCSfile='$RCSfile'
19614 Revision='$Revision'
19615 Source='$Source'
19616 State='$State'
19617 _a='$_a'
19618 _exe='$_exe'
19619 _o='$_o'
19620 afs='$afs'
19621 afsroot='$afsroot'
19622 alignbytes='$alignbytes'
19623 ansi2knr='$ansi2knr'
19624 aphostname='$aphostname'
19625 api_revision='$api_revision'
19626 api_subversion='$api_subversion'
19627 api_version='$api_version'
19628 api_versionstring='$api_versionstring'
19629 ar='$ar'
19630 archlib='$archlib'
19631 archlibexp='$archlibexp'
19632 archname64='$archname64'
19633 archname='$archname'
19634 archobjs='$archobjs'
19635 asctime_r_proto='$asctime_r_proto'
19636 awk='$awk'
19637 baserev='$baserev'
19638 bash='$bash'
19639 bin='$bin'
19640 binexp='$binexp'
19641 bison='$bison'
19642 byacc='$byacc'
19643 byteorder='$byteorder'
19644 c='$c'
19645 castflags='$castflags'
19646 cat='$cat'
19647 cc='$cc'
19648 cccdlflags='$cccdlflags'
19649 ccdlflags='$ccdlflags'
19650 ccflags='$ccflags'
19651 ccflags_uselargefiles='$ccflags_uselargefiles'
19652 ccname='$ccname'
19653 ccsymbols='$ccsymbols'
19654 ccversion='$ccversion'
19655 cf_by='$cf_by'
19656 cf_email='$cf_email'
19657 cf_time='$cf_time'
19658 charsize='$charsize'
19659 chgrp='$chgrp'
19660 chmod='$chmod'
19661 chown='$chown'
19662 clocktype='$clocktype'
19663 comm='$comm'
19664 compress='$compress'
19665 contains='$contains'
19666 cp='$cp'
19667 cpio='$cpio'
19668 cpp='$cpp'
19669 cpp_stuff='$cpp_stuff'
19670 cppccsymbols='$cppccsymbols'
19671 cppflags='$cppflags'
19672 cpplast='$cpplast'
19673 cppminus='$cppminus'
19674 cpprun='$cpprun'
19675 cppstdin='$cppstdin'
19676 cppsymbols='$cppsymbols'
19677 crypt_r_proto='$crypt_r_proto'
19678 cryptlib='$cryptlib'
19679 csh='$csh'
19680 ctermid_r_proto='$ctermid_r_proto'
19681 ctime_r_proto='$ctime_r_proto'
19682 d_Gconvert='$d_Gconvert'
19683 d_PRIEUldbl='$d_PRIEUldbl'
19684 d_PRIFUldbl='$d_PRIFUldbl'
19685 d_PRIGUldbl='$d_PRIGUldbl'
19686 d_PRIXU64='$d_PRIXU64'
19687 d_PRId64='$d_PRId64'
19688 d_PRIeldbl='$d_PRIeldbl'
19689 d_PRIfldbl='$d_PRIfldbl'
19690 d_PRIgldbl='$d_PRIgldbl'
19691 d_PRIi64='$d_PRIi64'
19692 d_PRIo64='$d_PRIo64'
19693 d_PRIu64='$d_PRIu64'
19694 d_PRIx64='$d_PRIx64'
19695 d_SCNfldbl='$d_SCNfldbl'
19696 d__fwalk='$d__fwalk'
19697 d_access='$d_access'
19698 d_accessx='$d_accessx'
19699 d_alarm='$d_alarm'
19700 d_archlib='$d_archlib'
19701 d_asctime_r='$d_asctime_r'
19702 d_atolf='$d_atolf'
19703 d_atoll='$d_atoll'
19704 d_attribut='$d_attribut'
19705 d_bcmp='$d_bcmp'
19706 d_bcopy='$d_bcopy'
19707 d_bsd='$d_bsd'
19708 d_bsdgetpgrp='$d_bsdgetpgrp'
19709 d_bsdsetpgrp='$d_bsdsetpgrp'
19710 d_bzero='$d_bzero'
19711 d_casti32='$d_casti32'
19712 d_castneg='$d_castneg'
19713 d_charvspr='$d_charvspr'
19714 d_chown='$d_chown'
19715 d_chroot='$d_chroot'
19716 d_chsize='$d_chsize'
19717 d_class='$d_class'
19718 d_closedir='$d_closedir'
19719 d_cmsghdr_s='$d_cmsghdr_s'
19720 d_const='$d_const'
19721 d_crypt='$d_crypt'
19722 d_crypt_r='$d_crypt_r'
19723 d_csh='$d_csh'
19724 d_ctermid_r='$d_ctermid_r'
19725 d_ctime_r='$d_ctime_r'
19726 d_cuserid='$d_cuserid'
19727 d_dbl_dig='$d_dbl_dig'
19728 d_dbminitproto='$d_dbminitproto'
19729 d_difftime='$d_difftime'
19730 d_dirfd='$d_dirfd'
19731 d_dirnamlen='$d_dirnamlen'
19732 d_dlerror='$d_dlerror'
19733 d_dlopen='$d_dlopen'
19734 d_dlsymun='$d_dlsymun'
19735 d_dosuid='$d_dosuid'
19736 d_drand48_r='$d_drand48_r'
19737 d_drand48proto='$d_drand48proto'
19738 d_dup2='$d_dup2'
19739 d_eaccess='$d_eaccess'
19740 d_endgrent='$d_endgrent'
19741 d_endgrent_r='$d_endgrent_r'
19742 d_endhent='$d_endhent'
19743 d_endhostent_r='$d_endhostent_r'
19744 d_endnent='$d_endnent'
19745 d_endnetent_r='$d_endnetent_r'
19746 d_endpent='$d_endpent'
19747 d_endprotoent_r='$d_endprotoent_r'
19748 d_endpwent='$d_endpwent'
19749 d_endpwent_r='$d_endpwent_r'
19750 d_endsent='$d_endsent'
19751 d_endservent_r='$d_endservent_r'
19752 d_eofnblk='$d_eofnblk'
19753 d_eunice='$d_eunice'
19754 d_fchdir='$d_fchdir'
19755 d_fchmod='$d_fchmod'
19756 d_fchown='$d_fchown'
19757 d_fcntl='$d_fcntl'
19758 d_fcntl_can_lock='$d_fcntl_can_lock'
19759 d_fd_macros='$d_fd_macros'
19760 d_fd_set='$d_fd_set'
19761 d_fds_bits='$d_fds_bits'
19762 d_fgetpos='$d_fgetpos'
19763 d_finite='$d_finite'
19764 d_finitel='$d_finitel'
19765 d_flexfnam='$d_flexfnam'
19766 d_flock='$d_flock'
19767 d_flockproto='$d_flockproto'
19768 d_fork='$d_fork'
19769 d_fp_class='$d_fp_class'
19770 d_fpathconf='$d_fpathconf'
19771 d_fpclass='$d_fpclass'
19772 d_fpclassify='$d_fpclassify'
19773 d_fpclassl='$d_fpclassl'
19774 d_fpos64_t='$d_fpos64_t'
19775 d_frexpl='$d_frexpl'
19776 d_fs_data_s='$d_fs_data_s'
19777 d_fseeko='$d_fseeko'
19778 d_fsetpos='$d_fsetpos'
19779 d_fstatfs='$d_fstatfs'
19780 d_fstatvfs='$d_fstatvfs'
19781 d_fsync='$d_fsync'
19782 d_ftello='$d_ftello'
19783 d_ftime='$d_ftime'
19784 d_getcwd='$d_getcwd'
19785 d_getespwnam='$d_getespwnam'
19786 d_getfsstat='$d_getfsstat'
19787 d_getgrent='$d_getgrent'
19788 d_getgrent_r='$d_getgrent_r'
19789 d_getgrgid_r='$d_getgrgid_r'
19790 d_getgrnam_r='$d_getgrnam_r'
19791 d_getgrps='$d_getgrps'
19792 d_gethbyaddr='$d_gethbyaddr'
19793 d_gethbyname='$d_gethbyname'
19794 d_gethent='$d_gethent'
19795 d_gethname='$d_gethname'
19796 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19797 d_gethostbyname_r='$d_gethostbyname_r'
19798 d_gethostent_r='$d_gethostent_r'
19799 d_gethostprotos='$d_gethostprotos'
19800 d_getitimer='$d_getitimer'
19801 d_getlogin='$d_getlogin'
19802 d_getlogin_r='$d_getlogin_r'
19803 d_getmnt='$d_getmnt'
19804 d_getmntent='$d_getmntent'
19805 d_getnbyaddr='$d_getnbyaddr'
19806 d_getnbyname='$d_getnbyname'
19807 d_getnent='$d_getnent'
19808 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19809 d_getnetbyname_r='$d_getnetbyname_r'
19810 d_getnetent_r='$d_getnetent_r'
19811 d_getnetprotos='$d_getnetprotos'
19812 d_getpagsz='$d_getpagsz'
19813 d_getpbyname='$d_getpbyname'
19814 d_getpbynumber='$d_getpbynumber'
19815 d_getpent='$d_getpent'
19816 d_getpgid='$d_getpgid'
19817 d_getpgrp2='$d_getpgrp2'
19818 d_getpgrp='$d_getpgrp'
19819 d_getppid='$d_getppid'
19820 d_getprior='$d_getprior'
19821 d_getprotobyname_r='$d_getprotobyname_r'
19822 d_getprotobynumber_r='$d_getprotobynumber_r'
19823 d_getprotoent_r='$d_getprotoent_r'
19824 d_getprotoprotos='$d_getprotoprotos'
19825 d_getprpwnam='$d_getprpwnam'
19826 d_getpwent='$d_getpwent'
19827 d_getpwent_r='$d_getpwent_r'
19828 d_getpwnam_r='$d_getpwnam_r'
19829 d_getpwuid_r='$d_getpwuid_r'
19830 d_getsbyname='$d_getsbyname'
19831 d_getsbyport='$d_getsbyport'
19832 d_getsent='$d_getsent'
19833 d_getservbyname_r='$d_getservbyname_r'
19834 d_getservbyport_r='$d_getservbyport_r'
19835 d_getservent_r='$d_getservent_r'
19836 d_getservprotos='$d_getservprotos'
19837 d_getspnam='$d_getspnam'
19838 d_getspnam_r='$d_getspnam_r'
19839 d_gettimeod='$d_gettimeod'
19840 d_gmtime_r='$d_gmtime_r'
19841 d_gnulibc='$d_gnulibc'
19842 d_grpasswd='$d_grpasswd'
19843 d_hasmntopt='$d_hasmntopt'
19844 d_htonl='$d_htonl'
19845 d_index='$d_index'
19846 d_inetaton='$d_inetaton'
19847 d_int64_t='$d_int64_t'
19848 d_isascii='$d_isascii'
19849 d_isfinite='$d_isfinite'
19850 d_isinf='$d_isinf'
19851 d_isnan='$d_isnan'
19852 d_isnanl='$d_isnanl'
19853 d_killpg='$d_killpg'
19854 d_lchown='$d_lchown'
19855 d_ldbl_dig='$d_ldbl_dig'
19856 d_link='$d_link'
19857 d_localtime_r='$d_localtime_r'
19858 d_locconv='$d_locconv'
19859 d_lockf='$d_lockf'
19860 d_longdbl='$d_longdbl'
19861 d_longlong='$d_longlong'
19862 d_lseekproto='$d_lseekproto'
19863 d_lstat='$d_lstat'
19864 d_madvise='$d_madvise'
19865 d_mblen='$d_mblen'
19866 d_mbstowcs='$d_mbstowcs'
19867 d_mbtowc='$d_mbtowc'
19868 d_memchr='$d_memchr'
19869 d_memcmp='$d_memcmp'
19870 d_memcpy='$d_memcpy'
19871 d_memmove='$d_memmove'
19872 d_memset='$d_memset'
19873 d_mkdir='$d_mkdir'
19874 d_mkdtemp='$d_mkdtemp'
19875 d_mkfifo='$d_mkfifo'
19876 d_mkstemp='$d_mkstemp'
19877 d_mkstemps='$d_mkstemps'
19878 d_mktime='$d_mktime'
19879 d_mmap='$d_mmap'
19880 d_modfl='$d_modfl'
19881 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19882 d_mprotect='$d_mprotect'
19883 d_msg='$d_msg'
19884 d_msg_ctrunc='$d_msg_ctrunc'
19885 d_msg_dontroute='$d_msg_dontroute'
19886 d_msg_oob='$d_msg_oob'
19887 d_msg_peek='$d_msg_peek'
19888 d_msg_proxy='$d_msg_proxy'
19889 d_msgctl='$d_msgctl'
19890 d_msgget='$d_msgget'
19891 d_msghdr_s='$d_msghdr_s'
19892 d_msgrcv='$d_msgrcv'
19893 d_msgsnd='$d_msgsnd'
19894 d_msync='$d_msync'
19895 d_munmap='$d_munmap'
19896 d_mymalloc='$d_mymalloc'
19897 d_nice='$d_nice'
19898 d_nl_langinfo='$d_nl_langinfo'
19899 d_nv_preserves_uv='$d_nv_preserves_uv'
19900 d_off64_t='$d_off64_t'
19901 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19902 d_oldpthreads='$d_oldpthreads'
19903 d_oldsock='$d_oldsock'
19904 d_open3='$d_open3'
19905 d_pathconf='$d_pathconf'
19906 d_pause='$d_pause'
19907 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19908 d_phostname='$d_phostname'
19909 d_pipe='$d_pipe'
19910 d_poll='$d_poll'
19911 d_portable='$d_portable'
19912 d_procselfexe='$d_procselfexe'
19913 d_pthread_atfork='$d_pthread_atfork'
19914 d_pthread_yield='$d_pthread_yield'
19915 d_pwage='$d_pwage'
19916 d_pwchange='$d_pwchange'
19917 d_pwclass='$d_pwclass'
19918 d_pwcomment='$d_pwcomment'
19919 d_pwexpire='$d_pwexpire'
19920 d_pwgecos='$d_pwgecos'
19921 d_pwpasswd='$d_pwpasswd'
19922 d_pwquota='$d_pwquota'
19923 d_qgcvt='$d_qgcvt'
19924 d_quad='$d_quad'
19925 d_random_r='$d_random_r'
19926 d_readdir64_r='$d_readdir64_r'
19927 d_readdir='$d_readdir'
19928 d_readdir_r='$d_readdir_r'
19929 d_readlink='$d_readlink'
19930 d_readv='$d_readv'
19931 d_recvmsg='$d_recvmsg'
19932 d_rename='$d_rename'
19933 d_rewinddir='$d_rewinddir'
19934 d_rmdir='$d_rmdir'
19935 d_safebcpy='$d_safebcpy'
19936 d_safemcpy='$d_safemcpy'
19937 d_sanemcmp='$d_sanemcmp'
19938 d_sbrkproto='$d_sbrkproto'
19939 d_sched_yield='$d_sched_yield'
19940 d_scm_rights='$d_scm_rights'
19941 d_seekdir='$d_seekdir'
19942 d_select='$d_select'
19943 d_sem='$d_sem'
19944 d_semctl='$d_semctl'
19945 d_semctl_semid_ds='$d_semctl_semid_ds'
19946 d_semctl_semun='$d_semctl_semun'
19947 d_semget='$d_semget'
19948 d_semop='$d_semop'
19949 d_sendmsg='$d_sendmsg'
19950 d_setegid='$d_setegid'
19951 d_seteuid='$d_seteuid'
19952 d_setgrent='$d_setgrent'
19953 d_setgrent_r='$d_setgrent_r'
19954 d_setgrps='$d_setgrps'
19955 d_sethent='$d_sethent'
19956 d_sethostent_r='$d_sethostent_r'
19957 d_setitimer='$d_setitimer'
19958 d_setlinebuf='$d_setlinebuf'
19959 d_setlocale='$d_setlocale'
19960 d_setlocale_r='$d_setlocale_r'
19961 d_setnent='$d_setnent'
19962 d_setnetent_r='$d_setnetent_r'
19963 d_setpent='$d_setpent'
19964 d_setpgid='$d_setpgid'
19965 d_setpgrp2='$d_setpgrp2'
19966 d_setpgrp='$d_setpgrp'
19967 d_setprior='$d_setprior'
19968 d_setproctitle='$d_setproctitle'
19969 d_setprotoent_r='$d_setprotoent_r'
19970 d_setpwent='$d_setpwent'
19971 d_setpwent_r='$d_setpwent_r'
19972 d_setregid='$d_setregid'
19973 d_setresgid='$d_setresgid'
19974 d_setresuid='$d_setresuid'
19975 d_setreuid='$d_setreuid'
19976 d_setrgid='$d_setrgid'
19977 d_setruid='$d_setruid'
19978 d_setsent='$d_setsent'
19979 d_setservent_r='$d_setservent_r'
19980 d_setsid='$d_setsid'
19981 d_setvbuf='$d_setvbuf'
19982 d_sfio='$d_sfio'
19983 d_shm='$d_shm'
19984 d_shmat='$d_shmat'
19985 d_shmatprototype='$d_shmatprototype'
19986 d_shmctl='$d_shmctl'
19987 d_shmdt='$d_shmdt'
19988 d_shmget='$d_shmget'
19989 d_sigaction='$d_sigaction'
19990 d_sigprocmask='$d_sigprocmask'
19991 d_sigsetjmp='$d_sigsetjmp'
19992 d_sockatmark='$d_sockatmark'
19993 d_sockatmarkproto='$d_sockatmarkproto'
19994 d_socket='$d_socket'
19995 d_socklen_t='$d_socklen_t'
19996 d_sockpair='$d_sockpair'
19997 d_socks5_init='$d_socks5_init'
19998 d_sqrtl='$d_sqrtl'
19999 d_srand48_r='$d_srand48_r'
20000 d_srandom_r='$d_srandom_r'
20001 d_sresgproto='$d_sresgproto'
20002 d_sresuproto='$d_sresuproto'
20003 d_statblks='$d_statblks'
20004 d_statfs_f_flags='$d_statfs_f_flags'
20005 d_statfs_s='$d_statfs_s'
20006 d_statvfs='$d_statvfs'
20007 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20008 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20009 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20010 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20011 d_stdio_stream_array='$d_stdio_stream_array'
20012 d_stdiobase='$d_stdiobase'
20013 d_stdstdio='$d_stdstdio'
20014 d_strchr='$d_strchr'
20015 d_strcoll='$d_strcoll'
20016 d_strctcpy='$d_strctcpy'
20017 d_strerrm='$d_strerrm'
20018 d_strerror='$d_strerror'
20019 d_strerror_r='$d_strerror_r'
20020 d_strftime='$d_strftime'
20021 d_strtod='$d_strtod'
20022 d_strtol='$d_strtol'
20023 d_strtold='$d_strtold'
20024 d_strtoll='$d_strtoll'
20025 d_strtoq='$d_strtoq'
20026 d_strtoul='$d_strtoul'
20027 d_strtoull='$d_strtoull'
20028 d_strtouq='$d_strtouq'
20029 d_strxfrm='$d_strxfrm'
20030 d_suidsafe='$d_suidsafe'
20031 d_symlink='$d_symlink'
20032 d_syscall='$d_syscall'
20033 d_syscallproto='$d_syscallproto'
20034 d_sysconf='$d_sysconf'
20035 d_sysernlst='$d_sysernlst'
20036 d_syserrlst='$d_syserrlst'
20037 d_system='$d_system'
20038 d_tcgetpgrp='$d_tcgetpgrp'
20039 d_tcsetpgrp='$d_tcsetpgrp'
20040 d_telldir='$d_telldir'
20041 d_telldirproto='$d_telldirproto'
20042 d_time='$d_time'
20043 d_times='$d_times'
20044 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20045 d_tm_tm_zone='$d_tm_tm_zone'
20046 d_tmpnam_r='$d_tmpnam_r'
20047 d_truncate='$d_truncate'
20048 d_ttyname_r='$d_ttyname_r'
20049 d_tzname='$d_tzname'
20050 d_u32align='$d_u32align'
20051 d_ualarm='$d_ualarm'
20052 d_umask='$d_umask'
20053 d_uname='$d_uname'
20054 d_union_semun='$d_union_semun'
20055 d_unordered='$d_unordered'
20056 d_usleep='$d_usleep'
20057 d_usleepproto='$d_usleepproto'
20058 d_ustat='$d_ustat'
20059 d_vendorarch='$d_vendorarch'
20060 d_vendorbin='$d_vendorbin'
20061 d_vendorlib='$d_vendorlib'
20062 d_vfork='$d_vfork'
20063 d_void_closedir='$d_void_closedir'
20064 d_voidsig='$d_voidsig'
20065 d_voidtty='$d_voidtty'
20066 d_volatile='$d_volatile'
20067 d_vprintf='$d_vprintf'
20068 d_wait4='$d_wait4'
20069 d_waitpid='$d_waitpid'
20070 d_wcstombs='$d_wcstombs'
20071 d_wctomb='$d_wctomb'
20072 d_writev='$d_writev'
20073 d_xenix='$d_xenix'
20074 date='$date'
20075 db_hashtype='$db_hashtype'
20076 db_prefixtype='$db_prefixtype'
20077 db_version_major='$db_version_major'
20078 db_version_minor='$db_version_minor'
20079 db_version_patch='$db_version_patch'
20080 defvoidused='$defvoidused'
20081 direntrytype='$direntrytype'
20082 dlext='$dlext'
20083 dlsrc='$dlsrc'
20084 doublesize='$doublesize'
20085 drand01='$drand01'
20086 drand48_r_proto='$drand48_r_proto'
20087 dynamic_ext='$dynamic_ext'
20088 eagain='$eagain'
20089 ebcdic='$ebcdic'
20090 echo='$echo'
20091 egrep='$egrep'
20092 emacs='$emacs'
20093 endgrent_r_proto='$endgrent_r_proto'
20094 endhostent_r_proto='$endhostent_r_proto'
20095 endnetent_r_proto='$endnetent_r_proto'
20096 endprotoent_r_proto='$endprotoent_r_proto'
20097 endpwent_r_proto='$endpwent_r_proto'
20098 endservent_r_proto='$endservent_r_proto'
20099 eunicefix='$eunicefix'
20100 exe_ext='$exe_ext'
20101 expr='$expr'
20102 extensions='$extensions'
20103 extras='$extras'
20104 fflushNULL='$fflushNULL'
20105 fflushall='$fflushall'
20106 find='$find'
20107 firstmakefile='$firstmakefile'
20108 flex='$flex'
20109 fpossize='$fpossize'
20110 fpostype='$fpostype'
20111 freetype='$freetype'
20112 from='$from'
20113 full_ar='$full_ar'
20114 full_csh='$full_csh'
20115 full_sed='$full_sed'
20116 gccosandvers='$gccosandvers'
20117 gccversion='$gccversion'
20118 getgrent_r_proto='$getgrent_r_proto'
20119 getgrgid_r_proto='$getgrgid_r_proto'
20120 getgrnam_r_proto='$getgrnam_r_proto'
20121 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20122 gethostbyname_r_proto='$gethostbyname_r_proto'
20123 gethostent_r_proto='$gethostent_r_proto'
20124 getlogin_r_proto='$getlogin_r_proto'
20125 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20126 getnetbyname_r_proto='$getnetbyname_r_proto'
20127 getnetent_r_proto='$getnetent_r_proto'
20128 getprotobyname_r_proto='$getprotobyname_r_proto'
20129 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20130 getprotoent_r_proto='$getprotoent_r_proto'
20131 getpwent_r_proto='$getpwent_r_proto'
20132 getpwnam_r_proto='$getpwnam_r_proto'
20133 getpwuid_r_proto='$getpwuid_r_proto'
20134 getservbyname_r_proto='$getservbyname_r_proto'
20135 getservbyport_r_proto='$getservbyport_r_proto'
20136 getservent_r_proto='$getservent_r_proto'
20137 getspnam_r_proto='$getspnam_r_proto'
20138 gidformat='$gidformat'
20139 gidsign='$gidsign'
20140 gidsize='$gidsize'
20141 gidtype='$gidtype'
20142 glibpth='$glibpth'
20143 gmake='$gmake'
20144 gmtime_r_proto='$gmtime_r_proto'
20145 gnulibc_version='$gnulibc_version'
20146 grep='$grep'
20147 groupcat='$groupcat'
20148 groupstype='$groupstype'
20149 gzip='$gzip'
20150 h_fcntl='$h_fcntl'
20151 h_sysfile='$h_sysfile'
20152 hint='$hint'
20153 hostcat='$hostcat'
20154 i16size='$i16size'
20155 i16type='$i16type'
20156 i32size='$i32size'
20157 i32type='$i32type'
20158 i64size='$i64size'
20159 i64type='$i64type'
20160 i8size='$i8size'
20161 i8type='$i8type'
20162 i_arpainet='$i_arpainet'
20163 i_bsdioctl='$i_bsdioctl'
20164 i_crypt='$i_crypt'
20165 i_db='$i_db'
20166 i_dbm='$i_dbm'
20167 i_dirent='$i_dirent'
20168 i_dld='$i_dld'
20169 i_dlfcn='$i_dlfcn'
20170 i_fcntl='$i_fcntl'
20171 i_float='$i_float'
20172 i_fp='$i_fp'
20173 i_fp_class='$i_fp_class'
20174 i_gdbm='$i_gdbm'
20175 i_grp='$i_grp'
20176 i_ieeefp='$i_ieeefp'
20177 i_inttypes='$i_inttypes'
20178 i_langinfo='$i_langinfo'
20179 i_libutil='$i_libutil'
20180 i_limits='$i_limits'
20181 i_locale='$i_locale'
20182 i_machcthr='$i_machcthr'
20183 i_malloc='$i_malloc'
20184 i_math='$i_math'
20185 i_memory='$i_memory'
20186 i_mntent='$i_mntent'
20187 i_ndbm='$i_ndbm'
20188 i_netdb='$i_netdb'
20189 i_neterrno='$i_neterrno'
20190 i_netinettcp='$i_netinettcp'
20191 i_niin='$i_niin'
20192 i_poll='$i_poll'
20193 i_prot='$i_prot'
20194 i_pthread='$i_pthread'
20195 i_pwd='$i_pwd'
20196 i_rpcsvcdbm='$i_rpcsvcdbm'
20197 i_sfio='$i_sfio'
20198 i_sgtty='$i_sgtty'
20199 i_shadow='$i_shadow'
20200 i_socks='$i_socks'
20201 i_stdarg='$i_stdarg'
20202 i_stddef='$i_stddef'
20203 i_stdlib='$i_stdlib'
20204 i_string='$i_string'
20205 i_sunmath='$i_sunmath'
20206 i_sysaccess='$i_sysaccess'
20207 i_sysdir='$i_sysdir'
20208 i_sysfile='$i_sysfile'
20209 i_sysfilio='$i_sysfilio'
20210 i_sysin='$i_sysin'
20211 i_sysioctl='$i_sysioctl'
20212 i_syslog='$i_syslog'
20213 i_sysmman='$i_sysmman'
20214 i_sysmode='$i_sysmode'
20215 i_sysmount='$i_sysmount'
20216 i_sysndir='$i_sysndir'
20217 i_sysparam='$i_sysparam'
20218 i_sysresrc='$i_sysresrc'
20219 i_syssecrt='$i_syssecrt'
20220 i_sysselct='$i_sysselct'
20221 i_syssockio='$i_syssockio'
20222 i_sysstat='$i_sysstat'
20223 i_sysstatfs='$i_sysstatfs'
20224 i_sysstatvfs='$i_sysstatvfs'
20225 i_systime='$i_systime'
20226 i_systimek='$i_systimek'
20227 i_systimes='$i_systimes'
20228 i_systypes='$i_systypes'
20229 i_sysuio='$i_sysuio'
20230 i_sysun='$i_sysun'
20231 i_sysutsname='$i_sysutsname'
20232 i_sysvfs='$i_sysvfs'
20233 i_syswait='$i_syswait'
20234 i_termio='$i_termio'
20235 i_termios='$i_termios'
20236 i_time='$i_time'
20237 i_unistd='$i_unistd'
20238 i_ustat='$i_ustat'
20239 i_utime='$i_utime'
20240 i_values='$i_values'
20241 i_varargs='$i_varargs'
20242 i_varhdr='$i_varhdr'
20243 i_vfork='$i_vfork'
20244 ignore_versioned_solibs='$ignore_versioned_solibs'
20245 inc_version_list='$inc_version_list'
20246 inc_version_list_init='$inc_version_list_init'
20247 incpath='$incpath'
20248 inews='$inews'
20249 installarchlib='$installarchlib'
20250 installbin='$installbin'
20251 installman1dir='$installman1dir'
20252 installman3dir='$installman3dir'
20253 installprefix='$installprefix'
20254 installprefixexp='$installprefixexp'
20255 installprivlib='$installprivlib'
20256 installscript='$installscript'
20257 installsitearch='$installsitearch'
20258 installsitebin='$installsitebin'
20259 installsitelib='$installsitelib'
20260 installstyle='$installstyle'
20261 installusrbinperl='$installusrbinperl'
20262 installvendorarch='$installvendorarch'
20263 installvendorbin='$installvendorbin'
20264 installvendorlib='$installvendorlib'
20265 intsize='$intsize'
20266 issymlink='$issymlink'
20267 ivdformat='$ivdformat'
20268 ivsize='$ivsize'
20269 ivtype='$ivtype'
20270 known_extensions='$known_extensions'
20271 ksh='$ksh'
20272 ld='$ld'
20273 lddlflags='$lddlflags'
20274 ldflags='$ldflags'
20275 ldflags_uselargefiles='$ldflags_uselargefiles'
20276 ldlibpthname='$ldlibpthname'
20277 less='$less'
20278 lib_ext='$lib_ext'
20279 libc='$libc'
20280 libperl='$libperl'
20281 libpth='$libpth'
20282 libs='$libs'
20283 libsdirs='$libsdirs'
20284 libsfiles='$libsfiles'
20285 libsfound='$libsfound'
20286 libspath='$libspath'
20287 libswanted='$libswanted'
20288 libswanted_uselargefiles='$libswanted_uselargefiles'
20289 line='$line'
20290 lint='$lint'
20291 lkflags='$lkflags'
20292 ln='$ln'
20293 lns='$lns'
20294 localtime_r_proto='$localtime_r_proto'
20295 locincpth='$locincpth'
20296 loclibpth='$loclibpth'
20297 longdblsize='$longdblsize'
20298 longlongsize='$longlongsize'
20299 longsize='$longsize'
20300 lp='$lp'
20301 lpr='$lpr'
20302 ls='$ls'
20303 lseeksize='$lseeksize'
20304 lseektype='$lseektype'
20305 mail='$mail'
20306 mailx='$mailx'
20307 make='$make'
20308 make_set_make='$make_set_make'
20309 mallocobj='$mallocobj'
20310 mallocsrc='$mallocsrc'
20311 malloctype='$malloctype'
20312 man1dir='$man1dir'
20313 man1direxp='$man1direxp'
20314 man1ext='$man1ext'
20315 man3dir='$man3dir'
20316 man3direxp='$man3direxp'
20317 man3ext='$man3ext'
20318 mips_type='$mips_type'
20319 mkdir='$mkdir'
20320 mmaptype='$mmaptype'
20321 modetype='$modetype'
20322 more='$more'
20323 multiarch='$multiarch'
20324 mv='$mv'
20325 myarchname='$myarchname'
20326 mydomain='$mydomain'
20327 myhostname='$myhostname'
20328 myuname='$myuname'
20329 n='$n'
20330 need_va_copy='$need_va_copy'
20331 netdb_hlen_type='$netdb_hlen_type'
20332 netdb_host_type='$netdb_host_type'
20333 netdb_name_type='$netdb_name_type'
20334 netdb_net_type='$netdb_net_type'
20335 nm='$nm'
20336 nm_opt='$nm_opt'
20337 nm_so_opt='$nm_so_opt'
20338 nonxs_ext='$nonxs_ext'
20339 nroff='$nroff'
20340 nvEUformat='$nvEUformat'
20341 nvFUformat='$nvFUformat'
20342 nvGUformat='$nvGUformat'
20343 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20344 nveformat='$nveformat'
20345 nvfformat='$nvfformat'
20346 nvgformat='$nvgformat'
20347 nvsize='$nvsize'
20348 nvtype='$nvtype'
20349 o_nonblock='$o_nonblock'
20350 obj_ext='$obj_ext'
20351 old_pthread_create_joinable='$old_pthread_create_joinable'
20352 optimize='$optimize'
20353 orderlib='$orderlib'
20354 osname='$osname'
20355 osvers='$osvers'
20356 otherlibdirs='$otherlibdirs'
20357 package='$package'
20358 pager='$pager'
20359 passcat='$passcat'
20360 patchlevel='$patchlevel'
20361 path_sep='$path_sep'
20362 perl5='$perl5'
20363 perl='$perl'
20364 perl_patchlevel='$perl_patchlevel'
20365 perladmin='$perladmin'
20366 perllibs='$perllibs'
20367 perlpath='$perlpath'
20368 pg='$pg'
20369 phostname='$phostname'
20370 pidtype='$pidtype'
20371 plibpth='$plibpth'
20372 pm_apiversion='$pm_apiversion'
20373 pmake='$pmake'
20374 pr='$pr'
20375 prefix='$prefix'
20376 prefixexp='$prefixexp'
20377 privlib='$privlib'
20378 privlibexp='$privlibexp'
20379 procselfexe='$procselfexe'
20380 prototype='$prototype'
20381 ptrsize='$ptrsize'
20382 quadkind='$quadkind'
20383 quadtype='$quadtype'
20384 randbits='$randbits'
20385 randfunc='$randfunc'
20386 random_r_proto='$random_r_proto'
20387 randseedtype='$randseedtype'
20388 ranlib='$ranlib'
20389 rd_nodata='$rd_nodata'
20390 readdir64_r_proto='$readdir64_r_proto'
20391 readdir_r_proto='$readdir_r_proto'
20392 revision='$revision'
20393 rm='$rm'
20394 rmail='$rmail'
20395 run='$run'
20396 runnm='$runnm'
20397 sPRIEUldbl='$sPRIEUldbl'
20398 sPRIFUldbl='$sPRIFUldbl'
20399 sPRIGUldbl='$sPRIGUldbl'
20400 sPRIXU64='$sPRIXU64'
20401 sPRId64='$sPRId64'
20402 sPRIeldbl='$sPRIeldbl'
20403 sPRIfldbl='$sPRIfldbl'
20404 sPRIgldbl='$sPRIgldbl'
20405 sPRIi64='$sPRIi64'
20406 sPRIo64='$sPRIo64'
20407 sPRIu64='$sPRIu64'
20408 sPRIx64='$sPRIx64'
20409 sSCNfldbl='$sSCNfldbl'
20410 sched_yield='$sched_yield'
20411 scriptdir='$scriptdir'
20412 scriptdirexp='$scriptdirexp'
20413 sed='$sed'
20414 seedfunc='$seedfunc'
20415 selectminbits='$selectminbits'
20416 selecttype='$selecttype'
20417 sendmail='$sendmail'
20418 setgrent_r_proto='$setgrent_r_proto'
20419 sethostent_r_proto='$sethostent_r_proto'
20420 setlocale_r_proto='$setlocale_r_proto'
20421 setnetent_r_proto='$setnetent_r_proto'
20422 setprotoent_r_proto='$setprotoent_r_proto'
20423 setpwent_r_proto='$setpwent_r_proto'
20424 setservent_r_proto='$setservent_r_proto'
20425 sh='$sh'
20426 shar='$shar'
20427 sharpbang='$sharpbang'
20428 shmattype='$shmattype'
20429 shortsize='$shortsize'
20430 shrpenv='$shrpenv'
20431 shsharp='$shsharp'
20432 sig_count='$sig_count'
20433 sig_name='$sig_name'
20434 sig_name_init='$sig_name_init'
20435 sig_num='$sig_num'
20436 sig_num_init='$sig_num_init'
20437 sig_size='$sig_size'
20438 signal_t='$signal_t'
20439 sitearch='$sitearch'
20440 sitearchexp='$sitearchexp'
20441 sitebin='$sitebin'
20442 sitebinexp='$sitebinexp'
20443 sitelib='$sitelib'
20444 sitelib_stem='$sitelib_stem'
20445 sitelibexp='$sitelibexp'
20446 siteprefix='$siteprefix'
20447 siteprefixexp='$siteprefixexp'
20448 sizesize='$sizesize'
20449 sizetype='$sizetype'
20450 sleep='$sleep'
20451 smail='$smail'
20452 so='$so'
20453 sockethdr='$sockethdr'
20454 socketlib='$socketlib'
20455 socksizetype='$socksizetype'
20456 sort='$sort'
20457 spackage='$spackage'
20458 spitshell='$spitshell'
20459 srand48_r_proto='$srand48_r_proto'
20460 srandom_r_proto='$srandom_r_proto'
20461 src='$src'
20462 ssizetype='$ssizetype'
20463 startperl='$startperl'
20464 startsh='$startsh'
20465 static_ext='$static_ext'
20466 stdchar='$stdchar'
20467 stdio_base='$stdio_base'
20468 stdio_bufsiz='$stdio_bufsiz'
20469 stdio_cnt='$stdio_cnt'
20470 stdio_filbuf='$stdio_filbuf'
20471 stdio_ptr='$stdio_ptr'
20472 stdio_stream_array='$stdio_stream_array'
20473 strerror_r_proto='$strerror_r_proto'
20474 strings='$strings'
20475 submit='$submit'
20476 subversion='$subversion'
20477 sysman='$sysman'
20478 tail='$tail'
20479 tar='$tar'
20480 targetarch='$targetarch'
20481 tbl='$tbl'
20482 tee='$tee'
20483 test='$test'
20484 timeincl='$timeincl'
20485 timetype='$timetype'
20486 tmpnam_r_proto='$tmpnam_r_proto'
20487 to='$to'
20488 touch='$touch'
20489 tr='$tr'
20490 trnl='$trnl'
20491 troff='$troff'
20492 ttyname_r_proto='$ttyname_r_proto'
20493 u16size='$u16size'
20494 u16type='$u16type'
20495 u32size='$u32size'
20496 u32type='$u32type'
20497 u64size='$u64size'
20498 u64type='$u64type'
20499 u8size='$u8size'
20500 u8type='$u8type'
20501 uidformat='$uidformat'
20502 uidsign='$uidsign'
20503 uidsize='$uidsize'
20504 uidtype='$uidtype'
20505 uname='$uname'
20506 uniq='$uniq'
20507 uquadtype='$uquadtype'
20508 use5005threads='$use5005threads'
20509 use64bitall='$use64bitall'
20510 use64bitint='$use64bitint'
20511 usecrosscompile='$usecrosscompile'
20512 usedl='$usedl'
20513 useithreads='$useithreads'
20514 uselargefiles='$uselargefiles'
20515 uselongdouble='$uselongdouble'
20516 usemorebits='$usemorebits'
20517 usemultiplicity='$usemultiplicity'
20518 usemymalloc='$usemymalloc'
20519 usenm='$usenm'
20520 useopcode='$useopcode'
20521 useperlio='$useperlio'
20522 useposix='$useposix'
20523 usereentrant='$usereentrant'
20524 usesfio='$usesfio'
20525 useshrplib='$useshrplib'
20526 usesocks='$usesocks'
20527 usethreads='$usethreads'
20528 usevendorprefix='$usevendorprefix'
20529 usevfork='$usevfork'
20530 usrinc='$usrinc'
20531 uuname='$uuname'
20532 uvXUformat='$uvXUformat'
20533 uvoformat='$uvoformat'
20534 uvsize='$uvsize'
20535 uvtype='$uvtype'
20536 uvuformat='$uvuformat'
20537 uvxformat='$uvxformat'
20538 vendorarch='$vendorarch'
20539 vendorarchexp='$vendorarchexp'
20540 vendorbin='$vendorbin'
20541 vendorbinexp='$vendorbinexp'
20542 vendorlib='$vendorlib'
20543 vendorlib_stem='$vendorlib_stem'
20544 vendorlibexp='$vendorlibexp'
20545 vendorprefix='$vendorprefix'
20546 vendorprefixexp='$vendorprefixexp'
20547 version='$version'
20548 version_patchlevel_string='$version_patchlevel_string'
20549 versiononly='$versiononly'
20550 vi='$vi'
20551 voidflags='$voidflags'
20552 xlibpth='$xlibpth'
20553 xs_apiversion='$xs_apiversion'
20554 yacc='$yacc'
20555 yaccflags='$yaccflags'
20556 zcat='$zcat'
20557 zip='$zip'
20558 EOT
20559
20560 : Add in command line options if available
20561 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20562
20563 : add special variables
20564 $test -f $src/patchlevel.h && \
20565 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20566 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20567 echo "PERL_CONFIG_SH=true" >>config.sh
20568
20569 : propagate old symbols
20570 if $test -f UU/config.sh; then
20571         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20572         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20573         $sort | $uniq -u >UU/oldsyms
20574         set X `cat UU/oldsyms`
20575         shift
20576         case $# in
20577         0) ;;
20578         *)
20579                 cat <<EOM
20580 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20581 EOM
20582                 echo "# Variables propagated from previous config.sh file." >>config.sh
20583                 for sym in `cat UU/oldsyms`; do
20584                         echo "    Propagating $hint variable "'$'"$sym..."
20585                         eval 'tmp="$'"${sym}"'"'
20586                         echo "$tmp" | \
20587                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20588                 done
20589                 ;;
20590         esac
20591 fi
20592
20593 : Finish up by extracting the .SH files
20594 case "$alldone" in
20595 exit)
20596         $rm -rf UU
20597         echo "Extraction done."
20598         exit 0
20599         ;;
20600 cont)
20601         ;;
20602 '')
20603         dflt=''
20604         nostick=true
20605         $cat <<EOM
20606
20607 If you'd like to make any changes to the config.sh file before I begin
20608 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20609
20610 EOM
20611         rp="Press return or use a shell escape to edit config.sh:"
20612         . UU/myread
20613         nostick=''
20614         case "$ans" in
20615         '') ;;
20616         *) : in case they cannot read
20617                 sh 1>&4 -c "$ans";;
20618         esac
20619         ;;
20620 esac
20621
20622 : if this fails, just run all the .SH files by hand
20623 . ./config.sh
20624
20625 echo " "
20626 exec 1>&4
20627 pwd=`pwd`
20628 . ./UU/extract
20629 cd "$pwd"
20630
20631 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20632         dflt=y
20633         case "$silent" in
20634         true) ;;
20635         *)
20636                 $cat <<EOM
20637
20638 Now you need to generate make dependencies by running "$make depend".
20639 You might prefer to run it in background: "$make depend > makedepend.out &"
20640 It can take a while, so you might not want to run it right now.
20641
20642 EOM
20643                 ;;
20644         esac
20645         rp="Run $make depend now?"
20646         . UU/myread
20647         case "$ans" in
20648         y*)
20649                 $make depend && echo "Now you must run '$make'."
20650                 ;;
20651         *)
20652                 echo "You must run '$make depend' then '$make'."
20653                 ;;
20654         esac
20655 elif test -f [Mm]akefile; then
20656         echo " "
20657         echo "Now you must run a $make."
20658 else
20659         echo "Configure done."
20660 fi
20661
20662 if $test -f Policy.sh; then
20663     $cat <<EOM
20664
20665 If you compile $package on a different machine or from a different object
20666 directory, copy the Policy.sh file from this object directory to the
20667 new one before you run Configure -- this will help you with most of
20668 the policy defaults.
20669
20670 EOM
20671 fi
20672 if $test -f config.msg; then
20673     echo "Hmm.  I also noted the following information while running:"
20674     echo " "
20675     $cat config.msg >&4
20676     $rm -f config.msg
20677 fi
20678 $rm -f kit*isdone ark*isdone
20679 $rm -rf UU
20680
20681 : End of Configure
20682