Fix and test for [perl #15549 Empty \Q\E not permitted]
[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 Tue Jan 21 18:59:19 MET 2003 [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_modflproto=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nanosleep=''
552 d_nice=''
553 d_nl_langinfo=''
554 d_off64_t=''
555 d_open3=''
556 d_fpathconf=''
557 d_pathconf=''
558 d_pause=''
559 d_pipe=''
560 d_poll=''
561 d_portable=''
562 d_procselfexe=''
563 procselfexe=''
564 d_old_pthread_create_joinable=''
565 old_pthread_create_joinable=''
566 d_pthread_atfork=''
567 d_pthread_yield=''
568 d_sched_yield=''
569 sched_yield=''
570 d_qgcvt=''
571 d_random_r=''
572 random_r_proto=''
573 d_readdir64_r=''
574 readdir64_r_proto=''
575 d_readdir=''
576 d_rewinddir=''
577 d_seekdir=''
578 d_telldir=''
579 d_readdir_r=''
580 readdir_r_proto=''
581 d_readlink=''
582 d_readv=''
583 d_recvmsg=''
584 d_rename=''
585 d_rmdir=''
586 d_safebcpy=''
587 d_safemcpy=''
588 d_sanemcmp=''
589 d_sbrkproto=''
590 d_select=''
591 d_sem=''
592 d_semctl=''
593 d_semget=''
594 d_semop=''
595 d_sendmsg=''
596 d_setegid=''
597 d_seteuid=''
598 d_setgrent=''
599 d_setgrent_r=''
600 setgrent_r_proto=''
601 d_setgrps=''
602 d_sethent=''
603 d_sethostent_r=''
604 sethostent_r_proto=''
605 d_setitimer=''
606 d_setlinebuf=''
607 d_setlocale=''
608 d_setlocale_r=''
609 setlocale_r_proto=''
610 d_setnent=''
611 d_setnetent_r=''
612 setnetent_r_proto=''
613 d_setpent=''
614 d_setpgid=''
615 d_setpgrp2=''
616 d_bsdsetpgrp=''
617 d_setpgrp=''
618 d_setprior=''
619 d_setproctitle=''
620 d_setprotoent_r=''
621 setprotoent_r_proto=''
622 d_setpwent=''
623 d_setpwent_r=''
624 setpwent_r_proto=''
625 d_setregid=''
626 d_setresgid=''
627 d_setresuid=''
628 d_setreuid=''
629 d_setrgid=''
630 d_setruid=''
631 d_setsent=''
632 d_setservent_r=''
633 setservent_r_proto=''
634 d_setsid=''
635 d_setvbuf=''
636 d_sfio=''
637 usesfio=''
638 d_shm=''
639 d_shmat=''
640 d_shmatprototype=''
641 shmattype=''
642 d_shmctl=''
643 d_shmdt=''
644 d_shmget=''
645 d_sigaction=''
646 d_sigprocmask=''
647 d_sigsetjmp=''
648 d_sockatmark=''
649 d_sockatmarkproto=''
650 d_msg_ctrunc=''
651 d_msg_dontroute=''
652 d_msg_oob=''
653 d_msg_peek=''
654 d_msg_proxy=''
655 d_oldsock=''
656 d_scm_rights=''
657 d_socket=''
658 d_sockpair=''
659 sockethdr=''
660 socketlib=''
661 d_socklen_t=''
662 d_socks5_init=''
663 d_sqrtl=''
664 d_srand48_r=''
665 srand48_r_proto=''
666 d_srandom_r=''
667 srandom_r_proto=''
668 d_sresgproto=''
669 d_sresuproto=''
670 d_statblks=''
671 d_statfs_f_flags=''
672 d_statfs_s=''
673 d_fstatvfs=''
674 d_statvfs=''
675 d_stdio_cnt_lval=''
676 d_stdio_ptr_lval=''
677 d_stdio_ptr_lval_nochange_cnt=''
678 d_stdio_ptr_lval_sets_cnt=''
679 d_stdiobase=''
680 d_stdstdio=''
681 stdio_base=''
682 stdio_bufsiz=''
683 stdio_cnt=''
684 stdio_filbuf=''
685 stdio_ptr=''
686 d_index=''
687 d_strchr=''
688 d_strcoll=''
689 d_strctcpy=''
690 d_strerrm=''
691 d_strerror=''
692 d_sysernlst=''
693 d_syserrlst=''
694 d_strerror_r=''
695 strerror_r_proto=''
696 d_strftime=''
697 d_strtod=''
698 d_strtol=''
699 d_strtold=''
700 d_strtoll=''
701 d_strtoq=''
702 d_strtoul=''
703 d_strtoull=''
704 d_strtouq=''
705 d_strxfrm=''
706 d_symlink=''
707 d_syscall=''
708 d_syscallproto=''
709 d_sysconf=''
710 d_system=''
711 d_tcgetpgrp=''
712 d_tcsetpgrp=''
713 d_telldirproto=''
714 d_time=''
715 timetype=''
716 clocktype=''
717 d_times=''
718 d_tmpnam_r=''
719 tmpnam_r_proto=''
720 d_truncate=''
721 d_ttyname_r=''
722 ttyname_r_proto=''
723 d_tzname=''
724 d_u32align=''
725 d_ualarm=''
726 d_umask=''
727 d_semctl_semid_ds=''
728 d_semctl_semun=''
729 d_union_semun=''
730 d_unordered=''
731 d_usleep=''
732 d_usleepproto=''
733 d_ustat=''
734 d_vfork=''
735 usevfork=''
736 d_voidsig=''
737 signal_t=''
738 d_volatile=''
739 d_charvspr=''
740 d_vprintf=''
741 d_wait4=''
742 d_waitpid=''
743 d_wcstombs=''
744 d_wctomb=''
745 d_writev=''
746 dlext=''
747 cccdlflags=''
748 ccdlflags=''
749 dlsrc=''
750 ld=''
751 lddlflags=''
752 usedl=''
753 doublesize=''
754 ebcdic=''
755 fflushNULL=''
756 fflushall=''
757 fpossize=''
758 fpostype=''
759 gccansipedantic=''
760 gccosandvers=''
761 gccversion=''
762 gidformat=''
763 gidsign=''
764 gidsize=''
765 gidtype=''
766 groupstype=''
767 h_fcntl=''
768 h_sysfile=''
769 html1dir=''
770 html1direxp=''
771 installhtml1dir=''
772 html3dir=''
773 html3direxp=''
774 installhtml3dir=''
775 i_arpainet=''
776 i_crypt=''
777 db_hashtype=''
778 db_prefixtype=''
779 db_version_major=''
780 db_version_minor=''
781 db_version_patch=''
782 i_db=''
783 i_dbm=''
784 i_rpcsvcdbm=''
785 d_dirnamlen=''
786 direntrytype=''
787 i_dirent=''
788 i_dld=''
789 i_dlfcn=''
790 i_fcntl=''
791 i_float=''
792 i_fp=''
793 i_fp_class=''
794 i_gdbm=''
795 d_grpasswd=''
796 i_grp=''
797 i_ieeefp=''
798 i_inttypes=''
799 i_langinfo=''
800 i_libutil=''
801 i_limits=''
802 i_locale=''
803 i_machcthr=''
804 i_malloc=''
805 i_math=''
806 i_memory=''
807 i_mntent=''
808 i_ndbm=''
809 i_netdb=''
810 i_neterrno=''
811 i_netinettcp=''
812 i_niin=''
813 i_sysin=''
814 i_poll=''
815 i_prot=''
816 i_pthread=''
817 d_pwage=''
818 d_pwchange=''
819 d_pwclass=''
820 d_pwcomment=''
821 d_pwexpire=''
822 d_pwgecos=''
823 d_pwpasswd=''
824 d_pwquota=''
825 i_pwd=''
826 i_sfio=''
827 i_shadow=''
828 i_socks=''
829 i_stddef=''
830 i_stdlib=''
831 i_string=''
832 strings=''
833 i_sunmath=''
834 i_sysaccess=''
835 i_sysdir=''
836 i_sysfile=''
837 d_voidtty=''
838 i_bsdioctl=''
839 i_sysfilio=''
840 i_sysioctl=''
841 i_syssockio=''
842 i_syslog=''
843 i_sysmman=''
844 i_sysmode=''
845 i_sysmount=''
846 i_sysndir=''
847 i_sysparam=''
848 i_sysresrc=''
849 i_syssecrt=''
850 i_sysselct=''
851 i_sysstat=''
852 i_sysstatfs=''
853 i_sysstatvfs=''
854 i_systimes=''
855 i_systypes=''
856 i_sysuio=''
857 i_sysun=''
858 i_sysutsname=''
859 i_sysvfs=''
860 i_syswait=''
861 i_sgtty=''
862 i_termio=''
863 i_termios=''
864 d_tm_tm_gmtoff=''
865 d_tm_tm_zone=''
866 i_systime=''
867 i_systimek=''
868 i_time=''
869 timeincl=''
870 i_unistd=''
871 i_ustat=''
872 i_utime=''
873 i_values=''
874 i_stdarg=''
875 i_varargs=''
876 i_varhdr=''
877 i_vfork=''
878 inc_version_list=''
879 inc_version_list_init=''
880 installprefix=''
881 installprefixexp=''
882 installstyle=''
883 installusrbinperl=''
884 intsize=''
885 longsize=''
886 shortsize=''
887 issymlink=''
888 libc=''
889 ldlibpthname=''
890 libperl=''
891 shrpenv=''
892 useshrplib=''
893 glibpth=''
894 libpth=''
895 loclibpth=''
896 plibpth=''
897 xlibpth=''
898 ignore_versioned_solibs=''
899 libs=''
900 libsdirs=''
901 libsfiles=''
902 libsfound=''
903 libspath=''
904 lns=''
905 d_PRIEUldbl=''
906 d_PRIFUldbl=''
907 d_PRIGUldbl=''
908 d_PRIeldbl=''
909 d_PRIfldbl=''
910 d_PRIgldbl=''
911 d_SCNfldbl=''
912 sPRIEUldbl=''
913 sPRIFUldbl=''
914 sPRIGUldbl=''
915 sPRIeldbl=''
916 sPRIfldbl=''
917 sPRIgldbl=''
918 sSCNfldbl=''
919 lseeksize=''
920 lseektype=''
921 make_set_make=''
922 d_mymalloc=''
923 freetype=''
924 mallocobj=''
925 mallocsrc=''
926 malloctype=''
927 usemymalloc=''
928 installman1dir=''
929 man1dir=''
930 man1direxp=''
931 man1ext=''
932 installman3dir=''
933 man3dir=''
934 man3direxp=''
935 man3ext=''
936 modetype=''
937 multiarch=''
938 mydomain=''
939 myhostname=''
940 phostname=''
941 c=''
942 n=''
943 d_eofnblk=''
944 eagain=''
945 o_nonblock=''
946 rd_nodata=''
947 need_va_copy=''
948 netdb_hlen_type=''
949 netdb_host_type=''
950 netdb_name_type=''
951 netdb_net_type=''
952 groupcat=''
953 hostcat=''
954 passcat=''
955 orderlib=''
956 ranlib=''
957 d_perl_otherlibdirs=''
958 otherlibdirs=''
959 package=''
960 spackage=''
961 pager=''
962 api_revision=''
963 api_subversion=''
964 api_version=''
965 api_versionstring=''
966 patchlevel=''
967 perl_patchlevel=''
968 revision=''
969 subversion=''
970 version=''
971 version_patchlevel_string=''
972 perl5=''
973 perladmin=''
974 perlpath=''
975 d_nv_preserves_uv=''
976 i16size=''
977 i16type=''
978 i32size=''
979 i32type=''
980 i64size=''
981 i64type=''
982 i8size=''
983 i8type=''
984 ivsize=''
985 ivtype=''
986 nv_preserves_uv_bits=''
987 nvsize=''
988 nvtype=''
989 u16size=''
990 u16type=''
991 u32size=''
992 u32type=''
993 u64size=''
994 u64type=''
995 u8size=''
996 u8type=''
997 uvsize=''
998 uvtype=''
999 ivdformat=''
1000 nvEUformat=''
1001 nvFUformat=''
1002 nvGUformat=''
1003 nveformat=''
1004 nvfformat=''
1005 nvgformat=''
1006 uvXUformat=''
1007 uvoformat=''
1008 uvuformat=''
1009 uvxformat=''
1010 pidtype=''
1011 prefix=''
1012 prefixexp=''
1013 installprivlib=''
1014 privlib=''
1015 privlibexp=''
1016 prototype=''
1017 ptrsize=''
1018 d_PRIXU64=''
1019 d_PRId64=''
1020 d_PRIi64=''
1021 d_PRIo64=''
1022 d_PRIu64=''
1023 d_PRIx64=''
1024 sPRIXU64=''
1025 sPRId64=''
1026 sPRIi64=''
1027 sPRIo64=''
1028 sPRIu64=''
1029 sPRIx64=''
1030 d_quad=''
1031 quadkind=''
1032 quadtype=''
1033 uquadtype=''
1034 drand01=''
1035 randbits=''
1036 randfunc=''
1037 randseedtype=''
1038 seedfunc=''
1039 installscript=''
1040 scriptdir=''
1041 scriptdirexp=''
1042 selectminbits=''
1043 selecttype=''
1044 sh=''
1045 sig_count=''
1046 sig_name=''
1047 sig_name_init=''
1048 sig_num=''
1049 sig_num_init=''
1050 sig_size=''
1051 installsitearch=''
1052 sitearch=''
1053 sitearchexp=''
1054 installsitebin=''
1055 sitebin=''
1056 sitebinexp=''
1057 installsitehtml1=''
1058 sitehtml1=''
1059 sitehtml1exp=''
1060 installsitehtml3=''
1061 sitehtml3=''
1062 sitehtml3exp=''
1063 installsitelib=''
1064 sitelib=''
1065 sitelib_stem=''
1066 sitelibexp=''
1067 installsiteman1=''
1068 siteman1=''
1069 siteman1exp=''
1070 installsiteman3=''
1071 siteman3=''
1072 siteman3exp=''
1073 siteprefix=''
1074 siteprefixexp=''
1075 installsitescript=''
1076 sitescript=''
1077 sitescriptexp=''
1078 sizesize=''
1079 sizetype=''
1080 so=''
1081 socksizetype=''
1082 sharpbang=''
1083 shsharp=''
1084 spitshell=''
1085 src=''
1086 ssizetype=''
1087 startperl=''
1088 startsh=''
1089 stdchar=''
1090 d_stdio_stream_array=''
1091 stdio_stream_array=''
1092 sysman=''
1093 trnl=''
1094 uidformat=''
1095 uidsign=''
1096 uidsize=''
1097 uidtype=''
1098 archname64=''
1099 use64bitall=''
1100 use64bitint=''
1101 ccflags_uselargefiles=''
1102 ldflags_uselargefiles=''
1103 libswanted_uselargefiles=''
1104 uselargefiles=''
1105 uselongdouble=''
1106 usemorebits=''
1107 usemultiplicity=''
1108 nm_opt=''
1109 nm_so_opt=''
1110 runnm=''
1111 usenm=''
1112 useperlio=''
1113 usesocks=''
1114 d_oldpthreads=''
1115 use5005threads=''
1116 useithreads=''
1117 usereentrant=''
1118 usethreads=''
1119 incpath=''
1120 mips_type=''
1121 usrinc=''
1122 d_vendorarch=''
1123 installvendorarch=''
1124 vendorarch=''
1125 vendorarchexp=''
1126 d_vendorbin=''
1127 installvendorbin=''
1128 vendorbin=''
1129 vendorbinexp=''
1130 installvendorhtml1=''
1131 vendorhtml1=''
1132 vendorhtml1exp=''
1133 installvendorhtml3=''
1134 vendorhtml3=''
1135 vendorhtml3exp=''
1136 d_vendorlib=''
1137 installvendorlib=''
1138 vendorlib=''
1139 vendorlib_stem=''
1140 vendorlibexp=''
1141 installvendorman1=''
1142 vendorman1=''
1143 vendorman1exp=''
1144 installvendorman3=''
1145 vendorman3=''
1146 vendorman3exp=''
1147 usevendorprefix=''
1148 vendorprefix=''
1149 vendorprefixexp=''
1150 d_vendorscript=''
1151 installvendorscript=''
1152 vendorscript=''
1153 vendorscriptexp=''
1154 versiononly=''
1155 defvoidused=''
1156 voidflags=''
1157 pm_apiversion=''
1158 xs_apiversion=''
1159 yacc=''
1160 yaccflags=''
1161 CONFIG=''
1162
1163 define='define'
1164 undef='undef'
1165 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1166 rmlist=''
1167
1168 : We must find out about Eunice early
1169 eunicefix=':'
1170 if test -f /etc/unixtovms; then
1171         eunicefix=/etc/unixtovms
1172 fi
1173 if test -f /etc/unixtovms.exe; then
1174         eunicefix=/etc/unixtovms.exe
1175 fi
1176
1177 : Set executable suffix now -- needed before hints available
1178 if test -f "/libs/version.library"; then
1179 : Amiga OS
1180     _exe=""
1181 elif test -f "/system/gnu_library/bin/ar.pm"; then
1182 : Stratus VOS
1183     _exe=".pm"
1184 elif test -n "$DJGPP"; then
1185 : DOS DJGPP
1186     _exe=".exe"
1187 elif test -d c:/. ; then
1188 : OS/2 or cygwin
1189     _exe=".exe"
1190 fi
1191
1192 i_whoami=''
1193 ccname=''
1194 ccversion=''
1195 perllibs=''
1196 : set useposix=false in your hint file to disable the POSIX extension.
1197 useposix=true
1198 : set useopcode=false in your hint file to disable the Opcode extension.
1199 useopcode=true
1200 : Trailing extension.  Override this in a hint file, if needed.
1201 : Extra object files, if any, needed on this platform.
1202 archobjs=''
1203 archname=''
1204 : Possible local include directories to search.
1205 : Set locincpth to "" in a hint file to defeat local include searches.
1206 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1207 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1208 :
1209 : no include file wanted by default
1210 inclwanted=''
1211
1212 groupstype=''
1213 libnames=''
1214 : change the next line if compiling for Xenix/286 on Xenix/386
1215 xlibpth='/usr/lib/386 /lib/386'
1216 : Possible local library directories to search.
1217 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1218 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1219
1220 : general looking path for locating libraries
1221 glibpth="/lib /usr/lib $xlibpth"
1222 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1223 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1224 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1225
1226 : Private path used by Configure to find libraries.  Its value
1227 : is prepended to libpth. This variable takes care of special
1228 : machines, like the mips.  Usually, it should be empty.
1229 plibpth=''
1230
1231 : default library list
1232 libswanted=''
1233 : some systems want to use only the non-versioned libso:s
1234 ignore_versioned_solibs=''
1235 siteman1=''
1236 siteman3=''
1237 sitescript=''
1238 archname64=''
1239 ccflags_uselargefiles=''
1240 ldflags_uselargefiles=''
1241 libswanted_uselargefiles=''
1242 : set usemultiplicity on the Configure command line to enable multiplicity.
1243 : set usesocks on the Configure command line to enable socks.
1244 : set usethreads on the Configure command line to enable threads.
1245 usereentrant='undef'
1246 : full support for void wanted by default
1247 defvoidused=15
1248
1249 : List of libraries we want.
1250 : If anyone needs -lnet, put it in a hint file.
1251 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1252 libswanted="$libswanted dld ld sun m c cposix posix"
1253 libswanted="$libswanted ndir dir crypt sec"
1254 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1255 : We probably want to search /usr/shlib before most other libraries.
1256 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1257 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1258 glibpth="/usr/shlib $glibpth"
1259 : Do not use vfork unless overridden by a hint file.
1260 usevfork=false
1261
1262 : Find the basic shell for Bourne shell scripts
1263 case "$sh" in
1264 '')
1265         case "$SYSTYPE" in
1266         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1267         *) xxx='/bin/sh';;
1268         esac
1269         if test -f "$xxx"; then
1270                 sh="$xxx"
1271         else
1272                 : Build up a list and do a single loop so we can 'break' out.
1273                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1274                 for xxx in sh bash ksh pdksh ash; do
1275                         for p in $pth; do
1276                                 try="$try ${p}/${xxx}"
1277                         done
1278                 done
1279                 for xxx in $try; do
1280                         if test -f "$xxx"; then
1281                                 sh="$xxx";
1282                                 break
1283                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1284                                 sh="$xxx";
1285                                 break
1286                         elif test -f "$xxx.exe"; then
1287                                 sh="$xxx";
1288                                 break
1289                         fi
1290                 done
1291         fi
1292         ;;
1293 esac
1294
1295 case "$sh" in
1296 '')     cat >&2 <<EOM
1297 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1298
1299 Usually it's in /bin/sh.  How did you even get this far?
1300 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1301 we'll try to straighten this all out.
1302 EOM
1303         exit 1
1304         ;;
1305 esac
1306
1307 : see if sh knows # comments
1308 if `$sh -c '#' >/dev/null 2>&1`; then
1309         shsharp=true
1310         spitshell=cat
1311         xcat=/bin/cat
1312         test -f $xcat$_exe || xcat=/usr/bin/cat
1313         if test ! -f $xcat$_exe; then
1314                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1315                         if test -f $p/cat$_exe; then
1316                                 xcat=$p/cat
1317                                 break
1318                         fi
1319                 done
1320                 if test ! -f $xcat$_exe; then
1321                         echo "Can't find cat anywhere!"
1322                         exit 1
1323                 fi
1324         fi
1325         echo "#!$xcat" >sharp
1326         $eunicefix sharp
1327         chmod +x sharp
1328         ./sharp > today
1329         if test -s today; then
1330                 sharpbang='#!'
1331         else
1332                 echo "#! $xcat" > sharp
1333                 $eunicefix sharp
1334                 chmod +x sharp
1335                 ./sharp > today
1336                 if test -s today; then
1337                         sharpbang='#! '
1338                 else
1339                         sharpbang=': use '
1340                 fi
1341         fi
1342 else
1343         echo " "
1344         echo "Your $sh doesn't grok # comments--I will strip them later on."
1345         shsharp=false
1346         cd ..
1347         echo "exec grep -v '^[  ]*#'" >spitshell
1348         chmod +x spitshell
1349         $eunicefix spitshell
1350         spitshell=`pwd`/spitshell
1351         cd UU
1352         echo "I presume that if # doesn't work, #! won't work either!"
1353         sharpbang=': use '
1354 fi
1355 rm -f sharp today
1356
1357 : figure out how to guarantee sh startup
1358 case "$startsh" in
1359 '') startsh=${sharpbang}${sh} ;;
1360 *)
1361 esac
1362 cat >sharp <<EOSS
1363 $startsh
1364 set abc
1365 test "$?abc" != 1
1366 EOSS
1367
1368 chmod +x sharp
1369 $eunicefix sharp
1370 if ./sharp; then
1371         : echo "Yup, it does."
1372 else
1373         echo "Hmm... '$startsh' does not guarantee sh startup..."
1374         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1375 fi
1376 rm -f sharp
1377
1378
1379 : Save command line options in file UU/cmdline.opt for later use in
1380 : generating config.sh.
1381 cat > cmdline.opt <<EOSH
1382 # Configure command line arguments.
1383 config_arg0='$0'
1384 config_args='$*'
1385 config_argc=$#
1386 EOSH
1387 argn=1
1388 args_exp=''
1389 args_sep=''
1390 for arg in "$@"; do
1391         cat >>cmdline.opt <<EOSH
1392 config_arg$argn='$arg'
1393 EOSH
1394         # Extreme backslashitis: replace each ' by '"'"'
1395         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1396 $arg
1397 EOC
1398         arg_exp=`cat cmdl.opt`
1399         args_exp="$args_exp$args_sep'$arg_exp'"
1400         argn=`expr $argn + 1`
1401         args_sep=' '
1402 done
1403 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1404 # used by ./hints/os2.sh
1405 rm -f cmdl.opt
1406
1407 : produce awk script to parse command line options
1408 cat >options.awk <<'EOF'
1409 BEGIN {
1410         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1411
1412         len = length(optstr);
1413         for (i = 1; i <= len; i++) {
1414                 c = substr(optstr, i, 1);
1415                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1416                 if (a == ":") {
1417                         arg[c] = 1;
1418                         i++;
1419                 }
1420                 opt[c] = 1;
1421         }
1422 }
1423 {
1424         expect = 0;
1425         str = $0;
1426         if (substr(str, 1, 1) != "-") {
1427                 printf("'%s'\n", str);
1428                 next;
1429         }
1430         len = length($0);
1431         for (i = 2; i <= len; i++) {
1432                 c = substr(str, i, 1);
1433                 if (!opt[c]) {
1434                         printf("-%s\n", substr(str, i));
1435                         next;
1436                 }
1437                 printf("-%s\n", c);
1438                 if (arg[c]) {
1439                         if (i < len)
1440                                 printf("'%s'\n", substr(str, i + 1));
1441                         else
1442                                 expect = 1;
1443                         next;
1444                 }
1445         }
1446 }
1447 END {
1448         if (expect)
1449                 print "?";
1450 }
1451 EOF
1452
1453 : process the command line options
1454 set X `for arg in "$@"; do echo "X$arg"; done |
1455         sed -e s/X// | awk -f options.awk`
1456 eval "set $*"
1457 shift
1458 rm -f options.awk
1459
1460 : set up default values
1461 fastread=''
1462 reuseval=false
1463 config_sh=''
1464 alldone=''
1465 error=''
1466 silent=''
1467 extractsh=''
1468 override=''
1469 knowitall=''
1470 rm -f optdef.sh posthint.sh
1471 cat >optdef.sh <<EOS
1472 $startsh
1473 EOS
1474
1475
1476 : option parsing
1477 while test $# -gt 0; do
1478         case "$1" in
1479         -d) shift; fastread=yes;;
1480         -e) shift; alldone=cont;;
1481         -f)
1482                 shift
1483                 cd ..
1484                 if test -r "$1"; then
1485                         config_sh="$1"
1486                 else
1487                         echo "$me: cannot read config file $1." >&2
1488                         error=true
1489                 fi
1490                 cd UU
1491                 shift;;
1492         -h) shift; error=true;;
1493         -r) shift; reuseval=true;;
1494         -s) shift; silent=true; realsilent=true;;
1495         -E) shift; alldone=exit;;
1496         -K) shift; knowitall=true;;
1497         -O) shift; override=true;;
1498         -S) shift; silent=true; extractsh=true;;
1499         -D)
1500                 shift
1501                 case "$1" in
1502                 *=)
1503                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1504                         echo "$me: ignoring -D $1" >&2
1505                         ;;
1506                 *=*) echo "$1" | \
1507                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1508                 *) echo "$1='define'" >> optdef.sh;;
1509                 esac
1510                 shift
1511                 ;;
1512         -U)
1513                 shift
1514                 case "$1" in
1515                 *=) echo "$1" >> optdef.sh;;
1516                 *=*)
1517                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1518                         echo "$me: ignoring -U $1" >&2
1519                         ;;
1520                 *) echo "$1='undef'" >> optdef.sh;;
1521                 esac
1522                 shift
1523                 ;;
1524         -A)
1525             shift
1526             xxx=''
1527             yyy="$1"
1528             zzz=''
1529             uuu=undef
1530             case "$yyy" in
1531             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1532                  case "$zzz" in
1533                  *:*) zzz='' ;;
1534                  *)   xxx=append
1535                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1536                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1537                  esac
1538                  ;;
1539             esac
1540             case "$xxx" in
1541             '')  case "$yyy" in
1542                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1543                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1544                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1545                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1546                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1547                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1548                  esac
1549                  ;;       
1550             esac
1551             case "$xxx" in
1552             append)
1553                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1554             clear)
1555                 echo "$yyy=''"                  >> posthint.sh ;;
1556             define)
1557                 case "$zzz" in
1558                 '') zzz=define ;;
1559                 esac
1560                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1561             eval)
1562                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1563             prepend)
1564                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1565             undef)
1566                 case "$zzz" in
1567                 '') zzz="$uuu" ;;
1568                 esac
1569                 echo "$yyy=$zzz"                >> posthint.sh ;;
1570             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1571             esac
1572             shift
1573             ;;
1574         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1575             exit 0;;
1576         --) break;;
1577         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1578         *) break;;
1579         esac
1580 done
1581
1582 case "$error" in
1583 true)
1584         cat >&2 <<EOM
1585 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1586                  [-U symbol] [-U symbol=] [-A command:symbol...]
1587   -d : use defaults for all answers.
1588   -e : go on without questioning past the production of config.sh.
1589   -f : specify an alternate default configuration file.
1590   -h : print this help message and exit (with an error status).
1591   -r : reuse C symbols value if possible (skips costly nm extraction).
1592   -s : silent mode, only echoes questions and essential information.
1593   -D : define symbol to have some value:
1594          -D symbol         symbol gets the value 'define'
1595          -D symbol=value   symbol gets the value 'value'
1596   -E : stop at the end of questions, after having produced config.sh.
1597   -K : do not use unless you know what you are doing.
1598   -O : let -D and -U override definitions from loaded configuration file.
1599   -S : perform variable substitutions on all .SH files (can mix with -f)
1600   -U : undefine symbol:
1601          -U symbol    symbol gets the value 'undef'
1602          -U symbol=   symbol gets completely empty
1603   -A : manipulate symbol after the platform specific hints have been applied:
1604          -A symbol=value                append " "value to symbol
1605          -A append:symbol=value         append value to symbol
1606          -A define:symbol=value         define symbol to have value
1607          -A clear:symbol                define symbol to be ''
1608          -A define:symbol               define symbol to be 'define'
1609          -A eval:symbol=value           define symbol to be eval of value
1610          -A prepend:symbol=value        prepend value to symbol
1611          -A undef:symbol                define symbol to be 'undef'
1612          -A undef:symbol=               define symbol to be ''
1613   -V : print version number and exit (with a zero status).
1614 EOM
1615         exit 1
1616         ;;
1617 esac
1618
1619 : Sanity checks
1620 case "$fastread$alldone" in
1621 yescont|yesexit) ;;
1622 *)
1623         case "$extractsh" in
1624         true) ;;
1625         *)
1626                 if test ! -t 0; then
1627                         echo "Say 'sh Configure', not 'sh <Configure'"
1628                         exit 1
1629                 fi
1630                 ;;
1631         esac
1632         ;;
1633 esac
1634
1635 exec 4>&1
1636 case "$silent" in
1637 true) exec 1>/dev/null;;
1638 esac
1639
1640 : run the defines and the undefines, if any, but leave the file out there...
1641 touch optdef.sh
1642 . ./optdef.sh
1643 : create the posthint manipulation script and leave the file out there...
1644 touch posthint.sh
1645
1646 : set package name
1647 package=perl5
1648 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1649 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1650 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1651 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1652 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1653 esac
1654
1655 : Some greps do not return status, grrr.
1656 echo "grimblepritz" >grimble
1657 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1658         contains=contains
1659 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1660         contains=grep
1661 else
1662         contains=contains
1663 fi
1664 rm -f grimble
1665 : the following should work in any shell
1666 case "$contains" in
1667 contains*)
1668         echo " "
1669         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1670         cat >contains <<'EOSS'
1671 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1672 EOSS
1673 chmod +x contains
1674 esac
1675
1676 : Find the path to the source tree
1677 case "$src" in
1678 '') case "$0" in
1679     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1680          case "$src" in
1681          /*)    ;;
1682          .)     ;;
1683          *)     src=`cd ../$src && pwd` ;;
1684          esac
1685          ;;
1686     *)   src='.';;
1687     esac;;
1688 esac
1689 case "$src" in
1690 '')     src=/
1691         rsrc=/
1692         ;;
1693 /*) rsrc="$src";;
1694 *) rsrc="../$src";;
1695 esac
1696 if test -f $rsrc/Configure && \
1697         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1698 then
1699    : found it, so we are ok.
1700 else
1701         rsrc=''
1702         for src in . .. ../.. ../../.. ../../../..; do
1703                 if test -f ../$src/Configure && \
1704                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1705                 then
1706                         rsrc=../$src
1707                         break
1708                 fi
1709         done
1710 fi
1711 case "$rsrc" in
1712 '')
1713         cat <<EOM >&4
1714
1715 Sorry, I can't seem to locate the source dir for $package.  Please start
1716 Configure with an explicit path -- i.e. /some/path/Configure.
1717
1718 EOM
1719         exit 1
1720         ;;
1721 ../.)   rsrc='..';;
1722 *)
1723         echo " "
1724         echo "Sources for $package found in \"$src\"." >&4
1725         ;;
1726 esac
1727
1728 : script used to extract .SH files with variable substitutions
1729 cat >extract <<'EOS'
1730 PERL_CONFIG_SH=true
1731 echo "Doing variable substitutions on .SH files..."
1732 if test -f MANIFEST; then
1733         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1734 else
1735         echo "(Looking for .SH files under the source directory.)"
1736         set x `(cd "$src"; find . -name "*.SH" -print)`
1737 fi
1738 shift
1739 case $# in
1740 0) set x `(cd "$src"; echo *.SH)`; shift;;
1741 esac
1742 if test ! -f "$src/$1"; then
1743         shift
1744 fi
1745 mkdir_p='
1746 name=$1;
1747 create="";
1748 while test $name; do
1749         if test ! -d "$name"; then
1750                 create="$name $create";
1751                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1752                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1753         else
1754                 name="";
1755         fi;
1756 done;
1757 for file in $create; do
1758         mkdir $file;
1759 done
1760 '
1761 for file in $*; do
1762         case "$src" in
1763         ".")
1764                 case "$file" in
1765                 */*)
1766                         dir=`expr X$file : 'X\(.*\)/'`
1767                         file=`expr X$file : 'X.*/\(.*\)'`
1768                         (cd "$dir" && . ./$file)
1769                         ;;
1770                 *)
1771                         . ./$file
1772                         ;;
1773                 esac
1774                 ;;
1775         *)
1776                 case "$file" in
1777                 */*)
1778                         dir=`expr X$file : 'X\(.*\)/'`
1779                         file=`expr X$file : 'X.*/\(.*\)'`
1780                         (set x $dir; shift; eval $mkdir_p)
1781                         sh <"$src/$dir/$file"
1782                         ;;
1783                 *)
1784                         sh <"$src/$file"
1785                         ;;
1786                 esac
1787                 ;;
1788         esac
1789 done
1790 if test -f "$src/config_h.SH"; then
1791         if test ! -f config.h; then
1792         : oops, they left it out of MANIFEST, probably, so do it anyway.
1793         . "$src/config_h.SH"
1794         fi
1795 fi
1796 EOS
1797
1798 : extract files and exit if asked to do so
1799 case "$extractsh" in
1800 true)
1801         case "$realsilent" in
1802         true) ;;
1803         *) exec 1>&4;;
1804         esac
1805         case "$config_sh" in
1806         '') config_sh='config.sh';;
1807         esac
1808         echo " "
1809         echo "Fetching answers from $config_sh..."
1810         cd ..
1811         . $config_sh
1812         test "$override" && . ./optdef.sh
1813         echo " "
1814         . UU/extract
1815         rm -rf UU
1816         echo "Extraction done."
1817         exit 0
1818         ;;
1819 esac
1820
1821 : Eunice requires " " instead of "", can you believe it
1822 echo " "
1823 : Here we go...
1824 echo "Beginning of configuration questions for $package."
1825
1826 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1827
1828 : first determine how to suppress newline on echo command
1829 echo " "
1830 echo "Checking echo to see how to suppress newlines..."
1831 (echo "hi there\c" ; echo " ") >.echotmp
1832 if $contains c .echotmp >/dev/null 2>&1 ; then
1833         echo "...using -n."
1834         n='-n'
1835         c=''
1836 else
1837         cat <<'EOM'
1838 ...using \c
1839 EOM
1840         n=''
1841         c='\c'
1842 fi
1843 echo $n "The star should be here-->$c"
1844 echo '*'
1845 rm -f .echotmp
1846
1847 : Now test for existence of everything in MANIFEST
1848 echo " "
1849 if test -f "$rsrc/MANIFEST"; then
1850         echo "First let's make sure your kit is complete.  Checking..." >&4
1851         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1852         rm -f missing
1853         tmppwd=`pwd`
1854         for filelist in x??; do
1855                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1856         done
1857         if test -s missing; then
1858                 cat missing >&4
1859                 cat >&4 <<'EOM'
1860
1861 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1862
1863 You have the option of continuing the configuration process, despite the
1864 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1865 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1866 and contact the author (perlbug@perl.org).
1867
1868 EOM
1869                 echo $n "Continue? [n] $c" >&4
1870                 read ans
1871                 case "$ans" in
1872                 y*)
1873                         echo "Continuing..." >&4
1874                         rm -f missing
1875                         ;;
1876                 *)
1877                         echo "ABORTING..." >&4
1878                         kill $$
1879                         ;;
1880                 esac
1881         else
1882                 echo "Looks good..."
1883         fi
1884 else
1885         echo "There is no MANIFEST file.  I hope your kit is complete !"
1886 fi
1887 rm -f missing x??
1888
1889 echo " "
1890 : Find the appropriate value for a newline for tr
1891 if test -n "$DJGPP"; then
1892        trnl='\012'
1893 fi
1894 if test X"$trnl" = X; then
1895         case "`echo foo|tr '\n' x 2>/dev/null`" in
1896         foox) trnl='\n' ;;
1897         esac
1898 fi
1899 if test X"$trnl" = X; then
1900         case "`echo foo|tr '\012' x 2>/dev/null`" in
1901         foox) trnl='\012' ;;
1902         esac
1903 fi
1904 if test X"$trnl" = X; then
1905        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1906        fooxy) trnl='\n\r' ;;
1907        esac
1908 fi
1909 if test X"$trnl" = X; then
1910         cat <<EOM >&2
1911
1912 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1913
1914 EOM
1915         exit 1
1916 fi
1917
1918 : compute the number of columns on the terminal for proper question formatting
1919 case "$COLUMNS" in
1920 '') COLUMNS='80';;
1921 esac
1922
1923 : set up the echo used in my read
1924 myecho="case \"\$xxxm\" in
1925 '') echo $n \"\$rp $c\" >&4;;
1926 *) case \"\$rp\" in
1927         '') echo $n \"[\$xxxm] $c\";;
1928         *)
1929                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1930                         echo \"\$rp\" >&4
1931                         echo $n \"[\$xxxm] $c\" >&4
1932                 else
1933                         echo $n \"\$rp [\$xxxm] $c\" >&4
1934                 fi
1935                 ;;
1936         esac;;
1937 esac"
1938
1939 : now set up to do reads with possible shell escape and default assignment
1940 cat <<EOSC >myread
1941 $startsh
1942 xxxm=\$dflt
1943 $myecho
1944 ans='!'
1945 case "\$fastread" in
1946 yes) case "\$dflt" in
1947         '') ;;
1948         *) ans='';
1949                 case "\$silent-\$rp" in
1950                 true-) ;;
1951                 *) echo " " >&4;;
1952                 esac;;
1953         esac;;
1954 *) case "\$silent" in
1955         true) case "\$rp" in
1956                 '') ans='';;
1957                 esac;;
1958         esac;;
1959 esac
1960 while expr "X\$ans" : "X!" >/dev/null; do
1961         read answ
1962         set x \$xxxm
1963         shift
1964         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1965         case  "\$answ" in
1966         "!")
1967                 sh 1>&4
1968                 echo " "
1969                 $myecho
1970                 ;;
1971         !*)
1972                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1973                 shift
1974                 sh 1>&4 -c "\$*"
1975                 echo " "
1976                 $myecho
1977                 ;;
1978         "\$ans")
1979                 case "\$ans" in
1980                 \\&*)
1981                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1982                         shift
1983                         case "\$1" in
1984                         -d)
1985                                 fastread=yes
1986                                 echo "(OK, I'll run with -d after this question.)" >&4
1987                                 ;;
1988                         -*)
1989                                 echo "*** Sorry, \$1 not supported yet." >&4
1990                                 ;;
1991                         esac
1992                         $myecho
1993                         ans=!
1994                         ;;
1995                 esac;;
1996         *)
1997                 case "\$aok" in
1998                 y)
1999                         echo "*** Substitution done -- please confirm."
2000                         xxxm="\$ans"
2001                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2002                         xxxm="\$ans"
2003                         ans=!
2004                         ;;
2005                 *)
2006                         echo "*** Error -- try again."
2007                         ans=!
2008                         ;;
2009                 esac
2010                 $myecho
2011                 ;;
2012         esac
2013         case "\$ans\$xxxm\$nostick" in
2014         '')
2015                 ans=!
2016                 $myecho
2017                 ;;
2018         esac
2019 done
2020 case "\$ans" in
2021 '') ans="\$xxxm";;
2022 esac
2023 EOSC
2024
2025 : create .config dir to save info across Configure sessions
2026 test -d ../.config || mkdir ../.config
2027 cat >../.config/README <<EOF
2028 This directory created by Configure to save information that should
2029 persist across sessions for $package.
2030
2031 You may safely delete it if you wish.
2032 EOF
2033
2034 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2035 case "$usedevel" in
2036 $define|true|[yY]*) ;;
2037 *) case "$xversion" in
2038    *[13579])
2039         cat >&4 <<EOH
2040 *** WHOA THERE!!! ***
2041
2042     This is an UNSTABLE DEVELOPMENT release.
2043     The version of this $package distribution is $xversion, that is, odd,
2044     (as opposed to even) and that signifies a development release.
2045     If you want a maintenance release, you want an even-numbered version.
2046
2047     Do ***NOT*** install this into production use.
2048     Data corruption and crashes are possible.
2049
2050     It is most seriously suggested that you do not continue any further
2051     unless you want to help in developing and debugging Perl.
2052
2053     If you *still* want to build perl, you can answer 'y' now,
2054     or pass -Dusedevel to Configure.
2055
2056 EOH
2057         rp='Do you really want to continue?'
2058         dflt='n'
2059         . ./myread
2060         case "$ans" in
2061         [yY]) echo >&4 "Okay, continuing."
2062               usedevel="$define" ;;
2063         *) echo >&4 "Okay, bye."
2064            exit 1
2065            ;;
2066         esac
2067         ;;
2068     esac
2069     ;;
2070 esac
2071 case "$usedevel" in
2072 $define|true|[yY]*)
2073         case "$versiononly" in
2074         '') versiononly="$define" ;;
2075         esac
2076         case "$installusrbinperl" in
2077         '') installusrbinperl="$undef" ;;
2078         esac
2079         ;;
2080 esac
2081
2082 : general instructions
2083 needman=true
2084 firsttime=true
2085 user=`(logname) 2>/dev/null`
2086 case "$user" in
2087 '') user=`whoami 2>&1`;;
2088 esac
2089 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2090         firsttime=false
2091         echo " "
2092         rp='Would you like to see the instructions?'
2093         dflt=n
2094         . ./myread
2095         case "$ans" in
2096         [yY]*) ;;
2097         *) needman=false;;
2098         esac
2099 fi
2100 if $needman; then
2101         cat <<EOH
2102
2103 This installation shell script will examine your system and ask you questions
2104 to determine how the perl5 package should be installed. If you get
2105 stuck on a question, you may use a ! shell escape to start a subshell or
2106 execute a command.  Many of the questions will have default answers in square
2107 brackets; typing carriage return will give you the default.
2108
2109 On some of the questions which ask for file or directory names you are allowed
2110 to use the ~name construct to specify the login directory belonging to "name",
2111 even if you don't have a shell which knows about that.  Questions where this is
2112 allowed will be marked "(~name ok)".
2113
2114 EOH
2115         rp=''
2116         dflt='Type carriage return to continue'
2117         . ./myread
2118         cat <<'EOH'
2119
2120 The prompter used in this script allows you to use shell variables and
2121 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2122 in the default answer, as if the default line was a set of arguments given to a
2123 script shell.  This means you may also use $* to repeat the whole default line,
2124 so you do not have to re-type everything to add something to the default.
2125
2126 Everytime there is a substitution, you will have to confirm.  If there is an
2127 error (e.g. an unmatched backtick), the default answer will remain unchanged
2128 and you will be prompted again.
2129
2130 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2131 the questions and use the computed defaults (or the previous answers if there
2132 was already a config.sh file). Type 'Configure -h' for a list of options.
2133 You may also start interactively and then answer '& -d' at any prompt to turn
2134 on the non-interactive behaviour for the remainder of the execution.
2135
2136 EOH
2137         . ./myread
2138         cat <<EOH
2139
2140 Much effort has been expended to ensure that this shell script will run on any
2141 Unix system.  If despite that it blows up on yours, your best bet is to edit
2142 Configure and run it again.  If you can't run Configure for some reason,
2143 you'll have to generate a config.sh file by hand.  Whatever problems you
2144 have, let me (perlbug@perl.org) know how I blew it.
2145
2146 This installation script affects things in two ways:
2147
2148 1) it may do direct variable substitutions on some of the files included
2149    in this kit.
2150 2) it builds a config.h file for inclusion in C programs.  You may edit
2151    any of these files as the need arises after running this script.
2152
2153 If you make a mistake on a question, there is no easy way to back up to it
2154 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2155 files.  Configure will offer to let you do this before it runs the SH files.
2156
2157 EOH
2158         dflt='Type carriage return to continue'
2159         . ./myread
2160         case "$firsttime" in
2161         true) echo $user >>../.config/instruct;;
2162         esac
2163 fi
2164
2165 : find out where common programs are
2166 echo " "
2167 echo "Locating common programs..." >&4
2168 cat <<EOSC >loc
2169 $startsh
2170 case \$# in
2171 0) exit 1;;
2172 esac
2173 thing=\$1
2174 shift
2175 dflt=\$1
2176 shift
2177 for dir in \$*; do
2178         case "\$thing" in
2179         .)
2180         if test -d \$dir/\$thing; then
2181                 echo \$dir
2182                 exit 0
2183         fi
2184         ;;
2185         *)
2186         for thisthing in \$dir/\$thing; do
2187                 : just loop through to pick last item
2188         done
2189         if test -f \$thisthing; then
2190                 echo \$thisthing
2191                 exit 0
2192         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2193                 echo \$thisthing
2194                 exit 0
2195         elif test -f \$dir/\$thing.exe; then
2196                 if test -n "$DJGPP"; then
2197                         echo \$dir/\$thing.exe
2198                 elif test "$eunicefix" != ":"; then
2199                         : on Eunice apparently
2200                         echo \$dir/\$thing
2201                         exit 0
2202                 fi
2203                 exit 0
2204         fi
2205         ;;
2206         esac
2207 done
2208 echo \$dflt
2209 exit 1
2210 EOSC
2211 chmod +x loc
2212 $eunicefix loc
2213 loclist="
2214 awk
2215 cat
2216 chmod
2217 comm
2218 cp
2219 echo
2220 expr
2221 grep
2222 ls
2223 mkdir
2224 rm
2225 sed
2226 sort
2227 touch
2228 tr
2229 uniq
2230 "
2231 trylist="
2232 Mcc
2233 ar
2234 bison
2235 byacc
2236 cpp
2237 csh
2238 date
2239 egrep
2240 gmake
2241 gzip
2242 less
2243 ln
2244 make
2245 more
2246 nm
2247 nroff
2248 pg
2249 test
2250 uname
2251 zip
2252 "
2253 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2254 pth="$pth /lib /usr/lib"
2255 for file in $loclist; do
2256         eval xxx=\$$file
2257         case "$xxx" in
2258         /*|?:[\\/]*)
2259                 if test -f "$xxx"; then
2260                         : ok
2261                 else
2262                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2263                         xxx=`./loc $file $file $pth`
2264                 fi
2265                 ;;
2266         '') xxx=`./loc $file $file $pth`;;
2267         *) xxx=`./loc $xxx $xxx $pth`;;
2268         esac
2269         eval $file=$xxx$_exe
2270         eval _$file=$xxx
2271         case "$xxx" in
2272         /*)
2273                 echo $file is in $xxx.
2274                 ;;
2275         ?:[\\/]*)
2276                 echo $file is in $xxx.
2277                 ;;
2278         *)
2279                 echo "I don't know where '$file' is, and my life depends on it." >&4
2280                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2281                 exit 1
2282                 ;;
2283         esac
2284 done
2285 echo " "
2286 echo "Don't worry if any of the following aren't found..."
2287 say=offhand
2288 for file in $trylist; do
2289         eval xxx=\$$file
2290         case "$xxx" in
2291         /*|?:[\\/]*)
2292                 if test -f "$xxx"; then
2293                         : ok
2294                 else
2295                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2296                         xxx=`./loc $file $file $pth`
2297                 fi
2298                 ;;
2299         '') xxx=`./loc $file $file $pth`;;
2300         *) xxx=`./loc $xxx $xxx $pth`;;
2301         esac
2302         eval $file=$xxx$_exe
2303         eval _$file=$xxx
2304         case "$xxx" in
2305         /*)
2306                 echo $file is in $xxx.
2307                 ;;
2308         ?:[\\/]*)
2309                 echo $file is in $xxx.
2310                 ;;
2311         *)
2312                 echo "I don't see $file out there, $say."
2313                 say=either
2314                 ;;
2315         esac
2316 done
2317 case "$egrep" in
2318 egrep)
2319         echo "Substituting grep for egrep."
2320         egrep=$grep
2321         _egrep=$grep
2322         ;;
2323 esac
2324 case "$ln" in
2325 ln)
2326         echo "Substituting cp for ln."
2327         ln=$cp
2328         _ln=$cp
2329         ;;
2330 esac
2331 case "$make" in
2332 make)   
2333         case "$gmake" in
2334         gmake)
2335         echo "I can't find make or gmake, and my life depends on it." >&4
2336         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2337         exit 1
2338         ;;
2339         esac
2340         ;;
2341 esac    
2342 case "$gmake" in
2343 gmake)  ;;
2344 *)      # We can't have osname yet.
2345         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2346                 # Assume that gmake, if found, is definitely GNU make
2347                 # and prefer it over the system make.
2348                 echo "Substituting gmake for make."
2349                 make=$gmake
2350                 _make=$gmake
2351         fi
2352         ;;
2353 esac
2354 case "$test" in
2355 test)
2356         echo "Hopefully test is built into your sh."
2357         ;;
2358 *)
2359         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2360                 echo "Using the test built into your sh."
2361                 test=test
2362                 _test=test
2363         fi
2364         ;;
2365 esac
2366 case "$echo" in
2367 echo)
2368         echo "Hopefully echo is built into your sh."
2369         ;;
2370 '') ;;
2371 *)
2372         echo " "
2373 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2374         $echo $n "hi there$c" >foo1
2375         echo $n "hi there$c" >foo2
2376         if cmp foo1 foo2 >/dev/null 2>&1; then
2377                 echo "They are compatible.  In fact, they may be identical."
2378         else
2379                 case "$n" in
2380                 '-n') n='' c='\c';;
2381                 *) n='-n' c='';;
2382                 esac
2383                 cat <<FOO
2384 They are not compatible!  You are probably running ksh on a non-USG system.
2385 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2386 have echo built in and we may have to run some Bourne shell scripts.  That
2387 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2388
2389 FOO
2390                 $echo $n "The star should be here-->$c"
2391                 $echo "*"
2392         fi
2393         $rm -f foo1 foo2
2394         ;;
2395 esac
2396
2397 cat <<EOS >trygcc
2398 $startsh
2399 EOS
2400 cat <<'EOSC' >>trygcc
2401 case "$cc" in
2402 '') ;;
2403 *)  $rm -f try try.*
2404     $cat >try.c <<EOM
2405 int main(int argc, char *argv[]) {
2406   return 0;
2407 }
2408 EOM
2409     if $cc -o try $ccflags $ldflags try.c; then
2410        :
2411     else
2412         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2413         despair=yes
2414         trygcc=yes
2415         case "$cc" in
2416         *gcc*) trygcc=no ;;
2417         esac
2418         case "`$cc -v -c try.c 2>&1`" in
2419         *gcc*) trygcc=no ;;
2420         esac
2421         if $test X"$trygcc" = Xyes; then
2422             if gcc -o try -c try.c; then
2423                 echo " "
2424                 echo "You seem to have a working gcc, though." >&4
2425                 rp="Would you like to use it?"
2426                 dflt=y
2427                 if $test -f myread; then
2428                     . ./myread
2429                 else
2430                     if $test -f UU/myread; then
2431                         . ./UU/myread
2432                     else
2433                         echo "Cannot find myread, sorry.  Aborting." >&2
2434                         exit 1
2435                     fi
2436                 fi  
2437                 case "$ans" in
2438                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2439                        if $test -f usethreads.cbu; then
2440                            $cat >&4 <<EOM 
2441
2442 *** However, any setting of the C compiler flags (e.g. for thread support)
2443 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2444 *** (together with e.g. -Dusethreads).
2445
2446 EOM
2447                        fi;;
2448                 esac
2449             fi
2450         fi
2451     fi
2452     $rm -f try try.*
2453     ;;
2454 esac
2455 EOSC
2456
2457 cat <<EOS >checkcc
2458 $startsh
2459 EOS
2460 cat <<'EOSC' >>checkcc
2461 case "$cc" in        
2462 '') ;;
2463 *)  $rm -f try try.*              
2464     $cat >try.c <<EOM
2465 int main(int argc, char *argv[]) {
2466   return 0;
2467 }
2468 EOM
2469     if $cc -o try $ccflags $ldflags try.c; then
2470        :
2471     else
2472         if $test X"$despair" = Xyes; then
2473            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2474         fi
2475         $cat >&4 <<EOM         
2476 You need to find a working C compiler.
2477 Either (purchase and) install the C compiler supplied by your OS vendor,
2478 or for a free C compiler try http://gcc.gnu.org/
2479 I cannot continue any further, aborting.
2480 EOM
2481         exit 1
2482     fi
2483     $rm -f try try.*
2484     ;;
2485 esac
2486 EOSC
2487
2488 : determine whether symbolic links are supported
2489 echo " "
2490 $touch blurfl
2491 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2492         echo "Symbolic links are supported." >&4
2493         lns="$ln -s"
2494 else
2495         echo "Symbolic links are NOT supported." >&4
2496         lns="$ln"
2497 fi
2498 $rm -f blurfl sym
2499
2500 : determine whether symbolic links are supported
2501 echo " "
2502 case "$lns" in
2503 *"ln"*" -s")
2504         echo "Checking how to test for symbolic links..." >&4
2505         $lns blurfl sym
2506         if $test "X$issymlink" = X; then
2507                 case "$newsh" in
2508                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2509                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2510                 esac
2511                 if test $? = 0; then
2512                         issymlink="test -h"
2513                 else
2514                         echo "Your builtin 'test -h' may be broken." >&4
2515                         case "$test" in
2516                         /*)     ;;
2517                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2518                                 for p in $pth
2519                                 do
2520                                         if test -f "$p/$test"; then
2521                                                 test="$p/$test"
2522                                                 break
2523                                         fi
2524                                 done
2525                                 ;;
2526                         esac
2527                         case "$test" in
2528                         /*)
2529                                 echo "Trying external '$test -h'." >&4
2530                                 issymlink="$test -h"
2531                                 if $test ! -h sym >/dev/null 2>&1; then
2532                                         echo "External '$test -h' is broken, too." >&4
2533                                         issymlink=''
2534                                 fi
2535                                 ;;
2536                         *)      issymlink='' ;;
2537                         esac
2538                 fi              
2539         fi
2540         if $test "X$issymlink" = X; then
2541                 if $test -L sym 2>/dev/null; then
2542                         issymlink="$test -L"
2543                         echo "The builtin '$test -L' worked." >&4
2544                 fi
2545         fi
2546         if $test "X$issymlink" != X; then
2547                 echo "You can test for symbolic links with '$issymlink'." >&4
2548         else
2549                 echo "I do not know how you can test for symbolic links." >&4
2550         fi
2551         $rm -f blurfl sym
2552         ;;
2553 *)      echo "No symbolic links, so not testing for their testing..." >&4
2554         ;;
2555 esac
2556 echo " "
2557
2558
2559 case "$mksymlinks" in
2560 $define|true|[yY]*)
2561         case "$src" in
2562         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2563                 exit 1
2564                 ;;
2565         *)      case "$lns:$issymlink" in
2566                 *"ln"*" -s:"*"test -"?)
2567                         echo "Creating the symbolic links..." >&4
2568                         echo "(First creating the subdirectories...)" >&4
2569                         cd ..
2570                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2571                                 read directory
2572                                 test -z "$directory" && break
2573                                 mkdir -p $directory
2574                         done
2575                         # Sanity check 1.
2576                         if test ! -d t/base; then
2577                                 echo "Failed to create the subdirectories.  Aborting." >&4
2578                                 exit 1
2579                         fi
2580                         echo "(Then creating the symlinks...)" >&4
2581                         awk '{print $1}' $src/MANIFEST | while true; do
2582                                 read filename
2583                                 test -z "$filename" && break
2584                                 if test -f $filename; then
2585                                         if $issymlink $filename; then
2586                                                 rm -f $filename
2587                                         fi
2588                                 fi
2589                                 if test -f $filename; then
2590                                         echo "$filename already exists, not symlinking."
2591                                 else
2592                                         ln -s $src/$filename $filename
2593                                 fi
2594                         done
2595                         # Sanity check 2.
2596                         if test ! -f t/base/lex.t; then
2597                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2598                                 exit 1
2599                         fi
2600                         cd UU
2601                         ;;
2602                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2603                         ;;
2604                 esac
2605                 ;;
2606         esac
2607         ;;
2608 esac
2609
2610
2611 case "$usecrosscompile" in
2612 $define|true|[yY]*)
2613         $echo "Cross-compiling..."
2614         croak=''
2615         case "$cc" in
2616         *-*-gcc) # A cross-compiling gcc, probably.
2617             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2618             ar=$targetarch-ar
2619             # leave out ld, choosing it is more complex
2620             nm=$targetarch-nm
2621             ranlib=$targetarch-ranlib
2622             $echo 'extern int foo;' > try.c
2623             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2624             shift
2625             if $test $# -gt 0; then
2626                 incpth="$incpth $*"
2627                 incpth="`$echo $incpth|$sed 's/^ //'`"
2628                 echo "Guessing incpth '$incpth'." >&4
2629                 for i in $*; do
2630                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2631                     if $test -d $j; then
2632                         libpth="$libpth $j"
2633                     fi
2634                 done   
2635                 libpth="`$echo $libpth|$sed 's/^ //'`"
2636                 echo "Guessing libpth '$libpth'." >&4
2637             fi
2638             $rm -f try.c
2639             ;;
2640         esac
2641         case "$targetarch" in
2642         '') echo "Targetarch not defined." >&4; croak=y ;;
2643         *)  echo "Using targetarch $targetarch." >&4 ;;
2644         esac
2645         case "$incpth" in
2646         '') echo "Incpth not defined." >&4; croak=y ;;
2647         *)  echo "Using incpth '$incpth'." >&4 ;;
2648         esac
2649         case "$libpth" in
2650         '') echo "Libpth not defined." >&4; croak=y ;;
2651         *)  echo "Using libpth '$libpth'." >&4 ;;
2652         esac
2653         case "$usrinc" in
2654         '') for i in $incpth; do
2655                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2656                     usrinc=$i
2657                     echo "Guessing usrinc $usrinc." >&4
2658                     break
2659                 fi
2660             done
2661             case "$usrinc" in
2662             '') echo "Usrinc not defined." >&4; croak=y ;;
2663             esac
2664             ;;
2665         *)  echo "Using usrinc $usrinc." >&4 ;;
2666         esac
2667         case "$targethost" in
2668         '') echo "Targethost not defined." >&4; croak=y ;;
2669         *)  echo "Using targethost $targethost." >&4
2670         esac
2671         locincpth=' '
2672         loclibpth=' '
2673         case "$croak" in
2674         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2675         esac
2676         case "$src" in
2677         /*) run=$src/Cross/run
2678             targetmkdir=$src/Cross/mkdir
2679             to=$src/Cross/to
2680             from=$src/Cross/from
2681             ;;
2682         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2683             run=$pwd/Cross/run
2684             targetmkdir=$pwd/Cross/mkdir
2685             to=$pwd/Cross/to
2686             from=$pwd/Cross/from
2687             ;;
2688         esac
2689         case "$targetrun" in
2690         '') targetrun=ssh ;;
2691         esac
2692         case "$targetto" in
2693         '') targetto=scp ;;
2694         esac
2695         case "$targetfrom" in
2696         '') targetfrom=scp ;;
2697         esac
2698         run=$run-$targetrun
2699         to=$to-$targetto
2700         from=$from-$targetfrom
2701         case "$targetdir" in
2702         '')  targetdir=/tmp
2703              echo "Guessing targetdir $targetdir." >&4
2704              ;;
2705         esac
2706         case "$targetuser" in
2707         '')  targetuser=root
2708              echo "Guessing targetuser $targetuser." >&4
2709              ;;
2710         esac
2711         case "$targetfrom" in
2712         scp)    q=-q ;;
2713         *)      q='' ;;
2714         esac
2715         case "$targetrun" in
2716         ssh|rsh)
2717             cat >$run <<EOF
2718 #!/bin/sh
2719 case "\$1" in
2720 -cwd)
2721   shift
2722   cwd=\$1
2723   shift
2724   ;;
2725 esac
2726 case "\$cwd" in
2727 '') cwd=$targetdir ;;
2728 esac
2729 exe=\$1
2730 shift
2731 if $test ! -f \$exe.xok; then
2732   $to \$exe
2733   $touch \$exe.xok
2734 fi
2735 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2736 EOF
2737             ;;
2738         *)  echo "Unknown targetrun '$targetrun'" >&4
2739             exit 1
2740             ;;
2741         esac
2742         case "$targetmkdir" in
2743         */Cross/mkdir)
2744             cat >$targetmkdir <<EOF
2745 #!/bin/sh
2746 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2747 EOF
2748             $chmod a+rx $targetmkdir
2749             ;;
2750         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2751             exit 1
2752             ;;
2753         esac
2754         case "$targetto" in
2755         scp|rcp)
2756             cat >$to <<EOF
2757 #!/bin/sh
2758 for f in \$@
2759 do
2760   case "\$f" in
2761   /*)
2762     $targetmkdir \`dirname \$f\`
2763     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2764     ;;
2765   *)
2766     $targetmkdir $targetdir/\`dirname \$f\`
2767     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2768     ;;
2769   esac
2770 done
2771 exit 0
2772 EOF
2773             ;;
2774         cp) cat >$to <<EOF
2775 #!/bin/sh
2776 for f in \$@
2777 do
2778   case "\$f" in
2779   /*)
2780     $mkdir -p $targetdir/\`dirname \$f\`
2781     $cp \$f $targetdir/\$f || exit 1
2782     ;;
2783   *)
2784     $targetmkdir $targetdir/\`dirname \$f\`
2785     $cp \$f $targetdir/\$f || exit 1
2786     ;;
2787   esac
2788 done
2789 exit 0
2790 EOF
2791             ;;
2792         *)  echo "Unknown targetto '$targetto'" >&4
2793             exit 1
2794             ;;
2795         esac
2796         case "$targetfrom" in
2797         scp|rcp)
2798           cat >$from <<EOF
2799 #!/bin/sh
2800 for f in \$@
2801 do
2802   $rm -f \$f
2803   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2804 done
2805 exit 0
2806 EOF
2807             ;;
2808         cp) cat >$from <<EOF
2809 #!/bin/sh
2810 for f in \$@
2811 do
2812   $rm -f \$f
2813   cp $targetdir/\$f . || exit 1
2814 done
2815 exit 0
2816 EOF
2817             ;;
2818         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2819             exit 1
2820             ;;
2821         esac
2822         if $test ! -f $run; then
2823             echo "Target 'run' script '$run' not found." >&4
2824         else
2825             $chmod a+rx $run
2826         fi
2827         if $test ! -f $to; then
2828             echo "Target 'to' script '$to' not found." >&4
2829         else
2830             $chmod a+rx $to
2831         fi
2832         if $test ! -f $from; then
2833             echo "Target 'from' script '$from' not found." >&4
2834         else
2835             $chmod a+rx $from
2836         fi
2837         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2838             exit 1
2839         fi
2840         cat >&4 <<EOF
2841 Using '$run' for remote execution,
2842 and '$from' and '$to'
2843 for remote file transfer.
2844 EOF
2845         ;;
2846 *)      run=''
2847         to=:
2848         from=:
2849         usecrosscompile='undef'
2850         targetarch=''
2851         ;;
2852 esac
2853
2854 : see whether [:lower:] and [:upper:] are supported character classes
2855 echo " "
2856 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2857 ABYZ)
2858         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2859         up='[:upper:]'
2860         low='[:lower:]'
2861         ;;
2862 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2863         # (0xc9 and 0xd1), therefore that is a nice testing point.
2864         if test "X$up" = X -o "X$low" = X; then
2865             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2866             ij) up='[A-Z]'
2867                 low='[a-z]'
2868                 ;;
2869             esac
2870         fi
2871         if test "X$up" = X -o "X$low" = X; then
2872             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2873             ij) up='A-Z'
2874                 low='a-z'
2875                 ;;
2876             esac
2877         fi
2878         if test "X$up" = X -o "X$low" = X; then
2879             case "`echo IJ | od -x 2>/dev/null`" in
2880             *C9D1*|*c9d1*)
2881                 echo "Hey, this might be EBCDIC." >&4
2882                 if test "X$up" = X -o "X$low" = X; then
2883                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2884                     ij) up='[A-IJ-RS-Z]'
2885                         low='[a-ij-rs-z]'
2886                         ;;
2887                     esac
2888                 fi
2889                 if test "X$up" = X -o "X$low" = X; then
2890                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2891                     ij) up='A-IJ-RS-Z'
2892                         low='a-ij-rs-z'
2893                         ;;
2894                     esac
2895                 fi
2896                 ;;
2897             esac
2898         fi
2899 esac
2900 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2901 ij)
2902     echo "Using $up and $low to convert case." >&4
2903     ;;
2904 *)
2905     echo "I don't know how to translate letters from upper to lower case." >&4
2906     echo "Your tr is not acting any way I know of." >&4
2907     exit 1
2908     ;;
2909 esac
2910 : set up the translation script tr, must be called with ./tr of course
2911 cat >tr <<EOSC
2912 $startsh
2913 case "\$1\$2" in
2914 '[A-Z][a-z]') exec $tr '$up' '$low';;
2915 '[a-z][A-Z]') exec $tr '$low' '$up';;
2916 esac
2917 exec $tr "\$@"
2918 EOSC
2919 chmod +x tr
2920 $eunicefix tr
2921
2922 : Try to determine whether config.sh was made on this system
2923 case "$config_sh" in
2924 '')
2925 myuname=`$uname -a 2>/dev/null`
2926 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2927 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2928 # because the A-Z/a-z are not consecutive.
2929 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2930         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2931 newmyuname="$myuname"
2932 dflt=n
2933 case "$knowitall" in
2934 '')
2935         if test -f ../config.sh; then
2936                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2937                         eval "`grep myuname= ../config.sh`"
2938                 fi
2939                 if test "X$myuname" = "X$newmyuname"; then
2940                         dflt=y
2941                 fi
2942         fi
2943         ;;
2944 *) dflt=y;;
2945 esac
2946
2947 : Get old answers from old config file if Configure was run on the
2948 : same system, otherwise use the hints.
2949 hint=default
2950 cd ..
2951 if test -f config.sh; then
2952         echo " "
2953         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2954         . UU/myread
2955         case "$ans" in
2956         n*|N*) echo "OK, I'll ignore it."
2957                 mv config.sh config.sh.old
2958                 myuname="$newmyuname"
2959                 ;;
2960         *)  echo "Fetching default answers from your old config.sh file..." >&4
2961                 tmp_n="$n"
2962                 tmp_c="$c"
2963                 tmp_sh="$sh"
2964                 . ./config.sh
2965                 cp config.sh UU
2966                 n="$tmp_n"
2967                 c="$tmp_c"
2968                 : Older versions did not always set $sh.  Catch re-use of such
2969                 : an old config.sh.
2970                 case "$sh" in
2971                 '') sh="$tmp_sh" ;;
2972                 esac
2973                 hint=previous
2974                 ;;
2975         esac
2976 fi
2977 . ./UU/checkcc
2978 if test ! -f config.sh; then
2979         $cat <<EOM
2980
2981 First time through, eh?  I have some defaults handy for some systems
2982 that need some extra help getting the Configure answers right:
2983
2984 EOM
2985         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2986         dflt=''
2987         : Half the following guesses are probably wrong... If you have better
2988         : tests or hints, please send them to perlbug@perl.org
2989         : The metaconfig authors would also appreciate a copy...
2990         $test -f /irix && osname=irix
2991         $test -f /xenix && osname=sco_xenix
2992         $test -f /dynix && osname=dynix
2993         $test -f /dnix && osname=dnix
2994         $test -f /lynx.os && osname=lynxos
2995         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2996         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2997         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2998         $test -f /bin/mips && /bin/mips && osname=mips
2999         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3000                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3001         $test -d /usr/apollo/bin && osname=apollo
3002         $test -f /etc/saf/_sactab && osname=svr4
3003         $test -d /usr/include/minix && osname=minix
3004         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3005         if $test -d /MachTen -o -d /MachTen_Folder; then
3006                 osname=machten
3007                 if $test -x /sbin/version; then
3008                         osvers=`/sbin/version | $awk '{print $2}' |
3009                         $sed -e 's/[A-Za-z]$//'`
3010                 elif $test -x /usr/etc/version; then
3011                         osvers=`/usr/etc/version | $awk '{print $2}' |
3012                         $sed -e 's/[A-Za-z]$//'`
3013                 else
3014                         osvers="$2.$3"
3015                 fi
3016         fi
3017
3018         $test -f /sys/posix.dll &&
3019                 $test -f /usr/bin/what &&
3020                 set X `/usr/bin/what /sys/posix.dll` &&
3021                 $test "$3" = UWIN &&
3022                 osname=uwin &&
3023                 osvers="$5"
3024
3025         if $test -f $uname; then
3026                 set X $myuname
3027                 shift
3028
3029                 case "$5" in
3030                 fps*) osname=fps ;;
3031                 mips*)
3032                         case "$4" in
3033                         umips) osname=umips ;;
3034                         *) osname=mips ;;
3035                         esac;;
3036                 [23]100) osname=mips ;;
3037                 next*) osname=next ;;
3038                 i386*)
3039                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3040                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3041                                 osname='sco'
3042                                 osvers=$tmp
3043                         elif $test -f /etc/kconfig; then
3044                                 osname=isc
3045                                 if test "$lns" = "$ln -s"; then
3046                                         osvers=4
3047                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3048                                         osvers=3
3049                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3050                                         osvers=2
3051                                 fi
3052                         fi
3053                         tmp=''
3054                         ;;
3055                 pc*)
3056                         if test -n "$DJGPP"; then
3057                                 osname=dos
3058                                 osvers=djgpp
3059                         fi
3060                         ;;
3061                 esac
3062
3063                 case "$1" in
3064                 aix) osname=aix
3065                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3066                         case "$tmp" in
3067                         'not found') osvers="$4"."$3" ;;
3068                         '<3240'|'<>3240') osvers=3.2.0 ;;
3069                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3070                         '=3250'|'>3250') osvers=3.2.5 ;;
3071                         *) osvers=$tmp;;
3072                         esac
3073                         ;;
3074                 bsd386) osname=bsd386
3075                         osvers=`$uname -r`
3076                         ;;
3077                 cygwin*) osname=cygwin
3078                         osvers="$3"
3079                         ;;
3080                 *dc.osx) osname=dcosx
3081                         osvers="$3"
3082                         ;;
3083                 dnix) osname=dnix
3084                         osvers="$3"
3085                         ;;
3086                 domainos) osname=apollo
3087                         osvers="$3"
3088                         ;;
3089                 dgux) osname=dgux 
3090                         osvers="$3"
3091                         ;;
3092                 dynixptx*) osname=dynixptx
3093                         osvers=`echo "$4"|sed 's/^v//'`
3094                         ;;
3095                 freebsd) osname=freebsd 
3096                         osvers="$3" ;;
3097                 genix) osname=genix ;;
3098                 hp*) osname=hpux 
3099                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3100                         ;;
3101                 irix*) osname=irix
3102                         case "$3" in
3103                         4*) osvers=4 ;;
3104                         5*) osvers=5 ;;
3105                         *)      osvers="$3" ;;
3106                         esac
3107                         ;;
3108                 linux) osname=linux
3109                         case "$3" in
3110                         *)      osvers="$3" ;;
3111                         esac
3112                         ;;
3113                 MiNT) osname=mint
3114                         ;;
3115                 netbsd*) osname=netbsd
3116                         osvers="$3"
3117                         ;;
3118                 news-os) osvers="$3"
3119                         case "$3" in
3120                         4*) osname=newsos4 ;;
3121                         *) osname=newsos ;;
3122                         esac
3123                         ;;
3124                 next*) osname=next ;;
3125                 nonstop-ux) osname=nonstopux ;;
3126                 openbsd) osname=openbsd
3127                         osvers="$3"
3128                         ;;
3129                 POSIX-BC | posix-bc ) osname=posix-bc
3130                         osvers="$3"
3131                         ;;
3132                 powerux | power_ux | powermax_os | powermaxos | \
3133                 powerunix | power_unix) osname=powerux
3134                         osvers="$3"
3135                         ;;
3136                 qnx) osname=qnx
3137                         osvers="$4"
3138                         ;;
3139                 solaris) osname=solaris
3140                         case "$3" in
3141                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3142                         *)      osvers="$3" ;;
3143                         esac
3144                         ;;
3145                 sunos) osname=sunos
3146                         case "$3" in
3147                         5*) osname=solaris
3148                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3149                         *)      osvers="$3" ;;
3150                         esac
3151                         ;;
3152                 titanos) osname=titanos
3153                         case "$3" in
3154                         1*) osvers=1 ;;
3155                         2*) osvers=2 ;;
3156                         3*) osvers=3 ;;
3157                         4*) osvers=4 ;;
3158                         *)      osvers="$3" ;;
3159                         esac
3160                         ;;
3161                 ultrix) osname=ultrix
3162                         osvers="$3"
3163                         ;;
3164                 osf1|mls+)      case "$5" in
3165                                 alpha)
3166                                         osname=dec_osf
3167                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3168                                         case "$osvers" in
3169                                         [1-9].[0-9]*) ;;
3170                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3171                                         esac
3172                                         ;;
3173                         hp*)    osname=hp_osf1  ;;
3174                         mips)   osname=mips_osf1 ;;
3175                         esac
3176                         ;;
3177                 unixware) osname=svr5
3178                         osvers="$4"
3179                         ;;
3180                 uts)    osname=uts
3181                         osvers="$3"
3182                         ;;
3183                 vos) osvers="$3"
3184                         ;;
3185                 $2) case "$osname" in
3186                         *isc*) ;;
3187                         *freebsd*) ;;
3188                         svr*)
3189                                 : svr4.x or possibly later
3190                                 case "svr$3" in 
3191                                 ${osname}*)
3192                                         osname=svr$3
3193                                         osvers=$4
3194                                         ;;
3195                                 esac
3196                                 case "$osname" in
3197                                 svr4.0)
3198                                         : Check for ESIX
3199                                         if test -f /stand/boot ; then
3200                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3201                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3202                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3203                                                         if test -n "$isesix"; then
3204                                                                 osname=esix4
3205                                                         fi
3206                                                 fi
3207                                         fi
3208                                         ;;
3209                                 esac
3210                                 ;;
3211                         *)      if test -f /etc/systemid; then
3212                                         osname=sco
3213                                         set `echo $3 | $sed 's/\./ /g'` $4
3214                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3215                                                 osvers=$1.$2.$3
3216                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3217                                                 osvers=$1.$2
3218                                         elif $test -f $src/hints/sco_$1.sh; then
3219                                                 osvers=$1
3220                                         fi
3221                                 else
3222                                         case "$osname" in
3223                                         '') : Still unknown.  Probably a generic Sys V.
3224                                                 osname="sysv"
3225                                                 osvers="$3"
3226                                                 ;;
3227                                         esac
3228                                 fi
3229                                 ;;
3230                         esac
3231                         ;;
3232                 *)      case "$osname" in
3233                         '') : Still unknown.  Probably a generic BSD.
3234                                 osname="$1"
3235                                 osvers="$3"
3236                                 ;;
3237                         esac
3238                         ;;
3239                 esac
3240         else
3241                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3242                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3243                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3244                                 osname=news_os
3245                         fi
3246                         $rm -f UU/kernel.what
3247                 elif test -d c:/.; then
3248                         set X $myuname
3249                         osname=os2
3250                         osvers="$5"
3251                 fi
3252         fi
3253         
3254         case "$targetarch" in
3255         '') ;;
3256         *)  hostarch=$osname
3257             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3258             osvers=''
3259             ;;
3260         esac
3261
3262         : Now look for a hint file osname_osvers, unless one has been
3263         : specified already.
3264         case "$hintfile" in
3265         ''|' ')
3266                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3267                 : Also try without trailing minor version numbers.
3268                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3269                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3270                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3271                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3272                 case "$file" in
3273                 '') dflt=none ;;
3274                 *)  case "$osvers" in
3275                         '') dflt=$file
3276                                 ;;
3277                         *)  if $test -f $src/hints/$file.sh ; then
3278                                         dflt=$file
3279                                 elif $test -f $src/hints/$xfile.sh ; then
3280                                         dflt=$xfile
3281                                 elif $test -f $src/hints/$xxfile.sh ; then
3282                                         dflt=$xxfile
3283                                 elif $test -f $src/hints/$xxxfile.sh ; then
3284                                         dflt=$xxxfile
3285                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3286                                         dflt=$xxxxfile
3287                                 elif $test -f "$src/hints/${osname}.sh" ; then
3288                                         dflt="${osname}"
3289                                 else
3290                                         dflt=none
3291                                 fi
3292                                 ;;
3293                         esac
3294                         ;;
3295                 esac
3296                 if $test -f Policy.sh ; then
3297                         case "$dflt" in
3298                         *Policy*) ;;
3299                         none) dflt="Policy" ;;
3300                         *) dflt="Policy $dflt" ;;
3301                         esac
3302                 fi
3303                 ;;
3304         *)
3305                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3306                 ;;
3307         esac
3308
3309         if $test -f Policy.sh ; then
3310                 $cat <<EOM
3311
3312 There's also a Policy hint file available, which should make the
3313 site-specific (policy) questions easier to answer.
3314 EOM
3315
3316         fi
3317
3318         $cat <<EOM
3319
3320 You may give one or more space-separated answers, or "none" if appropriate.
3321 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3322 is a good thing.  DO NOT give a wrong version or a wrong OS.
3323
3324 EOM
3325
3326         rp="Which of these apply, if any?"
3327         . UU/myread
3328         tans=$ans
3329         for file in $tans; do
3330                 if $test X$file = XPolicy -a -f Policy.sh; then
3331                         . Policy.sh
3332                         $cat Policy.sh >> UU/config.sh
3333                 elif $test -f $src/hints/$file.sh; then
3334                         . $src/hints/$file.sh
3335                         $cat $src/hints/$file.sh >> UU/config.sh
3336                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3337                         : nothing
3338                 else
3339                         : Give one chance to correct a possible typo.
3340                         echo "$file.sh does not exist"
3341                         dflt=$file
3342                         rp="hint to use instead?"
3343                         . UU/myread
3344                         for file in $ans; do
3345                                 if $test -f "$src/hints/$file.sh"; then
3346                                         . $src/hints/$file.sh
3347                                         $cat $src/hints/$file.sh >> UU/config.sh
3348                                 elif $test X$ans = X -o X$ans = Xnone ; then
3349                                         : nothing
3350                                 else
3351                                         echo "$file.sh does not exist -- ignored."
3352                                 fi
3353                         done
3354                 fi
3355         done
3356
3357         hint=recommended
3358         : Remember our hint file for later.
3359         if $test -f "$src/hints/$file.sh" ; then
3360                 hintfile="$file"
3361         else
3362                 hintfile=''
3363         fi
3364 fi
3365 cd UU
3366 ;;
3367 *)
3368         echo " "
3369         echo "Fetching default answers from $config_sh..." >&4
3370         tmp_n="$n"
3371         tmp_c="$c"
3372         cd ..
3373         cp $config_sh config.sh 2>/dev/null
3374         chmod +w config.sh
3375         . ./config.sh
3376         cd UU
3377         cp ../config.sh .
3378         n="$tmp_n"
3379         c="$tmp_c"
3380         hint=previous
3381         ;;
3382 esac
3383 test "$override" && . ./optdef.sh
3384
3385 : Restore computed paths
3386 for file in $loclist $trylist; do
3387         eval $file="\$_$file"
3388 done
3389
3390 cat << EOM
3391
3392 Configure uses the operating system name and version to set some defaults.
3393 The default value is probably right if the name rings a bell. Otherwise,
3394 since spelling matters for me, either accept the default or answer "none"
3395 to leave it blank.
3396
3397 EOM
3398 case "$osname" in
3399         ''|' ')
3400                 case "$hintfile" in
3401                 ''|' '|none) dflt=none ;;
3402                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3403                 esac
3404                 ;;
3405         *) dflt="$osname" ;;
3406 esac
3407 rp="Operating system name?"
3408 . ./myread
3409 case "$ans" in
3410 none)  osname='' ;;
3411 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3412 esac
3413 echo " "
3414 case "$osvers" in
3415         ''|' ')
3416                 case "$hintfile" in
3417                 ''|' '|none) dflt=none ;;
3418                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3419                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3420                         case "$dflt" in
3421                         ''|' ') dflt=none ;;
3422                         esac
3423                         ;;
3424                 esac
3425                 ;;
3426         *) dflt="$osvers" ;;
3427 esac
3428 rp="Operating system version?"
3429 . ./myread
3430 case "$ans" in
3431 none)  osvers='' ;;
3432 *) osvers="$ans" ;;
3433 esac
3434
3435
3436 . ./posthint.sh
3437
3438 : who configured the system
3439 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3440 cf_by=`(logname) 2>/dev/null`
3441 case "$cf_by" in
3442 "")
3443         cf_by=`(whoami) 2>/dev/null`
3444         case "$cf_by" in
3445         "") cf_by=unknown ;;
3446         esac ;;
3447 esac
3448
3449 : set up the script used to warn in case of inconsistency
3450 cat <<EOS >whoa
3451 $startsh
3452 EOS
3453 cat <<'EOSC' >>whoa
3454 dflt=y
3455 echo " "
3456 echo "*** WHOA THERE!!! ***" >&4
3457 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3458 rp="    Keep the $hint value?"
3459 . ./myread
3460 case "$ans" in
3461 y) td=$was; tu=$was;;
3462 esac
3463 EOSC
3464
3465 : function used to set $1 to $val
3466 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3467 case "$val$was" in
3468 $define$undef) . ./whoa; eval "$var=\$td";;
3469 $undef$define) . ./whoa; eval "$var=\$tu";;
3470 *) eval "$var=$val";;
3471 esac'
3472
3473 case "$usesocks" in
3474 $define|true|[yY]*)     dflt='y';;
3475 *) dflt='n';;
3476 esac
3477 cat <<EOM
3478
3479 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3480 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3481 to use the PerlIO abstraction layer, this will be implicitly selected.
3482
3483 If this doesn't make any sense to you, just accept the default '$dflt'.
3484 EOM
3485 rp='Build Perl for SOCKS?'
3486 . ./myread
3487 case "$ans" in
3488 y|Y)    val="$define" ;;     
3489 *)      val="$undef" ;;
3490 esac
3491 set usesocks
3492 eval $setvar
3493
3494 case "$usesocks" in
3495 $define|true|[yY]*) useperlio="$define";;
3496 esac
3497
3498 case "$useperlio" in
3499 $define|true|[yY]*|'')  dflt='y';;
3500 *) dflt='n';;
3501 esac
3502 cat <<EOM
3503
3504 Previous version of $package used the standard IO mechanisms as
3505 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3506 alternate IO mechanisms via the PerlIO abstraction layer, but the
3507 stdio mechanism is still available if needed.  The abstraction layer
3508 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3509 Using PerlIO with sfio may cause problems with some extension modules.
3510
3511 If this doesn't make any sense to you, just accept the default '$dflt'.
3512 EOM
3513 rp='Use the PerlIO abstraction layer?'
3514 . ./myread
3515 case "$ans" in
3516 y|Y) 
3517         val="$define"
3518         ;;
3519 *)      
3520         echo "Ok, doing things the stdio way."
3521         val="$undef"
3522         ;;
3523 esac
3524 set useperlio
3525 eval $setvar 
3526
3527 case "$usesocks" in
3528 $define|true|[yY]*)
3529         case "$useperlio" in
3530         $define|true|[yY]*) ;;
3531         *)      cat >&4 <<EOM
3532
3533 You are using the SOCKS proxy protocol library which means that you
3534 should also use the PerlIO layer.  You may be headed for trouble.
3535
3536 EOM
3537                 ;;
3538         esac
3539         ;;
3540 esac
3541
3542         
3543 case "$usethreads" in
3544 $define|true|[yY]*)     dflt='y';;
3545 *)     # Catch case where user specified ithreads or 5005threads but
3546        # forgot -Dusethreads (A.D. 4/2002)
3547        case "$useithreads$use5005threads" in
3548        *$define*)      
3549                 case "$useperlio" in
3550                 "$define")      dflt='y' ;;
3551                 *)              dflt='n' ;;
3552                 esac
3553                 ;;
3554        *)       dflt='n';;
3555        esac
3556        ;;
3557 esac
3558 cat <<EOM
3559
3560 Perl can be built to take advantage of threads on some systems.
3561 To do so, Configure can be run with -Dusethreads.
3562
3563 Note that Perl built with threading support runs slightly slower
3564 and uses more memory than plain Perl. The current implementation
3565 is believed to be stable, but it is fairly new, and so should be
3566 treated with caution.
3567
3568 If this doesn't make any sense to you, just accept the default '$dflt'.
3569 EOM
3570 rp='Build a threading Perl?'
3571 . ./myread
3572 case "$ans" in
3573 y|Y)    val="$define" ;;
3574 *)      val="$undef" ;;
3575 esac
3576 set usethreads
3577 eval $setvar
3578
3579 case "$usethreads" in
3580 $define)
3581         $cat <<EOM
3582
3583 Since release 5.6, Perl has had two different threading implementations,
3584 the newer interpreter-based version (ithreads) with one interpreter per
3585 thread, and the older 5.005 version (5005threads).
3586 The 5005threads version is effectively unmaintained and will probably be
3587 removed in Perl 5.10, so there should be no need to build a Perl using it
3588 unless needed for backwards compatibility with some existing 5.005threads
3589 code.
3590
3591 EOM
3592         : Default to ithreads unless overridden on command line or with
3593         : old config.sh
3594         dflt='y'
3595         case "$use5005threads" in
3596                 $define|true|[yY]*) dflt='n';;
3597         esac
3598         case "$useithreads" in
3599                 $undef|false|[nN]*) dflt='n';;
3600         esac
3601         rp='Use the newer interpreter-based ithreads?'
3602         . ./myread
3603         case "$ans" in
3604         y|Y)    val="$define" ;;
3605         *)      val="$undef" ;;
3606         esac
3607         set useithreads
3608         eval $setvar
3609         : Now set use5005threads to the opposite value.
3610         case "$useithreads" in
3611         $define) val="$undef" ;;
3612         *) val="$define" ;;
3613         esac
3614         set use5005threads
3615         eval $setvar
3616         ;;
3617 *)
3618         useithreads="$undef"
3619         use5005threads="$undef"
3620         ;;
3621 esac
3622
3623 case "$useithreads$use5005threads" in
3624 "$define$define")
3625         $cat >&4 <<EOM
3626
3627 You cannot have both the ithreads and the 5.005 threads enabled
3628 at the same time.  Disabling the 5.005 threads since they are
3629 much less stable than the ithreads.
3630
3631 EOM
3632         use5005threads="$undef"
3633         ;;
3634 esac
3635
3636 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3637         cat >&4 <<EOF
3638 ***
3639 *** To build with ithreads you must also use the PerlIO layer.
3640 *** Cannot continue, aborting.
3641 ***
3642 EOF
3643         exit 1
3644 fi
3645
3646 case "$d_oldpthreads" in
3647 '')     : Configure tests would be welcome here.  For now, assume undef.
3648         val="$undef" ;;
3649 *)      val="$d_oldpthreads" ;;
3650 esac
3651 set d_oldpthreads
3652 eval $setvar
3653
3654
3655 case "$usethreads" in
3656 "$define"|true|[yY]*)
3657 : Look for a hint-file generated 'call-back-unit'.  If the
3658 : user has specified that a threading perl is to be built,
3659 : we may need to set or change some other defaults.
3660         if $test -f usethreads.cbu; then
3661                 echo "Your platform has some specific hints for threaded builds, using them..."
3662                 . ./usethreads.cbu
3663         else
3664                 $cat <<EOM
3665 (Your platform doesn't have any specific hints for threaded builds.
3666  Assuming POSIX threads, then.)
3667 EOM
3668         fi
3669         ;;
3670 esac
3671
3672 cat <<EOM
3673
3674 Perl can be built so that multiple Perl interpreters can coexist
3675 within the same Perl executable.
3676 EOM
3677
3678 case "$useithreads" in
3679 $define)
3680         cat <<EOM
3681 This multiple interpreter support is required for interpreter-based threads.
3682 EOM
3683         val="$define"
3684         ;;
3685 *)      case "$usemultiplicity" in
3686         $define|true|[yY]*)     dflt='y';;
3687         *) dflt='n';;
3688         esac
3689         echo " "
3690         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3691         rp='Build Perl for multiplicity?'
3692         . ./myread
3693         case "$ans" in
3694         y|Y)    val="$define" ;;
3695         *)      val="$undef" ;;
3696         esac
3697         ;;
3698 esac
3699 set usemultiplicity
3700 eval $setvar
3701
3702
3703 case "$usemorebits" in
3704 "$define"|true|[yY]*)
3705         use64bitint="$define"
3706         uselongdouble="$define"
3707         usemorebits="$define"
3708         ;;
3709 *)      usemorebits="$undef"
3710         ;;
3711 esac
3712
3713 : make some quick guesses about what we are up against
3714 echo " "
3715 $echo $n "Hmm...  $c"
3716 echo exit 1 >bsd
3717 echo exit 1 >usg
3718 echo exit 1 >v7
3719 echo exit 1 >osf1
3720 echo exit 1 >eunice
3721 echo exit 1 >xenix
3722 echo exit 1 >venix
3723 echo exit 1 >os2
3724 d_bsd="$undef"
3725 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3726 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3727 then
3728         echo "Looks kind of like an OSF/1 system, but we'll see..."
3729         echo exit 0 >osf1
3730 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3731         xxx=`./loc addbib blurfl $pth`
3732         if $test -f $xxx; then
3733         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3734                 echo exit 0 >bsd
3735                 echo exit 0 >usg
3736         else
3737                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3738                         echo "Looks kind of like an extended USG system, but we'll see..."
3739                 else
3740                         echo "Looks kind of like a USG system, but we'll see..."
3741                 fi
3742                 echo exit 0 >usg
3743         fi
3744 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3745         echo "Looks kind of like a BSD system, but we'll see..."
3746         d_bsd="$define"
3747         echo exit 0 >bsd
3748 else
3749         echo "Looks kind of like a Version 7 system, but we'll see..."
3750         echo exit 0 >v7
3751 fi
3752 case "$eunicefix" in
3753 *unixtovms*)
3754         $cat <<'EOI'
3755 There is, however, a strange, musty smell in the air that reminds me of
3756 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3757 EOI
3758         echo exit 0 >eunice
3759         d_eunice="$define"
3760 : it so happens the Eunice I know will not run shell scripts in Unix format
3761         ;;
3762 *)
3763         echo " "
3764         echo "Congratulations.  You aren't running Eunice."
3765         d_eunice="$undef"
3766         ;;
3767 esac
3768 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3769 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3770 : semicolon as a patch separator
3771 case "$p_" in
3772 :) ;;
3773 *)
3774         $cat <<'EOI'
3775 I have the feeling something is not exactly right, however...don't tell me...
3776 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3777 (Or you may be running DOS with DJGPP.)
3778 EOI
3779         echo exit 0 >os2
3780         ;;
3781 esac
3782 if test -f /xenix; then
3783         echo "Actually, this looks more like a XENIX system..."
3784         echo exit 0 >xenix
3785         d_xenix="$define"
3786 else
3787         echo " "
3788         echo "It's not Xenix..."
3789         d_xenix="$undef"
3790 fi
3791 chmod +x xenix
3792 $eunicefix xenix
3793 if test -f /venix; then
3794         echo "Actually, this looks more like a VENIX system..."
3795         echo exit 0 >venix
3796 else
3797         echo " "
3798         if ./xenix; then
3799                 : null
3800         else
3801                 echo "Nor is it Venix..."
3802         fi
3803 fi
3804 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3805 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3806 $rm -f foo
3807
3808 case "$cc" in
3809 '') dflt=cc;;
3810 *) dflt="$cc";;
3811 esac
3812 rp="Use which C compiler?"
3813 . ./myread
3814 cc="$ans"
3815
3816 : See if they have not cc but they do have gcc
3817 . ./trygcc
3818 : Look for a hint-file generated 'call-back-unit'.  Now that the
3819 : user has specified the compiler, we may need to set or change some
3820 : other defaults.
3821 if $test -f cc.cbu; then
3822     . ./cc.cbu
3823 fi
3824 . ./checkcc
3825
3826 echo " "
3827 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3828 $cat >try.c <<EOM
3829 #include <stdio.h>
3830 int main() {
3831 #ifdef __GNUC__
3832 #ifdef __VERSION__
3833         printf("%s\n", __VERSION__);
3834 #else
3835         printf("%s\n", "1");
3836 #endif
3837 #endif
3838         exit(0);
3839 }
3840 EOM
3841 if $cc -o try $ccflags $ldflags try.c; then
3842         gccversion=`$run ./try`
3843         case "$gccversion" in
3844         '') echo "You are not using GNU cc." ;;
3845         *)  echo "You are using GNU cc $gccversion."
3846             ccname=gcc
3847             ;;
3848         esac
3849 else
3850         echo " "
3851         echo "*** WHOA THERE!!! ***" >&4
3852         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3853         case "$knowitall" in
3854         '')
3855         echo "    You'd better start hunting for one and let me know about it." >&4
3856                 exit 1
3857                 ;;
3858         esac
3859 fi
3860 $rm -f try try.*
3861 case "$gccversion" in
3862 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3863 esac
3864 case "$gccversion" in
3865 '') gccosandvers='' ;;
3866 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3867    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3868    gccshortvers=''
3869    case "$gccosandvers" in
3870    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3871    $osname$osvers) ;; # looking good
3872    $osname*) cat <<EOM >&4
3873
3874 *** WHOA THERE!!! ***
3875
3876     Your gcc has not been compiled for the exact release of
3877     your operating system ($gccosandvers versus $osname$osvers).
3878
3879     In general it is a good idea to keep gcc synchronized with
3880     the operating system because otherwise serious problems
3881     may ensue when trying to compile software, like Perl.
3882
3883     I'm trying to be optimistic here, though, and will continue.
3884     If later during the configuration and build icky compilation
3885     problems appear (headerfile conflicts being the most common
3886     manifestation), I suggest reinstalling the gcc to match
3887     your operating system release.
3888
3889 EOM
3890       ;;
3891    *) gccosandvers='' ;; # failed to parse, better be silent
3892    esac
3893    ;;
3894 esac
3895 case "$ccname" in
3896 '') ccname="$cc" ;;
3897 esac
3898
3899 # gcc 3.* complain about adding -Idirectories that they already know about,
3900 # so we will take those off from locincpth.
3901 case "$gccversion" in
3902 3*)
3903     echo "main(){}">try.c
3904     for incdir in $locincpth; do
3905        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3906              grep '^c[cp]p*[01]: warning: changing search order '`
3907        if test "X$warn" != X; then
3908            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3909        fi
3910     done
3911     $rm -f try try.*
3912 esac
3913
3914 : decide how portable to be.  Allow command line overrides.
3915 case "$d_portable" in
3916 "$undef") ;;
3917 *)      d_portable="$define" ;;
3918 esac
3919
3920 : set up shell script to do ~ expansion
3921 cat >filexp <<EOSS
3922 $startsh
3923 : expand filename
3924 case "\$1" in
3925  ~/*|~)
3926         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3927         ;;
3928  ~*)
3929         if $test -f /bin/csh; then
3930                 /bin/csh -f -c "glob \$1"
3931                 failed=\$?
3932                 echo ""
3933                 exit \$failed
3934         else
3935                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3936                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3937                 if $test ! -d "\$dir"; then
3938                         me=\`basename \$0\`
3939                         echo "\$me: can't locate home directory for: \$name" >&2
3940                         exit 1
3941                 fi
3942                 case "\$1" in
3943                 */*)
3944                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3945                         ;;
3946                 *)
3947                         echo \$dir
3948                         ;;
3949                 esac
3950         fi
3951         ;;
3952 *)
3953         echo \$1
3954         ;;
3955 esac
3956 EOSS
3957 chmod +x filexp
3958 $eunicefix filexp
3959
3960 : now set up to get a file name
3961 cat <<EOS >getfile
3962 $startsh
3963 EOS
3964 cat <<'EOSC' >>getfile
3965 tilde=''
3966 fullpath=''
3967 already=''
3968 skip=''
3969 none_ok=''
3970 exp_file=''
3971 nopath_ok=''
3972 orig_rp="$rp"
3973 orig_dflt="$dflt"
3974 case "$gfpth" in
3975 '') gfpth='.' ;;
3976 esac
3977
3978 case "$fn" in
3979 *\(*)
3980         : getfile will accept an answer from the comma-separated list
3981         : enclosed in parentheses even if it does not meet other criteria.
3982         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3983         fn=`echo $fn | sed 's/(.*)//'`
3984         ;;
3985 esac
3986
3987 case "$fn" in
3988 *:*)
3989         loc_file=`expr $fn : '.*:\(.*\)'`
3990         fn=`expr $fn : '\(.*\):.*'`
3991         ;;
3992 esac
3993
3994 case "$fn" in
3995 *~*) tilde=true;;
3996 esac
3997 case "$fn" in
3998 */*) fullpath=true;;
3999 esac
4000 case "$fn" in
4001 *+*) skip=true;;
4002 esac
4003 case "$fn" in
4004 *n*) none_ok=true;;
4005 esac
4006 case "$fn" in
4007 *e*) exp_file=true;;
4008 esac
4009 case "$fn" in
4010 *p*) nopath_ok=true;;
4011 esac
4012
4013 case "$fn" in
4014 *f*) type='File';;
4015 *d*) type='Directory';;
4016 *l*) type='Locate';;
4017 esac
4018
4019 what="$type"
4020 case "$what" in
4021 Locate) what='File';;
4022 esac
4023
4024 case "$exp_file" in
4025 '')
4026         case "$d_portable" in
4027         "$define") ;;
4028         *) exp_file=true;;
4029         esac
4030         ;;
4031 esac
4032
4033 cd ..
4034 while test "$type"; do
4035         redo=''
4036         rp="$orig_rp"
4037         dflt="$orig_dflt"
4038         case "$tilde" in
4039         true) rp="$rp (~name ok)";;
4040         esac
4041         . UU/myread
4042         if test -f UU/getfile.ok && \
4043                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4044         then
4045                 value="$ans"
4046                 ansexp="$ans"
4047                 break
4048         fi
4049         case "$ans" in
4050         none)
4051                 value=''
4052                 ansexp=''
4053                 case "$none_ok" in
4054                 true) type='';;
4055                 esac
4056                 ;;
4057         *)
4058                 case "$tilde" in
4059                 '') value="$ans"
4060                         ansexp="$ans";;
4061                 *)
4062                         value=`UU/filexp $ans`
4063                         case $? in
4064                         0)
4065                                 if test "$ans" != "$value"; then
4066                                         echo "(That expands to $value on this system.)"
4067                                 fi
4068                                 ;;
4069                         *) value="$ans";;
4070                         esac
4071                         ansexp="$value"
4072                         case "$exp_file" in
4073                         '') value="$ans";;
4074                         esac
4075                         ;;
4076                 esac
4077                 case "$fullpath" in
4078                 true)
4079                         case "$ansexp" in
4080                         /*) value="$ansexp" ;;
4081                         [a-zA-Z]:/*) value="$ansexp" ;;
4082                         *)
4083                                 redo=true
4084                                 case "$already" in
4085                                 true)
4086                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4087                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4088                                         ;;
4089                                 *)
4090                                 echo "Please give a full path name, starting with slash." >&4
4091                                         case "$tilde" in
4092                                         true)
4093                                 echo "Note that using ~name is ok provided it expands well." >&4
4094                                                 already=true
4095                                                 ;;
4096                                         esac
4097                                 esac
4098                                 ;;
4099                         esac
4100                         ;;
4101                 esac
4102                 case "$redo" in
4103                 '')
4104                         case "$type" in
4105                         File)
4106                                 for fp in $gfpth; do
4107                                         if test "X$fp" = X.; then
4108                                             pf="$ansexp"
4109                                         else    
4110                                             pf="$fp/$ansexp"
4111                                         fi
4112                                         if test -f "$pf"; then
4113                                                 type=''
4114                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4115                                         then
4116                                                 echo "($value is not a plain file, but that's ok.)"
4117                                                 type=''
4118                                         fi
4119                                         if test X"$type" = X; then
4120                                             value="$pf"
4121                                             break
4122                                         fi
4123                                 done
4124                                 ;;
4125                         Directory)
4126                                 for fp in $gfpth; do
4127                                         if test "X$fp" = X.; then
4128                                             dir="$ans"
4129                                             direxp="$ansexp"
4130                                         else    
4131                                             dir="$fp/$ansexp"
4132                                             direxp="$fp/$ansexp"
4133                                         fi
4134                                         if test -d "$direxp"; then
4135                                                 type=''
4136                                                 value="$dir"
4137                                                 break
4138                                         fi
4139                                 done
4140                                 ;;
4141                         Locate)
4142                                 if test -d "$ansexp"; then
4143                                         echo "(Looking for $loc_file in directory $value.)"
4144                                         value="$value/$loc_file"
4145                                         ansexp="$ansexp/$loc_file"
4146                                 fi
4147                                 if test -f "$ansexp"; then
4148                                         type=''
4149                                 fi
4150                                 case "$nopath_ok" in
4151                                 true)   case "$value" in
4152                                         */*) ;;
4153                                         *)      echo "Assuming $value will be in people's path."
4154                                                 type=''
4155                                                 ;;
4156                                         esac
4157                                         ;;
4158                                 esac
4159                                 ;;
4160                         esac
4161
4162                         case "$skip" in
4163                         true) type='';
4164                         esac
4165
4166                         case "$type" in
4167                         '') ;;
4168                         *)
4169                                 if test "$fastread" = yes; then
4170                                         dflt=y
4171                                 else
4172                                         dflt=n
4173                                 fi
4174                                 rp="$what $value doesn't exist.  Use that name anyway?"
4175                                 . UU/myread
4176                                 dflt=''
4177                                 case "$ans" in
4178                                 y*) type='';;
4179                                 *) echo " ";;
4180                                 esac
4181                                 ;;
4182                         esac
4183                         ;;
4184                 esac
4185                 ;;
4186         esac
4187 done
4188 cd UU
4189 ans="$value"
4190 rp="$orig_rp"
4191 dflt="$orig_dflt"
4192 rm -f getfile.ok
4193 test "X$gfpthkeep" != Xy && gfpth=""
4194 EOSC
4195
4196 : What should the include directory be ?
4197 echo " "
4198 $echo $n "Hmm...  $c"
4199 dflt='/usr/include'
4200 incpath=''
4201 mips_type=''
4202 if $test -f /bin/mips && /bin/mips; then
4203         echo "Looks like a MIPS system..."
4204         $cat >usr.c <<'EOCP'
4205 #ifdef SYSTYPE_BSD43
4206 /bsd43
4207 #endif
4208 EOCP
4209         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4210                 dflt='/bsd43/usr/include'
4211                 incpath='/bsd43'
4212                 mips_type='BSD 4.3'
4213         else
4214                 mips_type='System V'
4215         fi
4216         $rm -f usr.c usr.out
4217         echo "and you're compiling with the $mips_type compiler and libraries."
4218         xxx_prompt=y
4219         echo "exit 0" >mips
4220 else
4221         echo "Doesn't look like a MIPS system."
4222         xxx_prompt=n
4223         echo "exit 1" >mips
4224 fi
4225 chmod +x mips
4226 $eunicefix mips
4227 case "$usrinc" in
4228 '') ;;
4229 *) dflt="$usrinc";;
4230 esac
4231 case "$xxx_prompt" in
4232 y)      fn=d/
4233         echo " "
4234         rp='Where are the include files you want to use?'
4235         . ./getfile
4236         usrinc="$ans"
4237         ;;
4238 *)      usrinc="$dflt"
4239         ;;
4240 esac
4241
4242 : see how we invoke the C preprocessor
4243 echo " "
4244 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4245 cat <<'EOT' >testcpp.c
4246 #define ABC abc
4247 #define XYZ xyz
4248 ABC.XYZ
4249 EOT
4250 cd ..
4251 if test ! -f cppstdin; then
4252         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4253                 # AIX cc -E doesn't show the absolute headerfile
4254                 # locations but we'll cheat by using the -M flag.
4255                 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
4256         else
4257                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4258         fi
4259 else
4260         echo "Keeping your $hint cppstdin wrapper."
4261 fi
4262 chmod 755 cppstdin
4263 wrapper=`pwd`/cppstdin
4264 ok='false'
4265 cd UU
4266
4267 if $test "X$cppstdin" != "X" && \
4268         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4270 then
4271         echo "You used to use $cppstdin $cppminus so we'll use that again."
4272         case "$cpprun" in
4273         '') echo "But let's see if we can live without a wrapper..." ;;
4274         *)
4275                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4276                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4277                 then
4278                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4279                         ok='true'
4280                 else
4281                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4282                 fi
4283                 ;;
4284         esac
4285 else
4286         case "$cppstdin" in
4287         '') ;;
4288         *)
4289                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4290                 ;;
4291         esac
4292 fi
4293
4294 if $ok; then
4295         : nothing
4296 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4297         $cc -E <testcpp.c >testcpp.out 2>&1; \
4298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4299         echo "Yup, it does."
4300         x_cpp="$cc -E"
4301         x_minus='';
4302 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4303         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4305         echo "Yup, it does."
4306         x_cpp="$cc -E"
4307         x_minus='-';
4308 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4309         $cc -P <testcpp.c >testcpp.out 2>&1; \
4310         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4311         echo "Yipee, that works!"
4312         x_cpp="$cc -P"
4313         x_minus='';
4314 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4315         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4316         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4317         echo "At long last!"
4318         x_cpp="$cc -P"
4319         x_minus='-';
4320 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4321         $cpp <testcpp.c >testcpp.out 2>&1; \
4322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4323         echo "It works!"
4324         x_cpp="$cpp"
4325         x_minus='';
4326 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4327         $cpp - <testcpp.c >testcpp.out 2>&1; \
4328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4329         echo "Hooray, it works!  I was beginning to wonder."
4330         x_cpp="$cpp"
4331         x_minus='-';
4332 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4333         $wrapper <testcpp.c >testcpp.out 2>&1; \
4334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4335         x_cpp="$wrapper"
4336         x_minus=''
4337         echo "Eureka!"
4338 else
4339         dflt=''
4340         rp="No dice.  I can't find a C preprocessor.  Name one:"
4341         . ./myread
4342         x_cpp="$ans"
4343         x_minus=''
4344         $x_cpp <testcpp.c >testcpp.out 2>&1
4345         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346                 echo "OK, that will do." >&4
4347         else
4348 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4349                 exit 1
4350         fi
4351 fi
4352
4353 case "$ok" in
4354 false)
4355         cppstdin="$x_cpp"
4356         cppminus="$x_minus"
4357         cpprun="$x_cpp"
4358         cpplast="$x_minus"
4359         set X $x_cpp
4360         shift
4361         case "$1" in
4362         "$cpp")
4363                 echo "Perhaps can we force $cc -E using a wrapper..."
4364                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4365                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4366                 then
4367                         echo "Yup, we can."
4368                         cppstdin="$wrapper"
4369                         cppminus='';
4370                 else
4371                         echo "Nope, we'll have to live without it..."
4372                 fi
4373                 ;;
4374         esac
4375         case "$cpprun" in
4376         "$wrapper")
4377                 cpprun=''
4378                 cpplast=''
4379                 ;;
4380         esac
4381         ;;
4382 esac
4383
4384 case "$cppstdin" in
4385 "$wrapper"|'cppstdin') ;;
4386 *) $rm -f $wrapper;;
4387 esac
4388 $rm -f testcpp.c testcpp.out
4389
4390 : Set private lib path
4391 case "$plibpth" in
4392 '') if ./mips; then
4393                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4394         fi;;
4395 esac
4396 case "$libpth" in
4397 ' ') dlist='';;
4398 '') dlist="$loclibpth $plibpth $glibpth";;
4399 *) dlist="$libpth";;
4400 esac
4401
4402 : Now check and see which directories actually exist, avoiding duplicates
4403 libpth=''
4404 for xxx in $dlist
4405 do
4406     if $test -d $xxx; then
4407                 case " $libpth " in
4408                 *" $xxx "*) ;;
4409                 *) libpth="$libpth $xxx";;
4410                 esac
4411     fi
4412 done
4413 $cat <<'EOM'
4414
4415 Some systems have incompatible or broken versions of libraries.  Among
4416 the directories listed in the question below, please remove any you
4417 know not to be holding relevant libraries, and add any that are needed.
4418 Say "none" for none.
4419
4420 EOM
4421 case "$libpth" in
4422 '') dflt='none';;
4423 *)
4424         set X $libpth
4425         shift
4426         dflt=${1+"$@"}
4427         ;;
4428 esac
4429 rp="Directories to use for library searches?"
4430 . ./myread
4431 case "$ans" in
4432 none) libpth=' ';;
4433 *) libpth="$ans";;
4434 esac
4435
4436 : compute shared library extension
4437 case "$so" in
4438 '')
4439         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4440                 dflt='sl'
4441         else
4442                 dflt='so'
4443         fi
4444         ;;
4445 *) dflt="$so";;
4446 esac
4447 $cat <<EOM
4448
4449 On some systems, shared libraries may be available.  Answer 'none' if
4450 you want to suppress searching of shared libraries for the remainder
4451 of this configuration.
4452
4453 EOM
4454 rp='What is the file extension used for shared libraries?'
4455 . ./myread
4456 so="$ans"
4457
4458 : Define several unixisms.
4459 : Hints files or command line option can be used to override them.
4460 : The convoluted testing is in case hints files set either the old
4461 : or the new name.
4462 case "$_exe" in
4463 '')     case "$exe_ext" in
4464         '')     ;;
4465         *)      _exe="$exe_ext" ;;
4466         esac
4467         ;;
4468 esac
4469 case "$_a" in
4470 '')     case "$lib_ext" in
4471     '') _a='.a';;
4472         *)      _a="$lib_ext" ;;
4473         esac
4474         ;;
4475 esac
4476 case "$_o" in
4477 '') case "$obj_ext" in
4478         '')     _o='.o';;
4479         *)      _o="$obj_ext";;
4480         esac
4481         ;;
4482 esac
4483 case "$p_" in
4484 '') case "$path_sep" in
4485         '')     p_=':';;
4486         *)      p_="$path_sep";;
4487         esac
4488         ;;
4489 esac
4490 exe_ext=$_exe
4491 lib_ext=$_a
4492 obj_ext=$_o
4493 path_sep=$p_
4494
4495 : Which makefile gets called first.  This is used by make depend.
4496 case "$firstmakefile" in
4497 '') firstmakefile='makefile';;
4498 esac
4499
4500 : Looking for optional libraries
4501 echo " "
4502 echo "Checking for optional libraries..." >&4
4503 case "$libs" in
4504 ' '|'') dflt='';;
4505 *) dflt="$libs";;
4506 esac
4507 case "$libswanted" in
4508 '') libswanted='c_s';;
4509 esac
4510 case "$usesocks" in
4511 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4512 esac
4513 libsfound=''
4514 libsfiles=''
4515 libsdirs=''
4516 libspath=''
4517 for thisdir in $libpth $xlibpth; do
4518   test -d $thisdir && libspath="$libspath $thisdir"
4519 done
4520 for thislib in $libswanted; do
4521         for thisdir in $libspath; do
4522             xxx=''
4523             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4524                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4525                 $test -f "$xxx" && eval $libscheck
4526                 $test -f "$xxx" && libstyle=shared
4527             fi
4528             if test ! -f "$xxx"; then
4529                 xxx=$thisdir/lib$thislib.$so
4530                 $test -f "$xxx" && eval $libscheck
4531                 $test -f "$xxx" && libstyle=shared
4532             fi  
4533             if test ! -f "$xxx"; then
4534                 xxx=$thisdir/lib$thislib$_a
4535                 $test -f "$xxx" && eval $libscheck
4536                 $test -f "$xxx" && libstyle=static
4537             fi
4538             if test ! -f "$xxx"; then
4539                 xxx=$thisdir/$thislib$_a
4540                 $test -f "$xxx" && eval $libscheck
4541                 $test -f "$xxx" && libstyle=static
4542             fi
4543             if test ! -f "$xxx"; then
4544                 xxx=$thisdir/lib${thislib}_s$_a
4545                 $test -f "$xxx" && eval $libscheck
4546                 $test -f "$xxx" && libstyle=static
4547                 $test -f "$xxx" && thislib=${thislib}_s
4548             fi
4549             if test ! -f "$xxx"; then
4550                 xxx=$thisdir/Slib$thislib$_a
4551                 $test -f "$xxx" && eval $libscheck
4552                 $test -f "$xxx" && libstyle=static
4553             fi
4554             if $test -f "$xxx"; then
4555                 case "$libstyle" in
4556                 shared) echo "Found -l$thislib (shared)." ;;
4557                 static) echo "Found -l$thislib." ;;
4558                 *)      echo "Found -l$thislib ($libstyle)." ;;
4559                 esac
4560                 case " $dflt " in
4561                 *"-l$thislib "*);;
4562                 *) dflt="$dflt -l$thislib"
4563                    libsfound="$libsfound $xxx"
4564                    yyy=`basename $xxx`
4565                    libsfiles="$libsfiles $yyy"
4566                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4567                    case " $libsdirs " in
4568                    *" $yyy "*) ;;
4569                    *) libsdirs="$libsdirs $yyy" ;;
4570                    esac
4571                    ;;
4572                 esac
4573                 break
4574             fi  
4575         done
4576         if $test ! -f "$xxx"; then
4577             echo "No -l$thislib."
4578         fi
4579 done
4580 set X $dflt
4581 shift
4582 dflt="$*"
4583 case "$libs" in
4584 '') dflt="$dflt";;
4585 *) dflt="$libs";;
4586 esac
4587 case "$dflt" in
4588 ' '|'') dflt='none';;
4589 esac
4590
4591 $cat <<EOM
4592
4593 In order to compile $package on your machine, a number of libraries
4594 are usually needed.  Include any other special libraries here as well.
4595 Say "none" for none.  The default list is almost always right.
4596 EOM
4597
4598 echo " "
4599 rp="What libraries to use?"
4600 . ./myread
4601 case "$ans" in
4602 none) libs=' ';;
4603 *) libs="$ans";;
4604 esac
4605
4606 : determine optimization, if desired, or use for debug flag also
4607 case "$optimize" in
4608 ' '|$undef) dflt='none';;
4609 '') dflt='-O';;
4610 *) dflt="$optimize";;
4611 esac
4612 $cat <<EOH
4613
4614 By default, $package compiles with the -O flag to use the optimizer.
4615 Alternately, you might want to use the symbolic debugger, which uses
4616 the -g flag (on traditional Unix systems).  Either flag can be
4617 specified here.  To use neither flag, specify the word "none".
4618
4619 EOH
4620 rp="What optimizer/debugger flag should be used?"
4621 . ./myread
4622 optimize="$ans"
4623 case "$optimize" in
4624 'none') optimize=" ";;
4625 esac
4626
4627 dflt=''
4628 : We will not override a previous value, but we might want to
4629 : augment a hint file
4630 case "$hint" in
4631 default|recommended)
4632         case "$gccversion" in
4633         1*) dflt='-fpcc-struct-return' ;;
4634         esac
4635         case "$optimize" in
4636         *-g*) dflt="$dflt -DDEBUGGING";;
4637         esac
4638         case "$gccversion" in
4639         2*) if test -d /etc/conf/kconfig.d &&
4640                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4641                 then
4642                         dflt="$dflt -posix"
4643                 fi
4644                 ;;
4645         esac
4646         case "$gccversion" in
4647         1*) ;;
4648         2.[0-8]*) ;;
4649         ?*)     echo " "
4650                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4651                 echo 'int main(void) { return 0; }' > gcctest.c
4652                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4653                         echo "Yes, it does." 2>&1
4654                         case "$ccflags" in
4655                         *strict-aliasing*) 
4656                                 echo "Leaving current flags $ccflags alone." 2>&1
4657                                 ;;
4658                         *) dflt="$dflt -fno-strict-aliasing" ;;
4659                         esac
4660                 else
4661                         echo "Nope, it doesn't, but that's ok." 2>&1
4662                 fi
4663                 ;;
4664         esac
4665         ;;
4666 esac
4667
4668 case "$mips_type" in
4669 *BSD*|'') inclwanted="$locincpth $usrinc";;
4670 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4671 esac
4672 for thisincl in $inclwanted; do
4673         if $test -d $thisincl; then
4674                 if $test x$thisincl != x$usrinc; then
4675                         case "$dflt" in
4676                         *" -I$thisincl "*);;
4677                         *) dflt="$dflt -I$thisincl ";;
4678                         esac
4679                 fi
4680         fi
4681 done
4682
4683 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4684         xxx=true;
4685 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4686         xxx=true;
4687 else
4688         xxx=false;
4689 fi;
4690 if $xxx; then
4691         case "$dflt" in
4692         *$2*);;
4693         *) dflt="$dflt -D$2";;
4694         esac;
4695 fi'
4696
4697 set signal.h LANGUAGE_C; eval $inctest
4698
4699 case "$usesocks" in
4700 $define)
4701         ccflags="$ccflags -DSOCKS"
4702         ;;
4703 esac
4704
4705 case "$hint" in
4706 default|recommended) dflt="$ccflags $dflt" ;;
4707 *) dflt="$ccflags";;
4708 esac
4709
4710 case "$dflt" in
4711 ''|' ') dflt=none;;
4712 esac
4713
4714 $cat <<EOH
4715
4716 Your C compiler may want other flags.  For this question you should include
4717 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4718 but you should NOT include libraries or ld flags like -lwhatever.  If you
4719 want $package to honor its debug switch, you should include -DDEBUGGING here.
4720 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4721
4722 To use no flags, specify the word "none".
4723
4724 EOH
4725 set X $dflt
4726 shift
4727 dflt=${1+"$@"}
4728 rp="Any additional cc flags?"
4729 . ./myread
4730 case "$ans" in
4731 none) ccflags='';;
4732 *) ccflags="$ans";;
4733 esac
4734
4735 : the following weeds options from ccflags that are of no interest to cpp
4736 case "$cppflags" in
4737 '') cppflags="$ccflags" ;;
4738 *)  cppflags="$cppflags $ccflags" ;;
4739 esac
4740 case "$gccversion" in
4741 1*) cppflags="$cppflags -D__GNUC__"
4742 esac
4743 case "$mips_type" in
4744 '');;
4745 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4746 esac
4747 case "$cppflags" in
4748 '');;
4749 *)
4750         echo " "
4751         echo "Let me guess what the preprocessor flags are..." >&4
4752         set X $cppflags
4753         shift
4754         cppflags=''
4755         $cat >cpp.c <<'EOM'
4756 #define BLURFL foo
4757
4758 BLURFL xx LFRULB
4759 EOM
4760         previous=''
4761         for flag in $*
4762         do
4763                 case "$flag" in
4764                 -*) ftry="$flag";;
4765                 *) ftry="$previous $flag";;
4766                 esac
4767                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4768                         >cpp1.out 2>/dev/null && \
4769                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4770                         >cpp2.out 2>/dev/null && \
4771                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4772                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4773                 then
4774                         cppflags="$cppflags $ftry"
4775                         previous=''
4776                 else
4777                         previous="$flag"
4778                 fi
4779         done
4780         set X $cppflags
4781         shift
4782         cppflags=${1+"$@"}
4783         case "$cppflags" in
4784         *-*)  echo "They appear to be: $cppflags";;
4785         esac
4786         $rm -f cpp.c cpp?.out
4787         ;;
4788 esac
4789
4790 : flags used in final linking phase
4791 case "$ldflags" in
4792 '') if ./venix; then
4793                 dflt='-i -z'
4794         else
4795                 dflt=''
4796         fi
4797         case "$ccflags" in
4798         *-posix*) dflt="$dflt -posix" ;;
4799         esac
4800         ;;
4801 *) dflt="$ldflags";;
4802 esac
4803
4804 : Try to guess additional flags to pick up local libraries.
4805 for thislibdir in $libpth; do
4806         case " $loclibpth " in
4807         *" $thislibdir "*)
4808                 case "$dflt " in 
4809                 *"-L$thislibdir "*) ;;
4810                 *)  dflt="$dflt -L$thislibdir" ;;
4811                 esac
4812                 ;;
4813         esac
4814 done
4815
4816 case "$dflt" in
4817 '') dflt='none' ;;
4818 esac
4819
4820 $cat <<EOH
4821
4822 Your C linker may need flags.  For this question you should
4823 include -L/whatever and any other flags used by the C linker, but you
4824 should NOT include libraries like -lwhatever.
4825
4826 Make sure you include the appropriate -L/path flags if your C linker
4827 does not normally search all of the directories you specified above,
4828 namely
4829         $libpth
4830 To use no flags, specify the word "none".
4831
4832 EOH
4833
4834 rp="Any additional ld flags (NOT including libraries)?"
4835 . ./myread
4836 case "$ans" in
4837 none) ldflags='';;
4838 *) ldflags="$ans";;
4839 esac
4840 rmlist="$rmlist pdp11"
4841
4842 : coherency check
4843 echo " "
4844 echo "Checking your choice of C compiler and flags for coherency..." >&4
4845 $cat > try.c <<'EOF'
4846 #include <stdio.h>
4847 int main() { printf("Ok\n"); exit(0); }
4848 EOF
4849 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4850 shift
4851 $cat >try.msg <<'EOM'
4852 I've tried to compile and run the following simple program:
4853
4854 EOM
4855 $cat try.c >> try.msg
4856
4857 $cat >> try.msg <<EOM
4858
4859 I used the command:
4860
4861         $*
4862         $run ./try
4863
4864 and I got the following output:
4865
4866 EOM
4867 dflt=y
4868 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4869         if $sh -c "$run ./try" >>try.msg 2>&1; then
4870                 xxx=`$run ./try`
4871                 case "$xxx" in
4872                 "Ok") dflt=n ;;
4873                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4874                         case " $libs " in
4875                         *" -lsfio "*)
4876                                 cat >> try.msg <<'EOQS'
4877 If $libs contains -lsfio, and sfio is mis-configured, then it
4878 sometimes (apparently) runs and exits with a 0 status, but with no
4879 output!  It may have to do with sfio's use of _exit vs. exit.
4880
4881 EOQS
4882                                 rp="You have a big problem.  Shall I abort Configure"
4883                                 dflt=y
4884                                 ;;
4885                         esac
4886                         ;;
4887                 esac
4888         else
4889                 echo "The program compiled OK, but exited with status $?." >>try.msg
4890                 rp="You have a problem.  Shall I abort Configure"
4891                 dflt=y
4892         fi
4893 else
4894         echo "I can't compile the test program." >>try.msg
4895         rp="You have a BIG problem.  Shall I abort Configure"
4896         dflt=y
4897 fi
4898 case "$dflt" in
4899 y)
4900         $cat try.msg >&4
4901         case "$knowitall" in
4902         '')
4903                 echo "(The supplied flags or libraries might be incorrect.)"
4904                 ;;
4905         *) dflt=n;;
4906         esac
4907         echo " "
4908         . ./myread
4909         case "$ans" in
4910         n*|N*) ;;
4911         *)      echo "Ok.  Stopping Configure." >&4
4912                 exit 1
4913                 ;;
4914         esac
4915         ;;
4916 n) echo "OK, that should do.";;
4917 esac
4918 $rm -f try try.* core
4919
4920 : define a shorthand compile call
4921 compile='
4922 mc_file=$1;
4923 shift;
4924 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4925 : define a shorthand compile call for compilations that should be ok.
4926 compile_ok='
4927 mc_file=$1;
4928 shift;
4929 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4930
4931 : check for lengths of integral types
4932 echo " "
4933 case "$intsize" in
4934 '')
4935         echo "Checking to see how big your integers are..." >&4
4936         $cat >try.c <<'EOCP'
4937 #include <stdio.h>
4938 int main()
4939 {
4940         printf("intsize=%d;\n", (int)sizeof(int));
4941         printf("longsize=%d;\n", (int)sizeof(long));
4942         printf("shortsize=%d;\n", (int)sizeof(short));
4943         exit(0);
4944 }
4945 EOCP
4946         set try
4947         if eval $compile_ok && $run ./try > /dev/null; then
4948                 eval `$run ./try`
4949                 echo "Your integers are $intsize bytes long."
4950                 echo "Your long integers are $longsize bytes long."
4951                 echo "Your short integers are $shortsize bytes long."
4952         else
4953                 $cat >&4 <<EOM
4954 !
4955 Help! I can't compile and run the intsize test program: please enlighten me!
4956 (This is probably a misconfiguration in your system or libraries, and
4957 you really ought to fix it.  Still, I'll try anyway.)
4958 !
4959 EOM
4960                 dflt=4
4961                 rp="What is the size of an integer (in bytes)?"
4962                 . ./myread
4963                 intsize="$ans"
4964                 dflt=$intsize
4965                 rp="What is the size of a long integer (in bytes)?"
4966                 . ./myread
4967                 longsize="$ans"
4968                 dflt=2
4969                 rp="What is the size of a short integer (in bytes)?"
4970                 . ./myread
4971                 shortsize="$ans"
4972         fi
4973         ;;
4974 esac
4975 $rm -f try try.*
4976
4977 : check for long long
4978 echo " "
4979 echo "Checking to see if you have long long..." >&4
4980 echo 'int main() { long long x = 7; return 0; }' > try.c
4981 set try
4982 if eval $compile; then
4983         val="$define"
4984         echo "You have long long."
4985 else
4986         val="$undef"
4987         echo "You do not have long long."
4988 fi
4989 $rm try.*
4990 set d_longlong
4991 eval $setvar
4992
4993 : check for length of long long
4994 case "${d_longlong}${longlongsize}" in
4995 $define)
4996         echo " "
4997         echo "Checking to see how big your long longs are..." >&4
4998         $cat >try.c <<'EOCP'
4999 #include <stdio.h>
5000 int main()
5001 {
5002     printf("%d\n", (int)sizeof(long long));
5003     return(0);
5004 }
5005 EOCP
5006         set try
5007         if eval $compile_ok; then
5008                 longlongsize=`$run ./try`
5009                 echo "Your long longs are $longlongsize bytes long."
5010         else
5011                 dflt='8'
5012                 echo " "
5013                 echo "(I can't seem to compile the test program.  Guessing...)"
5014                 rp="What is the size of a long long (in bytes)?"
5015                 . ./myread
5016                 longlongsize="$ans"
5017         fi
5018         if $test "X$longsize" = "X$longlongsize"; then
5019                 echo "(That isn't any different from an ordinary long.)"
5020         fi      
5021         ;;
5022 esac
5023 $rm -f try.* try
5024
5025 : determine filename position in cpp output
5026 echo " "
5027 echo "Computing filename position in cpp output for #include directives..." >&4
5028 case "$osname" in
5029 vos) testaccess=-e ;;
5030 *)   testaccess=-r ;;
5031 esac
5032 echo '#include <stdio.h>' > foo.c
5033 $cat >fieldn <<EOF
5034 $startsh
5035 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5036 $grep '^[       ]*#.*stdio\.h' | \
5037 while read cline; do
5038         pos=1
5039         set \$cline
5040         while $test \$# -gt 0; do
5041                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5042                         echo "\$pos"
5043                         exit 0
5044                 fi
5045                 shift
5046                 pos=\`expr \$pos + 1\`
5047         done
5048 done
5049 EOF
5050 chmod +x fieldn
5051 fieldn=`./fieldn`
5052 $rm -f foo.c fieldn
5053 case $fieldn in
5054 '') pos='???';;
5055 1) pos=first;;
5056 2) pos=second;;
5057 3) pos=third;;
5058 *) pos="${fieldn}th";;
5059 esac
5060 echo "Your cpp writes the filename in the $pos field of the line."
5061
5062 case "$osname" in
5063 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5064 *)   cppfilter='' ;;
5065 esac
5066 : locate header file
5067 $cat >findhdr <<EOF
5068 $startsh
5069 wanted=\$1
5070 name=''
5071 for usrincdir in $usrinc
5072 do
5073         if test -f \$usrincdir/\$wanted; then
5074                 echo "\$usrincdir/\$wanted"
5075                 exit 0
5076         fi
5077 done
5078 awkprg='{ print \$$fieldn }'
5079 echo "#include <\$wanted>" > foo\$\$.c
5080 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5081 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5082 while read cline; do
5083         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5084         case "\$name" in
5085         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5086         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5087         *) exit 2;;
5088         esac;
5089 done;
5090 #
5091 # status = 0: grep returned 0 lines, case statement not executed
5092 # status = 1: headerfile found
5093 # status = 2: while loop executed, no headerfile found
5094 #
5095 status=\$?
5096 $rm -f foo\$\$.c;
5097 if test \$status -eq 1; then
5098         exit 0;
5099 fi
5100 exit 1
5101 EOF
5102 chmod +x findhdr
5103
5104 : define an alternate in-header-list? function
5105 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5106 cont=true; xxf="echo \"<\$1> found.\" >&4";
5107 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5108 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5109 esac;
5110 case $# in 4) instead=instead;; *) instead="at last";; esac;
5111 while $test "$cont"; do
5112         xxx=`./findhdr $1`
5113         var=$2; eval "was=\$$2";
5114         if $test "$xxx" && $test -r "$xxx";
5115         then eval $xxf;
5116         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5117                 cont="";
5118         else eval $xxnf;
5119         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5120         set $yyy; shift; shift; yyy=$@;
5121         case $# in 0) cont="";;
5122         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5123                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5124         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5125                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5126         esac;
5127 done;
5128 while $test "$yyy";
5129 do set $yyy; var=$2; eval "was=\$$2";
5130         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5131         set $yyy; shift; shift; yyy=$@;
5132 done'
5133
5134 : see if inttypes.h is available
5135 : we want a real compile instead of Inhdr because some systems
5136 : have an inttypes.h which includes non-existent headers
5137 echo " "
5138 $cat >try.c <<EOCP
5139 #include <inttypes.h>
5140 int main() {
5141         static int32_t foo32 = 0x12345678;
5142 }
5143 EOCP
5144 set try
5145 if eval $compile; then
5146         echo "<inttypes.h> found." >&4
5147         val="$define"
5148 else
5149         echo "<inttypes.h> NOT found." >&4
5150         val="$undef"
5151 fi
5152 $rm -f try.c try
5153 set i_inttypes
5154 eval $setvar
5155
5156 : check for int64_t
5157 echo " "
5158 echo "Checking to see if you have int64_t..." >&4
5159 $cat >try.c <<EOCP
5160 #include <sys/types.h>
5161 #$i_inttypes I_INTTYPES
5162 #ifdef I_INTTYPES
5163 #include <inttypes.h>
5164 #endif
5165 int main() { int64_t x = 7; }
5166 EOCP
5167 set try
5168 if eval $compile; then
5169         val="$define"
5170         echo "You have int64_t."
5171 else
5172         val="$undef"
5173         echo "You do not have int64_t."
5174 fi
5175 $rm -f try try.*
5176 set d_int64_t
5177 eval $setvar
5178
5179
5180 echo " "
5181 echo "Checking which 64-bit integer type we could use..." >&4
5182
5183 case "$intsize" in
5184 8) val=int
5185    set quadtype
5186    eval $setvar
5187    val='"unsigned int"'
5188    set uquadtype
5189    eval $setvar
5190    quadkind=1
5191    ;;
5192 *) case "$longsize" in
5193    8) val=long
5194       set quadtype
5195       eval $setvar
5196       val='"unsigned long"'
5197       set uquadtype
5198       eval $setvar
5199       quadkind=2
5200       ;;
5201    *) case "$d_longlong:$longlongsize" in
5202       define:8)
5203         val='"long long"'
5204         set quadtype
5205         eval $setvar
5206         val='"unsigned long long"'
5207         set uquadtype
5208         eval $setvar
5209         quadkind=3
5210         ;;
5211       *) case "$d_int64_t" in
5212          define)
5213            val=int64_t
5214            set quadtype
5215            eval $setvar
5216            val=uint64_t
5217            set uquadtype
5218            eval $setvar
5219            quadkind=4
5220            ;;
5221          esac
5222          ;;
5223       esac
5224       ;;
5225    esac
5226    ;;
5227 esac
5228
5229 case "$quadtype" in
5230 '')     echo "Alas, no 64-bit integer types in sight." >&4
5231         d_quad="$undef"
5232         ;;
5233 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5234         d_quad="$define"
5235         ;;
5236 esac
5237
5238
5239 case "$uselonglong" in
5240 "$define"|true|[yY]*)
5241         cat <<EOM >&4
5242
5243 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5244 EOM
5245         use64bitint="$define"
5246         ;;
5247 esac                          
5248 case "$use64bits" in
5249 "$define"|true|[yY]*)
5250         cat <<EOM >&4
5251
5252 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5253 EOM
5254         use64bitint="$define"
5255         ;;
5256 esac                          
5257 case "$use64bitints" in
5258 "$define"|true|[yY]*)
5259         cat <<EOM >&4
5260
5261 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5262 EOM
5263         use64bitint="$define"
5264         ;;
5265 esac                          
5266 case "$use64bitsint" in
5267 "$define"|true|[yY]*)
5268         cat <<EOM >&4
5269
5270 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5271 EOM
5272         use64bitint="$define"
5273         ;;
5274 esac                          
5275 case "$uselonglongs" in
5276 "$define"|true|[yY]*)
5277         cat <<EOM >&4
5278
5279 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5280 EOM
5281         use64bitint="$define"
5282         ;;
5283 esac                          
5284 case "$use64bitsall" in
5285 "$define"|true|[yY]*)
5286         cat <<EOM >&4
5287
5288 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5289 EOM
5290         use64bitall="$define"
5291         ;;
5292 esac                          
5293
5294 case "$ccflags" in
5295 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5296 esac
5297 case "$use64bitall" in
5298 "$define"|true|[yY]*) use64bitint="$define" ;;
5299 esac
5300
5301 case "$longsize" in
5302 8) cat <<EOM
5303
5304 You have natively 64-bit long integers.
5305 EOM
5306    val="$define"
5307    ;;
5308 *) case "$use64bitint" in
5309    "$define"|true|[yY]*) dflt='y';;
5310    *) dflt='n';;
5311    esac
5312    case "$d_quad" in
5313    "$define") ;;
5314    *) dflt='n' ;;
5315    esac
5316    cat <<EOM
5317
5318 Perl can be built to take advantage of 64-bit integer types
5319 on some systems.  To do so, Configure can be run with -Duse64bitint.
5320 Choosing this option will most probably introduce binary incompatibilities.
5321
5322 If this doesn't make any sense to you, just accept the default '$dflt'.
5323 (The default has been chosen based on your configuration.)
5324 EOM
5325    rp='Try to use 64-bit integers, if available?'
5326    . ./myread
5327    case "$ans" in
5328    [yY]*) val="$define" ;;
5329    *)     val="$undef"  ;;
5330    esac
5331    ;;
5332 esac
5333 set use64bitint
5334 eval $setvar
5335
5336 case "$use64bitall" in
5337 "$define"|true|[yY]*) dflt='y' ;;
5338 *) case "$longsize" in
5339    8) dflt='y' ;;
5340    *) dflt='n' ;;
5341    esac
5342    ;;
5343 esac    
5344 cat <<EOM
5345
5346 You may also choose to try maximal 64-bitness.  It means using as much
5347 64-bitness as possible on the platform.  This in turn means even more
5348 binary incompatibilities.  On the other hand, your platform may not
5349 have any more 64-bitness available than what you already have chosen.
5350
5351 If this doesn't make any sense to you, just accept the default '$dflt'.
5352 (The default has been chosen based on your configuration.)
5353 EOM
5354 rp='Try to use maximal 64-bit support, if available?'
5355 . ./myread
5356 case "$ans" in
5357 [yY]*) val="$define" ;;
5358 *)     val="$undef"  ;;
5359 esac
5360 set use64bitall
5361 eval $setvar
5362 case "$use64bitall" in
5363 "$define")
5364         case "$use64bitint" in
5365         "$undef")
5366                 cat <<EOM
5367
5368 Since you have chosen a maximally 64-bit build, I'm also turning on
5369 the use of 64-bit integers.
5370 EOM
5371                 use64bitint="$define" ;;
5372         esac
5373         ;;
5374 esac
5375
5376 case "$use64bitint" in
5377 "$define"|true|[yY]*)
5378 : Look for a hint-file generated 'call-back-unit'.  If the
5379 : user has specified that a 64-bit perl is to be built,
5380 : we may need to set or change some other defaults.
5381         if $test -f use64bitint.cbu; then
5382                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5383                 . ./use64bitint.cbu
5384         fi
5385         case "$longsize" in
5386         4) case "$archname64" in
5387            '') archname64=64int ;;
5388            esac
5389            ;;
5390         esac
5391         ;;
5392 esac
5393
5394 case "$use64bitall" in
5395 "$define"|true|[yY]*)
5396 : Look for a hint-file generated 'call-back-unit'.  If the
5397 : user has specified that a maximally 64-bit perl is to be built,
5398 : we may need to set or change some other defaults.
5399         if $test -f use64bitall.cbu; then
5400                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5401                 . ./use64bitall.cbu
5402         fi
5403         case "$longsize" in
5404         4) case "$archname64" in
5405            ''|64int) archname64=64all ;;
5406            esac
5407            ;;
5408         esac
5409         ;;
5410 esac
5411
5412 echo " "
5413 echo "Checking for GNU C Library..." >&4
5414 cat >try.c <<'EOCP'
5415 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5416    alone are insufficient to distinguish different versions, such as
5417    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5418    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5419 */
5420 #include <stdio.h>
5421 int main(void)
5422 {
5423 #ifdef __GLIBC__
5424 #   ifdef __GLIBC_MINOR__
5425 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5426 #           include <gnu/libc-version.h>
5427             printf("%s\n",  gnu_get_libc_version());
5428 #       else
5429             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5430 #       endif
5431 #   else
5432         printf("%d\n",  __GLIBC__);
5433 #   endif
5434     return 0;
5435 #else
5436     return 1;
5437 #endif
5438 }
5439 EOCP
5440 set try
5441 if eval $compile_ok && $run ./try > glibc.ver; then
5442         val="$define"
5443         gnulibc_version=`$cat glibc.ver`
5444         echo "You are using the GNU C Library version $gnulibc_version"
5445 else
5446         val="$undef"
5447         gnulibc_version=''
5448         echo "You are not using the GNU C Library"
5449 fi
5450 $rm -f try try.* glibc.ver
5451 set d_gnulibc
5452 eval $setvar
5453
5454 : see if nm is to be used to determine whether a symbol is defined or not
5455 case "$usenm" in
5456 '')
5457         dflt=''
5458         case "$d_gnulibc" in
5459         "$define")
5460                 echo " "
5461                 echo "nm probably won't work on the GNU C Library." >&4
5462                 dflt=n
5463                 ;;
5464         esac
5465         case "$dflt" in
5466         '') 
5467                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5468                         echo " "
5469                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5470                         echo "'nm' won't be sufficient on this sytem." >&4
5471                         dflt=n
5472                 fi
5473                 if $test "$osname" = plan9; then
5474                         echo " "
5475                         echo "Whoops!  Nm won't work on Plan 9!" >&4
5476                         dflt=n
5477                 fi
5478                 ;;
5479         esac
5480         case "$dflt" in
5481         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5482                 if $test $dflt -gt 20; then
5483                         dflt=y
5484                 else
5485                         dflt=n
5486                 fi
5487                 ;;
5488         esac
5489         ;;
5490 *)
5491         case "$usenm" in
5492         true|$define) dflt=y;;
5493         *) dflt=n;;
5494         esac
5495         ;;
5496 esac
5497 $cat <<EOM
5498
5499 I can use $nm to extract the symbols from your C libraries. This
5500 is a time consuming task which may generate huge output on the disk (up
5501 to 3 megabytes) but that should make the symbols extraction faster. The
5502 alternative is to skip the 'nm' extraction part and to compile a small
5503 test program instead to determine whether each symbol is present. If
5504 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5505 this may be the best solution.
5506
5507 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5508
5509 EOM
5510 rp="Shall I use $nm to extract C symbols from the libraries?"
5511 . ./myread
5512 case "$ans" in
5513 [Nn]*) usenm=false;;
5514 *) usenm=true;;
5515 esac
5516
5517 runnm=$usenm
5518 case "$reuseval" in
5519 true) runnm=false;;
5520 esac
5521
5522 : nm options which may be necessary
5523 case "$nm_opt" in
5524 '') if $test -f /mach_boot; then
5525                 nm_opt=''       # Mach
5526         elif $test -d /usr/ccs/lib; then
5527                 nm_opt='-p'     # Solaris (and SunOS?)
5528         elif $test -f /dgux; then
5529                 nm_opt='-p'     # DG-UX
5530         elif $test -f /lib64/rld; then
5531                 nm_opt='-p'     # 64-bit Irix
5532         else
5533                 nm_opt=''
5534         fi;;
5535 esac
5536
5537 : nm options which may be necessary for shared libraries but illegal
5538 : for archive libraries.  Thank you, Linux.
5539 case "$nm_so_opt" in
5540 '')     case "$myuname" in
5541         *linux*)
5542                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5543                         nm_so_opt='--dynamic'
5544                 fi
5545                 ;;
5546         esac
5547         ;;
5548 esac
5549
5550 case "$runnm" in
5551 true)
5552 : get list of predefined functions in a handy place
5553 echo " "
5554 case "$libc" in
5555 '') libc=unknown
5556         case "$libs" in
5557         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5558         esac
5559         ;;
5560 esac
5561 case "$libs" in
5562 '') ;;
5563 *)  for thislib in $libs; do
5564         case "$thislib" in
5565         -lc|-lc_s)
5566                 : Handle C library specially below.
5567                 ;;
5568         -l*)
5569                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5570                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5571                         :
5572                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5573                         :
5574                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5575                         :
5576                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5577                         :
5578                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5579                         :
5580                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5581                         :
5582                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5583                         :
5584                 else
5585                         try=''
5586                 fi
5587                 libnames="$libnames $try"
5588                 ;;
5589         *) libnames="$libnames $thislib" ;;
5590         esac
5591         done
5592         ;;
5593 esac
5594 xxx=normal
5595 case "$libc" in
5596 unknown)
5597         set /lib/libc.$so
5598         for xxx in $libpth; do
5599                 $test -r $1 || set $xxx/libc.$so
5600                 : The messy sed command sorts on library version numbers.
5601                 $test -r $1 || \
5602                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5603                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5604                                 h
5605                                 s/[0-9][0-9]*/0000&/g
5606                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5607                                 G
5608                                 s/\n/ /' | \
5609                          $sort | $sed -e 's/^.* //'`
5610                 eval set \$$#
5611         done
5612         $test -r $1 || set /usr/ccs/lib/libc.$so
5613         $test -r $1 || set /lib/libsys_s$_a
5614         ;;
5615 *)
5616         set blurfl
5617         ;;
5618 esac
5619 if $test -r "$1"; then
5620         echo "Your (shared) C library seems to be in $1."
5621         libc="$1"
5622 elif $test -r /lib/libc && $test -r /lib/clib; then
5623         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5624         xxx=apollo
5625         libc='/lib/clib /lib/libc'
5626         if $test -r /lib/syslib; then
5627                 echo "(Your math library is in /lib/syslib.)"
5628                 libc="$libc /lib/syslib"
5629         fi
5630 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5631         echo "Your C library seems to be in $libc, as you said before."
5632 elif $test -r $incpath/usr/lib/libc$_a; then
5633         libc=$incpath/usr/lib/libc$_a;
5634         echo "Your C library seems to be in $libc.  That's fine."
5635 elif $test -r /lib/libc$_a; then
5636         libc=/lib/libc$_a;
5637         echo "Your C library seems to be in $libc.  You're normal."
5638 else
5639         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5640                 :
5641         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5642                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5643         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5644                 :
5645         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5646                 :
5647         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5648                 :
5649         else
5650                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5651         fi
5652         if $test -r "$tans"; then
5653                 echo "Your C library seems to be in $tans, of all places."
5654                 libc=$tans
5655         else
5656                 libc='blurfl'
5657         fi
5658 fi
5659 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5660         dflt="$libc"
5661         cat <<EOM
5662
5663 If the guess above is wrong (which it might be if you're using a strange
5664 compiler, or your machine supports multiple models), you can override it here.
5665
5666 EOM
5667 else
5668         dflt=''
5669         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5670         cat >&4 <<EOM
5671 I can't seem to find your C library.  I've looked in the following places:
5672
5673 EOM
5674         $sed 's/^/      /' libpath
5675         cat <<EOM
5676
5677 None of these seems to contain your C library. I need to get its name...
5678
5679 EOM
5680 fi
5681 fn=f
5682 rp='Where is your C library?'
5683 . ./getfile
5684 libc="$ans"
5685
5686 echo " "
5687 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5688 set X `cat libnames`
5689 shift
5690 xxx=files
5691 case $# in 1) xxx=file; esac
5692 echo "Extracting names from the following $xxx for later perusal:" >&4
5693 echo " "
5694 $sed 's/^/      /' libnames >&4
5695 echo " "
5696 $echo $n "This may take a while...$c" >&4
5697
5698 for file in $*; do
5699         case $file in
5700         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5701         *) $nm $nm_opt $file 2>/dev/null;;
5702         esac
5703 done >libc.tmp
5704
5705 $echo $n ".$c"
5706 $grep fprintf libc.tmp > libc.ptf
5707 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5708 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5709 xxx='[ADTSIW]'
5710 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5711         eval $xscan;\
5712         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5713                 eval $xrun
5714 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5715         eval $xscan;\
5716         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5717                 eval $xrun
5718 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5719         eval $xscan;\
5720         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5721                 eval $xrun
5722 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5723         eval $xscan;\
5724         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5725                 eval $xrun
5726 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5727         eval $xscan;\
5728         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5729                 eval $xrun
5730 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5731         eval $xscan;\
5732         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5733                 eval $xrun
5734 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5735                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5736         eval $xscan;\
5737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5738                 eval $xrun
5739 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5740         eval $xscan;\
5741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5742                 eval $xrun
5743 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5744         eval $xscan;\
5745         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5746                 eval $xrun
5747 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5748         eval $xscan;\
5749         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5750                 eval $xrun
5751 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5752         eval $xscan;\
5753         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5754                 eval $xrun
5755 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5756         eval $xscan;\
5757         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5758                 eval $xrun
5759 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5760         eval $xscan;\
5761         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5762                 eval $xrun
5763 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5764         eval $xscan;\
5765         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5766                 eval $xrun
5767 else
5768         $nm -p $* 2>/dev/null >libc.tmp
5769         $grep fprintf libc.tmp > libc.ptf
5770         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5771                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5772         then
5773                 nm_opt='-p'
5774                 eval $xrun
5775         else
5776                 echo " "
5777                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5778                 com=''
5779                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5780                         for thisname in $libnames $libc; do
5781                                 $ar t $thisname >>libc.tmp
5782                         done
5783                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5784                         echo "Ok." >&4
5785                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5786                         # Repeat libc to extract forwarders to DLL entries too
5787                         for thisname in $libnames $libc; do
5788                                 $ar tv $thisname >>libc.tmp
5789                                 # Revision 50 of EMX has bug in $ar.
5790                                 # it will not extract forwarders to DLL entries
5791                                 # Use emximp which will extract exactly them.
5792                                 emximp -o tmp.imp $thisname \
5793                                     2>/dev/null && \
5794                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5795                                     < tmp.imp >>libc.tmp
5796                                 $rm tmp.imp
5797                         done
5798                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5799                         echo "Ok." >&4
5800                 else
5801                         echo "$ar didn't seem to work right." >&4
5802                         echo "Maybe this is a Cray...trying bld instead..." >&4
5803                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5804                         then
5805                                 for thisname in $libnames; do
5806                                         bld t $libnames | \
5807                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5808                                         $ar t $thisname >>libc.tmp
5809                                 done
5810                                 echo "Ok." >&4
5811                         else
5812                                 echo "That didn't work either.  Giving up." >&4
5813                                 exit 1
5814                         fi
5815                 fi
5816         fi
5817 fi
5818 nm_extract="$com"
5819 case "$PASE" in
5820 define)
5821     echo " "
5822     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5823     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5824     ;;
5825 *)  if $test -f /lib/syscalls.exp; then
5826         echo " "
5827         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5828         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5829     fi
5830     ;;
5831 esac
5832 ;;
5833 esac
5834 $rm -f libnames libpath
5835
5836 : is a C symbol defined?
5837 csym='tlook=$1;
5838 case "$3" in
5839 -v) tf=libc.tmp; tc=""; tdc="";;
5840 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5841 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5842 esac;
5843 tx=yes;
5844 case "$reuseval-$4" in
5845 true-) ;;
5846 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5847 esac;
5848 case "$tx" in
5849 yes)
5850         case "$runnm" in
5851         true)
5852                 if $contains $tlook $tf >/dev/null 2>&1;
5853                 then tval=true;
5854                 else tval=false;
5855                 fi;;
5856         *)
5857                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5858                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5859                 then tval=true;
5860                 else tval=false;
5861                 fi;
5862                 $rm -f t t.c;;
5863         esac;;
5864 *)
5865         case "$tval" in
5866         $define) tval=true;;
5867         *) tval=false;;
5868         esac;;
5869 esac;
5870 eval "$2=$tval"'
5871
5872 : define an is-in-libc? function
5873 inlibc='echo " "; td=$define; tu=$undef;
5874 sym=$1; var=$2; eval "was=\$$2";
5875 tx=yes;
5876 case "$reuseval$was" in
5877 true) ;;
5878 true*) tx=no;;
5879 esac;
5880 case "$tx" in
5881 yes)
5882         set $sym tres -f;
5883         eval $csym;
5884         case "$tres" in
5885         true)
5886                 echo "$sym() found." >&4;
5887                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5888         *)
5889                 echo "$sym() NOT found." >&4;
5890                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5891         esac;;
5892 *)
5893         case "$was" in
5894         $define) echo "$sym() found." >&4;;
5895         *) echo "$sym() NOT found." >&4;;
5896         esac;;
5897 esac'
5898
5899 : see if sqrtl exists
5900 set sqrtl d_sqrtl
5901 eval $inlibc
5902
5903 hasproto='varname=$1; func=$2; shift; shift;
5904 while $test $# -ge 2; do
5905         case "$1" in
5906         $define) echo "#include <$2>";;
5907         esac ;
5908     shift 2;
5909 done > try.c;
5910 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5911 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5912         echo "$func() prototype found.";
5913         val="$define";
5914 else
5915         echo "$func() prototype NOT found.";
5916         val="$undef";
5917 fi;
5918 set $varname;
5919 eval $setvar;
5920 $rm -f try.c tryout.c'
5921
5922 : check for length of double
5923 echo " "
5924 case "$doublesize" in
5925 '')
5926         echo "Checking to see how big your double precision numbers are..." >&4
5927         $cat >try.c <<'EOCP'
5928 #include <stdio.h>
5929 int main()
5930 {
5931     printf("%d\n", (int)sizeof(double));
5932     exit(0);
5933 }
5934 EOCP
5935         set try
5936         if eval $compile_ok; then
5937                 doublesize=`$run ./try`
5938                 echo "Your double is $doublesize bytes long."
5939         else
5940                 dflt='8'
5941                 echo "(I can't seem to compile the test program.  Guessing...)"
5942                 rp="What is the size of a double precision number (in bytes)?"
5943                 . ./myread
5944                 doublesize="$ans"
5945         fi
5946         ;;
5947 esac
5948 $rm -f try.c try
5949
5950 : check for long doubles
5951 echo " "
5952 echo "Checking to see if you have long double..." >&4
5953 echo 'int main() { long double x = 7.0; }' > try.c
5954 set try
5955 if eval $compile; then
5956         val="$define"
5957         echo "You have long double."
5958 else
5959         val="$undef"
5960         echo "You do not have long double."
5961 fi
5962 $rm try.*
5963 set d_longdbl
5964 eval $setvar
5965
5966 : check for length of long double
5967 case "${d_longdbl}${longdblsize}" in
5968 $define)
5969         echo " "
5970         echo "Checking to see how big your long doubles are..." >&4
5971         $cat >try.c <<'EOCP'
5972 #include <stdio.h>
5973 int main()
5974 {
5975         printf("%d\n", sizeof(long double));
5976 }
5977 EOCP
5978         set try
5979         set try
5980         if eval $compile; then
5981                 longdblsize=`$run ./try`
5982                 echo "Your long doubles are $longdblsize bytes long."
5983         else
5984                 dflt='8'
5985                 echo " "
5986                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5987                 rp="What is the size of a long double (in bytes)?"
5988                 . ./myread
5989                 longdblsize="$ans"
5990         fi
5991         if $test "X$doublesize" = "X$longdblsize"; then
5992                 echo "(That isn't any different from an ordinary double.)"
5993         fi      
5994         ;;
5995 esac
5996 $rm -f try.* try
5997
5998 echo " "
5999
6000 if $test X"$d_longdbl" = X"$define"; then
6001
6002 echo "Checking how to print long doubles..." >&4
6003
6004 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6005         $cat >try.c <<'EOCP'
6006 #include <sys/types.h>
6007 #include <stdio.h>
6008 int main() {
6009   double d = 123.456;
6010   printf("%.3f\n", d);
6011 }
6012 EOCP
6013         set try
6014         if eval $compile; then
6015                 yyy=`$run ./try`
6016                 case "$yyy" in
6017                 123.456)
6018                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6019                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6020                         echo "We will use %f."
6021                         ;;
6022                 esac
6023         fi
6024 fi
6025
6026 if $test X"$sPRIfldbl" = X; then
6027         $cat >try.c <<'EOCP'
6028 #include <sys/types.h>
6029 #include <stdio.h>
6030 int main() {
6031   long double d = 123.456;
6032   printf("%.3Lf\n", d);
6033 }
6034 EOCP
6035         set try
6036         if eval $compile; then
6037                 yyy=`$run ./try`
6038                 case "$yyy" in
6039                 123.456)
6040                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6041                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6042                         echo "We will use %Lf."
6043                         ;;
6044                 esac
6045         fi
6046 fi
6047
6048 if $test X"$sPRIfldbl" = X; then
6049         $cat >try.c <<'EOCP'
6050 #include <sys/types.h>
6051 #include <stdio.h>
6052 int main() {
6053   long double d = 123.456;
6054   printf("%.3llf\n", d);
6055 }
6056 EOCP
6057         set try
6058         if eval $compile; then
6059                 yyy=`$run ./try`
6060                 case "$yyy" in
6061                 123.456)
6062                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6063                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6064                         echo "We will use %llf."
6065                         ;;
6066                 esac
6067         fi
6068 fi
6069
6070 if $test X"$sPRIfldbl" = X; then
6071         $cat >try.c <<'EOCP'
6072 #include <sys/types.h>
6073 #include <stdio.h>
6074 int main() {
6075   long double d = 123.456;
6076   printf("%.3lf\n", d);
6077 }
6078 EOCP
6079         set try
6080         if eval $compile; then
6081                 yyy=`$run ./try`
6082                 case "$yyy" in
6083                 123.456)
6084                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6085                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6086                         echo "We will use %lf."
6087                         ;;
6088                 esac
6089         fi
6090 fi
6091
6092 if $test X"$sPRIfldbl" = X; then
6093         echo "Cannot figure out how to print long doubles." >&4
6094 else
6095         sSCNfldbl=$sPRIfldbl    # expect consistency
6096 fi
6097
6098 $rm -f try try.*
6099
6100 fi # d_longdbl
6101
6102 case "$sPRIfldbl" in
6103 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6104         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6105         d_SCNfldbl="$undef";
6106         ;;
6107 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6108         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6109         d_SCNfldbl="$define";
6110         ;;
6111 esac
6112
6113 : see if modfl exists
6114 set modfl d_modfl
6115 eval $inlibc
6116
6117 : see if prototype for modfl is available
6118 echo " "
6119 set d_modflproto modfl math.h
6120 eval $hasproto
6121
6122 d_modfl_pow32_bug="$undef"
6123
6124 case "$d_longdbl$d_modfl" in
6125 $define$define)
6126         $cat <<EOM
6127 Checking to see whether your modfl() is okay for large values...
6128 EOM
6129 $cat >try.c <<EOCP
6130 #include <math.h> 
6131 #include <stdio.h>
6132 EOCP
6133 if $test "X$d_modflproto" != "X$define"; then
6134         $cat >>try.c <<EOCP
6135 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6136 long double modfl (long double, long double *);
6137 EOCP
6138 fi
6139 $cat >>try.c <<EOCP
6140 int main() {
6141     long double nv = 4294967303.15;
6142     long double v, w;
6143     v = modfl(nv, &w);         
6144 #ifdef __GLIBC__
6145     printf("glibc");
6146 #endif
6147     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6148     return 0;
6149 }
6150 EOCP
6151         case "$osname:$gccversion" in
6152         aix:)   saveccflags="$ccflags"
6153                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6154         esac
6155         set try
6156         if eval $compile; then
6157                 foo=`$run ./try`
6158                 case "$foo" in
6159                 *" 4294967303.150000 1.150000 4294967302.000000")
6160                         echo >&4 "Your modfl() is broken for large values."
6161                         d_modfl_pow32_bug="$define"
6162                         case "$foo" in
6163                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6164                         ;;
6165                         esac
6166                         ;;
6167                 *" 4294967303.150000 0.150000 4294967303.000000")
6168                         echo >&4 "Your modfl() seems okay for large values."
6169                         ;;
6170                 *)      echo >&4 "I don't understand your modfl() at all."
6171                         d_modfl="$undef"
6172                         ;;
6173                 esac
6174                 $rm -f try.* try core core.try.*
6175         else
6176                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6177                 d_modfl="$undef"
6178         fi
6179         case "$osname:$gccversion" in
6180         aix:)   ccflags="$saveccflags" ;; # restore
6181         esac
6182         ;;
6183 esac
6184
6185 case "$ccflags" in
6186 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6187 esac
6188
6189 case "$uselongdouble" in
6190 $define|true|[yY]*)     dflt='y';;
6191 *) dflt='n';;
6192 esac
6193 cat <<EOM
6194
6195 Perl can be built to take advantage of long doubles which
6196 (if available) may give more accuracy and range for floating point numbers.
6197
6198 If this doesn't make any sense to you, just accept the default '$dflt'.
6199 EOM
6200 rp='Try to use long doubles if available?'
6201 . ./myread
6202 case "$ans" in
6203 y|Y)    val="$define"   ;;
6204 *)      val="$undef"    ;;
6205 esac
6206 set uselongdouble
6207 eval $setvar
6208
6209 case "$uselongdouble" in
6210 true|[yY]*) uselongdouble="$define" ;;
6211 esac
6212
6213 case "$uselongdouble" in
6214 $define)
6215 : Look for a hint-file generated 'call-back-unit'.  If the
6216 : user has specified that long doubles should be used,
6217 : we may need to set or change some other defaults.
6218         if $test -f uselongdouble.cbu; then
6219                 echo "Your platform has some specific hints for long doubles, using them..."
6220                 . ./uselongdouble.cbu
6221         else
6222                 $cat <<EOM
6223 (Your platform doesn't have any specific hints for long doubles.)
6224 EOM
6225         fi
6226         ;;
6227 esac
6228
6229 message=X
6230 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6231 $define:$define:$define)
6232         : You have both
6233         ;;
6234 $define:$define:$undef)
6235         message="I could not find modfl"
6236         ;;
6237 $define:$undef:$define)
6238         message="I could not find sqrtl"
6239         ;;
6240 $define:$undef:$undef)
6241         message="I found neither sqrtl nor modfl"
6242         ;;
6243 esac
6244
6245 if $test "$message" != X; then
6246         $cat <<EOM >&4
6247
6248 *** You requested the use of long doubles but you do not seem to have
6249 *** the mathematic functions for long doubles.
6250 *** ($message)
6251 *** I'm disabling the use of long doubles.
6252
6253 EOM
6254
6255         uselongdouble=$undef
6256 fi
6257
6258 : determine the architecture name
6259 echo " "
6260 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6261         tarch=`arch`"-$osname"
6262 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6263         if uname -m > tmparch 2>&1 ; then
6264                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6265                         -e 's/$/'"-$osname/" tmparch`
6266         else
6267                 tarch="$osname"
6268         fi
6269         $rm -f tmparch
6270 else
6271         tarch="$osname"
6272 fi
6273 case "$myarchname" in
6274 ''|"$tarch") ;;
6275 *)
6276         echo "(Your architecture name used to be $myarchname.)"
6277         archname=''
6278         ;;
6279 esac
6280 case "$targetarch" in
6281 '') ;;
6282 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6283 esac
6284 myarchname="$tarch"
6285 case "$archname" in
6286 '') dflt="$tarch";;
6287 *) dflt="$archname";;
6288 esac
6289 rp='What is your architecture name'
6290 . ./myread
6291 archname="$ans"
6292 case "$usethreads" in
6293 $define)
6294         echo "Threads selected." >&4
6295         case "$archname" in
6296         *-thread*) echo "...and architecture name already has -thread." >&4
6297                 ;;
6298         *)      archname="$archname-thread"
6299                 echo "...setting architecture name to $archname." >&4
6300                 ;;
6301         esac
6302         ;;
6303 esac
6304 case "$usemultiplicity" in
6305 $define)
6306         echo "Multiplicity selected." >&4
6307         case "$archname" in
6308         *-multi*) echo "...and architecture name already has -multi." >&4
6309                 ;;
6310         *)      archname="$archname-multi"
6311                 echo "...setting architecture name to $archname." >&4
6312                 ;;
6313         esac
6314         ;;
6315 esac
6316 case "$use64bitint$use64bitall" in
6317 *"$define"*)
6318         case "$archname64" in
6319         '')
6320                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6321                 ;;
6322         *)
6323                 case "$use64bitint" in
6324                 "$define") echo "64 bit integers selected." >&4 ;;
6325                 esac
6326                 case "$use64bitall" in
6327                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6328                 esac
6329                 case "$archname" in
6330                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6331                         ;;
6332                 *)      archname="$archname-$archname64"
6333                         echo "...setting architecture name to $archname." >&4
6334                         ;;
6335                 esac
6336                 ;;
6337         esac
6338 esac
6339 case "$uselongdouble" in
6340 $define)
6341         echo "Long doubles selected." >&4
6342         case "$longdblsize" in
6343         $doublesize)
6344                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6345                 ;;
6346         *)
6347                 case "$archname" in
6348                 *-ld*) echo "...and architecture name already has -ld." >&4
6349                         ;;
6350                 *)      archname="$archname-ld"
6351                         echo "...setting architecture name to $archname." >&4
6352                         ;;
6353                 esac
6354                 ;;
6355         esac
6356         ;;
6357 esac
6358 case "$useperlio" in
6359 $define)
6360         echo "Perlio selected." >&4
6361         ;;
6362 *)
6363         echo "Perlio not selected, using stdio." >&4
6364         case "$archname" in
6365         *-stdio*) echo "...and architecture name already has -stdio." >&4
6366                 ;;
6367         *)      archname="$archname-stdio"
6368                 echo "...setting architecture name to $archname." >&4
6369                 ;;
6370         esac
6371         ;;
6372 esac
6373
6374 : determine root of directory hierarchy where package will be installed.
6375 case "$prefix" in
6376 '')
6377         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6378         ;;
6379 *?/)
6380         dflt=`echo "$prefix" | sed 's/.$//'`
6381         ;;
6382 *)
6383         dflt="$prefix"
6384         ;;
6385 esac
6386 $cat <<EOM
6387
6388 By default, $package will be installed in $dflt/bin, manual pages
6389 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6390 installation directories. Typically this is something like /usr/local.
6391 If you wish to have binaries under /usr/bin but other parts of the
6392 installation under /usr/local, that's ok: you will be prompted
6393 separately for each of the installation directories, the prefix being
6394 only used to set the defaults.
6395
6396 EOM
6397 fn=d~
6398 rp='Installation prefix to use?'
6399 . ./getfile
6400 oldprefix=''
6401 case "$prefix" in
6402 '') ;;
6403 *)
6404         case "$ans" in
6405         "$prefix") ;;
6406         *) oldprefix="$prefix";;
6407         esac
6408         ;;
6409 esac
6410 prefix="$ans"
6411 prefixexp="$ansexp"
6412
6413 case "$afsroot" in
6414 '')     afsroot=/afs ;;
6415 *)      afsroot=$afsroot ;;
6416 esac
6417
6418 : is AFS running?
6419 echo " "
6420 case "$afs" in
6421 $define|true)   afs=true ;;
6422 $undef|false)   afs=false ;;
6423 *)      if test -d $afsroot; then
6424                 afs=true
6425         else
6426                 afs=false
6427         fi
6428         ;;
6429 esac
6430 if $afs; then
6431         echo "AFS may be running... I'll be extra cautious then..." >&4
6432 else
6433         echo "AFS does not seem to be running..." >&4
6434 fi
6435
6436 : determine installation prefix for where package is to be installed.
6437 if $afs; then 
6438 $cat <<EOM
6439
6440 Since you are running AFS, I need to distinguish the directory in which
6441 files will reside from the directory in which they are installed (and from
6442 which they are presumably copied to the former directory by occult means).
6443
6444 EOM
6445         case "$installprefix" in
6446         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6447         *) dflt="$installprefix";;
6448         esac
6449 else
6450 $cat <<EOM
6451
6452 In some special cases, particularly when building $package for distribution,
6453 it is convenient to distinguish the directory in which files should be
6454 installed from the directory ($prefix) in which they will
6455 eventually reside.  For most users, these two directories are the same.
6456
6457 EOM
6458         case "$installprefix" in
6459         '') dflt=$prefix ;;
6460         *) dflt=$installprefix;;
6461         esac
6462 fi
6463 fn=d~
6464 rp='What installation prefix should I use for installing files?'
6465 . ./getfile
6466 installprefix="$ans"
6467 installprefixexp="$ansexp"
6468
6469 : set the prefixit variable, to compute a suitable default value
6470 prefixit='case "$3" in
6471 ""|none)
6472         case "$oldprefix" in
6473         "") eval "$1=\"\$$2\"";;
6474         *)
6475                 case "$3" in
6476                 "") eval "$1=";;
6477                 none)
6478                         eval "tp=\"\$$2\"";
6479                         case "$tp" in
6480                         ""|" ") eval "$1=\"\$$2\"";;
6481                         *) eval "$1=";;
6482                         esac;;
6483                 esac;;
6484         esac;;
6485 *)
6486         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6487         case "$tp" in
6488         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6489         /*-$oldprefix/*|\~*-$oldprefix/*)
6490                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6491         *) eval "$1=\"\$$2\"";;
6492         esac;;
6493 esac'
6494
6495 : get the patchlevel
6496 echo " "
6497 echo "Getting the current patchlevel..." >&4
6498 if $test -r $rsrc/patchlevel.h;then
6499         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6500         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6501         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6502         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6503         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6504         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6505        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6506 else
6507         revision=0
6508         patchlevel=0
6509         subversion=0
6510         api_revision=0
6511         api_version=0
6512         api_subversion=0
6513         perl_patchlevel=0
6514         $echo "(You do not have patchlevel.h.  Eek.)"
6515 fi
6516 if $test -r $rsrc/.patch ; then  
6517         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6518                 perl_patchlevel=`cat $rsrc/.patch`
6519         fi
6520 fi
6521 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6522 version_patchlevel_string="version $patchlevel subversion $subversion"
6523 case "$perl_patchlevel" in
6524 0|'') ;;
6525 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6526 esac
6527
6528 $echo "(You have $package $version_patchlevel_string.)"
6529
6530 case "$osname" in
6531 dos|vms)
6532         : XXX Should be a Configure test for double-dots in filenames.
6533         version=`echo $revision $patchlevel $subversion | \
6534                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6535         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6536                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6537         ;;
6538 *)
6539         version=`echo $revision $patchlevel $subversion | \
6540                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6541         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6542                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6543         ;;
6544 esac
6545 : Special case the 5.005_xx maintenance series, which used 5.005
6546 : without any subversion label as a subdirectory in $sitelib
6547 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6548         api_versionstring='5.005'
6549 fi
6550
6551 : determine installation style
6552 : For now, try to deduce it from prefix unless it is already set.
6553 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6554 case "$installstyle" in
6555 '')     case "$prefix" in
6556                 *perl*) dflt='lib';;
6557                 *) dflt='lib/perl5' ;;
6558         esac
6559         ;;
6560 *)      dflt="$installstyle" ;;
6561 esac
6562 : Probably not worth prompting for this since we prompt for all
6563 : the directories individually, and the prompt would be too long and
6564 : confusing anyway.
6565 installstyle=$dflt
6566
6567 : determine where private library files go
6568 : Usual default is /usr/local/lib/perl5/$version.
6569 : Also allow things like /opt/perl/lib/$version, since 
6570 : /opt/perl/lib/perl5... would be redundant.
6571 : The default "style" setting is made in installstyle.U
6572 case "$installstyle" in
6573 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6574 *)       set dflt privlib lib/$version ;;
6575 esac
6576 eval $prefixit
6577 $cat <<EOM
6578
6579 There are some auxiliary files for $package that need to be put into a
6580 private library directory that is accessible by everyone.
6581
6582 EOM
6583 fn=d~+
6584 rp='Pathname where the private library files will reside?'
6585 . ./getfile
6586 privlib="$ans"
6587 privlibexp="$ansexp"
6588 : Change installation prefix, if necessary.
6589 if $test X"$prefix" != X"$installprefix"; then
6590         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6591 else
6592         installprivlib="$privlibexp"
6593 fi
6594
6595 : set the prefixup variable, to restore leading tilda escape
6596 prefixup='case "$prefixexp" in
6597 "$prefix") ;;
6598 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6599 esac'
6600
6601 : determine where public architecture dependent libraries go
6602 set archlib archlib
6603 eval $prefixit
6604 : privlib default is /usr/local/lib/$package/$version
6605 : archlib default is /usr/local/lib/$package/$version/$archname
6606 : privlib may have an optional trailing /share.
6607 tdflt=`echo $privlib | $sed 's,/share$,,'`
6608 tdflt=$tdflt/$archname
6609 case "$archlib" in
6610 '')     dflt=$tdflt
6611         ;;
6612 *)      dflt="$archlib"
6613     ;;
6614 esac
6615 $cat <<EOM
6616
6617 $spackage contains architecture-dependent library files.  If you are
6618 sharing libraries in a heterogeneous environment, you might store
6619 these files in a separate location.  Otherwise, you can just include
6620 them with the rest of the public library files.
6621
6622 EOM
6623 fn=d+~
6624 rp='Where do you want to put the public architecture-dependent libraries?'
6625 . ./getfile
6626 archlib="$ans"
6627 archlibexp="$ansexp"
6628 if $test X"$archlib" = X"$privlib"; then
6629         d_archlib="$undef"
6630 else
6631         d_archlib="$define"
6632 fi
6633 : Change installation prefix, if necessary.
6634 if $test X"$prefix" != X"$installprefix"; then
6635         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6636 else
6637         installarchlib="$archlibexp"
6638 fi
6639
6640 : see if setuid scripts can be secure
6641 $cat <<EOM
6642
6643 Some kernels have a bug that prevents setuid #! scripts from being
6644 secure.  Some sites have disabled setuid #! scripts because of this.
6645
6646 First let's decide if your kernel supports secure setuid #! scripts.
6647 (If setuid #! scripts would be secure but have been disabled anyway,
6648 don't say that they are secure if asked.)
6649
6650 EOM
6651
6652 val="$undef"
6653 if $test -d /dev/fd; then
6654         echo "#!$ls" >reflect
6655         chmod +x,u+s reflect
6656         ./reflect >flect 2>&1
6657         if $contains "/dev/fd" flect >/dev/null; then
6658                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6659                 val="$define"
6660         else
6661                 $cat <<EOM
6662 If you are not sure if they are secure, I can check but I'll need a
6663 username and password different from the one you are using right now.
6664 If you don't have such a username or don't want me to test, simply
6665 enter 'none'.
6666
6667 EOM
6668                 rp='Other username to test security of setuid scripts with?'
6669                 dflt='none'
6670                 . ./myread
6671                 case "$ans" in
6672                 n|none)
6673                         case "$d_suidsafe" in
6674                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6675                                 dflt=n;;
6676                         "$undef")
6677                                 echo "Well, the $hint value is *not* secure." >&4
6678                                 dflt=n;;
6679                         *)      echo "Well, the $hint value *is* secure." >&4
6680                                 dflt=y;;
6681                         esac
6682                         ;;
6683                 *)
6684                         $rm -f reflect flect
6685                         echo "#!$ls" >reflect
6686                         chmod +x,u+s reflect
6687                         echo >flect
6688                         chmod a+w flect
6689                         echo '"su" will (probably) prompt you for '"$ans's password."
6690                         su $ans -c './reflect >flect'
6691                         if $contains "/dev/fd" flect >/dev/null; then
6692                                 echo "Okay, it looks like setuid scripts are secure." >&4
6693                                 dflt=y
6694                         else
6695                                 echo "I don't think setuid scripts are secure." >&4
6696                                 dflt=n
6697                         fi
6698                         ;;
6699                 esac
6700                 rp='Does your kernel have *secure* setuid scripts?'
6701                 . ./myread
6702                 case "$ans" in
6703                 [yY]*)  val="$define";;
6704                 *)      val="$undef";;
6705                 esac
6706         fi
6707 else
6708         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6709         echo "(That's for file descriptors, not floppy disks.)"
6710         val="$undef"
6711 fi
6712 set d_suidsafe
6713 eval $setvar
6714
6715 $rm -f reflect flect
6716
6717 : now see if they want to do setuid emulation
6718 echo " "
6719 val="$undef"
6720 case "$d_suidsafe" in
6721 "$define")
6722         val="$undef"
6723         echo "No need to emulate SUID scripts since they are secure here." >&4
6724         ;;
6725 *)
6726         $cat <<EOM
6727 Some systems have disabled setuid scripts, especially systems where
6728 setuid scripts cannot be secure.  On systems where setuid scripts have
6729 been disabled, the setuid/setgid bits on scripts are currently
6730 useless.  It is possible for $package to detect those bits and emulate
6731 setuid/setgid in a secure fashion.  This emulation will only work if
6732 setuid scripts have been disabled in your kernel.
6733
6734 EOM
6735         case "$d_dosuid" in
6736         "$define") dflt=y ;;
6737         *) dflt=n ;;
6738         esac
6739         rp="Do you want to do setuid/setgid emulation?"
6740         . ./myread
6741         case "$ans" in
6742         [yY]*)  val="$define";;
6743         *)      val="$undef";;
6744         esac
6745         ;;
6746 esac
6747 set d_dosuid
6748 eval $setvar
6749
6750 : see if this is a malloc.h system
6751 : we want a real compile instead of Inhdr because some systems have a
6752 : malloc.h that just gives a compile error saying to use stdlib.h instead
6753 echo " "
6754 $cat >try.c <<EOCP
6755 #include <stdlib.h>
6756 #include <malloc.h>
6757 int main () { return 0; }
6758 EOCP
6759 set try
6760 if eval $compile; then
6761     echo "<malloc.h> found." >&4
6762     val="$define"
6763 else
6764     echo "<malloc.h> NOT found." >&4
6765     val="$undef"
6766 fi
6767 $rm -f try.c try
6768 set i_malloc
6769 eval $setvar
6770
6771 : see if stdlib is available
6772 set stdlib.h i_stdlib
6773 eval $inhdr
6774
6775 : check for void type
6776 echo " "
6777 echo "Checking to see how well your C compiler groks the void type..." >&4
6778 case "$voidflags" in
6779 '')
6780         $cat >try.c <<'EOCP'
6781 #if TRY & 1
6782 void sub() {
6783 #else
6784 sub() {
6785 #endif
6786         extern void moo();      /* function returning void */
6787         void (*goo)();          /* ptr to func returning void */
6788 #if TRY & 8
6789         void *hue;              /* generic ptr */
6790 #endif
6791 #if TRY & 2
6792         void (*foo[10])();
6793 #endif
6794
6795 #if TRY & 4
6796         if(goo == moo) {
6797                 exit(0);
6798         }
6799 #endif
6800         exit(0);
6801 }
6802 int main() { sub(); }
6803 EOCP
6804         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6805                 voidflags=$defvoidused
6806         echo "Good.  It appears to support void to the level $package wants.">&4
6807                 if $contains warning .out >/dev/null 2>&1; then
6808                         echo "However, you might get some warnings that look like this:"
6809                         $cat .out
6810                 fi
6811         else
6812 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6813                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6814                         echo "It supports 1..."
6815                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6816                                 echo "It also supports 2..."
6817                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6818                                         voidflags=7
6819                                         echo "And it supports 4 but not 8 definitely."
6820                                 else
6821                                         echo "It doesn't support 4..."
6822                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6823                                                 voidflags=11
6824                                                 echo "But it supports 8."
6825                                         else
6826                                                 voidflags=3
6827                                                 echo "Neither does it support 8."
6828                                         fi
6829                                 fi
6830                         else
6831                                 echo "It does not support 2..."
6832                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6833                                         voidflags=13
6834                                         echo "But it supports 4 and 8."
6835                                 else
6836                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6837                                                 voidflags=5
6838                                                 echo "And it supports 4 but has not heard about 8."
6839                                         else
6840                                                 echo "However it supports 8 but not 4."
6841                                         fi
6842                                 fi
6843                         fi
6844                 else
6845                         echo "There is no support at all for void."
6846                         voidflags=0
6847                 fi
6848         fi
6849 esac
6850 case "$voidflags" in
6851 "$defvoidused") ;;
6852 *)      $cat >&4 <<'EOM'
6853   Support flag bits are:
6854     1: basic void declarations.
6855     2: arrays of pointers to functions returning void.
6856     4: operations between pointers to and addresses of void functions.
6857     8: generic void pointers.
6858 EOM
6859         dflt="$voidflags";
6860         rp="Your void support flags add up to what?"
6861         . ./myread
6862         voidflags="$ans"
6863         ;;
6864 esac
6865 $rm -f try.* .out
6866
6867 : check for length of pointer
6868 echo " "
6869 case "$ptrsize" in
6870 '')
6871         echo "Checking to see how big your pointers are..." >&4
6872         if test "$voidflags" -gt 7; then
6873                 echo '#define VOID_PTR char *' > try.c
6874         else
6875                 echo '#define VOID_PTR void *' > try.c
6876         fi
6877         $cat >>try.c <<'EOCP'
6878 #include <stdio.h>
6879 int main()
6880 {
6881     printf("%d\n", (int)sizeof(VOID_PTR));
6882     exit(0);
6883 }
6884 EOCP
6885         set try
6886         if eval $compile_ok; then
6887                 ptrsize=`$run ./try`
6888                 echo "Your pointers are $ptrsize bytes long."
6889         else
6890                 dflt='4'
6891                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6892                 rp="What is the size of a pointer (in bytes)?"
6893                 . ./myread
6894                 ptrsize="$ans"
6895         fi
6896         ;;
6897 esac
6898 $rm -f try.c try
6899 case "$use64bitall" in
6900 "$define"|true|[yY]*)
6901         case "$ptrsize" in
6902         4)      cat <<EOM >&4
6903
6904 *** You have chosen a maximally 64-bit build, but your pointers
6905 *** are only 4 bytes wide, disabling maximal 64-bitness.
6906
6907 EOM
6908                 use64bitall="$undef"
6909                 case "$use64bitint" in
6910                 "$define"|true|[yY]*) ;;
6911                 *)      cat <<EOM >&4
6912
6913 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6914
6915 EOM
6916                         use64bitint="$define"
6917                         ;;
6918                 esac
6919                 ;;
6920         esac
6921         ;;
6922 esac
6923
6924
6925 : determine which malloc to compile in
6926 echo " "
6927 case "$usemymalloc" in
6928 [yY]*|true|$define)     dflt='y' ;;
6929 [nN]*|false|$undef)     dflt='n' ;;
6930 *)      case "$ptrsize" in
6931         4) dflt='y' ;;
6932         *) dflt='n' ;;
6933         esac
6934         ;;
6935 esac
6936 rp="Do you wish to attempt to use the malloc that comes with $package?"
6937 . ./myread
6938 usemymalloc="$ans"
6939 case "$ans" in
6940 y*|true)
6941         usemymalloc='y'
6942         mallocsrc='malloc.c'
6943         mallocobj="malloc$_o"
6944         d_mymalloc="$define"
6945         case "$libs" in
6946         *-lmalloc*)
6947                 : Remove malloc from list of libraries to use
6948                 echo "Removing unneeded -lmalloc from library list" >&4
6949                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6950                 shift
6951                 libs="$*"
6952                 echo "libs = $libs" >&4
6953                 ;;
6954         esac
6955         ;;
6956 *)
6957         usemymalloc='n'
6958         mallocsrc=''
6959         mallocobj=''
6960         d_mymalloc="$undef"
6961         ;;
6962 esac
6963
6964 : compute the return types of malloc and free
6965 echo " "
6966 $cat >malloc.c <<END
6967 #$i_malloc I_MALLOC
6968 #$i_stdlib I_STDLIB
6969 #include <stdio.h>
6970 #include <sys/types.h>
6971 #ifdef I_MALLOC
6972 #include <malloc.h>
6973 #endif
6974 #ifdef I_STDLIB
6975 #include <stdlib.h>
6976 #endif
6977 #ifdef TRY_MALLOC
6978 void *malloc();
6979 #endif
6980 #ifdef TRY_FREE
6981 void free();
6982 #endif
6983 END
6984 case "$malloctype" in
6985 '')
6986         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6987                 malloctype='void *'
6988         else
6989                 malloctype='char *'
6990         fi
6991         ;;
6992 esac
6993 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6994
6995 case "$freetype" in
6996 '')
6997         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6998                 freetype='void'
6999         else
7000                 freetype='int'
7001         fi
7002         ;;
7003 esac
7004 echo "Your system uses $freetype free(), it would seem." >&4
7005 $rm -f malloc.[co]
7006 $cat <<EOM
7007
7008 After $package is installed, you may wish to install various
7009 add-on modules and utilities.  Typically, these add-ons will
7010 be installed under $prefix with the rest
7011 of this package.  However, you may wish to install such add-ons
7012 elsewhere under a different prefix.
7013
7014 If you do not wish to put everything under a single prefix, that's
7015 ok.  You will be prompted for the individual locations; this siteprefix
7016 is only used to suggest the defaults.
7017
7018 The default should be fine for most people.
7019
7020 EOM
7021 fn=d~+
7022 rp='Installation prefix to use for add-on modules and utilities?'
7023 : XXX Here might be another good place for an installstyle setting.
7024 case "$siteprefix" in
7025 '') dflt=$prefix ;;
7026 *)  dflt=$siteprefix ;;
7027 esac
7028 . ./getfile
7029 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7030 oldsiteprefix=''
7031 case "$siteprefix" in
7032 '') ;;
7033 *)      case "$ans" in
7034         "$prefix") ;;
7035         *) oldsiteprefix="$prefix";;
7036         esac
7037         ;;
7038 esac
7039 siteprefix="$ans"
7040 siteprefixexp="$ansexp"
7041
7042 : determine where site specific libraries go.
7043 : Usual default is /usr/local/lib/perl5/site_perl/$version
7044 : The default "style" setting is made in installstyle.U
7045 : XXX No longer works with Prefixit stuff.
7046 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7047 case "$sitelib" in
7048 '') case "$installstyle" in
7049         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7050         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7051         esac
7052         ;;
7053 *)      dflt="$sitelib"
7054         ;;
7055 esac
7056 $cat <<EOM
7057
7058 The installation process will create a directory for
7059 site-specific extensions and modules.  Most users find it convenient
7060 to place all site-specific files in this directory rather than in the
7061 main distribution directory.
7062
7063 EOM
7064 fn=d~+
7065 rp='Pathname for the site-specific library files?'
7066 . ./getfile
7067 sitelib="$ans"
7068 sitelibexp="$ansexp"
7069 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7070 : Change installation prefix, if necessary.
7071 if $test X"$prefix" != X"$installprefix"; then
7072         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7073 else
7074         installsitelib="$sitelibexp"
7075 fi
7076
7077 : determine where site specific architecture-dependent libraries go.
7078 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7079 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7080 : sitelib may have an optional trailing /share.
7081 case "$sitearch" in
7082 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7083         dflt="$dflt/$archname"
7084         ;;
7085 *)      dflt="$sitearch"
7086         ;;
7087 esac
7088 set sitearch sitearch none
7089 eval $prefixit
7090 $cat <<EOM
7091
7092 The installation process will also create a directory for
7093 architecture-dependent site-specific extensions and modules.
7094
7095 EOM
7096 fn=d~+
7097 rp='Pathname for the site-specific architecture-dependent library files?'
7098 . ./getfile
7099 sitearch="$ans"
7100 sitearchexp="$ansexp"
7101 : Change installation prefix, if necessary.
7102 if $test X"$prefix" != X"$installprefix"; then
7103         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7104 else
7105         installsitearch="$sitearchexp"
7106 fi
7107
7108 $cat <<EOM
7109
7110 The installation process will also create a directory for
7111 vendor-supplied add-ons.  Vendors who supply perl with their system
7112 may find it convenient to place all vendor-supplied files in this
7113 directory rather than in the main distribution directory.  This will
7114 ease upgrades between binary-compatible maintenance versions of perl.
7115
7116 Of course you may also use these directories in whatever way you see
7117 fit.  For example, you might use them to access modules shared over a
7118 company-wide network.
7119
7120 The default answer should be fine for most people.
7121 This causes further questions about vendor add-ons to be skipped
7122 and no vendor-specific directories will be configured for perl.
7123
7124 EOM
7125 rp='Do you want to configure vendor-specific add-on directories?'
7126 case "$usevendorprefix" in
7127 define|true|[yY]*) dflt=y ;;
7128 *)      : User may have set vendorprefix directly on Configure command line.
7129         case "$vendorprefix" in
7130         ''|' ') dflt=n ;;
7131         *)      dflt=y ;;
7132         esac
7133         ;;
7134 esac
7135 . ./myread
7136 case "$ans" in
7137 [yY]*)  fn=d~+
7138         rp='Installation prefix to use for vendor-supplied add-ons?'
7139         case "$vendorprefix" in
7140         '') dflt='' ;;
7141         *)  dflt=$vendorprefix ;;
7142         esac
7143         . ./getfile
7144         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7145         oldvendorprefix=''
7146         case "$vendorprefix" in
7147         '') ;;
7148         *)      case "$ans" in
7149                 "$prefix") ;;
7150                 *) oldvendorprefix="$prefix";;
7151                 esac
7152                 ;;
7153         esac
7154         usevendorprefix="$define"
7155         vendorprefix="$ans"
7156         vendorprefixexp="$ansexp"
7157         ;;
7158 *)      usevendorprefix="$undef"
7159         vendorprefix=''
7160         vendorprefixexp=''
7161         ;;
7162 esac
7163
7164 case "$vendorprefix" in
7165 '')     d_vendorlib="$undef"
7166         vendorlib=''
7167         vendorlibexp=''
7168         ;;
7169 *)      d_vendorlib="$define"
7170         : determine where vendor-supplied modules go.
7171         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7172         case "$vendorlib" in
7173         '')
7174                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7175                 case "$installstyle" in
7176                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7177                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7178                 esac
7179                 ;;
7180         *)      dflt="$vendorlib"
7181                 ;;
7182         esac
7183         fn=d~+
7184         rp='Pathname for the vendor-supplied library files?'
7185         . ./getfile
7186         vendorlib="$ans"
7187         vendorlibexp="$ansexp"
7188         ;;
7189 esac
7190 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7191 : Change installation prefix, if necessary.
7192 if $test X"$prefix" != X"$installprefix"; then
7193         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7194 else
7195         installvendorlib="$vendorlibexp"
7196 fi
7197
7198 case "$vendorprefix" in
7199 '')     d_vendorarch="$undef"
7200         vendorarch=''
7201         vendorarchexp=''
7202         ;;
7203 *)      d_vendorarch="$define"
7204         : determine where vendor-supplied architecture-dependent libraries go.
7205         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7206         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7207         : vendorlib may have an optional trailing /share.
7208         case "$vendorarch" in
7209         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7210                 dflt="$dflt/$archname"
7211                 ;;
7212         *)      dflt="$vendorarch" ;;
7213         esac
7214         fn=d~+
7215         rp='Pathname for vendor-supplied architecture-dependent files?'
7216         . ./getfile
7217         vendorarch="$ans"
7218         vendorarchexp="$ansexp"
7219         ;;
7220 esac
7221 : Change installation prefix, if necessary.
7222 if $test X"$prefix" != X"$installprefix"; then
7223         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7224 else
7225         installvendorarch="$vendorarchexp"
7226 fi
7227
7228 : Final catch-all directories to search
7229 $cat <<EOM
7230
7231 Lastly, you can have perl look in other directories for extensions and
7232 modules in addition to those already specified.
7233 These directories will be searched after 
7234         $sitearch 
7235         $sitelib 
7236 EOM
7237 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7238 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7239 echo ' '
7240 case "$otherlibdirs" in
7241 ''|' ') dflt='none' ;;
7242 *)      dflt="$otherlibdirs" ;;
7243 esac
7244 $cat <<EOM
7245 Enter a colon-separated set of extra paths to include in perl's @INC
7246 search path, or enter 'none' for no extra paths.
7247
7248 EOM
7249
7250 rp='Colon-separated list of additional directories for perl to search?'
7251 . ./myread
7252 case "$ans" in
7253 ' '|''|none)    otherlibdirs=' ' ;;     
7254 *)      otherlibdirs="$ans" ;;
7255 esac
7256 case "$otherlibdirs" in
7257 ' ') val=$undef ;;
7258 *)      val=$define ;;
7259 esac
7260 set d_perl_otherlibdirs
7261 eval $setvar
7262
7263 : Cruising for prototypes
7264 echo " "
7265 echo "Checking out function prototypes..." >&4
7266 $cat >prototype.c <<'EOCP'
7267 int main(int argc, char *argv[]) {
7268         exit(0);}
7269 EOCP
7270 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7271         echo "Your C compiler appears to support function prototypes."
7272         val="$define"
7273 else
7274         echo "Your C compiler doesn't seem to understand function prototypes."
7275         val="$undef"
7276 fi
7277 set prototype
7278 eval $setvar
7279 $rm -f prototype*
7280
7281 case "$prototype" in
7282 "$define") ;;
7283 *)      ansi2knr='ansi2knr'
7284         echo " "
7285         cat <<EOM >&4
7286
7287 $me:  FATAL ERROR:
7288 This version of $package can only be compiled by a compiler that 
7289 understands function prototypes.  Unfortunately, your C compiler 
7290         $cc $ccflags
7291 doesn't seem to understand them.  Sorry about that.
7292
7293 If GNU cc is available for your system, perhaps you could try that instead.  
7294
7295 Eventually, we hope to support building Perl with pre-ANSI compilers.
7296 If you would like to help in that effort, please contact <perlbug@perl.org>.
7297
7298 Aborting Configure now.
7299 EOM
7300         exit 2
7301         ;;
7302 esac
7303
7304 : determine where public executables go
7305 echo " "
7306 set dflt bin bin
7307 eval $prefixit
7308 fn=d~
7309 rp='Pathname where the public executables will reside?'
7310 . ./getfile
7311 if $test "X$ansexp" != "X$binexp"; then
7312         installbin=''
7313 fi
7314 bin="$ans"
7315 binexp="$ansexp"
7316 : Change installation prefix, if necessary.
7317 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7318 if $test X"$prefix" != X"$installprefix"; then
7319         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7320 else
7321         installbin="$binexp"
7322 fi
7323
7324 echo " "
7325 case "$extras" in
7326 '') dflt='n';;
7327 *) dflt='y';;
7328 esac
7329 cat <<EOM
7330 Perl can be built with extra modules or bundles of modules which
7331 will be fetched from the CPAN and installed alongside Perl.
7332
7333 Notice that you will need access to the CPAN; either via the Internet,
7334 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7335 be asked later to configure the CPAN.pm module which will in turn do
7336 the installation of the rest of the extra modules or bundles.)
7337
7338 Notice also that if the modules require any external software such as
7339 libraries and headers (the libz library and the zlib.h header for the
7340 Compress::Zlib module, for example) you MUST have any such software
7341 already installed, this configuration process will NOT install such
7342 things for you.
7343
7344 If this doesn't make any sense to you, just accept the default '$dflt'.
7345 EOM
7346 rp='Install any extra modules (y or n)?'
7347 . ./myread
7348 case "$ans" in
7349 y|Y)
7350         cat <<EOM
7351
7352 Please list any extra modules or bundles to be installed from CPAN,
7353 with spaces between the names.  The names can be in any format the
7354 'install' command of CPAN.pm will understand.  (Answer 'none',
7355 without the quotes, to install no extra modules or bundles.)
7356 EOM
7357         rp='Extras?'
7358         dflt="$extras"
7359         . ./myread
7360         extras="$ans"
7361 esac
7362 case "$extras" in
7363 ''|'none')
7364         val=''
7365         $rm -f ../extras.lst
7366         ;;
7367 *)      echo "(Saving the list of extras for later...)"
7368         echo "$extras" > ../extras.lst
7369         val="'$extras'"
7370         ;;
7371 esac
7372 set extras
7373 eval $setvar
7374 echo " "
7375
7376 : determine where html pages for programs go
7377 set html1dir html1dir none
7378 eval $prefixit
7379 $cat <<EOM
7380
7381 If you wish to install html files for programs in $spackage, indicate 
7382 the appropriate directory here.  To skip installing html files,
7383 answer "none".
7384 EOM
7385 case "$html1dir" in
7386 ''|none|$undef|' ') dflt=none ;;
7387 *) dflt=$html1dir ;;
7388 esac
7389 fn=dn+~
7390 rp="Directory for the main $spackage html pages?"
7391 . ./getfile
7392 html1dir="$ans"
7393 html1direxp="$ansexp"
7394 : Use ' ' for none so value is preserved next time through Configure
7395 $test X"$html1dir" = "X" && html1dir=' '
7396 : Change installation prefix, if necessary.
7397 if $test X"$prefix" != X"$installprefix"; then
7398         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7399 else
7400         installhtml1dir="$html1direxp"
7401 fi
7402
7403 : determine where html pages for libraries and modules go
7404 set html3dir html3dir none
7405 eval $prefixit
7406 $cat <<EOM
7407
7408 If you wish to install html files for modules associated with $spackage,
7409 indicate the appropriate directory here.  To skip installing html files,
7410 answer "none".
7411 EOM
7412 : There is no obvious default.  If they have specified html1dir, then
7413 : try to key off that, possibly changing .../html1 into .../html3.
7414 case "$html3dir" in
7415 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7416 *) dflt=$html3dir ;;
7417 esac
7418 fn=dn+~
7419 rp="Directory for the $spackage module html pages?"
7420 . ./getfile
7421 html3dir="$ans"
7422 html3direxp="$ansexp"
7423 : Use ' ' for none so value is preserved next time through Configure
7424 $test X"$html3dir" = "X" && html3dir=' '
7425 : Change installation prefix, if necessary.
7426 if $test X"$prefix" != X"$installprefix"; then
7427         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7428 else
7429         installhtml3dir="$html3direxp"
7430 fi
7431
7432 : Find perl5.005 or later.
7433 echo "Looking for a previously installed perl5.005 or later... "
7434 case "$perl5" in
7435 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7436                 : Check if this perl is recent and can load a simple module
7437                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7438                         perl5=$tdir/perl
7439                         break;
7440                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7441                         perl5=$tdir/perl5
7442                         break;
7443                 fi
7444         done
7445         ;;
7446 *)      perl5="$perl5"
7447         ;;
7448 esac
7449 case "$perl5" in
7450 '')     echo "None found.  That's ok.";;
7451 *)      echo "Using $perl5." ;;
7452 esac
7453
7454 : Determine list of previous versions to include in @INC
7455 $cat > getverlist <<EOPL
7456 #!$perl5 -w
7457 use File::Basename;
7458 \$api_versionstring = "$api_versionstring";
7459 \$version = "$version";
7460 \$stem = "$sitelib_stem";
7461 \$archname = "$archname";
7462 EOPL
7463         $cat >> getverlist <<'EOPL'
7464 # Can't have leading @ because metaconfig interprets it as a command!
7465 ;@inc_version_list=();
7466 # XXX Redo to do opendir/readdir? 
7467 if (-d $stem) {
7468     chdir($stem);
7469     ;@candidates = glob("5.*");
7470 }
7471 else {
7472     ;@candidates = ();
7473 }
7474
7475 # XXX ToDo:  These comparisons must be reworked when two-digit
7476 # subversions come along, so that 5.7.10 compares as greater than
7477 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7478 # widespread that we can use the built-in version vectors rather
7479 # than reinventing them here.  For 5.6.0, however, we must
7480 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7481 foreach $d (@candidates) {
7482     if ($d lt $version) {
7483         if ($d ge $api_versionstring) {
7484             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7485         }
7486         elsif ($d ge "5.005") {
7487             unshift(@inc_version_list, grep { -d } $d);
7488         }
7489     }
7490     else {
7491         # Skip newer version.  I.e. don't look in
7492         # 5.7.0 if we're installing 5.6.1.
7493     }
7494 }
7495
7496 if (@inc_version_list) {
7497     print join(' ', @inc_version_list);
7498 }
7499 else {
7500     # Blank space to preserve value for next Configure run.
7501     print " ";
7502 }
7503 EOPL
7504 chmod +x getverlist
7505 case "$inc_version_list" in
7506 '')     if test -x "$perl5$exe_ext"; then
7507                 dflt=`$perl5 getverlist`
7508         else
7509                 dflt='none'
7510         fi
7511         ;;
7512 $undef) dflt='none' ;;
7513 *)  eval dflt=\"$inc_version_list\" ;;
7514 esac
7515 case "$dflt" in
7516 ''|' ') dflt=none ;;
7517 esac
7518 case "$dflt" in
7519 5.005) dflt=none ;;
7520 esac
7521 $cat <<EOM
7522
7523 In order to ease the process of upgrading, this version of perl 
7524 can be configured to use modules built and installed with earlier 
7525 versions of perl that were installed under $prefix.  Specify here
7526 the list of earlier versions that this version of perl should check.
7527 If Configure detected no earlier versions of perl installed under
7528 $prefix, then the list will be empty.  Answer 'none' to tell perl
7529 to not search earlier versions.
7530
7531 The default should almost always be sensible, so if you're not sure,
7532 just accept the default.
7533 EOM
7534
7535 rp='List of earlier versions to include in @INC?'
7536 . ./myread
7537 case "$ans" in
7538 [Nn]one|''|' ') inc_version_list=' ' ;;
7539 *) inc_version_list="$ans" ;;
7540 esac
7541 case "$inc_version_list" in
7542 ''|' ') 
7543         inc_version_list_init='0';;
7544 *)      inc_version_list_init=`echo $inc_version_list |
7545                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7546         ;;
7547 esac
7548 $rm -f getverlist
7549
7550 : determine whether to install perl also as /usr/bin/perl
7551
7552 echo " "
7553 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7554         $cat <<EOM
7555 Many scripts expect perl to be installed as /usr/bin/perl.
7556
7557 If you want to, I can install the perl you are about to compile
7558 as /usr/bin/perl (in addition to $bin/perl).
7559 EOM
7560         if test -f /usr/bin/perl; then
7561             $cat <<EOM
7562
7563 However, please note that because you already have a /usr/bin/perl,
7564 overwriting that with a new Perl would very probably cause problems.
7565 Therefore I'm assuming you don't want to do that (unless you insist).
7566
7567 EOM
7568             case "$installusrbinperl" in
7569             "$define"|[yY]*)    dflt='y';;
7570             *)                  dflt='n';;
7571             esac
7572         else
7573             $cat <<EOM
7574
7575 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7576
7577 EOM
7578             case "$installusrbinperl" in
7579             "$undef"|[nN]*)     dflt='n';;
7580             *)                  dflt='y';;
7581             esac
7582         fi
7583         rp="Do you want to install perl as /usr/bin/perl?"
7584         . ./myread
7585         case "$ans" in
7586         [yY]*)  val="$define";;
7587         *)      val="$undef" ;;
7588         esac
7589 else
7590         val="$undef"
7591 fi
7592 set installusrbinperl
7593 eval $setvar
7594
7595 : see if dld is available
7596 set dld.h i_dld
7597 eval $inhdr
7598
7599 : see if dlopen exists
7600 xxx_runnm="$runnm"
7601 runnm=false
7602 set dlopen d_dlopen
7603 eval $inlibc
7604 runnm="$xxx_runnm"
7605
7606 : determine which dynamic loading, if any, to compile in
7607 echo " "
7608 dldir="ext/DynaLoader"
7609 case "$usedl" in
7610 $define|y|true)
7611         dflt='y'
7612         usedl="$define"
7613         ;;
7614 $undef|n|false)
7615         dflt='n'
7616         usedl="$undef"
7617         ;;
7618 *) 
7619         dflt='n'
7620         case "$d_dlopen" in
7621             $define) dflt='y' ;;
7622         esac
7623         case "$i_dld" in
7624             $define) dflt='y' ;;
7625         esac
7626         : Does a dl_xxx.xs file exist for this operating system
7627         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7628         ;;
7629 esac
7630 rp="Do you wish to use dynamic loading?"
7631 . ./myread
7632 usedl="$ans"
7633 case "$ans" in
7634 y*) usedl="$define"
7635         case "$dlsrc" in
7636         '')
7637                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7638                         dflt="$dldir/dl_${osname}.xs"
7639                 elif $test "$d_dlopen" = "$define" ; then
7640                         dflt="$dldir/dl_dlopen.xs"
7641                 elif $test "$i_dld" = "$define" ; then
7642                         dflt="$dldir/dl_dld.xs"
7643                 else
7644                         dflt=''
7645                 fi
7646                 ;;
7647         *)      dflt="$dldir/$dlsrc"
7648                 ;;
7649         esac
7650     echo "The following dynamic loading files are available:"
7651         : Can not go over to $dldir because getfile has path hard-coded in.
7652         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7653         rp="Source file to use for dynamic loading"
7654         fn="fne"
7655         gfpth="$src"
7656         . ./getfile
7657         usedl="$define"
7658         : emulate basename
7659         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7660
7661         $cat << EOM
7662
7663 Some systems may require passing special flags to $cc -c to
7664 compile modules that will be used to create a shared library.
7665 To use no flags, say "none".
7666
7667 EOM
7668     case "$cccdlflags" in
7669     '') case "$gccversion" in
7670                 '') case "$osname" in
7671                         hpux)   dflt='+z' ;;
7672                         next)   dflt='none' ;;
7673                         irix*)  dflt='-KPIC' ;;
7674                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7675                         sunos)  dflt='-pic' ;;
7676                         *)      dflt='none' ;;
7677                     esac
7678                         ;;
7679                 *)  case "$osname" in
7680                         darwin) dflt='none' ;;
7681                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7682                         *)      dflt='-fpic' ;;
7683                     esac ;;
7684             esac ;;
7685         ' ') dflt='none' ;;
7686     *)  dflt="$cccdlflags" ;;
7687     esac
7688     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7689     . ./myread
7690     case "$ans" in
7691     none) cccdlflags=' ' ;;
7692     *) cccdlflags="$ans" ;;
7693     esac
7694
7695     cat << EOM
7696
7697 Some systems use ld to create libraries that can be dynamically loaded,
7698 while other systems (such as those using ELF) use $cc.
7699
7700 EOM
7701         case "$ld" in
7702         '')     $cat >try.c <<'EOM'
7703 /* Test for whether ELF binaries are produced */
7704 #include <fcntl.h>
7705 #include <stdlib.h>
7706 int main() {
7707         char b[4];
7708         int i = open("a.out",O_RDONLY);
7709         if(i == -1) 
7710                 exit(1); /* fail */
7711         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7712                 exit(0); /* succeed (yes, it's ELF) */
7713         else
7714                 exit(1); /* fail */
7715 }
7716 EOM
7717                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7718                         cat <<EOM
7719 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7720 EOM
7721                         dflt="$cc"
7722                 else
7723                         echo "I'll use ld to build dynamic libraries."
7724                         dflt='ld'
7725                 fi
7726                 rm -f try.c a.out
7727                 ;;
7728         *)      dflt="$ld"
7729                 ;;
7730         esac
7731
7732     rp="What command should be used to create dynamic libraries?"
7733     . ./myread
7734         ld="$ans"
7735
7736     cat << EOM
7737
7738 Some systems may require passing special flags to $ld to create a
7739 library that can be dynamically loaded.  If your ld flags include
7740 -L/other/path options to locate libraries outside your loader's normal
7741 search path, you may need to specify those -L options here as well.  To
7742 use no flags, say "none".
7743
7744 EOM
7745     case "$lddlflags" in
7746     '') case "$osname" in
7747                         beos) dflt='-nostart' ;;
7748                         hpux) dflt='-b';
7749                               case "$gccversion" in
7750                               '') dflt="$dflt +vnocompatwarnings" ;;
7751                               esac
7752                               ;;        
7753                         linux|irix*)    dflt='-shared' ;;
7754                         next)  dflt='none' ;;
7755                         solaris) dflt='-G' ;;
7756                         sunos) dflt='-assert nodefinitions' ;;
7757                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7758                 *)     dflt='none' ;;
7759                         esac
7760                         ;;
7761     *) dflt="$lddlflags" ;;
7762     esac
7763
7764         : Try to guess additional flags to pick up local libraries.
7765         : Be careful not to append to a plain 'none'
7766         case "$dflt" in
7767         none) dflt='' ;;
7768         esac
7769         for thisflag in $ldflags; do
7770                 case "$thisflag" in
7771                 -L*|-R*|-Wl,-R*)
7772                         case " $dflt " in
7773                         *" $thisflag "*) ;;
7774                         *) dflt="$dflt $thisflag" ;;
7775                         esac
7776                         ;;
7777                 esac
7778         done
7779
7780         case "$dflt" in
7781         ''|' ') dflt='none' ;;
7782         esac
7783
7784     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7785     . ./myread
7786     case "$ans" in
7787     none) lddlflags=' ' ;;
7788     *) lddlflags="$ans" ;;
7789     esac
7790
7791         cat <<EOM
7792
7793 Some systems may require passing special flags to $cc to indicate that
7794 the resulting executable will use dynamic linking.  To use no flags,
7795 say "none".
7796
7797 EOM
7798     case "$ccdlflags" in
7799     '') case "$osname" in
7800                 hpux)   dflt='-Wl,-E' ;;
7801                 linux)  dflt='-rdynamic' ;;
7802                 next)   dflt='none' ;;
7803                 sunos)  dflt='none' ;;
7804                 *)      dflt='none' ;;
7805             esac ;;
7806     ' ')  dflt='none' ;;
7807     *)  dflt="$ccdlflags" ;;
7808     esac
7809     rp="Any special flags to pass to $cc to use dynamic linking?"
7810     . ./myread
7811     case "$ans" in
7812     none) ccdlflags=' ' ;;
7813     *) ccdlflags="$ans" ;;
7814     esac
7815     ;;
7816 *)  usedl="$undef"
7817         ld='ld'
7818     dlsrc='dl_none.xs'
7819     lddlflags=''
7820     ccdlflags=''
7821     ;;
7822 esac
7823
7824 also=''
7825 case "$usedl" in
7826 $undef)
7827         # No dynamic loading being used, so don't bother even to prompt.
7828         useshrplib='false'
7829         ;;
7830 *)      case "$useshrplib" in
7831         '')     case "$osname" in
7832                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7833                         dflt=y
7834                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7835                         ;;
7836                 next*)
7837                         case "$osvers" in
7838                         4*)     dflt=y
7839                                 also='Building a shared libperl is needed for MAB support.'
7840                                 ;;
7841                         *)      dflt=n
7842                                 ;;
7843                         esac
7844                         ;;
7845                 *)      dflt=n
7846                         ;;
7847                 esac
7848                 ;;
7849         $define|true|[Yy]*)
7850                 dflt=y
7851                 ;;
7852         *)      dflt=n
7853                 ;;
7854         esac
7855         $cat << EOM
7856
7857 The perl executable is normally obtained by linking perlmain.c with
7858 libperl${_a}, any static extensions (usually just DynaLoader), and
7859 any other libraries needed on this system (such as -lm, etc.).  Since
7860 your system supports dynamic loading, it is probably possible to build
7861 a shared libperl.$so.  If you will have more than one executable linked
7862 to libperl.$so, this will significantly reduce the size of each
7863 executable, but it may have a noticeable affect on performance.  The
7864 default is probably sensible for your system.
7865 $also
7866
7867 EOM
7868         rp="Build a shared libperl.$so (y/n)"
7869         . ./myread
7870         case "$ans" in
7871         true|$define|[Yy]*)
7872                 useshrplib='true'  ;;
7873         *)      useshrplib='false' ;;
7874         esac
7875         ;;
7876 esac
7877
7878 case "$useshrplib" in
7879 true)
7880         case "$libperl" in
7881         '')
7882                 # Figure out a good name for libperl.so.  Since it gets stored in
7883                 # a version-specific architecture-dependent library, the version
7884                 # number isn't really that important, except for making cc/ld happy.
7885                 #
7886                 # A name such as libperl.so.3.1
7887                 majmin="libperl.$so.$patchlevel.$subversion"
7888                 # A name such as libperl.so.301
7889                 majonly=`echo $patchlevel $subversion |
7890                         $awk '{printf "%d%02d", $1, $2}'`
7891                 majonly=libperl.$so.$majonly
7892                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7893                 # rely on figuring it out from the naming of libc.
7894                 case "${osname}${osvers}" in
7895                 next4*)
7896                         dflt=libperl.5.$so
7897                         # XXX How handle the --version stuff for MAB?
7898                         ;;
7899                 linux*)  # ld won't link with a bare -lperl otherwise.
7900                         dflt=libperl.$so
7901                         ;;
7902                 cygwin*) # ld links against an importlib
7903                         dflt=libperl$lib_ext
7904                         ;;
7905                 *)      # Try to guess based on whether libc has major.minor.
7906                         case "$libc" in
7907                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7908                         *libc.$so.[0-9]*) dflt=$majonly ;;
7909                         *)      dflt=libperl.$so ;;
7910                         esac
7911                         ;;
7912                 esac
7913                 ;;
7914         *)      dflt=$libperl
7915                 ;;
7916         esac
7917         cat << EOM
7918
7919 I need to select a good name for the shared libperl.  If your system uses
7920 library names with major and minor numbers, then you might want something
7921 like $majmin.  Alternatively, if your system uses a single version
7922 number for shared libraries, then you might want to use $majonly.
7923 Or, your system might be quite happy with a simple libperl.$so.
7924
7925 Since the shared libperl will get installed into a version-specific
7926 architecture-dependent directory, the version number of the shared perl
7927 library probably isn't important, so the default should be o.k.
7928
7929 EOM
7930         rp='What name do you want to give to the shared libperl?'
7931         . ./myread
7932         libperl=$ans
7933         echo "Ok, I'll use $libperl"
7934         ;;
7935 *)
7936         libperl="libperl${_a}"
7937         ;;
7938 esac
7939
7940 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7941 case "$shrpdir" in
7942 '') ;;
7943 *)      $cat >&4 <<EOM
7944 WARNING:  Use of the shrpdir variable for the installation location of
7945 the shared $libperl is not supported.  It was never documented and
7946 will not work in this version.  Let me (perlbug@perl.org)
7947 know of any problems this may cause.
7948
7949 EOM
7950         case "$shrpdir" in
7951         "$archlibexp/CORE")
7952                 $cat >&4 <<EOM
7953 But your current setting of $shrpdir is
7954 the default anyway, so it's harmless.
7955 EOM
7956                 ;;
7957         *)
7958                 $cat >&4 <<EOM
7959 Further, your current attempted setting of $shrpdir
7960 conflicts with the value of $archlibexp/CORE
7961 that installperl will use.
7962 EOM
7963                 ;;
7964         esac
7965         ;;
7966 esac
7967
7968 # How will the perl executable find the installed shared $libperl?
7969 # Add $xxx to ccdlflags.
7970 # If we can't figure out a command-line option, use $shrpenv to
7971 # set env LD_RUN_PATH.  The main perl makefile uses this.
7972 shrpdir=$archlibexp/CORE
7973 xxx=''
7974 tmp_shrpenv=''
7975 if "$useshrplib"; then
7976     case "$osname" in 
7977         aix)
7978                 # We'll set it in Makefile.SH...
7979                 ;;
7980         solaris)
7981                 xxx="-R $shrpdir"
7982                 ;;
7983         freebsd|netbsd|openbsd)
7984                 xxx="-Wl,-R$shrpdir"
7985                 ;;
7986         bsdos|linux|irix*|dec_osf)
7987                 xxx="-Wl,-rpath,$shrpdir"
7988                 ;;
7989         next)
7990                 # next doesn't like the default...
7991                 ;;
7992         beos)
7993                 # beos doesn't like the default, either.
7994                 ;;
7995         hpux*)
7996                 # hpux doesn't like the default, either.
7997                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7998                 ;;
7999         *)
8000                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8001                 ;;
8002         esac
8003         case "$xxx" in
8004         '') ;;
8005         *)      
8006                 # Only add $xxx if it isn't already in ccdlflags.
8007                 case " $ccdlflags " in
8008                 *" $xxx "*)     ;;
8009                 *)      ccdlflags="$ccdlflags $xxx"
8010                         cat <<EOM >&4
8011
8012 Adding $xxx to the flags
8013 passed to $ld so that the perl executable will find the 
8014 installed shared $libperl.
8015
8016 EOM
8017                         ;;
8018                 esac
8019                 ;;
8020         esac
8021 fi
8022 # Fix ccdlflags in AIX for building external extensions.
8023 # (For building Perl itself bare -bE:perl.exp is needed,
8024 #  Makefile.SH takes care of this.)
8025 case "$osname" in
8026 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8027 esac
8028 # Respect a hint or command-line value.
8029 case "$shrpenv" in
8030 '') shrpenv="$tmp_shrpenv" ;;
8031 esac
8032 case "$ldlibpthname" in
8033 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8034 none)   ldlibpthname='' ;;
8035 esac
8036
8037 : determine where manual pages are on this system
8038 echo " "
8039 case "$sysman" in
8040 '') 
8041         syspath='/usr/share/man/man1 /usr/man/man1'
8042         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8043         syspath="$syspath /usr/man/u_man/man1"
8044         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8045         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8046         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8047         sysman=`./loc . /usr/man/man1 $syspath`
8048         ;;
8049 esac
8050 if $test -d "$sysman"; then
8051         echo "System manual is in $sysman." >&4
8052 else
8053         echo "Could not find manual pages in source form." >&4
8054 fi
8055
8056 : determine where manual pages go
8057 set man1dir man1dir none
8058 eval $prefixit
8059 $cat <<EOM
8060
8061 $spackage has manual pages available in source form.
8062 EOM
8063 case "$nroff" in
8064 nroff)
8065         echo "However, you don't have nroff, so they're probably useless to you."
8066         case "$man1dir" in
8067         '') man1dir="none";;
8068         esac;;
8069 esac
8070 echo "If you don't want the manual sources installed, answer 'none'."
8071 case "$man1dir" in
8072 ' ') dflt=none
8073         ;;
8074 '')
8075         lookpath="$prefixexp/share/man/man1"
8076         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8077         lookpath="$lookpath $prefixexp/man/p_man/man1"
8078         lookpath="$lookpath $prefixexp/man/u_man/man1"
8079         lookpath="$lookpath $prefixexp/man/man.1"
8080         case "$sysman" in
8081         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8082         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8083         esac
8084         set dflt
8085         eval $prefixup
8086         ;;
8087 *)  dflt="$man1dir"
8088         ;;
8089 esac
8090 echo " "
8091 fn=dn+~
8092 rp="Where do the main $spackage manual pages (source) go?"
8093 . ./getfile
8094 if $test "X$man1direxp" != "X$ansexp"; then
8095         installman1dir=''
8096 fi
8097 man1dir="$ans"
8098 man1direxp="$ansexp"
8099 case "$man1dir" in
8100 '')     man1dir=' '
8101         installman1dir='';;
8102 esac
8103
8104 : Change installation prefix, if necessary.
8105 if $test X"$prefix" != X"$installprefix"; then
8106         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8107 else
8108         installman1dir="$man1direxp"
8109 fi
8110
8111 : What suffix to use on installed man pages
8112
8113 case "$man1dir" in
8114 ' ')
8115         man1ext='0'
8116         ;;
8117 *)
8118         rp="What suffix should be used for the main $spackage man pages?"
8119         case "$man1ext" in
8120         '')     case "$man1dir" in
8121                 *1)  dflt=1 ;;
8122                 *1p) dflt=1p ;;
8123                 *1pm) dflt=1pm ;;
8124                 *l) dflt=l;;
8125                 *n) dflt=n;;
8126                 *o) dflt=o;;
8127                 *p) dflt=p;;
8128                 *C) dflt=C;;
8129                 *L) dflt=L;;
8130                 *L1) dflt=L1;;
8131                 *) dflt=1;;
8132                 esac
8133                 ;;
8134         *)      dflt="$man1ext";;
8135         esac
8136         . ./myread
8137         man1ext="$ans"
8138         ;;
8139 esac
8140
8141 : see if we can have long filenames
8142 echo " "
8143 first=123456789abcdef
8144 $rm -f $first
8145 if (echo hi >$first) 2>/dev/null; then
8146         if $test -f 123456789abcde; then
8147                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8148                 val="$undef"
8149         else
8150                 echo 'You can have filenames longer than 14 characters.'>&4
8151                 val="$define"
8152         fi
8153 else
8154         $cat <<'EOM'
8155 You can't have filenames longer than 14 chars.
8156 You can't even think about them!
8157 EOM
8158         val="$undef"
8159 fi 
8160 set d_flexfnam
8161 eval $setvar
8162 $rm -rf 123456789abcde*
8163
8164 : determine where library module manual pages go
8165 set man3dir man3dir none
8166 eval $prefixit
8167 $cat <<EOM
8168
8169 $spackage has manual pages for many of the library modules.
8170 EOM
8171
8172 case "$nroff" in
8173 nroff)
8174         $cat <<'EOM'
8175 However, you don't have nroff, so they're probably useless to you.
8176 EOM
8177         case "$man3dir" in
8178         '') man3dir="none";;
8179         esac;;
8180 esac
8181
8182 case "$d_flexfnam" in
8183 undef)
8184         $cat <<'EOM'
8185 However, your system can't handle the long file names like File::Basename.3. 
8186 EOM
8187         case "$man3dir" in
8188         '') man3dir="none";;
8189         esac;;
8190 esac
8191
8192 echo "If you don't want the manual sources installed, answer 'none'."
8193 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8194 case "$man3dir" in
8195 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8196         if $test -d "$privlib/man/man3"; then
8197                 cat <<EOM >&4
8198
8199 WARNING:  Previous versions of perl installed man3 pages into
8200 $privlib/man/man3.  This version will suggest a 
8201 new default of $dflt.  
8202 EOM
8203                 tdflt=$dflt
8204                 dflt='n'
8205                 rp='Do you wish to preserve the old behavior?(y/n)'
8206                 . ./myread
8207                 case "$ans" in
8208                 y*) dflt="$privlib/man/man3" ;;
8209                 *)  dflt=$tdflt ;;
8210                 esac
8211     fi
8212         ;;
8213 *)      dflt="$man3dir" ;;
8214 esac
8215 case "$dflt" in
8216 ' ') dflt=none ;;
8217 esac
8218 echo " "
8219 fn=dn+~
8220 rp="Where do the $package library man pages (source) go?"
8221 . ./getfile
8222 man3dir="$ans"
8223 man3direxp="$ansexp"
8224 case "$man3dir" in
8225 '')     man3dir=' '
8226         installman3dir='';;
8227 esac
8228
8229 : Change installation prefix, if necessary.
8230 if $test X"$prefix" != X"$installprefix"; then
8231         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8232 else
8233         installman3dir="$man3direxp"
8234 fi
8235
8236 : What suffix to use on installed man pages
8237 case "$man3dir" in
8238 ' ')
8239         man3ext='0'
8240         ;;
8241 *)
8242         rp="What suffix should be used for the $package library man pages?"
8243         case "$man3ext" in
8244         '')     case "$man3dir" in
8245                 *3)  dflt=3 ;;
8246                 *3p) dflt=3p ;;
8247                 *3pm) dflt=3pm ;;
8248                 *l) dflt=l;;
8249                 *n) dflt=n;;
8250                 *o) dflt=o;;
8251                 *p) dflt=p;;
8252                 *C) dflt=C;;
8253                 *L) dflt=L;;
8254                 *L3) dflt=L3;;
8255                 *) dflt=3;;
8256                 esac
8257                 ;;
8258         *)      dflt="$man3ext";;
8259         esac
8260         . ./myread
8261         man3ext="$ans"
8262         ;;
8263 esac
8264
8265 : see if we have to deal with yellow pages, now NIS.
8266 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8267         if $test -f /usr/etc/nibindd; then
8268                 echo " "
8269                 echo "I'm fairly confident you're on a NeXT."
8270                 echo " "
8271                 rp='Do you get the hosts file via NetInfo?'
8272                 dflt=y
8273                 case "$hostcat" in
8274                 nidump*) ;;
8275                 '') ;;
8276                 *) dflt=n;;
8277                 esac
8278                 . ./myread
8279                 case "$ans" in
8280                 y*) hostcat='nidump hosts .';;
8281                 *)      case "$hostcat" in
8282                         nidump*) hostcat='';;
8283                         esac
8284                         ;;
8285                 esac
8286         fi
8287         case "$hostcat" in
8288         nidump*) ;;
8289         *)
8290                 case "$hostcat" in
8291                 *ypcat*) dflt=y;;
8292                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8293                                 dflt=y
8294                         else
8295                                 dflt=n
8296                         fi;;
8297                 *) dflt=n;;
8298                 esac
8299                 echo " "
8300                 rp='Are you getting the hosts file via yellow pages?'
8301                 . ./myread
8302                 case "$ans" in
8303                 y*) hostcat='ypcat hosts';;
8304                 *) hostcat='cat /etc/hosts';;
8305                 esac
8306                 ;;
8307         esac
8308 fi
8309 case "$hostcat" in
8310 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8311 esac
8312 case "$groupcat" in
8313 '') test -f /etc/group && groupcat='cat /etc/group';;
8314 esac
8315 case "$passcat" in
8316 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8317 esac
8318
8319 : now get the host name
8320 echo " "
8321 echo "Figuring out host name..." >&4
8322 case "$myhostname" in
8323 '') cont=true
8324         echo 'Maybe "hostname" will work...'
8325         if tans=`sh -c hostname 2>&1` ; then
8326                 myhostname=$tans
8327                 phostname=hostname
8328                 cont=''
8329         fi
8330         ;;
8331 *) cont='';;
8332 esac
8333 if $test "$cont"; then
8334         if ./xenix; then
8335                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8336                 if tans=`cat /etc/systemid 2>&1` ; then
8337                         myhostname=$tans
8338                         phostname='cat /etc/systemid'
8339                         echo "Whadyaknow.  Xenix always was a bit strange..."
8340                         cont=''
8341                 fi
8342         elif $test -r /etc/systemid; then
8343                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8344         fi
8345 fi
8346 if $test "$cont"; then
8347         echo 'No, maybe "uuname -l" will work...'
8348         if tans=`sh -c 'uuname -l' 2>&1` ; then
8349                 myhostname=$tans
8350                 phostname='uuname -l'
8351         else
8352                 echo 'Strange.  Maybe "uname -n" will work...'
8353                 if tans=`sh -c 'uname -n' 2>&1` ; then
8354                         myhostname=$tans
8355                         phostname='uname -n'
8356                 else
8357                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8358                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8359                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8360                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8361                         else
8362                                 case "$myhostname" in
8363                                 '') echo "Does this machine have an identity crisis or something?"
8364                                         phostname='';;
8365                                 *)
8366                                         echo "Well, you said $myhostname before..."
8367                                         phostname='echo $myhostname';;
8368                                 esac
8369                         fi
8370                 fi
8371         fi
8372 fi
8373 case "$myhostname" in
8374 '') myhostname=noname ;;
8375 esac
8376 : you do not want to know about this
8377 set $myhostname
8378 myhostname=$1
8379
8380 : verify guess
8381 if $test "$myhostname" ; then
8382         dflt=y
8383         rp='Your host name appears to be "'$myhostname'".'" Right?"
8384         . ./myread
8385         case "$ans" in
8386         y*) ;;
8387         *) myhostname='';;
8388         esac
8389 fi
8390
8391 : bad guess or no guess
8392 while $test "X$myhostname" = X ; do
8393         dflt=''
8394         rp="Please type the (one word) name of your host:"
8395         . ./myread
8396         myhostname="$ans"
8397 done
8398
8399 : translate upper to lower if necessary
8400 case "$myhostname" in
8401 *[A-Z]*)
8402         echo "(Normalizing case in your host name)"
8403         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8404         ;;
8405 esac
8406
8407 case "$myhostname" in
8408 *.*)
8409         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8410         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8411         echo "(Trimming domain name from host name--host name is now $myhostname)"
8412         ;;
8413 *) case "$mydomain" in
8414         '')
8415                 {
8416                         test "X$hostcat" = "Xypcat hosts" &&
8417                         ypmatch "$myhostname" hosts 2>/dev/null |\
8418                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8419                         $test -s hosts
8420                 } || {
8421                         test "X$hostcat" != "X" &&
8422                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8423                                         /[       ]$myhostname[  . ]/p" > hosts
8424                 }
8425                 tmp_re="[       . ]"
8426                 if $test -f hosts; then
8427                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8428                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8429                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8430                                 hosts | $sort | $uniq | \
8431                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8432                         case `$echo X$dflt` in
8433                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8434                                 dflt=.
8435                                 ;;
8436                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8437                                 ;;
8438                         esac
8439                 else
8440                         echo "(I cannot locate a hosts database anywhere)"
8441                         dflt=.
8442                 fi
8443                 case "$dflt" in
8444                 .)
8445                         tans=`./loc resolv.conf X /etc /usr/etc`
8446                         if $test -f "$tans"; then
8447                                 echo "(Attempting domain name extraction from $tans)"
8448                                 dflt=.`$sed -n -e 's/   / /g' \
8449                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8450                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8451                                 case "$dflt" in
8452                                 .) dflt=.`$sed -n -e 's/        / /g' \
8453                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8454                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8455                                         ;;
8456                                 esac
8457                         fi
8458                         ;;
8459                 esac
8460                 case "$dflt" in
8461                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8462                         dflt=.`sh -c domainname 2>/dev/null`
8463                         case "$dflt" in
8464                         '') dflt='.';;
8465                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8466                         esac
8467                         ;;
8468                 esac
8469                 case "$dflt$osname" in
8470                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8471                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8472                         ;;
8473                 esac
8474                 case "$dflt" in
8475                 .) echo "(Lost all hope -- silly guess then)"
8476                         dflt='.nonet'
8477                         ;;
8478                 esac
8479                 $rm -f hosts
8480                 ;;
8481         *) dflt="$mydomain";;
8482         esac;;
8483 esac
8484 echo " "
8485 rp="What is your domain name?"
8486 . ./myread
8487 tans="$ans"
8488 case "$ans" in
8489 '') ;;
8490 .*) ;;
8491 *) tans=".$tans";;
8492 esac
8493 mydomain="$tans"
8494
8495 : translate upper to lower if necessary
8496 case "$mydomain" in
8497 *[A-Z]*)
8498         echo "(Normalizing case in your domain name)"
8499         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8500         ;;
8501 esac
8502
8503 : a little sanity check here
8504 case "$phostname" in
8505 '') ;;
8506 *)
8507         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8508         $myhostname$mydomain|$myhostname) ;;
8509         *)
8510                 case "$phostname" in
8511                 sed*)
8512                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8513                         ;;
8514                 *)
8515                         echo "(That doesn't agree with your $phostname command, by the way.)"
8516                         ;;
8517                 esac
8518         ;;
8519         esac
8520         ;;
8521 esac
8522
8523 $cat <<EOM
8524
8525 I need to get your e-mail address in Internet format if possible, i.e.
8526 something like user@host.domain. Please answer accurately since I have
8527 no easy means to double check it. The default value provided below
8528 is most probably close to reality but may not be valid from outside
8529 your organization...
8530
8531 EOM
8532 cont=x
8533 while test "$cont"; do
8534         case "$cf_email" in
8535         '') dflt="$cf_by@$myhostname$mydomain";;
8536         *) dflt="$cf_email";;
8537         esac
8538         rp='What is your e-mail address?'
8539         . ./myread
8540         cf_email="$ans"
8541         case "$cf_email" in
8542         *@*.*) cont='' ;;
8543         *)
8544                 rp='Address does not look like an Internet one.  Use it anyway?'
8545                 case "$fastread" in
8546                 yes) dflt=y ;;
8547                 *) dflt=n ;;
8548                 esac
8549                 . ./myread
8550                 case "$ans" in
8551                 y*) cont='' ;;
8552                 *) echo " " ;;
8553                 esac
8554                 ;;
8555         esac
8556 done
8557
8558 $cat <<EOM
8559
8560 If you or somebody else will be maintaining perl at your site, please
8561 fill in the correct e-mail address here so that they may be contacted
8562 if necessary. Currently, the "perlbug" program included with perl
8563 will send mail to this address in addition to perlbug@perl.org. You may
8564 enter "none" for no administrator.
8565
8566 EOM
8567 case "$perladmin" in
8568 '') dflt="$cf_email";;
8569 *) dflt="$perladmin";;
8570 esac
8571 rp='Perl administrator e-mail address'
8572 . ./myread
8573 perladmin="$ans"
8574
8575 : determine whether to only install version-specific parts.
8576 echo " "
8577 $cat <<EOM
8578 Do you want to install only the version-specific parts of the perl
8579 distribution?  Usually you do *not* want to do this.
8580 EOM
8581 case "$versiononly" in
8582 "$define"|[Yy]*|true) dflt='y' ;;
8583 *) dflt='n';
8584 esac
8585 rp="Do you want to install only the version-specific parts of perl?"
8586 . ./myread
8587 case "$ans" in
8588 [yY]*)  val="$define";;
8589 *)      val="$undef" ;;
8590 esac
8591 set versiononly
8592 eval $setvar
8593
8594 case "$versiononly" in
8595 "$define") inc_version_list=''
8596            inc_version_list_init=0
8597            ;;
8598 esac
8599
8600 : figure out how to guarantee perl startup
8601 case "$startperl" in
8602 '')
8603         case "$sharpbang" in
8604         *!)
8605                 $cat <<EOH
8606
8607 I can use the #! construct to start perl on your system. This will
8608 make startup of perl scripts faster, but may cause problems if you
8609 want to share those scripts and perl is not in a standard place
8610 ($binexp/perl) on all your platforms. The alternative is to force
8611 a shell by starting the script with a single ':' character.
8612
8613 EOH
8614                 case "$versiononly" in
8615                 "$define")      dflt="$binexp/perl$version";;  
8616                 *)              dflt="$binexp/perl";;
8617                 esac
8618                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8619                 . ./myread
8620                 case "$ans" in
8621                 none)   startperl=": # use perl";;
8622                 *)      startperl="#!$ans"
8623                         if $test 30 -lt `echo "$ans" | wc -c`; then
8624                                 $cat >&4 <<EOM
8625
8626 WARNING:  Some systems limit the #! command to 32 characters.
8627 If you experience difficulty running Perl scripts with #!, try
8628 installing Perl in a directory with a shorter pathname.
8629
8630 EOM
8631                         fi ;;
8632                 esac
8633                 ;;
8634         *) startperl=": # use perl"
8635                 ;;
8636         esac
8637         ;;
8638 esac
8639 echo "I'll use $startperl to start perl scripts."
8640
8641 : figure best path for perl in scripts
8642 case "$perlpath" in
8643 '')
8644         case "$versiononly" in
8645         "$define")      perlpath="$binexp/perl$version";;
8646         *)              perlpath="$binexp/perl";;
8647         esac
8648         case "$startperl" in
8649         *!*) ;;
8650         *)
8651                 $cat <<EOH
8652
8653 I will use the "eval 'exec'" idiom to start Perl on your system.
8654 I can use the full path of your Perl binary for this purpose, but
8655 doing so may cause problems if you want to share those scripts and
8656 Perl is not always in a standard place ($binexp/perl).
8657
8658 EOH
8659                 dflt="$binexp/perl"
8660                 rp="What path shall I use in \"eval 'exec'\"?"
8661                 . ./myread
8662                 perlpath="$ans"
8663                 ;;
8664         esac
8665         ;;
8666 esac
8667 case "$startperl" in
8668 *!*)    ;;
8669 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8670 esac
8671
8672 : determine where public executable scripts go
8673 set scriptdir scriptdir
8674 eval $prefixit
8675 case "$scriptdir" in
8676 '')
8677         dflt="$bin"
8678         : guess some guesses
8679         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8680         $test -d /usr/share/bin     && dflt=/usr/share/bin
8681         $test -d /usr/local/script  && dflt=/usr/local/script
8682         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8683         $test -d $prefixexp/script  && dflt=$prefixexp/script
8684         set dflt
8685         eval $prefixup
8686         ;;
8687 *)  dflt="$scriptdir"
8688         ;;
8689 esac
8690 $cat <<EOM
8691  
8692 Some installations have a separate directory just for executable scripts so
8693 that they can mount it across multiple architectures but keep the scripts in
8694 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8695 Or you might just lump your scripts in with all your other executables.
8696  
8697 EOM
8698 fn=d~
8699 rp='Where do you keep publicly executable scripts?'
8700 . ./getfile
8701 if $test "X$ansexp" != "X$scriptdirexp"; then
8702         installscript=''
8703 fi
8704 scriptdir="$ans"
8705 scriptdirexp="$ansexp"
8706 : Change installation prefix, if necessary.
8707 if $test X"$prefix" != X"$installprefix"; then
8708         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8709 else
8710         installscript="$scriptdirexp"
8711 fi
8712
8713 : determine where add-on public executables go
8714 case "$sitebin" in
8715 '')     dflt=$siteprefix/bin ;;
8716 *)      dflt=$sitebin ;;
8717 esac
8718 fn=d~
8719 rp='Pathname where the add-on public executables should be installed?'
8720 . ./getfile
8721 sitebin="$ans"
8722 sitebinexp="$ansexp"
8723 : Change installation prefix, if necessary.
8724 if $test X"$prefix" != X"$installprefix"; then
8725         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8726 else
8727         installsitebin="$sitebinexp"
8728 fi
8729
8730 : determine where add-on html pages go
8731 : There is no standard location, so try to copy the previously-selected 
8732 : directory structure for the core html pages.
8733 case "$sitehtml1" in
8734 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8735 *)      dflt=$sitehtml1 ;;
8736 esac
8737 case "$dflt" in
8738 ''|' ') dflt=none ;;
8739 esac
8740 fn=dn+~
8741 rp='Pathname where the site-specific html pages should be installed?'
8742 . ./getfile
8743 sitehtml1="$ans"
8744 sitehtml1exp="$ansexp"
8745 : Use ' ' for none so value is preserved next time through Configure
8746 $test X"$sitehtml1" = "X" && sitehtml1=' '
8747 : Change installation prefix, if necessary.
8748 if $test X"$prefix" != X"$installprefix"; then
8749         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8750 else
8751         installsitehtml1="$sitehtml1exp"
8752 fi
8753
8754 : determine where add-on library html pages go
8755 : There is no standard location, so try to copy the previously-selected
8756 : directory structure for the core html pages.
8757 case "$sitehtml3" in
8758 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8759 *)      dflt=$sitehtml3 ;;
8760 esac
8761 case "$dflt" in
8762 ''|' ') dflt=none ;;
8763 esac
8764 fn=dn+~
8765 rp='Pathname where the site-specific library html pages should be installed?'
8766 . ./getfile
8767 sitehtml3="$ans"
8768 sitehtml3exp="$ansexp"
8769 : Use ' ' for none so value is preserved next time through Configure
8770 $test X"$sitehtml3" = "X" && sitehtml3=' '
8771 : Change installation prefix, if necessary.
8772 if $test X"$prefix" != X"$installprefix"; then
8773         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8774 else
8775         installsitehtml3="$sitehtml3exp"
8776 fi
8777
8778 : determine where add-on manual pages go
8779 case "$siteman1" in
8780 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8781 *)      dflt=$siteman1 ;;
8782 esac
8783 case "$dflt" in
8784 ''|' ') dflt=none ;;
8785 esac
8786 fn=dn+~
8787 rp='Pathname where the site-specific manual pages should be installed?'
8788 . ./getfile
8789 siteman1="$ans"
8790 siteman1exp="$ansexp"
8791 : Use ' ' for none so value is preserved next time through Configure
8792 $test X"$siteman1" = "X" && siteman1=' '
8793 : Change installation prefix, if necessary.
8794 if $test X"$prefix" != X"$installprefix"; then
8795         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8796 else
8797         installsiteman1="$siteman1exp"
8798 fi
8799
8800 : determine where add-on library man pages go
8801 case "$siteman3" in
8802 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8803 *)      dflt=$siteman3 ;;
8804 esac
8805 case "$dflt" in
8806 ''|' ') dflt=none ;;
8807 esac
8808 fn=dn+~
8809 rp='Pathname where the site-specific library manual pages should be installed?'
8810 . ./getfile
8811 siteman3="$ans"
8812 siteman3exp="$ansexp"
8813 : Use ' ' for none so value is preserved next time through Configure
8814 $test X"$siteman3" = "X" && siteman3=' '
8815 : Change installation prefix, if necessary.
8816 if $test X"$prefix" != X"$installprefix"; then
8817         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8818 else
8819         installsiteman3="$siteman3exp"
8820 fi
8821
8822 : determine where add-on public executable scripts go
8823 case "$sitescript" in
8824 '')     dflt=$siteprefix/script
8825         $test -d $dflt || dflt=$sitebin ;;
8826 *)  dflt="$sitescript" ;;
8827 esac
8828 fn=d~+
8829 rp='Pathname where add-on public executable scripts should be installed?'
8830 . ./getfile
8831 sitescript="$ans"
8832 sitescriptexp="$ansexp"
8833 : Change installation prefix, if necessary.
8834 if $test X"$prefix" != X"$installprefix"; then
8835         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8836 else
8837         installsitescript="$sitescriptexp"
8838 fi
8839
8840 : define an is-a-typedef? function
8841 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8842 case "$inclist" in
8843 "") inclist="sys/types.h";;
8844 esac;
8845 eval "varval=\$$var";
8846 case "$varval" in
8847 "")
8848         $rm -f temp.c;
8849         for inc in $inclist; do
8850                 echo "#include <$inc>" >>temp.c;
8851         done;
8852         echo "#ifdef $type" >> temp.c;
8853         echo "printf(\"We have $type\");" >> temp.c;
8854         echo "#endif" >> temp.c;
8855         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8856         if $contains $type temp.E >/dev/null 2>&1; then
8857                 eval "$var=\$type";
8858         else
8859                 eval "$var=\$def";
8860         fi;
8861         $rm -f temp.?;;
8862 *) eval "$var=\$varval";;
8863 esac'
8864
8865 : define an is-a-typedef? function that prompts if the type is not available.
8866 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8867 case "$inclist" in
8868 "") inclist="sys/types.h";;
8869 esac;
8870 eval "varval=\$$var";
8871 case "$varval" in
8872 "")
8873         $rm -f temp.c;
8874         for inc in $inclist; do
8875                 echo "#include <$inc>" >>temp.c;
8876         done;
8877         echo "#ifdef $type" >> temp.c;
8878         echo "printf(\"We have $type\");" >> temp.c;
8879         echo "#endif" >> temp.c;
8880         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8881         echo " " ;
8882         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8883         if $contains $type temp.E >/dev/null 2>&1; then
8884                 echo "$type found." >&4;
8885                 eval "$var=\$type";
8886         else
8887                 echo "$type NOT found." >&4;
8888                 dflt="$def";
8889                 . ./myread ;
8890                 eval "$var=\$ans";
8891         fi;
8892         $rm -f temp.?;;
8893 *) eval "$var=\$varval";;
8894 esac'
8895
8896 : see what type lseek is declared as in the kernel
8897 rp="What is the type used for lseek's offset on this system?"
8898 set off_t lseektype long stdio.h sys/types.h
8899 eval $typedef_ask
8900
8901 echo " "
8902 echo "Checking to see how big your file offsets are..." >&4
8903 $cat >try.c <<EOCP
8904 #include <sys/types.h>
8905 #include <stdio.h>
8906 int main()
8907 {
8908     printf("%d\n", (int)sizeof($lseektype));
8909     return(0); 
8910 }
8911 EOCP
8912 set try
8913 if eval $compile_ok; then
8914         lseeksize=`$run ./try`
8915         echo "Your file offsets are $lseeksize bytes long."
8916 else
8917         dflt=$longsize
8918         echo " "
8919         echo "(I can't seem to compile the test program.  Guessing...)"
8920         rp="What is the size of your file offsets (in bytes)?"
8921         . ./myread
8922         lseeksize="$ans"
8923 fi
8924 $rm -f try.c try
8925
8926 : see what type file positions are declared as in the library
8927 rp="What is the type for file position used by fsetpos()?"
8928 set fpos_t fpostype long stdio.h sys/types.h
8929 eval $typedef_ask
8930
8931 echo " "
8932 case "$fpostype" in
8933 *_t) zzz="$fpostype"    ;;
8934 *)   zzz="fpos_t"       ;;
8935 esac
8936 echo "Checking the size of $zzz..." >&4 
8937 cat > try.c <<EOCP
8938 #include <sys/types.h>
8939 #include <stdio.h>
8940 int main() {
8941     printf("%d\n", (int)sizeof($fpostype));
8942     exit(0);
8943 }
8944 EOCP
8945 set try
8946 if eval $compile_ok; then
8947         yyy=`$run ./try`
8948         case "$yyy" in
8949         '')     fpossize=4
8950                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8951                 ;;
8952         *)      fpossize=$yyy
8953                 echo "Your $zzz is $fpossize bytes long."
8954                 ;;
8955         esac
8956 else
8957         dflt="$longsize"
8958         echo " " >&4
8959         echo "(I can't compile the test program.  Guessing...)" >&4
8960         rp="What is the size of your file positions (in bytes)?"
8961         . ./myread
8962         fpossize="$ans"
8963 fi
8964
8965
8966
8967 # Backward compatibility (uselfs is deprecated).
8968 case "$uselfs" in
8969 "$define"|true|[yY]*)
8970         cat <<EOM >&4
8971
8972 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8973 EOM
8974         uselargefiles="$define"
8975         ;;
8976 esac                          
8977
8978 case "$lseeksize:$fpossize" in
8979 8:8) cat <<EOM
8980
8981 You can have files larger than 2 gigabytes.
8982 EOM
8983    val="$define" ;;
8984 *)    case "$uselargefiles" in
8985    "$undef"|false|[nN]*) dflt='n' ;;
8986    *)   dflt='y' ;;
8987    esac
8988    cat <<EOM
8989
8990 Perl can be built to understand large files (files larger than 2 gigabytes)
8991 on some systems.  To do so, Configure can be run with -Duselargefiles.
8992
8993 If this doesn't make any sense to you, just accept the default '$dflt'.
8994 EOM
8995    rp='Try to understand large files, if available?'
8996    . ./myread
8997    case "$ans" in
8998    y|Y)         val="$define" ;;
8999    *)           val="$undef"  ;;
9000    esac
9001    ;;
9002 esac
9003 set uselargefiles
9004 eval $setvar
9005 case "$uselargefiles" in
9006 "$define")
9007 : Look for a hint-file generated 'call-back-unit'.  If the
9008 : user has specified that a large files perl is to be built,
9009 : we may need to set or change some other defaults.
9010         if $test -f uselargefiles.cbu; then
9011                 echo "Your platform has some specific hints for large file builds, using them..."
9012                 . ./uselargefiles.cbu
9013                 echo " "
9014                 echo "Rechecking to see how big your file offsets are..." >&4
9015                 $cat >try.c <<EOCP
9016 #include <sys/types.h>
9017 #include <stdio.h>
9018 int main()
9019 {
9020     printf("%d\n", (int)sizeof($lseektype));
9021     return(0); 
9022 }
9023 EOCP
9024                 set try
9025                 if eval $compile_ok; then
9026                         lseeksize=`$run ./try`
9027                         $echo "Your file offsets are now $lseeksize bytes long."
9028                 else
9029                         dflt="$lseeksize"
9030                         echo " "
9031                         echo "(I can't seem to compile the test program.  Guessing...)"
9032                         rp="What is the size of your file offsets (in bytes)?"
9033                         . ./myread
9034                         lseeksize="$ans"
9035                 fi
9036                 case "$fpostype" in
9037                 *_t) zzz="$fpostype"    ;;
9038                 *)   zzz="fpos_t"       ;;
9039                 esac
9040                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9041                 $cat > try.c <<EOCP
9042 #include <sys/types.h>
9043 #include <stdio.h>
9044 int main() {
9045     printf("%d\n", (int)sizeof($fpostype));
9046     exit(0);
9047 }
9048 EOCP
9049                 set try
9050                 if eval $compile_ok; then
9051                         yyy=`$run ./try`
9052                         dflt="$lseeksize"
9053                         case "$yyy" in
9054                         '')     echo " "
9055                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9056                                 ;;
9057                         *)      fpossize=$yyy
9058                                 echo " $fpossize bytes." >&4
9059                                 ;;
9060                         esac
9061                 else
9062                         dflt="$fpossize"
9063                         echo " "
9064                         echo "(I can't compile the test program.  Guessing...)" >&4
9065                         rp="What is the size of your file positions (in bytes)?"
9066                         . ./myread
9067                         fpossize="$ans"
9068                 fi
9069                 $rm -f try.c try
9070         fi
9071         ;;
9072 esac
9073
9074 case "$vendorprefix" in
9075 '')     d_vendorbin="$undef"
9076         vendorbin=''
9077         vendorbinexp=''
9078         ;;
9079 *)      d_vendorbin="$define"
9080         : determine where vendor-supplied executables go.
9081         case "$vendorbin" in
9082         '') dflt=$vendorprefix/bin ;;
9083         *)      dflt="$vendorbin" ;;
9084         esac
9085         fn=d~+
9086         rp='Pathname for the vendor-supplied executables directory?'
9087         . ./getfile
9088         vendorbin="$ans"
9089         vendorbinexp="$ansexp"
9090         ;;
9091 esac
9092 : Change installation prefix, if necessary.
9093 if $test X"$prefix" != X"$installprefix"; then
9094         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9095 else
9096         installvendorbin="$vendorbinexp"
9097 fi
9098
9099 case "$vendorprefix" in
9100 '')     vendorhtml1=''
9101         vendorhtml1exp=''
9102         ;;
9103 *)      : determine where vendor-supplied html pages go.
9104         : There is no standard location, so try to copy the previously-selected
9105         : directory structure for the core html pages.
9106         : XXX Better default suggestions would be welcome.
9107         case "$vendorhtml1" in
9108         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9109         *)      dflt=$vendorhtml1 ;;
9110         esac
9111         case "$dflt" in
9112         ''|' ') dflt=none ;;
9113         esac
9114         fn=dn+~
9115         rp='Pathname for the vendor-supplied html pages?'
9116         . ./getfile
9117         vendorhtml1="$ans"
9118         vendorhtml1exp="$ansexp"
9119         ;;
9120 esac
9121 : Use ' ' for none so value is preserved next time through Configure
9122 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
9123 : Change installation prefix, if necessary.
9124 if $test X"$prefix" != X"$installprefix"; then
9125         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9126 else
9127         installvendorhtml1="$vendorhtml1exp"
9128 fi
9129
9130 case "$vendorprefix" in
9131 '')     vendorhtml3=''
9132         vendorhtml3exp=''
9133         ;;
9134 *)      : determine where vendor-supplied module html pages go.
9135         : There is no standard location, so try to copy the previously-selected
9136         : directory structure for the core html pages.
9137         : XXX Better default suggestions would be welcome.
9138         case "$vendorhtml3" in
9139         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9140         *)      dflt=$vendorhtml3 ;;
9141         esac
9142         case "$dflt" in
9143         ''|' ') dflt=none ;;
9144         esac
9145         fn=dn+~
9146         rp='Pathname for the vendor-supplied html pages?'
9147         . ./getfile
9148         vendorhtml3="$ans"
9149         vendorhtml3exp="$ansexp"
9150         ;;
9151 esac
9152 : Use ' ' for none so value is preserved next time through Configure
9153 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9154 : Change installation prefix, if necessary.
9155 if $test X"$prefix" != X"$installprefix"; then
9156         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9157 else
9158         installvendorhtml3="$vendorhtml3exp"
9159 fi
9160
9161 case "$vendorprefix" in
9162 '')     vendorman1=''
9163         vendorman1exp=''
9164         ;;
9165 *)      : determine where vendor-supplied manual pages go.
9166         case "$vendorman1" in
9167         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9168         *)      dflt=$vendorman1 ;;
9169         esac
9170         case "$dflt" in
9171         ''|' ') dflt=none ;;
9172         esac
9173         fn=nd~+
9174         rp='Pathname for the vendor-supplied manual section 1 pages?'
9175         . ./getfile
9176         vendorman1="$ans"
9177         vendorman1exp="$ansexp"
9178         ;;
9179 esac
9180 : Use ' ' for none so value is preserved next time through Configure
9181 $test X"$vendorman1" = "X" && vendorman1=' '
9182 : Change installation prefix, if necessary.
9183 if $test X"$prefix" != X"$installprefix"; then
9184         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9185 else
9186         installvendorman1="$vendorman1exp"
9187 fi
9188
9189 case "$vendorprefix" in
9190 '')     vendorman3=''
9191         vendorman3exp=''
9192         ;;
9193 *)      : determine where vendor-supplied module manual pages go.
9194         case "$vendorman3" in
9195         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9196         *)      dflt=$vendorman3 ;;
9197         esac
9198         case "$dflt" in
9199         ''|' ') dflt=none ;;
9200         esac
9201         fn=nd~+
9202         rp='Pathname for the vendor-supplied manual section 3 pages?'
9203         . ./getfile
9204         vendorman3="$ans"
9205         vendorman3exp="$ansexp"
9206         ;;
9207 esac
9208 : Use ' ' for none so value is preserved next time through Configure
9209 $test X"$vendorman3" = "X" && vendorman3=' '
9210 : Change installation prefix, if necessary.
9211 if $test X"$prefix" != X"$installprefix"; then
9212         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9213 else
9214         installvendorman3="$vendorman3exp"
9215 fi
9216
9217 case "$vendorprefix" in
9218 '')     d_vendorscript="$undef"
9219         vendorscript=''
9220         vendorscriptexp=''
9221         ;;
9222 *)      d_vendorscript="$define"
9223         : determine where vendor-supplied scripts go.
9224         case "$vendorscript" in
9225         '')     dflt=$vendorprefix/script
9226                 $test -d $dflt || dflt=$vendorbin ;;
9227         *)  dflt="$vendorscript" ;;
9228         esac
9229         $cat <<EOM
9230
9231 The installation process will create a directory for 
9232 vendor-supplied scripts.
9233
9234 EOM
9235         fn=d~+
9236         rp='Pathname for the vendor-supplied scripts directory?'
9237         . ./getfile
9238         vendorscript="$ans"
9239         vendorscriptexp="$ansexp"
9240         ;;
9241 esac
9242 : Change installation prefix, if necessary.
9243 if $test X"$prefix" != X"$installprefix"; then
9244         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9245 else
9246         installvendorscript="$vendorscriptexp"
9247 fi
9248
9249 : see if qgcvt exists
9250 set qgcvt d_qgcvt
9251 eval $inlibc
9252
9253 : Check how to convert floats to strings.
9254
9255 if test "X$d_Gconvert" = X; then
9256
9257 echo " "
9258 echo "Checking for an efficient way to convert floats to strings."
9259 echo " " > try.c
9260 case "$uselongdouble" in
9261 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9262 esac
9263 case "$d_longdbl" in
9264 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9265 esac
9266 case "$d_PRIgldbl" in
9267 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9268 esac
9269 $cat >>try.c <<EOP
9270 #ifdef TRY_gconvert
9271 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9272 char *myname = "gconvert";
9273 #endif
9274 #ifdef TRY_gcvt
9275 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9276 char *myname = "gcvt";
9277 #endif
9278 #ifdef TRY_qgcvt
9279 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9280 char *myname = "qgcvt";
9281 #define DOUBLETYPE long double
9282 #endif
9283 #ifdef TRY_sprintf
9284 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9285 #ifdef HAS_PRIgldbl
9286 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9287 #else
9288 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9289 #endif
9290 #else
9291 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9292 #endif
9293 char *myname = "sprintf";
9294 #endif
9295
9296 #ifndef DOUBLETYPE
9297 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9298 #define DOUBLETYPE long double
9299 #else
9300 #define DOUBLETYPE double
9301 #endif
9302 #endif
9303
9304 #include <stdio.h>
9305
9306 #define I_STDLIB $i_stdlib
9307 #ifdef I_STDLIB
9308 #include <stdlib.h>
9309 #endif
9310
9311 int
9312 checkit(expect, got)
9313 char *expect;
9314 char *got;
9315 {
9316     if (strcmp(expect, got)) {
9317                 printf("%s oddity:  Expected %s, got %s\n",
9318                         myname, expect, got);
9319                 exit(1);
9320         }
9321 }
9322
9323 int main()
9324
9325         char buf[64]; 
9326         buf[63] = '\0';
9327
9328         /* This must be 1st test on (which?) platform */
9329         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9330         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9331         checkit("0.1", buf);
9332
9333         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9334         checkit("0.01", buf);
9335
9336         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9337         checkit("0.001", buf);
9338
9339         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9340         checkit("0.0001", buf);
9341
9342         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9343         if (strlen(buf) > 5)
9344             checkit("9e-005", buf); /* for Microsoft ?? */
9345         else
9346             checkit("9e-05", buf);
9347
9348         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9349         checkit("1", buf);
9350
9351         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9352         checkit("1.1", buf);
9353
9354         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9355         checkit("1.01", buf);
9356
9357         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9358         checkit("1.001", buf);
9359
9360         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9361         checkit("1.0001", buf);
9362
9363         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9364         checkit("1.00001", buf);
9365
9366         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9367         checkit("1.000001", buf);
9368
9369         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9370         checkit("0", buf);
9371
9372         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9373         checkit("-1", buf);
9374
9375         /* Some Linux gcvt's give 1.e+5 here. */
9376         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9377         checkit("100000", buf);
9378         
9379         /* Some Linux gcvt's give -1.e+5 here. */
9380         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9381         checkit("-100000", buf);
9382
9383         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9384         checkit("123.456", buf);
9385
9386         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9387         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9388         /* 34 should be enough to scare even long double
9389          * places into using the e notation. */
9390         if (strlen(buf) > 5)
9391             checkit("1e+034", buf); /* for Microsoft */
9392         else
9393             checkit("1e+34", buf);
9394
9395         /* For Perl, if you add additional tests here, also add them to
9396          * t/base/num.t for benefit of platforms not using Configure or
9397          * overriding d_Gconvert */
9398
9399         exit(0);
9400 }
9401 EOP
9402 : first add preferred functions to our list
9403 xxx_list=""
9404 for xxx_convert in $gconvert_preference; do
9405     case $xxx_convert in
9406     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9407     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9408     esac 
9409 done
9410 : then add any others
9411 for xxx_convert in gconvert gcvt sprintf; do
9412     case "$xxx_list" in
9413     *$xxx_convert*) ;;
9414     *) xxx_list="$xxx_list $xxx_convert" ;;
9415     esac 
9416 done
9417
9418 case "$d_longdbl$uselongdouble" in
9419 "$define$define")
9420     : again, add prefered functions to our list first
9421     xxx_ld_list=""
9422     for xxx_convert in $gconvert_ld_preference; do
9423         case $xxx_convert in
9424         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9425         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9426         esac
9427     done
9428     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9429     for xxx_convert in qgcvt sprintf $xxx_list; do
9430         case "$xxx_ld_list" in
9431         $xxx_convert*|*" $xxx_convert"*) ;;
9432         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9433         esac
9434     done
9435     : if sprintf cannot do long doubles, move it to the end
9436     if test "$d_PRIgldbl" != "$define"; then
9437         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9438     fi
9439     : if no qgcvt, remove it
9440     if test "$d_qgcvt" != "$define"; then
9441         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9442     fi
9443     : use the ld_list
9444     xxx_list="$xxx_ld_list"
9445     ;;
9446 esac
9447
9448 for xxx_convert in $xxx_list; do
9449         echo "Trying $xxx_convert..."
9450         $rm -f try try$_o
9451         set try -DTRY_$xxx_convert
9452         if eval $compile; then
9453                 echo "$xxx_convert() found." >&4
9454                 if $run ./try; then
9455                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9456                         break;
9457                 else
9458                         echo "...But $xxx_convert didn't work as I expected."
9459                         xxx_convert=''
9460                 fi
9461         else
9462                 echo "$xxx_convert NOT found." >&4
9463         fi
9464 done
9465
9466 if test X$xxx_convert = X; then
9467     echo "*** WHOA THERE!!! ***" >&4
9468     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9469     xxx_convert=sprintf
9470 fi
9471
9472 case "$xxx_convert" in
9473 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9474 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9475 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9476 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9477    "$define$define$define")
9478       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9479    "$define$define$undef")
9480       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9481    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9482    esac
9483    ;;  
9484 esac
9485
9486 fi
9487
9488 : see if _fwalk exists
9489 set fwalk d__fwalk
9490 eval $inlibc
9491
9492 : Initialize h_fcntl
9493 h_fcntl=false
9494
9495 : Initialize h_sysfile
9496 h_sysfile=false
9497
9498 : access call always available on UNIX
9499 set access d_access
9500 eval $inlibc
9501
9502 : locate the flags for 'access()'
9503 case "$d_access" in
9504 "$define")
9505         echo " "
9506         $cat >access.c <<'EOCP'
9507 #include <sys/types.h>
9508 #ifdef I_FCNTL
9509 #include <fcntl.h>
9510 #endif
9511 #ifdef I_SYS_FILE
9512 #include <sys/file.h>
9513 #endif
9514 #ifdef I_UNISTD
9515 #include <unistd.h>
9516 #endif
9517 int main() {
9518         exit(R_OK);
9519 }
9520 EOCP
9521         : check sys/file.h first, no particular reason here
9522         if $test `./findhdr sys/file.h` && \
9523                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9524                 h_sysfile=true;
9525                 echo "<sys/file.h> defines the *_OK access constants." >&4
9526         elif $test `./findhdr fcntl.h` && \
9527                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9528                 h_fcntl=true;
9529                 echo "<fcntl.h> defines the *_OK access constants." >&4
9530         elif $test `./findhdr unistd.h` && \
9531                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9532                 echo "<unistd.h> defines the *_OK access constants." >&4
9533         else
9534                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9535         fi
9536         ;;
9537 esac
9538 $rm -f access*
9539
9540 : see if accessx exists
9541 set accessx d_accessx
9542 eval $inlibc
9543
9544 : see if alarm exists
9545 set alarm d_alarm
9546 eval $inlibc
9547
9548 : see if POSIX threads are available
9549 set pthread.h i_pthread
9550 eval $inhdr
9551
9552 : define a fucntion to check prototypes
9553 $cat > protochk <<EOSH
9554 $startsh
9555 cc="$cc"
9556 optimize="$optimize"
9557 ccflags="$ccflags"
9558 prototype="$prototype"
9559 define="$define"
9560 rm=$rm
9561 usethreads=$usethreads
9562 i_pthread=$i_pthread
9563 pthread_h_first=$pthread_h_first
9564 EOSH
9565
9566 $cat >> protochk <<'EOSH'
9567
9568 $rm -f try.c
9569 foo="$1"
9570 shift
9571 while test $# -ge 2; do
9572         case "$1" in
9573                 $define) echo "#include <$2>" >> try.c ;;
9574                 literal) echo "$2" >> try.c ;;
9575         esac
9576     # Extra magic for the benefit of systems that need pthread.h
9577     # to be included early to correctly detect threadsafe functions.
9578     # Such functions must guarantee themselves, though, that the usethreads
9579     # and i_pthread have been defined, before calling protochk.
9580     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9581         echo "#include <pthread.h>" >> try.c
9582         pthread_h_done=yes
9583     fi
9584     shift 2
9585 done
9586 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9587 cat >> try.c <<'EOCP'
9588 #ifdef CAN_PROTOTYPE
9589 #define _(args) args
9590 #else
9591 #define _(args) ()
9592 #endif
9593 EOCP
9594 echo "$foo" >> try.c
9595 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9596 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9597 status=$?
9598 $rm -f try.[co]
9599 exit $status
9600 EOSH
9601 chmod +x protochk
9602 $eunicefix protochk
9603
9604 : see if sys/types.h has to be included
9605 set sys/types.h i_systypes
9606 eval $inhdr
9607
9608 : see if sys/select.h has to be included
9609 set sys/select.h i_sysselct
9610 eval $inhdr
9611
9612 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9613 while $test $# -ge 2; do
9614         case "$1" in
9615         $define) echo "#include <$2>";;
9616         esac ;
9617     shift 2;
9618 done > try.c;
9619 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9620 set try;
9621 if eval $compile; then
9622         val="$define";
9623 else
9624         val="$undef";
9625 fi;
9626 set $varname;
9627 eval $setvar;
9628 $rm -f try.c try.o'
9629
9630 : see if we should include time.h, sys/time.h, or both
9631 echo " "
9632 if test "X$timeincl" = X; then
9633         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9634         $echo $n "I'm now running the test program...$c"
9635         $cat >try.c <<'EOCP'
9636 #include <sys/types.h>
9637 #ifdef I_TIME
9638 #include <time.h>
9639 #endif
9640 #ifdef I_SYSTIME
9641 #ifdef SYSTIMEKERNEL
9642 #define KERNEL
9643 #endif
9644 #include <sys/time.h>
9645 #endif
9646 #ifdef I_SYSSELECT
9647 #include <sys/select.h>
9648 #endif
9649 int main()
9650 {
9651         struct tm foo;
9652 #ifdef S_TIMEVAL
9653         struct timeval bar;
9654 #endif
9655 #ifdef S_TIMEZONE
9656         struct timezone tzp;
9657 #endif
9658         if (foo.tm_sec == foo.tm_sec)
9659                 exit(0);
9660 #ifdef S_TIMEVAL
9661         if (bar.tv_sec == bar.tv_sec)
9662                 exit(0);
9663 #endif
9664         exit(1);
9665 }
9666 EOCP
9667         flags=''
9668         for s_timezone in '-DS_TIMEZONE' ''; do
9669         sysselect=''
9670         for s_timeval in '-DS_TIMEVAL' ''; do
9671         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9672         for i_time in '' '-DI_TIME'; do
9673         for i_systime in '-DI_SYSTIME' ''; do
9674                 case "$flags" in
9675                 '') $echo $n ".$c"
9676                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9677                         if eval $compile; then
9678                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9679                                 shift
9680                                 flags="$*"
9681                                 echo " "
9682                                 $echo $n "Succeeded with $flags$c"
9683                         fi
9684                         ;;
9685                 esac
9686         done
9687         done
9688         done
9689         done
9690         done
9691         timeincl=''
9692         echo " "
9693         case "$flags" in
9694         *SYSTIMEKERNEL*) i_systimek="$define"
9695                 timeincl=`./findhdr sys/time.h`
9696                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9697         *) i_systimek="$undef";;
9698         esac
9699         case "$flags" in
9700         *I_TIME*) i_time="$define"
9701                 timeincl=`./findhdr time.h`" $timeincl"
9702                 echo "We'll include <time.h>." >&4;;
9703         *) i_time="$undef";;
9704         esac
9705         case "$flags" in
9706         *I_SYSTIME*) i_systime="$define"
9707                 timeincl=`./findhdr sys/time.h`" $timeincl"
9708                 echo "We'll include <sys/time.h>." >&4;;
9709         *) i_systime="$undef";;
9710         esac
9711         $rm -f try.c try
9712 fi
9713 : see if struct tm knows about tm_zone
9714 case "$i_systime$i_time" in
9715 *$define*) 
9716         echo " "
9717         echo "Checking to see if your struct tm has tm_zone field..." >&4
9718         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9719         eval $hasfield
9720         ;;
9721 *)      val="$undef"
9722         set d_tm_tm_zone
9723         eval $setvar
9724         ;;
9725 esac
9726 case "$d_tm_tm_zone" in
9727 "$define")      echo "Yes, it does."   ;;
9728 *)              echo "No, it doesn't." ;;
9729 esac
9730 : see if struct tm knows about tm_gmtoff
9731 case "$i_systime$i_time" in
9732 *$define*) 
9733         echo " "
9734         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9735         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9736         eval $hasfield
9737         ;;
9738 *)      val="$undef"
9739         set d_tm_tm_gmtoff
9740         eval $setvar
9741         ;;
9742 esac
9743 case "$d_tm_tm_gmtoff" in
9744 "$define")      echo "Yes, it does."   ;;
9745 *)              echo "No, it doesn't." ;;
9746 esac
9747
9748 : see if asctime_r exists
9749 set asctime_r d_asctime_r
9750 eval $inlibc
9751 case "$d_asctime_r" in
9752 "$define")
9753         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9754         case "$d_asctime_r_proto:$usethreads" in
9755         ":define")      d_asctime_r_proto=define
9756                 set d_asctime_r_proto asctime_r $hdrs
9757                 eval $hasproto ;;
9758         *)      ;;
9759         esac
9760         case "$d_asctime_r_proto" in
9761         define)
9762         case "$asctime_r_proto" in
9763         ''|0) try='char* asctime_r(const struct tm*, char*);'
9764         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9765         esac
9766         case "$asctime_r_proto" in
9767         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9768         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9769         esac
9770         case "$asctime_r_proto" in
9771         ''|0) try='int asctime_r(const struct tm*, char*);'
9772         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9773         esac
9774         case "$asctime_r_proto" in
9775         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9776         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9777         esac
9778         case "$asctime_r_proto" in
9779         ''|0)   d_asctime_r=undef
9780                 asctime_r_proto=0
9781                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9782         * )     case "$asctime_r_proto" in
9783                 REENTRANT_PROTO*) ;;
9784                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9785                 esac
9786                 echo "Prototype: $try" ;;
9787         esac
9788         ;;
9789         *)      case "$usethreads" in
9790                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9791                 esac
9792                 d_asctime_r=undef
9793                 asctime_r_proto=0
9794                 ;;
9795         esac
9796         ;;
9797 *)      asctime_r_proto=0
9798         ;;
9799 esac
9800
9801 : see if atolf exists
9802 set atolf d_atolf
9803 eval $inlibc
9804
9805 : see if atoll exists
9806 set atoll d_atoll
9807 eval $inlibc
9808
9809 : Look for GNU-cc style attribute checking
9810 echo " "
9811 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9812 $cat >attrib.c <<'EOCP'
9813 #include <stdio.h>
9814 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9815 EOCP
9816 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9817         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9818                 echo "Your C compiler doesn't fully support __attribute__."
9819                 val="$undef"
9820         else
9821                 echo "Your C compiler supports __attribute__."
9822                 val="$define"
9823         fi
9824 else
9825         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9826         val="$undef"
9827 fi
9828 set d_attribut
9829 eval $setvar
9830 $rm -f attrib*
9831
9832 : see if bcmp exists
9833 set bcmp d_bcmp
9834 eval $inlibc
9835
9836 : see if bcopy exists
9837 set bcopy d_bcopy
9838 eval $inlibc
9839
9840 : see if this is a unistd.h system
9841 set unistd.h i_unistd
9842 eval $inhdr
9843
9844 : see if getpgrp exists
9845 set getpgrp d_getpgrp
9846 eval $inlibc
9847
9848 case "$d_getpgrp" in
9849 "$define")
9850         echo " "
9851         echo "Checking to see which flavor of getpgrp is in use..."
9852         $cat >try.c <<EOP
9853 #$i_unistd I_UNISTD
9854 #include <sys/types.h>
9855 #ifdef I_UNISTD
9856 #  include <unistd.h>
9857 #endif
9858 int main()
9859 {
9860         if (getuid() == 0) {
9861                 printf("(I see you are running Configure as super-user...)\n");
9862                 setuid(1);
9863         }
9864 #ifdef TRY_BSD_PGRP
9865         if (getpgrp(1) == 0)
9866                 exit(0);
9867 #else
9868         if (getpgrp() > 0)
9869                 exit(0);
9870 #endif
9871         exit(1);
9872 }
9873 EOP
9874         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9875                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9876                 val="$define"
9877         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9878                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9879                 val="$undef"
9880         else
9881                 echo "I can't seem to compile and run the test program."
9882                 if ./usg; then
9883                         xxx="a USG one, i.e. you use getpgrp()."
9884                 else
9885                         # SVR4 systems can appear rather BSD-ish.
9886                         case "$i_unistd" in
9887                         $undef)
9888                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9889                                 val="$define"
9890                                 ;;
9891                         $define)
9892                                 xxx="probably a USG one, i.e. you use getpgrp()."
9893                                 val="$undef"
9894                                 ;;
9895                         esac
9896                 fi
9897                 echo "Assuming your getpgrp is $xxx" >&4
9898         fi
9899         ;;
9900 *) val="$undef";;
9901 esac
9902 set d_bsdgetpgrp
9903 eval $setvar
9904 $rm -f try try.*
9905
9906 : see if setpgrp exists
9907 set setpgrp d_setpgrp
9908 eval $inlibc
9909
9910 case "$d_setpgrp" in
9911 "$define")
9912         echo " "
9913         echo "Checking to see which flavor of setpgrp is in use..."
9914         $cat >try.c <<EOP
9915 #$i_unistd I_UNISTD
9916 #include <sys/types.h>
9917 #ifdef I_UNISTD
9918 #  include <unistd.h>
9919 #endif
9920 int main()
9921 {
9922         if (getuid() == 0) {
9923                 printf("(I see you are running Configure as super-user...)\n");
9924                 setuid(1);
9925         }
9926 #ifdef TRY_BSD_PGRP
9927         if (-1 == setpgrp(1, 1))
9928                 exit(0);
9929 #else
9930         if (setpgrp() != -1)
9931                 exit(0);
9932 #endif
9933         exit(1);
9934 }
9935 EOP
9936         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9937                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9938                 val="$define"
9939         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9940                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9941                 val="$undef"
9942         else
9943                 echo "(I can't seem to compile and run the test program.)"
9944                 if ./usg; then
9945                         xxx="a USG one, i.e. you use setpgrp()."
9946                 else
9947                         # SVR4 systems can appear rather BSD-ish.
9948                         case "$i_unistd" in
9949                         $undef)
9950                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9951                                 val="$define"
9952                                 ;;
9953                         $define)
9954                                 xxx="probably a USG one, i.e. you use setpgrp()."
9955                                 val="$undef"
9956                                 ;;
9957                         esac
9958                 fi
9959                 echo "Assuming your setpgrp is $xxx" >&4
9960         fi
9961         ;;
9962 *) val="$undef";;
9963 esac
9964 set d_bsdsetpgrp
9965 eval $setvar
9966 $rm -f try try.*
9967 : see if bzero exists
9968 set bzero d_bzero
9969 eval $inlibc
9970
9971 : see if signal is declared as pointer to function returning int or void
9972 echo " "
9973 xxx=`./findhdr signal.h`
9974 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9975 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9976         echo "You have int (*signal())() instead of void." >&4
9977         val="$undef"
9978 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9979         echo "You have void (*signal())()." >&4
9980         val="$define"
9981 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9982         echo "You have int (*signal())() instead of void." >&4
9983         val="$undef"
9984 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9985         echo "You have void (*signal())()." >&4
9986         val="$define"
9987 else
9988         case "$d_voidsig" in
9989         '')
9990         echo "I can't determine whether signal handler returns void or int..." >&4
9991                 dflt=void
9992                 rp="What type does your signal handler return?"
9993                 . ./myread
9994                 case "$ans" in
9995                 v*) val="$define";;
9996                 *) val="$undef";;
9997                 esac;;
9998         "$define")
9999                 echo "As you already told me, signal handler returns void." >&4
10000                 val="$define"
10001                 ;;
10002         *)      echo "As you already told me, signal handler returns int." >&4
10003                 val="$undef"
10004                 ;;
10005         esac
10006 fi
10007 set d_voidsig
10008 eval $setvar
10009 case "$d_voidsig" in
10010 "$define") signal_t="void";;
10011 *) signal_t="int";;
10012 esac
10013 $rm -f $$.tmp
10014
10015 : check for ability to cast large floats to 32-bit ints.
10016 echo " "
10017 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10018 if $test "$intsize" -ge 4; then
10019         xxx=int
10020 else
10021         xxx=long
10022 fi
10023 $cat >try.c <<EOCP
10024 #include <stdio.h>
10025 #include <sys/types.h>
10026 #include <signal.h>
10027 $signal_t blech(s) int s; { exit(3); }
10028 int main()
10029 {
10030         $xxx i32;
10031         double f, g;
10032         int result = 0;
10033         char str[16];
10034         signal(SIGFPE, blech);
10035
10036         /* Don't let compiler optimize the test away.  Store the number 
10037            in a writable string for gcc to pass to sscanf under HP/UX.
10038         */
10039         sprintf(str, "2147483647");
10040         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10041         g = 10 * f;
10042         i32  = ($xxx) g;
10043
10044         /* x86 processors will probably give 0x8000 0000, which is a
10045        sign change.  We don't want that.  We want to mimic SPARC
10046            behavior here, which is to preserve the sign and give
10047            back 0x7fff ffff.
10048         */
10049         if (i32 != ($xxx) f)
10050                 result |= 1;
10051         exit(result);
10052 }
10053 EOCP
10054 set try
10055 if eval $compile_ok; then
10056         $run ./try
10057         yyy=$?
10058 else
10059         echo "(I can't seem to compile the test program--assuming it can't)"
10060         yyy=1
10061 fi
10062 case "$yyy" in
10063 0)      val="$define"
10064         echo "Yup, it can."
10065         ;;
10066 *)      val="$undef"
10067         echo "Nope, it can't."
10068         ;;
10069 esac
10070 set d_casti32
10071 eval $setvar
10072 $rm -f try try.*
10073
10074 : check for ability to cast negative floats to unsigned
10075 echo " "
10076 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10077 $cat >try.c <<EOCP
10078 #include <stdio.h>
10079 #include <sys/types.h>
10080 #include <signal.h>
10081 $signal_t blech(s) int s; { exit(7); }
10082 $signal_t blech_in_list(s) int s; { exit(4); }
10083 unsigned long dummy_long(p) unsigned long p; { return p; }
10084 unsigned int dummy_int(p) unsigned int p; { return p; }
10085 unsigned short dummy_short(p) unsigned short p; { return p; }
10086 int main()
10087 {
10088         double f;
10089         unsigned long along;
10090         unsigned int aint;
10091         unsigned short ashort;
10092         int result = 0;
10093         char str[16];
10094         
10095         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10096            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10097            optimized the whole file away
10098         */
10099         /* Store the number in a writable string for gcc to pass to 
10100            sscanf under HP/UX.
10101         */
10102         sprintf(str, "-123");
10103         sscanf(str, "%lf", &f);  /* f = -123.; */
10104
10105         signal(SIGFPE, blech);
10106         along = (unsigned long)f;
10107         aint = (unsigned int)f;
10108         ashort = (unsigned short)f;
10109         if (along != (unsigned long)-123)
10110                 result |= 1;
10111         if (aint != (unsigned int)-123)
10112                 result |= 1;
10113         if (ashort != (unsigned short)-123)
10114                 result |= 1;
10115         sprintf(str, "1073741824.");
10116         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10117         f = f + f;
10118         along = 0;
10119         along = (unsigned long)f;
10120         if (along != 0x80000000)
10121                 result |= 2;
10122         f -= 1.;
10123         along = 0;
10124         along = (unsigned long)f;
10125         if (along != 0x7fffffff)
10126                 result |= 1;
10127         f += 2.;
10128         along = 0;
10129         along = (unsigned long)f;
10130         if (along != 0x80000001)
10131                 result |= 2;
10132         if (result)
10133                 exit(result);
10134         signal(SIGFPE, blech_in_list);
10135         sprintf(str, "123.");
10136         sscanf(str, "%lf", &f);  /* f = 123.; */
10137         along = dummy_long((unsigned long)f);
10138         aint = dummy_int((unsigned int)f);
10139         ashort = dummy_short((unsigned short)f);
10140         if (along != (unsigned long)123)
10141                 result |= 4;
10142         if (aint != (unsigned int)123)
10143                 result |= 4;
10144         if (ashort != (unsigned short)123)
10145                 result |= 4;
10146         exit(result);
10147
10148 }
10149 EOCP
10150 set try
10151 if eval $compile_ok; then
10152         $run ./try
10153         castflags=$?
10154 else
10155         echo "(I can't seem to compile the test program--assuming it can't)"
10156         castflags=7
10157 fi
10158 case "$castflags" in
10159 0)      val="$define"
10160         echo "Yup, it can."
10161         ;;
10162 *)      val="$undef"
10163         echo "Nope, it can't."
10164         ;;
10165 esac
10166 set d_castneg
10167 eval $setvar
10168 $rm -f try.*
10169
10170 : see if vprintf exists
10171 echo " "
10172 if set vprintf val -f d_vprintf; eval $csym; $val; then
10173         echo 'vprintf() found.' >&4
10174         val="$define"
10175         $cat >try.c <<'EOF'
10176 #include <varargs.h>
10177
10178 int main() { xxx("foo"); }
10179
10180 xxx(va_alist)
10181 va_dcl
10182 {
10183         va_list args;
10184         char buf[10];
10185
10186         va_start(args);
10187         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10188 }
10189 EOF
10190         set try
10191         if eval $compile && $run ./try; then
10192                 echo "Your vsprintf() returns (int)." >&4
10193                 val2="$undef"
10194         else
10195                 echo "Your vsprintf() returns (char*)." >&4
10196                 val2="$define"
10197         fi
10198 else
10199         echo 'vprintf() NOT found.' >&4
10200                 val="$undef"
10201                 val2="$undef"
10202 fi
10203 $rm -f try try.*
10204 set d_vprintf
10205 eval $setvar
10206 val=$val2
10207 set d_charvspr
10208 eval $setvar
10209
10210 : see if chown exists
10211 set chown d_chown
10212 eval $inlibc
10213
10214 : see if chroot exists
10215 set chroot d_chroot
10216 eval $inlibc
10217
10218 : see if chsize exists
10219 set chsize d_chsize
10220 eval $inlibc
10221
10222 : see if class exists
10223 set class d_class
10224 eval $inlibc
10225
10226 hasstruct='varname=$1; struct=$2; shift; shift;
10227 while $test $# -ge 2; do
10228         case "$1" in
10229         $define) echo "#include <$2>";;
10230         esac ;
10231     shift 2;
10232 done > try.c;
10233 echo "int main () { struct $struct foo; }" >> try.c;
10234 set try;
10235 if eval $compile; then
10236         val="$define";
10237 else
10238         val="$undef";
10239 fi;
10240 set $varname;
10241 eval $setvar;
10242 $rm -f try.c try.o'
10243
10244 socketlib=''
10245 sockethdr=''
10246 : see whether socket exists
10247 echo " "
10248 $echo $n "Hmm... $c" >&4
10249 if set socket val -f d_socket; eval $csym; $val; then
10250         echo "Looks like you have Berkeley networking support." >&4
10251         d_socket="$define"
10252         if set setsockopt val -f; eval $csym; $val; then
10253                 d_oldsock="$undef"
10254         else
10255                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10256                 d_oldsock="$define"
10257         fi
10258 else
10259         if $contains socklib libc.list >/dev/null 2>&1; then
10260                 echo "Looks like you have Berkeley networking support." >&4
10261                 d_socket="$define"
10262                 : we will have to assume that it supports the 4.2 BSD interface
10263                 d_oldsock="$undef"
10264         else
10265                 echo "You don't have Berkeley networking in libc$_a..." >&4
10266                 if test "X$d_socket" = "X$define"; then
10267                    echo "...but you seem to believe that you have sockets." >&4
10268                 else
10269                         for net in net socket
10270                         do
10271                                 if test -f /usr/lib/lib$net$_a; then
10272                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10273                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10274                                         if $contains socket libc.list >/dev/null 2>&1; then
10275                                                 d_socket="$define"
10276                                                 socketlib="-l$net"
10277                                                 case "$net" in
10278                                                 net)
10279                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10280                                                         sockethdr="-I/usr/netinclude"
10281                                                         ;;
10282                                                 esac
10283                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10284                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10285                                                         d_oldsock="$undef"
10286                                                 else
10287                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10288                                                         d_oldsock="$define"
10289                                                 fi
10290                                                 break
10291                                         fi
10292                                 fi
10293                         done
10294                         if test "X$d_socket" != "X$define"; then
10295                            echo "or anywhere else I see." >&4
10296                            d_socket="$undef"
10297                            d_oldsock="$undef"
10298                         fi
10299                 fi
10300         fi
10301 fi
10302
10303 : see if socketpair exists
10304 set socketpair d_sockpair
10305 eval $inlibc
10306
10307
10308 echo " "
10309 echo "Checking the availability of certain socket constants..." >&4
10310 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10311         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10312         $cat >try.c <<EOF
10313 #include <sys/types.h>
10314 #include <sys/socket.h>
10315 int main() {
10316     int i = $ENUM;
10317 }
10318 EOF
10319         val="$undef"
10320         set try; if eval $compile; then
10321                 val="$define"
10322         fi
10323         set d_${enum}; eval $setvar
10324         $rm -f try.c try
10325 done
10326
10327 : see if this is a sys/uio.h system
10328 set sys/uio.h i_sysuio
10329 eval $inhdr
10330
10331
10332 echo " "
10333 echo "Checking to see if your system supports struct cmsghdr..." >&4
10334 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10335 eval $hasstruct
10336 case "$d_cmsghdr_s" in
10337 "$define")      echo "Yes, it does."   ;;
10338 *)              echo "No, it doesn't." ;;
10339 esac
10340
10341
10342 : check for const keyword
10343 echo " "
10344 echo 'Checking to see if your C compiler knows about "const"...' >&4
10345 $cat >const.c <<'EOCP'
10346 typedef struct spug { int drokk; } spug;
10347 main()
10348 {
10349         const char *foo;
10350         const spug y;
10351 }
10352 EOCP
10353 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10354         val="$define"
10355         echo "Yup, it does."
10356 else
10357         val="$undef"
10358         echo "Nope, it doesn't."
10359 fi
10360 set d_const
10361 eval $setvar
10362
10363 : see if crypt exists
10364 echo " "
10365 set crypt d_crypt
10366 eval $inlibc
10367 case "$d_crypt" in
10368 $define) cryptlib='' ;;
10369 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10370                 echo 'crypt() found.' >&4
10371                 val="$define"
10372                 cryptlib=''
10373         else
10374                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10375                 if $test -z "$cryptlib"; then
10376                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10377                 else
10378                         cryptlib=-lcrypt
10379                 fi
10380                 if $test -z "$cryptlib"; then
10381                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10382                 else
10383                         cryptlib=-lcrypt
10384                 fi
10385                 if $test -z "$cryptlib"; then
10386                         cryptlib=`./loc libcrypt$_a "" $libpth`
10387                 else
10388                         cryptlib=-lcrypt
10389                 fi
10390                 if $test -z "$cryptlib"; then
10391                         echo 'crypt() NOT found.' >&4
10392                         val="$undef"
10393                 else
10394                         val="$define"
10395                 fi
10396         fi
10397         set d_crypt
10398         eval $setvar
10399         ;;
10400 esac
10401
10402 : see if this is a crypt.h system
10403 set crypt.h i_crypt
10404 eval $inhdr
10405
10406 : see if crypt_r exists
10407 set crypt_r d_crypt_r
10408 eval $inlibc
10409 case "$d_crypt_r" in
10410 "$define")
10411         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10412         case "$d_crypt_r_proto:$usethreads" in
10413         ":define")      d_crypt_r_proto=define
10414                 set d_crypt_r_proto crypt_r $hdrs
10415                 eval $hasproto ;;
10416         *)      ;;
10417         esac
10418         case "$d_crypt_r_proto" in
10419         define)
10420         case "$crypt_r_proto" in
10421         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10422         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10423         esac
10424         case "$crypt_r_proto" in
10425         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10426         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10427         esac
10428         case "$crypt_r_proto" in
10429         ''|0)   d_crypt_r=undef
10430                 crypt_r_proto=0
10431                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10432         * )     case "$crypt_r_proto" in
10433                 REENTRANT_PROTO*) ;;
10434                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10435                 esac
10436                 echo "Prototype: $try" ;;
10437         esac
10438         ;;
10439         *)      case "$usethreads" in
10440                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10441                 esac
10442                 d_crypt_r=undef
10443                 crypt_r_proto=0
10444                 ;;
10445         esac
10446         ;;
10447 *)      crypt_r_proto=0
10448         ;;
10449 esac
10450
10451 : get csh whereabouts
10452 case "$csh" in
10453 'csh') val="$undef" ;;
10454 *) val="$define" ;;
10455 esac
10456 set d_csh
10457 eval $setvar
10458 : Respect a hint or command line value for full_csh.
10459 case "$full_csh" in
10460 '') full_csh=$csh ;;
10461 esac
10462
10463 : see if ctermid_r exists
10464 set ctermid_r d_ctermid_r
10465 eval $inlibc
10466 case "$d_ctermid_r" in
10467 "$define")
10468         hdrs="$i_systypes sys/types.h define stdio.h "
10469         case "$d_ctermid_r_proto:$usethreads" in
10470         ":define")      d_ctermid_r_proto=define
10471                 set d_ctermid_r_proto ctermid_r $hdrs
10472                 eval $hasproto ;;
10473         *)      ;;
10474         esac
10475         case "$d_ctermid_r_proto" in
10476         define)
10477         case "$ctermid_r_proto" in
10478         ''|0) try='char* ctermid_r(char*);'
10479         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10480         esac
10481         case "$ctermid_r_proto" in
10482         ''|0)   d_ctermid_r=undef
10483                 ctermid_r_proto=0
10484                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10485         * )     case "$ctermid_r_proto" in
10486                 REENTRANT_PROTO*) ;;
10487                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10488                 esac
10489                 echo "Prototype: $try" ;;
10490         esac
10491         ;;
10492         *)      case "$usethreads" in
10493                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10494                 esac
10495                 d_ctermid_r=undef
10496                 ctermid_r_proto=0
10497                 ;;
10498         esac
10499         ;;
10500 *)      ctermid_r_proto=0
10501         ;;
10502 esac
10503
10504 : see if ctime_r exists
10505 set ctime_r d_ctime_r
10506 eval $inlibc
10507 case "$d_ctime_r" in
10508 "$define")
10509         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10510         case "$d_ctime_r_proto:$usethreads" in
10511         ":define")      d_ctime_r_proto=define
10512                 set d_ctime_r_proto ctime_r $hdrs
10513                 eval $hasproto ;;
10514         *)      ;;
10515         esac
10516         case "$d_ctime_r_proto" in
10517         define)
10518         case "$ctime_r_proto" in
10519         ''|0) try='char* ctime_r(const time_t*, char*);'
10520         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10521         esac
10522         case "$ctime_r_proto" in
10523         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10524         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10525         esac
10526         case "$ctime_r_proto" in
10527         ''|0) try='int ctime_r(const time_t*, char*);'
10528         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10529         esac
10530         case "$ctime_r_proto" in
10531         ''|0) try='int ctime_r(const time_t*, char*, int);'
10532         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10533         esac
10534         case "$ctime_r_proto" in
10535         ''|0)   d_ctime_r=undef
10536                 ctime_r_proto=0
10537                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10538         * )     case "$ctime_r_proto" in
10539                 REENTRANT_PROTO*) ;;
10540                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10541                 esac
10542                 echo "Prototype: $try" ;;
10543         esac
10544         ;;
10545         *)      case "$usethreads" in
10546                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10547                 esac
10548                 d_ctime_r=undef
10549                 ctime_r_proto=0
10550                 ;;
10551         esac
10552         ;;
10553 *)      ctime_r_proto=0
10554         ;;
10555 esac
10556
10557 : see if cuserid exists
10558 set cuserid d_cuserid
10559 eval $inlibc
10560
10561 : see if this is a limits.h system
10562 set limits.h i_limits
10563 eval $inhdr
10564
10565 : see if this is a float.h system
10566 set float.h i_float
10567 eval $inhdr
10568
10569 : See if number of significant digits in a double precision number is known
10570 echo " "
10571 $cat >dbl_dig.c <<EOM
10572 #$i_limits I_LIMITS
10573 #$i_float I_FLOAT
10574 #ifdef I_LIMITS
10575 #include <limits.h>
10576 #endif
10577 #ifdef I_FLOAT
10578 #include <float.h>
10579 #endif
10580 #ifdef DBL_DIG
10581 printf("Contains DBL_DIG");
10582 #endif
10583 EOM
10584 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10585 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10586         echo "DBL_DIG found." >&4
10587         val="$define"
10588 else
10589         echo "DBL_DIG NOT found." >&4
10590         val="$undef"
10591 fi
10592 $rm -f dbl_dig.?
10593 set d_dbl_dig
10594 eval $setvar
10595
10596 : see if dbm.h is available
10597 : see if dbmclose exists
10598 set dbmclose d_dbmclose
10599 eval $inlibc
10600
10601 case "$d_dbmclose" in
10602 $define)
10603         set dbm.h i_dbm
10604         eval $inhdr
10605         case "$i_dbm" in
10606         $define)
10607                 val="$undef"
10608                 set i_rpcsvcdbm
10609                 eval $setvar
10610                 ;;
10611         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10612                 eval $inhdr
10613                 ;;
10614         esac
10615         ;;
10616 *)      echo "We won't be including <dbm.h>"
10617         val="$undef"
10618         set i_dbm
10619         eval $setvar
10620         val="$undef"
10621         set i_rpcsvcdbm
10622         eval $setvar
10623         ;;
10624 esac
10625
10626 : see if prototype for dbminit is available
10627 echo " "
10628 set d_dbminitproto dbminit $i_dbm dbm.h
10629 eval $hasproto
10630
10631 : see if difftime exists
10632 set difftime d_difftime
10633 eval $inlibc
10634
10635 : see if this is a dirent system
10636 echo " "
10637 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10638         val="$define"
10639         echo "<dirent.h> found." >&4
10640 else
10641         val="$undef"
10642         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10643                 echo "<sys/dir.h> found." >&4
10644                 echo " "
10645         else
10646                 xinc=`./findhdr sys/ndir.h`
10647         fi
10648         echo "<dirent.h> NOT found." >&4
10649 fi
10650 set i_dirent
10651 eval $setvar
10652
10653 : Look for type of directory structure.
10654 echo " "
10655 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10656
10657 case "$direntrytype" in
10658 ''|' ')
10659         case "$i_dirent" in
10660         $define) guess1='struct dirent' ;;
10661         *) guess1='struct direct'  ;;
10662         esac
10663         ;;
10664 *)      guess1="$direntrytype"
10665         ;;
10666 esac
10667
10668 case "$guess1" in
10669 'struct dirent') guess2='struct direct' ;;
10670 *) guess2='struct dirent' ;;
10671 esac
10672                 
10673 if $contains "$guess1" try.c >/dev/null 2>&1; then
10674         direntrytype="$guess1"
10675         echo "Your directory entries are $direntrytype." >&4
10676 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10677         direntrytype="$guess2"
10678         echo "Your directory entries seem to be $direntrytype." >&4
10679 else
10680         echo "I don't recognize your system's directory entries." >&4
10681         rp="What type is used for directory entries on this system?"
10682         dflt="$guess1"
10683         . ./myread
10684         direntrytype="$ans"
10685 fi
10686 $rm -f try.c
10687
10688
10689 : see if the directory entry stores field length
10690 echo " "
10691 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10692 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10693         echo "Good, your directory entry keeps length information in d_namlen." >&4
10694         val="$define"
10695 else
10696         echo "Your directory entry does not know about the d_namlen field." >&4
10697         val="$undef"
10698 fi
10699 set d_dirnamlen
10700 eval $setvar
10701 $rm -f try.c
10702
10703 : see if this is an sysdir system
10704 set sys/dir.h i_sysdir
10705 eval $inhdr
10706
10707 : see if this is an sysndir system
10708 set sys/ndir.h i_sysndir
10709 eval $inhdr
10710
10711 : Look for dirfd
10712 echo " "
10713 $cat >dirfd.c <<EOM
10714 #include <stdio.h>
10715 #$i_dirent I_DIRENT             /**/
10716 #$i_sysdir I_SYS_DIR            /**/
10717 #$i_sysndir I_SYS_NDIR          /**/
10718 #$i_systypes I_SYS_TYPES        /**/
10719 #if defined(I_SYS_TYPES)
10720 #include <sys/types.h>
10721 #endif
10722 #if defined(I_DIRENT)
10723 #include <dirent.h>
10724 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10725 #include <sys/dir.h>
10726 #endif
10727 #else
10728 #ifdef I_SYS_NDIR
10729 #include <sys/ndir.h>
10730 #else
10731 #ifdef I_SYS_DIR
10732 #ifdef hp9000s500
10733 #include <ndir.h>       /* may be wrong in the future */
10734 #else
10735 #include <sys/dir.h>
10736 #endif
10737 #endif
10738 #endif
10739 #endif 
10740 int main() {
10741         DIR *dirp = opendir(".");
10742         if (dirfd(dirp) >= 0)
10743                 exit(0);
10744         else
10745                 exit(1);
10746 }
10747 EOM
10748 set dirfd
10749 if eval $compile; then
10750         val="$define"
10751 fi
10752 case "$val" in
10753 $define)        echo "dirfd() found." >&4       ;;
10754 *)              echo "dirfd() NOT found." >&4   ;;
10755 esac
10756 set d_dirfd
10757 eval $setvar
10758 $rm -f dirfd*
10759
10760 : see if dlerror exists
10761 xxx_runnm="$runnm"
10762 runnm=false
10763 set dlerror d_dlerror
10764 eval $inlibc
10765 runnm="$xxx_runnm"
10766
10767 : see if dlfcn is available
10768 set dlfcn.h i_dlfcn
10769 eval $inhdr
10770
10771 case "$usedl" in
10772 $define|y|true)
10773         $cat << EOM
10774
10775 On a few systems, the dynamically loaded modules that perl generates and uses
10776 will need a different extension than shared libs. The default will probably
10777 be appropriate.
10778
10779 EOM
10780         case "$dlext" in
10781         '')     dflt="$so" ;;
10782         *)      dflt="$dlext" ;;
10783         esac
10784         rp='What is the extension of dynamically loaded modules'
10785         . ./myread
10786         dlext="$ans"
10787         ;;
10788 *)
10789         dlext="none"
10790         ;;
10791 esac
10792
10793 : Check if dlsym need a leading underscore
10794 echo " "
10795 val="$undef"
10796
10797 case "$dlsrc" in
10798 dl_dlopen.xs)
10799         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10800         $cat >dyna.c <<'EOM'
10801 fred () { }
10802 EOM
10803
10804 $cat >fred.c<<EOM
10805
10806 #include <stdio.h>
10807 #$i_dlfcn I_DLFCN
10808 #ifdef I_DLFCN
10809 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10810 #else
10811 #include <sys/types.h>
10812 #include <nlist.h>
10813 #include <link.h>
10814 #endif
10815
10816 extern int fred() ;
10817
10818 int main()
10819 {
10820     void * handle ;
10821     void * symbol ;
10822 #ifndef RTLD_LAZY
10823     int mode = 1 ;
10824 #else
10825     int mode = RTLD_LAZY ;
10826 #endif
10827     handle = dlopen("./dyna.$dlext", mode) ;
10828     if (handle == NULL) {
10829         printf ("1\n") ;
10830         fflush (stdout) ;
10831         exit(0);
10832     }
10833     symbol = dlsym(handle, "fred") ;
10834     if (symbol == NULL) {
10835         /* try putting a leading underscore */
10836         symbol = dlsym(handle, "_fred") ;
10837         if (symbol == NULL) {
10838             printf ("2\n") ;
10839             fflush (stdout) ;
10840             exit(0);
10841         }
10842         printf ("3\n") ;
10843     }
10844     else
10845         printf ("4\n") ;
10846     fflush (stdout) ;
10847     exit(0);
10848 }
10849 EOM
10850         : Call the object file tmp-dyna.o in case dlext=o.
10851         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10852                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10853                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10854                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10855                 xxx=`$run ./fred`
10856                 case $xxx in
10857                 1)      echo "Test program failed using dlopen." >&4
10858                         echo "Perhaps you should not use dynamic loading." >&4;;
10859                 2)      echo "Test program failed using dlsym." >&4
10860                         echo "Perhaps you should not use dynamic loading." >&4;;
10861                 3)      echo "dlsym needs a leading underscore" >&4
10862                         val="$define" ;;
10863                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10864                 esac
10865         else
10866                 echo "I can't compile and run the test program." >&4
10867                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10868         fi
10869         ;;
10870 esac
10871                 
10872 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10873
10874 set d_dlsymun
10875 eval $setvar
10876
10877 : see if drand48_r exists
10878 set drand48_r d_drand48_r
10879 eval $inlibc
10880 case "$d_drand48_r" in
10881 "$define")
10882         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10883         case "$d_drand48_r_proto:$usethreads" in
10884         ":define")      d_drand48_r_proto=define
10885                 set d_drand48_r_proto drand48_r $hdrs
10886                 eval $hasproto ;;
10887         *)      ;;
10888         esac
10889         case "$d_drand48_r_proto" in
10890         define)
10891         case "$drand48_r_proto" in
10892         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10893         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10894         esac
10895         case "$drand48_r_proto" in
10896         ''|0)   d_drand48_r=undef
10897                 drand48_r_proto=0
10898                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10899         * )     case "$drand48_r_proto" in
10900                 REENTRANT_PROTO*) ;;
10901                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10902                 esac
10903                 echo "Prototype: $try" ;;
10904         esac
10905         ;;
10906         *)      case "$usethreads" in
10907                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10908                 esac
10909                 d_drand48_r=undef
10910                 drand48_r_proto=0
10911                 ;;
10912         esac
10913         ;;
10914 *)      drand48_r_proto=0
10915         ;;
10916 esac
10917
10918 : see if prototype for drand48 is available
10919 echo " "
10920 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10921 eval $hasproto
10922
10923 : see if dup2 exists
10924 set dup2 d_dup2
10925 eval $inlibc
10926
10927 : see if eaccess exists
10928 set eaccess d_eaccess
10929 eval $inlibc
10930
10931 : see if endgrent exists
10932 set endgrent d_endgrent
10933 eval $inlibc
10934
10935 : see if this is an grp system
10936 set grp.h i_grp
10937 eval $inhdr
10938
10939 case "$i_grp" in
10940 $define)
10941         xxx=`./findhdr grp.h`
10942         $cppstdin $cppflags $cppminus < $xxx >$$.h
10943
10944         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10945                 val="$define"
10946         else
10947                 val="$undef"
10948         fi
10949         set d_grpasswd
10950         eval $setvar
10951
10952         $rm -f $$.h
10953         ;;
10954 *)
10955         val="$undef";
10956         set d_grpasswd; eval $setvar
10957         ;;
10958 esac
10959
10960 : see if endgrent_r exists
10961 set endgrent_r d_endgrent_r
10962 eval $inlibc
10963 case "$d_endgrent_r" in
10964 "$define")
10965         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10966         case "$d_endgrent_r_proto:$usethreads" in
10967         ":define")      d_endgrent_r_proto=define
10968                 set d_endgrent_r_proto endgrent_r $hdrs
10969                 eval $hasproto ;;
10970         *)      ;;
10971         esac
10972         case "$d_endgrent_r_proto" in
10973         define)
10974         case "$endgrent_r_proto" in
10975         ''|0) try='int endgrent_r(FILE**);'
10976         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10977         esac
10978         case "$endgrent_r_proto" in
10979         ''|0) try='void endgrent_r(FILE**);'
10980         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10981         esac
10982         case "$endgrent_r_proto" in
10983         ''|0)   d_endgrent_r=undef
10984                 endgrent_r_proto=0
10985                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10986         * )     case "$endgrent_r_proto" in
10987                 REENTRANT_PROTO*) ;;
10988                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10989                 esac
10990                 echo "Prototype: $try" ;;
10991         esac
10992         ;;
10993         *)      case "$usethreads" in
10994                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10995                 esac
10996                 d_endgrent_r=undef
10997                 endgrent_r_proto=0
10998                 ;;
10999         esac
11000         ;;
11001 *)      endgrent_r_proto=0
11002         ;;
11003 esac
11004
11005 : see if endhostent exists
11006 set endhostent d_endhent
11007 eval $inlibc
11008
11009 : see if this is a netdb.h system
11010 set netdb.h i_netdb
11011 eval $inhdr
11012
11013 : see if endhostent_r exists
11014 set endhostent_r d_endhostent_r
11015 eval $inlibc
11016 case "$d_endhostent_r" in
11017 "$define")
11018         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11019         case "$d_endhostent_r_proto:$usethreads" in
11020         ":define")      d_endhostent_r_proto=define
11021                 set d_endhostent_r_proto endhostent_r $hdrs
11022                 eval $hasproto ;;
11023         *)      ;;
11024         esac
11025         case "$d_endhostent_r_proto" in
11026         define)
11027         case "$endhostent_r_proto" in
11028         ''|0) try='int endhostent_r(struct hostent_data*);'
11029         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11030         esac
11031         case "$endhostent_r_proto" in
11032         ''|0) try='void endhostent_r(struct hostent_data*);'
11033         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11034         esac
11035         case "$endhostent_r_proto" in
11036         ''|0)   d_endhostent_r=undef
11037                 endhostent_r_proto=0
11038                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11039         * )     case "$endhostent_r_proto" in
11040                 REENTRANT_PROTO*) ;;
11041                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11042                 esac
11043                 echo "Prototype: $try" ;;
11044         esac
11045         ;;
11046         *)      case "$usethreads" in
11047                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11048                 esac
11049                 d_endhostent_r=undef
11050                 endhostent_r_proto=0
11051                 ;;
11052         esac
11053         ;;
11054 *)      endhostent_r_proto=0
11055         ;;
11056 esac
11057
11058 : see if endnetent exists
11059 set endnetent d_endnent
11060 eval $inlibc
11061
11062 : see if endnetent_r exists
11063 set endnetent_r d_endnetent_r
11064 eval $inlibc
11065 case "$d_endnetent_r" in
11066 "$define")
11067         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11068         case "$d_endnetent_r_proto:$usethreads" in
11069         ":define")      d_endnetent_r_proto=define
11070                 set d_endnetent_r_proto endnetent_r $hdrs
11071                 eval $hasproto ;;
11072         *)      ;;
11073         esac
11074         case "$d_endnetent_r_proto" in
11075         define)
11076         case "$endnetent_r_proto" in
11077         ''|0) try='int endnetent_r(struct netent_data*);'
11078         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11079         esac
11080         case "$endnetent_r_proto" in
11081         ''|0) try='void endnetent_r(struct netent_data*);'
11082         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11083         esac
11084         case "$endnetent_r_proto" in
11085         ''|0)   d_endnetent_r=undef
11086                 endnetent_r_proto=0
11087                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11088         * )     case "$endnetent_r_proto" in
11089                 REENTRANT_PROTO*) ;;
11090                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11091                 esac
11092                 echo "Prototype: $try" ;;
11093         esac
11094         ;;
11095         *)      case "$usethreads" in
11096                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11097                 esac
11098                 d_endnetent_r=undef
11099                 endnetent_r_proto=0
11100                 ;;
11101         esac
11102         ;;
11103 *)      endnetent_r_proto=0
11104         ;;
11105 esac
11106
11107 : see if endprotoent exists
11108 set endprotoent d_endpent
11109 eval $inlibc
11110
11111 : see if endprotoent_r exists
11112 set endprotoent_r d_endprotoent_r
11113 eval $inlibc
11114 case "$d_endprotoent_r" in
11115 "$define")
11116         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11117         case "$d_endprotoent_r_proto:$usethreads" in
11118         ":define")      d_endprotoent_r_proto=define
11119                 set d_endprotoent_r_proto endprotoent_r $hdrs
11120                 eval $hasproto ;;
11121         *)      ;;
11122         esac
11123         case "$d_endprotoent_r_proto" in
11124         define)
11125         case "$endprotoent_r_proto" in
11126         ''|0) try='int endprotoent_r(struct protoent_data*);'
11127         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11128         esac
11129         case "$endprotoent_r_proto" in
11130         ''|0) try='void endprotoent_r(struct protoent_data*);'
11131         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11132         esac
11133         case "$endprotoent_r_proto" in
11134         ''|0)   d_endprotoent_r=undef
11135                 endprotoent_r_proto=0
11136                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11137         * )     case "$endprotoent_r_proto" in
11138                 REENTRANT_PROTO*) ;;
11139                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11140                 esac
11141                 echo "Prototype: $try" ;;
11142         esac
11143         ;;
11144         *)      case "$usethreads" in
11145                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11146                 esac
11147                 d_endprotoent_r=undef
11148                 endprotoent_r_proto=0
11149                 ;;
11150         esac
11151         ;;
11152 *)      endprotoent_r_proto=0
11153         ;;
11154 esac
11155
11156 : see if endpwent exists
11157 set endpwent d_endpwent
11158 eval $inlibc
11159
11160 : see if this is a pwd.h system
11161 set pwd.h i_pwd
11162 eval $inhdr
11163
11164 case "$i_pwd" in
11165 $define)
11166         xxx=`./findhdr pwd.h`
11167         $cppstdin $cppflags $cppminus < $xxx >$$.h
11168
11169         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11170                 val="$define"
11171         else
11172                 val="$undef"
11173         fi
11174         set d_pwquota
11175         eval $setvar
11176
11177         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11178                 val="$define"
11179         else
11180                 val="$undef"
11181         fi
11182         set d_pwage
11183         eval $setvar
11184
11185         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11186                 val="$define"
11187         else
11188                 val="$undef"
11189         fi
11190         set d_pwchange
11191         eval $setvar
11192
11193         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11194                 val="$define"
11195         else
11196                 val="$undef"
11197         fi
11198         set d_pwclass
11199         eval $setvar
11200
11201         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11202                 val="$define"
11203         else
11204                 val="$undef"
11205         fi
11206         set d_pwexpire
11207         eval $setvar
11208
11209         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11210                 val="$define"
11211         else
11212                 val="$undef"
11213         fi
11214         set d_pwcomment
11215         eval $setvar
11216
11217         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11218                 val="$define"
11219         else
11220                 val="$undef"
11221         fi
11222         set d_pwgecos
11223         eval $setvar
11224
11225         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11226                 val="$define"
11227         else
11228                 val="$undef"
11229         fi
11230         set d_pwpasswd
11231         eval $setvar
11232
11233         $rm -f $$.h
11234         ;;
11235 *)
11236         val="$undef"; 
11237         set d_pwquota; eval $setvar
11238         set d_pwage; eval $setvar
11239         set d_pwchange; eval $setvar
11240         set d_pwclass; eval $setvar
11241         set d_pwexpire; eval $setvar
11242         set d_pwcomment; eval $setvar
11243         set d_pwgecos; eval $setvar
11244         set d_pwpasswd; eval $setvar
11245         ;;
11246 esac
11247
11248 : see if endpwent_r exists
11249 set endpwent_r d_endpwent_r
11250 eval $inlibc
11251 case "$d_endpwent_r" in
11252 "$define")
11253         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11254         case "$d_endpwent_r_proto:$usethreads" in
11255         ":define")      d_endpwent_r_proto=define
11256                 set d_endpwent_r_proto endpwent_r $hdrs
11257                 eval $hasproto ;;
11258         *)      ;;
11259         esac
11260         case "$d_endpwent_r_proto" in
11261         define)
11262         case "$endpwent_r_proto" in
11263         ''|0) try='int endpwent_r(FILE**);'
11264         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11265         esac
11266         case "$endpwent_r_proto" in
11267         ''|0) try='void endpwent_r(FILE**);'
11268         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11269         esac
11270         case "$endpwent_r_proto" in
11271         ''|0)   d_endpwent_r=undef
11272                 endpwent_r_proto=0
11273                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11274         * )     case "$endpwent_r_proto" in
11275                 REENTRANT_PROTO*) ;;
11276                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11277                 esac
11278                 echo "Prototype: $try" ;;
11279         esac
11280         ;;
11281         *)      case "$usethreads" in
11282                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11283                 esac
11284                 d_endpwent_r=undef
11285                 endpwent_r_proto=0
11286                 ;;
11287         esac
11288         ;;
11289 *)      endpwent_r_proto=0
11290         ;;
11291 esac
11292
11293 : see if endservent exists
11294 set endservent d_endsent
11295 eval $inlibc
11296
11297 : see if endservent_r exists
11298 set endservent_r d_endservent_r
11299 eval $inlibc
11300 case "$d_endservent_r" in
11301 "$define")
11302         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11303         case "$d_endservent_r_proto:$usethreads" in
11304         ":define")      d_endservent_r_proto=define
11305                 set d_endservent_r_proto endservent_r $hdrs
11306                 eval $hasproto ;;
11307         *)      ;;
11308         esac
11309         case "$d_endservent_r_proto" in
11310         define)
11311         case "$endservent_r_proto" in
11312         ''|0) try='int endservent_r(struct servent_data*);'
11313         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11314         esac
11315         case "$endservent_r_proto" in
11316         ''|0) try='void endservent_r(struct servent_data*);'
11317         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11318         esac
11319         case "$endservent_r_proto" in
11320         ''|0)   d_endservent_r=undef
11321                 endservent_r_proto=0
11322                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11323         * )     case "$endservent_r_proto" in
11324                 REENTRANT_PROTO*) ;;
11325                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11326                 esac
11327                 echo "Prototype: $try" ;;
11328         esac
11329         ;;
11330         *)      case "$usethreads" in
11331                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11332                 esac
11333                 d_endservent_r=undef
11334                 endservent_r_proto=0
11335                 ;;
11336         esac
11337         ;;
11338 *)      endservent_r_proto=0
11339         ;;
11340 esac
11341
11342 : Locate the flags for 'open()'
11343 echo " "
11344 $cat >try.c <<'EOCP'
11345 #include <sys/types.h>
11346 #ifdef I_FCNTL
11347 #include <fcntl.h>
11348 #endif
11349 #ifdef I_SYS_FILE
11350 #include <sys/file.h>
11351 #endif
11352 int main() {
11353         if(O_RDONLY);
11354 #ifdef O_TRUNC
11355         exit(0);
11356 #else
11357         exit(1);
11358 #endif
11359 }
11360 EOCP
11361 : check sys/file.h first to get FREAD on Sun
11362 if $test `./findhdr sys/file.h` && \
11363                 set try -DI_SYS_FILE && eval $compile; then
11364         h_sysfile=true;
11365         echo "<sys/file.h> defines the O_* constants..." >&4
11366         if $run ./try; then
11367                 echo "and you have the 3 argument form of open()." >&4
11368                 val="$define"
11369         else
11370                 echo "but not the 3 argument form of open().  Oh, well." >&4
11371                 val="$undef"
11372         fi
11373 elif $test `./findhdr fcntl.h` && \
11374                 set try -DI_FCNTL && eval $compile; then
11375         h_fcntl=true;
11376         echo "<fcntl.h> defines the O_* constants..." >&4
11377         if $run ./try; then
11378                 echo "and you have the 3 argument form of open()." >&4
11379                 val="$define"
11380         else
11381                 echo "but not the 3 argument form of open().  Oh, well." >&4
11382                 val="$undef"
11383         fi
11384 else
11385         val="$undef"
11386         echo "I can't find the O_* constant definitions!  You got problems." >&4
11387 fi
11388 set d_open3
11389 eval $setvar
11390 $rm -f try try.*
11391
11392 : see which of string.h or strings.h is needed
11393 echo " "
11394 strings=`./findhdr string.h`
11395 if $test "$strings" && $test -r "$strings"; then
11396         echo "Using <string.h> instead of <strings.h>." >&4
11397         val="$define"
11398 else
11399         val="$undef"
11400         strings=`./findhdr strings.h`
11401         if $test "$strings" && $test -r "$strings"; then
11402                 echo "Using <strings.h> instead of <string.h>." >&4
11403         else
11404                 echo "No string header found -- You'll surely have problems." >&4
11405         fi
11406 fi
11407 set i_string
11408 eval $setvar
11409 case "$i_string" in
11410 "$undef") strings=`./findhdr strings.h`;;
11411 *)        strings=`./findhdr string.h`;;
11412 esac
11413
11414 : see if this is a sys/file.h system
11415 val=''
11416 set sys/file.h val
11417 eval $inhdr
11418
11419 : do we need to include sys/file.h ?
11420 case "$val" in
11421 "$define")
11422         echo " "
11423         if $h_sysfile; then
11424                 val="$define"
11425                 echo "We'll be including <sys/file.h>." >&4
11426         else
11427                 val="$undef"
11428                 echo "We won't be including <sys/file.h>." >&4
11429         fi
11430         ;;
11431 *)
11432         h_sysfile=false
11433         ;;
11434 esac
11435 set i_sysfile
11436 eval $setvar
11437
11438 : see if fcntl.h is there
11439 val=''
11440 set fcntl.h val
11441 eval $inhdr
11442
11443 : see if we can include fcntl.h
11444 case "$val" in
11445 "$define")
11446         echo " "
11447         if $h_fcntl; then
11448                 val="$define"
11449                 echo "We'll be including <fcntl.h>." >&4
11450         else
11451                 val="$undef"
11452                 if $h_sysfile; then
11453         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11454                 else
11455                         echo "We won't be including <fcntl.h>." >&4
11456                 fi
11457         fi
11458         ;;
11459 *)
11460         h_fcntl=false
11461         val="$undef"
11462         ;;
11463 esac
11464 set i_fcntl
11465 eval $setvar
11466
11467 : check for non-blocking I/O stuff
11468 case "$h_sysfile" in
11469 true) echo "#include <sys/file.h>" > head.c;;
11470 *)
11471        case "$h_fcntl" in
11472        true) echo "#include <fcntl.h>" > head.c;;
11473        *) echo "#include <sys/fcntl.h>" > head.c;;
11474        esac
11475        ;;
11476 esac
11477 echo " "
11478 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11479 case "$o_nonblock" in
11480 '')
11481         $cat head.c > try.c
11482         $cat >>try.c <<EOCP
11483 #include <stdio.h>
11484 #include <stdlib.h>
11485 #$i_fcntl I_FCNTL
11486 #ifdef I_FCNTL
11487 #include <fcntl.h>
11488 #endif
11489 int main() {
11490 #ifdef O_NONBLOCK
11491         printf("O_NONBLOCK\n");
11492         exit(0);
11493 #endif
11494 #ifdef O_NDELAY
11495         printf("O_NDELAY\n");
11496         exit(0);
11497 #endif
11498 #ifdef FNDELAY
11499         printf("FNDELAY\n");
11500         exit(0);
11501 #endif
11502         exit(0);
11503 }
11504 EOCP
11505         set try
11506         if eval $compile_ok; then
11507                 o_nonblock=`$run ./try`
11508                 case "$o_nonblock" in
11509                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11510                 *) echo "Seems like we can use $o_nonblock.";;
11511                 esac
11512         else
11513                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11514         fi
11515         ;;
11516 *) echo "Using $hint value $o_nonblock.";;
11517 esac
11518 $rm -f try try.* .out core
11519
11520 echo " "
11521 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11522 case "$eagain" in
11523 '')
11524         $cat head.c > try.c
11525         $cat >>try.c <<EOCP
11526 #include <errno.h>
11527 #include <sys/types.h>
11528 #include <signal.h>
11529 #include <stdio.h> 
11530 #include <stdlib.h> 
11531 #$i_fcntl I_FCNTL
11532 #ifdef I_FCNTL
11533 #include <fcntl.h>
11534 #endif
11535 #define MY_O_NONBLOCK $o_nonblock
11536 #ifndef errno  /* XXX need better Configure test */
11537 extern int errno;
11538 #endif
11539 #$i_unistd I_UNISTD
11540 #ifdef I_UNISTD
11541 #include <unistd.h>
11542 #endif
11543 #$i_string I_STRING
11544 #ifdef I_STRING
11545 #include <string.h>
11546 #else
11547 #include <strings.h>
11548 #endif
11549 $signal_t blech(x) int x; { exit(3); }
11550 EOCP
11551         $cat >> try.c <<'EOCP'
11552 int main()
11553 {
11554         int pd[2];
11555         int pu[2];
11556         char buf[1];
11557         char string[100];
11558
11559         pipe(pd);       /* Down: child -> parent */
11560         pipe(pu);       /* Up: parent -> child */
11561         if (0 != fork()) {
11562                 int ret;
11563                 close(pd[1]);   /* Parent reads from pd[0] */
11564                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11565 #ifdef F_SETFL
11566                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11567                         exit(1);
11568 #else
11569                 exit(4);
11570 #endif
11571                 signal(SIGALRM, blech);
11572                 alarm(5);
11573                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11574                         exit(2);
11575                 sprintf(string, "%d\n", ret);
11576                 write(2, string, strlen(string));
11577                 alarm(0);
11578 #ifdef EAGAIN
11579                 if (errno == EAGAIN) {
11580                         printf("EAGAIN\n");
11581                         goto ok;
11582                 }
11583 #endif
11584 #ifdef EWOULDBLOCK
11585                 if (errno == EWOULDBLOCK)
11586                         printf("EWOULDBLOCK\n");
11587 #endif
11588         ok:
11589                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11590                 sleep(2);                               /* Give it time to close our pipe */
11591                 alarm(5);
11592                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11593                 alarm(0);
11594                 sprintf(string, "%d\n", ret);
11595                 write(4, string, strlen(string));
11596                 exit(0);
11597         }
11598
11599         close(pd[0]);                   /* We write to pd[1] */
11600         close(pu[1]);                   /* We read from pu[0] */
11601         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11602         close(pd[1]);                   /* Pipe pd is now fully closed! */
11603         exit(0);                                /* Bye bye, thank you for playing! */
11604 }
11605 EOCP
11606         set try
11607         if eval $compile_ok; then
11608                 echo "$startsh" >mtry
11609                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11610                 chmod +x mtry
11611                 ./mtry >/dev/null 2>&1
11612                 case $? in
11613                 0) eagain=`$cat try.out`;;
11614                 1) echo "Could not perform non-blocking setting!";;
11615                 2) echo "I did a successful read() for something that was not there!";;
11616                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11617                 4) echo "Could not find F_SETFL!";;
11618                 *) echo "Something terribly wrong happened during testing.";;
11619                 esac
11620                 rd_nodata=`$cat try.ret`
11621                 echo "A read() system call with no data present returns $rd_nodata."
11622                 case "$rd_nodata" in
11623                 0|-1) ;;
11624                 *)
11625                         echo "(That's peculiar, fixing that to be -1.)"
11626                         rd_nodata=-1
11627                         ;;
11628                 esac
11629                 case "$eagain" in
11630                 '')
11631                         echo "Forcing errno EAGAIN on read() with no data available."
11632                         eagain=EAGAIN
11633                         ;;
11634                 *)
11635                         echo "Your read() sets errno to $eagain when no data is available."
11636                         ;;
11637                 esac
11638                 status=`$cat try.err`
11639                 case "$status" in
11640                 0) echo "And it correctly returns 0 to signal EOF.";;
11641                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11642                 *) echo "However, your read() returns '$status' on EOF??";;
11643                 esac
11644                 val="$define"
11645                 if test "$status" = "$rd_nodata"; then
11646                         echo "WARNING: you can't distinguish between EOF and no data!"
11647                         val="$undef"
11648                 fi
11649         else
11650                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11651                 eagain=EAGAIN
11652         fi
11653         set d_eofnblk
11654         eval $setvar
11655         ;;
11656 *)
11657         echo "Using $hint value $eagain."
11658         echo "Your read() returns $rd_nodata when no data is present."
11659         case "$d_eofnblk" in
11660         "$define") echo "And you can see EOF because read() returns 0.";;
11661         "$undef") echo "But you can't see EOF status from read() returned value.";;
11662         *)
11663                 echo "(Assuming you can't see EOF status from read anyway.)"
11664                 d_eofnblk=$undef
11665                 ;;
11666         esac
11667         ;;
11668 esac
11669 $rm -f try try.* .out core head.c mtry
11670
11671 : see if fchdir exists
11672 set fchdir d_fchdir
11673 eval $inlibc
11674
11675 : see if fchmod exists
11676 set fchmod d_fchmod
11677 eval $inlibc
11678
11679 : see if fchown exists
11680 set fchown d_fchown
11681 eval $inlibc
11682
11683 : see if this is an fcntl system
11684 set fcntl d_fcntl
11685 eval $inlibc
11686
11687 echo " "
11688 : See if fcntl-based locking works.
11689 $cat >try.c <<EOCP
11690 #include <stdlib.h>
11691 #include <unistd.h>
11692 #include <fcntl.h>
11693 #include <signal.h>
11694 $signal_t blech(x) int x; { exit(3); }
11695 int main() {
11696 #if defined(F_SETLK) && defined(F_SETLKW)
11697      struct flock flock;
11698      int retval, fd;
11699      fd = open("try.c", O_RDONLY);
11700      flock.l_type = F_RDLCK;
11701      flock.l_whence = SEEK_SET;
11702      flock.l_start = flock.l_len = 0;
11703      signal(SIGALRM, blech);
11704      alarm(10);
11705      retval = fcntl(fd, F_SETLK, &flock);
11706      close(fd);
11707      (retval < 0 ? exit(2) : exit(0));
11708 #else
11709      exit(2);
11710 #endif
11711 }
11712 EOCP
11713 echo "Checking if fcntl-based file locking works... "
11714 case "$d_fcntl" in
11715 "$define")
11716         set try
11717         if eval $compile_ok; then
11718                 if $run ./try; then
11719                         echo "Yes, it seems to work."
11720                         val="$define"
11721                 else
11722                         echo "Nope, it didn't work."
11723                         val="$undef"
11724                         case "$?" in
11725                         3) $cat >&4 <<EOM
11726 ***
11727 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11728 *** This is (almost) impossible.
11729 *** If your NFS lock daemons are not feeling well, something like
11730 *** this may happen, please investigate.  Cannot continue, aborting.
11731 ***
11732 EOM
11733                                 exit 1
11734                                 ;;
11735                         esac
11736                 fi
11737         else
11738                 echo "I'm unable to compile the test program, so I'll assume not."
11739                 val="$undef"
11740         fi
11741         ;;
11742 *) val="$undef";
11743         echo "Nope, since you don't even have fcntl()."
11744         ;;
11745 esac
11746 set d_fcntl_can_lock
11747 eval $setvar
11748 $rm -f try*
11749
11750
11751 : check for fd_set items
11752 $cat <<EOM
11753
11754 Checking to see how well your C compiler handles fd_set and friends ...
11755 EOM
11756 $cat >try.c <<EOCP
11757 #$i_systime I_SYS_TIME
11758 #$i_sysselct I_SYS_SELECT
11759 #$d_socket HAS_SOCKET
11760 #include <sys/types.h>
11761 #ifdef HAS_SOCKET
11762 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11763 #endif
11764 #ifdef I_SYS_TIME
11765 #include <sys/time.h>
11766 #endif
11767 #ifdef I_SYS_SELECT
11768 #include <sys/select.h>
11769 #endif
11770 int main() {
11771         fd_set fds;
11772
11773 #ifdef TRYBITS
11774         if(fds.fds_bits);
11775 #endif
11776
11777 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11778         exit(0);
11779 #else
11780         exit(1);
11781 #endif
11782 }
11783 EOCP
11784 set try -DTRYBITS
11785 if eval $compile; then
11786         d_fds_bits="$define"
11787         d_fd_set="$define"
11788         echo "Well, your system knows about the normal fd_set typedef..." >&4
11789         if $run ./try; then
11790                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11791                 d_fd_macros="$define"
11792         else
11793                 $cat >&4 <<'EOM'
11794 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11795 EOM
11796                 d_fd_macros="$undef"
11797         fi
11798 else
11799         $cat <<'EOM'
11800 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11801 EOM
11802         set try
11803         if eval $compile; then
11804                 d_fds_bits="$undef"
11805                 d_fd_set="$define"
11806                 echo "Well, your system has some sort of fd_set available..." >&4
11807                 if $run ./try; then
11808                         echo "and you have the normal fd_set macros." >&4
11809                         d_fd_macros="$define"
11810                 else
11811                         $cat <<'EOM'
11812 but not the normal fd_set macros!  Gross!  More work for me...
11813 EOM
11814                         d_fd_macros="$undef"
11815                 fi
11816         else
11817         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11818                 d_fd_set="$undef"
11819                 d_fds_bits="$undef"
11820                 d_fd_macros="$undef"
11821         fi
11822 fi
11823 $rm -f try try.*
11824
11825 : see if fgetpos exists
11826 set fgetpos d_fgetpos
11827 eval $inlibc
11828
11829 : see if finite exists
11830 set finite d_finite
11831 eval $inlibc
11832
11833 : see if finitel exists
11834 set finitel d_finitel
11835 eval $inlibc
11836
11837 : see if flock exists
11838 set flock d_flock
11839 eval $inlibc
11840
11841 : see if prototype for flock is available
11842 echo " "
11843 set d_flockproto flock $i_sysfile sys/file.h
11844 eval $hasproto
11845
11846 : see if fork exists
11847 set fork d_fork
11848 eval $inlibc
11849
11850 : see if fp_class exists
11851 set fp_class d_fp_class
11852 eval $inlibc
11853
11854 : see if pathconf exists
11855 set pathconf d_pathconf
11856 eval $inlibc
11857
11858 : see if fpathconf exists
11859 set fpathconf d_fpathconf
11860 eval $inlibc
11861
11862 : see if fpclass exists
11863 set fpclass d_fpclass
11864 eval $inlibc
11865
11866 : see if fpclassify exists
11867 set fpclassify d_fpclassify
11868 eval $inlibc
11869
11870 : see if fpclassl exists
11871 set fpclassl d_fpclassl
11872 eval $inlibc
11873
11874
11875 : check for fpos64_t
11876 echo " "
11877 echo "Checking to see if you have fpos64_t..." >&4
11878 $cat >try.c <<EOCP
11879 #include <stdio.h>
11880 int main() { fpos64_t x = 7; }
11881 EOCP
11882 set try
11883 if eval $compile; then
11884         val="$define"
11885         echo "You have fpos64_t."
11886 else
11887         val="$undef"
11888         echo "You do not have fpos64_t."
11889         case "$fpossize" in
11890         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11891         esac
11892 fi
11893 $rm -f try.* try
11894 set d_fpos64_t
11895 eval $setvar
11896
11897 : see if frexpl exists
11898 set frexpl d_frexpl
11899 eval $inlibc
11900
11901 : see if this is a sys/param system
11902 set sys/param.h i_sysparam
11903 eval $inhdr
11904
11905 : see if this is a sys/mount.h system
11906 set sys/mount.h i_sysmount
11907 eval $inhdr
11908
11909
11910 echo " "
11911 echo "Checking to see if your system supports struct fs_data..." >&4
11912 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11913 eval $hasstruct
11914 case "$d_fs_data_s" in
11915 "$define")      echo "Yes, it does."   ;;
11916 *)              echo "No, it doesn't." ;;
11917 esac
11918
11919 : see if fseeko exists
11920 set fseeko d_fseeko
11921 eval $inlibc
11922 case "$longsize" in
11923 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11924 esac
11925
11926 : see if fsetpos exists
11927 set fsetpos d_fsetpos
11928 eval $inlibc
11929
11930
11931 : see if fstatfs exists
11932 set fstatfs d_fstatfs
11933 eval $inlibc
11934
11935
11936 : see if statvfs exists
11937 set statvfs d_statvfs
11938 eval $inlibc
11939
11940 : see if fstatvfs exists
11941 set fstatvfs d_fstatvfs
11942 eval $inlibc
11943
11944
11945 : see if fsync exists
11946 set fsync d_fsync
11947 eval $inlibc
11948
11949 : see if ftello exists
11950 set ftello d_ftello
11951 eval $inlibc
11952 case "$longsize" in
11953 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11954 esac
11955
11956 : see if getcwd exists
11957 set getcwd d_getcwd
11958 eval $inlibc
11959
11960 : see if getespwnam exists
11961 set getespwnam d_getespwnam
11962 eval $inlibc
11963
11964
11965 : see if getfsstat exists
11966 set getfsstat d_getfsstat
11967 eval $inlibc
11968
11969 : see if getgrent exists
11970 set getgrent d_getgrent
11971 eval $inlibc
11972
11973 : see if getgrent_r exists
11974 set getgrent_r d_getgrent_r
11975 eval $inlibc
11976 case "$d_getgrent_r" in
11977 "$define")
11978         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11979         case "$d_getgrent_r_proto:$usethreads" in
11980         ":define")      d_getgrent_r_proto=define
11981                 set d_getgrent_r_proto getgrent_r $hdrs
11982                 eval $hasproto ;;
11983         *)      ;;
11984         esac
11985         case "$d_getgrent_r_proto" in
11986         define)
11987         case "$getgrent_r_proto" in
11988         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11989         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11990         esac
11991         case "$getgrent_r_proto" in
11992         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11993         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11994         esac
11995         case "$getgrent_r_proto" in
11996         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11997         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11998         esac
11999         case "$getgrent_r_proto" in
12000         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12001         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12002         esac
12003         case "$getgrent_r_proto" in
12004         ''|0) try='int getgrent_r(struct group*, char*, int);'
12005         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12006         esac
12007         case "$getgrent_r_proto" in
12008         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12009         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12010         esac
12011         case "$getgrent_r_proto" in
12012         ''|0)   d_getgrent_r=undef
12013                 getgrent_r_proto=0
12014                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12015         * )     case "$getgrent_r_proto" in
12016                 REENTRANT_PROTO*) ;;
12017                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12018                 esac
12019                 echo "Prototype: $try" ;;
12020         esac
12021         ;;
12022         *)      case "$usethreads" in
12023                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12024                 esac
12025                 d_getgrent_r=undef
12026                 getgrent_r_proto=0
12027                 ;;
12028         esac
12029         ;;
12030 *)      getgrent_r_proto=0
12031         ;;
12032 esac
12033
12034 : see if getgrgid_r exists
12035 set getgrgid_r d_getgrgid_r
12036 eval $inlibc
12037 case "$d_getgrgid_r" in
12038 "$define")
12039         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12040         case "$d_getgrgid_r_proto:$usethreads" in
12041         ":define")      d_getgrgid_r_proto=define
12042                 set d_getgrgid_r_proto getgrgid_r $hdrs
12043                 eval $hasproto ;;
12044         *)      ;;
12045         esac
12046         case "$d_getgrgid_r_proto" in
12047         define)
12048         case "$getgrgid_r_proto" in
12049         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12050         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12051         esac
12052         case "$getgrgid_r_proto" in
12053         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12054         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12055         esac
12056         case "$getgrgid_r_proto" in
12057         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12058         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12059         esac
12060         case "$getgrgid_r_proto" in
12061         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12062         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12063         esac
12064         case "$getgrgid_r_proto" in
12065         ''|0)   d_getgrgid_r=undef
12066                 getgrgid_r_proto=0
12067                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12068         * )     case "$getgrgid_r_proto" in
12069                 REENTRANT_PROTO*) ;;
12070                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12071                 esac
12072                 echo "Prototype: $try" ;;
12073         esac
12074         ;;
12075         *)      case "$usethreads" in
12076                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12077                 esac
12078                 d_getgrgid_r=undef
12079                 getgrgid_r_proto=0
12080                 ;;
12081         esac
12082         ;;
12083 *)      getgrgid_r_proto=0
12084         ;;
12085 esac
12086
12087 : see if getgrnam_r exists
12088 set getgrnam_r d_getgrnam_r
12089 eval $inlibc
12090 case "$d_getgrnam_r" in
12091 "$define")
12092         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12093         case "$d_getgrnam_r_proto:$usethreads" in
12094         ":define")      d_getgrnam_r_proto=define
12095                 set d_getgrnam_r_proto getgrnam_r $hdrs
12096                 eval $hasproto ;;
12097         *)      ;;
12098         esac
12099         case "$d_getgrnam_r_proto" in
12100         define)
12101         case "$getgrnam_r_proto" in
12102         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12103         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12104         esac
12105         case "$getgrnam_r_proto" in
12106         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12107         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12108         esac
12109         case "$getgrnam_r_proto" in
12110         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12111         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12112         esac
12113         case "$getgrnam_r_proto" in
12114         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12115         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12116         esac
12117         case "$getgrnam_r_proto" in
12118         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12119         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12120         esac
12121         case "$getgrnam_r_proto" in
12122         ''|0)   d_getgrnam_r=undef
12123                 getgrnam_r_proto=0
12124                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12125         * )     case "$getgrnam_r_proto" in
12126                 REENTRANT_PROTO*) ;;
12127                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12128                 esac
12129                 echo "Prototype: $try" ;;
12130         esac
12131         ;;
12132         *)      case "$usethreads" in
12133                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12134                 esac
12135                 d_getgrnam_r=undef
12136                 getgrnam_r_proto=0
12137                 ;;
12138         esac
12139         ;;
12140 *)      getgrnam_r_proto=0
12141         ;;
12142 esac
12143
12144 : see if gethostbyaddr exists
12145 set gethostbyaddr d_gethbyaddr
12146 eval $inlibc
12147
12148 : see if gethostbyname exists
12149 set gethostbyname d_gethbyname
12150 eval $inlibc
12151
12152 : see if gethostent exists
12153 set gethostent d_gethent
12154 eval $inlibc
12155
12156 : see how we will look up host name
12157 echo " "
12158 call=''
12159 if set gethostname val -f d_gethname; eval $csym; $val; then
12160         echo 'gethostname() found.' >&4
12161         d_gethname="$define"
12162         call=gethostname
12163 fi
12164 if set uname val -f d_uname; eval $csym; $val; then
12165         if ./xenix; then
12166                 $cat <<'EOM'
12167 uname() was found, but you're running xenix, and older versions of xenix
12168 have a broken uname(). If you don't really know whether your xenix is old
12169 enough to have a broken system call, use the default answer.
12170
12171 EOM
12172                 dflt=y
12173                 case "$d_uname" in
12174                 "$define") dflt=n;;
12175                 esac
12176                 rp='Is your uname() broken?'
12177                 . ./myread
12178                 case "$ans" in
12179                 n*) d_uname="$define"; call=uname;;
12180                 esac
12181         else
12182                 echo 'uname() found.' >&4
12183                 d_uname="$define"
12184                 case "$call" in
12185                 '') call=uname ;;
12186                 esac
12187         fi
12188 fi
12189 case "$d_gethname" in
12190 '') d_gethname="$undef";;
12191 esac
12192 case "$d_uname" in
12193 '') d_uname="$undef";;
12194 esac
12195 case "$d_uname$d_gethname" in
12196 *define*)
12197         dflt=n
12198         cat <<EOM
12199  
12200 Every now and then someone has a $call() that lies about the hostname
12201 but can't be fixed for political or economic reasons.  If you wish, I can
12202 pretend $call() isn't there and maybe compute hostname at run-time
12203 thanks to the '$phostname' command.
12204
12205 EOM
12206         rp="Shall I ignore $call() from now on?"
12207         . ./myread
12208         case "$ans" in
12209         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12210         esac;;
12211 esac
12212 case "$phostname" in
12213 '') aphostname='';;
12214 *) case "$aphostname" in
12215         /*) ;;
12216         *) set X $phostname
12217                 shift
12218                 file=$1
12219                 shift
12220                 file=`./loc $file $file $pth`
12221                 aphostname=`echo $file $*`
12222                 ;;
12223         esac
12224         ;;
12225 esac
12226 case "$d_uname$d_gethname" in
12227 *define*) ;;
12228 *)
12229         case "$phostname" in
12230         '')
12231                 echo "There will be no way for $package to get your hostname." >&4;;
12232         *)
12233         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12234                 ;;
12235         esac;;
12236 esac
12237 case "$d_phostname" in
12238 '') d_phostname="$undef";;
12239 esac
12240
12241 : see if gethostbyaddr_r exists
12242 set gethostbyaddr_r d_gethostbyaddr_r
12243 eval $inlibc
12244 case "$d_gethostbyaddr_r" in
12245 "$define")
12246         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12247         case "$d_gethostbyaddr_r_proto:$usethreads" in
12248         ":define")      d_gethostbyaddr_r_proto=define
12249                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12250                 eval $hasproto ;;
12251         *)      ;;
12252         esac
12253         case "$d_gethostbyaddr_r_proto" in
12254         define)
12255         case "$gethostbyaddr_r_proto" in
12256         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12257         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12258         esac
12259         case "$gethostbyaddr_r_proto" in
12260         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12261         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12262         esac
12263         case "$gethostbyaddr_r_proto" in
12264         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12265         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12266         esac
12267         case "$gethostbyaddr_r_proto" in
12268         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12269         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12270         esac
12271         case "$gethostbyaddr_r_proto" in
12272         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12273         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12274         esac
12275         case "$gethostbyaddr_r_proto" in
12276         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12277         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12278         esac
12279         case "$gethostbyaddr_r_proto" in
12280         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12281         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12282         esac
12283         case "$gethostbyaddr_r_proto" in
12284         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12285         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12286         esac
12287         case "$gethostbyaddr_r_proto" in
12288         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12289         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12290         esac
12291         case "$gethostbyaddr_r_proto" in
12292         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12293         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12294         esac
12295         case "$gethostbyaddr_r_proto" in
12296         ''|0)   d_gethostbyaddr_r=undef
12297                 gethostbyaddr_r_proto=0
12298                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12299         * )     case "$gethostbyaddr_r_proto" in
12300                 REENTRANT_PROTO*) ;;
12301                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12302                 esac
12303                 echo "Prototype: $try" ;;
12304         esac
12305         ;;
12306         *)      case "$usethreads" in
12307                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12308                 esac
12309                 d_gethostbyaddr_r=undef
12310                 gethostbyaddr_r_proto=0
12311                 ;;
12312         esac
12313         ;;
12314 *)      gethostbyaddr_r_proto=0
12315         ;;
12316 esac
12317
12318 : see if gethostbyname_r exists
12319 set gethostbyname_r d_gethostbyname_r
12320 eval $inlibc
12321 case "$d_gethostbyname_r" in
12322 "$define")
12323         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12324         case "$d_gethostbyname_r_proto:$usethreads" in
12325         ":define")      d_gethostbyname_r_proto=define
12326                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12327                 eval $hasproto ;;
12328         *)      ;;
12329         esac
12330         case "$d_gethostbyname_r_proto" in
12331         define)
12332         case "$gethostbyname_r_proto" in
12333         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12334         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12335         esac
12336         case "$gethostbyname_r_proto" in
12337         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12338         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12339         esac
12340         case "$gethostbyname_r_proto" in
12341         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12342         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12343         esac
12344         case "$gethostbyname_r_proto" in
12345         ''|0)   d_gethostbyname_r=undef
12346                 gethostbyname_r_proto=0
12347                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12348         * )     case "$gethostbyname_r_proto" in
12349                 REENTRANT_PROTO*) ;;
12350                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12351                 esac
12352                 echo "Prototype: $try" ;;
12353         esac
12354         ;;
12355         *)      case "$usethreads" in
12356                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12357                 esac
12358                 d_gethostbyname_r=undef
12359                 gethostbyname_r_proto=0
12360                 ;;
12361         esac
12362         ;;
12363 *)      gethostbyname_r_proto=0
12364         ;;
12365 esac
12366
12367 : see if gethostent_r exists
12368 set gethostent_r d_gethostent_r
12369 eval $inlibc
12370 case "$d_gethostent_r" in
12371 "$define")
12372         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12373         case "$d_gethostent_r_proto:$usethreads" in
12374         ":define")      d_gethostent_r_proto=define
12375                 set d_gethostent_r_proto gethostent_r $hdrs
12376                 eval $hasproto ;;
12377         *)      ;;
12378         esac
12379         case "$d_gethostent_r_proto" in
12380         define)
12381         case "$gethostent_r_proto" in
12382         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12383         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12384         esac
12385         case "$gethostent_r_proto" in
12386         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12387         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12388         esac
12389         case "$gethostent_r_proto" in
12390         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12391         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12392         esac
12393         case "$gethostent_r_proto" in
12394         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12395         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12396         esac
12397         case "$gethostent_r_proto" in
12398         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12399         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12400         esac
12401         case "$gethostent_r_proto" in
12402         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12403         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12404         esac
12405         case "$gethostent_r_proto" in
12406         ''|0)   d_gethostent_r=undef
12407                 gethostent_r_proto=0
12408                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12409         * )     case "$gethostent_r_proto" in
12410                 REENTRANT_PROTO*) ;;
12411                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12412                 esac
12413                 echo "Prototype: $try" ;;
12414         esac
12415         ;;
12416         *)      case "$usethreads" in
12417                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12418                 esac
12419                 d_gethostent_r=undef
12420                 gethostent_r_proto=0
12421                 ;;
12422         esac
12423         ;;
12424 *)      gethostent_r_proto=0
12425         ;;
12426 esac
12427
12428 : see if prototypes for various gethostxxx netdb.h functions are available
12429 echo " "
12430 set d_gethostprotos gethostent $i_netdb netdb.h
12431 eval $hasproto
12432
12433 : see if getitimer exists
12434 set getitimer d_getitimer
12435 eval $inlibc
12436
12437 : see if getlogin exists
12438 set getlogin d_getlogin
12439 eval $inlibc
12440
12441 : see if getlogin_r exists
12442 set getlogin_r d_getlogin_r
12443 eval $inlibc
12444 case "$d_getlogin_r" in
12445 "$define")
12446         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12447         case "$d_getlogin_r_proto:$usethreads" in
12448         ":define")      d_getlogin_r_proto=define
12449                 set d_getlogin_r_proto getlogin_r $hdrs
12450                 eval $hasproto ;;
12451         *)      ;;
12452         esac
12453         case "$d_getlogin_r_proto" in
12454         define)
12455         case "$getlogin_r_proto" in
12456         ''|0) try='int getlogin_r(char*, size_t);'
12457         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12458         esac
12459         case "$getlogin_r_proto" in
12460         ''|0) try='int getlogin_r(char*, int);'
12461         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12462         esac
12463         case "$getlogin_r_proto" in
12464         ''|0) try='char* getlogin_r(char*, size_t);'
12465         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12466         esac
12467         case "$getlogin_r_proto" in
12468         ''|0) try='char* getlogin_r(char*, int);'
12469         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12470         esac
12471         case "$getlogin_r_proto" in
12472         ''|0)   d_getlogin_r=undef
12473                 getlogin_r_proto=0
12474                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12475         * )     case "$getlogin_r_proto" in
12476                 REENTRANT_PROTO*) ;;
12477                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12478                 esac
12479                 echo "Prototype: $try" ;;
12480         esac
12481         ;;
12482         *)      case "$usethreads" in
12483                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12484                 esac
12485                 d_getlogin_r=undef
12486                 getlogin_r_proto=0
12487                 ;;
12488         esac
12489         ;;
12490 *)      getlogin_r_proto=0
12491         ;;
12492 esac
12493
12494 : see if getmnt exists
12495 set getmnt d_getmnt
12496 eval $inlibc
12497
12498 : see if getmntent exists
12499 set getmntent d_getmntent
12500 eval $inlibc
12501
12502 : see if getnetbyaddr exists
12503 set getnetbyaddr d_getnbyaddr
12504 eval $inlibc
12505
12506 : see if getnetbyname exists
12507 set getnetbyname d_getnbyname
12508 eval $inlibc
12509
12510 : see if getnetent exists
12511 set getnetent d_getnent
12512 eval $inlibc
12513
12514 : see if getnetbyaddr_r exists
12515 set getnetbyaddr_r d_getnetbyaddr_r
12516 eval $inlibc
12517 case "$d_getnetbyaddr_r" in
12518 "$define")
12519         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12520         case "$d_getnetbyaddr_r_proto:$usethreads" in
12521         ":define")      d_getnetbyaddr_r_proto=define
12522                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12523                 eval $hasproto ;;
12524         *)      ;;
12525         esac
12526         case "$d_getnetbyaddr_r_proto" in
12527         define)
12528         case "$getnetbyaddr_r_proto" in
12529         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12530         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12531         esac
12532         case "$getnetbyaddr_r_proto" in
12533         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12534         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12535         esac
12536         case "$getnetbyaddr_r_proto" in
12537         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12538         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12539         esac
12540         case "$getnetbyaddr_r_proto" in
12541         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12542         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12543         esac
12544         case "$getnetbyaddr_r_proto" in
12545         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12546         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12547         esac
12548         case "$getnetbyaddr_r_proto" in
12549         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12550         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12551         esac
12552         case "$getnetbyaddr_r_proto" in
12553         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12554         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12555         esac
12556         case "$getnetbyaddr_r_proto" in
12557         ''|0)   d_getnetbyaddr_r=undef
12558                 getnetbyaddr_r_proto=0
12559                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12560         * )     case "$getnetbyaddr_r_proto" in
12561                 REENTRANT_PROTO*) ;;
12562                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12563                 esac
12564                 echo "Prototype: $try" ;;
12565         esac
12566         ;;
12567         *)      case "$usethreads" in
12568                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12569                 esac
12570                 d_getnetbyaddr_r=undef
12571                 getnetbyaddr_r_proto=0
12572                 ;;
12573         esac
12574         ;;
12575 *)      getnetbyaddr_r_proto=0
12576         ;;
12577 esac
12578
12579 : see if getnetbyname_r exists
12580 set getnetbyname_r d_getnetbyname_r
12581 eval $inlibc
12582 case "$d_getnetbyname_r" in
12583 "$define")
12584         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12585         case "$d_getnetbyname_r_proto:$usethreads" in
12586         ":define")      d_getnetbyname_r_proto=define
12587                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12588                 eval $hasproto ;;
12589         *)      ;;
12590         esac
12591         case "$d_getnetbyname_r_proto" in
12592         define)
12593         case "$getnetbyname_r_proto" in
12594         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12595         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12596         esac
12597         case "$getnetbyname_r_proto" in
12598         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12599         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12600         esac
12601         case "$getnetbyname_r_proto" in
12602         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12603         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12604         esac
12605         case "$getnetbyname_r_proto" in
12606         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12607         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12608         esac
12609         case "$getnetbyname_r_proto" in
12610         ''|0)   d_getnetbyname_r=undef
12611                 getnetbyname_r_proto=0
12612                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12613         * )     case "$getnetbyname_r_proto" in
12614                 REENTRANT_PROTO*) ;;
12615                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12616                 esac
12617                 echo "Prototype: $try" ;;
12618         esac
12619         ;;
12620         *)      case "$usethreads" in
12621                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12622                 esac
12623                 d_getnetbyname_r=undef
12624                 getnetbyname_r_proto=0
12625                 ;;
12626         esac
12627         ;;
12628 *)      getnetbyname_r_proto=0
12629         ;;
12630 esac
12631
12632 : see if getnetent_r exists
12633 set getnetent_r d_getnetent_r
12634 eval $inlibc
12635 case "$d_getnetent_r" in
12636 "$define")
12637         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12638         case "$d_getnetent_r_proto:$usethreads" in
12639         ":define")      d_getnetent_r_proto=define
12640                 set d_getnetent_r_proto getnetent_r $hdrs
12641                 eval $hasproto ;;
12642         *)      ;;
12643         esac
12644         case "$d_getnetent_r_proto" in
12645         define)
12646         case "$getnetent_r_proto" in
12647         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12648         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12649         esac
12650         case "$getnetent_r_proto" in
12651         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12652         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12653         esac
12654         case "$getnetent_r_proto" in
12655         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12656         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12657         esac
12658         case "$getnetent_r_proto" in
12659         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12660         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12661         esac
12662         case "$getnetent_r_proto" in
12663         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12664         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12665         esac
12666         case "$getnetent_r_proto" in
12667         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12668         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12669         esac
12670         case "$getnetent_r_proto" in
12671         ''|0)   d_getnetent_r=undef
12672                 getnetent_r_proto=0
12673                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12674         * )     case "$getnetent_r_proto" in
12675                 REENTRANT_PROTO*) ;;
12676                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12677                 esac
12678                 echo "Prototype: $try" ;;
12679         esac
12680         ;;
12681         *)      case "$usethreads" in
12682                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12683                 esac
12684                 d_getnetent_r=undef
12685                 getnetent_r_proto=0
12686                 ;;
12687         esac
12688         ;;
12689 *)      getnetent_r_proto=0
12690         ;;
12691 esac
12692
12693 : see if prototypes for various getnetxxx netdb.h functions are available
12694 echo " "
12695 set d_getnetprotos getnetent $i_netdb netdb.h
12696 eval $hasproto
12697
12698 : see if getpagesize exists
12699 set getpagesize d_getpagsz
12700 eval $inlibc
12701
12702
12703 : see if getprotobyname exists
12704 set getprotobyname d_getpbyname
12705 eval $inlibc
12706
12707 : see if getprotobynumber exists
12708 set getprotobynumber d_getpbynumber
12709 eval $inlibc
12710
12711 : see if getprotoent exists
12712 set getprotoent d_getpent
12713 eval $inlibc
12714
12715 : see if getpgid exists
12716 set getpgid d_getpgid
12717 eval $inlibc
12718
12719 : see if getpgrp2 exists
12720 set getpgrp2 d_getpgrp2
12721 eval $inlibc
12722
12723 : see if getppid exists
12724 set getppid d_getppid
12725 eval $inlibc
12726
12727 : see if getpriority exists
12728 set getpriority d_getprior
12729 eval $inlibc
12730
12731 : see if getprotobyname_r exists
12732 set getprotobyname_r d_getprotobyname_r
12733 eval $inlibc
12734 case "$d_getprotobyname_r" in
12735 "$define")
12736         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12737         case "$d_getprotobyname_r_proto:$usethreads" in
12738         ":define")      d_getprotobyname_r_proto=define
12739                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12740                 eval $hasproto ;;
12741         *)      ;;
12742         esac
12743         case "$d_getprotobyname_r_proto" in
12744         define)
12745         case "$getprotobyname_r_proto" in
12746         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12747         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12748         esac
12749         case "$getprotobyname_r_proto" in
12750         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12751         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12752         esac
12753         case "$getprotobyname_r_proto" in
12754         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12755         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12756         esac
12757         case "$getprotobyname_r_proto" in
12758         ''|0)   d_getprotobyname_r=undef
12759                 getprotobyname_r_proto=0
12760                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12761         * )     case "$getprotobyname_r_proto" in
12762                 REENTRANT_PROTO*) ;;
12763                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12764                 esac
12765                 echo "Prototype: $try" ;;
12766         esac
12767         ;;
12768         *)      case "$usethreads" in
12769                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12770                 esac
12771                 d_getprotobyname_r=undef
12772                 getprotobyname_r_proto=0
12773                 ;;
12774         esac
12775         ;;
12776 *)      getprotobyname_r_proto=0
12777         ;;
12778 esac
12779
12780 : see if getprotobynumber_r exists
12781 set getprotobynumber_r d_getprotobynumber_r
12782 eval $inlibc
12783 case "$d_getprotobynumber_r" in
12784 "$define")
12785         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12786         case "$d_getprotobynumber_r_proto:$usethreads" in
12787         ":define")      d_getprotobynumber_r_proto=define
12788                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12789                 eval $hasproto ;;
12790         *)      ;;
12791         esac
12792         case "$d_getprotobynumber_r_proto" in
12793         define)
12794         case "$getprotobynumber_r_proto" in
12795         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12796         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12797         esac
12798         case "$getprotobynumber_r_proto" in
12799         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12800         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12801         esac
12802         case "$getprotobynumber_r_proto" in
12803         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12804         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12805         esac
12806         case "$getprotobynumber_r_proto" in
12807         ''|0)   d_getprotobynumber_r=undef
12808                 getprotobynumber_r_proto=0
12809                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12810         * )     case "$getprotobynumber_r_proto" in
12811                 REENTRANT_PROTO*) ;;
12812                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12813                 esac
12814                 echo "Prototype: $try" ;;
12815         esac
12816         ;;
12817         *)      case "$usethreads" in
12818                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12819                 esac
12820                 d_getprotobynumber_r=undef
12821                 getprotobynumber_r_proto=0
12822                 ;;
12823         esac
12824         ;;
12825 *)      getprotobynumber_r_proto=0
12826         ;;
12827 esac
12828
12829 : see if getprotoent_r exists
12830 set getprotoent_r d_getprotoent_r
12831 eval $inlibc
12832 case "$d_getprotoent_r" in
12833 "$define")
12834         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12835         case "$d_getprotoent_r_proto:$usethreads" in
12836         ":define")      d_getprotoent_r_proto=define
12837                 set d_getprotoent_r_proto getprotoent_r $hdrs
12838                 eval $hasproto ;;
12839         *)      ;;
12840         esac
12841         case "$d_getprotoent_r_proto" in
12842         define)
12843         case "$getprotoent_r_proto" in
12844         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12845         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12846         esac
12847         case "$getprotoent_r_proto" in
12848         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12849         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12850         esac
12851         case "$getprotoent_r_proto" in
12852         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12853         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12854         esac
12855         case "$getprotoent_r_proto" in
12856         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12857         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12858         esac
12859         case "$getprotoent_r_proto" in
12860         ''|0)   d_getprotoent_r=undef
12861                 getprotoent_r_proto=0
12862                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12863         * )     case "$getprotoent_r_proto" in
12864                 REENTRANT_PROTO*) ;;
12865                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12866                 esac
12867                 echo "Prototype: $try" ;;
12868         esac
12869         ;;
12870         *)      case "$usethreads" in
12871                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12872                 esac
12873                 d_getprotoent_r=undef
12874                 getprotoent_r_proto=0
12875                 ;;
12876         esac
12877         ;;
12878 *)      getprotoent_r_proto=0
12879         ;;
12880 esac
12881
12882 : see if prototypes for various getprotoxxx netdb.h functions are available
12883 echo " "
12884 set d_getprotoprotos getprotoent $i_netdb netdb.h
12885 eval $hasproto
12886
12887 : see if getprpwnam exists
12888 set getprpwnam d_getprpwnam
12889 eval $inlibc
12890
12891 : see if getpwent exists
12892 set getpwent d_getpwent
12893 eval $inlibc
12894
12895 : see if getpwent_r exists
12896 set getpwent_r d_getpwent_r
12897 eval $inlibc
12898 case "$d_getpwent_r" in
12899 "$define")
12900         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12901         case "$d_getpwent_r_proto:$usethreads" in
12902         ":define")      d_getpwent_r_proto=define
12903                 set d_getpwent_r_proto getpwent_r $hdrs
12904                 eval $hasproto ;;
12905         *)      ;;
12906         esac
12907         case "$d_getpwent_r_proto" in
12908         define)
12909         case "$getpwent_r_proto" in
12910         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12911         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12912         esac
12913         case "$getpwent_r_proto" in
12914         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12915         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12916         esac
12917         case "$getpwent_r_proto" in
12918         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12919         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12920         esac
12921         case "$getpwent_r_proto" in
12922         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12923         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12924         esac
12925         case "$getpwent_r_proto" in
12926         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12927         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12928         esac
12929         case "$getpwent_r_proto" in
12930         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12931         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12932         esac
12933         case "$getpwent_r_proto" in
12934         ''|0)   d_getpwent_r=undef
12935                 getpwent_r_proto=0
12936                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12937         * )     case "$getpwent_r_proto" in
12938                 REENTRANT_PROTO*) ;;
12939                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12940                 esac
12941                 echo "Prototype: $try" ;;
12942         esac
12943         ;;
12944         *)      case "$usethreads" in
12945                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12946                 esac
12947                 d_getpwent_r=undef
12948                 getpwent_r_proto=0
12949                 ;;
12950         esac
12951         ;;
12952 *)      getpwent_r_proto=0
12953         ;;
12954 esac
12955
12956 : see if getpwnam_r exists
12957 set getpwnam_r d_getpwnam_r
12958 eval $inlibc
12959 case "$d_getpwnam_r" in
12960 "$define")
12961         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12962         case "$d_getpwnam_r_proto:$usethreads" in
12963         ":define")      d_getpwnam_r_proto=define
12964                 set d_getpwnam_r_proto getpwnam_r $hdrs
12965                 eval $hasproto ;;
12966         *)      ;;
12967         esac
12968         case "$d_getpwnam_r_proto" in
12969         define)
12970         case "$getpwnam_r_proto" in
12971         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12972         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12973         esac
12974         case "$getpwnam_r_proto" in
12975         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12976         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12977         esac
12978         case "$getpwnam_r_proto" in
12979         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12980         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12981         esac
12982         case "$getpwnam_r_proto" in
12983         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12984         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12985         esac
12986         case "$getpwnam_r_proto" in
12987         ''|0)   d_getpwnam_r=undef
12988                 getpwnam_r_proto=0
12989                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12990         * )     case "$getpwnam_r_proto" in
12991                 REENTRANT_PROTO*) ;;
12992                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12993                 esac
12994                 echo "Prototype: $try" ;;
12995         esac
12996         ;;
12997         *)      case "$usethreads" in
12998                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12999                 esac
13000                 d_getpwnam_r=undef
13001                 getpwnam_r_proto=0
13002                 ;;
13003         esac
13004         ;;
13005 *)      getpwnam_r_proto=0
13006         ;;
13007 esac
13008
13009 : see if getpwuid_r exists
13010 set getpwuid_r d_getpwuid_r
13011 eval $inlibc
13012 case "$d_getpwuid_r" in
13013 "$define")
13014         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13015         case "$d_getpwuid_r_proto:$usethreads" in
13016         ":define")      d_getpwuid_r_proto=define
13017                 set d_getpwuid_r_proto getpwuid_r $hdrs
13018                 eval $hasproto ;;
13019         *)      ;;
13020         esac
13021         case "$d_getpwuid_r_proto" in
13022         define)
13023         case "$getpwuid_r_proto" in
13024         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13025         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13026         esac
13027         case "$getpwuid_r_proto" in
13028         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13029         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13030         esac
13031         case "$getpwuid_r_proto" in
13032         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13033         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13034         esac
13035         case "$getpwuid_r_proto" in
13036         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13037         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13038         esac
13039         case "$getpwuid_r_proto" in
13040         ''|0)   d_getpwuid_r=undef
13041                 getpwuid_r_proto=0
13042                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13043         * )     case "$getpwuid_r_proto" in
13044                 REENTRANT_PROTO*) ;;
13045                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13046                 esac
13047                 echo "Prototype: $try" ;;
13048         esac
13049         ;;
13050         *)      case "$usethreads" in
13051                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13052                 esac
13053                 d_getpwuid_r=undef
13054                 getpwuid_r_proto=0
13055                 ;;
13056         esac
13057         ;;
13058 *)      getpwuid_r_proto=0
13059         ;;
13060 esac
13061
13062
13063 : see if getservbyname exists
13064 set getservbyname d_getsbyname
13065 eval $inlibc
13066
13067 : see if getservbyport exists
13068 set getservbyport d_getsbyport
13069 eval $inlibc
13070
13071 : see if getservent exists
13072 set getservent d_getsent
13073 eval $inlibc
13074
13075 : see if getservbyname_r exists
13076 set getservbyname_r d_getservbyname_r
13077 eval $inlibc
13078 case "$d_getservbyname_r" in
13079 "$define")
13080         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13081         case "$d_getservbyname_r_proto:$usethreads" in
13082         ":define")      d_getservbyname_r_proto=define
13083                 set d_getservbyname_r_proto getservbyname_r $hdrs
13084                 eval $hasproto ;;
13085         *)      ;;
13086         esac
13087         case "$d_getservbyname_r_proto" in
13088         define)
13089         case "$getservbyname_r_proto" in
13090         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13091         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13092         esac
13093         case "$getservbyname_r_proto" in
13094         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13095         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13096         esac
13097         case "$getservbyname_r_proto" in
13098         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13099         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13100         esac
13101         case "$getservbyname_r_proto" in
13102         ''|0)   d_getservbyname_r=undef
13103                 getservbyname_r_proto=0
13104                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13105         * )     case "$getservbyname_r_proto" in
13106                 REENTRANT_PROTO*) ;;
13107                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13108                 esac
13109                 echo "Prototype: $try" ;;
13110         esac
13111         ;;
13112         *)      case "$usethreads" in
13113                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13114                 esac
13115                 d_getservbyname_r=undef
13116                 getservbyname_r_proto=0
13117                 ;;
13118         esac
13119         ;;
13120 *)      getservbyname_r_proto=0
13121         ;;
13122 esac
13123
13124 : see if getservbyport_r exists
13125 set getservbyport_r d_getservbyport_r
13126 eval $inlibc
13127 case "$d_getservbyport_r" in
13128 "$define")
13129         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13130         case "$d_getservbyport_r_proto:$usethreads" in
13131         ":define")      d_getservbyport_r_proto=define
13132                 set d_getservbyport_r_proto getservbyport_r $hdrs
13133                 eval $hasproto ;;
13134         *)      ;;
13135         esac
13136         case "$d_getservbyport_r_proto" in
13137         define)
13138         case "$getservbyport_r_proto" in
13139         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13140         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13141         esac
13142         case "$getservbyport_r_proto" in
13143         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13144         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13145         esac
13146         case "$getservbyport_r_proto" in
13147         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13148         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13149         esac
13150         case "$getservbyport_r_proto" in
13151         ''|0)   d_getservbyport_r=undef
13152                 getservbyport_r_proto=0
13153                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13154         * )     case "$getservbyport_r_proto" in
13155                 REENTRANT_PROTO*) ;;
13156                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13157                 esac
13158                 echo "Prototype: $try" ;;
13159         esac
13160         ;;
13161         *)      case "$usethreads" in
13162                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13163                 esac
13164                 d_getservbyport_r=undef
13165                 getservbyport_r_proto=0
13166                 ;;
13167         esac
13168         ;;
13169 *)      getservbyport_r_proto=0
13170         ;;
13171 esac
13172
13173 : see if getservent_r exists
13174 set getservent_r d_getservent_r
13175 eval $inlibc
13176 case "$d_getservent_r" in
13177 "$define")
13178         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13179         case "$d_getservent_r_proto:$usethreads" in
13180         ":define")      d_getservent_r_proto=define
13181                 set d_getservent_r_proto getservent_r $hdrs
13182                 eval $hasproto ;;
13183         *)      ;;
13184         esac
13185         case "$d_getservent_r_proto" in
13186         define)
13187         case "$getservent_r_proto" in
13188         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13189         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13190         esac
13191         case "$getservent_r_proto" in
13192         ''|0) try='int getservent_r(struct servent*, char*, int);'
13193         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13194         esac
13195         case "$getservent_r_proto" in
13196         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13197         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13198         esac
13199         case "$getservent_r_proto" in
13200         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13201         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13202         esac
13203         case "$getservent_r_proto" in
13204         ''|0)   d_getservent_r=undef
13205                 getservent_r_proto=0
13206                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13207         * )     case "$getservent_r_proto" in
13208                 REENTRANT_PROTO*) ;;
13209                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13210                 esac
13211                 echo "Prototype: $try" ;;
13212         esac
13213         ;;
13214         *)      case "$usethreads" in
13215                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13216                 esac
13217                 d_getservent_r=undef
13218                 getservent_r_proto=0
13219                 ;;
13220         esac
13221         ;;
13222 *)      getservent_r_proto=0
13223         ;;
13224 esac
13225
13226 : see if prototypes for various getservxxx netdb.h functions are available
13227 echo " "
13228 set d_getservprotos getservent $i_netdb netdb.h
13229 eval $hasproto
13230
13231 : see if getspnam exists
13232 set getspnam d_getspnam
13233 eval $inlibc
13234
13235 : see if this is a shadow.h system
13236 set shadow.h i_shadow
13237 eval $inhdr
13238
13239 : see if getspnam_r exists
13240 set getspnam_r d_getspnam_r
13241 eval $inlibc
13242 case "$d_getspnam_r" in
13243 "$define")
13244         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13245         case "$d_getspnam_r_proto:$usethreads" in
13246         ":define")      d_getspnam_r_proto=define
13247                 set d_getspnam_r_proto getspnam_r $hdrs
13248                 eval $hasproto ;;
13249         *)      ;;
13250         esac
13251         case "$d_getspnam_r_proto" in
13252         define)
13253         case "$getspnam_r_proto" in
13254         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13255         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13256         esac
13257         case "$getspnam_r_proto" in
13258         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13259         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13260         esac
13261         case "$getspnam_r_proto" in
13262         ''|0)   d_getspnam_r=undef
13263                 getspnam_r_proto=0
13264                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13265         * )     case "$getspnam_r_proto" in
13266                 REENTRANT_PROTO*) ;;
13267                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13268                 esac
13269                 echo "Prototype: $try" ;;
13270         esac
13271         ;;
13272         *)      case "$usethreads" in
13273                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13274                 esac
13275                 d_getspnam_r=undef
13276                 getspnam_r_proto=0
13277                 ;;
13278         esac
13279         ;;
13280 *)      getspnam_r_proto=0
13281         ;;
13282 esac
13283
13284 : see if gettimeofday or ftime exists
13285 set gettimeofday d_gettimeod
13286 eval $inlibc
13287 case "$d_gettimeod" in
13288 "$undef")
13289         set ftime d_ftime 
13290         eval $inlibc
13291         ;;
13292 *)
13293         val="$undef"; set d_ftime; eval $setvar
13294         ;;
13295 esac
13296 case "$d_gettimeod$d_ftime" in
13297 "$undef$undef")
13298         echo " "
13299         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13300         ;;
13301 esac
13302
13303 : see if gmtime_r exists
13304 set gmtime_r d_gmtime_r
13305 eval $inlibc
13306 case "$d_gmtime_r" in
13307 "$define")
13308         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13309         case "$d_gmtime_r_proto:$usethreads" in
13310         ":define")      d_gmtime_r_proto=define
13311                 set d_gmtime_r_proto gmtime_r $hdrs
13312                 eval $hasproto ;;
13313         *)      ;;
13314         esac
13315         case "$d_gmtime_r_proto" in
13316         define)
13317         case "$gmtime_r_proto" in
13318         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13319         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13320         esac
13321         case "$gmtime_r_proto" in
13322         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13323         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13324         esac
13325         case "$gmtime_r_proto" in
13326         ''|0)   d_gmtime_r=undef
13327                 gmtime_r_proto=0
13328                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13329         * )     case "$gmtime_r_proto" in
13330                 REENTRANT_PROTO*) ;;
13331                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13332                 esac
13333                 echo "Prototype: $try" ;;
13334         esac
13335         ;;
13336         *)      case "$usethreads" in
13337                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13338                 esac
13339                 d_gmtime_r=undef
13340                 gmtime_r_proto=0
13341                 ;;
13342         esac
13343         ;;
13344 *)      gmtime_r_proto=0
13345         ;;
13346 esac
13347
13348 : see if hasmntopt exists
13349 set hasmntopt d_hasmntopt
13350 eval $inlibc
13351
13352 : see if this is a netinet/in.h or sys/in.h system
13353 set netinet/in.h i_niin sys/in.h i_sysin
13354 eval $inhdr
13355
13356 : see if arpa/inet.h has to be included
13357 set arpa/inet.h i_arpainet
13358 eval $inhdr
13359
13360 : see if htonl --and friends-- exists
13361 val=''
13362 set htonl val
13363 eval $inlibc
13364
13365 : Maybe they are macros.
13366 case "$val" in
13367 $undef)
13368         $cat >htonl.c <<EOM
13369 #include <stdio.h>
13370 #include <sys/types.h>
13371 #$i_niin I_NETINET_IN
13372 #$i_sysin I_SYS_IN
13373 #$i_arpainet I_ARPA_INET
13374 #ifdef I_NETINET_IN
13375 #include <netinet/in.h>
13376 #endif
13377 #ifdef I_SYS_IN
13378 #include <sys/in.h>
13379 #endif
13380 #ifdef I_ARPA_INET
13381 #include <arpa/inet.h>
13382 #endif
13383 #ifdef htonl
13384 printf("Defined as a macro.");
13385 #endif
13386 EOM
13387         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13388         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13389                 val="$define"
13390                 echo "But it seems to be defined as a macro." >&4
13391         fi
13392         $rm -f htonl.?
13393         ;;
13394 esac
13395 set d_htonl
13396 eval $setvar
13397
13398 : index or strchr
13399 echo " "
13400 if set index val -f; eval $csym; $val; then
13401         if set strchr val -f d_strchr; eval $csym; $val; then
13402                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13403                         val="$define"
13404                         vali="$undef"
13405                         echo "strchr() found." >&4
13406                 else
13407                         val="$undef"
13408                         vali="$define"
13409                         echo "index() found." >&4
13410                 fi
13411         else
13412                 val="$undef"
13413                 vali="$define"
13414                 echo "index() found." >&4
13415         fi
13416 else
13417         if set strchr val -f d_strchr; eval $csym; $val; then
13418                 val="$define"
13419                 vali="$undef"
13420                 echo "strchr() found." >&4
13421         else
13422                 echo "No index() or strchr() found!" >&4
13423                 val="$undef"
13424                 vali="$undef"
13425         fi
13426 fi
13427 set d_strchr; eval $setvar
13428 val="$vali"
13429 set d_index; eval $setvar
13430
13431 : check whether inet_aton exists
13432 set inet_aton d_inetaton
13433 eval $inlibc
13434
13435 : Look for isascii
13436 echo " "
13437 $cat >isascii.c <<'EOCP'
13438 #include <stdio.h>
13439 #include <ctype.h>
13440 int main() {
13441         int c = 'A';
13442         if (isascii(c))
13443                 exit(0);
13444         else
13445                 exit(1);
13446 }
13447 EOCP
13448 set isascii
13449 if eval $compile; then
13450         echo "isascii() found." >&4
13451         val="$define"
13452 else
13453         echo "isascii() NOT found." >&4
13454         val="$undef"
13455 fi
13456 set d_isascii
13457 eval $setvar
13458 $rm -f isascii*
13459
13460 : see if isfinite exists
13461 set isfinite d_isfinite
13462 eval $inlibc
13463
13464 : see if isinf exists
13465 set isinf d_isinf
13466 eval $inlibc
13467
13468 : see if isnan exists
13469 set isnan d_isnan
13470 eval $inlibc
13471
13472 : see if isnanl exists
13473 set isnanl d_isnanl
13474 eval $inlibc
13475
13476 : see if killpg exists
13477 set killpg d_killpg
13478 eval $inlibc
13479
13480 : see if lchown exists
13481 echo " "
13482 $cat > try.c <<'EOCP'
13483 /* System header to define __stub macros and hopefully few prototypes,
13484     which can conflict with char lchown(); below.  */
13485 #include <assert.h>
13486 /* Override any gcc2 internal prototype to avoid an error.  */
13487 /* We use char because int might match the return type of a gcc2
13488    builtin and then its argument prototype would still apply.  */
13489 char lchown();
13490 int main() {
13491     /*  The GNU C library defines this for functions which it implements
13492         to always fail with ENOSYS.  Some functions are actually named
13493         something starting with __ and the normal name is an alias.  */
13494 #if defined (__stub_lchown) || defined (__stub___lchown)
13495 choke me
13496 #else
13497 lchown();
13498 #endif
13499 ; return 0; }
13500 EOCP
13501 set try
13502 if eval $compile; then
13503     $echo "lchown() found." >&4
13504     val="$define"
13505 else
13506     $echo "lchown() NOT found." >&4
13507     val="$undef"
13508 fi
13509 set d_lchown
13510 eval $setvar
13511
13512 : See if number of significant digits in a double precision number is known
13513 echo " "
13514 $cat >ldbl_dig.c <<EOM
13515 #$i_limits I_LIMITS
13516 #$i_float I_FLOAT
13517 #ifdef I_LIMITS
13518 #include <limits.h>
13519 #endif
13520 #ifdef I_FLOAT
13521 #include <float.h>
13522 #endif
13523 #ifdef LDBL_DIG
13524 printf("Contains LDBL_DIG");
13525 #endif
13526 EOM
13527 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13528 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13529         echo "LDBL_DIG found." >&4
13530         val="$define"
13531 else
13532         echo "LDBL_DIG NOT found." >&4
13533         val="$undef"
13534 fi
13535 $rm -f ldbl_dig.?
13536 set d_ldbl_dig
13537 eval $setvar
13538
13539 : see if link exists
13540 set link d_link
13541 eval $inlibc
13542
13543 : see if localtime_r exists
13544 set localtime_r d_localtime_r
13545 eval $inlibc
13546 case "$d_localtime_r" in
13547 "$define")
13548         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13549         case "$d_localtime_r_proto:$usethreads" in
13550         ":define")      d_localtime_r_proto=define
13551                 set d_localtime_r_proto localtime_r $hdrs
13552                 eval $hasproto ;;
13553         *)      ;;
13554         esac
13555         case "$d_localtime_r_proto" in
13556         define)
13557         case "$localtime_r_proto" in
13558         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13559         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13560         esac
13561         case "$localtime_r_proto" in
13562         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13563         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13564         esac
13565         case "$localtime_r_proto" in
13566         ''|0)   d_localtime_r=undef
13567                 localtime_r_proto=0
13568                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13569         * )     case "$localtime_r_proto" in
13570                 REENTRANT_PROTO*) ;;
13571                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13572                 esac
13573                 echo "Prototype: $try" ;;
13574         esac
13575         ;;
13576         *)      case "$usethreads" in
13577                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13578                 esac
13579                 d_localtime_r=undef
13580                 localtime_r_proto=0
13581                 ;;
13582         esac
13583         ;;
13584 *)      localtime_r_proto=0
13585         ;;
13586 esac
13587
13588 : see if localeconv exists
13589 set localeconv d_locconv
13590 eval $inlibc
13591
13592 : see if lockf exists
13593 set lockf d_lockf
13594 eval $inlibc
13595
13596 : see if prototype for lseek is available
13597 echo " "
13598 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13599 eval $hasproto
13600
13601 : see if lstat exists
13602 set lstat d_lstat
13603 eval $inlibc
13604
13605 : see if madvise exists
13606 set madvise d_madvise
13607 eval $inlibc
13608
13609 : see if mblen exists
13610 set mblen d_mblen
13611 eval $inlibc
13612
13613 : see if mbstowcs exists
13614 set mbstowcs d_mbstowcs
13615 eval $inlibc
13616
13617 : see if mbtowc exists
13618 set mbtowc d_mbtowc
13619 eval $inlibc
13620
13621 : see if memchr exists
13622 set memchr d_memchr
13623 eval $inlibc
13624
13625 : see if memcmp exists
13626 set memcmp d_memcmp
13627 eval $inlibc
13628
13629 : see if memcpy exists
13630 set memcpy d_memcpy
13631 eval $inlibc
13632
13633 : see if memmove exists
13634 set memmove d_memmove
13635 eval $inlibc
13636
13637 : see if memset exists
13638 set memset d_memset
13639 eval $inlibc
13640
13641 : see if mkdir exists
13642 set mkdir d_mkdir
13643 eval $inlibc
13644
13645 : see if mkdtemp exists
13646 set mkdtemp d_mkdtemp
13647 eval $inlibc
13648
13649 : see if mkfifo exists
13650 set mkfifo d_mkfifo
13651 eval $inlibc
13652
13653 : see if mkstemp exists
13654 set mkstemp d_mkstemp
13655 eval $inlibc
13656
13657 : see if mkstemps exists
13658 set mkstemps d_mkstemps
13659 eval $inlibc
13660
13661 : see if mktime exists
13662 set mktime d_mktime
13663 eval $inlibc
13664
13665 : see if this is a sys/mman.h system
13666 set sys/mman.h i_sysmman
13667 eval $inhdr
13668
13669 : see if mmap exists
13670 set mmap d_mmap
13671 eval $inlibc
13672 : see what shmat returns
13673 : default to something harmless
13674 mmaptype='void *'
13675 case "$i_sysmman$d_mmap" in
13676 "$define$define")
13677         $cat >mmap.c <<'END'
13678 #include <sys/mman.h>
13679 void *mmap();
13680 END
13681         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13682                 mmaptype='void *'
13683         else
13684                 mmaptype='caddr_t'
13685         fi
13686         echo "and it returns ($mmaptype)." >&4
13687         ;;
13688 esac
13689
13690
13691
13692 : see if mprotect exists
13693 set mprotect d_mprotect
13694 eval $inlibc
13695
13696 : see if msgctl exists
13697 set msgctl d_msgctl
13698 eval $inlibc
13699
13700 : see if msgget exists
13701 set msgget d_msgget
13702 eval $inlibc
13703
13704 : see if msgsnd exists
13705 set msgsnd d_msgsnd
13706 eval $inlibc
13707
13708 : see if msgrcv exists
13709 set msgrcv d_msgrcv
13710 eval $inlibc
13711
13712 : see how much of the 'msg*(2)' library is present.
13713 h_msg=true
13714 echo " "
13715 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13716 *"$undef"*) h_msg=false;;
13717 esac
13718 case "$osname" in
13719 freebsd)
13720     case "`ipcs 2>&1`" in
13721     "SVID messages"*"not configured"*)
13722         echo "Your $osname does not have the msg*(2) configured." >&4
13723         h_msg=false
13724         val="$undef"
13725         set msgctl d_msgctl
13726         eval $setvar
13727         set msgget d_msgget
13728         eval $setvar
13729         set msgsnd d_msgsnd
13730         eval $setvar
13731         set msgrcv d_msgrcv
13732         eval $setvar
13733         ;;
13734     esac
13735     ;;
13736 esac
13737 : we could also check for sys/ipc.h ...
13738 if $h_msg && $test `./findhdr sys/msg.h`; then
13739         echo "You have the full msg*(2) library." >&4
13740         val="$define"
13741 else
13742         echo "You don't have the full msg*(2) library." >&4
13743         val="$undef"
13744 fi
13745 set d_msg
13746 eval $setvar
13747
13748
13749 echo " "
13750 echo "Checking to see if your system supports struct msghdr..." >&4
13751 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13752 eval $hasstruct
13753 case "$d_msghdr_s" in
13754 "$define")      echo "Yes, it does."   ;;
13755 *)              echo "No, it doesn't." ;;
13756 esac
13757
13758
13759 : see if msync exists
13760 set msync d_msync
13761 eval $inlibc
13762
13763 : see if munmap exists
13764 set munmap d_munmap
13765 eval $inlibc
13766
13767 : see if nanosleep exists
13768 set nanosleep d_nanosleep
13769 eval $inlibc
13770
13771 : see if nice exists
13772 set nice d_nice
13773 eval $inlibc
13774
13775 : see if this is a langinfo.h system
13776 set langinfo.h i_langinfo
13777 eval $inhdr
13778
13779 : see if nl_langinfo exists
13780 set nl_langinfo d_nl_langinfo
13781 eval $inlibc
13782
13783 : check for length of character
13784 echo " "
13785 case "$charsize" in
13786 '')
13787         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13788         $cat >try.c <<'EOCP'
13789 #include <stdio.h>
13790 int main()
13791 {
13792     printf("%d\n", (int)sizeof(char));
13793     exit(0);
13794 }
13795 EOCP
13796         set try
13797         if eval $compile_ok; then
13798                 dflt=`$run ./try`
13799         else
13800                 dflt='1'
13801                 echo "(I can't seem to compile the test program.  Guessing...)"
13802         fi
13803         ;;
13804 *)
13805         dflt="$charsize"
13806         ;;
13807 esac
13808 rp="What is the size of a character (in bytes)?"
13809 . ./myread
13810 charsize="$ans"
13811 $rm -f try.c try
13812
13813 : check for volatile keyword
13814 echo " "
13815 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13816 $cat >try.c <<'EOCP'
13817 main()
13818 {
13819         typedef struct _goo_struct goo_struct;
13820         goo_struct * volatile goo = ((goo_struct *)0);
13821         struct _goo_struct {
13822                 long long_int;
13823                 int reg_int;
13824                 char char_var;
13825         };
13826         typedef unsigned short foo_t;
13827         char *volatile foo;
13828         volatile int bar;
13829         volatile foo_t blech;
13830         foo = foo;
13831 }
13832 EOCP
13833 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13834         val="$define"
13835         echo "Yup, it does."
13836 else
13837         val="$undef"
13838         echo "Nope, it doesn't."
13839 fi
13840 set d_volatile
13841 eval $setvar
13842 $rm -f try.*
13843
13844
13845 echo " "
13846 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13847
13848 case "$use64bitint:$d_quad:$quadtype" in
13849 define:define:?*)
13850         ivtype="$quadtype"
13851         uvtype="$uquadtype"
13852         ivsize=8
13853         uvsize=8
13854         ;;
13855 *)      ivtype="long"
13856         uvtype="unsigned long"
13857         ivsize=$longsize
13858         uvsize=$longsize
13859         ;;
13860 esac
13861
13862 case "$uselongdouble:$d_longdbl" in
13863 define:define)
13864         nvtype="long double"
13865         nvsize=$longdblsize
13866         ;;
13867 *)      nvtype=double
13868         nvsize=$doublesize
13869         ;;
13870 esac
13871
13872 $echo "(IV will be "$ivtype", $ivsize bytes)"
13873 $echo "(UV will be "$uvtype", $uvsize bytes)"
13874 $echo "(NV will be "$nvtype", $nvsize bytes)"
13875
13876 $cat >try.c <<EOCP
13877 #$i_inttypes I_INTTYPES
13878 #ifdef I_INTTYPES
13879 #include <inttypes.h>
13880 #endif
13881 #include <stdio.h>
13882 int main() {
13883 #ifdef INT8
13884    int8_t i =  INT8_MAX;
13885   uint8_t u = UINT8_MAX;
13886   printf("int8_t\n");
13887 #endif
13888 #ifdef INT16
13889    int16_t i =  INT16_MAX;
13890   uint16_t i = UINT16_MAX;
13891   printf("int16_t\n");
13892 #endif
13893 #ifdef INT32
13894    int32_t i =  INT32_MAX;
13895   uint32_t u = UINT32_MAX;
13896   printf("int32_t\n");
13897 #endif
13898 }
13899 EOCP
13900
13901 case "$i8type" in
13902 '')     case "$charsize" in
13903         1)      i8type=char
13904                 u8type="unsigned char"
13905                 i8size=$charsize
13906                 u8size=$charsize
13907                 ;;
13908         esac
13909         ;;
13910 esac
13911 case "$i8type" in
13912 '')     set try -DINT8
13913         if eval $compile; then
13914                 case "`$run ./try`" in
13915                 int8_t) i8type=int8_t
13916                         u8type=uint8_t
13917                         i8size=1
13918                         u8size=1
13919                         ;;
13920                 esac
13921         fi
13922         ;;
13923 esac
13924 case "$i8type" in
13925 '')     if $test $charsize -ge 1; then
13926                 i8type=char
13927                 u8type="unsigned char"
13928                 i8size=$charsize
13929                 u8size=$charsize
13930         fi
13931         ;;
13932 esac
13933
13934 case "$i16type" in
13935 '')     case "$shortsize" in
13936         2)      i16type=short
13937                 u16type="unsigned short"
13938                 i16size=$shortsize
13939                 u16size=$shortsize
13940                 ;;
13941         esac
13942         ;;
13943 esac
13944 case "$i16type" in
13945 '')     set try -DINT16
13946         if eval $compile; then
13947                 case "`$run ./try`" in
13948                 int16_t)
13949                         i16type=int16_t
13950                         u16type=uint16_t
13951                         i16size=2
13952                         u16size=2
13953                         ;;
13954                 esac
13955         fi
13956         ;;
13957 esac
13958 case "$i16type" in
13959 '')     if $test $shortsize -ge 2; then
13960                 i16type=short
13961                 u16type="unsigned short"
13962                 i16size=$shortsize
13963                 u16size=$shortsize
13964         fi
13965         ;;
13966 esac
13967
13968 case "$i32type" in
13969 '')     case "$longsize" in
13970         4)      i32type=long
13971                 u32type="unsigned long"
13972                 i32size=$longsize
13973                 u32size=$longsize
13974                 ;;
13975         *)      case "$intsize" in
13976                 4)      i32type=int
13977                         u32type="unsigned int"
13978                         i32size=$intsize
13979                         u32size=$intsize
13980                         ;;
13981                 esac
13982                 ;;
13983         esac
13984         ;;
13985 esac
13986 case "$i32type" in
13987 '')     set try -DINT32
13988         if eval $compile; then
13989                 case "`$run ./try`" in
13990                 int32_t)
13991                         i32type=int32_t
13992                         u32type=uint32_t
13993                         i32size=4
13994                         u32size=4
13995                         ;;
13996                 esac
13997         fi
13998         ;;
13999 esac
14000 case "$i32type" in
14001 '')     if $test $intsize -ge 4; then
14002                 i32type=int
14003                 u32type="unsigned int"
14004                 i32size=$intsize
14005                 u32size=$intsize
14006         fi
14007         ;;
14008 esac
14009
14010 case "$i64type" in
14011 '')     case "$d_quad:$quadtype" in
14012         define:?*)
14013                 i64type="$quadtype"
14014                 u64type="$uquadtype"
14015                 i64size=8
14016                 u64size=8
14017                 ;;
14018         esac
14019         ;;
14020 esac
14021
14022 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14023 : volatile so that the compiler has to store it out to memory.
14024 if test X"$d_volatile" = X"$define"; then
14025         volatile=volatile
14026 fi
14027 $cat <<EOP >try.c
14028 #include <stdio.h>
14029 #include <sys/types.h>
14030 #include <signal.h>
14031 #ifdef SIGFPE
14032 $volatile int bletched = 0;
14033 $signal_t blech(s) int s; { bletched = 1; }
14034 #endif
14035 int main() {
14036     $uvtype u = 0;
14037     $nvtype d;
14038     int     n = 8 * $uvsize;
14039     int     i;
14040 #ifdef SIGFPE
14041     signal(SIGFPE, blech);
14042 #endif
14043
14044     for (i = 0; i < n; i++) {
14045       u = u << 1 | ($uvtype)1;
14046       d = ($nvtype)u;
14047       if (($uvtype)d != u)
14048         break;
14049       if (d <= 0)
14050         break;
14051       d = ($nvtype)(u - 1);
14052       if (($uvtype)d != (u - 1))
14053         break;
14054 #ifdef SIGFPE
14055       if (bletched) {
14056         break;
14057 #endif
14058       } 
14059     }
14060     printf("%d\n", ((i == n) ? -n : i));
14061     exit(0);
14062 }
14063 EOP
14064 set try
14065
14066 d_nv_preserves_uv="$undef"
14067 if eval $compile; then
14068         nv_preserves_uv_bits="`$run ./try`"
14069 fi
14070 case "$nv_preserves_uv_bits" in
14071 \-[1-9]*)       
14072         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14073         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14074         d_nv_preserves_uv="$define"
14075         ;;
14076 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14077         d_nv_preserves_uv="$undef" ;;
14078 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14079         nv_preserves_uv_bits="$undef" ;;
14080 esac
14081
14082 $rm -f try.* try
14083
14084
14085 : check for off64_t
14086 echo " "
14087 echo "Checking to see if you have off64_t..." >&4
14088 $cat >try.c <<EOCP
14089 #include <sys/types.h>
14090 #include <unistd.h>
14091 int main() { off64_t x = 7; }
14092 EOCP
14093 set try
14094 if eval $compile; then
14095         val="$define"
14096         echo "You have off64_t."
14097 else
14098         val="$undef"
14099         echo "You do not have off64_t."
14100         case "$lseeksize" in
14101         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14102         esac
14103 fi
14104 $rm -f try.* try
14105 set d_off64_t
14106 eval $setvar
14107
14108 : how to create joinable pthreads
14109 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14110         echo " "
14111         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14112         $cat >try.c <<'EOCP'
14113 #include <pthread.h>
14114 int main() {
14115     int detachstate = JOINABLE;
14116 }
14117 EOCP
14118         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14119         if eval $compile; then
14120                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14121                 val="$undef" # Yes, undef.
14122                 set d_old_pthread_create_joinable
14123                 eval $setvar
14124                 val=""
14125                 set old_pthread_create_joinable
14126                 eval $setvar
14127         else
14128                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14129                 if eval $compile; then
14130                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14131                         val="$define"
14132                         set d_old_pthread_create_joinable
14133                         eval $setvar
14134                         val=PTHREAD_CREATE_UNDETACHED
14135                         set old_pthread_create_joinable
14136                         eval $setvar
14137                 else            
14138                         set try -DJOINABLE=__UNDETACHED
14139                         if eval $compile; then
14140                                 echo "You seem to use __UNDETACHED." >&4
14141                                 val="$define"
14142                                 set d_old_pthread_create_joinable
14143                                 eval $setvar
14144                                 val=__UNDETACHED
14145                                 set old_pthread_create_joinable
14146                                 eval $setvar
14147                         else
14148                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14149                                 val="$define"
14150                                 set d_old_pthread_create_joinable
14151                                 eval $setvar
14152                                 val=0
14153                                 set old_pthread_create_joinable
14154                                 eval $setvar
14155                         fi
14156                 fi
14157         fi
14158         $rm -f try try.*
14159 else
14160     d_old_pthread_create_joinable="$undef"
14161     old_pthread_create_joinable=""
14162 fi
14163
14164 : see if pause exists
14165 set pause d_pause
14166 eval $inlibc
14167
14168 : see if pipe exists
14169 set pipe d_pipe
14170 eval $inlibc
14171
14172 : see if poll exists
14173 set poll d_poll
14174 eval $inlibc
14175
14176 : see if readlink exists
14177 set readlink d_readlink
14178 eval $inlibc
14179
14180 echo " "
14181 procselfexe=''
14182 val="$undef"
14183 case "$d_readlink" in
14184 "$define")
14185         if $issymlink /proc/self/exe ; then
14186                 $ls -l /proc/self/exe > reflect
14187                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14188                         echo "You have Linux-like /proc/self/exe."
14189                         procselfexe='"/proc/self/exe"'
14190                         val="$define"
14191                 fi
14192         fi
14193         if $issymlink /proc/curproc/file ; then
14194                 $ls -l /proc/curproc/file > reflect
14195                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14196                         echo "You have BSD-like /proc/curproc/file."
14197                         procselfexe='"/proc/curproc/file"'
14198                         val="$define"
14199                 fi
14200         fi
14201         ;;
14202 esac
14203 $rm -f reflect
14204 set d_procselfexe
14205 eval $setvar
14206
14207 : see whether the pthread_atfork exists
14208 $cat >try.c <<EOP
14209 #include <pthread.h>
14210 #include <stdio.h>
14211 int main() {
14212 #ifdef  PTHREAD_ATFORK
14213         pthread_atfork(NULL,NULL,NULL);
14214 #endif
14215 }
14216 EOP
14217
14218 : see if pthread_atfork exists
14219 set try -DPTHREAD_ATFORK
14220 if eval $compile; then
14221     val="$define"
14222 else
14223     val="$undef"
14224 fi
14225 case "$usethreads" in
14226 $define)
14227         case "$val" in
14228         $define) echo 'pthread_atfork found.' >&4        ;;
14229         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14230         esac
14231 esac
14232 set d_pthread_atfork
14233 eval $setvar
14234
14235
14236 : see whether the various POSIXish _yields exist
14237 $cat >try.c <<EOP
14238 #include <pthread.h>
14239 #include <stdio.h>
14240 int main() {
14241 #ifdef SCHED_YIELD
14242         sched_yield();
14243 #else
14244 #ifdef PTHREAD_YIELD
14245         pthread_yield();
14246 #else
14247 #ifdef PTHREAD_YIELD_NULL
14248         pthread_yield(NULL);
14249 #endif
14250 #endif
14251 #endif
14252 }
14253 EOP
14254 : see if sched_yield exists
14255 set try -DSCHED_YIELD
14256 if eval $compile; then
14257     val="$define"
14258     sched_yield='sched_yield()'
14259 else
14260     val="$undef"
14261 fi
14262 case "$usethreads" in
14263 $define)
14264         case "$val" in
14265         $define) echo 'sched_yield() found.' >&4        ;;
14266         *)       echo 'sched_yield() NOT found.' >&4    ;;
14267         esac
14268 esac
14269 set d_sched_yield
14270 eval $setvar
14271
14272 : see if pthread_yield exists
14273 set try -DPTHREAD_YIELD
14274 if eval $compile; then
14275     val="$define"
14276     case "$sched_yield" in
14277     '') sched_yield='pthread_yield()' ;;
14278     esac
14279 else
14280     set try -DPTHREAD_YIELD_NULL
14281     if eval $compile; then
14282         val="$define"
14283         case "$sched_yield" in
14284         '') sched_yield='pthread_yield(NULL)' ;;
14285         esac
14286     else
14287         val="$undef"
14288     fi
14289 fi
14290 case "$usethreads" in
14291 $define)
14292         case "$val" in
14293         $define) echo 'pthread_yield() found.' >&4      ;;
14294         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14295         esac
14296         ;;
14297 esac
14298 set d_pthread_yield
14299 eval $setvar
14300
14301 case "$sched_yield" in
14302 '') sched_yield=undef ;;
14303 esac
14304
14305 $rm -f try try.*
14306
14307 : see if random_r exists
14308 set random_r d_random_r
14309 eval $inlibc
14310 case "$d_random_r" in
14311 "$define")
14312         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14313         case "$d_random_r_proto:$usethreads" in
14314         ":define")      d_random_r_proto=define
14315                 set d_random_r_proto random_r $hdrs
14316                 eval $hasproto ;;
14317         *)      ;;
14318         esac
14319         case "$d_random_r_proto" in
14320         define)
14321         case "$random_r_proto" in
14322         ''|0) try='int random_r(int*, struct random_data*);'
14323         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14324         esac
14325         case "$random_r_proto" in
14326         ''|0)   d_random_r=undef
14327                 random_r_proto=0
14328                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14329         * )     case "$random_r_proto" in
14330                 REENTRANT_PROTO*) ;;
14331                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14332                 esac
14333                 echo "Prototype: $try" ;;
14334         esac
14335         ;;
14336         *)      case "$usethreads" in
14337                 define) echo "random_r has no prototype, not using it." >&4 ;;
14338                 esac
14339                 d_random_r=undef
14340                 random_r_proto=0
14341                 ;;
14342         esac
14343         ;;
14344 *)      random_r_proto=0
14345         ;;
14346 esac
14347
14348 : see if readdir and friends exist
14349 set readdir d_readdir
14350 eval $inlibc
14351 set seekdir d_seekdir
14352 eval $inlibc
14353 set telldir d_telldir
14354 eval $inlibc
14355 set rewinddir d_rewinddir
14356 eval $inlibc
14357
14358 : see if readdir64_r exists
14359 set readdir64_r d_readdir64_r
14360 eval $inlibc
14361 case "$d_readdir64_r" in
14362 "$define")
14363         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14364         case "$d_readdir64_r_proto:$usethreads" in
14365         ":define")      d_readdir64_r_proto=define
14366                 set d_readdir64_r_proto readdir64_r $hdrs
14367                 eval $hasproto ;;
14368         *)      ;;
14369         esac
14370         case "$d_readdir64_r_proto" in
14371         define)
14372         case "$readdir64_r_proto" in
14373         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14374         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14375         esac
14376         case "$readdir64_r_proto" in
14377         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14378         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14379         esac
14380         case "$readdir64_r_proto" in
14381         ''|0)   d_readdir64_r=undef
14382                 readdir64_r_proto=0
14383                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14384         * )     case "$readdir64_r_proto" in
14385                 REENTRANT_PROTO*) ;;
14386                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14387                 esac
14388                 echo "Prototype: $try" ;;
14389         esac
14390         ;;
14391         *)      case "$usethreads" in
14392                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14393                 esac
14394                 d_readdir64_r=undef
14395                 readdir64_r_proto=0
14396                 ;;
14397         esac
14398         ;;
14399 *)      readdir64_r_proto=0
14400         ;;
14401 esac
14402
14403 : see if readdir_r exists
14404 set readdir_r d_readdir_r
14405 eval $inlibc
14406 case "$d_readdir_r" in
14407 "$define")
14408         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14409         case "$d_readdir_r_proto:$usethreads" in
14410         ":define")      d_readdir_r_proto=define
14411                 set d_readdir_r_proto readdir_r $hdrs
14412                 eval $hasproto ;;
14413         *)      ;;
14414         esac
14415         case "$d_readdir_r_proto" in
14416         define)
14417         case "$readdir_r_proto" in
14418         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14419         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14420         esac
14421         case "$readdir_r_proto" in
14422         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14423         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14424         esac
14425         case "$readdir_r_proto" in
14426         ''|0)   d_readdir_r=undef
14427                 readdir_r_proto=0
14428                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14429         * )     case "$readdir_r_proto" in
14430                 REENTRANT_PROTO*) ;;
14431                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14432                 esac
14433                 echo "Prototype: $try" ;;
14434         esac
14435         ;;
14436         *)      case "$usethreads" in
14437                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14438                 esac
14439                 d_readdir_r=undef
14440                 readdir_r_proto=0
14441                 ;;
14442         esac
14443         ;;
14444 *)      readdir_r_proto=0
14445         ;;
14446 esac
14447
14448 : see if readv exists
14449 set readv d_readv
14450 eval $inlibc
14451
14452 : see if recvmsg exists
14453 set recvmsg d_recvmsg
14454 eval $inlibc
14455
14456 : see if rename exists
14457 set rename d_rename
14458 eval $inlibc
14459
14460 : see if rmdir exists
14461 set rmdir d_rmdir
14462 eval $inlibc
14463
14464 : see if memory.h is available.
14465 val=''
14466 set memory.h val
14467 eval $inhdr
14468
14469 : See if it conflicts with string.h
14470 case "$val" in
14471 $define)
14472         case "$strings" in
14473         '') ;;
14474         *)
14475                 $cppstdin $cppflags $cppminus < $strings > mem.h
14476                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14477                         echo " "
14478                         echo "We won't be including <memory.h>."
14479                         val="$undef"
14480                 fi
14481                 $rm -f mem.h
14482                 ;;
14483         esac
14484 esac
14485 set i_memory
14486 eval $setvar
14487
14488 : can bcopy handle overlapping blocks?
14489 echo " "
14490 val="$undef"
14491 case "$d_memmove" in
14492 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14493 *)      case "$d_bcopy" in
14494         "$define")
14495                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14496                 $cat >try.c <<EOCP
14497 #$i_memory I_MEMORY
14498 #$i_stdlib I_STDLIB
14499 #$i_string I_STRING
14500 #$i_unistd I_UNISTD
14501 EOCP
14502         $cat >>try.c <<'EOCP'
14503 #include <stdio.h>
14504 #ifdef I_MEMORY
14505 #  include <memory.h>
14506 #endif
14507 #ifdef I_STDLIB
14508 #  include <stdlib.h>
14509 #endif
14510 #ifdef I_STRING
14511 #  include <string.h>
14512 #else
14513 #  include <strings.h>
14514 #endif
14515 #ifdef I_UNISTD
14516 #  include <unistd.h>  /* Needed for NetBSD */
14517 #endif
14518 int main()
14519 {
14520 char buf[128], abc[128];
14521 char *b;
14522 int len;
14523 int off;
14524 int align;
14525
14526 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14527    try to store the string in read-only memory. */
14528 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14529
14530 for (align = 7; align >= 0; align--) {
14531         for (len = 36; len; len--) {
14532                 b = buf+align;
14533                 bcopy(abc, b, len);
14534                 for (off = 1; off <= len; off++) {
14535                         bcopy(b, b+off, len);
14536                         bcopy(b+off, b, len);
14537                         if (bcmp(b, abc, len))
14538                                 exit(1);
14539                 }
14540         }
14541 }
14542 exit(0);
14543 }
14544 EOCP
14545                 set try
14546                 if eval $compile_ok; then
14547                         if ./try 2>/dev/null; then
14548                                 echo "Yes, it can."
14549                                 val="$define"
14550                         else
14551                                 echo "It can't, sorry."
14552                         fi
14553                 else
14554                         echo "(I can't compile the test program, so we'll assume not...)"
14555                 fi
14556                 ;;
14557         esac
14558         $rm -f try.* try core
14559         ;;
14560 esac
14561 set d_safebcpy
14562 eval $setvar
14563
14564 : can memcpy handle overlapping blocks?
14565 echo " "
14566 val="$undef"
14567 case "$d_memmove" in
14568 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14569 *)      case "$d_memcpy" in
14570         "$define")
14571                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14572                 $cat >try.c <<EOCP
14573 #$i_memory I_MEMORY
14574 #$i_stdlib I_STDLIB
14575 #$i_string I_STRING
14576 #$i_unistd I_UNISTD
14577 EOCP
14578         $cat >>try.c <<'EOCP'
14579 #include <stdio.h>
14580 #ifdef I_MEMORY
14581 #  include <memory.h>
14582 #endif
14583 #ifdef I_STDLIB
14584 #  include <stdlib.h>
14585 #endif
14586 #ifdef I_STRING
14587 #  include <string.h>
14588 #else
14589 #  include <strings.h>
14590 #endif
14591 #ifdef I_UNISTD
14592 #  include <unistd.h>  /* Needed for NetBSD */
14593 #endif
14594 int main()
14595 {
14596 char buf[128], abc[128];
14597 char *b;
14598 int len;
14599 int off;
14600 int align;
14601
14602 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14603    try to store the string in read-only memory. */
14604 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14605
14606 for (align = 7; align >= 0; align--) {
14607         for (len = 36; len; len--) {
14608                 b = buf+align;
14609                 memcpy(b, abc, len);
14610                 for (off = 1; off <= len; off++) {
14611                         memcpy(b+off, b, len);
14612                         memcpy(b, b+off, len);
14613                         if (memcmp(b, abc, len))
14614                                 exit(1);
14615                 }
14616         }
14617 }
14618 exit(0);
14619 }
14620 EOCP
14621                 set try
14622                 if eval $compile_ok; then
14623                         if ./try 2>/dev/null; then
14624                                 echo "Yes, it can."
14625                                 val="$define"
14626                         else
14627                                 echo "It can't, sorry."
14628                         fi
14629                 else
14630                         echo "(I can't compile the test program, so we'll assume not...)"
14631                 fi
14632                 ;;
14633         esac
14634         $rm -f try.* try core
14635         ;;
14636 esac
14637 set d_safemcpy
14638 eval $setvar
14639
14640 : can memcmp be trusted to compare relative magnitude?
14641 val="$undef"
14642 case "$d_memcmp" in
14643 "$define")
14644         echo " "
14645         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14646         $cat >try.c <<EOCP
14647 #$i_memory I_MEMORY
14648 #$i_stdlib I_STDLIB
14649 #$i_string I_STRING
14650 #$i_unistd I_UNISTD
14651 EOCP
14652         $cat >>try.c <<'EOCP'
14653 #include <stdio.h>
14654 #ifdef I_MEMORY
14655 #  include <memory.h>
14656 #endif
14657 #ifdef I_STDLIB
14658 #  include <stdlib.h>
14659 #endif
14660 #ifdef I_STRING
14661 #  include <string.h>
14662 #else
14663 #  include <strings.h>
14664 #endif
14665 #ifdef I_UNISTD
14666 #  include <unistd.h>  /* Needed for NetBSD */
14667 #endif
14668 int main()
14669 {
14670 char a = -1;
14671 char b = 0;
14672 if ((a < b) && memcmp(&a, &b, 1) < 0)
14673         exit(1);
14674 exit(0);
14675 }
14676 EOCP
14677         set try
14678         if eval $compile_ok; then
14679                 if $run ./try 2>/dev/null; then
14680                         echo "Yes, it can."
14681                         val="$define"
14682                 else
14683                         echo "No, it can't (it uses signed chars)."
14684                 fi
14685         else
14686                 echo "(I can't compile the test program, so we'll assume not...)"
14687         fi
14688         ;;
14689 esac
14690 $rm -f try.* try core
14691 set d_sanemcmp
14692 eval $setvar
14693
14694 : see if prototype for sbrk is available
14695 echo " "
14696 set d_sbrkproto sbrk $i_unistd unistd.h
14697 eval $hasproto
14698
14699 : see if select exists
14700 set select d_select
14701 eval $inlibc
14702
14703 : see if semctl exists
14704 set semctl d_semctl
14705 eval $inlibc
14706
14707 : see if semget exists
14708 set semget d_semget
14709 eval $inlibc
14710
14711 : see if semop exists
14712 set semop d_semop
14713 eval $inlibc
14714
14715 : see how much of the 'sem*(2)' library is present.
14716 h_sem=true
14717 echo " "
14718 case "$d_semctl$d_semget$d_semop" in
14719 *"$undef"*) h_sem=false;;
14720 esac
14721 case "$osname" in
14722 freebsd)
14723     case "`ipcs 2>&1`" in
14724     "SVID messages"*"not configured"*)
14725         echo "Your $osname does not have the sem*(2) configured." >&4
14726         h_sem=false
14727         val="$undef"
14728         set semctl d_semctl
14729         eval $setvar
14730         set semget d_semget
14731         eval $setvar
14732         set semop d_semop
14733         eval $setvar
14734         ;;
14735     esac
14736     ;;
14737 esac
14738 : we could also check for sys/ipc.h ...
14739 if $h_sem && $test `./findhdr sys/sem.h`; then
14740         echo "You have the full sem*(2) library." >&4
14741         val="$define"
14742 else
14743         echo "You don't have the full sem*(2) library." >&4
14744         val="$undef"
14745 fi
14746 set d_sem
14747 eval $setvar
14748
14749 : see whether sys/sem.h defines union semun
14750 echo " "
14751 $cat > try.c <<'END'
14752 #include <sys/types.h>
14753 #include <sys/ipc.h>
14754 #include <sys/sem.h>
14755 int main () { union semun semun; semun.buf = 0; }
14756 END
14757 set try
14758 if eval $compile; then
14759     echo "You have union semun in <sys/sem.h>." >&4
14760     val="$define"
14761 else
14762     echo "You do not have union semun in <sys/sem.h>." >&4
14763     val="$undef"
14764 fi
14765 $rm -f try try.c try.h
14766 set d_union_semun
14767 eval $setvar
14768
14769 : see how to do semctl IPC_STAT
14770 case "$d_sem" in
14771 $define)
14772     : see whether semctl IPC_STAT can use union semun
14773     echo " "
14774     $cat > try.h <<END
14775 #ifndef S_IRUSR
14776 #   ifdef S_IREAD
14777 #       define S_IRUSR S_IREAD
14778 #       define S_IWUSR S_IWRITE
14779 #       define S_IXUSR S_IEXEC
14780 #   else
14781 #       define S_IRUSR 0400
14782 #       define S_IWUSR 0200
14783 #       define S_IXUSR 0100
14784 #   endif
14785 #   define S_IRGRP (S_IRUSR>>3)
14786 #   define S_IWGRP (S_IWUSR>>3)
14787 #   define S_IXGRP (S_IXUSR>>3)
14788 #   define S_IROTH (S_IRUSR>>6)
14789 #   define S_IWOTH (S_IWUSR>>6)
14790 #   define S_IXOTH (S_IXUSR>>6)
14791 #endif
14792 #ifndef S_IRWXU
14793 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14794 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14795 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14796 #endif
14797 END
14798
14799     $cat > try.c <<END
14800 #include <sys/types.h>
14801 #include <sys/ipc.h>
14802 #include <sys/sem.h>
14803 #include <sys/stat.h>
14804 #include <stdio.h>
14805 #include <errno.h>
14806 #include "try.h"
14807 #ifndef errno
14808 extern int errno;
14809 #endif
14810 #$d_union_semun HAS_UNION_SEMUN
14811 int main() {
14812     union semun
14813 #ifndef HAS_UNION_SEMUN
14814     {
14815         int val;
14816         struct semid_ds *buf;
14817         unsigned short *array;
14818     }
14819 #endif
14820     arg;
14821     int sem, st;
14822
14823 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14824     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14825     if (sem > -1) {
14826         struct semid_ds argbuf;
14827         arg.buf = &argbuf;
14828 #       ifdef IPC_STAT
14829         st = semctl(sem, 0, IPC_STAT, arg);
14830         if (st == 0)
14831             printf("semun\n");
14832         else
14833 #       endif /* IPC_STAT */
14834             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14835 #       ifdef IPC_RMID
14836         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14837 #       endif /* IPC_RMID */
14838             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14839     } else
14840 #endif /* IPC_PRIVATE && ... */
14841         printf("semget failed: errno = %d\n", errno);
14842   return 0;
14843 }
14844 END
14845     val="$undef"
14846     set try
14847     if eval $compile; then
14848         xxx=`$run ./try`
14849         case "$xxx" in
14850         semun) val="$define" ;;
14851         esac
14852     fi
14853     $rm -f try try.c
14854     set d_semctl_semun
14855     eval $setvar
14856     case "$d_semctl_semun" in
14857     $define)
14858         echo "You can use union semun for semctl IPC_STAT." >&4
14859         also='also'
14860         ;;
14861     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14862         also=''
14863         ;;
14864     esac
14865
14866     : see whether semctl IPC_STAT can use struct semid_ds pointer
14867     $cat > try.c <<'END'
14868 #include <sys/types.h>
14869 #include <sys/ipc.h>
14870 #include <sys/sem.h>
14871 #include <sys/stat.h>
14872 #include "try.h"
14873 #include <stdio.h>
14874 #include <errno.h>
14875 #ifndef errno
14876 extern int errno;
14877 #endif
14878 int main() {
14879     struct semid_ds arg;
14880     int sem, st;
14881
14882 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14883     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14884     if (sem > -1) {
14885 #       ifdef IPC_STAT
14886         st = semctl(sem, 0, IPC_STAT, &arg);
14887         if (st == 0)
14888             printf("semid_ds\n");
14889         else
14890 #       endif /* IPC_STAT */
14891             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14892 #       ifdef IPC_RMID
14893         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14894 #       endif /* IPC_RMID */
14895             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14896     } else
14897 #endif /* IPC_PRIVATE && ... */
14898         printf("semget failed: errno = %d\n", errno);
14899
14900     return 0;
14901 }
14902 END
14903     val="$undef"
14904     set try
14905     if eval $compile; then
14906         xxx=`$run ./try`
14907         case "$xxx" in
14908         semid_ds) val="$define" ;;
14909         esac
14910     fi
14911     $rm -f try try.c
14912     set d_semctl_semid_ds
14913     eval $setvar
14914     case "$d_semctl_semid_ds" in
14915     $define)
14916         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14917         ;;
14918     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14919         ;;
14920     esac
14921     $rm -f try.h
14922     ;;
14923 *)  val="$undef"
14924
14925     # We do not have the full sem*(2) library, so assume we can not
14926     # use either.
14927
14928     set d_semctl_semun
14929     eval $setvar
14930
14931     set d_semctl_semid_ds
14932     eval $setvar
14933     ;;
14934 esac
14935
14936 : see if sendmsg exists
14937 set sendmsg d_sendmsg
14938 eval $inlibc
14939
14940 : see if setegid exists
14941 set setegid d_setegid
14942 eval $inlibc
14943
14944 : see if seteuid exists
14945 set seteuid d_seteuid
14946 eval $inlibc
14947
14948 : see if setgrent exists
14949 set setgrent d_setgrent
14950 eval $inlibc
14951
14952 : see if setgrent_r exists
14953 set setgrent_r d_setgrent_r
14954 eval $inlibc
14955 case "$d_setgrent_r" in
14956 "$define")
14957         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14958         case "$d_setgrent_r_proto:$usethreads" in
14959         ":define")      d_setgrent_r_proto=define
14960                 set d_setgrent_r_proto setgrent_r $hdrs
14961                 eval $hasproto ;;
14962         *)      ;;
14963         esac
14964         case "$d_setgrent_r_proto" in
14965         define)
14966         case "$setgrent_r_proto" in
14967         ''|0) try='int setgrent_r(FILE**);'
14968         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14969         esac
14970         case "$setgrent_r_proto" in
14971         ''|0) try='void setgrent_r(FILE**);'
14972         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14973         esac
14974         case "$setgrent_r_proto" in
14975         ''|0)   d_setgrent_r=undef
14976                 setgrent_r_proto=0
14977                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14978         * )     case "$setgrent_r_proto" in
14979                 REENTRANT_PROTO*) ;;
14980                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14981                 esac
14982                 echo "Prototype: $try" ;;
14983         esac
14984         ;;
14985         *)      case "$usethreads" in
14986                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14987                 esac
14988                 d_setgrent_r=undef
14989                 setgrent_r_proto=0
14990                 ;;
14991         esac
14992         ;;
14993 *)      setgrent_r_proto=0
14994         ;;
14995 esac
14996
14997 : see if sethostent exists
14998 set sethostent d_sethent
14999 eval $inlibc
15000
15001 : see if sethostent_r exists
15002 set sethostent_r d_sethostent_r
15003 eval $inlibc
15004 case "$d_sethostent_r" in
15005 "$define")
15006         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15007         case "$d_sethostent_r_proto:$usethreads" in
15008         ":define")      d_sethostent_r_proto=define
15009                 set d_sethostent_r_proto sethostent_r $hdrs
15010                 eval $hasproto ;;
15011         *)      ;;
15012         esac
15013         case "$d_sethostent_r_proto" in
15014         define)
15015         case "$sethostent_r_proto" in
15016         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15017         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15018         esac
15019         case "$sethostent_r_proto" in
15020         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15021         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15022         esac
15023         case "$sethostent_r_proto" in
15024         ''|0)   d_sethostent_r=undef
15025                 sethostent_r_proto=0
15026                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15027         * )     case "$sethostent_r_proto" in
15028                 REENTRANT_PROTO*) ;;
15029                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15030                 esac
15031                 echo "Prototype: $try" ;;
15032         esac
15033         ;;
15034         *)      case "$usethreads" in
15035                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15036                 esac
15037                 d_sethostent_r=undef
15038                 sethostent_r_proto=0
15039                 ;;
15040         esac
15041         ;;
15042 *)      sethostent_r_proto=0
15043         ;;
15044 esac
15045
15046 : see if setitimer exists
15047 set setitimer d_setitimer
15048 eval $inlibc
15049
15050 : see if setlinebuf exists
15051 set setlinebuf d_setlinebuf
15052 eval $inlibc
15053
15054 : see if setlocale exists
15055 set setlocale d_setlocale
15056 eval $inlibc
15057
15058 : see if locale.h is available
15059 set locale.h i_locale
15060 eval $inhdr
15061
15062 : see if setlocale_r exists
15063 set setlocale_r d_setlocale_r
15064 eval $inlibc
15065 case "$d_setlocale_r" in
15066 "$define")
15067         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15068         case "$d_setlocale_r_proto:$usethreads" in
15069         ":define")      d_setlocale_r_proto=define
15070                 set d_setlocale_r_proto setlocale_r $hdrs
15071                 eval $hasproto ;;
15072         *)      ;;
15073         esac
15074         case "$d_setlocale_r_proto" in
15075         define)
15076         case "$setlocale_r_proto" in
15077         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15078         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15079         esac
15080         case "$setlocale_r_proto" in
15081         ''|0)   d_setlocale_r=undef
15082                 setlocale_r_proto=0
15083                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15084         * )     case "$setlocale_r_proto" in
15085                 REENTRANT_PROTO*) ;;
15086                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15087                 esac
15088                 echo "Prototype: $try" ;;
15089         esac
15090         ;;
15091         *)      case "$usethreads" in
15092                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15093                 esac
15094                 d_setlocale_r=undef
15095                 setlocale_r_proto=0
15096                 ;;
15097         esac
15098         ;;
15099 *)      setlocale_r_proto=0
15100         ;;
15101 esac
15102
15103 : see if setnetent exists
15104 set setnetent d_setnent
15105 eval $inlibc
15106
15107 : see if setnetent_r exists
15108 set setnetent_r d_setnetent_r
15109 eval $inlibc
15110 case "$d_setnetent_r" in
15111 "$define")
15112         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15113         case "$d_setnetent_r_proto:$usethreads" in
15114         ":define")      d_setnetent_r_proto=define
15115                 set d_setnetent_r_proto setnetent_r $hdrs
15116                 eval $hasproto ;;
15117         *)      ;;
15118         esac
15119         case "$d_setnetent_r_proto" in
15120         define)
15121         case "$setnetent_r_proto" in
15122         ''|0) try='int setnetent_r(int, struct netent_data*);'
15123         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15124         esac
15125         case "$setnetent_r_proto" in
15126         ''|0) try='void setnetent_r(int, struct netent_data*);'
15127         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15128         esac
15129         case "$setnetent_r_proto" in
15130         ''|0)   d_setnetent_r=undef
15131                 setnetent_r_proto=0
15132                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15133         * )     case "$setnetent_r_proto" in
15134                 REENTRANT_PROTO*) ;;
15135                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15136                 esac
15137                 echo "Prototype: $try" ;;
15138         esac
15139         ;;
15140         *)      case "$usethreads" in
15141                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15142                 esac
15143                 d_setnetent_r=undef
15144                 setnetent_r_proto=0
15145                 ;;
15146         esac
15147         ;;
15148 *)      setnetent_r_proto=0
15149         ;;
15150 esac
15151
15152 : see if setprotoent exists
15153 set setprotoent d_setpent
15154 eval $inlibc
15155
15156 : see if setpgid exists
15157 set setpgid d_setpgid
15158 eval $inlibc
15159
15160 : see if setpgrp2 exists
15161 set setpgrp2 d_setpgrp2
15162 eval $inlibc
15163
15164 : see if setpriority exists
15165 set setpriority d_setprior
15166 eval $inlibc
15167
15168 : see if setproctitle exists
15169 set setproctitle d_setproctitle
15170 eval $inlibc
15171
15172 : see if setprotoent_r exists
15173 set setprotoent_r d_setprotoent_r
15174 eval $inlibc
15175 case "$d_setprotoent_r" in
15176 "$define")
15177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15178         case "$d_setprotoent_r_proto:$usethreads" in
15179         ":define")      d_setprotoent_r_proto=define
15180                 set d_setprotoent_r_proto setprotoent_r $hdrs
15181                 eval $hasproto ;;
15182         *)      ;;
15183         esac
15184         case "$d_setprotoent_r_proto" in
15185         define)
15186         case "$setprotoent_r_proto" in
15187         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15188         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15189         esac
15190         case "$setprotoent_r_proto" in
15191         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15192         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15193         esac
15194         case "$setprotoent_r_proto" in
15195         ''|0)   d_setprotoent_r=undef
15196                 setprotoent_r_proto=0
15197                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15198         * )     case "$setprotoent_r_proto" in
15199                 REENTRANT_PROTO*) ;;
15200                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15201                 esac
15202                 echo "Prototype: $try" ;;
15203         esac
15204         ;;
15205         *)      case "$usethreads" in
15206                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15207                 esac
15208                 d_setprotoent_r=undef
15209                 setprotoent_r_proto=0
15210                 ;;
15211         esac
15212         ;;
15213 *)      setprotoent_r_proto=0
15214         ;;
15215 esac
15216
15217 : see if setpwent exists
15218 set setpwent d_setpwent
15219 eval $inlibc
15220
15221 : see if setpwent_r exists
15222 set setpwent_r d_setpwent_r
15223 eval $inlibc
15224 case "$d_setpwent_r" in
15225 "$define")
15226         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15227         case "$d_setpwent_r_proto:$usethreads" in
15228         ":define")      d_setpwent_r_proto=define
15229                 set d_setpwent_r_proto setpwent_r $hdrs
15230                 eval $hasproto ;;
15231         *)      ;;
15232         esac
15233         case "$d_setpwent_r_proto" in
15234         define)
15235         case "$setpwent_r_proto" in
15236         ''|0) try='int setpwent_r(FILE**);'
15237         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15238         esac
15239         case "$setpwent_r_proto" in
15240         ''|0) try='void setpwent_r(FILE**);'
15241         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15242         esac
15243         case "$setpwent_r_proto" in
15244         ''|0)   d_setpwent_r=undef
15245                 setpwent_r_proto=0
15246                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15247         * )     case "$setpwent_r_proto" in
15248                 REENTRANT_PROTO*) ;;
15249                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15250                 esac
15251                 echo "Prototype: $try" ;;
15252         esac
15253         ;;
15254         *)      case "$usethreads" in
15255                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15256                 esac
15257                 d_setpwent_r=undef
15258                 setpwent_r_proto=0
15259                 ;;
15260         esac
15261         ;;
15262 *)      setpwent_r_proto=0
15263         ;;
15264 esac
15265
15266 : see if setregid exists
15267 set setregid d_setregid
15268 eval $inlibc
15269 set setresgid d_setresgid
15270 eval $inlibc
15271
15272 : see if setreuid exists
15273 set setreuid d_setreuid
15274 eval $inlibc
15275 set setresuid d_setresuid
15276 eval $inlibc
15277
15278 : see if setrgid exists
15279 set setrgid d_setrgid
15280 eval $inlibc
15281
15282 : see if setruid exists
15283 set setruid d_setruid
15284 eval $inlibc
15285
15286 : see if setservent exists
15287 set setservent d_setsent
15288 eval $inlibc
15289
15290 : see if setservent_r exists
15291 set setservent_r d_setservent_r
15292 eval $inlibc
15293 case "$d_setservent_r" in
15294 "$define")
15295         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15296         case "$d_setservent_r_proto:$usethreads" in
15297         ":define")      d_setservent_r_proto=define
15298                 set d_setservent_r_proto setservent_r $hdrs
15299                 eval $hasproto ;;
15300         *)      ;;
15301         esac
15302         case "$d_setservent_r_proto" in
15303         define)
15304         case "$setservent_r_proto" in
15305         ''|0) try='int setservent_r(int, struct servent_data*);'
15306         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15307         esac
15308         case "$setservent_r_proto" in
15309         ''|0) try='void setservent_r(int, struct servent_data*);'
15310         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15311         esac
15312         case "$setservent_r_proto" in
15313         ''|0)   d_setservent_r=undef
15314                 setservent_r_proto=0
15315                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15316         * )     case "$setservent_r_proto" in
15317                 REENTRANT_PROTO*) ;;
15318                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15319                 esac
15320                 echo "Prototype: $try" ;;
15321         esac
15322         ;;
15323         *)      case "$usethreads" in
15324                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15325                 esac
15326                 d_setservent_r=undef
15327                 setservent_r_proto=0
15328                 ;;
15329         esac
15330         ;;
15331 *)      setservent_r_proto=0
15332         ;;
15333 esac
15334
15335 : see if setsid exists
15336 set setsid d_setsid
15337 eval $inlibc
15338
15339 : see if setvbuf exists
15340 set setvbuf d_setvbuf
15341 eval $inlibc
15342
15343 : see if sfio.h is available
15344 set sfio.h i_sfio
15345 eval $inhdr
15346
15347
15348 : see if sfio library is available
15349 case "$i_sfio" in
15350 $define)
15351         val=''
15352         set sfreserve val
15353         eval $inlibc
15354         ;;
15355 *)
15356         val="$undef"
15357         ;;
15358 esac
15359 : Ok, but do we want to use it.
15360 case "$val" in
15361 $define)
15362         case "$usesfio" in
15363         true|$define|[yY]*) dflt='y';;
15364         *) dflt='n';;
15365         esac
15366         echo "$package can use the sfio library, but it is experimental."
15367         case "$useperlio" in
15368         "$undef")
15369             echo "For sfio also the PerlIO abstraction layer is needed."
15370             echo "Earlier you said you wouldn't want that."
15371             ;;
15372         esac
15373         rp="You seem to have sfio available, do you want to try using it?"
15374         . ./myread
15375         case "$ans" in
15376         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15377                 useperlio="$define"
15378                 val="$define"
15379                 ;;
15380         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15381                 val="$undef"
15382                 ;;
15383         esac
15384         ;;
15385 *)      case "$usesfio" in
15386         true|$define|[yY]*)
15387                 echo "Sorry, cannot find sfio on this machine." >&4
15388                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15389                 val="$undef"
15390                 ;;
15391         esac
15392         ;;
15393 esac
15394 set d_sfio
15395 eval $setvar
15396 case "$d_sfio" in
15397 $define) usesfio='true';;
15398 *) usesfio='false';;
15399 esac
15400 case "$d_sfio" in
15401 $define) ;;
15402 *)      : Remove sfio from list of libraries to use
15403         case "$libs" in
15404         *-lsfio*)
15405                 echo "Removing unneeded -lsfio from library list" >&4
15406                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15407                 shift
15408                 libs="$*"
15409                 echo "libs = $libs" >&4
15410                 ;;
15411         esac
15412 ;;
15413 esac
15414
15415
15416 : see if shmctl exists
15417 set shmctl d_shmctl
15418 eval $inlibc
15419
15420 : see if shmget exists
15421 set shmget d_shmget
15422 eval $inlibc
15423
15424 : see if shmat exists
15425 set shmat d_shmat
15426 eval $inlibc
15427 : see what shmat returns
15428 case "$d_shmat" in
15429 "$define")
15430         $cat >shmat.c <<'END'
15431 #include <sys/shm.h>
15432 void *shmat();
15433 END
15434         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15435                 shmattype='void *'
15436         else
15437                 shmattype='char *'
15438         fi
15439         echo "and it returns ($shmattype)." >&4
15440         : see if a prototype for shmat is available
15441         xxx=`./findhdr sys/shm.h`
15442         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15443         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15444                 val="$define"
15445         else
15446                 val="$undef"
15447         fi
15448         $rm -f shmat.[co]
15449         ;;
15450 *)
15451         val="$undef"
15452         ;;
15453 esac
15454 set d_shmatprototype
15455 eval $setvar
15456
15457 : see if shmdt exists
15458 set shmdt d_shmdt
15459 eval $inlibc
15460
15461 : see how much of the 'shm*(2)' library is present.
15462 h_shm=true
15463 echo " "
15464 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15465 *"$undef"*) h_shm=false;;
15466 esac
15467 case "$osname" in
15468 freebsd)
15469     case "`ipcs 2>&1`" in
15470     "SVID shared memory"*"not configured"*)
15471         echo "Your $osname does not have the shm*(2) configured." >&4
15472         h_shm=false
15473         val="$undef"
15474         set shmctl d_shmctl
15475         evat $setvar
15476         set shmget d_shmget
15477         evat $setvar
15478         set shmat d_shmat
15479         evat $setvar
15480         set shmdt d_shmdt
15481         evat $setvar
15482         ;;
15483     esac
15484     ;;
15485 esac
15486 : we could also check for sys/ipc.h ...
15487 if $h_shm && $test `./findhdr sys/shm.h`; then
15488         echo "You have the full shm*(2) library." >&4
15489         val="$define"
15490 else
15491         echo "You don't have the full shm*(2) library." >&4
15492         val="$undef"
15493 fi
15494 set d_shm
15495 eval $setvar
15496
15497 echo " "
15498 : see if we have sigaction
15499 if set sigaction val -f d_sigaction; eval $csym; $val; then
15500         echo 'sigaction() found.' >&4
15501         $cat > try.c <<'EOP'
15502 #include <stdio.h>
15503 #include <sys/types.h>
15504 #include <signal.h>
15505 int main()
15506 {
15507     struct sigaction act, oact;
15508     act.sa_flags = 0;
15509     oact.sa_handler = 0;
15510     /* so that act and oact are used */
15511     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15512 }
15513 EOP
15514         set try
15515         if eval $compile_ok; then
15516                 val="$define"
15517         else
15518                 echo "But you don't seem to have a useable struct sigaction." >&4
15519                 val="$undef"
15520         fi
15521 else
15522         echo 'sigaction NOT found.' >&4
15523         val="$undef"
15524 fi
15525 set d_sigaction; eval $setvar
15526 $rm -f try try$_o try.c
15527
15528 : see if sigprocmask exists
15529 set sigprocmask d_sigprocmask
15530 eval $inlibc
15531
15532 : see if sigsetjmp exists
15533 echo " "
15534 case "$d_sigsetjmp" in
15535 '')
15536         $cat >try.c <<'EOP'
15537 #include <setjmp.h>
15538 sigjmp_buf env;
15539 int set = 1;
15540 int main()
15541 {
15542         if (sigsetjmp(env,1))
15543                 exit(set);
15544         set = 0;
15545         siglongjmp(env, 1);
15546         exit(1);
15547 }
15548 EOP
15549         set try
15550         if eval $compile; then
15551                 if $run ./try >/dev/null 2>&1; then
15552                         echo "POSIX sigsetjmp found." >&4
15553                         val="$define"
15554                 else
15555                         $cat >&4 <<EOM
15556 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15557 I'll ignore them.
15558 EOM
15559                         val="$undef"
15560                 fi
15561         else
15562                 echo "sigsetjmp not found." >&4
15563                 val="$undef"
15564         fi
15565         ;;
15566 *) val="$d_sigsetjmp"
15567         case "$d_sigsetjmp" in
15568         $define) echo "POSIX sigsetjmp found." >&4;;
15569         $undef) echo "sigsetjmp not found." >&4;;
15570         esac
15571         ;;
15572 esac
15573 set d_sigsetjmp
15574 eval $setvar
15575 $rm -f try.c try
15576
15577 : see if sockatmark exists
15578 set sockatmark d_sockatmark
15579 eval $inlibc
15580
15581 : see if prototype for sockatmark is available
15582 echo " "
15583 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15584 eval $hasproto
15585
15586 : see if socks5_init exists
15587 set socks5_init d_socks5_init
15588 eval $inlibc
15589
15590 : see if srand48_r exists
15591 set srand48_r d_srand48_r
15592 eval $inlibc
15593 case "$d_srand48_r" in
15594 "$define")
15595         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15596         case "$d_srand48_r_proto:$usethreads" in
15597         ":define")      d_srand48_r_proto=define
15598                 set d_srand48_r_proto srand48_r $hdrs
15599                 eval $hasproto ;;
15600         *)      ;;
15601         esac
15602         case "$d_srand48_r_proto" in
15603         define)
15604         case "$srand48_r_proto" in
15605         ''|0) try='int srand48_r(long, struct drand48_data*);'
15606         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15607         esac
15608         case "$srand48_r_proto" in
15609         ''|0)   d_srand48_r=undef
15610                 srand48_r_proto=0
15611                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15612         * )     case "$srand48_r_proto" in
15613                 REENTRANT_PROTO*) ;;
15614                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15615                 esac
15616                 echo "Prototype: $try" ;;
15617         esac
15618         ;;
15619         *)      case "$usethreads" in
15620                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15621                 esac
15622                 d_srand48_r=undef
15623                 srand48_r_proto=0
15624                 ;;
15625         esac
15626         ;;
15627 *)      srand48_r_proto=0
15628         ;;
15629 esac
15630
15631 : see if srandom_r exists
15632 set srandom_r d_srandom_r
15633 eval $inlibc
15634 case "$d_srandom_r" in
15635 "$define")
15636         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15637         case "$d_srandom_r_proto:$usethreads" in
15638         ":define")      d_srandom_r_proto=define
15639                 set d_srandom_r_proto srandom_r $hdrs
15640                 eval $hasproto ;;
15641         *)      ;;
15642         esac
15643         case "$d_srandom_r_proto" in
15644         define)
15645         case "$srandom_r_proto" in
15646         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15647         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15648         esac
15649         case "$srandom_r_proto" in
15650         ''|0)   d_srandom_r=undef
15651                 srandom_r_proto=0
15652                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15653         * )     case "$srandom_r_proto" in
15654                 REENTRANT_PROTO*) ;;
15655                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15656                 esac
15657                 echo "Prototype: $try" ;;
15658         esac
15659         ;;
15660         *)      case "$usethreads" in
15661                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15662                 esac
15663                 d_srandom_r=undef
15664                 srandom_r_proto=0
15665                 ;;
15666         esac
15667         ;;
15668 *)      srandom_r_proto=0
15669         ;;
15670 esac
15671
15672 : see if prototype for setresgid is available
15673 echo " "
15674 set d_sresgproto setresgid $i_unistd unistd.h
15675 eval $hasproto
15676
15677 : see if prototype for setresuid is available
15678 echo " "
15679 set d_sresuproto setresuid $i_unistd unistd.h
15680 eval $hasproto
15681
15682 : see if sys/stat.h is available
15683 set sys/stat.h i_sysstat
15684 eval $inhdr
15685
15686
15687 : see if stat knows about block sizes
15688 echo " "
15689 echo "Checking to see if your struct stat has st_blocks field..." >&4
15690 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15691 eval $hasfield
15692
15693
15694 : see if this is a sys/vfs.h system
15695 set sys/vfs.h i_sysvfs
15696 eval $inhdr
15697
15698
15699 : see if this is a sys/statfs.h system
15700 set sys/statfs.h i_sysstatfs
15701 eval $inhdr
15702
15703
15704 echo " "
15705 echo "Checking to see if your system supports struct statfs..." >&4
15706 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
15707 eval $hasstruct
15708 case "$d_statfs_s" in
15709 "$define")      echo "Yes, it does."   ;;
15710 *)              echo "No, it doesn't." ;;
15711 esac
15712
15713
15714
15715 : see if struct statfs knows about f_flags
15716 case "$d_statfs_s" in
15717 define) 
15718         echo " "
15719         echo "Checking to see if your struct statfs has f_flags field..." >&4
15720         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
15721         eval $hasfield
15722         ;;
15723 *)      val="$undef"
15724         set d_statfs_f_flags
15725         eval $setvar
15726         ;;
15727 esac
15728 case "$d_statfs_f_flags" in
15729 "$define")      echo "Yes, it does."   ;;
15730 *)              echo "No, it doesn't." ;;
15731 esac
15732
15733 : see if _ptr and _cnt from stdio act std
15734 echo " "
15735
15736 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15737         echo "(Looks like you have stdio.h from BSD.)"
15738         case "$stdio_ptr" in
15739         '') stdio_ptr='((fp)->_p)'
15740                 ptr_lval=$define
15741                 ;;
15742         *)      ptr_lval=$d_stdio_ptr_lval;;
15743         esac
15744         case "$stdio_cnt" in
15745         '') stdio_cnt='((fp)->_r)'
15746                 cnt_lval=$define
15747                 ;;
15748         *)      cnt_lval=$d_stdio_cnt_lval;;
15749         esac
15750         case "$stdio_base" in
15751         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15752         esac
15753         case "$stdio_bufsiz" in
15754         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15755         esac
15756 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15757         echo "(Looks like you have stdio.h from Linux.)"
15758         case "$stdio_ptr" in
15759         '') stdio_ptr='((fp)->_IO_read_ptr)'
15760                 ptr_lval=$define
15761                 ;;
15762         *)      ptr_lval=$d_stdio_ptr_lval;;
15763         esac
15764         case "$stdio_cnt" in
15765         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15766                 cnt_lval=$undef
15767                 ;;
15768         *)      cnt_lval=$d_stdio_cnt_lval;;
15769         esac
15770         case "$stdio_base" in
15771         '') stdio_base='((fp)->_IO_read_base)';;
15772         esac
15773         case "$stdio_bufsiz" in
15774         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15775         esac
15776 else
15777         case "$stdio_ptr" in
15778         '') stdio_ptr='((fp)->_ptr)'
15779                 ptr_lval=$define
15780                 ;;
15781         *)      ptr_lval=$d_stdio_ptr_lval;;
15782         esac
15783         case "$stdio_cnt" in
15784         '') stdio_cnt='((fp)->_cnt)'
15785                 cnt_lval=$define
15786                 ;;
15787         *)      cnt_lval=$d_stdio_cnt_lval;;
15788         esac
15789         case "$stdio_base" in
15790         '') stdio_base='((fp)->_base)';;
15791         esac
15792         case "$stdio_bufsiz" in
15793         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15794         esac
15795 fi
15796
15797 : test whether _ptr and _cnt really work
15798 echo "Checking how std your stdio is..." >&4
15799 $cat >try.c <<EOP
15800 #include <stdio.h>
15801 #define FILE_ptr(fp)    $stdio_ptr
15802 #define FILE_cnt(fp)    $stdio_cnt
15803 int main() {
15804         FILE *fp = fopen("try.c", "r");
15805         char c = getc(fp);
15806         if (
15807                 18 <= FILE_cnt(fp) &&
15808                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15809         )
15810                 exit(0);
15811         exit(1);
15812 }
15813 EOP
15814 val="$undef"
15815 set try
15816 if eval $compile && $to try.c; then
15817         if $run ./try; then
15818                 echo "Your stdio acts pretty std."
15819                 val="$define"
15820         else
15821                 echo "Your stdio isn't very std."
15822         fi
15823 else
15824         echo "Your stdio doesn't appear very std."
15825 fi
15826 $rm -f try.c try
15827
15828 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15829 # direct buffer manipulation no longer works.  The Configure tests
15830 # should be changed to correctly detect this, but until then,
15831 # the following check should at least let perl compile and run.
15832 # (This quick fix should be updated before 5.8.1.)
15833 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15834 # A. Dougherty, June 3, 2002.
15835 case "$d_gnulibc" in
15836 $define)
15837         case "$gnulibc_version" in
15838         2.[01]*)  ;;
15839         2.2) ;;
15840         2.2.[0-9]) ;;
15841         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15842                 val="$undef"
15843                 ;;
15844         esac
15845         ;;
15846 esac
15847 set d_stdstdio
15848 eval $setvar
15849
15850 : Can _ptr be used as an lvalue?
15851 case "$d_stdstdio$ptr_lval" in
15852 $define$define) val=$define ;;
15853 *) val=$undef ;;
15854 esac
15855 set d_stdio_ptr_lval
15856 eval $setvar
15857
15858 : Can _cnt be used as an lvalue?
15859 case "$d_stdstdio$cnt_lval" in
15860 $define$define) val=$define ;;
15861 *) val=$undef ;;
15862 esac
15863 set d_stdio_cnt_lval
15864 eval $setvar
15865
15866
15867 : test whether setting _ptr sets _cnt as a side effect
15868 d_stdio_ptr_lval_sets_cnt="$undef"
15869 d_stdio_ptr_lval_nochange_cnt="$undef"
15870 case "$d_stdio_ptr_lval$d_stdstdio" in
15871 $define$define)
15872         echo "Checking to see what happens if we set the stdio ptr..." >&4
15873 $cat >try.c <<EOP
15874 #include <stdio.h>
15875 /* Can we scream? */
15876 /* Eat dust sed :-) */
15877 /* In the buffer space, no one can hear you scream. */
15878 #define FILE_ptr(fp)    $stdio_ptr
15879 #define FILE_cnt(fp)    $stdio_cnt
15880 #include <sys/types.h>
15881 int main() {
15882         FILE *fp = fopen("try.c", "r");
15883         int c;
15884         char *ptr;
15885         size_t cnt;
15886         if (!fp) {
15887             puts("Fail even to read");
15888             exit(1);
15889         }
15890         c = getc(fp); /* Read away the first # */
15891         if (c == EOF) {
15892             puts("Fail even to read");
15893             exit(1);
15894         }
15895         if (!(
15896                 18 <= FILE_cnt(fp) &&
15897                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15898         )) {
15899                 puts("Fail even to read");
15900                 exit (1);
15901         }
15902         ptr = (char*) FILE_ptr(fp);
15903         cnt = (size_t)FILE_cnt(fp);
15904
15905         FILE_ptr(fp) += 42;
15906
15907         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15908                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15909                 exit (1);
15910         }
15911         if (FILE_cnt(fp) <= 20) {
15912                 printf ("Fail (<20 chars to test)");
15913                 exit (1);
15914         }
15915         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15916                 puts("Fail compare");
15917                 exit (1);
15918         }
15919         if (cnt == FILE_cnt(fp)) {
15920                 puts("Pass_unchanged");
15921                 exit (0);
15922         }       
15923         if (FILE_cnt(fp) == (cnt - 42)) {
15924                 puts("Pass_changed");
15925                 exit (0);
15926         }
15927         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15928         return 1;
15929
15930 }
15931 EOP
15932         set try
15933         if eval $compile && $to try.c; then
15934                 case `$run ./try` in
15935                 Pass_changed)
15936                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15937                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15938                 Pass_unchanged)
15939                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15940                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15941                 Fail*)
15942                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15943                 *)
15944                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15945         esac
15946         else
15947                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15948         fi
15949         $rm -f try.c try
15950         ;;
15951 esac
15952
15953 : see if _base is also standard
15954 val="$undef"
15955 case "$d_stdstdio" in
15956 $define)
15957         $cat >try.c <<EOP
15958 #include <stdio.h>
15959 #define FILE_base(fp)   $stdio_base
15960 #define FILE_bufsiz(fp) $stdio_bufsiz
15961 int main() {
15962         FILE *fp = fopen("try.c", "r");
15963         char c = getc(fp);
15964         if (
15965                 19 <= FILE_bufsiz(fp) &&
15966                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15967         )
15968                 exit(0);
15969         exit(1);
15970 }
15971 EOP
15972         set try
15973         if eval $compile && $to try.c; then
15974                 if $run ./try; then
15975                         echo "And its _base field acts std."
15976                         val="$define"
15977                 else
15978                         echo "But its _base field isn't std."
15979                 fi
15980         else
15981                 echo "However, it seems to be lacking the _base field."
15982         fi
15983         $rm -f try.c try
15984         ;;
15985 esac
15986 set d_stdiobase
15987 eval $setvar
15988
15989 $cat >&4 <<EOM
15990 Checking how to access stdio streams by file descriptor number...
15991 EOM
15992 case "$stdio_stream_array" in
15993 '')     $cat >try.c <<EOCP
15994 #include <stdio.h>
15995 int main() {
15996   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15997     printf("yes\n");
15998 }
15999 EOCP
16000         for s in _iob __iob __sF
16001         do
16002                 set try -DSTDIO_STREAM_ARRAY=$s
16003                 if eval $compile; then
16004                         case "`$run ./try`" in
16005                         yes)    stdio_stream_array=$s; break ;;
16006                         esac
16007                 fi
16008         done
16009         $rm -f try.* try$exe_ext
16010 esac
16011 case "$stdio_stream_array" in
16012 '')     $cat >&4 <<EOM
16013 I can't figure out how to access stdio streams by file descriptor number.
16014 EOM
16015         d_stdio_stream_array="$undef"
16016         ;;
16017 *)      $cat >&4 <<EOM
16018 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16019 EOM
16020         d_stdio_stream_array="$define"
16021         ;;
16022 esac
16023
16024 : see if strcoll exists
16025 set strcoll d_strcoll
16026 eval $inlibc
16027
16028 : check for structure copying
16029 echo " "
16030 echo "Checking to see if your C compiler can copy structs..." >&4
16031 $cat >try.c <<'EOCP'
16032 main()
16033 {
16034         struct blurfl {
16035                 int dyick;
16036         } foo, bar;
16037
16038         foo = bar;
16039 }
16040 EOCP
16041 if $cc -c try.c >/dev/null 2>&1 ; then
16042         val="$define"
16043         echo "Yup, it can."
16044 else
16045         val="$undef"
16046         echo "Nope, it can't."
16047 fi
16048 set d_strctcpy
16049 eval $setvar
16050 $rm -f try.*
16051
16052 : see if strerror and/or sys_errlist[] exist
16053 echo " "
16054 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16055     if set strerror val -f d_strerror; eval $csym; $val; then
16056                 echo 'strerror() found.' >&4
16057                 d_strerror="$define"
16058                 d_strerrm='strerror(e)'
16059                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16060                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16061                         d_syserrlst="$define"
16062                 else
16063                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16064                         d_syserrlst="$undef"
16065                 fi
16066     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16067                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16068                 echo 'strerror() found in string header.' >&4
16069                 d_strerror="$define"
16070                 d_strerrm='strerror(e)'
16071                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16072                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16073                                 d_syserrlst="$define"
16074                 else
16075                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16076                         d_syserrlst="$undef"
16077                 fi
16078     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16079                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16080                 d_strerror="$undef"
16081                 d_syserrlst="$define"
16082                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16083     else
16084                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16085                 d_strerror="$undef"
16086                 d_syserrlst="$undef"
16087                 d_strerrm='"unknown"'
16088     fi
16089 fi
16090
16091 : see if strerror_r exists
16092 set strerror_r d_strerror_r
16093 eval $inlibc
16094 case "$d_strerror_r" in
16095 "$define")
16096         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16097         case "$d_strerror_r_proto:$usethreads" in
16098         ":define")      d_strerror_r_proto=define
16099                 set d_strerror_r_proto strerror_r $hdrs
16100                 eval $hasproto ;;
16101         *)      ;;
16102         esac
16103         case "$d_strerror_r_proto" in
16104         define)
16105         case "$strerror_r_proto" in
16106         ''|0) try='int strerror_r(int, char*, size_t);'
16107         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16108         esac
16109         case "$strerror_r_proto" in
16110         ''|0) try='int strerror_r(int, char*, int);'
16111         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16112         esac
16113         case "$strerror_r_proto" in
16114         ''|0) try='char* strerror_r(int, char*, size_t);'
16115         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16116         esac
16117         case "$strerror_r_proto" in
16118         ''|0)   d_strerror_r=undef
16119                 strerror_r_proto=0
16120                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16121         * )     case "$strerror_r_proto" in
16122                 REENTRANT_PROTO*) ;;
16123                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16124                 esac
16125                 echo "Prototype: $try" ;;
16126         esac
16127         ;;
16128         *)      case "$usethreads" in
16129                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16130                 esac
16131                 d_strerror_r=undef
16132                 strerror_r_proto=0
16133                 ;;
16134         esac
16135         ;;
16136 *)      strerror_r_proto=0
16137         ;;
16138 esac
16139
16140 : see if strftime exists
16141 set strftime d_strftime
16142 eval $inlibc
16143
16144 : see if strtod exists
16145 set strtod d_strtod
16146 eval $inlibc
16147
16148 : see if strtol exists
16149 set strtol d_strtol
16150 eval $inlibc
16151
16152 : see if strtold exists
16153 set strtold d_strtold
16154 eval $inlibc
16155
16156 : see if strtoll exists
16157 set strtoll d_strtoll
16158 eval $inlibc
16159
16160 case "$d_longlong-$d_strtoll" in
16161 "$define-$define")
16162         $cat <<EOM
16163 Checking whether your strtoll() works okay...
16164 EOM
16165         $cat >try.c <<'EOCP'
16166 #include <errno.h>
16167 #ifdef __hpux
16168 #define strtoll __strtoll
16169 #endif
16170 #ifdef __EMX__
16171 #define strtoll _strtoll
16172 #endif
16173 #include <stdio.h>
16174 extern long long int strtoll(char *s, char **, int); 
16175 static int bad = 0;
16176 int check(char *s, long long ell, int een) {
16177         long long gll;
16178         errno = 0;
16179         gll = strtoll(s, 0, 10);
16180         if (!((gll == ell) && (errno == een)))
16181                 bad++;
16182 }
16183 int main() {
16184         check(" 1",                                      1LL, 0);
16185         check(" 0",                                      0LL, 0);
16186         check("-1",                                     -1LL, 0);
16187         check("-9223372036854775808", -9223372036854775808LL, 0);
16188         check("-9223372036854775808", -9223372036854775808LL, 0);
16189         check(" 9223372036854775807",  9223372036854775807LL, 0);
16190         check("-9223372036854775808", -9223372036854775808LL, 0);
16191         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16192         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16193         if (!bad)
16194                 printf("ok\n");
16195 }
16196 EOCP
16197         set try
16198         if eval $compile; then
16199                 yyy=`$run ./try`
16200                 case "$yyy" in
16201                 ok) echo "Your strtoll() seems to be working okay." ;;
16202                 *) cat <<EOM >&4
16203 Your strtoll() doesn't seem to be working okay.
16204 EOM
16205                    d_strtoll="$undef"
16206                    ;;
16207                 esac
16208         else
16209                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16210                 d_strtoll="$undef"
16211         fi
16212         ;;
16213 esac
16214
16215 : see if strtoq exists
16216 set strtoq d_strtoq
16217 eval $inlibc
16218
16219 : see if strtoul exists
16220 set strtoul d_strtoul
16221 eval $inlibc
16222
16223 case "$d_strtoul" in
16224 "$define")
16225         $cat <<EOM
16226 Checking whether your strtoul() works okay...
16227 EOM
16228         $cat >try.c <<'EOCP'
16229 #include <errno.h>
16230 #include <stdio.h>
16231 extern unsigned long int strtoul(char *s, char **, int); 
16232 static int bad = 0;
16233 void check(char *s, unsigned long eul, int een) {
16234         unsigned long gul;
16235         errno = 0;
16236         gul = strtoul(s, 0, 10);
16237         if (!((gul == eul) && (errno == een)))
16238                 bad++;
16239 }
16240 int main() {
16241         check(" 1", 1L, 0);
16242         check(" 0", 0L, 0);
16243 EOCP
16244         case "$longsize" in
16245         8)
16246             $cat >>try.c <<'EOCP'
16247         check("18446744073709551615", 18446744073709551615UL, 0);
16248         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16249 #if 0 /* strtoul() for /^-/ strings is undefined. */
16250         check("-1", 18446744073709551615UL, 0);
16251         check("-18446744073709551614", 2, 0);
16252         check("-18446744073709551615", 1, 0);
16253         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16254         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16255 #endif
16256 EOCP
16257                 ;;
16258         4)
16259                     $cat >>try.c <<'EOCP'
16260         check("4294967295", 4294967295UL, 0);
16261         check("4294967296", 4294967295UL, ERANGE);
16262 #if 0 /* strtoul() for /^-/ strings is undefined. */
16263         check("-1", 4294967295UL, 0);
16264         check("-4294967294", 2, 0);
16265         check("-4294967295", 1, 0);
16266         check("-4294967296", 4294967295UL, ERANGE);
16267         check("-4294967297", 4294967295UL, ERANGE);
16268 #endif
16269 EOCP
16270                 ;;
16271         *)
16272 : Should we write these tests to be more portable by sprintf-ing
16273 : ~0 and then manipulating that char string as input for strtol?
16274                 ;;
16275         esac
16276         $cat >>try.c <<'EOCP'
16277         if (!bad)
16278                 printf("ok\n");
16279         return 0;
16280 }
16281 EOCP
16282         set try
16283         if eval $compile; then
16284                 case "`$run ./try`" in
16285                 ok) echo "Your strtoul() seems to be working okay." ;;
16286                 *) cat <<EOM >&4
16287 Your strtoul() doesn't seem to be working okay.
16288 EOM
16289                    d_strtoul="$undef"
16290                    ;;
16291                 esac
16292         fi
16293         ;;
16294 esac
16295
16296 : see if strtoull exists
16297 set strtoull d_strtoull
16298 eval $inlibc
16299
16300 case "$d_longlong-$d_strtoull" in
16301 "$define-$define")
16302         $cat <<EOM
16303 Checking whether your strtoull() works okay...
16304 EOM
16305         $cat >try.c <<'EOCP'
16306 #include <errno.h>
16307 #ifdef __hpux
16308 #define strtoull __strtoull
16309 #endif
16310 #include <stdio.h>
16311 extern unsigned long long int strtoull(char *s, char **, int); 
16312 static int bad = 0;
16313 int check(char *s, long long eull, int een) {
16314         long long gull;
16315         errno = 0;
16316         gull = strtoull(s, 0, 10);
16317         if (!((gull == eull) && (errno == een)))
16318                 bad++;
16319 }
16320 int main() {
16321         check(" 1",                                        1LL, 0);
16322         check(" 0",                                        0LL, 0);
16323         check("18446744073709551615",  18446744073709551615ULL, 0);
16324         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16325 #if 0 /* strtoull() for /^-/ strings is undefined. */
16326         check("-1",                    18446744073709551615ULL, 0);
16327         check("-18446744073709551614",                     2LL, 0);
16328         check("-18446744073709551615",                     1LL, 0);
16329         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16330         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16331 #endif
16332         if (!bad)
16333                 printf("ok\n");
16334 }
16335 EOCP
16336         set try
16337         if eval $compile; then
16338                 case "`$run ./try`" in
16339                 ok) echo "Your strtoull() seems to be working okay." ;;
16340                 *) cat <<EOM >&4
16341 Your strtoull() doesn't seem to be working okay.
16342 EOM
16343                    d_strtoull="$undef"
16344                    ;;
16345                 esac
16346         fi
16347         ;;
16348 esac
16349
16350 : see if strtouq exists
16351 set strtouq d_strtouq
16352 eval $inlibc
16353
16354 case "$d_strtouq" in
16355 "$define")
16356         $cat <<EOM
16357 Checking whether your strtouq() works okay...
16358 EOM
16359         $cat >try.c <<'EOCP'
16360 #include <errno.h>
16361 #include <stdio.h>
16362 extern unsigned long long int strtouq(char *s, char **, int); 
16363 static int bad = 0;
16364 void check(char *s, unsigned long long eull, int een) {
16365         unsigned long long gull;
16366         errno = 0;
16367         gull = strtouq(s, 0, 10);
16368         if (!((gull == eull) && (errno == een)))
16369                 bad++;
16370 }
16371 int main() {
16372         check(" 1",                                        1LL, 0);
16373         check(" 0",                                        0LL, 0);
16374         check("18446744073709551615",  18446744073709551615ULL, 0);
16375         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16376 #if 0 /* strtouq() for /^-/ strings is undefined. */
16377         check("-1",                    18446744073709551615ULL, 0);
16378         check("-18446744073709551614",                     2LL, 0);
16379         check("-18446744073709551615",                     1LL, 0);
16380         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16381         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16382 #endif
16383         if (!bad)
16384                 printf("ok\n");
16385         return 0;
16386 }
16387 EOCP
16388         set try
16389         if eval $compile; then
16390                 case "`$run ./try`" in
16391                 ok) echo "Your strtouq() seems to be working okay." ;;
16392                 *) cat <<EOM >&4
16393 Your strtouq() doesn't seem to be working okay.
16394 EOM
16395                    d_strtouq="$undef"
16396                    ;;
16397                 esac
16398         fi
16399         ;;
16400 esac
16401
16402 : see if strxfrm exists
16403 set strxfrm d_strxfrm
16404 eval $inlibc
16405
16406 : see if symlink exists
16407 set symlink d_symlink
16408 eval $inlibc
16409
16410 : see if syscall exists
16411 set syscall d_syscall
16412 eval $inlibc
16413
16414 : see if prototype for syscall is available
16415 echo " "
16416 set d_syscallproto syscall $i_unistd unistd.h
16417 eval $hasproto
16418
16419 : see if sysconf exists
16420 set sysconf d_sysconf
16421 eval $inlibc
16422
16423 : see if system exists
16424 set system d_system
16425 eval $inlibc
16426
16427 : see if tcgetpgrp exists
16428 set tcgetpgrp d_tcgetpgrp
16429 eval $inlibc
16430
16431 : see if tcsetpgrp exists
16432 set tcsetpgrp d_tcsetpgrp
16433 eval $inlibc
16434
16435 : see if prototype for telldir is available
16436 echo " "
16437 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16438 eval $hasproto
16439
16440 : see if time exists
16441 echo " "
16442 if test "X$d_time" = X -o X"$timetype" = X; then
16443     if set time val -f d_time; eval $csym; $val; then
16444                 echo 'time() found.' >&4
16445                 val="$define"
16446                 rp="What is the type returned by time() on this system?"
16447                 set time_t timetype long stdio.h sys/types.h
16448                 eval $typedef_ask
16449     else
16450                 echo 'time() not found, hope that will do.' >&4
16451                 val="$undef"
16452                 timetype='int';
16453     fi
16454     set d_time
16455     eval $setvar
16456 fi
16457
16458 : see if this is a sys/times.h system
16459 set sys/times.h i_systimes
16460 eval $inhdr
16461
16462 : see if times exists
16463 echo " "
16464 if set times val -f d_times; eval $csym; $val; then
16465         echo 'times() found.' >&4
16466         d_times="$define"
16467         inc=''
16468         case "$i_systimes" in
16469         "$define") inc='sys/times.h';;
16470         esac
16471         rp="What is the type returned by times() on this system?"
16472         set clock_t clocktype long stdio.h sys/types.h $inc
16473         eval $typedef_ask
16474 else
16475         echo 'times() NOT found, hope that will do.' >&4
16476         d_times="$undef"
16477         clocktype='int'
16478 fi
16479
16480 : see if tmpnam_r exists
16481 set tmpnam_r d_tmpnam_r
16482 eval $inlibc
16483 case "$d_tmpnam_r" in
16484 "$define")
16485         hdrs="$i_systypes sys/types.h define stdio.h "
16486         case "$d_tmpnam_r_proto:$usethreads" in
16487         ":define")      d_tmpnam_r_proto=define
16488                 set d_tmpnam_r_proto tmpnam_r $hdrs
16489                 eval $hasproto ;;
16490         *)      ;;
16491         esac
16492         case "$d_tmpnam_r_proto" in
16493         define)
16494         case "$tmpnam_r_proto" in
16495         ''|0) try='char* tmpnam_r(char*);'
16496         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16497         esac
16498         case "$tmpnam_r_proto" in
16499         ''|0)   d_tmpnam_r=undef
16500                 tmpnam_r_proto=0
16501                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16502         * )     case "$tmpnam_r_proto" in
16503                 REENTRANT_PROTO*) ;;
16504                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16505                 esac
16506                 echo "Prototype: $try" ;;
16507         esac
16508         ;;
16509         *)      case "$usethreads" in
16510                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16511                 esac
16512                 d_tmpnam_r=undef
16513                 tmpnam_r_proto=0
16514                 ;;
16515         esac
16516         ;;
16517 *)      tmpnam_r_proto=0
16518         ;;
16519 esac
16520
16521 : see if truncate exists
16522 set truncate d_truncate
16523 eval $inlibc
16524
16525 : see if ttyname_r exists
16526 set ttyname_r d_ttyname_r
16527 eval $inlibc
16528 case "$d_ttyname_r" in
16529 "$define")
16530         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16531         case "$d_ttyname_r_proto:$usethreads" in
16532         ":define")      d_ttyname_r_proto=define
16533                 set d_ttyname_r_proto ttyname_r $hdrs
16534                 eval $hasproto ;;
16535         *)      ;;
16536         esac
16537         case "$d_ttyname_r_proto" in
16538         define)
16539         case "$ttyname_r_proto" in
16540         ''|0) try='int ttyname_r(int, char*, size_t);'
16541         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16542         esac
16543         case "$ttyname_r_proto" in
16544         ''|0) try='int ttyname_r(int, char*, int);'
16545         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16546         esac
16547         case "$ttyname_r_proto" in
16548         ''|0) try='char* ttyname_r(int, char*, int);'
16549         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16550         esac
16551         case "$ttyname_r_proto" in
16552         ''|0)   d_ttyname_r=undef
16553                 ttyname_r_proto=0
16554                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16555         * )     case "$ttyname_r_proto" in
16556                 REENTRANT_PROTO*) ;;
16557                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16558                 esac
16559                 echo "Prototype: $try" ;;
16560         esac
16561         ;;
16562         *)      case "$usethreads" in
16563                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16564                 esac
16565                 d_ttyname_r=undef
16566                 ttyname_r_proto=0
16567                 ;;
16568         esac
16569         ;;
16570 *)      ttyname_r_proto=0
16571         ;;
16572 esac
16573
16574 : see if tzname[] exists
16575 echo " "
16576 if set tzname val -a d_tzname; eval $csym; $val; then
16577         val="$define"
16578         echo 'tzname[] found.' >&4
16579 else
16580         val="$undef"
16581         echo 'tzname[] NOT found.' >&4
16582 fi
16583 set d_tzname
16584 eval $setvar
16585
16586 case "$osname" in
16587 next|rhapsody|darwin) multiarch="$define" ;;
16588 esac
16589 case "$multiarch" in
16590 ''|[nN]*) multiarch="$undef" ;;
16591 esac
16592
16593 : check for ordering of bytes in a UV
16594 echo " "
16595 case "$usecrosscompile$multiarch" in
16596 *$define*)
16597         $cat <<EOM
16598 You seem to be either cross-compiling or doing a multiarchitecture build,
16599 skipping the byteorder check.
16600
16601 EOM
16602         byteorder='ffff'
16603         ;;
16604 *)
16605         case "$byteorder" in
16606         '')
16607                 $cat <<'EOM'
16608 In the following, larger digits indicate more significance.  A big-endian
16609 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16610 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16611 machines may have weird orders like 3412.  A Cray will report 87654321,
16612 an Alpha will report 12345678. If the test program works the default is
16613 probably right.
16614 I'm now running the test program...
16615 EOM
16616                 $cat >try.c <<EOCP
16617 #include <stdio.h>
16618 #include <sys/types.h>
16619 typedef $uvtype UV;
16620 int main()
16621 {
16622         int i;
16623         union {
16624                 UV l;
16625                 char c[$uvsize];
16626         } u;
16627
16628         if ($uvsize > 4)
16629                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16630         else
16631                 u.l = (UV)0x04030201;
16632         for (i = 0; i < $uvsize; i++)
16633                 printf("%c", u.c[i]+'0');
16634         printf("\n");
16635         exit(0);
16636 }
16637 EOCP
16638                 xxx_prompt=y
16639                 set try
16640                 if eval $compile && ./try > /dev/null; then
16641                         dflt=`$run ./try`
16642                         case "$dflt" in
16643                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16644                                 echo "(The test program ran ok.)"
16645                                 echo "byteorder=$dflt"
16646                                 xxx_prompt=n
16647                         ;;
16648                         ????|????????) echo "(The test program ran ok.)" ;;
16649                         *) echo "(The test program didn't run right for some reason.)" ;;
16650                         esac
16651                 else
16652                         dflt='4321'
16653                         cat <<'EOM'
16654 (I can't seem to compile the test program.  Guessing big-endian...)
16655 EOM
16656                 fi
16657                 case "$xxx_prompt" in
16658                 y)
16659                         rp="What is the order of bytes in $uvtype?"
16660                         . ./myread
16661                         byteorder="$ans"
16662                         ;;
16663                 *)      byteorder=$dflt
16664                         ;;
16665                 esac
16666                 ;;
16667         esac
16668         $rm -f try.c try
16669         ;;
16670 esac
16671
16672
16673 $cat <<EOM
16674
16675 Checking to see whether you can access character data unalignedly...
16676 EOM
16677 case "$d_u32align" in
16678 '')   $cat >try.c <<EOCP
16679 #include <stdio.h>
16680 #define U32 $u32type
16681 #define BYTEORDER 0x$byteorder
16682 #define U8 $u8type
16683 #include <signal.h>
16684 #ifdef SIGBUS
16685 $signal_t bletch(s) int s; { exit(4); }
16686 #endif
16687 int main() {
16688 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16689     U8 buf[8];
16690     U32 *up;
16691     int i;
16692
16693     if (sizeof(U32) != 4) {
16694         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16695         exit(1);
16696     }
16697
16698     fflush(stdout);
16699
16700 #ifdef SIGBUS
16701     signal(SIGBUS, bletch);
16702 #endif
16703
16704     buf[0] = 0;
16705     buf[1] = 0;
16706     buf[2] = 0;
16707     buf[3] = 1;
16708     buf[5] = 0;
16709     buf[6] = 0;
16710     buf[7] = 0;
16711     buf[8] = 1;
16712
16713     for (i = 0; i < 4; i++) {
16714         up = (U32*)(buf + i);
16715         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16716                (*up == 1 << (8*(3-i)))  /* little-endian */
16717               )
16718            )
16719         {
16720             printf("read failed (%x)\n", *up);
16721             exit(2);
16722         }
16723     }
16724
16725     /* write test */
16726     for (i = 0; i < 4; i++) {
16727         up = (U32*)(buf + i);
16728         *up = 0xBeef;
16729         if (*up != 0xBeef) {
16730             printf("write failed (%x)\n", *up);
16731             exit(3);
16732         }
16733     }
16734
16735     exit(0);
16736 #else
16737     printf("1\n");
16738     exit(1);
16739 #endif
16740     return 0;
16741 }
16742 EOCP
16743 set try
16744 if eval $compile_ok; then
16745         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16746         $run ./try 2>&1 >/dev/null
16747         case "$?" in
16748         0)      cat >&4 <<EOM
16749 You can access character data pretty unalignedly.
16750 EOM
16751                 d_u32align="$undef"
16752                 ;;
16753         *)      cat >&4 <<EOM
16754 It seems that you must access character data in an aligned manner.
16755 EOM
16756                 d_u32align="$define"
16757                 ;;
16758         esac
16759 else
16760         rp='Can you access character data at unaligned addresses?'
16761         dflt='n'
16762         . ./myread
16763         case "$ans" in
16764         [yY]*)  d_u32align="$undef"  ;;
16765         *)      d_u32align="$define" ;;
16766         esac
16767 fi
16768 $rm -f core core.try.* try.core
16769 ;;
16770 esac
16771
16772 : see if ualarm exists
16773 set ualarm d_ualarm
16774 eval $inlibc
16775
16776 : see if umask exists
16777 set umask d_umask
16778 eval $inlibc
16779
16780 : see if unordered exists
16781 set unordered d_unordered
16782 eval $inlibc
16783
16784 : see if usleep exists
16785 set usleep d_usleep
16786 eval $inlibc
16787
16788 : see if prototype for usleep is available
16789 echo " "
16790 set d_usleepproto usleep $i_unistd unistd.h
16791 eval $hasproto
16792
16793 : see if ustat exists
16794 set ustat d_ustat
16795 eval $inlibc
16796
16797 : backward compatibility for d_hvfork
16798 if test X$d_hvfork != X; then
16799         d_vfork="$d_hvfork"
16800         d_hvfork=''
16801 fi
16802 : see if there is a vfork
16803 val=''
16804 set vfork val
16805 eval $inlibc
16806
16807 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16808 : perl on Solaris 2.x, and probably elsewhere.
16809 case "$val" in
16810 $define)
16811         echo " "
16812         case "$usevfork" in
16813         false) dflt='n';;
16814         *) dflt='y';;
16815         esac
16816         cat <<'EOM'
16817  
16818 Perl can only use a vfork() that doesn't suffer from strict
16819 restrictions on calling functions or modifying global data in
16820 the child.  For example, glibc-2.1 contains such a vfork()
16821 that is unsuitable.  If your system provides a proper fork()
16822 call, chances are that you do NOT want perl to use vfork().
16823
16824 EOM
16825         rp="Do you still want to use vfork()?"
16826         . ./myread
16827         case "$ans" in
16828         y|Y) ;;
16829         *)
16830                 echo "Ok, we won't use vfork()."
16831                 val="$undef"
16832                 ;;
16833         esac
16834         ;;
16835 esac
16836 set d_vfork
16837 eval $setvar
16838 case "$d_vfork" in
16839 $define) usevfork='true';;
16840 *) usevfork='false';;
16841 esac
16842
16843 : see if closedir exists
16844 set closedir d_closedir
16845 eval $inlibc
16846
16847 case "$d_closedir" in
16848 "$define")
16849         echo " "
16850         echo "Checking whether closedir() returns a status..." >&4
16851         cat > try.c <<EOM
16852 #$i_dirent I_DIRENT             /**/
16853 #$i_sysdir I_SYS_DIR            /**/
16854 #$i_sysndir I_SYS_NDIR          /**/
16855 #$i_systypes I_SYS_TYPES        /**/
16856
16857 #if defined(I_SYS_TYPES)
16858 #include <sys/types.h>
16859 #endif
16860 #if defined(I_DIRENT)
16861 #include <dirent.h>
16862 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16863 #include <sys/dir.h>
16864 #endif
16865 #else
16866 #ifdef I_SYS_NDIR
16867 #include <sys/ndir.h>
16868 #else
16869 #ifdef I_SYS_DIR
16870 #ifdef hp9000s500
16871 #include <ndir.h>       /* may be wrong in the future */
16872 #else
16873 #include <sys/dir.h>
16874 #endif
16875 #endif
16876 #endif
16877 #endif 
16878 int main() { return closedir(opendir(".")); }
16879 EOM
16880         set try
16881         if eval $compile_ok; then
16882                 if $run ./try > /dev/null 2>&1 ; then
16883                         echo "Yes, it does."
16884                         val="$undef"
16885                 else
16886                         echo "No, it doesn't."
16887                         val="$define"
16888                 fi
16889         else
16890                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16891                 val="$define"
16892         fi
16893         ;;
16894 *)
16895         val="$undef";
16896         ;;
16897 esac
16898 set d_void_closedir
16899 eval $setvar
16900 $rm -f try try.*
16901 : see if there is a wait4
16902 set wait4 d_wait4
16903 eval $inlibc
16904
16905 : see if waitpid exists
16906 set waitpid d_waitpid
16907 eval $inlibc
16908
16909 : see if wcstombs exists
16910 set wcstombs d_wcstombs
16911 eval $inlibc
16912
16913 : see if wctomb exists
16914 set wctomb d_wctomb
16915 eval $inlibc
16916
16917 : see if writev exists
16918 set writev d_writev
16919 eval $inlibc
16920
16921 : preserve RCS keywords in files with variable substitution, grrr
16922 Date='$Date'
16923 Id='$Id'
16924 Log='$Log'
16925 RCSfile='$RCSfile'
16926 Revision='$Revision'
16927
16928 : check for alignment requirements
16929 echo " "
16930 case "$usecrosscompile$multiarch" in
16931 *$define*)
16932         $cat <<EOM
16933 You seem to be either cross-compiling or doing a multiarchitecture build,
16934 skipping the memory alignment check.
16935
16936 EOM
16937         case "$alignbytes" in
16938         '') alignbytes=8 ;;
16939         esac
16940         ;;
16941 *)
16942         case "$alignbytes" in
16943         '') echo "Checking alignment constraints..." >&4
16944                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16945                         $cat >try.c <<'EOCP'
16946 typedef long double NV;
16947 EOCP
16948                 else
16949                         $cat >try.c <<'EOCP'
16950 typedef double NV;
16951 EOCP
16952                 fi
16953                 $cat >>try.c <<'EOCP'
16954 #include <stdio.h>
16955 struct foobar {
16956         char foo;
16957         NV bar;
16958 } try_algn;
16959 int main()
16960 {
16961     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16962     return(0);
16963 }
16964 EOCP
16965                 set try
16966                 if eval $compile_ok; then
16967                         dflt=`$run ./try`
16968                 else
16969                         dflt='8'
16970                         echo "(I can't seem to compile the test program...)"
16971                 fi
16972                 ;;
16973         *) dflt="$alignbytes"
16974                 ;;
16975         esac
16976         rp="Doubles must be aligned on a how-many-byte boundary?"
16977         . ./myread
16978         alignbytes="$ans"
16979         $rm -f try.c try
16980         ;;
16981 esac
16982
16983
16984 : set the base revision
16985 baserev=5.0
16986
16987 : how do we catenate cpp tokens here?
16988 echo " "
16989 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16990 $cat >cpp_stuff.c <<'EOCP'
16991 #define RCAT(a,b)a/**/b
16992 #define ACAT(a,b)a ## b
16993 RCAT(Rei,ser)
16994 ACAT(Cir,cus)
16995 EOCP
16996 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16997 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16998         echo "Oh!  Smells like ANSI's been here." >&4
16999         echo "We can catify or stringify, separately or together!"
17000         cpp_stuff=42
17001 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17002         echo "Ah, yes!  The good old days!" >&4
17003         echo "However, in the good old days we don't know how to stringify and"
17004         echo "catify at the same time."
17005         cpp_stuff=1
17006 else
17007         $cat >&4 <<EOM
17008 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
17009 to have to edit the values of CAT[2-5] in config.h...
17010 EOM
17011         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17012 fi
17013 $rm -f cpp_stuff.*
17014
17015 : see if this is a db.h system
17016 set db.h i_db
17017 eval $inhdr
17018
17019 case "$i_db" in
17020 $define)
17021         : Check db version.
17022         echo " "
17023         echo "Checking Berkeley DB version ..." >&4
17024         $cat >try.c <<EOCP
17025 #$d_const HASCONST
17026 #ifndef HASCONST
17027 #define const
17028 #endif
17029 #include <sys/types.h>
17030 #include <stdio.h>
17031 #include <db.h>
17032 int main(int argc, char *argv[])
17033 {
17034 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17035     int Major, Minor, Patch ;
17036     unsigned long Version ;
17037     (void)db_version(&Major, &Minor, &Patch) ;
17038     if (argc == 2) {
17039         printf("%d %d %d %d %d %d\n",
17040                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17041                Major, Minor, Patch);
17042         exit(0);
17043     }
17044     printf("You have Berkeley DB Version 2 or greater.\n");
17045
17046     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17047                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17048     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17049                 Major, Minor, Patch) ;
17050
17051     /* check that db.h & libdb are compatible */
17052     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17053         printf("db.h and libdb are incompatible.\n") ;
17054         exit(3);        
17055     }
17056
17057     printf("db.h and libdb are compatible.\n") ;
17058
17059     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17060                 + DB_VERSION_PATCH ;
17061
17062     /* needs to be >= 2.3.4 */
17063     if (Version < 2003004) {
17064     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17065         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17066         exit(2);        
17067     }
17068
17069     exit(0);
17070 #else
17071 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17072     if (argc == 2) {
17073         printf("1 0 0\n");
17074         exit(0);
17075     }
17076     printf("You have Berkeley DB Version 1.\n");
17077     exit(0);    /* DB version < 2: the coast is clear. */
17078 #else
17079     exit(1);    /* <db.h> not Berkeley DB? */
17080 #endif
17081 #endif
17082 }
17083 EOCP
17084         set try
17085         if eval $compile_ok && $run ./try; then
17086                 echo 'Looks OK.' >&4
17087                 set `$run ./try 1`
17088                 db_version_major=$1
17089                 db_version_minor=$2
17090                 db_version_patch=$3
17091         else
17092                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17093                 i_db=$undef
17094                 case " $libs " in
17095                 *"-ldb "*)
17096                         : Remove db from list of libraries to use
17097                         echo "Removing unusable -ldb from library list" >&4
17098                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17099                         shift
17100                         libs="$*"
17101                         echo "libs = $libs" >&4
17102                         ;;
17103                 esac
17104         fi
17105         $rm -f try.*
17106         ;;
17107 esac
17108
17109 case "$i_db" in
17110 define)
17111         : Check the return type needed for hash 
17112         echo " "
17113         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17114         $cat >try.c <<EOCP
17115 #$d_const HASCONST
17116 #ifndef HASCONST
17117 #define const
17118 #endif
17119 #include <sys/types.h>
17120 #include <db.h>
17121
17122 #ifndef DB_VERSION_MAJOR
17123 u_int32_t hash_cb (ptr, size)
17124 const void *ptr;
17125 size_t size;
17126 {
17127 }
17128 HASHINFO info;
17129 int main()
17130 {
17131         info.hash = hash_cb;
17132 }
17133 #endif
17134 EOCP
17135         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17136                 if $contains warning try.out >>/dev/null 2>&1 ; then
17137                         db_hashtype='int'
17138                 else
17139                         db_hashtype='u_int32_t'
17140                 fi
17141         else
17142                 : XXX Maybe we should just give up here.
17143                 db_hashtype=u_int32_t
17144                 $cat try.out >&4
17145                 echo "Help:  I can't seem to compile the db test program." >&4
17146                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17147         fi
17148         $rm -f try.*
17149         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17150         ;;
17151 *)      db_hashtype=u_int32_t
17152         ;;
17153 esac
17154 case "$i_db" in
17155 define)
17156         : Check the return type needed for prefix 
17157         echo " "
17158         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17159         cat >try.c <<EOCP
17160 #$d_const HASCONST
17161 #ifndef HASCONST
17162 #define const
17163 #endif
17164 #include <sys/types.h>
17165 #include <db.h>
17166
17167 #ifndef DB_VERSION_MAJOR
17168 size_t prefix_cb (key1, key2)
17169 const DBT *key1;
17170 const DBT *key2;
17171 {
17172 }
17173 BTREEINFO info;
17174 int main()
17175 {
17176         info.prefix = prefix_cb;
17177 }
17178 #endif
17179 EOCP
17180         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17181                 if $contains warning try.out >>/dev/null 2>&1 ; then
17182                         db_prefixtype='int'
17183                 else
17184                         db_prefixtype='size_t'
17185                 fi
17186         else
17187                 db_prefixtype='size_t'
17188                 : XXX Maybe we should just give up here.
17189                 $cat try.out >&4
17190                 echo "Help:  I can't seem to compile the db test program." >&4
17191                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17192         fi
17193         $rm -f try.*
17194         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17195         ;;
17196 *)      db_prefixtype='size_t'
17197         ;;
17198 esac
17199
17200
17201 : How can we generate normalized random numbers ?
17202 echo " "
17203 echo "Looking for a random number function..." >&4
17204 case "$randfunc" in
17205 '')
17206         if set drand48 val -f; eval $csym; $val; then
17207                 dflt="drand48"
17208                 echo "Good, found drand48()." >&4
17209         elif set random val -f; eval $csym; $val; then
17210                 dflt="random"
17211                 echo "OK, found random()." >&4
17212         else
17213                 dflt="rand"
17214                 echo "Yick, looks like I have to use rand()." >&4
17215         fi
17216         echo " "
17217         ;;
17218 *)
17219         dflt="$randfunc"
17220         ;;
17221 esac
17222 cont=true
17223
17224 case "$ccflags" in
17225 *-Dmy_rand=*|*-Dmy_srand=*)
17226         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17227         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17228         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17229         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17230         ;;
17231 esac
17232
17233 while $test "$cont"; do
17234         rp="Use which function to generate random numbers?"
17235         . ./myread
17236         if $test "$ans" = "$dflt"; then
17237                 : null
17238         else
17239                 randbits=''
17240         fi
17241         randfunc="$ans"
17242         if set $ans val -f; eval $csym; $val; then
17243                 cont=''
17244         else
17245                 dflt=y
17246                 rp="I cannot find function $ans. Use that name anyway?"
17247                 . ./myread
17248                 dflt=rand
17249                 case "$ans" in
17250                         [yY]*) cont='';;
17251                 esac
17252         fi
17253         case "$cont" in
17254         '')
17255                 case "$randfunc" in
17256                 drand48)
17257                         drand01="drand48()"
17258                         seedfunc="srand48"
17259                         randbits=48
17260                         randseedtype=long
17261                         ;;
17262                 rand|random)
17263                         case "$randbits" in
17264                         '')
17265 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17266                                 $cat >try.c <<EOCP
17267 #$i_unistd I_UNISTD
17268 #$i_stdlib I_STDLIB
17269 #include <stdio.h>
17270 #ifdef I_UNISTD
17271 #  include <unistd.h>
17272 #endif
17273 #ifdef I_STDLIB
17274 #  include <stdlib.h>
17275 #endif
17276 int main()
17277 {
17278         register int i;
17279         register unsigned long tmp;
17280         register unsigned long max = 0L;
17281
17282         for (i = 1000; i; i--) {
17283                 tmp = (unsigned long) $randfunc();
17284                 if (tmp > max) max = tmp;
17285         }
17286         for (i = 0; max; i++)
17287                 max /= 2;
17288         printf("%d\n",i);
17289 }
17290 EOCP
17291                                 set try
17292                                 if eval $compile_ok; then
17293                                         dflt=`try`
17294                                 else
17295                                         dflt='?'
17296                                         echo "(I can't seem to compile the test program...)"
17297                                 fi
17298                                 ;;
17299                         *)
17300                                 dflt="$randbits"
17301                                 ;;
17302                         esac
17303                         rp="How many bits does your $randfunc() function produce?"
17304                         . ./myread
17305                         randbits="$ans"
17306                         $rm -f try.c try
17307                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17308                         seedfunc="s$randfunc"
17309                         randseedtype=unsigned
17310                         ;;
17311                 *)
17312                         dflt="31"
17313                         rp="How many bits does your $randfunc() function produce?"
17314                         . ./myread
17315                         randbits="$ans"
17316                         seedfunc="s$randfunc"
17317                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17318                         if set $seedfunc val -f; eval $csym; $val; then
17319                                 echo "(Using $seedfunc() to seed random generator)"
17320                         else
17321                                 echo "(Warning: no $seedfunc() to seed random generator)"
17322                                 seedfunc=rand
17323                         fi
17324                         randseedtype=unsigned
17325                         ;;
17326                 esac
17327                 ;;
17328         esac
17329 done
17330
17331 echo " "
17332 echo "Determining whether or not we are on an EBCDIC system..." >&4
17333 $cat >try.c <<'EOM'
17334 int main()
17335 {
17336   if ('M'==0xd4) return 0;
17337   return 1;
17338 }
17339 EOM
17340
17341 val=$undef
17342 set try
17343 if eval $compile_ok; then
17344         if $run ./try; then
17345                 echo "You seem to speak EBCDIC." >&4
17346                 val="$define"
17347         else
17348                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17349         fi
17350 else
17351         echo "I'm unable to compile the test program." >&4
17352         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17353 fi
17354 $rm -f try try.*
17355 set ebcdic
17356 eval $setvar
17357
17358 echo " "
17359 $cat >&4 <<EOM
17360 Checking how to flush all pending stdio output...
17361 EOM
17362 # I only know how to find the first 32 possibly open files on SunOS.
17363 # See also hints/sunos_4_1.sh and util.c  --AD
17364 case "$osname" in
17365 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17366 esac
17367 $cat >>try.c <<EOCP
17368 #include <stdio.h>
17369 #$i_unistd I_UNISTD
17370 #ifdef I_UNISTD
17371 # include <unistd.h>
17372 #endif
17373 #$d_sysconf HAS_SYSCONF
17374 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17375 #ifdef HAS_STDIO_STREAM_ARRAY
17376 # define STDIO_STREAM_ARRAY $stdio_stream_array
17377 #endif
17378 int main() {
17379   FILE* p;
17380   unlink("try.out");
17381   p = fopen("try.out", "w");
17382 #ifdef TRY_FPUTC
17383   fputc('x', p);
17384 #else
17385 # ifdef TRY_FPRINTF
17386   fprintf(p, "x");
17387 # endif
17388 #endif
17389 #ifdef TRY_FFLUSH_NULL
17390   fflush(NULL);
17391 #endif
17392 #ifdef TRY_FFLUSH_ALL
17393   {
17394     long open_max = -1;
17395 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17396     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17397 # else
17398 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17399     open_max = sysconf(_SC_OPEN_MAX);
17400 #  else
17401 #   ifdef FOPEN_MAX
17402     open_max = FOPEN_MAX;
17403 #   else
17404 #    ifdef OPEN_MAX
17405     open_max = OPEN_MAX;
17406 #    else
17407 #     ifdef _NFILE
17408     open_max = _NFILE;
17409 #     endif
17410 #    endif
17411 #   endif
17412 #  endif
17413 # endif 
17414 # ifdef HAS_STDIO_STREAM_ARRAY
17415     if (open_max > 0) {
17416       long i;
17417       for (i = 0; i < open_max; i++)
17418             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17419                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17420                 STDIO_STREAM_ARRAY[i]._flag)
17421                 fflush(&STDIO_STREAM_ARRAY[i]);
17422     }   
17423   }
17424 # endif
17425 #endif
17426   _exit(42);
17427 }
17428 EOCP
17429 : first we have to find out how _not_ to flush
17430 $to try.c
17431 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17432     output=''
17433     set try -DTRY_FPUTC
17434     if eval $compile; then
17435             $run ./try 2>/dev/null
17436             code="$?"
17437             $from try.out
17438             if $test ! -s try.out -a "X$code" = X42; then
17439                 output=-DTRY_FPUTC
17440             fi
17441     fi
17442     case "$output" in
17443     '')
17444             set try -DTRY_FPRINTF
17445             if eval $compile; then
17446                     $run ./try 2>/dev/null
17447                     code="$?"
17448                     $from try.out
17449                     if $test ! -s try.out -a "X$code" = X42; then
17450                         output=-DTRY_FPRINTF
17451                     fi
17452             fi
17453         ;;
17454     esac
17455 fi
17456 : check for fflush NULL behaviour
17457 case "$fflushNULL" in
17458 '')     set try -DTRY_FFLUSH_NULL $output
17459         if eval $compile; then
17460                 $run ./try 2>/dev/null
17461                 code="$?"
17462                 $from try.out
17463                 if $test -s try.out -a "X$code" = X42; then
17464                         fflushNULL="`$cat try.out`"
17465                 else
17466                         if $test "X$code" != X42; then
17467                                 $cat >&4 <<EOM
17468 (If this test failed, don't worry, we'll try another method shortly.)
17469 EOM
17470                         fi
17471                 fi
17472         fi
17473         $rm -f core try.core core.try.*
17474         case "$fflushNULL" in
17475         x)      $cat >&4 <<EOM
17476 Your fflush(NULL) works okay for output streams.
17477 Let's see if it clobbers input pipes...
17478 EOM
17479 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17480 # bug that improperly flushes the input end of pipes.  So we avoid the
17481 # autoflush on fork/system/exec support for now. :-(
17482 $cat >tryp.c <<EOCP
17483 #include <stdio.h>
17484 int
17485 main(int argc, char **argv)
17486 {
17487     char buf[1024];
17488     int i;
17489     char *bp = buf;
17490     while (1) {
17491         while ((i = getc(stdin)) != -1
17492                && (*bp++ = i) != '\n'
17493                && bp < &buf[1024])
17494         /* DO NOTHING */ ;
17495         *bp = '\0';
17496         fprintf(stdout, "%s", buf);
17497         fflush(NULL);
17498         if (i == -1)
17499             return 0;
17500         bp = buf;
17501     }
17502 }
17503 EOCP
17504                 fflushNULL="$define"
17505                 set tryp
17506                 if eval $compile; then
17507                     $rm -f tryp.out
17508                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17509                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17510                        $cat >&4 <<EOM
17511 fflush(NULL) seems to behave okay with input streams.
17512 EOM
17513                         fflushNULL="$define"
17514                     else
17515                         $cat >&4 <<EOM
17516 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17517 EOM
17518                         fflushNULL="$undef"
17519                     fi
17520                 fi
17521                 $rm -f core tryp.c tryp.core core.tryp.*
17522                 ;;
17523         '')     $cat >&4 <<EOM
17524 Your fflush(NULL) isn't working (contrary to ANSI C).
17525 EOM
17526                 fflushNULL="$undef"
17527                 ;;
17528         *)      $cat >&4 <<EOM
17529 Cannot figure out whether your fflush(NULL) works or not.
17530 I'm assuming it doesn't (contrary to ANSI C).
17531 EOM
17532                 fflushNULL="$undef"
17533                 ;;
17534         esac
17535         ;;
17536 $define|true|[yY]*)
17537         fflushNULL="$define"
17538         ;;
17539 *)
17540         fflushNULL="$undef"
17541         ;;
17542 esac
17543 : check explicit looping only if NULL did not work, and if the pipe
17544 : bug does not show up on an explicit flush too
17545 case "$fflushNULL" in
17546 "$undef")
17547         $cat >tryp.c <<EOCP
17548 #include <stdio.h>
17549 int
17550 main(int argc, char **argv)
17551 {
17552     char buf[1024];
17553     int i;
17554     char *bp = buf;
17555     while (1) {
17556         while ((i = getc(stdin)) != -1
17557                && (*bp++ = i) != '\n'
17558                && bp < &buf[1024])
17559         /* DO NOTHING */ ;
17560         *bp = '\0';
17561         fprintf(stdout, "%s", buf);
17562         fflush(stdin);
17563         if (i == -1)
17564             return 0;
17565         bp = buf;
17566     }
17567 }
17568 EOCP
17569         set tryp
17570         if eval $compile; then
17571             $rm -f tryp.out
17572             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17573             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17574                $cat >&4 <<EOM
17575 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17576 EOM
17577                 : now check for fflushall behaviour
17578                 case "$fflushall" in
17579                 '')     set try -DTRY_FFLUSH_ALL $output
17580                         if eval $compile; then
17581                                 $cat >&4 <<EOM
17582 (Now testing the other method--but note that this also may fail.)
17583 EOM
17584                                 $run ./try 2>/dev/null
17585                                 code=$?
17586                                 $from try.out
17587                                 if $test -s try.out -a "X$code" = X42; then
17588                                         fflushall="`$cat try.out`"
17589                                 fi
17590                         fi
17591                         $rm -f core try.core core.try.*
17592                         case "$fflushall" in
17593                         x)      $cat >&4 <<EOM
17594 Whew. Flushing explicitly all the stdio streams works.
17595 EOM
17596                                 fflushall="$define"
17597                                 ;;
17598                         '')     $cat >&4 <<EOM
17599 Sigh. Flushing explicitly all the stdio streams doesn't work.
17600 EOM
17601                                 fflushall="$undef"
17602                                 ;;
17603                         *)      $cat >&4 <<EOM
17604 Cannot figure out whether flushing stdio streams explicitly works or not.
17605 I'm assuming it doesn't.
17606 EOM
17607                                 fflushall="$undef"
17608                                 ;;
17609                         esac
17610                         ;;
17611                 "$define"|true|[yY]*)
17612                         fflushall="$define"
17613                         ;;
17614                 *)
17615                         fflushall="$undef"
17616                         ;;
17617                 esac
17618             else
17619                 $cat >&4 <<EOM
17620 All is futile.  Even fflush(stdin) clobbers input pipes!
17621 EOM
17622                 fflushall="$undef"
17623             fi
17624         else
17625             fflushall="$undef"
17626         fi
17627         $rm -f core tryp.c tryp.core core.tryp.*
17628         ;;
17629 *)      fflushall="$undef"
17630         ;;
17631 esac
17632
17633 case "$fflushNULL$fflushall" in
17634 undefundef)
17635         $cat <<EOM
17636 OK, I give up.  I cannot figure out how to flush pending stdio output.
17637 We won't be flushing handles at all before fork/exec/popen.
17638 EOM
17639         ;;
17640 esac
17641 $rm -f try.* try$exe_ext
17642
17643 : Store the full pathname to the ar program for use in the C program
17644 : Respect a hint or command line value for full_ar.
17645 case "$full_ar" in
17646 '') full_ar=$ar ;;
17647 esac
17648
17649 : Store the full pathname to the sed program for use in the C program
17650 full_sed=$sed
17651
17652 : see what type gids are declared as in the kernel
17653 echo " "
17654 echo "Looking for the type for group ids returned by getgid()."
17655 set gid_t gidtype xxx stdio.h sys/types.h
17656 eval $typedef
17657 case "$gidtype" in
17658 xxx)
17659         xxx=`./findhdr sys/user.h`
17660         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17661         case $1 in
17662         unsigned) dflt="$1 $2" ;;
17663         *) dflt="$1" ;;
17664         esac
17665         ;;
17666 *) dflt="$gidtype";;
17667 esac
17668 case "$gidtype" in
17669 gid_t) echo "gid_t found." ;;
17670 *)      rp="What is the type for group ids returned by getgid()?"
17671         . ./myread
17672         gidtype="$ans"
17673         ;;
17674 esac
17675
17676 echo " "
17677 case "$gidtype" in
17678 *_t) zzz="$gidtype"     ;;
17679 *)   zzz="gid"          ;;
17680 esac
17681 echo "Checking the size of $zzz..." >&4 
17682 cat > try.c <<EOCP
17683 #include <sys/types.h>
17684 #include <stdio.h>
17685 int main() {
17686     printf("%d\n", (int)sizeof($gidtype));
17687     exit(0);
17688 }
17689 EOCP
17690 set try
17691 if eval $compile_ok; then
17692         yyy=`$run ./try`
17693         case "$yyy" in
17694         '')     gidsize=4
17695                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17696                 ;;
17697         *)      gidsize=$yyy
17698                 echo "Your $zzz is $gidsize bytes long."
17699                 ;;
17700         esac
17701 else
17702         gidsize=4
17703         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17704 fi
17705
17706
17707 echo " "
17708 case "$gidtype" in
17709 *_t) zzz="$gidtype"     ;;
17710 *)   zzz="gid"          ;;
17711 esac
17712 echo "Checking the sign of $zzz..." >&4 
17713 cat > try.c <<EOCP
17714 #include <sys/types.h>
17715 #include <stdio.h>
17716 int main() {
17717         $gidtype foo = -1;
17718         if (foo < 0)
17719                 printf("-1\n");
17720         else
17721                 printf("1\n");
17722 }
17723 EOCP
17724 set try
17725 if eval $compile; then
17726         yyy=`$run ./try`
17727         case "$yyy" in
17728         '')     gidsign=1
17729                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17730                 ;;
17731         *)      gidsign=$yyy
17732                 case "$gidsign" in
17733                  1) echo "Your $zzz is unsigned." ;;
17734                 -1) echo "Your $zzz is signed."   ;;
17735                 esac
17736                 ;;
17737         esac
17738 else
17739         gidsign=1
17740         echo "(I can't compile the test program--guessing unsigned.)" >&4
17741 fi
17742
17743
17744 echo " "
17745
17746 if $test X"$quadtype" != X; then
17747
17748 echo "Checking how to print 64-bit integers..." >&4
17749
17750 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17751         $cat >try.c <<'EOCP'
17752 #include <sys/types.h>
17753 #include <stdio.h>
17754 int main() {
17755   int q = 12345678901;
17756   printf("%ld\n", q);
17757 }
17758 EOCP
17759         set try
17760         if eval $compile; then
17761                 yyy=`$run ./try`
17762                 case "$yyy" in
17763                 12345678901)
17764                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17765                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17766                         echo "We will use %d."
17767                         ;;
17768                 esac
17769         fi
17770 fi
17771
17772 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17773         $cat >try.c <<'EOCP'
17774 #include <sys/types.h>
17775 #include <stdio.h>
17776 int main() {
17777   long q = 12345678901;
17778   printf("%ld\n", q);
17779 }
17780 EOCP
17781         set try
17782         if eval $compile; then
17783                 yyy=`$run ./try`
17784                 case "$yyy" in
17785                 12345678901)
17786                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17787                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17788                         echo "We will use %ld."
17789                         ;;
17790                 esac
17791         fi
17792 fi
17793
17794 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17795         $cat >try.c <<'EOCP'
17796 #include <sys/types.h>
17797 #include <inttypes.h>
17798 #include <stdio.h>
17799 int main() {
17800   int64_t q = 12345678901;
17801   printf("%" PRId64 "\n", q);
17802 }
17803 EOCP
17804         set try
17805         if eval $compile; then
17806                 yyy=`$run ./try`
17807                 case "$yyy" in
17808                 12345678901)
17809                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17810                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17811                         echo "We will use the C9X style."
17812                         ;;
17813                 esac
17814         fi
17815 fi
17816
17817 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17818         $cat >try.c <<EOCP
17819 #include <sys/types.h>
17820 #include <stdio.h>
17821 int main() {
17822   $quadtype q = 12345678901;
17823   printf("%Ld\n", q);
17824 }
17825 EOCP
17826         set try
17827         if eval $compile; then
17828                 yyy=`$run ./try`
17829                 case "$yyy" in
17830                 12345678901)
17831                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17832                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17833                         echo "We will use %Ld."
17834                         ;;
17835                 esac
17836         fi
17837 fi
17838
17839 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17840         $cat >try.c <<'EOCP'
17841 #include <sys/types.h>
17842 #include <stdio.h>
17843 int main() {
17844   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17845   printf("%lld\n", q);
17846 }
17847 EOCP
17848         set try
17849         if eval $compile; then
17850                 yyy=`$run ./try`
17851                 case "$yyy" in
17852                 12345678901)
17853                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17854                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17855                         echo "We will use the %lld style."
17856                         ;;
17857                 esac
17858         fi
17859 fi
17860
17861 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17862         $cat >try.c <<EOCP
17863 #include <sys/types.h>
17864 #include <stdio.h>
17865 int main() {
17866   $quadtype q = 12345678901;
17867   printf("%qd\n", q);
17868 }
17869 EOCP
17870         set try
17871         if eval $compile; then
17872                 yyy=`$run ./try`
17873                 case "$yyy" in
17874                 12345678901)
17875                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17876                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17877                         echo "We will use %qd."
17878                         ;;
17879                 esac
17880         fi
17881 fi
17882
17883 if $test X"$sPRId64" = X; then
17884         echo "Cannot figure out how to print 64-bit integers." >&4
17885 fi
17886
17887 $rm -f try try.*
17888
17889 fi
17890
17891 case "$sPRId64" in
17892 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17893         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17894         ;;
17895 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17896         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17897         ;;
17898 esac
17899
17900
17901 echo " "
17902 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17903
17904 if $test X"$ivsize" = X8; then
17905         ivdformat="$sPRId64"
17906         uvuformat="$sPRIu64"
17907         uvoformat="$sPRIo64"
17908         uvxformat="$sPRIx64"
17909         uvXUformat="$sPRIXU64"
17910 else
17911         if $test X"$ivsize" = X"$longsize"; then
17912                 ivdformat='"ld"'
17913                 uvuformat='"lu"'
17914                 uvoformat='"lo"'
17915                 uvxformat='"lx"'
17916                 uvXUformat='"lX"'
17917         else
17918                 if $test X"$ivsize" = X"$intsize"; then
17919                         ivdformat='"d"'
17920                         uvuformat='"u"'
17921                         uvoformat='"o"'
17922                         uvxformat='"x"'
17923                         uvXUformat='"X"'
17924                 else
17925                         : far out
17926                         if $test X"$ivsize" = X"$shortsize"; then
17927                                 ivdformat='"hd"'
17928                                 uvuformat='"hu"'
17929                                 uvoformat='"ho"'
17930                                 uvxformat='"hx"'
17931                                 uvXUformat='"hX"'
17932                         fi
17933                 fi
17934         fi
17935 fi
17936
17937 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17938         nveformat="$sPRIeldbl"
17939         nvfformat="$sPRIfldbl"
17940         nvgformat="$sPRIgldbl"
17941         nvEUformat="$sPRIEUldbl"
17942         nvFUformat="$sPRIFUldbl"
17943         nvGUformat="$sPRIGUldbl"
17944 else
17945         nveformat='"e"'
17946         nvfformat='"f"'
17947         nvgformat='"g"'
17948         nvEUformat='"E"'
17949         nvFUformat='"F"'
17950         nvGUformat='"G"'
17951 fi
17952
17953 case "$ivdformat" in
17954 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17955     exit 1
17956     ;;
17957 esac
17958
17959
17960 echo " "
17961 $echo "Checking the format string to be used for gids..." >&4
17962
17963 case "$gidsign" in
17964 -1)     if $test X"$gidsize" = X"$ivsize"; then
17965                 gidformat="$ivdformat"
17966         else
17967                 if $test X"$gidsize" = X"$longsize"; then
17968                         gidformat='"ld"'
17969                 else
17970                         if $test X"$gidsize" = X"$intsize"; then
17971                                 gidformat='"d"'
17972                         else
17973                                 if $test X"$gidsize" = X"$shortsize"; then
17974                                         gidformat='"hd"'
17975                                 fi
17976                         fi
17977                 fi
17978         fi
17979         ;;
17980 *)      if $test X"$gidsize" = X"$uvsize"; then
17981                 gidformat="$uvuformat"
17982         else
17983                 if $test X"$gidsize" = X"$longsize"; then
17984                         gidformat='"lu"'
17985                 else
17986                         if $test X"$gidsize" = X"$intsize"; then
17987                                 gidformat='"u"'
17988                         else
17989                                 if $test X"$gidsize" = X"$shortsize"; then
17990                                         gidformat='"hu"'
17991                                 fi
17992                         fi
17993                 fi
17994         fi
17995         ;;
17996 esac
17997
17998 : see if getgroups exists
17999 set getgroups d_getgrps
18000 eval $inlibc
18001
18002 : see if setgroups exists
18003 set setgroups d_setgrps
18004 eval $inlibc
18005
18006
18007 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18008 echo " "
18009 case "$d_getgrps$d_setgrps" in
18010 *define*)
18011         case "$groupstype" in
18012         '') dflt="$gidtype" ;;
18013         *)  dflt="$groupstype" ;;
18014         esac
18015         $cat <<EOM
18016 What type of pointer is the second argument to getgroups() and setgroups()?
18017 Usually this is the same as group ids, $gidtype, but not always.
18018
18019 EOM
18020         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18021         . ./myread
18022         groupstype="$ans"
18023         ;;
18024 *)  groupstype="$gidtype";;
18025 esac
18026
18027 echo " "
18028 echo "Checking if your $make program sets \$(MAKE)..." >&4
18029 case "$make_set_make" in
18030 '')
18031         $sed 's/^X //' > testmake.mak << 'EOF'
18032 Xall:
18033 X       @echo 'maketemp="$(MAKE)"'
18034 EOF
18035         case "`$make -f testmake.mak 2>/dev/null`" in
18036         *maketemp=*) make_set_make='#' ;;
18037         *)      make_set_make="MAKE=$make" ;;
18038         esac
18039         $rm -f testmake.mak
18040         ;;
18041 esac
18042 case "$make_set_make" in
18043 '#') echo "Yup, it does.";;
18044 *) echo "Nope, it doesn't.";;
18045 esac
18046
18047 : see what type is used for mode_t
18048 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18049 set mode_t modetype int stdio.h sys/types.h
18050 eval $typedef_ask
18051
18052 : see if stdarg is available
18053 echo " "
18054 if $test `./findhdr stdarg.h`; then
18055         echo "<stdarg.h> found." >&4
18056         valstd="$define"
18057 else
18058         echo "<stdarg.h> NOT found." >&4
18059         valstd="$undef"
18060 fi
18061
18062 : see if varags is available
18063 echo " "
18064 if $test `./findhdr varargs.h`; then
18065         echo "<varargs.h> found." >&4
18066 else
18067         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18068 fi
18069
18070 : set up the varargs testing programs
18071 $cat > varargs.c <<EOP
18072 #ifdef I_STDARG
18073 #include <stdarg.h>
18074 #endif
18075 #ifdef I_VARARGS
18076 #include <varargs.h>
18077 #endif
18078
18079 #ifdef I_STDARG
18080 int f(char *p, ...)
18081 #else
18082 int f(va_alist)
18083 va_dcl
18084 #endif
18085 {
18086         va_list ap;
18087 #ifndef I_STDARG
18088         char *p;
18089 #endif
18090 #ifdef I_STDARG
18091         va_start(ap,p);
18092 #else
18093         va_start(ap);
18094         p = va_arg(ap, char *);
18095 #endif
18096         va_end(ap);
18097 }
18098 EOP
18099 $cat > varargs <<EOP
18100 $startsh
18101 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18102         echo "true"
18103 else
18104         echo "false"
18105 fi
18106 $rm -f varargs$_o
18107 EOP
18108 chmod +x varargs
18109
18110 : now check which varargs header should be included
18111 echo " "
18112 i_varhdr=''
18113 case "$valstd" in
18114 "$define")
18115         if `./varargs I_STDARG`; then
18116                 val='stdarg.h'
18117         elif `./varargs I_VARARGS`; then
18118                 val='varargs.h'
18119         fi
18120         ;;
18121 *)
18122         if `./varargs I_VARARGS`; then
18123                 val='varargs.h'
18124         fi
18125         ;;
18126 esac
18127 case "$val" in
18128 '')
18129 echo "I could not find the definition for va_dcl... You have problems..." >&4
18130         val="$undef"; set i_stdarg; eval $setvar
18131         val="$undef"; set i_varargs; eval $setvar
18132         ;;
18133 *) 
18134         set i_varhdr
18135         eval $setvar
18136         case "$i_varhdr" in
18137         stdarg.h)
18138                 val="$define"; set i_stdarg; eval $setvar
18139                 val="$undef"; set i_varargs; eval $setvar
18140                 ;;
18141         varargs.h)
18142                 val="$undef"; set i_stdarg; eval $setvar
18143                 val="$define"; set i_varargs; eval $setvar
18144                 ;;
18145         esac
18146         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18147 esac
18148 $rm -f varargs*
18149
18150 : see if we need va_copy
18151 echo " "
18152 case "$i_stdarg" in
18153 "$define")
18154         $cat >try.c <<EOCP
18155 #include <stdarg.h>
18156 #include <stdio.h>
18157 #$i_stdlib I_STDLIB
18158 #ifdef I_STDLIB
18159 #include <stdlib.h>
18160 #endif
18161 #include <signal.h>
18162
18163 int
18164 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18165 {
18166   return vfprintf(f, fmt, *valp);
18167 }
18168  
18169 int    
18170 myvfprintf(FILE *f, const  char *fmt, va_list val)
18171 {
18172   return ivfprintf(f, fmt, &val);
18173 }
18174       
18175 int
18176 myprintf(char *fmt, ...) 
18177 {
18178   va_list val;
18179   va_start(val, fmt);
18180   return myvfprintf(stdout, fmt, val); 
18181 }         
18182
18183 int
18184 main(int ac, char **av)
18185 {
18186   signal(SIGSEGV, exit);
18187
18188   myprintf("%s%cs all right, then\n", "that", '\'');                            
18189   exit(0);      
18190 }
18191 EOCP
18192         set try
18193         if eval $compile && $run ./try 2>&1 >/dev/null; then
18194                 case "`$run ./try`" in
18195                 "that's all right, then")
18196                         okay=yes
18197                         ;;
18198                 esac
18199         fi
18200         case "$okay" in
18201         yes)    echo "It seems that you don't need va_copy()." >&4
18202                 need_va_copy="$undef"
18203                 ;;
18204         *)      echo "It seems that va_copy() or similar will be needed." >&4
18205                 need_va_copy="$define"
18206                 ;;
18207         esac
18208         $rm -f try.* core core.* *.core *.core.*
18209         ;;
18210 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18211         ;;
18212 esac
18213
18214 : see what type is used for size_t
18215 rp="What is the type used for the length parameter for string functions?"
18216 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18217 eval $typedef_ask
18218
18219 : check for type of arguments to gethostbyaddr. 
18220 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18221         case "$d_gethbyaddr" in
18222         $define)
18223                 $cat <<EOM
18224
18225 Checking to see what type of arguments are accepted by gethostbyaddr().
18226 EOM
18227                 hdrs="$define sys/types.h
18228                         $d_socket sys/socket.h 
18229                         $i_niin netinet/in.h 
18230                         $i_netdb netdb.h
18231                         $i_unistd unistd.h"
18232                 : The first arg can 'char *' or 'void *'
18233                 : The second arg is some of integral type
18234                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18235                         for yyy in size_t long int; do
18236                                 case "$netdb_host_type" in
18237                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18238                                         if ./protochk "$try" $hdrs; then
18239                                                 echo "Your system accepts $xxx for the first arg."
18240                                                 echo "...and $yyy for the second arg."
18241                                                 netdb_host_type="$xxx"
18242                                                 netdb_hlen_type="$yyy"
18243                                         fi
18244                                         ;;
18245                                 esac
18246                         done
18247                 done
18248                 : In case none of those worked, prompt the user.
18249                 case "$netdb_host_type" in
18250                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18251                         dflt='char *'
18252                         . ./myread
18253                         netdb_host_type=$ans
18254                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18255                         dflt="$sizetype"
18256                         . ./myread
18257                         netdb_hlen_type=$ans
18258                         ;;
18259                 esac
18260                 ;;
18261         *)      : no gethostbyaddr, so pick harmless defaults
18262                 netdb_host_type='char *'
18263                 netdb_hlen_type="$sizetype"
18264                 ;;
18265         esac
18266         # Remove the "const" if needed. -- but then we'll have a 
18267         # prototype clash!
18268         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18269 fi
18270
18271 : check for type of argument to gethostbyname. 
18272 if test "X$netdb_name_type" = X ; then
18273         case "$d_gethbyname" in
18274         $define)
18275                 $cat <<EOM
18276
18277 Checking to see what type of argument is accepted by gethostbyname().
18278 EOM
18279                 hdrs="$define sys/types.h
18280                         $d_socket sys/socket.h 
18281                         $i_niin netinet/in.h 
18282                         $i_netdb netdb.h
18283                         $i_unistd unistd.h"
18284                 for xxx in "const char *" "char *"; do
18285                         case "$netdb_name_type" in
18286                         '')     try="extern struct hostent *gethostbyname($xxx);"
18287                                 if ./protochk "$try" $hdrs; then
18288                                         echo "Your system accepts $xxx."
18289                                         netdb_name_type="$xxx"
18290                                 fi
18291                                 ;;
18292                         esac
18293                 done
18294                 : In case none of those worked, prompt the user.
18295                 case "$netdb_name_type" in
18296                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18297                         dflt='char *'
18298                         . ./myread
18299                         netdb_name_type=$ans
18300                         ;;
18301                 esac
18302                 ;;
18303         *)      : no gethostbyname, so pick harmless default
18304                 netdb_name_type='char *'
18305                 ;;
18306         esac
18307 fi
18308
18309 : check for type of 1st argument to getnetbyaddr. 
18310 if test "X$netdb_net_type" = X ; then
18311         case "$d_getnbyaddr" in
18312         $define)
18313                 $cat <<EOM
18314
18315 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18316 EOM
18317                 hdrs="$define sys/types.h
18318                         $d_socket sys/socket.h 
18319                         $i_niin netinet/in.h 
18320                         $i_netdb netdb.h
18321                         $i_unistd unistd.h"
18322                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18323                         case "$netdb_net_type" in
18324                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18325                                 if ./protochk "$try" $hdrs; then
18326                                         echo "Your system accepts $xxx."
18327                                         netdb_net_type="$xxx"
18328                                 fi
18329                                 ;;
18330                         esac
18331                 done
18332                 : In case none of those worked, prompt the user.
18333                 case "$netdb_net_type" in
18334                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18335                         dflt='long'
18336                         . ./myread
18337                         netdb_net_type=$ans
18338                         ;;
18339                 esac
18340                 ;;
18341         *)      : no getnetbyaddr, so pick harmless default
18342                 netdb_net_type='long'
18343                 ;;
18344         esac
18345 fi
18346 : locate the preferred pager for this system
18347 fn=f/
18348 case "$pager" in
18349 '')
18350         dflt=''
18351         case "$pg" in
18352         /*) dflt=$pg;;
18353         [a-zA-Z]:/*) dflt=$pg;;
18354         esac
18355         case "$more" in
18356         /*) dflt=$more;;
18357         [a-zA-Z]:/*) dflt=$more;;
18358         esac
18359         case "$less" in
18360         /*) dflt=$less;;
18361         [a-zA-Z]:/*) dflt=$less;;
18362         esac
18363         case "$dflt" in
18364         '') dflt=/usr/ucb/more;;
18365         esac
18366         ;;
18367 *)      dflt="$pager"
18368         : Instruct ./getfile to trust the hinted or previous pager value,
18369         : even if it does not begin with a slash.  For example, on os2,
18370         : pager might be cmd /c more.  See comments in UU/getfile.
18371         fn="f/($pager)"
18372         ;;
18373 esac
18374 echo " "
18375 rp='What pager is used on your system?'
18376 . ./getfile
18377 pager="$ans"
18378
18379 : see what type pids are declared as in the kernel
18380 rp="What is the type of process ids on this system?"
18381 set pid_t pidtype int stdio.h sys/types.h
18382 eval $typedef_ask
18383
18384 : Find earliest binary compatible site_perl subdirectory perl can use.
18385 xs_apiversion=$version # The current site_perl version.
18386 : Find earliest pure perl site_perl subdirectory perl can use.
18387 : The versioned directories started at 5.005.
18388 pm_apiversion='5.005'
18389
18390 : see if ar generates random libraries by itself
18391 echo " "
18392 echo "Checking how to generate random libraries on your machine..." >&4
18393 echo 'int bar1() { return bar2(); }' > bar1.c
18394 echo 'int bar2() { return 2; }' > bar2.c
18395 $cat > foo.c <<'EOP'
18396 int main() { printf("%d\n", bar1()); exit(0); }
18397 EOP
18398 $cc $ccflags -c bar1.c >/dev/null 2>&1
18399 $cc $ccflags -c bar2.c >/dev/null 2>&1
18400 $cc $ccflags -c foo.c >/dev/null 2>&1
18401 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18402 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18403         $run ./foobar >/dev/null 2>&1; then
18404         echo "$ar appears to generate random libraries itself."
18405         orderlib=false
18406         ranlib=":"
18407 elif $ar ts bar$_a >/dev/null 2>&1 &&
18408         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18409         $run ./foobar >/dev/null 2>&1; then
18410                 echo "a table of contents needs to be added with '$ar ts'."
18411                 orderlib=false
18412                 ranlib="$ar ts"
18413 else
18414         case "$ranlib" in
18415         :) ranlib='';;
18416         '')
18417                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18418                 $test -f $ranlib || ranlib=''
18419                 ;;
18420         esac
18421         if $test -n "$ranlib"; then
18422                 echo "your system has '$ranlib'; we'll use that."
18423                 orderlib=false
18424         else
18425                 echo "your system doesn't seem to support random libraries"
18426                 echo "so we'll use lorder and tsort to order the libraries."
18427                 orderlib=true
18428                 ranlib=":"
18429         fi
18430 fi
18431 $rm -f foo* bar* 
18432
18433 : check for type of arguments to select. 
18434 case "$selecttype" in
18435 '') case "$d_select" in
18436         $define)
18437                 echo " "
18438                 $cat <<EOM
18439 Checking to see what type of arguments are accepted by select().
18440 EOM
18441                 hdrs="$define sys/types.h
18442                         $i_systime sys/time.h 
18443                         $i_sysselct sys/select.h
18444                         $d_socket sys/socket.h"
18445                 : The first arg can be int, unsigned, or size_t
18446                 : The last arg may or may not be 'const'
18447                 val=''
18448                 : void pointer has been seen but using that
18449                 : breaks the selectminbits test
18450                 for xxx in 'fd_set *' 'int *'; do
18451                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18452                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18453                                         case "$val" in
18454                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18455                                                 if ./protochk "$try" $hdrs; then
18456                                                         echo "Your system accepts $xxx."
18457                                                         val="$xxx"
18458                                                 fi
18459                                                 ;;
18460                                         esac
18461                                 done
18462                         done
18463                 done
18464                 case "$val" in
18465                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18466                         case "$d_fd_set" in
18467                                 $define) dflt="fd_set *" ;;
18468                                 *)              dflt="int *" ;;
18469                         esac
18470                         . ./myread
18471                         val=$ans
18472                         ;;
18473                 esac
18474                 selecttype="$val"
18475                 ;;
18476         *)      : no select, so pick a harmless default
18477                 selecttype='int *'
18478                 ;;
18479         esac
18480         ;;
18481 esac
18482
18483 : check for the select 'width'
18484 case "$selectminbits" in
18485 '') case "$d_select" in
18486         $define)
18487                 $cat <<EOM
18488
18489 Checking to see on how many bits at a time your select() operates...
18490 EOM
18491                 $cat >try.c <<EOCP
18492 #include <sys/types.h>
18493 #$i_time I_TIME
18494 #$i_systime I_SYS_TIME
18495 #$i_systimek I_SYS_TIME_KERNEL
18496 #ifdef I_TIME
18497 #   include <time.h>
18498 #endif
18499 #ifdef I_SYS_TIME
18500 #   ifdef I_SYS_TIME_KERNEL
18501 #       define KERNEL
18502 #   endif
18503 #   include <sys/time.h>
18504 #   ifdef I_SYS_TIME_KERNEL
18505 #       undef KERNEL
18506 #   endif
18507 #endif
18508 #$i_sysselct I_SYS_SELECT
18509 #ifdef I_SYS_SELECT
18510 #include <sys/select.h>
18511 #endif
18512 #$d_socket HAS_SOCKET
18513 #ifdef HAS_SOCKET
18514 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18515 #endif
18516 #include <stdio.h>
18517 $selecttype b;
18518 #define S sizeof(*(b))
18519 #define MINBITS 64
18520 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18521 #define NBITS  (NBYTES * 8)
18522 int main() {
18523     char s[NBYTES];
18524     struct timeval t;
18525     int i;
18526     FILE* fp;
18527     int fd;
18528
18529     fclose(stdin);
18530     fp = fopen("try.c", "r");
18531     if (fp == 0)
18532       exit(1);
18533     fd = fileno(fp);
18534     if (fd < 0)
18535       exit(2);
18536     b = ($selecttype)s;
18537     for (i = 0; i < NBITS; i++)
18538         FD_SET(i, b);
18539     t.tv_sec  = 0;
18540     t.tv_usec = 0;
18541     select(fd + 1, b, 0, 0, &t);
18542     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18543     printf("%d\n", i + 1);
18544     return 0;
18545 }
18546 EOCP
18547                 set try
18548                 if eval $compile_ok; then
18549                         selectminbits=`$run ./try`
18550                         case "$selectminbits" in
18551                         '')     cat >&4 <<EOM
18552 Cannot figure out on how many bits at a time your select() operates.
18553 I'll play safe and guess it is 32 bits.
18554 EOM
18555                                 selectminbits=32
18556                                 bits="32 bits"
18557                                 ;;
18558                         1)      bits="1 bit" ;;
18559                         *)      bits="$selectminbits bits" ;;
18560                         esac
18561                         echo "Your select() operates on $bits at a time." >&4
18562                 else
18563                         rp='What is the minimum number of bits your select() operates on?'
18564                         case "$byteorder" in
18565                         1234|12345678)  dflt=32 ;;
18566                         *)              dflt=1  ;;
18567                         esac
18568                         . ./myread
18569                         val=$ans
18570                         selectminbits="$val"
18571                 fi
18572                 $rm -f try.* try
18573                 ;;
18574         *)      : no select, so pick a harmless default
18575                 selectminbits='32'
18576                 ;;
18577         esac
18578         ;;
18579 esac
18580
18581 : Trace out the files included by signal.h, then look for SIGxxx names.
18582 : Remove SIGARRAYSIZE used by HPUX.
18583 : Remove SIGSTKSIZE used by Linux.
18584 : Remove SIGSTKSZ used by Posix.
18585 : Remove SIGTYP void lines used by OS2.
18586 : Some cpps, like os390, dont give the file name anywhere
18587 if [ "X$fieldn" = X ]; then
18588         : Just make some guesses.  We check them later.
18589         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18590 else
18591         xxx=`echo '#include <signal.h>' |
18592         $cppstdin $cppminus $cppflags 2>/dev/null |
18593         $grep '^[       ]*#.*include' | 
18594         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18595 fi
18596 : Check this list of files to be sure we have parsed the cpp output ok.
18597 : This will also avoid potentially non-existent files, such 
18598 : as ../foo/bar.h
18599 xxxfiles=''
18600 for xx in $xxx /dev/null ; do
18601         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18602 done
18603 : If we have found no files, at least try signal.h
18604 case "$xxxfiles" in
18605 '')     xxxfiles=`./findhdr signal.h` ;;
18606 esac
18607 xxx=`awk '
18608 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18609         print substr($2, 4, 20)
18610 }
18611 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18612         print substr($3, 4, 20)
18613 }' $xxxfiles`
18614 : Append some common names just in case the awk scan failed.
18615 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18616 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18617 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18618 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18619 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18620
18621 : generate a few handy files for later
18622 $cat > signal.c <<'EOCP'
18623 #include <sys/types.h>
18624 #include <signal.h>
18625 #include <stdio.h>
18626 int main() {
18627
18628 /* Strange style to avoid deeply-nested #if/#else/#endif */
18629 #ifndef NSIG
18630 #  ifdef _NSIG
18631 #    define NSIG (_NSIG)
18632 #  endif
18633 #endif
18634
18635 #ifndef NSIG
18636 #  ifdef SIGMAX
18637 #    define NSIG (SIGMAX+1)
18638 #  endif
18639 #endif
18640
18641 #ifndef NSIG
18642 #  ifdef SIG_MAX
18643 #    define NSIG (SIG_MAX+1)
18644 #  endif
18645 #endif
18646
18647 #ifndef NSIG
18648 #  ifdef MAXSIG
18649 #    define NSIG (MAXSIG+1)
18650 #  endif
18651 #endif
18652
18653 #ifndef NSIG
18654 #  ifdef MAX_SIG
18655 #    define NSIG (MAX_SIG+1)
18656 #  endif
18657 #endif
18658
18659 #ifndef NSIG
18660 #  ifdef SIGARRAYSIZE
18661 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18662 #  endif
18663 #endif
18664
18665 #ifndef NSIG
18666 #  ifdef _sys_nsig
18667 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18668 #  endif
18669 #endif
18670
18671 /* Default to some arbitrary number that's big enough to get most
18672    of the common signals.
18673 */
18674 #ifndef NSIG
18675 #    define NSIG 50
18676 #endif
18677
18678 printf("NSIG %d\n", NSIG);
18679
18680 #ifndef JUST_NSIG
18681
18682 EOCP
18683
18684 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18685 {
18686         printf "#ifdef SIG"; printf $1; printf "\n"
18687         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18688         printf $1; printf ");\n"
18689         printf "#endif\n"
18690 }
18691 END {
18692         printf "#endif /* JUST_NSIG */\n";
18693         printf "exit(0);\n}\n";
18694 }
18695 ' >>signal.c
18696 $cat >signal.awk <<'EOP'
18697 BEGIN { ndups = 0 }
18698 $1 ~ /^NSIG$/ { nsig = $2 }
18699 ($1 !~ /^NSIG$/) && (NF == 2) {
18700     if ($2 > maxsig) { maxsig = $2 }
18701     if (sig_name[$2]) {
18702         dup_name[ndups] = $1
18703         dup_num[ndups] = $2
18704         ndups++ 
18705     }
18706     else {
18707         sig_name[$2] = $1
18708         sig_num[$2] = $2
18709     }
18710 }
18711 END { 
18712     if (nsig == 0) {
18713         nsig = maxsig + 1
18714     }
18715     printf("NSIG %d\n", nsig);
18716     for (n = 1; n < nsig; n++) {
18717         if (sig_name[n]) {
18718             printf("%s %d\n", sig_name[n], sig_num[n])
18719         }
18720         else {
18721             printf("NUM%d %d\n", n, n) 
18722         }
18723     }
18724     for (n = 0; n < ndups; n++) {
18725         printf("%s %d\n", dup_name[n], dup_num[n])
18726     }
18727 }
18728 EOP
18729 $cat >signal_cmd <<EOS
18730 $startsh
18731 if $test -s signal.lst; then
18732     echo "Using your existing signal.lst file"
18733         exit 0
18734 fi
18735 xxx="$xxx"
18736 EOS
18737 $cat >>signal_cmd <<'EOS'
18738
18739 set signal
18740 if eval $compile_ok; then
18741         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18742 else
18743         echo "(I can't seem be able to compile the whole test program)" >&4
18744         echo "(I'll try it in little pieces.)" >&4
18745         set signal -DJUST_NSIG
18746         if eval $compile_ok; then
18747                 $run ./signal$_exe > signal.nsg
18748                 $cat signal.nsg
18749         else
18750                 echo "I can't seem to figure out how many signals you have." >&4
18751                 echo "Guessing 50." >&4
18752                 echo 'NSIG 50' > signal.nsg
18753         fi
18754         : Now look at all the signal names, one at a time.
18755         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18756                 $cat > signal.c <<EOCP
18757 #include <sys/types.h>
18758 #include <signal.h>
18759 #include <stdio.h>
18760 int main() {
18761 printf("$xx %d\n", SIG${xx});
18762 return 0;
18763 }
18764 EOCP
18765                 set signal
18766                 if eval $compile; then
18767                         echo "SIG${xx} found."
18768                         $run ./signal$_exe  >> signal.ls1
18769                 else
18770                         echo "SIG${xx} NOT found."
18771                 fi
18772         done
18773         if $test -s signal.ls1; then
18774                 $cat signal.nsg signal.ls1 |
18775                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18776         fi
18777
18778 fi
18779 if $test -s signal.lst; then
18780         :
18781 else
18782         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18783         echo 'kill -l' >signal
18784         set X `csh -f <signal`
18785         $rm -f signal
18786         shift
18787         case $# in
18788         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18789         esac
18790         echo $@ | $tr ' ' $trnl | \
18791             $awk '{ printf "%s %d\n", $1, ++s; }
18792                   END { printf "NSIG %d\n", ++s }' >signal.lst
18793 fi
18794 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18795 EOS
18796 chmod a+x signal_cmd
18797 $eunicefix signal_cmd
18798
18799 : generate list of signal names
18800 echo " "
18801 case "$sig_name_init" in
18802 '') doinit=yes ;;
18803 *)  case "$sig_num_init" in
18804     ''|*,*) doinit=yes ;;
18805     esac ;;
18806 esac
18807 case "$doinit" in
18808 yes)
18809         echo "Generating a list of signal names and numbers..." >&4
18810         . ./signal_cmd
18811         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18812         sig_name=`$awk 'BEGIN { printf "ZERO " }
18813                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18814         sig_num=`$awk  'BEGIN { printf "0 " }
18815                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18816         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18817                              !/^NSIG/   { printf "\"%s\", ", $1 }
18818                              END        { printf "0\n" }' signal.lst`
18819         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18820                              !/^NSIG/   { printf "%d, ", $2}
18821                              END        { printf "0\n"}' signal.lst`
18822         ;;
18823 esac
18824 echo "The following $sig_count signals are available:"
18825 echo " "
18826 echo $sig_name | $awk \
18827 'BEGIN { linelen = 0 }
18828 {
18829         for (i = 1; i <= NF; i++) {
18830                 name = "SIG" $i " "
18831                 linelen = linelen + length(name)
18832                 if (linelen > 70) {
18833                         printf "\n"
18834                         linelen = length(name)
18835                 }
18836                 printf "%s", name
18837         }
18838         printf "\n"
18839 }'
18840 sig_size=`echo $sig_name | awk '{print NF}'`
18841 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18842
18843 echo " "
18844 case "$sizetype" in
18845 *_t) zzz="$sizetype"    ;;
18846 *)   zzz="filesize"     ;;
18847 esac
18848 echo "Checking the size of $zzz..." >&4 
18849 cat > try.c <<EOCP
18850 #include <sys/types.h>
18851 #include <stdio.h>
18852 int main() {
18853     printf("%d\n", (int)sizeof($sizetype));
18854     exit(0);
18855 }
18856 EOCP
18857 set try
18858 if eval $compile_ok; then
18859         yyy=`$run ./try`
18860         case "$yyy" in
18861         '')     sizesize=4
18862                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18863                 ;;
18864         *)      sizesize=$yyy
18865                 echo "Your $zzz size is $sizesize bytes."
18866                 ;;
18867         esac
18868 else
18869         sizesize=4
18870         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18871 fi
18872
18873
18874 : check for socklen_t
18875 echo " "
18876 echo "Checking to see if you have socklen_t..." >&4
18877 $cat >try.c <<EOCP
18878 #include <sys/types.h>
18879 #$d_socket HAS_SOCKET
18880 #ifdef HAS_SOCKET
18881 #include <sys/socket.h>
18882 #endif
18883 int main() { socklen_t x = 16; }
18884 EOCP
18885 set try
18886 if eval $compile; then
18887         val="$define"
18888         echo "You have socklen_t."
18889 else
18890         val="$undef"
18891         echo "You do not have socklen_t."
18892         case "$sizetype" in
18893         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18894         esac
18895 fi
18896 $rm -f try try.*
18897 set d_socklen_t
18898 eval $setvar
18899
18900 : see if this is a socks.h system
18901 set socks.h i_socks
18902 eval $inhdr
18903
18904 : check for type of the size argument to socket calls
18905 case "$d_socket" in
18906 "$define")
18907         $cat <<EOM
18908
18909 Checking to see what type is the last argument of accept().
18910 EOM
18911         yyy=''
18912         case "$d_socklen_t" in
18913         "$define") yyy="$yyy socklen_t"
18914         esac
18915         yyy="$yyy $sizetype int long unsigned"
18916         for xxx in $yyy; do
18917                 case "$socksizetype" in
18918                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18919                         case "$usesocks" in
18920                         "$define")
18921                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18922                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18923                                         socksizetype="$xxx"
18924                                 fi
18925                                 ;;
18926                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18927                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18928                                         socksizetype="$xxx"
18929                                 fi
18930                                 ;;
18931                         esac
18932                         ;;
18933                 esac
18934         done
18935 : In case none of those worked, prompt the user.
18936         case "$socksizetype" in
18937         '')     rp='What is the type for socket address structure sizes?'
18938                 dflt='int'
18939                 . ./myread
18940                 socksizetype=$ans
18941                 ;;
18942         esac
18943         ;;
18944 *)      : no sockets, so pick relatively harmless default
18945         socksizetype='int'
18946         ;;
18947 esac
18948
18949 : see what type is used for signed size_t
18950 set ssize_t ssizetype int stdio.h sys/types.h
18951 eval $typedef
18952 dflt="$ssizetype"
18953 $cat > try.c <<EOM
18954 #include <stdio.h>
18955 #include <sys/types.h>
18956 #define Size_t $sizetype
18957 #define SSize_t $dflt
18958 int main()
18959 {
18960         if (sizeof(Size_t) == sizeof(SSize_t))
18961                 printf("$dflt\n");
18962         else if (sizeof(Size_t) == sizeof(int))
18963                 printf("int\n");
18964         else 
18965                 printf("long\n");
18966         exit(0);
18967 }
18968 EOM
18969 echo " "
18970 set try
18971 if eval $compile_ok && $run ./try > /dev/null; then
18972         ssizetype=`$run ./try`
18973         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18974 else
18975         $cat >&4 <<EOM
18976 Help! I can't compile and run the ssize_t test program: please enlighten me!
18977 (This is probably a misconfiguration in your system or libraries, and
18978 you really ought to fix it.  Still, I'll try anyway.)
18979
18980 I need a type that is the same size as $sizetype, but is guaranteed to
18981 be signed.  Common values are ssize_t, int and long.
18982
18983 EOM
18984         rp="What signed type is the same size as $sizetype?"
18985         . ./myread
18986         ssizetype="$ans"
18987 fi
18988 $rm -f try try.*
18989
18990 : see what type of char stdio uses.
18991 echo " "
18992 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18993 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18994         echo "Your stdio uses unsigned chars." >&4
18995         stdchar="unsigned char"
18996 else
18997         echo "Your stdio uses signed chars." >&4
18998         stdchar="char"
18999 fi
19000 $rm -f stdioh
19001
19002
19003
19004 : see what type uids are declared as in the kernel
19005 echo " "
19006 echo "Looking for the type for user ids returned by getuid()."
19007 set uid_t uidtype xxx stdio.h sys/types.h
19008 eval $typedef
19009 case "$uidtype" in
19010 xxx)
19011         xxx=`./findhdr sys/user.h`
19012         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19013         case $1 in
19014         unsigned) dflt="$1 $2" ;;
19015         *) dflt="$1" ;;
19016         esac
19017         ;;
19018 *) dflt="$uidtype";;
19019 esac
19020 case "$uidtype" in
19021 uid_t)  echo "uid_t found." ;;
19022 *)      rp="What is the type for user ids returned by getuid()?"
19023         . ./myread
19024         uidtype="$ans"
19025         ;;
19026 esac
19027
19028 echo " "
19029 case "$uidtype" in
19030 *_t) zzz="$uidtype"     ;;
19031 *)   zzz="uid"          ;;
19032 esac
19033 echo "Checking the size of $zzz..." >&4 
19034 cat > try.c <<EOCP
19035 #include <sys/types.h>
19036 #include <stdio.h>
19037 int main() {
19038     printf("%d\n", (int)sizeof($uidtype));
19039     exit(0);
19040 }
19041 EOCP
19042 set try
19043 if eval $compile_ok; then
19044         yyy=`$run ./try`
19045         case "$yyy" in
19046         '')     uidsize=4
19047                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19048                 ;;
19049         *)      uidsize=$yyy
19050                 echo "Your $zzz is $uidsize bytes long."
19051                 ;;
19052         esac
19053 else
19054         uidsize=4
19055         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19056 fi
19057
19058 echo " "
19059 case "$uidtype" in
19060 *_t) zzz="$uidtype"     ;;
19061 *)   zzz="uid"          ;;
19062 esac
19063 echo "Checking the sign of $zzz..." >&4
19064 cat > try.c <<EOCP
19065 #include <sys/types.h>
19066 #include <stdio.h>
19067 int main() {
19068         $uidtype foo = -1;
19069         if (foo < 0)
19070                 printf("-1\n");
19071         else
19072                 printf("1\n");
19073 }
19074 EOCP
19075 set try
19076 if eval $compile; then
19077         yyy=`$run ./try`
19078         case "$yyy" in
19079         '')     uidsign=1
19080                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19081                 ;;
19082         *)      uidsign=$yyy
19083                 case "$uidsign" in
19084                  1) echo "Your $zzz is unsigned." ;;
19085                 -1) echo "Your $zzz is signed."   ;;
19086                 esac
19087                 ;;
19088         esac
19089 else
19090         uidsign=1
19091         echo "(I can't compile the test program--guessing unsigned.)" >&4
19092 fi
19093
19094
19095
19096 echo " "
19097 $echo "Checking the format string to be used for uids..." >&4
19098
19099 case "$uidsign" in
19100 -1)     if $test X"$uidsize" = X"$ivsize"; then
19101                 uidformat="$ivdformat"
19102         else
19103                 if $test X"$uidsize" = X"$longsize"; then
19104                         uidformat='"ld"'
19105                 else
19106                         if $test X"$uidsize" = X"$intsize"; then
19107                                 uidformat='"d"'
19108                         else
19109                                 if $test X"$uidsize" = X"$shortsize"; then
19110                                         uidformat='"hd"'
19111                                 fi
19112                         fi
19113                 fi
19114         fi
19115         ;;
19116 *)      if $test X"$uidsize" = X"$uvsize"; then
19117                 uidformat="$uvuformat"
19118         else
19119                 if $test X"$uidsize" = X"$longsize"; then
19120                         uidformat='"lu"'
19121                 else
19122                         if $test X"$uidsize" = X"$intsize"; then
19123                                 uidformat='"u"'
19124                         else
19125                                 if $test X"$uidsize" = X"$shortsize"; then
19126                                         uidformat='"hu"'
19127                                 fi
19128                         fi
19129                 fi
19130         fi
19131         ;;
19132 esac
19133
19134 : determine compiler compiler
19135 case "$yacc" in
19136 '')
19137         dflt=yacc;;
19138 *)
19139         dflt="$yacc";;
19140 esac
19141 echo " "
19142 comp='yacc'
19143 if $test -f "$byacc$_exe"; then
19144         dflt="$byacc"
19145         comp="byacc or $comp"
19146 fi
19147 if $test -f "$bison$_exe"; then
19148         comp="$comp or bison -y"
19149 fi
19150 rp="Which compiler compiler ($comp) shall I use?"
19151 . ./myread
19152 yacc="$ans"
19153 case "$yacc" in
19154 *bis*)
19155         case "$yacc" in
19156         *-y*) ;;
19157         *)
19158                 yacc="$yacc -y"
19159                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19160                 ;;
19161         esac
19162         ;;
19163 esac
19164
19165 : see if this is a fp.h system
19166 set fp.h i_fp
19167 eval $inhdr
19168
19169 : see if this is a fp_class.h system
19170 set fp_class.h i_fp_class
19171 eval $inhdr
19172
19173 : see if this is a ieeefp.h system
19174 case "$i_ieeefp" in
19175 '' ) set ieeefp.h i_ieeefp
19176      eval $inhdr
19177      ;;
19178 esac
19179
19180 : see if this is a libutil.h system
19181 set libutil.h i_libutil
19182 eval $inhdr
19183
19184 : see if mach cthreads are available
19185 if test "X$usethreads" = "X$define"; then
19186         set mach/cthreads.h i_machcthr
19187         eval $inhdr
19188 else
19189         i_machcthr="$undef"
19190 fi
19191
19192
19193
19194 : see if this is a math.h system
19195 set math.h i_math
19196 eval $inhdr
19197
19198 : see if this is a mntent.h system
19199 set mntent.h i_mntent
19200 eval $inhdr
19201
19202 : see if ndbm.h is available
19203 set ndbm.h t_ndbm
19204 eval $inhdr
19205
19206 case "$t_ndbm" in
19207 $undef)
19208     # Some Linux distributions such as RedHat 7.1 put the
19209     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19210     if $test -f /usr/include/gdbm/ndbm.h; then
19211         echo '<gdbm/ndbm.h> found.'
19212         ccflags="$ccflags -I/usr/include/gdbm"
19213         cppflags="$cppflags -I/usr/include/gdbm"
19214         t_ndbm=$define
19215     fi
19216     ;;
19217 esac
19218
19219 case "$t_ndbm" in
19220 $define)
19221         : see if dbm_open exists
19222         set dbm_open d_dbm_open
19223         eval $inlibc
19224         case "$d_dbm_open" in
19225         $undef)
19226                 t_ndbm="$undef"
19227                 echo "We won't be including <ndbm.h>"
19228                 ;;
19229         esac
19230         ;;
19231 esac
19232 val="$t_ndbm"
19233 set i_ndbm
19234 eval $setvar
19235
19236 : see if net/errno.h is available
19237 val=''
19238 set net/errno.h val
19239 eval $inhdr
19240
19241 : Unfortunately, it causes problems on some systems.  Arrgh.
19242 case "$val" in
19243 $define)
19244         cat > try.c <<'EOM'
19245 #include <stdio.h>
19246 #include <errno.h>
19247 #include <net/errno.h>
19248 int func()
19249 {
19250         return ENOTSOCK;
19251 }
19252 EOM
19253         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19254                 echo "We'll be including <net/errno.h>." >&4
19255         else
19256                 echo "We won't be including <net/errno.h>." >&4
19257                 val="$undef"
19258         fi
19259         $rm -f try.* try
19260         ;;
19261 esac
19262 set i_neterrno
19263 eval $setvar
19264
19265 : see if netinet/tcp.h is available
19266 set netinet/tcp.h i_netinettcp
19267 eval $inhdr
19268
19269 : see if this is a poll.h system
19270 set poll.h i_poll
19271 eval $inhdr
19272
19273 : see if this is a prot.h system
19274 set prot.h i_prot
19275 eval $inhdr
19276
19277 echo " "
19278 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19279 $cat <<'EOSH' > Cppsym.know
19280 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19281 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19282 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19283 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19284 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19285 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19286 bull c cadmus clipper CMU COFF COMPILER_VERSION
19287 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19288 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19289 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19290 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19291 GLIBC GLIBC_MINOR
19292 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19293 H3050R H3050RX hbullx20 hcx host_mips
19294 hp200 hp300 hp700 HP700 hp800 hp9000
19295 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19296 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19297 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19298 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19299 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19300 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19301 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19302 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19303 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19304 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19305 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19306 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19307 MATH_HAS_NO_SIDE_EFFECTS
19308 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19309 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19310 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19311 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19312 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19313 NetBSD news1500 news1700 news1800 news1900 news3700
19314 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19315 ns32016 ns32332 ns32k nsc32000
19316 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19317 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19318 pc532 pdp11 PGC PIC plexus PORTAR posix
19319 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19320 POSIX_C_SOURCE POSIX_SOURCE POWER
19321 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19322 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19323 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19324 sony sony_news sonyrisc sparc sparclite spectrum
19325 stardent stdc STDC_EXT stratos sun sun3 sun386
19326 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19327 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19328 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19329 sysV68 sysV88 Tek4132 Tek4300 titan
19330 TM3200 TM5400 TM5600
19331 tower tower32 tower32_200 tower32_600 tower32_700
19332 tower32_800 tower32_850 tss
19333 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19334 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19335 unix UNIX95 UNIX99 unixpc unos
19336 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19337 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19338 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19339 USGr4 USGr4_2
19340 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19341 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19342 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19343 z8000
19344 EOSH
19345 # Maybe put other stuff here too.
19346 cat <<EOSH >>Cppsym.know
19347 $osname
19348 EOSH
19349 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19350 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19351 $cat Cppsym.know > Cppsym.c
19352 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19353 $rm -f Cppsym.a Cppsym.b Cppsym.c
19354 cat <<EOSH > Cppsym
19355 $startsh
19356 if $test \$# -gt 0; then
19357     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19358     if $test -s Cppsym.got; then
19359         $rm -f Cppsym.got
19360         exit 0
19361     fi
19362     $rm -f Cppsym.got
19363     exit 1
19364 else
19365     $tr " " "$trnl" | ./Cppsym.try
19366     exit 0
19367 fi
19368 EOSH
19369 chmod +x Cppsym
19370 $eunicefix Cppsym
19371 cat <<EOSH > Cppsym.try
19372 $startsh
19373 cat <<'EOCP' > try.c
19374 #include <stdio.h>
19375 int main() {
19376 EOCP
19377 $awk \\
19378 EOSH
19379 cat <<'EOSH' >> Cppsym.try
19380 'length($1) > 0 {
19381     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
19382     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
19383     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
19384     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
19385 }'       >> try.c
19386 echo 'return 0;}' >> try.c
19387 EOSH
19388 cat <<EOSH >> Cppsym.try
19389 ccflags="$ccflags"
19390 case "$osname-$gccversion" in
19391 irix-) ccflags="\$ccflags -woff 1178" ;;
19392 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19393 esac
19394 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19395 EOSH
19396 chmod +x Cppsym.try
19397 $eunicefix Cppsym.try
19398 ./Cppsym < Cppsym.know > Cppsym.true
19399 : now check the C compiler for additional symbols
19400 postprocess_cc_v=''
19401 case "$osname" in
19402 aix) postprocess_cc_v="|$tr , ' '" ;;
19403 esac
19404 $cat >ccsym <<EOS
19405 $startsh
19406 $cat >tmp.c <<EOF
19407 extern int foo;
19408 EOF
19409 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19410 do
19411         case "\$i" in
19412         -D*) echo "\$i" | $sed 's/^-D//';;
19413         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19414         esac
19415 done
19416 $rm -f try.c
19417 EOS
19418 postprocess_cc_v=''
19419 chmod +x ccsym
19420 $eunicefix ccsym
19421 ./ccsym > ccsym1.raw
19422 if $test -s ccsym1.raw; then
19423        $sort ccsym1.raw | $uniq >ccsym.raw
19424 else
19425        mv ccsym1.raw ccsym.raw
19426 fi
19427
19428 $awk '/\=/ { print $0; next }
19429         { print $0"=1" }' ccsym.raw >ccsym.list
19430 $awk '/\=/ { print $0; next }
19431         { print $0"=1" }' Cppsym.true >ccsym.true
19432 $comm -13 ccsym.true ccsym.list >ccsym.own
19433 $comm -12 ccsym.true ccsym.list >ccsym.com
19434 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19435 also=''
19436 if $test -z ccsym.raw; then
19437         echo "Your C compiler doesn't seem to define any symbols!" >&4
19438         echo " "
19439         echo "However, your C preprocessor defines the following symbols:"
19440         $cat Cppsym.true
19441         ccsymbols=''
19442         cppsymbols=`$cat Cppsym.true`
19443         cppsymbols=`echo $cppsymbols`
19444         cppccsymbols="$cppsymbols"
19445 else
19446         if $test -s ccsym.com; then
19447                 echo "Your C compiler and pre-processor define these symbols:"
19448                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19449                 also='also '
19450                 symbols='ones'
19451                 cppccsymbols=`$cat ccsym.com`
19452                 cppccsymbols=`echo $cppccsymbols`
19453                 $test "$silent" || sleep 1
19454         fi
19455         if $test -s ccsym.cpp; then
19456                 $test "$also" && echo " "
19457                 echo "Your C pre-processor ${also}defines the following symbols:"
19458                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19459                 also='further '
19460                 cppsymbols=`$cat ccsym.cpp`
19461                 cppsymbols=`echo $cppsymbols`
19462                 $test "$silent" || sleep 1
19463         fi
19464         if $test -s ccsym.own; then
19465                 $test "$also" && echo " "
19466                 echo "Your C compiler ${also}defines the following cpp symbols:"
19467                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19468                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19469                 ccsymbols=`$cat ccsym.own`
19470                 ccsymbols=`echo $ccsymbols`
19471                 $test "$silent" || sleep 1
19472         fi
19473 fi
19474
19475 : see if this is a termio system
19476 val="$undef"
19477 val2="$undef"
19478 val3="$undef"
19479 if $test `./findhdr termios.h`; then
19480         set tcsetattr i_termios
19481         eval $inlibc
19482         val3="$i_termios"
19483 fi
19484 echo " "
19485 case "$val3" in
19486 "$define") echo "You have POSIX termios.h... good!" >&4;;
19487 *) if ./Cppsym pyr; then
19488                 case "`/bin/universe`" in
19489                 ucb) if $test `./findhdr sgtty.h`; then
19490                                 val2="$define"
19491                                 echo "<sgtty.h> found." >&4
19492                         else
19493                                 echo "System is pyramid with BSD universe."
19494                                 echo "<sgtty.h> not found--you could have problems." >&4
19495                         fi;;
19496                 *) if $test `./findhdr termio.h`; then
19497                                 val="$define"
19498                                 echo "<termio.h> found." >&4
19499                         else
19500                                 echo "System is pyramid with USG universe."
19501                                 echo "<termio.h> not found--you could have problems." >&4
19502                         fi;;
19503                 esac
19504         elif ./usg; then
19505                 if $test `./findhdr termio.h`; then
19506                         echo "<termio.h> found." >&4
19507                         val="$define"
19508                 elif $test `./findhdr sgtty.h`; then
19509                         echo "<sgtty.h> found." >&4
19510                         val2="$define"
19511                 else
19512 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19513                 fi
19514         else
19515                 if $test `./findhdr sgtty.h`; then
19516                         echo "<sgtty.h> found." >&4
19517                         val2="$define"
19518                 elif $test `./findhdr termio.h`; then
19519                         echo "<termio.h> found." >&4
19520                         val="$define"
19521                 else
19522 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19523                 fi
19524         fi;;
19525 esac
19526 set i_termio; eval $setvar
19527 val=$val2; set i_sgtty; eval $setvar
19528 val=$val3; set i_termios; eval $setvar
19529
19530 : see if stddef is available
19531 set stddef.h i_stddef
19532 eval $inhdr
19533
19534 : see if this is a sunmath.h system
19535 set sunmath.h i_sunmath
19536 eval $inhdr
19537
19538 : see if sys/access.h is available
19539 set sys/access.h i_sysaccess
19540 eval $inhdr
19541
19542 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19543 set sys/filio.h i_sysfilio
19544 eval $inhdr
19545 echo " "
19546 if $test `./findhdr sys/ioctl.h`; then
19547         val="$define"
19548         echo '<sys/ioctl.h> found.' >&4
19549 else
19550         val="$undef"
19551         if $test $i_sysfilio = "$define"; then
19552             echo '<sys/ioctl.h> NOT found.' >&4
19553         else
19554                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19555                 $test $i_termio = "$define" && xxx="termio.h"
19556                 $test $i_termios = "$define" && xxx="termios.h"
19557 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19558         fi
19559 fi
19560 set i_sysioctl
19561 eval $setvar
19562
19563 : see if socket ioctl defs are in sys/sockio.h
19564 echo " "
19565 xxx=`./findhdr sys/sockio.h`
19566 if $test "$xxx"; then
19567         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19568                 val="$define"
19569                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19570         else
19571                 val="$undef"
19572                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19573         fi
19574 else
19575         val="$undef"
19576         $cat <<EOM
19577 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19578 EOM
19579 fi
19580 set i_syssockio
19581 eval $setvar
19582
19583
19584 : see if this is a syslog.h system
19585 set syslog.h i_syslog
19586 eval $inhdr
19587
19588
19589 : see if this is a sys/mode.h system
19590 set sys/mode.h i_sysmode
19591 eval $inhdr
19592
19593 : see if sys/resource.h has to be included
19594 set sys/resource.h i_sysresrc
19595 eval $inhdr
19596
19597 : see if sys/security.h is available
19598 set sys/security.h i_syssecrt
19599 eval $inhdr
19600
19601 : see if this is a sys/statvfs.h system
19602 set sys/statvfs.h i_sysstatvfs
19603 eval $inhdr
19604
19605 : see if this is a sys/un.h system
19606 set sys/un.h i_sysun
19607 eval $inhdr
19608
19609
19610 : see if this is a sys/utsname.h system
19611 set sys/utsname.h i_sysutsname
19612 eval $inhdr
19613
19614 : see if this is a syswait system
19615 set sys/wait.h i_syswait
19616 eval $inhdr
19617
19618 : see if this is a ustat.h system
19619 set ustat.h i_ustat
19620 eval $inhdr
19621
19622 : see if this is an utime system
19623 set utime.h i_utime
19624 eval $inhdr
19625
19626 : see if this is a values.h system
19627 set values.h i_values
19628 eval $inhdr
19629
19630 : see if this is a vfork system
19631 case "$d_vfork" in
19632 "$define")
19633         set vfork.h i_vfork
19634         eval $inhdr
19635         ;;
19636 *)
19637         i_vfork="$undef"
19638         ;;
19639 esac
19640
19641 : see if gdbm.h is available
19642 set gdbm.h t_gdbm
19643 eval $inhdr
19644 case "$t_gdbm" in
19645 $define)
19646         : see if gdbm_open exists
19647         set gdbm_open d_gdbm_open
19648         eval $inlibc
19649         case "$d_gdbm_open" in
19650         $undef)
19651                 t_gdbm="$undef"
19652                 echo "We won't be including <gdbm.h>"
19653                 ;;
19654         esac
19655         ;;
19656 esac
19657 val="$t_gdbm"
19658 set i_gdbm
19659 eval $setvar
19660
19661 echo " "
19662 echo "Looking for extensions..." >&4
19663 : If we are using the old config.sh, known_extensions may contain
19664 : old or inaccurate or duplicate values.
19665 known_extensions=''
19666 nonxs_extensions=''
19667 : We do not use find because it might not be available.
19668 : We do not just use MANIFEST because the user may have dropped
19669 : some additional extensions into the source tree and expect them
19670 : to be built.
19671
19672 : Function to recursively find available extensions, ignoring DynaLoader
19673 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19674 find_extensions='
19675     for xxx in *; do
19676        case "$xxx" in
19677            DynaLoader|dynaload) ;;
19678            *)
19679            if $test -f $xxx/$xxx.xs; then
19680                known_extensions="$known_extensions $1$xxx";
19681            elif $test -f $xxx/Makefile.PL; then
19682                nonxs_extensions="$nonxs_extensions $1$xxx";
19683            else
19684                if $test -d $xxx -a $# -lt 10; then
19685                    set $1$xxx/ $*;
19686                    cd "$xxx";
19687                    eval $find_extensions;
19688                    cd ..;
19689                    shift;
19690                fi;
19691            fi
19692            ;;
19693        esac;
19694     done'
19695 tdir=`pwd`
19696 cd "$rsrc/ext"
19697 set X
19698 shift
19699 eval $find_extensions
19700 # Special case:  Add in threads/shared since it is not picked up by the
19701 # recursive find above (and adding in general recursive finding breaks
19702 # SDBM_File/sdbm).  A.D.  10/25/2001.
19703 known_extensions="$known_extensions threads/shared"
19704 set X $nonxs_extensions
19705 shift
19706 nonxs_extensions="$*"
19707 set X $known_extensions
19708 shift
19709 known_extensions="$*"
19710 cd "$tdir"
19711
19712 : Now see which are supported on this system.
19713 avail_ext=''
19714 for xxx in $known_extensions ; do
19715         case "$xxx" in
19716         DB_File|db_file)
19717                 case "$i_db" in
19718                 $define) avail_ext="$avail_ext $xxx" ;;
19719                 esac
19720                 ;;
19721         GDBM_File|gdbm_fil)
19722                 case "$i_gdbm" in 
19723                 $define) avail_ext="$avail_ext $xxx" ;;
19724                 esac
19725                 ;;
19726         I18N/Langinfo|i18n_lan)
19727                 case "$i_langinfo$d_nl_langinfo" in 
19728                 $define$define) avail_ext="$avail_ext $xxx" ;;
19729                 esac
19730                 ;;
19731         NDBM_File|ndbm_fil)
19732                 case "$i_ndbm" in
19733                 $define)
19734                     case "$osname-$use64bitint" in
19735                     hpux-define)
19736                         case "$libs" in
19737                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19738                         esac
19739                         ;;
19740                     *) avail_ext="$avail_ext $xxx" ;;
19741                     esac
19742                     ;;
19743                 esac
19744                 ;;
19745         ODBM_File|odbm_fil) 
19746                 case "${i_dbm}${i_rpcsvcdbm}" in
19747                 *"${define}"*)
19748                     case "$osname-$use64bitint" in
19749                     hpux-define)
19750                         case "$libs" in
19751                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19752                         esac
19753                         ;;
19754                     *) avail_ext="$avail_ext $xxx" ;;
19755                     esac
19756                     ;;
19757                 esac
19758                 ;;
19759         POSIX|posix)
19760                 case "$useposix" in
19761                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19762                 esac
19763                 ;;
19764         Opcode|opcode)
19765                 case "$useopcode" in
19766                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19767                 esac
19768                 ;;
19769         Socket|socket)
19770                 case "$d_socket" in 
19771                 true|$define|y)
19772                     case "$osname" in
19773                     beos) ;; # not unless BONE
19774                     *) avail_ext="$avail_ext $xxx" ;;
19775                     esac
19776                     ;;
19777                 esac
19778                 ;;
19779         Sys/Syslog|sys/syslog)
19780                 : XXX syslog requires socket
19781                 case "$d_socket" in 
19782                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19783                 esac
19784                 ;;
19785         Thread|thread)
19786                 case "$usethreads" in
19787                 true|$define|y)
19788                         case "$useithreads" in
19789                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19790                         esac
19791                 esac
19792                 ;;
19793         XS/APItest|xs/apitest)
19794                 # This is just for testing.  Skip it unless we have dynamic loading.
19795
19796                 case "$usedl" in
19797                 $define) avail_ext="$avail_ext $xxx" ;;
19798                 esac
19799                 ;;
19800         XS/Typemap|xs/typemap)
19801                 # This is just for testing.  Skip it unless we have dynamic loading.
19802                 case "$usedl" in
19803                 $define) avail_ext="$avail_ext $xxx" ;;
19804                 esac
19805                 ;;
19806         threads|threads/shared)
19807                 # threads and threads::shared are special cases.
19808                 # To stop people from asking "Perl 5.8.0 was supposed
19809                 # to have this new fancy threads implementation but my
19810                 # perl doesn't have it" and from people trying to
19811                 # (re)install the threads module using CPAN.pm and
19812                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19813                 # the threads.pm and threads/shared.pm will always be
19814                 # there, croaking informatively ("you need to rebuild
19815                 # all of Perl with threads, sorry") when threads haven't
19816                 # been compiled in.
19817                 # --jhi
19818                 avail_ext="$avail_ext $xxx"
19819                 ;;
19820         IPC/SysV|ipc/sysv)
19821                 : XXX Do we need a useipcsysv variable here
19822                 case "${d_msg}${d_sem}${d_shm}" in 
19823                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19824                 esac
19825                 ;;
19826         *)      avail_ext="$avail_ext $xxx"
19827                 ;;
19828         esac
19829 done
19830
19831 set X $avail_ext
19832 shift
19833 avail_ext="$*"
19834
19835 : Now see which nonxs extensions are supported on this system.
19836 : For now assume all are.
19837 nonxs_ext=''
19838 for xxx in $nonxs_extensions ; do
19839         case "$xxx" in
19840         *)      nonxs_ext="$nonxs_ext $xxx"
19841                 ;;
19842         esac
19843 done
19844
19845 set X $nonxs_ext
19846 shift
19847 nonxs_ext="$*"
19848
19849 case $usedl in
19850 $define)
19851         $cat <<EOM
19852 A number of extensions are supplied with $package.  You may choose to
19853 compile these extensions for dynamic loading (the default), compile
19854 them into the $package executable (static loading), or not include
19855 them at all.  Answer "none" to include no extensions.
19856 Note that DynaLoader is always built and need not be mentioned here.
19857
19858 EOM
19859         case "$dynamic_ext" in
19860         '')
19861                 : Exclude those listed in static_ext
19862                 dflt=''
19863                 for xxx in $avail_ext; do
19864                         case " $static_ext " in
19865                         *" $xxx "*) ;;
19866                         *) dflt="$dflt $xxx" ;;
19867                         esac
19868                 done
19869                 set X $dflt
19870                 shift
19871                 dflt="$*"
19872                 ;;
19873         *)      dflt="$dynamic_ext"
19874                 # Perhaps we are reusing an old out-of-date config.sh.
19875                 case "$hint" in
19876                 previous)
19877                         if test X"$dynamic_ext" != X"$avail_ext"; then
19878                                 $cat <<EOM
19879 NOTICE:  Your previous config.sh list may be incorrect. 
19880 The extensions now available to you are 
19881         ${avail_ext}
19882 but the default list from your previous config.sh is
19883         ${dynamic_ext} 
19884
19885 EOM
19886                         fi
19887                         ;;
19888                 esac
19889                 ;;
19890         esac
19891         case "$dflt" in
19892         '')     dflt=none;;
19893         esac
19894         rp="What extensions do you wish to load dynamically?"
19895         . ./myread
19896         case "$ans" in
19897         none) dynamic_ext=' ' ;;
19898         *) dynamic_ext="$ans" ;;
19899         esac
19900
19901         case "$static_ext" in
19902         '')
19903                 : Exclude those already listed in dynamic linking
19904                 dflt=''
19905                 for xxx in $avail_ext; do
19906                         case " $dynamic_ext " in
19907                         *" $xxx "*) ;;
19908                         *) dflt="$dflt $xxx" ;;
19909                         esac
19910                 done
19911                 set X $dflt
19912                 shift
19913                 dflt="$*"
19914                 ;;
19915         *)  dflt="$static_ext" 
19916                 ;;
19917         esac
19918
19919         case "$dflt" in
19920         '')     dflt=none;;
19921         esac
19922         rp="What extensions do you wish to load statically?"
19923         . ./myread
19924         case "$ans" in
19925         none) static_ext=' ' ;;
19926         *) static_ext="$ans" ;;
19927         esac
19928         ;;
19929 *)
19930         $cat <<EOM
19931 A number of extensions are supplied with $package.  Answer "none" 
19932 to include no extensions. 
19933 Note that DynaLoader is always built and need not be mentioned here.
19934
19935 EOM
19936         case "$static_ext" in
19937         '') dflt="$avail_ext" ;;
19938         *)      dflt="$static_ext"
19939                 # Perhaps we are reusing an old out-of-date config.sh.
19940                 case "$hint" in
19941                 previous)
19942                         if test X"$static_ext" != X"$avail_ext"; then
19943                                 $cat <<EOM
19944 NOTICE:  Your previous config.sh list may be incorrect. 
19945 The extensions now available to you are 
19946         ${avail_ext}
19947 but the default list from your previous config.sh is
19948         ${static_ext} 
19949
19950 EOM
19951                         fi
19952                         ;;
19953                 esac
19954                 ;;
19955         esac
19956         : Exclude those that are not xs extensions
19957         case "$dflt" in
19958         '')     dflt=none;;
19959         esac
19960         rp="What extensions do you wish to include?"
19961         . ./myread
19962         case "$ans" in
19963         none) static_ext=' ' ;;
19964         *) static_ext="$ans" ;;
19965         esac
19966         ;;
19967 esac
19968 #        
19969 # Encode is a special case.  If we are building Encode as a static
19970 # extension, we need to explicitly list its subextensions as well.
19971 # For other nested extensions, this is handled automatically by
19972 # the appropriate Makefile.PL.
19973 case " $static_ext " in
19974         *" Encode "*) # Add the subextensions of Encode
19975         cd "$rsrc/ext"
19976         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19977                 static_ext="$static_ext Encode/$xxx"
19978         done
19979         cd "$tdir"
19980         ;;
19981 esac
19982
19983 set X $dynamic_ext $static_ext $nonxs_ext
19984 shift
19985 extensions="$*"
19986
19987 : Remove libraries needed only for extensions
19988 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19989 : The exception is SunOS 4.x, which needs them.
19990 case "${osname}X${osvers}" in
19991 sunos*X4*)
19992     perllibs="$libs"
19993     ;;
19994 *) case "$usedl" in
19995     $define|true|[yY]*)
19996             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19997             shift
19998             perllibs="$*"
19999             ;;
20000     *)  perllibs="$libs"
20001             ;;
20002     esac
20003     ;;
20004 esac
20005
20006 : Remove build directory name from cppstdin so it can be used from
20007 : either the present location or the final installed location.
20008 echo " "
20009 : Get out of the UU directory to get correct path name.
20010 cd ..
20011 case "$cppstdin" in
20012 `pwd`/cppstdin)
20013         echo "Stripping down cppstdin path name"
20014         cppstdin=cppstdin
20015         ;;
20016 esac
20017 cd UU
20018
20019 : end of configuration questions
20020 echo " "
20021 echo "End of configuration questions."
20022 echo " "
20023
20024 : back to where it started
20025 if test -d ../UU; then
20026         cd ..
20027 fi
20028
20029 : configuration may be patched via a 'config.arch' file
20030 if $test -f config.arch; then
20031         echo "I see a config.arch file, loading it."
20032         . ./config.arch
20033 fi
20034
20035 : configuration may be patched via a 'config.over' file
20036 if $test -f config.over; then
20037         echo " "
20038         dflt=y
20039         rp='I see a config.over file.  Do you wish to load it?'
20040         . UU/myread
20041         case "$ans" in
20042         n*) echo "OK, I'll ignore it.";;
20043         *)      . ./config.over
20044                 echo "Configuration override changes have been loaded."
20045                 ;;
20046         esac
20047 fi
20048
20049 : in case they want portability, strip down executable paths
20050 case "$d_portable" in
20051 "$define")
20052         echo " "
20053         echo "Stripping down executable paths..." >&4
20054         for file in $loclist $trylist; do
20055                 eval temp=\$$file
20056                 eval $file=`basename $temp`
20057         done
20058         ;;
20059 esac
20060
20061 : create config.sh file
20062 echo " "
20063 echo "Creating config.sh..." >&4
20064 $spitshell <<EOT >config.sh
20065 $startsh
20066 #
20067 # This file was produced by running the Configure script. It holds all the
20068 # definitions figured out by Configure. Should you modify one of these values,
20069 # do not forget to propagate your changes by running "Configure -der". You may
20070 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20071 #
20072
20073 # Package name      : $package
20074 # Source directory  : $src
20075 # Configuration time: $cf_time
20076 # Configured by     : $cf_by
20077 # Target system     : $myuname
20078
20079 Author='$Author'
20080 Date='$Date'
20081 Header='$Header'
20082 Id='$Id'
20083 Locker='$Locker'
20084 Log='$Log'
20085 Mcc='$Mcc'
20086 RCSfile='$RCSfile'
20087 Revision='$Revision'
20088 Source='$Source'
20089 State='$State'
20090 _a='$_a'
20091 _exe='$_exe'
20092 _o='$_o'
20093 afs='$afs'
20094 afsroot='$afsroot'
20095 alignbytes='$alignbytes'
20096 ansi2knr='$ansi2knr'
20097 aphostname='$aphostname'
20098 api_revision='$api_revision'
20099 api_subversion='$api_subversion'
20100 api_version='$api_version'
20101 api_versionstring='$api_versionstring'
20102 ar='$ar'
20103 archlib='$archlib'
20104 archlibexp='$archlibexp'
20105 archname64='$archname64'
20106 archname='$archname'
20107 archobjs='$archobjs'
20108 asctime_r_proto='$asctime_r_proto'
20109 awk='$awk'
20110 baserev='$baserev'
20111 bash='$bash'
20112 bin='$bin'
20113 binexp='$binexp'
20114 bison='$bison'
20115 byacc='$byacc'
20116 byteorder='$byteorder'
20117 c='$c'
20118 castflags='$castflags'
20119 cat='$cat'
20120 cc='$cc'
20121 cccdlflags='$cccdlflags'
20122 ccdlflags='$ccdlflags'
20123 ccflags='$ccflags'
20124 ccflags_uselargefiles='$ccflags_uselargefiles'
20125 ccname='$ccname'
20126 ccsymbols='$ccsymbols'
20127 ccversion='$ccversion'
20128 cf_by='$cf_by'
20129 cf_email='$cf_email'
20130 cf_time='$cf_time'
20131 charsize='$charsize'
20132 chgrp='$chgrp'
20133 chmod='$chmod'
20134 chown='$chown'
20135 clocktype='$clocktype'
20136 comm='$comm'
20137 compress='$compress'
20138 contains='$contains'
20139 cp='$cp'
20140 cpio='$cpio'
20141 cpp='$cpp'
20142 cpp_stuff='$cpp_stuff'
20143 cppccsymbols='$cppccsymbols'
20144 cppflags='$cppflags'
20145 cpplast='$cpplast'
20146 cppminus='$cppminus'
20147 cpprun='$cpprun'
20148 cppstdin='$cppstdin'
20149 cppsymbols='$cppsymbols'
20150 crypt_r_proto='$crypt_r_proto'
20151 cryptlib='$cryptlib'
20152 csh='$csh'
20153 ctermid_r_proto='$ctermid_r_proto'
20154 ctime_r_proto='$ctime_r_proto'
20155 d_Gconvert='$d_Gconvert'
20156 d_PRIEUldbl='$d_PRIEUldbl'
20157 d_PRIFUldbl='$d_PRIFUldbl'
20158 d_PRIGUldbl='$d_PRIGUldbl'
20159 d_PRIXU64='$d_PRIXU64'
20160 d_PRId64='$d_PRId64'
20161 d_PRIeldbl='$d_PRIeldbl'
20162 d_PRIfldbl='$d_PRIfldbl'
20163 d_PRIgldbl='$d_PRIgldbl'
20164 d_PRIi64='$d_PRIi64'
20165 d_PRIo64='$d_PRIo64'
20166 d_PRIu64='$d_PRIu64'
20167 d_PRIx64='$d_PRIx64'
20168 d_SCNfldbl='$d_SCNfldbl'
20169 d__fwalk='$d__fwalk'
20170 d_access='$d_access'
20171 d_accessx='$d_accessx'
20172 d_alarm='$d_alarm'
20173 d_archlib='$d_archlib'
20174 d_asctime_r='$d_asctime_r'
20175 d_atolf='$d_atolf'
20176 d_atoll='$d_atoll'
20177 d_attribut='$d_attribut'
20178 d_bcmp='$d_bcmp'
20179 d_bcopy='$d_bcopy'
20180 d_bsd='$d_bsd'
20181 d_bsdgetpgrp='$d_bsdgetpgrp'
20182 d_bsdsetpgrp='$d_bsdsetpgrp'
20183 d_bzero='$d_bzero'
20184 d_casti32='$d_casti32'
20185 d_castneg='$d_castneg'
20186 d_charvspr='$d_charvspr'
20187 d_chown='$d_chown'
20188 d_chroot='$d_chroot'
20189 d_chsize='$d_chsize'
20190 d_class='$d_class'
20191 d_closedir='$d_closedir'
20192 d_cmsghdr_s='$d_cmsghdr_s'
20193 d_const='$d_const'
20194 d_crypt='$d_crypt'
20195 d_crypt_r='$d_crypt_r'
20196 d_csh='$d_csh'
20197 d_ctermid_r='$d_ctermid_r'
20198 d_ctime_r='$d_ctime_r'
20199 d_cuserid='$d_cuserid'
20200 d_dbl_dig='$d_dbl_dig'
20201 d_dbminitproto='$d_dbminitproto'
20202 d_difftime='$d_difftime'
20203 d_dirfd='$d_dirfd'
20204 d_dirnamlen='$d_dirnamlen'
20205 d_dlerror='$d_dlerror'
20206 d_dlopen='$d_dlopen'
20207 d_dlsymun='$d_dlsymun'
20208 d_dosuid='$d_dosuid'
20209 d_drand48_r='$d_drand48_r'
20210 d_drand48proto='$d_drand48proto'
20211 d_dup2='$d_dup2'
20212 d_eaccess='$d_eaccess'
20213 d_endgrent='$d_endgrent'
20214 d_endgrent_r='$d_endgrent_r'
20215 d_endhent='$d_endhent'
20216 d_endhostent_r='$d_endhostent_r'
20217 d_endnent='$d_endnent'
20218 d_endnetent_r='$d_endnetent_r'
20219 d_endpent='$d_endpent'
20220 d_endprotoent_r='$d_endprotoent_r'
20221 d_endpwent='$d_endpwent'
20222 d_endpwent_r='$d_endpwent_r'
20223 d_endsent='$d_endsent'
20224 d_endservent_r='$d_endservent_r'
20225 d_eofnblk='$d_eofnblk'
20226 d_eunice='$d_eunice'
20227 d_fchdir='$d_fchdir'
20228 d_fchmod='$d_fchmod'
20229 d_fchown='$d_fchown'
20230 d_fcntl='$d_fcntl'
20231 d_fcntl_can_lock='$d_fcntl_can_lock'
20232 d_fd_macros='$d_fd_macros'
20233 d_fd_set='$d_fd_set'
20234 d_fds_bits='$d_fds_bits'
20235 d_fgetpos='$d_fgetpos'
20236 d_finite='$d_finite'
20237 d_finitel='$d_finitel'
20238 d_flexfnam='$d_flexfnam'
20239 d_flock='$d_flock'
20240 d_flockproto='$d_flockproto'
20241 d_fork='$d_fork'
20242 d_fp_class='$d_fp_class'
20243 d_fpathconf='$d_fpathconf'
20244 d_fpclass='$d_fpclass'
20245 d_fpclassify='$d_fpclassify'
20246 d_fpclassl='$d_fpclassl'
20247 d_fpos64_t='$d_fpos64_t'
20248 d_frexpl='$d_frexpl'
20249 d_fs_data_s='$d_fs_data_s'
20250 d_fseeko='$d_fseeko'
20251 d_fsetpos='$d_fsetpos'
20252 d_fstatfs='$d_fstatfs'
20253 d_fstatvfs='$d_fstatvfs'
20254 d_fsync='$d_fsync'
20255 d_ftello='$d_ftello'
20256 d_ftime='$d_ftime'
20257 d_getcwd='$d_getcwd'
20258 d_getespwnam='$d_getespwnam'
20259 d_getfsstat='$d_getfsstat'
20260 d_getgrent='$d_getgrent'
20261 d_getgrent_r='$d_getgrent_r'
20262 d_getgrgid_r='$d_getgrgid_r'
20263 d_getgrnam_r='$d_getgrnam_r'
20264 d_getgrps='$d_getgrps'
20265 d_gethbyaddr='$d_gethbyaddr'
20266 d_gethbyname='$d_gethbyname'
20267 d_gethent='$d_gethent'
20268 d_gethname='$d_gethname'
20269 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20270 d_gethostbyname_r='$d_gethostbyname_r'
20271 d_gethostent_r='$d_gethostent_r'
20272 d_gethostprotos='$d_gethostprotos'
20273 d_getitimer='$d_getitimer'
20274 d_getlogin='$d_getlogin'
20275 d_getlogin_r='$d_getlogin_r'
20276 d_getmnt='$d_getmnt'
20277 d_getmntent='$d_getmntent'
20278 d_getnbyaddr='$d_getnbyaddr'
20279 d_getnbyname='$d_getnbyname'
20280 d_getnent='$d_getnent'
20281 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20282 d_getnetbyname_r='$d_getnetbyname_r'
20283 d_getnetent_r='$d_getnetent_r'
20284 d_getnetprotos='$d_getnetprotos'
20285 d_getpagsz='$d_getpagsz'
20286 d_getpbyname='$d_getpbyname'
20287 d_getpbynumber='$d_getpbynumber'
20288 d_getpent='$d_getpent'
20289 d_getpgid='$d_getpgid'
20290 d_getpgrp2='$d_getpgrp2'
20291 d_getpgrp='$d_getpgrp'
20292 d_getppid='$d_getppid'
20293 d_getprior='$d_getprior'
20294 d_getprotobyname_r='$d_getprotobyname_r'
20295 d_getprotobynumber_r='$d_getprotobynumber_r'
20296 d_getprotoent_r='$d_getprotoent_r'
20297 d_getprotoprotos='$d_getprotoprotos'
20298 d_getprpwnam='$d_getprpwnam'
20299 d_getpwent='$d_getpwent'
20300 d_getpwent_r='$d_getpwent_r'
20301 d_getpwnam_r='$d_getpwnam_r'
20302 d_getpwuid_r='$d_getpwuid_r'
20303 d_getsbyname='$d_getsbyname'
20304 d_getsbyport='$d_getsbyport'
20305 d_getsent='$d_getsent'
20306 d_getservbyname_r='$d_getservbyname_r'
20307 d_getservbyport_r='$d_getservbyport_r'
20308 d_getservent_r='$d_getservent_r'
20309 d_getservprotos='$d_getservprotos'
20310 d_getspnam='$d_getspnam'
20311 d_getspnam_r='$d_getspnam_r'
20312 d_gettimeod='$d_gettimeod'
20313 d_gmtime_r='$d_gmtime_r'
20314 d_gnulibc='$d_gnulibc'
20315 d_grpasswd='$d_grpasswd'
20316 d_hasmntopt='$d_hasmntopt'
20317 d_htonl='$d_htonl'
20318 d_index='$d_index'
20319 d_inetaton='$d_inetaton'
20320 d_int64_t='$d_int64_t'
20321 d_isascii='$d_isascii'
20322 d_isfinite='$d_isfinite'
20323 d_isinf='$d_isinf'
20324 d_isnan='$d_isnan'
20325 d_isnanl='$d_isnanl'
20326 d_killpg='$d_killpg'
20327 d_lchown='$d_lchown'
20328 d_ldbl_dig='$d_ldbl_dig'
20329 d_link='$d_link'
20330 d_localtime_r='$d_localtime_r'
20331 d_locconv='$d_locconv'
20332 d_lockf='$d_lockf'
20333 d_longdbl='$d_longdbl'
20334 d_longlong='$d_longlong'
20335 d_lseekproto='$d_lseekproto'
20336 d_lstat='$d_lstat'
20337 d_madvise='$d_madvise'
20338 d_mblen='$d_mblen'
20339 d_mbstowcs='$d_mbstowcs'
20340 d_mbtowc='$d_mbtowc'
20341 d_memchr='$d_memchr'
20342 d_memcmp='$d_memcmp'
20343 d_memcpy='$d_memcpy'
20344 d_memmove='$d_memmove'
20345 d_memset='$d_memset'
20346 d_mkdir='$d_mkdir'
20347 d_mkdtemp='$d_mkdtemp'
20348 d_mkfifo='$d_mkfifo'
20349 d_mkstemp='$d_mkstemp'
20350 d_mkstemps='$d_mkstemps'
20351 d_mktime='$d_mktime'
20352 d_mmap='$d_mmap'
20353 d_modfl='$d_modfl'
20354 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20355 d_modflproto='$d_modflproto'
20356 d_mprotect='$d_mprotect'
20357 d_msg='$d_msg'
20358 d_msg_ctrunc='$d_msg_ctrunc'
20359 d_msg_dontroute='$d_msg_dontroute'
20360 d_msg_oob='$d_msg_oob'
20361 d_msg_peek='$d_msg_peek'
20362 d_msg_proxy='$d_msg_proxy'
20363 d_msgctl='$d_msgctl'
20364 d_msgget='$d_msgget'
20365 d_msghdr_s='$d_msghdr_s'
20366 d_msgrcv='$d_msgrcv'
20367 d_msgsnd='$d_msgsnd'
20368 d_msync='$d_msync'
20369 d_munmap='$d_munmap'
20370 d_mymalloc='$d_mymalloc'
20371 d_nanosleep='$d_nanosleep'
20372 d_nice='$d_nice'
20373 d_nl_langinfo='$d_nl_langinfo'
20374 d_nv_preserves_uv='$d_nv_preserves_uv'
20375 d_off64_t='$d_off64_t'
20376 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20377 d_oldpthreads='$d_oldpthreads'
20378 d_oldsock='$d_oldsock'
20379 d_open3='$d_open3'
20380 d_pathconf='$d_pathconf'
20381 d_pause='$d_pause'
20382 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20383 d_phostname='$d_phostname'
20384 d_pipe='$d_pipe'
20385 d_poll='$d_poll'
20386 d_portable='$d_portable'
20387 d_procselfexe='$d_procselfexe'
20388 d_pthread_atfork='$d_pthread_atfork'
20389 d_pthread_yield='$d_pthread_yield'
20390 d_pwage='$d_pwage'
20391 d_pwchange='$d_pwchange'
20392 d_pwclass='$d_pwclass'
20393 d_pwcomment='$d_pwcomment'
20394 d_pwexpire='$d_pwexpire'
20395 d_pwgecos='$d_pwgecos'
20396 d_pwpasswd='$d_pwpasswd'
20397 d_pwquota='$d_pwquota'
20398 d_qgcvt='$d_qgcvt'
20399 d_quad='$d_quad'
20400 d_random_r='$d_random_r'
20401 d_readdir64_r='$d_readdir64_r'
20402 d_readdir='$d_readdir'
20403 d_readdir_r='$d_readdir_r'
20404 d_readlink='$d_readlink'
20405 d_readv='$d_readv'
20406 d_recvmsg='$d_recvmsg'
20407 d_rename='$d_rename'
20408 d_rewinddir='$d_rewinddir'
20409 d_rmdir='$d_rmdir'
20410 d_safebcpy='$d_safebcpy'
20411 d_safemcpy='$d_safemcpy'
20412 d_sanemcmp='$d_sanemcmp'
20413 d_sbrkproto='$d_sbrkproto'
20414 d_sched_yield='$d_sched_yield'
20415 d_scm_rights='$d_scm_rights'
20416 d_seekdir='$d_seekdir'
20417 d_select='$d_select'
20418 d_sem='$d_sem'
20419 d_semctl='$d_semctl'
20420 d_semctl_semid_ds='$d_semctl_semid_ds'
20421 d_semctl_semun='$d_semctl_semun'
20422 d_semget='$d_semget'
20423 d_semop='$d_semop'
20424 d_sendmsg='$d_sendmsg'
20425 d_setegid='$d_setegid'
20426 d_seteuid='$d_seteuid'
20427 d_setgrent='$d_setgrent'
20428 d_setgrent_r='$d_setgrent_r'
20429 d_setgrps='$d_setgrps'
20430 d_sethent='$d_sethent'
20431 d_sethostent_r='$d_sethostent_r'
20432 d_setitimer='$d_setitimer'
20433 d_setlinebuf='$d_setlinebuf'
20434 d_setlocale='$d_setlocale'
20435 d_setlocale_r='$d_setlocale_r'
20436 d_setnent='$d_setnent'
20437 d_setnetent_r='$d_setnetent_r'
20438 d_setpent='$d_setpent'
20439 d_setpgid='$d_setpgid'
20440 d_setpgrp2='$d_setpgrp2'
20441 d_setpgrp='$d_setpgrp'
20442 d_setprior='$d_setprior'
20443 d_setproctitle='$d_setproctitle'
20444 d_setprotoent_r='$d_setprotoent_r'
20445 d_setpwent='$d_setpwent'
20446 d_setpwent_r='$d_setpwent_r'
20447 d_setregid='$d_setregid'
20448 d_setresgid='$d_setresgid'
20449 d_setresuid='$d_setresuid'
20450 d_setreuid='$d_setreuid'
20451 d_setrgid='$d_setrgid'
20452 d_setruid='$d_setruid'
20453 d_setsent='$d_setsent'
20454 d_setservent_r='$d_setservent_r'
20455 d_setsid='$d_setsid'
20456 d_setvbuf='$d_setvbuf'
20457 d_sfio='$d_sfio'
20458 d_shm='$d_shm'
20459 d_shmat='$d_shmat'
20460 d_shmatprototype='$d_shmatprototype'
20461 d_shmctl='$d_shmctl'
20462 d_shmdt='$d_shmdt'
20463 d_shmget='$d_shmget'
20464 d_sigaction='$d_sigaction'
20465 d_sigprocmask='$d_sigprocmask'
20466 d_sigsetjmp='$d_sigsetjmp'
20467 d_sockatmark='$d_sockatmark'
20468 d_sockatmarkproto='$d_sockatmarkproto'
20469 d_socket='$d_socket'
20470 d_socklen_t='$d_socklen_t'
20471 d_sockpair='$d_sockpair'
20472 d_socks5_init='$d_socks5_init'
20473 d_sqrtl='$d_sqrtl'
20474 d_srand48_r='$d_srand48_r'
20475 d_srandom_r='$d_srandom_r'
20476 d_sresgproto='$d_sresgproto'
20477 d_sresuproto='$d_sresuproto'
20478 d_statblks='$d_statblks'
20479 d_statfs_f_flags='$d_statfs_f_flags'
20480 d_statfs_s='$d_statfs_s'
20481 d_statvfs='$d_statvfs'
20482 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20483 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20484 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20485 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20486 d_stdio_stream_array='$d_stdio_stream_array'
20487 d_stdiobase='$d_stdiobase'
20488 d_stdstdio='$d_stdstdio'
20489 d_strchr='$d_strchr'
20490 d_strcoll='$d_strcoll'
20491 d_strctcpy='$d_strctcpy'
20492 d_strerrm='$d_strerrm'
20493 d_strerror='$d_strerror'
20494 d_strerror_r='$d_strerror_r'
20495 d_strftime='$d_strftime'
20496 d_strtod='$d_strtod'
20497 d_strtol='$d_strtol'
20498 d_strtold='$d_strtold'
20499 d_strtoll='$d_strtoll'
20500 d_strtoq='$d_strtoq'
20501 d_strtoul='$d_strtoul'
20502 d_strtoull='$d_strtoull'
20503 d_strtouq='$d_strtouq'
20504 d_strxfrm='$d_strxfrm'
20505 d_suidsafe='$d_suidsafe'
20506 d_symlink='$d_symlink'
20507 d_syscall='$d_syscall'
20508 d_syscallproto='$d_syscallproto'
20509 d_sysconf='$d_sysconf'
20510 d_sysernlst='$d_sysernlst'
20511 d_syserrlst='$d_syserrlst'
20512 d_system='$d_system'
20513 d_tcgetpgrp='$d_tcgetpgrp'
20514 d_tcsetpgrp='$d_tcsetpgrp'
20515 d_telldir='$d_telldir'
20516 d_telldirproto='$d_telldirproto'
20517 d_time='$d_time'
20518 d_times='$d_times'
20519 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20520 d_tm_tm_zone='$d_tm_tm_zone'
20521 d_tmpnam_r='$d_tmpnam_r'
20522 d_truncate='$d_truncate'
20523 d_ttyname_r='$d_ttyname_r'
20524 d_tzname='$d_tzname'
20525 d_u32align='$d_u32align'
20526 d_ualarm='$d_ualarm'
20527 d_umask='$d_umask'
20528 d_uname='$d_uname'
20529 d_union_semun='$d_union_semun'
20530 d_unordered='$d_unordered'
20531 d_usleep='$d_usleep'
20532 d_usleepproto='$d_usleepproto'
20533 d_ustat='$d_ustat'
20534 d_vendorarch='$d_vendorarch'
20535 d_vendorbin='$d_vendorbin'
20536 d_vendorlib='$d_vendorlib'
20537 d_vendorscript='$d_vendorscript'
20538 d_vfork='$d_vfork'
20539 d_void_closedir='$d_void_closedir'
20540 d_voidsig='$d_voidsig'
20541 d_voidtty='$d_voidtty'
20542 d_volatile='$d_volatile'
20543 d_vprintf='$d_vprintf'
20544 d_wait4='$d_wait4'
20545 d_waitpid='$d_waitpid'
20546 d_wcstombs='$d_wcstombs'
20547 d_wctomb='$d_wctomb'
20548 d_writev='$d_writev'
20549 d_xenix='$d_xenix'
20550 date='$date'
20551 db_hashtype='$db_hashtype'
20552 db_prefixtype='$db_prefixtype'
20553 db_version_major='$db_version_major'
20554 db_version_minor='$db_version_minor'
20555 db_version_patch='$db_version_patch'
20556 defvoidused='$defvoidused'
20557 direntrytype='$direntrytype'
20558 dlext='$dlext'
20559 dlsrc='$dlsrc'
20560 doublesize='$doublesize'
20561 drand01='$drand01'
20562 drand48_r_proto='$drand48_r_proto'
20563 dynamic_ext='$dynamic_ext'
20564 eagain='$eagain'
20565 ebcdic='$ebcdic'
20566 echo='$echo'
20567 egrep='$egrep'
20568 emacs='$emacs'
20569 endgrent_r_proto='$endgrent_r_proto'
20570 endhostent_r_proto='$endhostent_r_proto'
20571 endnetent_r_proto='$endnetent_r_proto'
20572 endprotoent_r_proto='$endprotoent_r_proto'
20573 endpwent_r_proto='$endpwent_r_proto'
20574 endservent_r_proto='$endservent_r_proto'
20575 eunicefix='$eunicefix'
20576 exe_ext='$exe_ext'
20577 expr='$expr'
20578 extensions='$extensions'
20579 extras='$extras'
20580 fflushNULL='$fflushNULL'
20581 fflushall='$fflushall'
20582 find='$find'
20583 firstmakefile='$firstmakefile'
20584 flex='$flex'
20585 fpossize='$fpossize'
20586 fpostype='$fpostype'
20587 freetype='$freetype'
20588 from='$from'
20589 full_ar='$full_ar'
20590 full_csh='$full_csh'
20591 full_sed='$full_sed'
20592 gccansipedantic='$gccansipedantic'
20593 gccosandvers='$gccosandvers'
20594 gccversion='$gccversion'
20595 getgrent_r_proto='$getgrent_r_proto'
20596 getgrgid_r_proto='$getgrgid_r_proto'
20597 getgrnam_r_proto='$getgrnam_r_proto'
20598 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20599 gethostbyname_r_proto='$gethostbyname_r_proto'
20600 gethostent_r_proto='$gethostent_r_proto'
20601 getlogin_r_proto='$getlogin_r_proto'
20602 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20603 getnetbyname_r_proto='$getnetbyname_r_proto'
20604 getnetent_r_proto='$getnetent_r_proto'
20605 getprotobyname_r_proto='$getprotobyname_r_proto'
20606 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20607 getprotoent_r_proto='$getprotoent_r_proto'
20608 getpwent_r_proto='$getpwent_r_proto'
20609 getpwnam_r_proto='$getpwnam_r_proto'
20610 getpwuid_r_proto='$getpwuid_r_proto'
20611 getservbyname_r_proto='$getservbyname_r_proto'
20612 getservbyport_r_proto='$getservbyport_r_proto'
20613 getservent_r_proto='$getservent_r_proto'
20614 getspnam_r_proto='$getspnam_r_proto'
20615 gidformat='$gidformat'
20616 gidsign='$gidsign'
20617 gidsize='$gidsize'
20618 gidtype='$gidtype'
20619 glibpth='$glibpth'
20620 gmake='$gmake'
20621 gmtime_r_proto='$gmtime_r_proto'
20622 gnulibc_version='$gnulibc_version'
20623 grep='$grep'
20624 groupcat='$groupcat'
20625 groupstype='$groupstype'
20626 gzip='$gzip'
20627 h_fcntl='$h_fcntl'
20628 h_sysfile='$h_sysfile'
20629 hint='$hint'
20630 hostcat='$hostcat'
20631 html1dir='$html1dir'
20632 html1direxp='$html1direxp'
20633 html3dir='$html3dir'
20634 html3direxp='$html3direxp'
20635 i16size='$i16size'
20636 i16type='$i16type'
20637 i32size='$i32size'
20638 i32type='$i32type'
20639 i64size='$i64size'
20640 i64type='$i64type'
20641 i8size='$i8size'
20642 i8type='$i8type'
20643 i_arpainet='$i_arpainet'
20644 i_bsdioctl='$i_bsdioctl'
20645 i_crypt='$i_crypt'
20646 i_db='$i_db'
20647 i_dbm='$i_dbm'
20648 i_dirent='$i_dirent'
20649 i_dld='$i_dld'
20650 i_dlfcn='$i_dlfcn'
20651 i_fcntl='$i_fcntl'
20652 i_float='$i_float'
20653 i_fp='$i_fp'
20654 i_fp_class='$i_fp_class'
20655 i_gdbm='$i_gdbm'
20656 i_grp='$i_grp'
20657 i_ieeefp='$i_ieeefp'
20658 i_inttypes='$i_inttypes'
20659 i_langinfo='$i_langinfo'
20660 i_libutil='$i_libutil'
20661 i_limits='$i_limits'
20662 i_locale='$i_locale'
20663 i_machcthr='$i_machcthr'
20664 i_malloc='$i_malloc'
20665 i_math='$i_math'
20666 i_memory='$i_memory'
20667 i_mntent='$i_mntent'
20668 i_ndbm='$i_ndbm'
20669 i_netdb='$i_netdb'
20670 i_neterrno='$i_neterrno'
20671 i_netinettcp='$i_netinettcp'
20672 i_niin='$i_niin'
20673 i_poll='$i_poll'
20674 i_prot='$i_prot'
20675 i_pthread='$i_pthread'
20676 i_pwd='$i_pwd'
20677 i_rpcsvcdbm='$i_rpcsvcdbm'
20678 i_sfio='$i_sfio'
20679 i_sgtty='$i_sgtty'
20680 i_shadow='$i_shadow'
20681 i_socks='$i_socks'
20682 i_stdarg='$i_stdarg'
20683 i_stddef='$i_stddef'
20684 i_stdlib='$i_stdlib'
20685 i_string='$i_string'
20686 i_sunmath='$i_sunmath'
20687 i_sysaccess='$i_sysaccess'
20688 i_sysdir='$i_sysdir'
20689 i_sysfile='$i_sysfile'
20690 i_sysfilio='$i_sysfilio'
20691 i_sysin='$i_sysin'
20692 i_sysioctl='$i_sysioctl'
20693 i_syslog='$i_syslog'
20694 i_sysmman='$i_sysmman'
20695 i_sysmode='$i_sysmode'
20696 i_sysmount='$i_sysmount'
20697 i_sysndir='$i_sysndir'
20698 i_sysparam='$i_sysparam'
20699 i_sysresrc='$i_sysresrc'
20700 i_syssecrt='$i_syssecrt'
20701 i_sysselct='$i_sysselct'
20702 i_syssockio='$i_syssockio'
20703 i_sysstat='$i_sysstat'
20704 i_sysstatfs='$i_sysstatfs'
20705 i_sysstatvfs='$i_sysstatvfs'
20706 i_systime='$i_systime'
20707 i_systimek='$i_systimek'
20708 i_systimes='$i_systimes'
20709 i_systypes='$i_systypes'
20710 i_sysuio='$i_sysuio'
20711 i_sysun='$i_sysun'
20712 i_sysutsname='$i_sysutsname'
20713 i_sysvfs='$i_sysvfs'
20714 i_syswait='$i_syswait'
20715 i_termio='$i_termio'
20716 i_termios='$i_termios'
20717 i_time='$i_time'
20718 i_unistd='$i_unistd'
20719 i_ustat='$i_ustat'
20720 i_utime='$i_utime'
20721 i_values='$i_values'
20722 i_varargs='$i_varargs'
20723 i_varhdr='$i_varhdr'
20724 i_vfork='$i_vfork'
20725 ignore_versioned_solibs='$ignore_versioned_solibs'
20726 inc_version_list='$inc_version_list'
20727 inc_version_list_init='$inc_version_list_init'
20728 incpath='$incpath'
20729 inews='$inews'
20730 installarchlib='$installarchlib'
20731 installbin='$installbin'
20732 installhtml1dir='$installhtml1dir'
20733 installhtml3dir='$installhtml3dir'
20734 installman1dir='$installman1dir'
20735 installman3dir='$installman3dir'
20736 installprefix='$installprefix'
20737 installprefixexp='$installprefixexp'
20738 installprivlib='$installprivlib'
20739 installscript='$installscript'
20740 installsitearch='$installsitearch'
20741 installsitebin='$installsitebin'
20742 installsitehtml1='$installsitehtml1'
20743 installsitehtml3='$installsitehtml3'
20744 installsitelib='$installsitelib'
20745 installsiteman1='$installsiteman1'
20746 installsiteman3='$installsiteman3'
20747 installsitescript='$installsitescript'
20748 installstyle='$installstyle'
20749 installusrbinperl='$installusrbinperl'
20750 installvendorarch='$installvendorarch'
20751 installvendorbin='$installvendorbin'
20752 installvendorhtml1='$installvendorhtml1'
20753 installvendorhtml3='$installvendorhtml3'
20754 installvendorlib='$installvendorlib'
20755 installvendorman1='$installvendorman1'
20756 installvendorman3='$installvendorman3'
20757 installvendorscript='$installvendorscript'
20758 intsize='$intsize'
20759 issymlink='$issymlink'
20760 ivdformat='$ivdformat'
20761 ivsize='$ivsize'
20762 ivtype='$ivtype'
20763 known_extensions='$known_extensions'
20764 ksh='$ksh'
20765 ld='$ld'
20766 lddlflags='$lddlflags'
20767 ldflags='$ldflags'
20768 ldflags_uselargefiles='$ldflags_uselargefiles'
20769 ldlibpthname='$ldlibpthname'
20770 less='$less'
20771 lib_ext='$lib_ext'
20772 libc='$libc'
20773 libperl='$libperl'
20774 libpth='$libpth'
20775 libs='$libs'
20776 libsdirs='$libsdirs'
20777 libsfiles='$libsfiles'
20778 libsfound='$libsfound'
20779 libspath='$libspath'
20780 libswanted='$libswanted'
20781 libswanted_uselargefiles='$libswanted_uselargefiles'
20782 line='$line'
20783 lint='$lint'
20784 lkflags='$lkflags'
20785 ln='$ln'
20786 lns='$lns'
20787 localtime_r_proto='$localtime_r_proto'
20788 locincpth='$locincpth'
20789 loclibpth='$loclibpth'
20790 longdblsize='$longdblsize'
20791 longlongsize='$longlongsize'
20792 longsize='$longsize'
20793 lp='$lp'
20794 lpr='$lpr'
20795 ls='$ls'
20796 lseeksize='$lseeksize'
20797 lseektype='$lseektype'
20798 mail='$mail'
20799 mailx='$mailx'
20800 make='$make'
20801 make_set_make='$make_set_make'
20802 mallocobj='$mallocobj'
20803 mallocsrc='$mallocsrc'
20804 malloctype='$malloctype'
20805 man1dir='$man1dir'
20806 man1direxp='$man1direxp'
20807 man1ext='$man1ext'
20808 man3dir='$man3dir'
20809 man3direxp='$man3direxp'
20810 man3ext='$man3ext'
20811 mips_type='$mips_type'
20812 mkdir='$mkdir'
20813 mmaptype='$mmaptype'
20814 modetype='$modetype'
20815 more='$more'
20816 multiarch='$multiarch'
20817 mv='$mv'
20818 myarchname='$myarchname'
20819 mydomain='$mydomain'
20820 myhostname='$myhostname'
20821 myuname='$myuname'
20822 n='$n'
20823 need_va_copy='$need_va_copy'
20824 netdb_hlen_type='$netdb_hlen_type'
20825 netdb_host_type='$netdb_host_type'
20826 netdb_name_type='$netdb_name_type'
20827 netdb_net_type='$netdb_net_type'
20828 nm='$nm'
20829 nm_opt='$nm_opt'
20830 nm_so_opt='$nm_so_opt'
20831 nonxs_ext='$nonxs_ext'
20832 nroff='$nroff'
20833 nvEUformat='$nvEUformat'
20834 nvFUformat='$nvFUformat'
20835 nvGUformat='$nvGUformat'
20836 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20837 nveformat='$nveformat'
20838 nvfformat='$nvfformat'
20839 nvgformat='$nvgformat'
20840 nvsize='$nvsize'
20841 nvtype='$nvtype'
20842 o_nonblock='$o_nonblock'
20843 obj_ext='$obj_ext'
20844 old_pthread_create_joinable='$old_pthread_create_joinable'
20845 optimize='$optimize'
20846 orderlib='$orderlib'
20847 osname='$osname'
20848 osvers='$osvers'
20849 otherlibdirs='$otherlibdirs'
20850 package='$package'
20851 pager='$pager'
20852 passcat='$passcat'
20853 patchlevel='$patchlevel'
20854 path_sep='$path_sep'
20855 perl5='$perl5'
20856 perl='$perl'
20857 perl_patchlevel='$perl_patchlevel'
20858 perladmin='$perladmin'
20859 perllibs='$perllibs'
20860 perlpath='$perlpath'
20861 pg='$pg'
20862 phostname='$phostname'
20863 pidtype='$pidtype'
20864 plibpth='$plibpth'
20865 pm_apiversion='$pm_apiversion'
20866 pmake='$pmake'
20867 pr='$pr'
20868 prefix='$prefix'
20869 prefixexp='$prefixexp'
20870 privlib='$privlib'
20871 privlibexp='$privlibexp'
20872 procselfexe='$procselfexe'
20873 prototype='$prototype'
20874 ptrsize='$ptrsize'
20875 quadkind='$quadkind'
20876 quadtype='$quadtype'
20877 randbits='$randbits'
20878 randfunc='$randfunc'
20879 random_r_proto='$random_r_proto'
20880 randseedtype='$randseedtype'
20881 ranlib='$ranlib'
20882 rd_nodata='$rd_nodata'
20883 readdir64_r_proto='$readdir64_r_proto'
20884 readdir_r_proto='$readdir_r_proto'
20885 revision='$revision'
20886 rm='$rm'
20887 rmail='$rmail'
20888 run='$run'
20889 runnm='$runnm'
20890 sPRIEUldbl='$sPRIEUldbl'
20891 sPRIFUldbl='$sPRIFUldbl'
20892 sPRIGUldbl='$sPRIGUldbl'
20893 sPRIXU64='$sPRIXU64'
20894 sPRId64='$sPRId64'
20895 sPRIeldbl='$sPRIeldbl'
20896 sPRIfldbl='$sPRIfldbl'
20897 sPRIgldbl='$sPRIgldbl'
20898 sPRIi64='$sPRIi64'
20899 sPRIo64='$sPRIo64'
20900 sPRIu64='$sPRIu64'
20901 sPRIx64='$sPRIx64'
20902 sSCNfldbl='$sSCNfldbl'
20903 sched_yield='$sched_yield'
20904 scriptdir='$scriptdir'
20905 scriptdirexp='$scriptdirexp'
20906 sed='$sed'
20907 seedfunc='$seedfunc'
20908 selectminbits='$selectminbits'
20909 selecttype='$selecttype'
20910 sendmail='$sendmail'
20911 setgrent_r_proto='$setgrent_r_proto'
20912 sethostent_r_proto='$sethostent_r_proto'
20913 setlocale_r_proto='$setlocale_r_proto'
20914 setnetent_r_proto='$setnetent_r_proto'
20915 setprotoent_r_proto='$setprotoent_r_proto'
20916 setpwent_r_proto='$setpwent_r_proto'
20917 setservent_r_proto='$setservent_r_proto'
20918 sh='$sh'
20919 shar='$shar'
20920 sharpbang='$sharpbang'
20921 shmattype='$shmattype'
20922 shortsize='$shortsize'
20923 shrpenv='$shrpenv'
20924 shsharp='$shsharp'
20925 sig_count='$sig_count'
20926 sig_name='$sig_name'
20927 sig_name_init='$sig_name_init'
20928 sig_num='$sig_num'
20929 sig_num_init='$sig_num_init'
20930 sig_size='$sig_size'
20931 signal_t='$signal_t'
20932 sitearch='$sitearch'
20933 sitearchexp='$sitearchexp'
20934 sitebin='$sitebin'
20935 sitebinexp='$sitebinexp'
20936 sitehtml1='$sitehtml1'
20937 sitehtml1exp='$sitehtml1exp'
20938 sitehtml3='$sitehtml3'
20939 sitehtml3exp='$sitehtml3exp'
20940 sitelib='$sitelib'
20941 sitelib_stem='$sitelib_stem'
20942 sitelibexp='$sitelibexp'
20943 siteman1='$siteman1'
20944 siteman1exp='$siteman1exp'
20945 siteman3='$siteman3'
20946 siteman3exp='$siteman3exp'
20947 siteprefix='$siteprefix'
20948 siteprefixexp='$siteprefixexp'
20949 sitescript='$sitescript'
20950 sitescriptexp='$sitescriptexp'
20951 sizesize='$sizesize'
20952 sizetype='$sizetype'
20953 sleep='$sleep'
20954 smail='$smail'
20955 so='$so'
20956 sockethdr='$sockethdr'
20957 socketlib='$socketlib'
20958 socksizetype='$socksizetype'
20959 sort='$sort'
20960 spackage='$spackage'
20961 spitshell='$spitshell'
20962 srand48_r_proto='$srand48_r_proto'
20963 srandom_r_proto='$srandom_r_proto'
20964 src='$src'
20965 ssizetype='$ssizetype'
20966 startperl='$startperl'
20967 startsh='$startsh'
20968 static_ext='$static_ext'
20969 stdchar='$stdchar'
20970 stdio_base='$stdio_base'
20971 stdio_bufsiz='$stdio_bufsiz'
20972 stdio_cnt='$stdio_cnt'
20973 stdio_filbuf='$stdio_filbuf'
20974 stdio_ptr='$stdio_ptr'
20975 stdio_stream_array='$stdio_stream_array'
20976 strerror_r_proto='$strerror_r_proto'
20977 strings='$strings'
20978 submit='$submit'
20979 subversion='$subversion'
20980 sysman='$sysman'
20981 tail='$tail'
20982 tar='$tar'
20983 targetarch='$targetarch'
20984 tbl='$tbl'
20985 tee='$tee'
20986 test='$test'
20987 timeincl='$timeincl'
20988 timetype='$timetype'
20989 tmpnam_r_proto='$tmpnam_r_proto'
20990 to='$to'
20991 touch='$touch'
20992 tr='$tr'
20993 trnl='$trnl'
20994 troff='$troff'
20995 ttyname_r_proto='$ttyname_r_proto'
20996 u16size='$u16size'
20997 u16type='$u16type'
20998 u32size='$u32size'
20999 u32type='$u32type'
21000 u64size='$u64size'
21001 u64type='$u64type'
21002 u8size='$u8size'
21003 u8type='$u8type'
21004 uidformat='$uidformat'
21005 uidsign='$uidsign'
21006 uidsize='$uidsize'
21007 uidtype='$uidtype'
21008 uname='$uname'
21009 uniq='$uniq'
21010 uquadtype='$uquadtype'
21011 use5005threads='$use5005threads'
21012 use64bitall='$use64bitall'
21013 use64bitint='$use64bitint'
21014 usecrosscompile='$usecrosscompile'
21015 usedl='$usedl'
21016 useithreads='$useithreads'
21017 uselargefiles='$uselargefiles'
21018 uselongdouble='$uselongdouble'
21019 usemorebits='$usemorebits'
21020 usemultiplicity='$usemultiplicity'
21021 usemymalloc='$usemymalloc'
21022 usenm='$usenm'
21023 useopcode='$useopcode'
21024 useperlio='$useperlio'
21025 useposix='$useposix'
21026 usereentrant='$usereentrant'
21027 usesfio='$usesfio'
21028 useshrplib='$useshrplib'
21029 usesocks='$usesocks'
21030 usethreads='$usethreads'
21031 usevendorprefix='$usevendorprefix'
21032 usevfork='$usevfork'
21033 usrinc='$usrinc'
21034 uuname='$uuname'
21035 uvXUformat='$uvXUformat'
21036 uvoformat='$uvoformat'
21037 uvsize='$uvsize'
21038 uvtype='$uvtype'
21039 uvuformat='$uvuformat'
21040 uvxformat='$uvxformat'
21041 vendorarch='$vendorarch'
21042 vendorarchexp='$vendorarchexp'
21043 vendorbin='$vendorbin'
21044 vendorbinexp='$vendorbinexp'
21045 vendorhtml1='$vendorhtml1'
21046 vendorhtml1exp='$vendorhtml1exp'
21047 vendorhtml3='$vendorhtml3'
21048 vendorhtml3exp='$vendorhtml3exp'
21049 vendorlib='$vendorlib'
21050 vendorlib_stem='$vendorlib_stem'
21051 vendorlibexp='$vendorlibexp'
21052 vendorman1='$vendorman1'
21053 vendorman1exp='$vendorman1exp'
21054 vendorman3='$vendorman3'
21055 vendorman3exp='$vendorman3exp'
21056 vendorprefix='$vendorprefix'
21057 vendorprefixexp='$vendorprefixexp'
21058 vendorscript='$vendorscript'
21059 vendorscriptexp='$vendorscriptexp'
21060 version='$version'
21061 version_patchlevel_string='$version_patchlevel_string'
21062 versiononly='$versiononly'
21063 vi='$vi'
21064 voidflags='$voidflags'
21065 xlibpth='$xlibpth'
21066 xs_apiversion='$xs_apiversion'
21067 yacc='$yacc'
21068 yaccflags='$yaccflags'
21069 zcat='$zcat'
21070 zip='$zip'
21071 EOT
21072
21073 : Add in command line options if available
21074 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21075
21076 : add special variables
21077 $test -f $src/patchlevel.h && \
21078 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21079 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21080 echo "PERL_CONFIG_SH=true" >>config.sh
21081
21082 : propagate old symbols
21083 if $test -f UU/config.sh; then
21084         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21085         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21086         $sort | $uniq -u >UU/oldsyms
21087         set X `cat UU/oldsyms`
21088         shift
21089         case $# in
21090         0) ;;
21091         *)
21092                 cat <<EOM
21093 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21094 EOM
21095                 echo "# Variables propagated from previous config.sh file." >>config.sh
21096                 for sym in `cat UU/oldsyms`; do
21097                         echo "    Propagating $hint variable "'$'"$sym..."
21098                         eval 'tmp="$'"${sym}"'"'
21099                         echo "$tmp" | \
21100                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21101                 done
21102                 ;;
21103         esac
21104 fi
21105
21106 : Finish up by extracting the .SH files
21107 case "$alldone" in
21108 exit)
21109         $rm -rf UU
21110         echo "Extraction done."
21111         exit 0
21112         ;;
21113 cont)
21114         ;;
21115 '')
21116         dflt=''
21117         nostick=true
21118         $cat <<EOM
21119
21120 If you'd like to make any changes to the config.sh file before I begin
21121 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21122
21123 EOM
21124         rp="Press return or use a shell escape to edit config.sh:"
21125         . UU/myread
21126         nostick=''
21127         case "$ans" in
21128         '') ;;
21129         *) : in case they cannot read
21130                 sh 1>&4 -c "$ans";;
21131         esac
21132         ;;
21133 esac
21134
21135 : if this fails, just run all the .SH files by hand
21136 . ./config.sh
21137
21138 echo " "
21139 exec 1>&4
21140 pwd=`pwd`
21141 . ./UU/extract
21142 cd "$pwd"
21143
21144 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21145         dflt=y
21146         case "$silent" in
21147         true) ;;
21148         *)
21149                 $cat <<EOM
21150
21151 Now you need to generate make dependencies by running "$make depend".
21152 You might prefer to run it in background: "$make depend > makedepend.out &"
21153 It can take a while, so you might not want to run it right now.
21154
21155 EOM
21156                 ;;
21157         esac
21158         rp="Run $make depend now?"
21159         . UU/myread
21160         case "$ans" in
21161         y*)
21162                 $make depend && echo "Now you must run '$make'."
21163                 ;;
21164         *)
21165                 echo "You must run '$make depend' then '$make'."
21166                 ;;
21167         esac
21168 elif test -f [Mm]akefile; then
21169         echo " "
21170         echo "Now you must run a $make."
21171 else
21172         echo "Configure done."
21173 fi
21174
21175 if $test -f Policy.sh; then
21176     $cat <<EOM
21177
21178 If you compile $package on a different machine or from a different object
21179 directory, copy the Policy.sh file from this object directory to the
21180 new one before you run Configure -- this will help you with most of
21181 the policy defaults.
21182
21183 EOM
21184 fi
21185 if $test -f config.msg; then
21186     echo "Hmm.  I also noted the following information while running:"
21187     echo " "
21188     $cat config.msg >&4
21189     $rm -f config.msg
21190 fi
21191 $rm -f kit*isdone ark*isdone
21192 $rm -rf UU
21193
21194 : End of Configure
21195