Integrate perlio:
[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 Apr  9 18:44:25 EET DST 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 bincompat5005=''
305 d_bincompat5005=''
306 byteorder=''
307 cc=''
308 ccflags=''
309 cppflags=''
310 ldflags=''
311 lkflags=''
312 locincpth=''
313 optimize=''
314 cf_email=''
315 cf_by=''
316 cf_time=''
317 charsize=''
318 contains=''
319 cpp_stuff=''
320 cpplast=''
321 cppminus=''
322 cpprun=''
323 cppstdin=''
324 d__fwalk=''
325 d_access=''
326 d_accessx=''
327 d_alarm=''
328 asctime_r_proto=''
329 d_asctime_r=''
330 d_attribut=''
331 d_bcmp=''
332 d_bcopy=''
333 d_bzero=''
334 d_casti32=''
335 castflags=''
336 d_castneg=''
337 d_chown=''
338 d_chroot=''
339 d_chsize=''
340 d_class=''
341 d_closedir=''
342 d_void_closedir=''
343 d_cmsghdr_s=''
344 d_const=''
345 cryptlib=''
346 d_crypt=''
347 crypt_r_proto=''
348 d_crypt_r=''
349 d_csh=''
350 full_csh=''
351 ctermid_r_proto=''
352 d_ctermid_r=''
353 ctime_r_proto=''
354 d_ctime_r=''
355 d_cuserid=''
356 d_dbl_dig=''
357 d_dbminitproto=''
358 d_difftime=''
359 d_dirfd=''
360 d_dlerror=''
361 d_dlopen=''
362 d_dlsymun=''
363 d_dosuid=''
364 d_suidsafe=''
365 d_drand48_r=''
366 drand48_r_proto=''
367 d_drand48proto=''
368 d_dup2=''
369 d_eaccess=''
370 d_endgrent=''
371 d_endgrent_r=''
372 endgrent_r_proto=''
373 d_endhent=''
374 d_endhostent_r=''
375 endhostent_r_proto=''
376 d_endnent=''
377 d_endnetent_r=''
378 endnetent_r_proto=''
379 d_endpent=''
380 d_endprotoent_r=''
381 endprotoent_r_proto=''
382 d_endpwent=''
383 d_endpwent_r=''
384 endpwent_r_proto=''
385 d_endsent=''
386 d_endservent_r=''
387 endservent_r_proto=''
388 d_fchdir=''
389 d_fchmod=''
390 d_fchown=''
391 d_fcntl=''
392 d_fcntl_can_lock=''
393 d_fd_macros=''
394 d_fd_set=''
395 d_fds_bits=''
396 d_fgetpos=''
397 d_finite=''
398 d_finitel=''
399 d_flexfnam=''
400 d_flock=''
401 d_flockproto=''
402 d_fork=''
403 d_fp_class=''
404 d_fpclass=''
405 d_fpclassify=''
406 d_fpclassl=''
407 d_fpos64_t=''
408 d_frexpl=''
409 d_fs_data_s=''
410 d_fseeko=''
411 d_fsetpos=''
412 d_fstatfs=''
413 d_fsync=''
414 d_ftello=''
415 d_ftime=''
416 d_gettimeod=''
417 d_Gconvert=''
418 d_getcwd=''
419 d_getespwnam=''
420 d_getfsstat=''
421 d_getgrent=''
422 d_getgrent_r=''
423 getgrent_r_proto=''
424 d_getgrgid_r=''
425 getgrgid_r_proto=''
426 d_getgrnam_r=''
427 getgrnam_r_proto=''
428 d_getgrps=''
429 d_gethbyaddr=''
430 d_gethbyname=''
431 d_gethent=''
432 aphostname=''
433 d_gethname=''
434 d_phostname=''
435 d_uname=''
436 d_gethostbyaddr_r=''
437 gethostbyaddr_r_proto=''
438 d_gethostbyname_r=''
439 gethostbyname_r_proto=''
440 d_gethostent_r=''
441 gethostent_r_proto=''
442 d_gethostprotos=''
443 d_getitimer=''
444 d_getlogin=''
445 d_getlogin_r=''
446 getlogin_r_proto=''
447 d_getmnt=''
448 d_getmntent=''
449 d_getnbyaddr=''
450 d_getnbyname=''
451 d_getnent=''
452 d_getnetbyaddr_r=''
453 getnetbyaddr_r_proto=''
454 d_getnetbyname_r=''
455 getnetbyname_r_proto=''
456 d_getnetent_r=''
457 getnetent_r_proto=''
458 d_getnetprotos=''
459 d_getpagsz=''
460 d_getpent=''
461 d_getpgid=''
462 d_getpgrp2=''
463 d_bsdgetpgrp=''
464 d_getpgrp=''
465 d_getppid=''
466 d_getprior=''
467 d_getpbyname=''
468 d_getpbynumber=''
469 d_getprotobyname_r=''
470 getprotobyname_r_proto=''
471 d_getprotobynumber_r=''
472 getprotobynumber_r_proto=''
473 d_getprotoent_r=''
474 getprotoent_r_proto=''
475 d_getprotoprotos=''
476 d_getprpwnam=''
477 d_getpwent=''
478 d_getpwent_r=''
479 getpwent_r_proto=''
480 d_getpwnam_r=''
481 getpwnam_r_proto=''
482 d_getpwuid_r=''
483 getpwuid_r_proto=''
484 d_getsent=''
485 d_getservbyname_r=''
486 getservbyname_r_proto=''
487 d_getservbyport_r=''
488 getservbyport_r_proto=''
489 d_getservent_r=''
490 getservent_r_proto=''
491 d_getservprotos=''
492 d_getspnam=''
493 d_getspnam_r=''
494 getspnam_r_proto=''
495 d_getsbyname=''
496 d_getsbyport=''
497 d_gmtime_r=''
498 gmtime_r_proto=''
499 d_gnulibc=''
500 d_hasmntopt=''
501 d_htonl=''
502 d_inetaton=''
503 d_int64_t=''
504 d_isascii=''
505 d_isfinite=''
506 d_isinf=''
507 d_isnan=''
508 d_isnanl=''
509 d_killpg=''
510 d_lchown=''
511 d_ldbl_dig=''
512 d_link=''
513 d_localtime_r=''
514 localtime_r_proto=''
515 d_locconv=''
516 d_lockf=''
517 d_longdbl=''
518 longdblsize=''
519 d_longlong=''
520 longlongsize=''
521 d_lseekproto=''
522 d_lstat=''
523 d_madvise=''
524 d_mblen=''
525 d_mbstowcs=''
526 d_mbtowc=''
527 d_memchr=''
528 d_memcmp=''
529 d_memcpy=''
530 d_memmove=''
531 d_memset=''
532 d_mkdir=''
533 d_mkdtemp=''
534 d_mkfifo=''
535 d_mkstemp=''
536 d_mkstemps=''
537 d_mktime=''
538 d_mmap=''
539 mmaptype=''
540 d_modfl=''
541 d_modfl_pow32_bug=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nice=''
552 d_nl_langinfo=''
553 d_off64_t=''
554 d_open3=''
555 d_fpathconf=''
556 d_pathconf=''
557 d_pause=''
558 d_pipe=''
559 d_poll=''
560 d_portable=''
561 d_procselfexe=''
562 procselfexe=''
563 d_old_pthread_create_joinable=''
564 old_pthread_create_joinable=''
565 d_pthread_atfork=''
566 d_pthread_yield=''
567 d_sched_yield=''
568 sched_yield=''
569 d_qgcvt=''
570 d_random_r=''
571 random_r_proto=''
572 d_readdir64_r=''
573 readdir64_r_proto=''
574 d_readdir=''
575 d_rewinddir=''
576 d_seekdir=''
577 d_telldir=''
578 d_readdir_r=''
579 readdir_r_proto=''
580 d_readlink=''
581 d_readv=''
582 d_recvmsg=''
583 d_rename=''
584 d_rmdir=''
585 d_safebcpy=''
586 d_safemcpy=''
587 d_sanemcmp=''
588 d_sbrkproto=''
589 d_select=''
590 d_sem=''
591 d_semctl=''
592 d_semget=''
593 d_semop=''
594 d_sendmsg=''
595 d_setegid=''
596 d_seteuid=''
597 d_setgrent=''
598 d_setgrent_r=''
599 setgrent_r_proto=''
600 d_setgrps=''
601 d_sethent=''
602 d_sethostent_r=''
603 sethostent_r_proto=''
604 d_setitimer=''
605 d_setlinebuf=''
606 d_setlocale=''
607 d_setlocale_r=''
608 setlocale_r_proto=''
609 d_setnent=''
610 d_setnetent_r=''
611 setnetent_r_proto=''
612 d_setpent=''
613 d_setpgid=''
614 d_setpgrp2=''
615 d_bsdsetpgrp=''
616 d_setpgrp=''
617 d_setprior=''
618 d_setproctitle=''
619 d_setprotoent_r=''
620 setprotoent_r_proto=''
621 d_setpwent=''
622 d_setpwent_r=''
623 setpwent_r_proto=''
624 d_setregid=''
625 d_setresgid=''
626 d_setresuid=''
627 d_setreuid=''
628 d_setrgid=''
629 d_setruid=''
630 d_setsent=''
631 d_setservent_r=''
632 setservent_r_proto=''
633 d_setsid=''
634 d_setvbuf=''
635 d_sfio=''
636 usesfio=''
637 d_shm=''
638 d_shmat=''
639 d_shmatprototype=''
640 shmattype=''
641 d_shmctl=''
642 d_shmdt=''
643 d_shmget=''
644 d_sigaction=''
645 d_sigprocmask=''
646 d_sigsetjmp=''
647 d_sockatmark=''
648 d_sockatmarkproto=''
649 d_msg_ctrunc=''
650 d_msg_dontroute=''
651 d_msg_oob=''
652 d_msg_peek=''
653 d_msg_proxy=''
654 d_oldsock=''
655 d_scm_rights=''
656 d_socket=''
657 d_sockpair=''
658 sockethdr=''
659 socketlib=''
660 d_socklen_t=''
661 d_socks5_init=''
662 d_sqrtl=''
663 d_srand48_r=''
664 srand48_r_proto=''
665 d_srandom_r=''
666 srandom_r_proto=''
667 d_sresgproto=''
668 d_sresuproto=''
669 d_statblks=''
670 d_statfs_f_flags=''
671 d_statfs_s=''
672 d_fstatvfs=''
673 d_statvfs=''
674 d_stdio_cnt_lval=''
675 d_stdio_ptr_lval=''
676 d_stdio_ptr_lval_nochange_cnt=''
677 d_stdio_ptr_lval_sets_cnt=''
678 d_stdiobase=''
679 d_stdstdio=''
680 stdio_base=''
681 stdio_bufsiz=''
682 stdio_cnt=''
683 stdio_filbuf=''
684 stdio_ptr=''
685 d_index=''
686 d_strchr=''
687 d_strcoll=''
688 d_strctcpy=''
689 d_strerrm=''
690 d_strerror=''
691 d_sysernlst=''
692 d_syserrlst=''
693 d_strerror_r=''
694 strerror_r_proto=''
695 d_strftime=''
696 d_strtod=''
697 d_strtol=''
698 d_strtold=''
699 d_strtoll=''
700 d_strtoq=''
701 d_strtoul=''
702 d_strtoull=''
703 d_strtouq=''
704 d_strxfrm=''
705 d_symlink=''
706 d_syscall=''
707 d_syscallproto=''
708 d_sysconf=''
709 d_system=''
710 d_tcgetpgrp=''
711 d_tcsetpgrp=''
712 d_telldirproto=''
713 d_time=''
714 timetype=''
715 clocktype=''
716 d_times=''
717 d_tmpnam_r=''
718 tmpnam_r_proto=''
719 d_truncate=''
720 d_ttyname_r=''
721 ttyname_r_proto=''
722 d_tzname=''
723 d_u32align=''
724 d_ualarm=''
725 d_umask=''
726 d_semctl_semid_ds=''
727 d_semctl_semun=''
728 d_union_semun=''
729 d_unordered=''
730 d_usleep=''
731 d_usleepproto=''
732 d_ustat=''
733 d_vfork=''
734 usevfork=''
735 d_voidsig=''
736 signal_t=''
737 d_volatile=''
738 d_charvspr=''
739 d_vprintf=''
740 d_wait4=''
741 d_waitpid=''
742 d_wcstombs=''
743 d_wctomb=''
744 d_writev=''
745 dlext=''
746 cccdlflags=''
747 ccdlflags=''
748 dlsrc=''
749 ld=''
750 lddlflags=''
751 usedl=''
752 doublesize=''
753 ebcdic=''
754 fflushNULL=''
755 fflushall=''
756 fpossize=''
757 fpostype=''
758 gccosandvers=''
759 gccversion=''
760 gidformat=''
761 gidsign=''
762 gidsize=''
763 gidtype=''
764 groupstype=''
765 h_fcntl=''
766 h_sysfile=''
767 i_arpainet=''
768 i_crypt=''
769 db_hashtype=''
770 db_prefixtype=''
771 db_version_major=''
772 db_version_minor=''
773 db_version_patch=''
774 i_db=''
775 i_dbm=''
776 i_rpcsvcdbm=''
777 d_dirnamlen=''
778 direntrytype=''
779 i_dirent=''
780 i_dld=''
781 i_dlfcn=''
782 i_fcntl=''
783 i_float=''
784 i_fp=''
785 i_fp_class=''
786 i_gdbm=''
787 d_grpasswd=''
788 i_grp=''
789 i_ieeefp=''
790 i_inttypes=''
791 i_langinfo=''
792 i_libutil=''
793 i_limits=''
794 i_locale=''
795 i_machcthr=''
796 i_malloc=''
797 i_math=''
798 i_memory=''
799 i_mntent=''
800 i_ndbm=''
801 i_netdb=''
802 i_neterrno=''
803 i_netinettcp=''
804 i_niin=''
805 i_sysin=''
806 i_poll=''
807 i_prot=''
808 i_pthread=''
809 d_pwage=''
810 d_pwchange=''
811 d_pwclass=''
812 d_pwcomment=''
813 d_pwexpire=''
814 d_pwgecos=''
815 d_pwpasswd=''
816 d_pwquota=''
817 i_pwd=''
818 i_sfio=''
819 i_shadow=''
820 i_socks=''
821 i_stddef=''
822 i_stdlib=''
823 i_string=''
824 strings=''
825 i_sunmath=''
826 i_sysaccess=''
827 i_sysdir=''
828 i_sysfile=''
829 d_voidtty=''
830 i_bsdioctl=''
831 i_sysfilio=''
832 i_sysioctl=''
833 i_syssockio=''
834 i_syslog=''
835 i_sysmman=''
836 i_sysmode=''
837 i_sysmount=''
838 i_sysndir=''
839 i_sysparam=''
840 i_sysresrc=''
841 i_syssecrt=''
842 i_sysselct=''
843 i_sysstat=''
844 i_sysstatfs=''
845 i_sysstatvfs=''
846 i_systimes=''
847 i_systypes=''
848 i_sysuio=''
849 i_sysun=''
850 i_sysutsname=''
851 i_sysvfs=''
852 i_syswait=''
853 i_sgtty=''
854 i_termio=''
855 i_termios=''
856 d_tm_tm_gmtoff=''
857 d_tm_tm_zone=''
858 i_systime=''
859 i_systimek=''
860 i_time=''
861 timeincl=''
862 i_unistd=''
863 i_ustat=''
864 i_utime=''
865 i_values=''
866 i_stdarg=''
867 i_varargs=''
868 i_varhdr=''
869 i_vfork=''
870 inc_version_list=''
871 inc_version_list_init=''
872 installprefix=''
873 installprefixexp=''
874 installstyle=''
875 installusrbinperl=''
876 intsize=''
877 longsize=''
878 shortsize=''
879 issymlink=''
880 libc=''
881 ldlibpthname=''
882 libperl=''
883 shrpenv=''
884 useshrplib=''
885 glibpth=''
886 libpth=''
887 loclibpth=''
888 plibpth=''
889 xlibpth=''
890 ignore_versioned_solibs=''
891 libs=''
892 libsdirs=''
893 libsfiles=''
894 libsfound=''
895 libspath=''
896 lns=''
897 d_PRIEUldbl=''
898 d_PRIFUldbl=''
899 d_PRIGUldbl=''
900 d_PRIeldbl=''
901 d_PRIfldbl=''
902 d_PRIgldbl=''
903 d_SCNfldbl=''
904 sPRIEUldbl=''
905 sPRIFUldbl=''
906 sPRIGUldbl=''
907 sPRIeldbl=''
908 sPRIfldbl=''
909 sPRIgldbl=''
910 sSCNfldbl=''
911 lseeksize=''
912 lseektype=''
913 make_set_make=''
914 d_mymalloc=''
915 freetype=''
916 mallocobj=''
917 mallocsrc=''
918 malloctype=''
919 usemymalloc=''
920 installman1dir=''
921 man1dir=''
922 man1direxp=''
923 man1ext=''
924 installman3dir=''
925 man3dir=''
926 man3direxp=''
927 man3ext=''
928 modetype=''
929 multiarch=''
930 mydomain=''
931 myhostname=''
932 phostname=''
933 c=''
934 n=''
935 d_eofnblk=''
936 eagain=''
937 o_nonblock=''
938 rd_nodata=''
939 need_va_copy=''
940 netdb_hlen_type=''
941 netdb_host_type=''
942 netdb_name_type=''
943 netdb_net_type=''
944 groupcat=''
945 hostcat=''
946 passcat=''
947 orderlib=''
948 ranlib=''
949 d_perl_otherlibdirs=''
950 otherlibdirs=''
951 package=''
952 spackage=''
953 pager=''
954 api_revision=''
955 api_subversion=''
956 api_version=''
957 api_versionstring=''
958 patchlevel=''
959 perl_patchlevel=''
960 revision=''
961 subversion=''
962 version=''
963 version_patchlevel_string=''
964 perl5=''
965 perladmin=''
966 perlpath=''
967 d_nv_preserves_uv=''
968 i16size=''
969 i16type=''
970 i32size=''
971 i32type=''
972 i64size=''
973 i64type=''
974 i8size=''
975 i8type=''
976 ivsize=''
977 ivtype=''
978 nv_preserves_uv_bits=''
979 nvsize=''
980 nvtype=''
981 u16size=''
982 u16type=''
983 u32size=''
984 u32type=''
985 u64size=''
986 u64type=''
987 u8size=''
988 u8type=''
989 uvsize=''
990 uvtype=''
991 ivdformat=''
992 nvEUformat=''
993 nvFUformat=''
994 nvGUformat=''
995 nveformat=''
996 nvfformat=''
997 nvgformat=''
998 uvXUformat=''
999 uvoformat=''
1000 uvuformat=''
1001 uvxformat=''
1002 pidtype=''
1003 prefix=''
1004 prefixexp=''
1005 installprivlib=''
1006 privlib=''
1007 privlibexp=''
1008 prototype=''
1009 ptrsize=''
1010 d_PRIXU64=''
1011 d_PRId64=''
1012 d_PRIi64=''
1013 d_PRIo64=''
1014 d_PRIu64=''
1015 d_PRIx64=''
1016 sPRIXU64=''
1017 sPRId64=''
1018 sPRIi64=''
1019 sPRIo64=''
1020 sPRIu64=''
1021 sPRIx64=''
1022 d_quad=''
1023 quadkind=''
1024 quadtype=''
1025 uquadtype=''
1026 drand01=''
1027 randbits=''
1028 randfunc=''
1029 randseedtype=''
1030 seedfunc=''
1031 installscript=''
1032 scriptdir=''
1033 scriptdirexp=''
1034 selectminbits=''
1035 selecttype=''
1036 sh=''
1037 sig_count=''
1038 sig_name=''
1039 sig_name_init=''
1040 sig_num=''
1041 sig_num_init=''
1042 sig_size=''
1043 installsitearch=''
1044 sitearch=''
1045 sitearchexp=''
1046 installsitebin=''
1047 sitebin=''
1048 sitebinexp=''
1049 installsitelib=''
1050 sitelib=''
1051 sitelib_stem=''
1052 sitelibexp=''
1053 siteprefix=''
1054 siteprefixexp=''
1055 sizesize=''
1056 sizetype=''
1057 so=''
1058 socksizetype=''
1059 sharpbang=''
1060 shsharp=''
1061 spitshell=''
1062 src=''
1063 ssizetype=''
1064 startperl=''
1065 startsh=''
1066 stdchar=''
1067 d_stdio_stream_array=''
1068 stdio_stream_array=''
1069 sysman=''
1070 trnl=''
1071 uidformat=''
1072 uidsign=''
1073 uidsize=''
1074 uidtype=''
1075 archname64=''
1076 use64bitall=''
1077 use64bitint=''
1078 ccflags_uselargefiles=''
1079 ldflags_uselargefiles=''
1080 libswanted_uselargefiles=''
1081 uselargefiles=''
1082 uselongdouble=''
1083 usemorebits=''
1084 usemultiplicity=''
1085 nm_opt=''
1086 nm_so_opt=''
1087 runnm=''
1088 usenm=''
1089 useperlio=''
1090 usesocks=''
1091 d_oldpthreads=''
1092 use5005threads=''
1093 useithreads=''
1094 usereentrant=''
1095 usethreads=''
1096 incpath=''
1097 mips_type=''
1098 usrinc=''
1099 d_vendorarch=''
1100 installvendorarch=''
1101 vendorarch=''
1102 vendorarchexp=''
1103 d_vendorbin=''
1104 installvendorbin=''
1105 vendorbin=''
1106 vendorbinexp=''
1107 d_vendorlib=''
1108 installvendorlib=''
1109 vendorlib=''
1110 vendorlib_stem=''
1111 vendorlibexp=''
1112 usevendorprefix=''
1113 vendorprefix=''
1114 vendorprefixexp=''
1115 versiononly=''
1116 defvoidused=''
1117 voidflags=''
1118 pm_apiversion=''
1119 xs_apiversion=''
1120 yacc=''
1121 yaccflags=''
1122 CONFIG=''
1123
1124 define='define'
1125 undef='undef'
1126 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1127 rmlist=''
1128
1129 : We must find out about Eunice early
1130 eunicefix=':'
1131 if test -f /etc/unixtovms; then
1132         eunicefix=/etc/unixtovms
1133 fi
1134 if test -f /etc/unixtovms.exe; then
1135         eunicefix=/etc/unixtovms.exe
1136 fi
1137
1138 : Set executable suffix now -- needed before hints available
1139 if test -f "/libs/version.library"; then
1140 : Amiga OS
1141     _exe=""
1142 elif test -f "/system/gnu_library/bin/ar.pm"; then
1143 : Stratus VOS
1144     _exe=".pm"
1145 elif test -n "$DJGPP"; then
1146 : DOS DJGPP
1147     _exe=".exe"
1148 elif test -d c:/. ; then
1149 : OS/2 or cygwin
1150     _exe=".exe"
1151 fi
1152
1153 i_whoami=''
1154 ccname=''
1155 ccversion=''
1156 perllibs=''
1157 : set useposix=false in your hint file to disable the POSIX extension.
1158 useposix=true
1159 : set useopcode=false in your hint file to disable the Opcode extension.
1160 useopcode=true
1161 : Trailing extension.  Override this in a hint file, if needed.
1162 : Extra object files, if any, needed on this platform.
1163 archobjs=''
1164 archname=''
1165 : Possible local include directories to search.
1166 : Set locincpth to "" in a hint file to defeat local include searches.
1167 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1168 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1169 :
1170 : no include file wanted by default
1171 inclwanted=''
1172
1173 groupstype=''
1174 libnames=''
1175 : change the next line if compiling for Xenix/286 on Xenix/386
1176 xlibpth='/usr/lib/386 /lib/386'
1177 : Possible local library directories to search.
1178 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1179 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1180
1181 : general looking path for locating libraries
1182 glibpth="/lib /usr/lib $xlibpth"
1183 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1184 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1185 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1186
1187 : Private path used by Configure to find libraries.  Its value
1188 : is prepended to libpth. This variable takes care of special
1189 : machines, like the mips.  Usually, it should be empty.
1190 plibpth=''
1191
1192 : default library list
1193 libswanted=''
1194 : some systems want to use only the non-versioned libso:s
1195 ignore_versioned_solibs=''
1196 archname64=''
1197 ccflags_uselargefiles=''
1198 ldflags_uselargefiles=''
1199 libswanted_uselargefiles=''
1200 : set usemultiplicity on the Configure command line to enable multiplicity.
1201 : set usesocks on the Configure command line to enable socks.
1202 : set usethreads on the Configure command line to enable threads.
1203 usereentrant='undef'
1204 : full support for void wanted by default
1205 defvoidused=15
1206
1207 : List of libraries we want.
1208 : If anyone needs -lnet, put it in a hint file.
1209 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1210 libswanted="$libswanted dld ld sun m c cposix posix"
1211 libswanted="$libswanted ndir dir crypt sec"
1212 libswanted="$libswanted ucb bsd BSD PW x util"
1213 : We probably want to search /usr/shlib before most other libraries.
1214 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1215 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1216 glibpth="/usr/shlib $glibpth"
1217 : Do not use vfork unless overridden by a hint file.
1218 usevfork=false
1219
1220 : Find the basic shell for Bourne shell scripts
1221 case "$sh" in
1222 '')
1223         case "$SYSTYPE" in
1224         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1225         *) xxx='/bin/sh';;
1226         esac
1227         if test -f "$xxx"; then
1228                 sh="$xxx"
1229         else
1230                 : Build up a list and do a single loop so we can 'break' out.
1231                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1232                 for xxx in sh bash ksh pdksh ash; do
1233                         for p in $pth; do
1234                                 try="$try ${p}/${xxx}"
1235                         done
1236                 done
1237                 for xxx in $try; do
1238                         if test -f "$xxx"; then
1239                                 sh="$xxx";
1240                                 break
1241                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1242                                 sh="$xxx";
1243                                 break
1244                         elif test -f "$xxx.exe"; then
1245                                 sh="$xxx";
1246                                 break
1247                         fi
1248                 done
1249         fi
1250         ;;
1251 esac
1252
1253 case "$sh" in
1254 '')     cat >&2 <<EOM
1255 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1256
1257 Usually it's in /bin/sh.  How did you even get this far?
1258 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1259 we'll try to straighten this all out.
1260 EOM
1261         exit 1
1262         ;;
1263 esac
1264
1265 : see if sh knows # comments
1266 if `$sh -c '#' >/dev/null 2>&1`; then
1267         shsharp=true
1268         spitshell=cat
1269         xcat=/bin/cat
1270         test -f $xcat$_exe || xcat=/usr/bin/cat
1271         if test ! -f $xcat$_exe; then
1272                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1273                         if test -f $p/cat$_exe; then
1274                                 xcat=$p/cat
1275                                 break
1276                         fi
1277                 done
1278                 if test ! -f $xcat$_exe; then
1279                         echo "Can't find cat anywhere!"
1280                         exit 1
1281                 fi
1282         fi
1283         echo "#!$xcat" >sharp
1284         $eunicefix sharp
1285         chmod +x sharp
1286         ./sharp > today
1287         if test -s today; then
1288                 sharpbang='#!'
1289         else
1290                 echo "#! $xcat" > sharp
1291                 $eunicefix sharp
1292                 chmod +x sharp
1293                 ./sharp > today
1294                 if test -s today; then
1295                         sharpbang='#! '
1296                 else
1297                         sharpbang=': use '
1298                 fi
1299         fi
1300 else
1301         echo " "
1302         echo "Your $sh doesn't grok # comments--I will strip them later on."
1303         shsharp=false
1304         cd ..
1305         echo "exec grep -v '^[  ]*#'" >spitshell
1306         chmod +x spitshell
1307         $eunicefix spitshell
1308         spitshell=`pwd`/spitshell
1309         cd UU
1310         echo "I presume that if # doesn't work, #! won't work either!"
1311         sharpbang=': use '
1312 fi
1313 rm -f sharp today
1314
1315 : figure out how to guarantee sh startup
1316 case "$startsh" in
1317 '') startsh=${sharpbang}${sh} ;;
1318 *)
1319 esac
1320 cat >sharp <<EOSS
1321 $startsh
1322 set abc
1323 test "$?abc" != 1
1324 EOSS
1325
1326 chmod +x sharp
1327 $eunicefix sharp
1328 if ./sharp; then
1329         : echo "Yup, it does."
1330 else
1331         echo "Hmm... '$startsh' does not guarantee sh startup..."
1332         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1333 fi
1334 rm -f sharp
1335
1336
1337 : Save command line options in file UU/cmdline.opt for later use in
1338 : generating config.sh.
1339 cat > cmdline.opt <<EOSH
1340 # Configure command line arguments.
1341 config_arg0='$0'
1342 config_args='$*'
1343 config_argc=$#
1344 EOSH
1345 argn=1
1346 args_exp=''
1347 args_sep=''
1348 for arg in "$@"; do
1349         cat >>cmdline.opt <<EOSH
1350 config_arg$argn='$arg'
1351 EOSH
1352         # Extreme backslashitis: replace each ' by '"'"'
1353         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1354 $arg
1355 EOC
1356         arg_exp=`cat cmdl.opt`
1357         args_exp="$args_exp$args_sep'$arg_exp'"
1358         argn=`expr $argn + 1`
1359         args_sep=' '
1360 done
1361 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1362 # used by ./hints/os2.sh
1363 rm -f cmdl.opt
1364
1365 : produce awk script to parse command line options
1366 cat >options.awk <<'EOF'
1367 BEGIN {
1368         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1369
1370         len = length(optstr);
1371         for (i = 1; i <= len; i++) {
1372                 c = substr(optstr, i, 1);
1373                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1374                 if (a == ":") {
1375                         arg[c] = 1;
1376                         i++;
1377                 }
1378                 opt[c] = 1;
1379         }
1380 }
1381 {
1382         expect = 0;
1383         str = $0;
1384         if (substr(str, 1, 1) != "-") {
1385                 printf("'%s'\n", str);
1386                 next;
1387         }
1388         len = length($0);
1389         for (i = 2; i <= len; i++) {
1390                 c = substr(str, i, 1);
1391                 if (!opt[c]) {
1392                         printf("-%s\n", substr(str, i));
1393                         next;
1394                 }
1395                 printf("-%s\n", c);
1396                 if (arg[c]) {
1397                         if (i < len)
1398                                 printf("'%s'\n", substr(str, i + 1));
1399                         else
1400                                 expect = 1;
1401                         next;
1402                 }
1403         }
1404 }
1405 END {
1406         if (expect)
1407                 print "?";
1408 }
1409 EOF
1410
1411 : process the command line options
1412 set X `for arg in "$@"; do echo "X$arg"; done |
1413         sed -e s/X// | awk -f options.awk`
1414 eval "set $*"
1415 shift
1416 rm -f options.awk
1417
1418 : set up default values
1419 fastread=''
1420 reuseval=false
1421 config_sh=''
1422 alldone=''
1423 error=''
1424 silent=''
1425 extractsh=''
1426 override=''
1427 knowitall=''
1428 rm -f optdef.sh posthint.sh
1429 cat >optdef.sh <<EOS
1430 $startsh
1431 EOS
1432
1433
1434 : option parsing
1435 while test $# -gt 0; do
1436         case "$1" in
1437         -d) shift; fastread=yes;;
1438         -e) shift; alldone=cont;;
1439         -f)
1440                 shift
1441                 cd ..
1442                 if test -r "$1"; then
1443                         config_sh="$1"
1444                 else
1445                         echo "$me: cannot read config file $1." >&2
1446                         error=true
1447                 fi
1448                 cd UU
1449                 shift;;
1450         -h) shift; error=true;;
1451         -r) shift; reuseval=true;;
1452         -s) shift; silent=true; realsilent=true;;
1453         -E) shift; alldone=exit;;
1454         -K) shift; knowitall=true;;
1455         -O) shift; override=true;;
1456         -S) shift; silent=true; extractsh=true;;
1457         -D)
1458                 shift
1459                 case "$1" in
1460                 *=)
1461                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1462                         echo "$me: ignoring -D $1" >&2
1463                         ;;
1464                 *=*) echo "$1" | \
1465                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1466                 *) echo "$1='define'" >> optdef.sh;;
1467                 esac
1468                 shift
1469                 ;;
1470         -U)
1471                 shift
1472                 case "$1" in
1473                 *=) echo "$1" >> optdef.sh;;
1474                 *=*)
1475                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1476                         echo "$me: ignoring -U $1" >&2
1477                         ;;
1478                 *) echo "$1='undef'" >> optdef.sh;;
1479                 esac
1480                 shift
1481                 ;;
1482         -A)
1483             shift
1484             xxx=''
1485             yyy="$1"
1486             zzz=''
1487             uuu=undef
1488             case "$yyy" in
1489             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1490                  case "$zzz" in
1491                  *:*) zzz='' ;;
1492                  *)   xxx=append
1493                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1494                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1495                  esac
1496                  ;;
1497             esac
1498             case "$xxx" in
1499             '')  case "$yyy" in
1500                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1501                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1502                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1503                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1504                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1505                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1506                  esac
1507                  ;;       
1508             esac
1509             case "$xxx" in
1510             append)
1511                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1512             clear)
1513                 echo "$yyy=''"                  >> posthint.sh ;;
1514             define)
1515                 case "$zzz" in
1516                 '') zzz=define ;;
1517                 esac
1518                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1519             eval)
1520                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1521             prepend)
1522                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1523             undef)
1524                 case "$zzz" in
1525                 '') zzz="$uuu" ;;
1526                 esac
1527                 echo "$yyy=$zzz"                >> posthint.sh ;;
1528             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1529             esac
1530             shift
1531             ;;
1532         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1533             exit 0;;
1534         --) break;;
1535         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1536         *) break;;
1537         esac
1538 done
1539
1540 case "$error" in
1541 true)
1542         cat >&2 <<EOM
1543 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1544                  [-U symbol] [-U symbol=] [-A command:symbol...]
1545   -d : use defaults for all answers.
1546   -e : go on without questioning past the production of config.sh.
1547   -f : specify an alternate default configuration file.
1548   -h : print this help message and exit (with an error status).
1549   -r : reuse C symbols value if possible (skips costly nm extraction).
1550   -s : silent mode, only echoes questions and essential information.
1551   -D : define symbol to have some value:
1552          -D symbol         symbol gets the value 'define'
1553          -D symbol=value   symbol gets the value 'value'
1554   -E : stop at the end of questions, after having produced config.sh.
1555   -K : do not use unless you know what you are doing.
1556   -O : let -D and -U override definitions from loaded configuration file.
1557   -S : perform variable substitutions on all .SH files (can mix with -f)
1558   -U : undefine symbol:
1559          -U symbol    symbol gets the value 'undef'
1560          -U symbol=   symbol gets completely empty
1561   -A : manipulate symbol after the platform specific hints have been applied:
1562          -A symbol=value                append " "value to symbol
1563          -A append:symbol=value         append value to symbol
1564          -A define:symbol=value         define symbol to have value
1565          -A clear:symbol                define symbol to be ''
1566          -A define:symbol               define symbol to be 'define'
1567          -A eval:symbol=value           define symbol to be eval of value
1568          -A prepend:symbol=value        prepend value to symbol
1569          -A undef:symbol                define symbol to be 'undef'
1570          -A undef:symbol=               define symbol to be ''
1571   -V : print version number and exit (with a zero status).
1572 EOM
1573         exit 1
1574         ;;
1575 esac
1576
1577 : Sanity checks
1578 case "$fastread$alldone" in
1579 yescont|yesexit) ;;
1580 *)
1581         case "$extractsh" in
1582         true) ;;
1583         *)
1584                 if test ! -t 0; then
1585                         echo "Say 'sh Configure', not 'sh <Configure'"
1586                         exit 1
1587                 fi
1588                 ;;
1589         esac
1590         ;;
1591 esac
1592
1593 exec 4>&1
1594 case "$silent" in
1595 true) exec 1>/dev/null;;
1596 esac
1597
1598 : run the defines and the undefines, if any, but leave the file out there...
1599 touch optdef.sh
1600 . ./optdef.sh
1601 : create the posthint manipulation script and leave the file out there...
1602 touch posthint.sh
1603
1604 : set package name
1605 package=perl5
1606 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1607 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1608 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1609 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1610 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1611 esac
1612
1613 : Some greps do not return status, grrr.
1614 echo "grimblepritz" >grimble
1615 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1616         contains=contains
1617 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1618         contains=grep
1619 else
1620         contains=contains
1621 fi
1622 rm -f grimble
1623 : the following should work in any shell
1624 case "$contains" in
1625 contains*)
1626         echo " "
1627         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1628         cat >contains <<'EOSS'
1629 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1630 EOSS
1631 chmod +x contains
1632 esac
1633
1634 : Find the path to the source tree
1635 case "$src" in
1636 '') case "$0" in
1637     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1638          case "$src" in
1639          /*)    ;;
1640          .)     ;;
1641          *)     src=`cd ../$src && pwd` ;;
1642          esac
1643          ;;
1644     *)   src='.';;
1645     esac;;
1646 esac
1647 case "$src" in
1648 '')     src=/
1649         rsrc=/
1650         ;;
1651 /*) rsrc="$src";;
1652 *) rsrc="../$src";;
1653 esac
1654 if test -f $rsrc/Configure && \
1655         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1656 then
1657    : found it, so we are ok.
1658 else
1659         rsrc=''
1660         for src in . .. ../.. ../../.. ../../../..; do
1661                 if test -f ../$src/Configure && \
1662                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1663                 then
1664                         rsrc=../$src
1665                         break
1666                 fi
1667         done
1668 fi
1669 case "$rsrc" in
1670 '')
1671         cat <<EOM >&4
1672
1673 Sorry, I can't seem to locate the source dir for $package.  Please start
1674 Configure with an explicit path -- i.e. /some/path/Configure.
1675
1676 EOM
1677         exit 1
1678         ;;
1679 ../.)   rsrc='..';;
1680 *)
1681         echo " "
1682         echo "Sources for $package found in \"$src\"." >&4
1683         ;;
1684 esac
1685
1686 : script used to extract .SH files with variable substitutions
1687 cat >extract <<'EOS'
1688 PERL_CONFIG_SH=true
1689 echo "Doing variable substitutions on .SH files..."
1690 if test -f MANIFEST; then
1691         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1692 else
1693         echo "(Looking for .SH files under the source directory.)"
1694         set x `(cd "$src"; find . -name "*.SH" -print)`
1695 fi
1696 shift
1697 case $# in
1698 0) set x `(cd "$src"; echo *.SH)`; shift;;
1699 esac
1700 if test ! -f "$src/$1"; then
1701         shift
1702 fi
1703 mkdir_p='
1704 name=$1;
1705 create="";
1706 while test $name; do
1707         if test ! -d "$name"; then
1708                 create="$name $create";
1709                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1710                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1711         else
1712                 name="";
1713         fi;
1714 done;
1715 for file in $create; do
1716         mkdir $file;
1717 done
1718 '
1719 for file in $*; do
1720         case "$src" in
1721         ".")
1722                 case "$file" in
1723                 */*)
1724                         dir=`expr X$file : 'X\(.*\)/'`
1725                         file=`expr X$file : 'X.*/\(.*\)'`
1726                         (cd "$dir" && . ./$file)
1727                         ;;
1728                 *)
1729                         . ./$file
1730                         ;;
1731                 esac
1732                 ;;
1733         *)
1734                 case "$file" in
1735                 */*)
1736                         dir=`expr X$file : 'X\(.*\)/'`
1737                         file=`expr X$file : 'X.*/\(.*\)'`
1738                         (set x $dir; shift; eval $mkdir_p)
1739                         sh <"$src/$dir/$file"
1740                         ;;
1741                 *)
1742                         sh <"$src/$file"
1743                         ;;
1744                 esac
1745                 ;;
1746         esac
1747 done
1748 if test -f "$src/config_h.SH"; then
1749         if test ! -f config.h; then
1750         : oops, they left it out of MANIFEST, probably, so do it anyway.
1751         . "$src/config_h.SH"
1752         fi
1753 fi
1754 EOS
1755
1756 : extract files and exit if asked to do so
1757 case "$extractsh" in
1758 true)
1759         case "$realsilent" in
1760         true) ;;
1761         *) exec 1>&4;;
1762         esac
1763         case "$config_sh" in
1764         '') config_sh='config.sh';;
1765         esac
1766         echo " "
1767         echo "Fetching answers from $config_sh..."
1768         cd ..
1769         . $config_sh
1770         test "$override" && . ./optdef.sh
1771         echo " "
1772         . UU/extract
1773         rm -rf UU
1774         echo "Extraction done."
1775         exit 0
1776         ;;
1777 esac
1778
1779 : Eunice requires " " instead of "", can you believe it
1780 echo " "
1781 : Here we go...
1782 echo "Beginning of configuration questions for $package."
1783
1784 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1785
1786 : first determine how to suppress newline on echo command
1787 echo " "
1788 echo "Checking echo to see how to suppress newlines..."
1789 (echo "hi there\c" ; echo " ") >.echotmp
1790 if $contains c .echotmp >/dev/null 2>&1 ; then
1791         echo "...using -n."
1792         n='-n'
1793         c=''
1794 else
1795         cat <<'EOM'
1796 ...using \c
1797 EOM
1798         n=''
1799         c='\c'
1800 fi
1801 echo $n "The star should be here-->$c"
1802 echo '*'
1803 rm -f .echotmp
1804
1805 : Now test for existence of everything in MANIFEST
1806 echo " "
1807 if test -f "$rsrc/MANIFEST"; then
1808         echo "First let's make sure your kit is complete.  Checking..." >&4
1809         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1810         rm -f missing
1811         tmppwd=`pwd`
1812         for filelist in x??; do
1813                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1814         done
1815         if test -s missing; then
1816                 cat missing >&4
1817                 cat >&4 <<'EOM'
1818
1819 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1820
1821 You have the option of continuing the configuration process, despite the
1822 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1823 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1824 and contact the author (perlbug@perl.org).
1825
1826 EOM
1827                 echo $n "Continue? [n] $c" >&4
1828                 read ans
1829                 case "$ans" in
1830                 y*)
1831                         echo "Continuing..." >&4
1832                         rm -f missing
1833                         ;;
1834                 *)
1835                         echo "ABORTING..." >&4
1836                         kill $$
1837                         ;;
1838                 esac
1839         else
1840                 echo "Looks good..."
1841         fi
1842 else
1843         echo "There is no MANIFEST file.  I hope your kit is complete !"
1844 fi
1845 rm -f missing x??
1846
1847 echo " "
1848 : Find the appropriate value for a newline for tr
1849 if test -n "$DJGPP"; then
1850        trnl='\012'
1851 fi
1852 if test X"$trnl" = X; then
1853         case "`echo foo|tr '\n' x 2>/dev/null`" in
1854         foox) trnl='\n' ;;
1855         esac
1856 fi
1857 if test X"$trnl" = X; then
1858         case "`echo foo|tr '\012' x 2>/dev/null`" in
1859         foox) trnl='\012' ;;
1860         esac
1861 fi
1862 if test X"$trnl" = X; then
1863         cat <<EOM >&2
1864
1865 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1866
1867 EOM
1868         exit 1
1869 fi
1870
1871 : compute the number of columns on the terminal for proper question formatting
1872 case "$COLUMNS" in
1873 '') COLUMNS='80';;
1874 esac
1875
1876 : set up the echo used in my read
1877 myecho="case \"\$xxxm\" in
1878 '') echo $n \"\$rp $c\" >&4;;
1879 *) case \"\$rp\" in
1880         '') echo $n \"[\$xxxm] $c\";;
1881         *)
1882                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1883                         echo \"\$rp\" >&4
1884                         echo $n \"[\$xxxm] $c\" >&4
1885                 else
1886                         echo $n \"\$rp [\$xxxm] $c\" >&4
1887                 fi
1888                 ;;
1889         esac;;
1890 esac"
1891
1892 : now set up to do reads with possible shell escape and default assignment
1893 cat <<EOSC >myread
1894 $startsh
1895 xxxm=\$dflt
1896 $myecho
1897 ans='!'
1898 case "\$fastread" in
1899 yes) case "\$dflt" in
1900         '') ;;
1901         *) ans='';
1902                 case "\$silent-\$rp" in
1903                 true-) ;;
1904                 *) echo " " >&4;;
1905                 esac;;
1906         esac;;
1907 *) case "\$silent" in
1908         true) case "\$rp" in
1909                 '') ans='';;
1910                 esac;;
1911         esac;;
1912 esac
1913 while expr "X\$ans" : "X!" >/dev/null; do
1914         read answ
1915         set x \$xxxm
1916         shift
1917         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1918         case  "\$answ" in
1919         "!")
1920                 sh 1>&4
1921                 echo " "
1922                 $myecho
1923                 ;;
1924         !*)
1925                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1926                 shift
1927                 sh 1>&4 -c "\$*"
1928                 echo " "
1929                 $myecho
1930                 ;;
1931         "\$ans")
1932                 case "\$ans" in
1933                 \\&*)
1934                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1935                         shift
1936                         case "\$1" in
1937                         -d)
1938                                 fastread=yes
1939                                 echo "(OK, I'll run with -d after this question.)" >&4
1940                                 ;;
1941                         -*)
1942                                 echo "*** Sorry, \$1 not supported yet." >&4
1943                                 ;;
1944                         esac
1945                         $myecho
1946                         ans=!
1947                         ;;
1948                 esac;;
1949         *)
1950                 case "\$aok" in
1951                 y)
1952                         echo "*** Substitution done -- please confirm."
1953                         xxxm="\$ans"
1954                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1955                         xxxm="\$ans"
1956                         ans=!
1957                         ;;
1958                 *)
1959                         echo "*** Error -- try again."
1960                         ans=!
1961                         ;;
1962                 esac
1963                 $myecho
1964                 ;;
1965         esac
1966         case "\$ans\$xxxm\$nostick" in
1967         '')
1968                 ans=!
1969                 $myecho
1970                 ;;
1971         esac
1972 done
1973 case "\$ans" in
1974 '') ans="\$xxxm";;
1975 esac
1976 EOSC
1977
1978 : create .config dir to save info across Configure sessions
1979 test -d ../.config || mkdir ../.config
1980 cat >../.config/README <<EOF
1981 This directory created by Configure to save information that should
1982 persist across sessions for $package.
1983
1984 You may safely delete it if you wish.
1985 EOF
1986
1987 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1988 case "$usedevel" in
1989 $define|true|[yY]*) ;;
1990 *) case "$xversion" in
1991    *[13579])
1992         cat >&4 <<EOH
1993 *** WHOA THERE!!! ***
1994
1995     This is an UNSTABLE DEVELOPMENT release.
1996     The version of this $package distribution is $xversion, that is, odd,
1997     (as opposed to even) and that signifies a development release.
1998     If you want a maintenance release, you want an even-numbered version.
1999
2000     Do ***NOT*** install this into production use.
2001     Data corruption and crashes are possible.
2002
2003     It is most seriously suggested that you do not continue any further
2004     unless you want to help in developing and debugging Perl.
2005
2006     If you *still* want to build perl, you can answer 'y' now,
2007     or pass -Dusedevel to Configure.
2008
2009 EOH
2010         rp='Do you really want to continue?'
2011         dflt='n'
2012         . ./myread
2013         case "$ans" in
2014         [yY]) echo >&4 "Okay, continuing."
2015               usedevel="$define" ;;
2016         *) echo >&4 "Okay, bye."
2017            exit 1
2018            ;;
2019         esac
2020         ;;
2021     esac
2022     ;;
2023 esac
2024 case "$usedevel" in
2025 $define|true|[yY]*)
2026         case "$versiononly" in
2027         '') versiononly="$define" ;;
2028         esac
2029         case "$installusrbinperl" in
2030         '') installusrbinperl="$undef" ;;
2031         esac
2032         ;;
2033 esac
2034
2035 : general instructions
2036 needman=true
2037 firsttime=true
2038 user=`(logname) 2>/dev/null`
2039 case "$user" in
2040 '') user=`whoami 2>&1`;;
2041 esac
2042 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2043         firsttime=false
2044         echo " "
2045         rp='Would you like to see the instructions?'
2046         dflt=n
2047         . ./myread
2048         case "$ans" in
2049         [yY]*) ;;
2050         *) needman=false;;
2051         esac
2052 fi
2053 if $needman; then
2054         cat <<EOH
2055
2056 This installation shell script will examine your system and ask you questions
2057 to determine how the perl5 package should be installed. If you get
2058 stuck on a question, you may use a ! shell escape to start a subshell or
2059 execute a command.  Many of the questions will have default answers in square
2060 brackets; typing carriage return will give you the default.
2061
2062 On some of the questions which ask for file or directory names you are allowed
2063 to use the ~name construct to specify the login directory belonging to "name",
2064 even if you don't have a shell which knows about that.  Questions where this is
2065 allowed will be marked "(~name ok)".
2066
2067 EOH
2068         rp=''
2069         dflt='Type carriage return to continue'
2070         . ./myread
2071         cat <<'EOH'
2072
2073 The prompter used in this script allows you to use shell variables and
2074 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2075 in the default answer, as if the default line was a set of arguments given to a
2076 script shell.  This means you may also use $* to repeat the whole default line,
2077 so you do not have to re-type everything to add something to the default.
2078
2079 Everytime there is a substitution, you will have to confirm.  If there is an
2080 error (e.g. an unmatched backtick), the default answer will remain unchanged
2081 and you will be prompted again.
2082
2083 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2084 the questions and use the computed defaults (or the previous answers if there
2085 was already a config.sh file). Type 'Configure -h' for a list of options.
2086 You may also start interactively and then answer '& -d' at any prompt to turn
2087 on the non-interactive behaviour for the remainder of the execution.
2088
2089 EOH
2090         . ./myread
2091         cat <<EOH
2092
2093 Much effort has been expended to ensure that this shell script will run on any
2094 Unix system.  If despite that it blows up on yours, your best bet is to edit
2095 Configure and run it again.  If you can't run Configure for some reason,
2096 you'll have to generate a config.sh file by hand.  Whatever problems you
2097 have, let me (perlbug@perl.org) know how I blew it.
2098
2099 This installation script affects things in two ways:
2100
2101 1) it may do direct variable substitutions on some of the files included
2102    in this kit.
2103 2) it builds a config.h file for inclusion in C programs.  You may edit
2104    any of these files as the need arises after running this script.
2105
2106 If you make a mistake on a question, there is no easy way to back up to it
2107 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2108 files.  Configure will offer to let you do this before it runs the SH files.
2109
2110 EOH
2111         dflt='Type carriage return to continue'
2112         . ./myread
2113         case "$firsttime" in
2114         true) echo $user >>../.config/instruct;;
2115         esac
2116 fi
2117
2118 : find out where common programs are
2119 echo " "
2120 echo "Locating common programs..." >&4
2121 cat <<EOSC >loc
2122 $startsh
2123 case \$# in
2124 0) exit 1;;
2125 esac
2126 thing=\$1
2127 shift
2128 dflt=\$1
2129 shift
2130 for dir in \$*; do
2131         case "\$thing" in
2132         .)
2133         if test -d \$dir/\$thing; then
2134                 echo \$dir
2135                 exit 0
2136         fi
2137         ;;
2138         *)
2139         for thisthing in \$dir/\$thing; do
2140                 : just loop through to pick last item
2141         done
2142         if test -f \$thisthing; then
2143                 echo \$thisthing
2144                 exit 0
2145         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2146                 echo \$thisthing
2147                 exit 0
2148         elif test -f \$dir/\$thing.exe; then
2149                 if test -n "$DJGPP"; then
2150                         echo \$dir/\$thing.exe
2151                 else
2152                         : on Eunice apparently
2153                         echo \$dir/\$thing
2154                 fi
2155                 exit 0
2156         fi
2157         ;;
2158         esac
2159 done
2160 echo \$dflt
2161 exit 1
2162 EOSC
2163 chmod +x loc
2164 $eunicefix loc
2165 loclist="
2166 awk
2167 cat
2168 chmod
2169 comm
2170 cp
2171 echo
2172 expr
2173 grep
2174 ls
2175 mkdir
2176 rm
2177 sed
2178 sort
2179 touch
2180 tr
2181 uniq
2182 "
2183 trylist="
2184 Mcc
2185 ar
2186 bison
2187 byacc
2188 cpp
2189 csh
2190 date
2191 egrep
2192 gmake
2193 gzip
2194 less
2195 ln
2196 make
2197 more
2198 nm
2199 nroff
2200 pg
2201 test
2202 uname
2203 zip
2204 "
2205 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2206 pth="$pth /lib /usr/lib"
2207 for file in $loclist; do
2208         eval xxx=\$$file
2209         case "$xxx" in
2210         /*|?:[\\/]*)
2211                 if test -f "$xxx"; then
2212                         : ok
2213                 else
2214                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2215                         xxx=`./loc $file $file $pth`
2216                 fi
2217                 ;;
2218         '') xxx=`./loc $file $file $pth`;;
2219         *) xxx=`./loc $xxx $xxx $pth`;;
2220         esac
2221         eval $file=$xxx$_exe
2222         eval _$file=$xxx
2223         case "$xxx" in
2224         /*)
2225                 echo $file is in $xxx.
2226                 ;;
2227         ?:[\\/]*)
2228                 echo $file is in $xxx.
2229                 ;;
2230         *)
2231                 echo "I don't know where '$file' is, and my life depends on it." >&4
2232                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2233                 exit 1
2234                 ;;
2235         esac
2236 done
2237 echo " "
2238 echo "Don't worry if any of the following aren't found..."
2239 say=offhand
2240 for file in $trylist; do
2241         eval xxx=\$$file
2242         case "$xxx" in
2243         /*|?:[\\/]*)
2244                 if test -f "$xxx"; then
2245                         : ok
2246                 else
2247                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2248                         xxx=`./loc $file $file $pth`
2249                 fi
2250                 ;;
2251         '') xxx=`./loc $file $file $pth`;;
2252         *) xxx=`./loc $xxx $xxx $pth`;;
2253         esac
2254         eval $file=$xxx$_exe
2255         eval _$file=$xxx
2256         case "$xxx" in
2257         /*)
2258                 echo $file is in $xxx.
2259                 ;;
2260         ?:[\\/]*)
2261                 echo $file is in $xxx.
2262                 ;;
2263         *)
2264                 echo "I don't see $file out there, $say."
2265                 say=either
2266                 ;;
2267         esac
2268 done
2269 case "$egrep" in
2270 egrep)
2271         echo "Substituting grep for egrep."
2272         egrep=$grep
2273         _egrep=$grep
2274         ;;
2275 esac
2276 case "$ln" in
2277 ln)
2278         echo "Substituting cp for ln."
2279         ln=$cp
2280         _ln=$cp
2281         ;;
2282 esac
2283 case "$make" in
2284 make)   
2285         case "$gmake" in
2286         gmake)
2287         echo "I can't find make or gmake, and my life depends on it." >&4
2288         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2289         exit 1
2290         ;;
2291         esac
2292         ;;
2293 esac    
2294 case "$gmake" in
2295 gmake)  ;;
2296 *)      # We can't have osname yet.
2297         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2298                 # Assume that gmake, if found, is definitely GNU make
2299                 # and prefer it over the system make.
2300                 echo "Substituting gmake for make."
2301                 make=$gmake
2302                 _make=$gmake
2303         fi
2304         ;;
2305 esac
2306 case "$test" in
2307 test)
2308         echo "Hopefully test is built into your sh."
2309         ;;
2310 *)
2311         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2312                 echo "Using the test built into your sh."
2313                 test=test
2314                 _test=test
2315         fi
2316         ;;
2317 esac
2318 case "$echo" in
2319 echo)
2320         echo "Hopefully echo is built into your sh."
2321         ;;
2322 '') ;;
2323 *)
2324         echo " "
2325 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2326         $echo $n "hi there$c" >foo1
2327         echo $n "hi there$c" >foo2
2328         if cmp foo1 foo2 >/dev/null 2>&1; then
2329                 echo "They are compatible.  In fact, they may be identical."
2330         else
2331                 case "$n" in
2332                 '-n') n='' c='\c';;
2333                 *) n='-n' c='';;
2334                 esac
2335                 cat <<FOO
2336 They are not compatible!  You are probably running ksh on a non-USG system.
2337 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2338 have echo built in and we may have to run some Bourne shell scripts.  That
2339 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2340
2341 FOO
2342                 $echo $n "The star should be here-->$c"
2343                 $echo "*"
2344         fi
2345         $rm -f foo1 foo2
2346         ;;
2347 esac
2348
2349 cat <<EOS >trygcc
2350 $startsh
2351 EOS
2352 cat <<'EOSC' >>trygcc
2353 case "$cc" in
2354 '') ;;
2355 *)  $rm -f try try.*
2356     $cat >try.c <<EOM
2357 int main(int argc, char *argv[]) {
2358   return 0;
2359 }
2360 EOM
2361     if $cc -o try $ccflags $ldflags try.c; then
2362        :
2363     else
2364         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2365         despair=yes
2366         trygcc=yes
2367         case "$cc" in
2368         *gcc*) trygcc=no ;;
2369         esac
2370         case "`$cc -v -c try.c 2>&1`" in
2371         *gcc*) trygcc=no ;;
2372         esac
2373         if $test X"$trygcc" = Xyes; then
2374             if gcc -o try -c try.c; then
2375                 echo " "
2376                 echo "You seem to have a working gcc, though." >&4
2377                 rp="Would you like to use it?"
2378                 dflt=y
2379                 if $test -f myread; then
2380                     . ./myread
2381                 else
2382                     if $test -f UU/myread; then
2383                         . ./UU/myread
2384                     else
2385                         echo "Cannot find myread, sorry.  Aborting." >&2
2386                         exit 1
2387                     fi
2388                 fi  
2389                 case "$ans" in
2390                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2391                        if $test -f usethreads.cbu; then
2392                            $cat >&4 <<EOM 
2393
2394 *** However, any setting of the C compiler flags (e.g. for thread support)
2395 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2396 *** (together with e.g. -Dusethreads).
2397
2398 EOM
2399                        fi;;
2400                 esac
2401             fi
2402         fi
2403     fi
2404     $rm -f try try.*
2405     ;;
2406 esac
2407 EOSC
2408
2409 cat <<EOS >checkcc
2410 $startsh
2411 EOS
2412 cat <<'EOSC' >>checkcc
2413 case "$cc" in        
2414 '') ;;
2415 *)  $rm -f try try.*              
2416     $cat >try.c <<EOM
2417 int main(int argc, char *argv[]) {
2418   return 0;
2419 }
2420 EOM
2421     if $cc -o try $ccflags $ldflags try.c; then
2422        :
2423     else
2424         if $test X"$despair" = Xyes; then
2425            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2426         fi
2427         $cat >&4 <<EOM         
2428 You need to find a working C compiler.
2429 Either (purchase and) install the C compiler supplied by your OS vendor,
2430 or for a free C compiler try http://gcc.gnu.org/
2431 I cannot continue any further, aborting.
2432 EOM
2433         exit 1
2434     fi
2435     $rm -f try try.*
2436     ;;
2437 esac
2438 EOSC
2439
2440 : determine whether symbolic links are supported
2441 echo " "
2442 $touch blurfl
2443 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2444         echo "Symbolic links are supported." >&4
2445         lns="$ln -s"
2446 else
2447         echo "Symbolic links are NOT supported." >&4
2448         lns="$ln"
2449 fi
2450 $rm -f blurfl sym
2451
2452 : determine whether symbolic links are supported
2453 echo " "
2454 case "$lns" in
2455 *"ln"*" -s")
2456         echo "Checking how to test for symbolic links..." >&4
2457         $lns blurfl sym
2458         if $test "X$issymlink" = X; then
2459                 case "$newsh" in
2460                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2461                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2462                 esac
2463                 if test $? = 0; then
2464                         issymlink="test -h"
2465                 else
2466                         echo "Your builtin 'test -h' may be broken." >&4
2467                         case "$test" in
2468                         /*)     ;;
2469                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2470                                 for p in $pth
2471                                 do
2472                                         if test -f "$p/$test"; then
2473                                                 test="$p/$test"
2474                                                 break
2475                                         fi
2476                                 done
2477                                 ;;
2478                         esac
2479                         case "$test" in
2480                         /*)
2481                                 echo "Trying external '$test -h'." >&4
2482                                 issymlink="$test -h"
2483                                 if $test ! -h sym >/dev/null 2>&1; then
2484                                         echo "External '$test -h' is broken, too." >&4
2485                                         issymlink=''
2486                                 fi
2487                                 ;;
2488                         *)      issymlink='' ;;
2489                         esac
2490                 fi              
2491         fi
2492         if $test "X$issymlink" = X; then
2493                 if $test -L sym 2>/dev/null; then
2494                         issymlink="$test -L"
2495                         echo "The builtin '$test -L' worked." >&4
2496                 fi
2497         fi
2498         if $test "X$issymlink" != X; then
2499                 echo "You can test for symbolic links with '$issymlink'." >&4
2500         else
2501                 echo "I do not know how you can test for symbolic links." >&4
2502         fi
2503         $rm -f blurfl sym
2504         ;;
2505 *)      echo "No symbolic links, so not testing for their testing..." >&4
2506         ;;
2507 esac
2508 echo " "
2509
2510
2511 case "$mksymlinks" in
2512 $define|true|[yY]*)
2513         case "$src" in
2514         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2515                 exit 1
2516                 ;;
2517         *)      case "$lns:$issymlink" in
2518                 *"ln"*" -s:"*"test -"?)
2519                         echo "Creating the symbolic links..." >&4
2520                         echo "(First creating the subdirectories...)" >&4
2521                         cd ..
2522                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2523                                 read directory
2524                                 test -z "$directory" && break
2525                                 mkdir -p $directory
2526                         done
2527                         # Sanity check 1.
2528                         if test ! -d t/base; then
2529                                 echo "Failed to create the subdirectories.  Aborting." >&4
2530                                 exit 1
2531                         fi
2532                         echo "(Then creating the symlinks...)" >&4
2533                         awk '{print $1}' $src/MANIFEST | while true; do
2534                                 read filename
2535                                 test -z "$filename" && break
2536                                 if test -f $filename; then
2537                                         if $issymlink $filename; then
2538                                                 rm -f $filename
2539                                         fi
2540                                 fi
2541                                 if test -f $filename; then
2542                                         echo "$filename already exists, not symlinking."
2543                                 else
2544                                         ln -s $src/$filename $filename
2545                                 fi
2546                         done
2547                         # Sanity check 2.
2548                         if test ! -f t/base/lex.t; then
2549                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2550                                 exit 1
2551                         fi
2552                         cd UU
2553                         ;;
2554                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2555                         ;;
2556                 esac
2557                 ;;
2558         esac
2559         ;;
2560 esac
2561
2562
2563 case "$usecrosscompile" in
2564 $define|true|[yY]*)
2565         $echo "Cross-compiling..."
2566         croak=''
2567         case "$cc" in
2568         *-*-gcc) # A cross-compiling gcc, probably.
2569             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2570             ar=$targetarch-ar
2571             # leave out ld, choosing it is more complex
2572             nm=$targetarch-nm
2573             ranlib=$targetarch-ranlib
2574             $echo 'extern int foo;' > try.c
2575             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2576             shift
2577             if $test $# -gt 0; then
2578                 incpth="$incpth $*"
2579                 incpth="`$echo $incpth|$sed 's/^ //'`"
2580                 echo "Guessing incpth '$incpth'." >&4
2581                 for i in $*; do
2582                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2583                     if $test -d $j; then
2584                         libpth="$libpth $j"
2585                     fi
2586                 done   
2587                 libpth="`$echo $libpth|$sed 's/^ //'`"
2588                 echo "Guessing libpth '$libpth'." >&4
2589             fi
2590             $rm -f try.c
2591             ;;
2592         esac
2593         case "$targetarch" in
2594         '') echo "Targetarch not defined." >&4; croak=y ;;
2595         *)  echo "Using targetarch $targetarch." >&4 ;;
2596         esac
2597         case "$incpth" in
2598         '') echo "Incpth not defined." >&4; croak=y ;;
2599         *)  echo "Using incpth '$incpth'." >&4 ;;
2600         esac
2601         case "$libpth" in
2602         '') echo "Libpth not defined." >&4; croak=y ;;
2603         *)  echo "Using libpth '$libpth'." >&4 ;;
2604         esac
2605         case "$usrinc" in
2606         '') for i in $incpth; do
2607                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2608                     usrinc=$i
2609                     echo "Guessing usrinc $usrinc." >&4
2610                     break
2611                 fi
2612             done
2613             case "$usrinc" in
2614             '') echo "Usrinc not defined." >&4; croak=y ;;
2615             esac
2616             ;;
2617         *)  echo "Using usrinc $usrinc." >&4 ;;
2618         esac
2619         case "$targethost" in
2620         '') echo "Targethost not defined." >&4; croak=y ;;
2621         *)  echo "Using targethost $targethost." >&4
2622         esac
2623         locincpth=' '
2624         loclibpth=' '
2625         case "$croak" in
2626         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2627         esac
2628         case "$src" in
2629         /*) run=$src/Cross/run
2630             targetmkdir=$src/Cross/mkdir
2631             to=$src/Cross/to
2632             from=$src/Cross/from
2633             ;;
2634         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2635             run=$pwd/Cross/run
2636             targetmkdir=$pwd/Cross/mkdir
2637             to=$pwd/Cross/to
2638             from=$pwd/Cross/from
2639             ;;
2640         esac
2641         case "$targetrun" in
2642         '') targetrun=ssh ;;
2643         esac
2644         case "$targetto" in
2645         '') targetto=scp ;;
2646         esac
2647         case "$targetfrom" in
2648         '') targetfrom=scp ;;
2649         esac
2650         run=$run-$targetrun
2651         to=$to-$targetto
2652         from=$from-$targetfrom
2653         case "$targetdir" in
2654         '')  targetdir=/tmp
2655              echo "Guessing targetdir $targetdir." >&4
2656              ;;
2657         esac
2658         case "$targetuser" in
2659         '')  targetuser=root
2660              echo "Guessing targetuser $targetuser." >&4
2661              ;;
2662         esac
2663         case "$targetfrom" in
2664         scp)    q=-q ;;
2665         *)      q='' ;;
2666         esac
2667         case "$targetrun" in
2668         ssh|rsh)
2669             cat >$run <<EOF
2670 #!/bin/sh
2671 case "\$1" in
2672 -cwd)
2673   shift
2674   cwd=\$1
2675   shift
2676   ;;
2677 esac
2678 case "\$cwd" in
2679 '') cwd=$targetdir ;;
2680 esac
2681 exe=\$1
2682 shift
2683 if $test ! -f \$exe.xok; then
2684   $to \$exe
2685   $touch \$exe.xok
2686 fi
2687 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2688 EOF
2689             ;;
2690         *)  echo "Unknown targetrun '$targetrun'" >&4
2691             exit 1
2692             ;;
2693         esac
2694         case "$targetmkdir" in
2695         */Cross/mkdir)
2696             cat >$targetmkdir <<EOF
2697 #!/bin/sh
2698 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2699 EOF
2700             $chmod a+rx $targetmkdir
2701             ;;
2702         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2703             exit 1
2704             ;;
2705         esac
2706         case "$targetto" in
2707         scp|rcp)
2708             cat >$to <<EOF
2709 #!/bin/sh
2710 for f in \$@
2711 do
2712   case "\$f" in
2713   /*)
2714     $targetmkdir \`dirname \$f\`
2715     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2716     ;;
2717   *)
2718     $targetmkdir $targetdir/\`dirname \$f\`
2719     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2720     ;;
2721   esac
2722 done
2723 exit 0
2724 EOF
2725             ;;
2726         cp) cat >$to <<EOF
2727 #!/bin/sh
2728 for f in \$@
2729 do
2730   case "\$f" in
2731   /*)
2732     $mkdir -p $targetdir/\`dirname \$f\`
2733     $cp \$f $targetdir/\$f || exit 1
2734     ;;
2735   *)
2736     $targetmkdir $targetdir/\`dirname \$f\`
2737     $cp \$f $targetdir/\$f || exit 1
2738     ;;
2739   esac
2740 done
2741 exit 0
2742 EOF
2743             ;;
2744         *)  echo "Unknown targetto '$targetto'" >&4
2745             exit 1
2746             ;;
2747         esac
2748         case "$targetfrom" in
2749         scp|rcp)
2750           cat >$from <<EOF
2751 #!/bin/sh
2752 for f in \$@
2753 do
2754   $rm -f \$f
2755   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2756 done
2757 exit 0
2758 EOF
2759             ;;
2760         cp) cat >$from <<EOF
2761 #!/bin/sh
2762 for f in \$@
2763 do
2764   $rm -f \$f
2765   cp $targetdir/\$f . || exit 1
2766 done
2767 exit 0
2768 EOF
2769             ;;
2770         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2771             exit 1
2772             ;;
2773         esac
2774         if $test ! -f $run; then
2775             echo "Target 'run' script '$run' not found." >&4
2776         else
2777             $chmod a+rx $run
2778         fi
2779         if $test ! -f $to; then
2780             echo "Target 'to' script '$to' not found." >&4
2781         else
2782             $chmod a+rx $to
2783         fi
2784         if $test ! -f $from; then
2785             echo "Target 'from' script '$from' not found." >&4
2786         else
2787             $chmod a+rx $from
2788         fi
2789         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2790             exit 1
2791         fi
2792         cat >&4 <<EOF
2793 Using '$run' for remote execution,
2794 and '$from' and '$to'
2795 for remote file transfer.
2796 EOF
2797         ;;
2798 *)      run=''
2799         to=:
2800         from=:
2801         usecrosscompile='undef'
2802         targetarch=''
2803         ;;
2804 esac
2805
2806 : see whether [:lower:] and [:upper:] are supported character classes
2807 echo " "
2808 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2809 ABYZ)
2810         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2811         up='[:upper:]'
2812         low='[:lower:]'
2813         ;;
2814 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2815         # (0xc9 and 0xd1), therefore that is a nice testing point.
2816         if test "X$up" = X -o "X$low" = X; then
2817             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2818             ij) up='[A-Z]'
2819                 low='[a-z]'
2820                 ;;
2821             esac
2822         fi
2823         if test "X$up" = X -o "X$low" = X; then
2824             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2825             ij) up='A-Z'
2826                 low='a-z'
2827                 ;;
2828             esac
2829         fi
2830         if test "X$up" = X -o "X$low" = X; then
2831             case "`echo IJ | od -x 2>/dev/null`" in
2832             *C9D1*|*c9d1*)
2833                 echo "Hey, this might be EBCDIC." >&4
2834                 if test "X$up" = X -o "X$low" = X; then
2835                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2836                     ij) up='[A-IJ-RS-Z]'
2837                         low='[a-ij-rs-z]'
2838                         ;;
2839                     esac
2840                 fi
2841                 if test "X$up" = X -o "X$low" = X; then
2842                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2843                     ij) up='A-IJ-RS-Z'
2844                         low='a-ij-rs-z'
2845                         ;;
2846                     esac
2847                 fi
2848                 ;;
2849             esac
2850         fi
2851 esac
2852 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2853 ij)
2854     echo "Using $up and $low to convert case." >&4
2855     ;;
2856 *)
2857     echo "I don't know how to translate letters from upper to lower case." >&4
2858     echo "Your tr is not acting any way I know of." >&4
2859     exit 1
2860     ;;
2861 esac
2862 : set up the translation script tr, must be called with ./tr of course
2863 cat >tr <<EOSC
2864 $startsh
2865 case "\$1\$2" in
2866 '[A-Z][a-z]') exec $tr '$up' '$low';;
2867 '[a-z][A-Z]') exec $tr '$low' '$up';;
2868 esac
2869 exec $tr "\$@"
2870 EOSC
2871 chmod +x tr
2872 $eunicefix tr
2873
2874 : Try to determine whether config.sh was made on this system
2875 case "$config_sh" in
2876 '')
2877 myuname=`$uname -a 2>/dev/null`
2878 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2879 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2880 # because the A-Z/a-z are not consecutive.
2881 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2882         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2883 newmyuname="$myuname"
2884 dflt=n
2885 case "$knowitall" in
2886 '')
2887         if test -f ../config.sh; then
2888                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2889                         eval "`grep myuname= ../config.sh`"
2890                 fi
2891                 if test "X$myuname" = "X$newmyuname"; then
2892                         dflt=y
2893                 fi
2894         fi
2895         ;;
2896 *) dflt=y;;
2897 esac
2898
2899 : Get old answers from old config file if Configure was run on the
2900 : same system, otherwise use the hints.
2901 hint=default
2902 cd ..
2903 if test -f config.sh; then
2904         echo " "
2905         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2906         . UU/myread
2907         case "$ans" in
2908         n*|N*) echo "OK, I'll ignore it."
2909                 mv config.sh config.sh.old
2910                 myuname="$newmyuname"
2911                 ;;
2912         *)  echo "Fetching default answers from your old config.sh file..." >&4
2913                 tmp_n="$n"
2914                 tmp_c="$c"
2915                 tmp_sh="$sh"
2916                 . ./config.sh
2917                 cp config.sh UU
2918                 n="$tmp_n"
2919                 c="$tmp_c"
2920                 : Older versions did not always set $sh.  Catch re-use of such
2921                 : an old config.sh.
2922                 case "$sh" in
2923                 '') sh="$tmp_sh" ;;
2924                 esac
2925                 hint=previous
2926                 ;;
2927         esac
2928 fi
2929 . ./UU/checkcc
2930 if test ! -f config.sh; then
2931         $cat <<EOM
2932
2933 First time through, eh?  I have some defaults handy for some systems
2934 that need some extra help getting the Configure answers right:
2935
2936 EOM
2937         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2938         dflt=''
2939         : Half the following guesses are probably wrong... If you have better
2940         : tests or hints, please send them to perlbug@perl.org
2941         : The metaconfig authors would also appreciate a copy...
2942         $test -f /irix && osname=irix
2943         $test -f /xenix && osname=sco_xenix
2944         $test -f /dynix && osname=dynix
2945         $test -f /dnix && osname=dnix
2946         $test -f /lynx.os && osname=lynxos
2947         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2948         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2949         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2950         $test -f /bin/mips && /bin/mips && osname=mips
2951         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2952                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2953         $test -d /usr/apollo/bin && osname=apollo
2954         $test -f /etc/saf/_sactab && osname=svr4
2955         $test -d /usr/include/minix && osname=minix
2956         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2957         if $test -d /MachTen -o -d /MachTen_Folder; then
2958                 osname=machten
2959                 if $test -x /sbin/version; then
2960                         osvers=`/sbin/version | $awk '{print $2}' |
2961                         $sed -e 's/[A-Za-z]$//'`
2962                 elif $test -x /usr/etc/version; then
2963                         osvers=`/usr/etc/version | $awk '{print $2}' |
2964                         $sed -e 's/[A-Za-z]$//'`
2965                 else
2966                         osvers="$2.$3"
2967                 fi
2968         fi
2969
2970         $test -f /sys/posix.dll &&
2971                 $test -f /usr/bin/what &&
2972                 set X `/usr/bin/what /sys/posix.dll` &&
2973                 $test "$3" = UWIN &&
2974                 osname=uwin &&
2975                 osvers="$5"
2976
2977         if $test -f $uname; then
2978                 set X $myuname
2979                 shift
2980
2981                 case "$5" in
2982                 fps*) osname=fps ;;
2983                 mips*)
2984                         case "$4" in
2985                         umips) osname=umips ;;
2986                         *) osname=mips ;;
2987                         esac;;
2988                 [23]100) osname=mips ;;
2989                 next*) osname=next ;;
2990                 i386*)
2991                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2992                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2993                                 osname='sco'
2994                                 osvers=$tmp
2995                         elif $test -f /etc/kconfig; then
2996                                 osname=isc
2997                                 if test "$lns" = "$ln -s"; then
2998                                         osvers=4
2999                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3000                                         osvers=3
3001                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3002                                         osvers=2
3003                                 fi
3004                         fi
3005                         tmp=''
3006                         ;;
3007                 pc*)
3008                         if test -n "$DJGPP"; then
3009                                 osname=dos
3010                                 osvers=djgpp
3011                         fi
3012                         ;;
3013                 esac
3014
3015                 case "$1" in
3016                 aix) osname=aix
3017                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3018                         case "$tmp" in
3019                         'not found') osvers="$4"."$3" ;;
3020                         '<3240'|'<>3240') osvers=3.2.0 ;;
3021                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3022                         '=3250'|'>3250') osvers=3.2.5 ;;
3023                         *) osvers=$tmp;;
3024                         esac
3025                         ;;
3026                 bsd386) osname=bsd386
3027                         osvers=`$uname -r`
3028                         ;;
3029                 cygwin*) osname=cygwin
3030                         osvers="$3"
3031                         ;;
3032                 *dc.osx) osname=dcosx
3033                         osvers="$3"
3034                         ;;
3035                 dnix) osname=dnix
3036                         osvers="$3"
3037                         ;;
3038                 domainos) osname=apollo
3039                         osvers="$3"
3040                         ;;
3041                 dgux) osname=dgux 
3042                         osvers="$3"
3043                         ;;
3044                 dynixptx*) osname=dynixptx
3045                         osvers=`echo "$4"|sed 's/^v//'`
3046                         ;;
3047                 freebsd) osname=freebsd 
3048                         osvers="$3" ;;
3049                 genix) osname=genix ;;
3050                 hp*) osname=hpux 
3051                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3052                         ;;
3053                 irix*) osname=irix
3054                         case "$3" in
3055                         4*) osvers=4 ;;
3056                         5*) osvers=5 ;;
3057                         *)      osvers="$3" ;;
3058                         esac
3059                         ;;
3060                 linux) osname=linux
3061                         case "$3" in
3062                         *)      osvers="$3" ;;
3063                         esac
3064                         ;;
3065                 MiNT) osname=mint
3066                         ;;
3067                 netbsd*) osname=netbsd
3068                         osvers="$3"
3069                         ;;
3070                 news-os) osvers="$3"
3071                         case "$3" in
3072                         4*) osname=newsos4 ;;
3073                         *) osname=newsos ;;
3074                         esac
3075                         ;;
3076                 next*) osname=next ;;
3077                 nonstop-ux) osname=nonstopux ;;
3078                 openbsd) osname=openbsd
3079                         osvers="$3"
3080                         ;;
3081                 POSIX-BC | posix-bc ) osname=posix-bc
3082                         osvers="$3"
3083                         ;;
3084                 powerux | power_ux | powermax_os | powermaxos | \
3085                 powerunix | power_unix) osname=powerux
3086                         osvers="$3"
3087                         ;;
3088                 qnx) osname=qnx
3089                         osvers="$4"
3090                         ;;
3091                 solaris) osname=solaris
3092                         case "$3" in
3093                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3094                         *)      osvers="$3" ;;
3095                         esac
3096                         ;;
3097                 sunos) osname=sunos
3098                         case "$3" in
3099                         5*) osname=solaris
3100                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3101                         *)      osvers="$3" ;;
3102                         esac
3103                         ;;
3104                 titanos) osname=titanos
3105                         case "$3" in
3106                         1*) osvers=1 ;;
3107                         2*) osvers=2 ;;
3108                         3*) osvers=3 ;;
3109                         4*) osvers=4 ;;
3110                         *)      osvers="$3" ;;
3111                         esac
3112                         ;;
3113                 ultrix) osname=ultrix
3114                         osvers="$3"
3115                         ;;
3116                 osf1|mls+)      case "$5" in
3117                                 alpha)
3118                                         osname=dec_osf
3119                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3120                                         case "$osvers" in
3121                                         [1-9].[0-9]*) ;;
3122                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3123                                         esac
3124                                         ;;
3125                         hp*)    osname=hp_osf1  ;;
3126                         mips)   osname=mips_osf1 ;;
3127                         esac
3128                         ;;
3129                 unixware) osname=svr5
3130                         osvers="$4"
3131                         ;;
3132                 uts)    osname=uts
3133                         osvers="$3"
3134                         ;;
3135                 vos) osvers="$3"
3136                         ;;
3137                 $2) case "$osname" in
3138                         *isc*) ;;
3139                         *freebsd*) ;;
3140                         svr*)
3141                                 : svr4.x or possibly later
3142                                 case "svr$3" in 
3143                                 ${osname}*)
3144                                         osname=svr$3
3145                                         osvers=$4
3146                                         ;;
3147                                 esac
3148                                 case "$osname" in
3149                                 svr4.0)
3150                                         : Check for ESIX
3151                                         if test -f /stand/boot ; then
3152                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3153                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3154                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3155                                                         if test -n "$isesix"; then
3156                                                                 osname=esix4
3157                                                         fi
3158                                                 fi
3159                                         fi
3160                                         ;;
3161                                 esac
3162                                 ;;
3163                         *)      if test -f /etc/systemid; then
3164                                         osname=sco
3165                                         set `echo $3 | $sed 's/\./ /g'` $4
3166                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3167                                                 osvers=$1.$2.$3
3168                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3169                                                 osvers=$1.$2
3170                                         elif $test -f $src/hints/sco_$1.sh; then
3171                                                 osvers=$1
3172                                         fi
3173                                 else
3174                                         case "$osname" in
3175                                         '') : Still unknown.  Probably a generic Sys V.
3176                                                 osname="sysv"
3177                                                 osvers="$3"
3178                                                 ;;
3179                                         esac
3180                                 fi
3181                                 ;;
3182                         esac
3183                         ;;
3184                 *)      case "$osname" in
3185                         '') : Still unknown.  Probably a generic BSD.
3186                                 osname="$1"
3187                                 osvers="$3"
3188                                 ;;
3189                         esac
3190                         ;;
3191                 esac
3192         else
3193                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3194                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3195                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3196                                 osname=news_os
3197                         fi
3198                         $rm -f UU/kernel.what
3199                 elif test -d c:/.; then
3200                         set X $myuname
3201                         osname=os2
3202                         osvers="$5"
3203                 fi
3204         fi
3205         
3206         case "$targetarch" in
3207         '') ;;
3208         *)  hostarch=$osname
3209             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3210             osvers=''
3211             ;;
3212         esac
3213
3214         : Now look for a hint file osname_osvers, unless one has been
3215         : specified already.
3216         case "$hintfile" in
3217         ''|' ')
3218                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3219                 : Also try without trailing minor version numbers.
3220                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3221                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3222                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3223                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3224                 case "$file" in
3225                 '') dflt=none ;;
3226                 *)  case "$osvers" in
3227                         '') dflt=$file
3228                                 ;;
3229                         *)  if $test -f $src/hints/$file.sh ; then
3230                                         dflt=$file
3231                                 elif $test -f $src/hints/$xfile.sh ; then
3232                                         dflt=$xfile
3233                                 elif $test -f $src/hints/$xxfile.sh ; then
3234                                         dflt=$xxfile
3235                                 elif $test -f $src/hints/$xxxfile.sh ; then
3236                                         dflt=$xxxfile
3237                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3238                                         dflt=$xxxxfile
3239                                 elif $test -f "$src/hints/${osname}.sh" ; then
3240                                         dflt="${osname}"
3241                                 else
3242                                         dflt=none
3243                                 fi
3244                                 ;;
3245                         esac
3246                         ;;
3247                 esac
3248                 if $test -f Policy.sh ; then
3249                         case "$dflt" in
3250                         *Policy*) ;;
3251                         none) dflt="Policy" ;;
3252                         *) dflt="Policy $dflt" ;;
3253                         esac
3254                 fi
3255                 ;;
3256         *)
3257                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3258                 ;;
3259         esac
3260
3261         if $test -f Policy.sh ; then
3262                 $cat <<EOM
3263
3264 There's also a Policy hint file available, which should make the
3265 site-specific (policy) questions easier to answer.
3266 EOM
3267
3268         fi
3269
3270         $cat <<EOM
3271
3272 You may give one or more space-separated answers, or "none" if appropriate.
3273 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3274 is a good thing.  DO NOT give a wrong version or a wrong OS.
3275
3276 EOM
3277
3278         rp="Which of these apply, if any?"
3279         . UU/myread
3280         tans=$ans
3281         for file in $tans; do
3282                 if $test X$file = XPolicy -a -f Policy.sh; then
3283                         . Policy.sh
3284                         $cat Policy.sh >> UU/config.sh
3285                 elif $test -f $src/hints/$file.sh; then
3286                         . $src/hints/$file.sh
3287                         $cat $src/hints/$file.sh >> UU/config.sh
3288                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3289                         : nothing
3290                 else
3291                         : Give one chance to correct a possible typo.
3292                         echo "$file.sh does not exist"
3293                         dflt=$file
3294                         rp="hint to use instead?"
3295                         . UU/myread
3296                         for file in $ans; do
3297                                 if $test -f "$src/hints/$file.sh"; then
3298                                         . $src/hints/$file.sh
3299                                         $cat $src/hints/$file.sh >> UU/config.sh
3300                                 elif $test X$ans = X -o X$ans = Xnone ; then
3301                                         : nothing
3302                                 else
3303                                         echo "$file.sh does not exist -- ignored."
3304                                 fi
3305                         done
3306                 fi
3307         done
3308
3309         hint=recommended
3310         : Remember our hint file for later.
3311         if $test -f "$src/hints/$file.sh" ; then
3312                 hintfile="$file"
3313         else
3314                 hintfile=''
3315         fi
3316 fi
3317 cd UU
3318 ;;
3319 *)
3320         echo " "
3321         echo "Fetching default answers from $config_sh..." >&4
3322         tmp_n="$n"
3323         tmp_c="$c"
3324         cd ..
3325         cp $config_sh config.sh 2>/dev/null
3326         chmod +w config.sh
3327         . ./config.sh
3328         cd UU
3329         cp ../config.sh .
3330         n="$tmp_n"
3331         c="$tmp_c"
3332         hint=previous
3333         ;;
3334 esac
3335 test "$override" && . ./optdef.sh
3336
3337 : Restore computed paths
3338 for file in $loclist $trylist; do
3339         eval $file="\$_$file"
3340 done
3341
3342 cat << EOM
3343
3344 Configure uses the operating system name and version to set some defaults.
3345 The default value is probably right if the name rings a bell. Otherwise,
3346 since spelling matters for me, either accept the default or answer "none"
3347 to leave it blank.
3348
3349 EOM
3350 case "$osname" in
3351         ''|' ')
3352                 case "$hintfile" in
3353                 ''|' '|none) dflt=none ;;
3354                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3355                 esac
3356                 ;;
3357         *) dflt="$osname" ;;
3358 esac
3359 rp="Operating system name?"
3360 . ./myread
3361 case "$ans" in
3362 none)  osname='' ;;
3363 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3364 esac
3365 echo " "
3366 case "$osvers" in
3367         ''|' ')
3368                 case "$hintfile" in
3369                 ''|' '|none) dflt=none ;;
3370                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3371                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3372                         case "$dflt" in
3373                         ''|' ') dflt=none ;;
3374                         esac
3375                         ;;
3376                 esac
3377                 ;;
3378         *) dflt="$osvers" ;;
3379 esac
3380 rp="Operating system version?"
3381 . ./myread
3382 case "$ans" in
3383 none)  osvers='' ;;
3384 *) osvers="$ans" ;;
3385 esac
3386
3387
3388 . ./posthint.sh
3389
3390 : who configured the system
3391 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3392 cf_by=`(logname) 2>/dev/null`
3393 case "$cf_by" in
3394 "")
3395         cf_by=`(whoami) 2>/dev/null`
3396         case "$cf_by" in
3397         "") cf_by=unknown ;;
3398         esac ;;
3399 esac
3400
3401 : set up the script used to warn in case of inconsistency
3402 cat <<EOS >whoa
3403 $startsh
3404 EOS
3405 cat <<'EOSC' >>whoa
3406 dflt=y
3407 echo " "
3408 echo "*** WHOA THERE!!! ***" >&4
3409 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3410 rp="    Keep the $hint value?"
3411 . ./myread
3412 case "$ans" in
3413 y) td=$was; tu=$was;;
3414 esac
3415 EOSC
3416
3417 : function used to set $1 to $val
3418 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3419 case "$val$was" in
3420 $define$undef) . ./whoa; eval "$var=\$td";;
3421 $undef$define) . ./whoa; eval "$var=\$tu";;
3422 *) eval "$var=$val";;
3423 esac'
3424
3425 case "$usethreads" in
3426 $define|true|[yY]*)     dflt='y';;
3427 *)     # Catch case where user specified ithreads or 5005threads but
3428        # forgot -Dusethreads (A.D. 4/2002)
3429        case "$useithreads$use5005threads" in
3430        *$define*)      dflt='y' ;;
3431        *)      dflt='n';;
3432        esac
3433        ;;
3434 esac
3435 cat <<EOM
3436
3437 Perl can be built to take advantage of threads on some systems.
3438 To do so, Configure can be run with -Dusethreads.
3439
3440 Note that threading is a highly experimental feature, and
3441 some known race conditions still remain.  If you choose to try
3442 it, be very sure to not actually deploy it for production
3443 purposes.  README.threads has more details, and is required
3444 reading if you enable threads.
3445
3446 If this doesn't make any sense to you, just accept the default '$dflt'.
3447 EOM
3448 rp='Build a threading Perl?'
3449 . ./myread
3450 case "$ans" in
3451 y|Y)    val="$define" ;;
3452 *)      val="$undef" ;;
3453 esac
3454 set usethreads
3455 eval $setvar
3456
3457 case "$usethreads" in
3458 $define)
3459         $cat <<EOM
3460
3461 As of release 5.6, Perl has two different threading implementations,
3462 an interpreter-based version (ithreads) with one interpreter per
3463 thread, and the 5.005 version (5005threads).  Both implementations
3464 are considered experimental, but since 5.8 ithreads somewhat less so.
3465 The 5005threads is effectively unmaintained.
3466
3467 EOM
3468         : Default to ithreads unless overridden on command line or with
3469         : old config.sh
3470         dflt='y'
3471         case "$use5005threads" in
3472                 $define|true|[yY]*) dflt='n';;
3473         esac
3474         case "$useithreads" in
3475                 $undef|false|[nN]*) dflt='n';;
3476         esac
3477         rp='Use interpreter-based ithreads?'
3478         . ./myread
3479         case "$ans" in
3480         y|Y)    val="$define" ;;
3481         *)      val="$undef" ;;
3482         esac
3483         set useithreads
3484         eval $setvar
3485         : Now set use5005threads to the opposite value.
3486         case "$useithreads" in
3487         $define) val="$undef" ;;
3488         *) val="$define" ;;
3489         esac
3490         set use5005threads
3491         eval $setvar
3492         ;;
3493 *)
3494         useithreads="$undef"
3495         use5005threads="$undef"
3496         ;;
3497 esac
3498
3499 case "$useithreads$use5005threads" in
3500 "$define$define")
3501         $cat >&4 <<EOM
3502
3503 You cannot have both the ithreads and the 5.005 threads enabled
3504 at the same time.  Disabling the 5.005 threads since they are
3505 much less stable than the ithreads.
3506
3507 EOM
3508         use5005threads="$undef"
3509         ;;
3510 esac
3511
3512 case "$d_oldpthreads" in
3513 '')     : Configure tests would be welcome here.  For now, assume undef.
3514         val="$undef" ;;
3515 *)      val="$d_oldpthreads" ;;
3516 esac
3517 set d_oldpthreads
3518 eval $setvar
3519
3520
3521 case "$usethreads" in
3522 "$define"|true|[yY]*)
3523 : Look for a hint-file generated 'call-back-unit'.  If the
3524 : user has specified that a threading perl is to be built,
3525 : we may need to set or change some other defaults.
3526         if $test -f usethreads.cbu; then
3527                 echo "Your platform has some specific hints for threaded builds, using them..."
3528                 . ./usethreads.cbu
3529         else
3530                 $cat <<EOM
3531 (Your platform doesn't have any specific hints for threaded builds.
3532  Assuming POSIX threads, then.)
3533 EOM
3534         fi
3535         ;;
3536 esac
3537
3538 cat <<EOM
3539
3540 Perl can be built so that multiple Perl interpreters can coexist
3541 within the same Perl executable.
3542 EOM
3543
3544 case "$useithreads" in
3545 $define)
3546         cat <<EOM
3547 This multiple interpreter support is required for interpreter-based threads.
3548 EOM
3549         val="$define"
3550         ;;
3551 *)      case "$usemultiplicity" in
3552         $define|true|[yY]*)     dflt='y';;
3553         *) dflt='n';;
3554         esac
3555         echo " "
3556         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3557         rp='Build Perl for multiplicity?'
3558         . ./myread
3559         case "$ans" in
3560         y|Y)    val="$define" ;;
3561         *)      val="$undef" ;;
3562         esac
3563         ;;
3564 esac
3565 set usemultiplicity
3566 eval $setvar
3567
3568
3569 case "$usemorebits" in
3570 "$define"|true|[yY]*)
3571         use64bitint="$define"
3572         uselongdouble="$define"
3573         usemorebits="$define"
3574         ;;
3575 *)      usemorebits="$undef"
3576         ;;
3577 esac
3578
3579 : make some quick guesses about what we are up against
3580 echo " "
3581 $echo $n "Hmm...  $c"
3582 echo exit 1 >bsd
3583 echo exit 1 >usg
3584 echo exit 1 >v7
3585 echo exit 1 >osf1
3586 echo exit 1 >eunice
3587 echo exit 1 >xenix
3588 echo exit 1 >venix
3589 echo exit 1 >os2
3590 d_bsd="$undef"
3591 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3592 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3593 then
3594         echo "Looks kind of like an OSF/1 system, but we'll see..."
3595         echo exit 0 >osf1
3596 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3597         xxx=`./loc addbib blurfl $pth`
3598         if $test -f $xxx; then
3599         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3600                 echo exit 0 >bsd
3601                 echo exit 0 >usg
3602         else
3603                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3604                         echo "Looks kind of like an extended USG system, but we'll see..."
3605                 else
3606                         echo "Looks kind of like a USG system, but we'll see..."
3607                 fi
3608                 echo exit 0 >usg
3609         fi
3610 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3611         echo "Looks kind of like a BSD system, but we'll see..."
3612         d_bsd="$define"
3613         echo exit 0 >bsd
3614 else
3615         echo "Looks kind of like a Version 7 system, but we'll see..."
3616         echo exit 0 >v7
3617 fi
3618 case "$eunicefix" in
3619 *unixtovms*)
3620         $cat <<'EOI'
3621 There is, however, a strange, musty smell in the air that reminds me of
3622 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3623 EOI
3624         echo exit 0 >eunice
3625         d_eunice="$define"
3626 : it so happens the Eunice I know will not run shell scripts in Unix format
3627         ;;
3628 *)
3629         echo " "
3630         echo "Congratulations.  You aren't running Eunice."
3631         d_eunice="$undef"
3632         ;;
3633 esac
3634 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3635 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3636 : semicolon as a patch separator
3637 case "$p_" in
3638 :) ;;
3639 *)
3640         $cat <<'EOI'
3641 I have the feeling something is not exactly right, however...don't tell me...
3642 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3643 (Or you may be running DOS with DJGPP.)
3644 EOI
3645         echo exit 0 >os2
3646         ;;
3647 esac
3648 if test -f /xenix; then
3649         echo "Actually, this looks more like a XENIX system..."
3650         echo exit 0 >xenix
3651         d_xenix="$define"
3652 else
3653         echo " "
3654         echo "It's not Xenix..."
3655         d_xenix="$undef"
3656 fi
3657 chmod +x xenix
3658 $eunicefix xenix
3659 if test -f /venix; then
3660         echo "Actually, this looks more like a VENIX system..."
3661         echo exit 0 >venix
3662 else
3663         echo " "
3664         if ./xenix; then
3665                 : null
3666         else
3667                 echo "Nor is it Venix..."
3668         fi
3669 fi
3670 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3671 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3672 $rm -f foo
3673
3674 case "$cc" in
3675 '') dflt=cc;;
3676 *) dflt="$cc";;
3677 esac
3678 rp="Use which C compiler?"
3679 . ./myread
3680 cc="$ans"
3681
3682 : See if they have not cc but they do have gcc
3683 . ./trygcc
3684 : Look for a hint-file generated 'call-back-unit'.  Now that the
3685 : user has specified the compiler, we may need to set or change some
3686 : other defaults.
3687 if $test -f cc.cbu; then
3688     . ./cc.cbu
3689 fi
3690 . ./checkcc
3691
3692 echo " "
3693 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3694 $cat >try.c <<EOM
3695 #include <stdio.h>
3696 int main() {
3697 #ifdef __GNUC__
3698 #ifdef __VERSION__
3699         printf("%s\n", __VERSION__);
3700 #else
3701         printf("%s\n", "1");
3702 #endif
3703 #endif
3704         exit(0);
3705 }
3706 EOM
3707 if $cc -o try $ccflags $ldflags try.c; then
3708         gccversion=`$run ./try`
3709         case "$gccversion" in
3710         '') echo "You are not using GNU cc." ;;
3711         *)  echo "You are using GNU cc $gccversion."
3712             ccname=gcc  
3713             ;;
3714         esac
3715 else
3716         echo " "
3717         echo "*** WHOA THERE!!! ***" >&4
3718         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3719         case "$knowitall" in
3720         '')
3721         echo "    You'd better start hunting for one and let me know about it." >&4
3722                 exit 1
3723                 ;;
3724         esac
3725 fi
3726 $rm -f try try.*
3727 case "$gccversion" in
3728 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3729 esac
3730 case "$gccversion" in
3731 '') gccosandvers='' ;;
3732 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3733    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3734    gccshortvers=''
3735    case "$gccosandvers" in
3736    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3737    $osname$osvers) ;; # looking good
3738    $osname*) cat <<EOM >&4
3739
3740 *** WHOA THERE!!! ***
3741
3742     Your gcc has not been compiled for the exact release of
3743     your operating system ($gccosandvers versus $osname$osvers).
3744
3745     In general it is a good idea to keep gcc synchronized with
3746     the operating system because otherwise serious problems
3747     may ensue when trying to compile software, like Perl.
3748
3749     I'm trying to be optimistic here, though, and will continue.
3750     If later during the configuration and build icky compilation
3751     problems appear (headerfile conflicts being the most common
3752     manifestation), I suggest reinstalling the gcc to match
3753     your operating system release.
3754
3755 EOM
3756       ;;
3757    *) gccosandvers='' ;; # failed to parse, better be silent
3758    esac
3759    ;;
3760 esac
3761 case "$ccname" in
3762 '') ccname="$cc" ;;
3763 esac
3764
3765
3766 : decide how portable to be.  Allow command line overrides.
3767 case "$d_portable" in
3768 "$undef") ;;
3769 *)      d_portable="$define" ;;
3770 esac
3771
3772 : set up shell script to do ~ expansion
3773 cat >filexp <<EOSS
3774 $startsh
3775 : expand filename
3776 case "\$1" in
3777  ~/*|~)
3778         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3779         ;;
3780  ~*)
3781         if $test -f /bin/csh; then
3782                 /bin/csh -f -c "glob \$1"
3783                 failed=\$?
3784                 echo ""
3785                 exit \$failed
3786         else
3787                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3788                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3789                 if $test ! -d "\$dir"; then
3790                         me=\`basename \$0\`
3791                         echo "\$me: can't locate home directory for: \$name" >&2
3792                         exit 1
3793                 fi
3794                 case "\$1" in
3795                 */*)
3796                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3797                         ;;
3798                 *)
3799                         echo \$dir
3800                         ;;
3801                 esac
3802         fi
3803         ;;
3804 *)
3805         echo \$1
3806         ;;
3807 esac
3808 EOSS
3809 chmod +x filexp
3810 $eunicefix filexp
3811
3812 : now set up to get a file name
3813 cat <<EOS >getfile
3814 $startsh
3815 EOS
3816 cat <<'EOSC' >>getfile
3817 tilde=''
3818 fullpath=''
3819 already=''
3820 skip=''
3821 none_ok=''
3822 exp_file=''
3823 nopath_ok=''
3824 orig_rp="$rp"
3825 orig_dflt="$dflt"
3826 case "$gfpth" in
3827 '') gfpth='.' ;;
3828 esac
3829
3830 case "$fn" in
3831 *\(*)
3832         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3833         fn=`echo $fn | sed 's/(.*)//'`
3834         ;;
3835 esac
3836
3837 case "$fn" in
3838 *:*)
3839         loc_file=`expr $fn : '.*:\(.*\)'`
3840         fn=`expr $fn : '\(.*\):.*'`
3841         ;;
3842 esac
3843
3844 case "$fn" in
3845 *~*) tilde=true;;
3846 esac
3847 case "$fn" in
3848 */*) fullpath=true;;
3849 esac
3850 case "$fn" in
3851 *+*) skip=true;;
3852 esac
3853 case "$fn" in
3854 *n*) none_ok=true;;
3855 esac
3856 case "$fn" in
3857 *e*) exp_file=true;;
3858 esac
3859 case "$fn" in
3860 *p*) nopath_ok=true;;
3861 esac
3862
3863 case "$fn" in
3864 *f*) type='File';;
3865 *d*) type='Directory';;
3866 *l*) type='Locate';;
3867 esac
3868
3869 what="$type"
3870 case "$what" in
3871 Locate) what='File';;
3872 esac
3873
3874 case "$exp_file" in
3875 '')
3876         case "$d_portable" in
3877         "$define") ;;
3878         *) exp_file=true;;
3879         esac
3880         ;;
3881 esac
3882
3883 cd ..
3884 while test "$type"; do
3885         redo=''
3886         rp="$orig_rp"
3887         dflt="$orig_dflt"
3888         case "$tilde" in
3889         true) rp="$rp (~name ok)";;
3890         esac
3891         . UU/myread
3892         if test -f UU/getfile.ok && \
3893                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3894         then
3895                 value="$ans"
3896                 ansexp="$ans"
3897                 break
3898         fi
3899         case "$ans" in
3900         none)
3901                 value=''
3902                 ansexp=''
3903                 case "$none_ok" in
3904                 true) type='';;
3905                 esac
3906                 ;;
3907         *)
3908                 case "$tilde" in
3909                 '') value="$ans"
3910                         ansexp="$ans";;
3911                 *)
3912                         value=`UU/filexp $ans`
3913                         case $? in
3914                         0)
3915                                 if test "$ans" != "$value"; then
3916                                         echo "(That expands to $value on this system.)"
3917                                 fi
3918                                 ;;
3919                         *) value="$ans";;
3920                         esac
3921                         ansexp="$value"
3922                         case "$exp_file" in
3923                         '') value="$ans";;
3924                         esac
3925                         ;;
3926                 esac
3927                 case "$fullpath" in
3928                 true)
3929                         case "$ansexp" in
3930                         /*) value="$ansexp" ;;
3931                         [a-zA-Z]:/*) value="$ansexp" ;;
3932                         *)
3933                                 redo=true
3934                                 case "$already" in
3935                                 true)
3936                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3937                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3938                                         ;;
3939                                 *)
3940                                 echo "Please give a full path name, starting with slash." >&4
3941                                         case "$tilde" in
3942                                         true)
3943                                 echo "Note that using ~name is ok provided it expands well." >&4
3944                                                 already=true
3945                                                 ;;
3946                                         esac
3947                                 esac
3948                                 ;;
3949                         esac
3950                         ;;
3951                 esac
3952                 case "$redo" in
3953                 '')
3954                         case "$type" in
3955                         File)
3956                                 for fp in $gfpth; do
3957                                         if test "X$fp" = X.; then
3958                                             pf="$ansexp"
3959                                         else    
3960                                             pf="$fp/$ansexp"
3961                                         fi
3962                                         if test -f "$pf"; then
3963                                                 type=''
3964                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3965                                         then
3966                                                 echo "($value is not a plain file, but that's ok.)"
3967                                                 type=''
3968                                         fi
3969                                         if test X"$type" = X; then
3970                                             value="$pf"
3971                                             break
3972                                         fi
3973                                 done
3974                                 ;;
3975                         Directory)
3976                                 for fp in $gfpth; do
3977                                         if test "X$fp" = X.; then
3978                                             dir="$ans"
3979                                             direxp="$ansexp"
3980                                         else    
3981                                             dir="$fp/$ansexp"
3982                                             direxp="$fp/$ansexp"
3983                                         fi
3984                                         if test -d "$direxp"; then
3985                                                 type=''
3986                                                 value="$dir"
3987                                                 break
3988                                         fi
3989                                 done
3990                                 ;;
3991                         Locate)
3992                                 if test -d "$ansexp"; then
3993                                         echo "(Looking for $loc_file in directory $value.)"
3994                                         value="$value/$loc_file"
3995                                         ansexp="$ansexp/$loc_file"
3996                                 fi
3997                                 if test -f "$ansexp"; then
3998                                         type=''
3999                                 fi
4000                                 case "$nopath_ok" in
4001                                 true)   case "$value" in
4002                                         */*) ;;
4003                                         *)      echo "Assuming $value will be in people's path."
4004                                                 type=''
4005                                                 ;;
4006                                         esac
4007                                         ;;
4008                                 esac
4009                                 ;;
4010                         esac
4011
4012                         case "$skip" in
4013                         true) type='';
4014                         esac
4015
4016                         case "$type" in
4017                         '') ;;
4018                         *)
4019                                 if test "$fastread" = yes; then
4020                                         dflt=y
4021                                 else
4022                                         dflt=n
4023                                 fi
4024                                 rp="$what $value doesn't exist.  Use that name anyway?"
4025                                 . UU/myread
4026                                 dflt=''
4027                                 case "$ans" in
4028                                 y*) type='';;
4029                                 *) echo " ";;
4030                                 esac
4031                                 ;;
4032                         esac
4033                         ;;
4034                 esac
4035                 ;;
4036         esac
4037 done
4038 cd UU
4039 ans="$value"
4040 rp="$orig_rp"
4041 dflt="$orig_dflt"
4042 rm -f getfile.ok
4043 test "X$gfpthkeep" != Xy && gfpth=""
4044 EOSC
4045
4046 : What should the include directory be ?
4047 echo " "
4048 $echo $n "Hmm...  $c"
4049 dflt='/usr/include'
4050 incpath=''
4051 mips_type=''
4052 if $test -f /bin/mips && /bin/mips; then
4053         echo "Looks like a MIPS system..."
4054         $cat >usr.c <<'EOCP'
4055 #ifdef SYSTYPE_BSD43
4056 /bsd43
4057 #endif
4058 EOCP
4059         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4060                 dflt='/bsd43/usr/include'
4061                 incpath='/bsd43'
4062                 mips_type='BSD 4.3'
4063         else
4064                 mips_type='System V'
4065         fi
4066         $rm -f usr.c usr.out
4067         echo "and you're compiling with the $mips_type compiler and libraries."
4068         xxx_prompt=y
4069         echo "exit 0" >mips
4070 else
4071         echo "Doesn't look like a MIPS system."
4072         xxx_prompt=n
4073         echo "exit 1" >mips
4074 fi
4075 chmod +x mips
4076 $eunicefix mips
4077 case "$usrinc" in
4078 '') ;;
4079 *) dflt="$usrinc";;
4080 esac
4081 case "$xxx_prompt" in
4082 y)      fn=d/
4083         echo " "
4084         rp='Where are the include files you want to use?'
4085         . ./getfile
4086         usrinc="$ans"
4087         ;;
4088 *)      usrinc="$dflt"
4089         ;;
4090 esac
4091
4092 : see how we invoke the C preprocessor
4093 echo " "
4094 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4095 cat <<'EOT' >testcpp.c
4096 #define ABC abc
4097 #define XYZ xyz
4098 ABC.XYZ
4099 EOT
4100 cd ..
4101 if test ! -f cppstdin; then
4102         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4103                 # AIX cc -E doesn't show the absolute headerfile
4104                 # locations but we'll cheat by using the -M flag.
4105                 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
4106         else
4107                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4108         fi
4109 else
4110         echo "Keeping your $hint cppstdin wrapper."
4111 fi
4112 chmod 755 cppstdin
4113 wrapper=`pwd`/cppstdin
4114 ok='false'
4115 cd UU
4116
4117 if $test "X$cppstdin" != "X" && \
4118         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4119         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4120 then
4121         echo "You used to use $cppstdin $cppminus so we'll use that again."
4122         case "$cpprun" in
4123         '') echo "But let's see if we can live without a wrapper..." ;;
4124         *)
4125                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4126                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4127                 then
4128                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4129                         ok='true'
4130                 else
4131                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4132                 fi
4133                 ;;
4134         esac
4135 else
4136         case "$cppstdin" in
4137         '') ;;
4138         *)
4139                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4140                 ;;
4141         esac
4142 fi
4143
4144 if $ok; then
4145         : nothing
4146 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4147         $cc -E <testcpp.c >testcpp.out 2>&1; \
4148         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4149         echo "Yup, it does."
4150         x_cpp="$cc -E"
4151         x_minus='';
4152 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4153         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4154         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4155         echo "Yup, it does."
4156         x_cpp="$cc -E"
4157         x_minus='-';
4158 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4159         $cc -P <testcpp.c >testcpp.out 2>&1; \
4160         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4161         echo "Yipee, that works!"
4162         x_cpp="$cc -P"
4163         x_minus='';
4164 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4165         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4166         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4167         echo "At long last!"
4168         x_cpp="$cc -P"
4169         x_minus='-';
4170 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4171         $cpp <testcpp.c >testcpp.out 2>&1; \
4172         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4173         echo "It works!"
4174         x_cpp="$cpp"
4175         x_minus='';
4176 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4177         $cpp - <testcpp.c >testcpp.out 2>&1; \
4178         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4179         echo "Hooray, it works!  I was beginning to wonder."
4180         x_cpp="$cpp"
4181         x_minus='-';
4182 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4183         $wrapper <testcpp.c >testcpp.out 2>&1; \
4184         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4185         x_cpp="$wrapper"
4186         x_minus=''
4187         echo "Eureka!"
4188 else
4189         dflt=''
4190         rp="No dice.  I can't find a C preprocessor.  Name one:"
4191         . ./myread
4192         x_cpp="$ans"
4193         x_minus=''
4194         $x_cpp <testcpp.c >testcpp.out 2>&1
4195         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4196                 echo "OK, that will do." >&4
4197         else
4198 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4199                 exit 1
4200         fi
4201 fi
4202
4203 case "$ok" in
4204 false)
4205         cppstdin="$x_cpp"
4206         cppminus="$x_minus"
4207         cpprun="$x_cpp"
4208         cpplast="$x_minus"
4209         set X $x_cpp
4210         shift
4211         case "$1" in
4212         "$cpp")
4213                 echo "Perhaps can we force $cc -E using a wrapper..."
4214                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4215                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4216                 then
4217                         echo "Yup, we can."
4218                         cppstdin="$wrapper"
4219                         cppminus='';
4220                 else
4221                         echo "Nope, we'll have to live without it..."
4222                 fi
4223                 ;;
4224         esac
4225         case "$cpprun" in
4226         "$wrapper")
4227                 cpprun=''
4228                 cpplast=''
4229                 ;;
4230         esac
4231         ;;
4232 esac
4233
4234 case "$cppstdin" in
4235 "$wrapper"|'cppstdin') ;;
4236 *) $rm -f $wrapper;;
4237 esac
4238 $rm -f testcpp.c testcpp.out
4239
4240 : Set private lib path
4241 case "$plibpth" in
4242 '') if ./mips; then
4243                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4244         fi;;
4245 esac
4246 case "$libpth" in
4247 ' ') dlist='';;
4248 '') dlist="$loclibpth $plibpth $glibpth";;
4249 *) dlist="$libpth";;
4250 esac
4251
4252 : Now check and see which directories actually exist, avoiding duplicates
4253 libpth=''
4254 for xxx in $dlist
4255 do
4256     if $test -d $xxx; then
4257                 case " $libpth " in
4258                 *" $xxx "*) ;;
4259                 *) libpth="$libpth $xxx";;
4260                 esac
4261     fi
4262 done
4263 $cat <<'EOM'
4264
4265 Some systems have incompatible or broken versions of libraries.  Among
4266 the directories listed in the question below, please remove any you
4267 know not to be holding relevant libraries, and add any that are needed.
4268 Say "none" for none.
4269
4270 EOM
4271 case "$libpth" in
4272 '') dflt='none';;
4273 *)
4274         set X $libpth
4275         shift
4276         dflt=${1+"$@"}
4277         ;;
4278 esac
4279 rp="Directories to use for library searches?"
4280 . ./myread
4281 case "$ans" in
4282 none) libpth=' ';;
4283 *) libpth="$ans";;
4284 esac
4285
4286 : compute shared library extension
4287 case "$so" in
4288 '')
4289         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4290                 dflt='sl'
4291         else
4292                 dflt='so'
4293         fi
4294         ;;
4295 *) dflt="$so";;
4296 esac
4297 $cat <<EOM
4298
4299 On some systems, shared libraries may be available.  Answer 'none' if
4300 you want to suppress searching of shared libraries for the remainder
4301 of this configuration.
4302
4303 EOM
4304 rp='What is the file extension used for shared libraries?'
4305 . ./myread
4306 so="$ans"
4307
4308 : Define several unixisms.
4309 : Hints files or command line option can be used to override them.
4310 : The convoluted testing is in case hints files set either the old
4311 : or the new name.
4312 case "$_exe" in
4313 '')     case "$exe_ext" in
4314         '')     ;;
4315         *)      _exe="$exe_ext" ;;
4316         esac
4317         ;;
4318 esac
4319 case "$_a" in
4320 '')     case "$lib_ext" in
4321     '') _a='.a';;
4322         *)      _a="$lib_ext" ;;
4323         esac
4324         ;;
4325 esac
4326 case "$_o" in
4327 '') case "$obj_ext" in
4328         '')     _o='.o';;
4329         *)      _o="$obj_ext";;
4330         esac
4331         ;;
4332 esac
4333 case "$p_" in
4334 '') case "$path_sep" in
4335         '')     p_=':';;
4336         *)      p_="$path_sep";;
4337         esac
4338         ;;
4339 esac
4340 exe_ext=$_exe
4341 lib_ext=$_a
4342 obj_ext=$_o
4343 path_sep=$p_
4344
4345 : Which makefile gets called first.  This is used by make depend.
4346 case "$firstmakefile" in
4347 '') firstmakefile='makefile';;
4348 esac
4349
4350 case "$usesocks" in
4351 $define|true|[yY]*)     dflt='y';;
4352 *) dflt='n';;
4353 esac
4354 cat <<EOM
4355
4356 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4357 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4358 to use the PerlIO abstraction layer, this will be implicitly selected.
4359
4360 If this doesn't make any sense to you, just accept the default '$dflt'.
4361 EOM
4362 rp='Build Perl for SOCKS?'
4363 . ./myread
4364 case "$ans" in
4365 y|Y)    val="$define" ;;     
4366 *)      val="$undef" ;;
4367 esac
4368 set usesocks
4369 eval $setvar
4370
4371 case "$usesocks" in
4372 $define|true|[yY]*) useperlio="$define";;
4373 esac
4374
4375 : Looking for optional libraries
4376 echo " "
4377 echo "Checking for optional libraries..." >&4
4378 case "$libs" in
4379 ' '|'') dflt='';;
4380 *) dflt="$libs";;
4381 esac
4382 case "$libswanted" in
4383 '') libswanted='c_s';;
4384 esac
4385 case "$usesocks" in
4386 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4387 esac
4388 libsfound=''
4389 libsfiles=''
4390 libsdirs=''
4391 libspath=''
4392 for thisdir in $libpth $xlibpth; do
4393   test -d $thisdir && libspath="$libspath $thisdir"
4394 done
4395 for thislib in $libswanted; do
4396         for thisdir in $libspath; do
4397             xxx=''
4398             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4399                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4400                 $test -f "$xxx" && eval $libscheck
4401                 $test -f "$xxx" && libstyle=shared
4402             fi
4403             if test ! -f "$xxx"; then
4404                 xxx=$thisdir/lib$thislib.$so
4405                 $test -f "$xxx" && eval $libscheck
4406                 $test -f "$xxx" && libstyle=shared
4407             fi  
4408             if test ! -f "$xxx"; then
4409                 xxx=$thisdir/lib$thislib$_a
4410                 $test -f "$xxx" && eval $libscheck
4411                 $test -f "$xxx" && libstyle=static
4412             fi
4413             if test ! -f "$xxx"; then
4414                 xxx=$thisdir/$thislib$_a
4415                 $test -f "$xxx" && eval $libscheck
4416                 $test -f "$xxx" && libstyle=static
4417             fi
4418             if test ! -f "$xxx"; then
4419                 xxx=$thisdir/lib${thislib}_s$_a
4420                 $test -f "$xxx" && eval $libscheck
4421                 $test -f "$xxx" && libstyle=static
4422                 $test -f "$xxx" && thislib=${thislib}_s
4423             fi
4424             if test ! -f "$xxx"; then
4425                 xxx=$thisdir/Slib$thislib$_a
4426                 $test -f "$xxx" && eval $libscheck
4427                 $test -f "$xxx" && libstyle=static
4428             fi
4429             if $test -f "$xxx"; then
4430                 case "$libstyle" in
4431                 shared) echo "Found -l$thislib (shared)." ;;
4432                 static) echo "Found -l$thislib." ;;
4433                 *)      echo "Found -l$thislib ($libstyle)." ;;
4434                 esac
4435                 case " $dflt " in
4436                 *"-l$thislib "*);;
4437                 *) dflt="$dflt -l$thislib"
4438                    libsfound="$libsfound $xxx"
4439                    yyy=`basename $xxx`
4440                    libsfiles="$libsfiles $yyy"
4441                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4442                    case " $libsdirs " in
4443                    *" $yyy "*) ;;
4444                    *) libsdirs="$libsdirs $yyy" ;;
4445                    esac
4446                    ;;
4447                 esac
4448                 break
4449             fi  
4450         done
4451         if $test ! -f "$xxx"; then
4452             echo "No -l$thislib."
4453         fi
4454 done
4455 set X $dflt
4456 shift
4457 dflt="$*"
4458 case "$libs" in
4459 '') dflt="$dflt";;
4460 *) dflt="$libs";;
4461 esac
4462 case "$dflt" in
4463 ' '|'') dflt='none';;
4464 esac
4465
4466 $cat <<EOM
4467
4468 In order to compile $package on your machine, a number of libraries
4469 are usually needed.  Include any other special libraries here as well.
4470 Say "none" for none.  The default list is almost always right.
4471 EOM
4472
4473 echo " "
4474 rp="What libraries to use?"
4475 . ./myread
4476 case "$ans" in
4477 none) libs=' ';;
4478 *) libs="$ans";;
4479 esac
4480
4481 : determine optimization, if desired, or use for debug flag also
4482 case "$optimize" in
4483 ' '|$undef) dflt='none';;
4484 '') dflt='-O';;
4485 *) dflt="$optimize";;
4486 esac
4487 $cat <<EOH
4488
4489 By default, $package compiles with the -O flag to use the optimizer.
4490 Alternately, you might want to use the symbolic debugger, which uses
4491 the -g flag (on traditional Unix systems).  Either flag can be
4492 specified here.  To use neither flag, specify the word "none".
4493
4494 EOH
4495 rp="What optimizer/debugger flag should be used?"
4496 . ./myread
4497 optimize="$ans"
4498 case "$optimize" in
4499 'none') optimize=" ";;
4500 esac
4501
4502 dflt=''
4503 : We will not override a previous value, but we might want to
4504 : augment a hint file
4505 case "$hint" in
4506 default|recommended)
4507         case "$gccversion" in
4508         1*) dflt='-fpcc-struct-return' ;;
4509         esac
4510         case "$optimize" in
4511         *-g*) dflt="$dflt -DDEBUGGING";;
4512         esac
4513         case "$gccversion" in
4514         2*) if test -d /etc/conf/kconfig.d &&
4515                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4516                 then
4517                         dflt="$dflt -posix"
4518                 fi
4519                 ;;
4520         esac
4521         case "$gccversion" in
4522         1*) ;;
4523         2.[0-8]*) ;;
4524         ?*)     echo " "
4525                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4526                 echo 'int main(void) { return 0; }' > gcctest.c
4527                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4528                         echo "Yes, it does." 2>&1
4529                         case "$ccflags" in
4530                         *strict-aliasing*) 
4531                                 echo "Leaving current flags $ccflags alone." 2>&1
4532                                 ;;
4533                         *) dflt="$dflt -fno-strict-aliasing" ;;
4534                         esac
4535                 else
4536                         echo "Nope, it doesn't, but that's ok." 2>&1
4537                 fi
4538                 ;;
4539         esac
4540         ;;
4541 esac
4542
4543 case "$mips_type" in
4544 *BSD*|'') inclwanted="$locincpth $usrinc";;
4545 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4546 esac
4547 for thisincl in $inclwanted; do
4548         if $test -d $thisincl; then
4549                 if $test x$thisincl != x$usrinc; then
4550                         case "$dflt" in
4551                         *" -I$thisincl "*);;
4552                         *) dflt="$dflt -I$thisincl ";;
4553                         esac
4554                 fi
4555         fi
4556 done
4557
4558 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4559         xxx=true;
4560 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4561         xxx=true;
4562 else
4563         xxx=false;
4564 fi;
4565 if $xxx; then
4566         case "$dflt" in
4567         *$2*);;
4568         *) dflt="$dflt -D$2";;
4569         esac;
4570 fi'
4571
4572 set signal.h LANGUAGE_C; eval $inctest
4573
4574 case "$usesocks" in
4575 $define)
4576         ccflags="$ccflags -DSOCKS"
4577         ;;
4578 esac
4579
4580 case "$hint" in
4581 default|recommended) dflt="$ccflags $dflt" ;;
4582 *) dflt="$ccflags";;
4583 esac
4584
4585 case "$dflt" in
4586 ''|' ') dflt=none;;
4587 esac
4588
4589 $cat <<EOH
4590
4591 Your C compiler may want other flags.  For this question you should include
4592 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4593 but you should NOT include libraries or ld flags like -lwhatever.  If you
4594 want $package to honor its debug switch, you should include -DDEBUGGING here.
4595 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4596
4597 To use no flags, specify the word "none".
4598
4599 EOH
4600 set X $dflt
4601 shift
4602 dflt=${1+"$@"}
4603 rp="Any additional cc flags?"
4604 . ./myread
4605 case "$ans" in
4606 none) ccflags='';;
4607 *) ccflags="$ans";;
4608 esac
4609
4610 : the following weeds options from ccflags that are of no interest to cpp
4611 case "$cppflags" in
4612 '') cppflags="$ccflags" ;;
4613 *)  cppflags="$cppflags $ccflags" ;;
4614 esac
4615 case "$gccversion" in
4616 1*) cppflags="$cppflags -D__GNUC__"
4617 esac
4618 case "$mips_type" in
4619 '');;
4620 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4621 esac
4622 case "$cppflags" in
4623 '');;
4624 *)
4625         echo " "
4626         echo "Let me guess what the preprocessor flags are..." >&4
4627         set X $cppflags
4628         shift
4629         cppflags=''
4630         $cat >cpp.c <<'EOM'
4631 #define BLURFL foo
4632
4633 BLURFL xx LFRULB
4634 EOM
4635         previous=''
4636         for flag in $*
4637         do
4638                 case "$flag" in
4639                 -*) ftry="$flag";;
4640                 *) ftry="$previous $flag";;
4641                 esac
4642                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4643                         >cpp1.out 2>/dev/null && \
4644                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4645                         >cpp2.out 2>/dev/null && \
4646                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4647                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4648                 then
4649                         cppflags="$cppflags $ftry"
4650                         previous=''
4651                 else
4652                         previous="$flag"
4653                 fi
4654         done
4655         set X $cppflags
4656         shift
4657         cppflags=${1+"$@"}
4658         case "$cppflags" in
4659         *-*)  echo "They appear to be: $cppflags";;
4660         esac
4661         $rm -f cpp.c cpp?.out
4662         ;;
4663 esac
4664
4665 : flags used in final linking phase
4666 case "$ldflags" in
4667 '') if ./venix; then
4668                 dflt='-i -z'
4669         else
4670                 dflt=''
4671         fi
4672         case "$ccflags" in
4673         *-posix*) dflt="$dflt -posix" ;;
4674         esac
4675         ;;
4676 *) dflt="$ldflags";;
4677 esac
4678
4679 : Try to guess additional flags to pick up local libraries.
4680 for thislibdir in $libpth; do
4681         case " $loclibpth " in
4682         *" $thislibdir "*)
4683                 case "$dflt " in 
4684                 *"-L$thislibdir "*) ;;
4685                 *)  dflt="$dflt -L$thislibdir" ;;
4686                 esac
4687                 ;;
4688         esac
4689 done
4690
4691 case "$dflt" in
4692 '') dflt='none' ;;
4693 esac
4694
4695 $cat <<EOH
4696
4697 Your C linker may need flags.  For this question you should
4698 include -L/whatever and any other flags used by the C linker, but you
4699 should NOT include libraries like -lwhatever.
4700
4701 Make sure you include the appropriate -L/path flags if your C linker
4702 does not normally search all of the directories you specified above,
4703 namely
4704         $libpth
4705 To use no flags, specify the word "none".
4706
4707 EOH
4708
4709 rp="Any additional ld flags (NOT including libraries)?"
4710 . ./myread
4711 case "$ans" in
4712 none) ldflags='';;
4713 *) ldflags="$ans";;
4714 esac
4715 rmlist="$rmlist pdp11"
4716
4717 : coherency check
4718 echo " "
4719 echo "Checking your choice of C compiler and flags for coherency..." >&4
4720 $cat > try.c <<'EOF'
4721 #include <stdio.h>
4722 int main() { printf("Ok\n"); exit(0); }
4723 EOF
4724 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4725 shift
4726 $cat >try.msg <<'EOM'
4727 I've tried to compile and run the following simple program:
4728
4729 EOM
4730 $cat try.c >> try.msg
4731
4732 $cat >> try.msg <<EOM
4733
4734 I used the command:
4735
4736         $*
4737         $run ./try
4738
4739 and I got the following output:
4740
4741 EOM
4742 dflt=y
4743 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4744         if $sh -c "$run ./try" >>try.msg 2>&1; then
4745                 xxx=`$run ./try`
4746                 case "$xxx" in
4747                 "Ok") dflt=n ;;
4748                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4749                         case " $libs " in
4750                         *" -lsfio "*)
4751                                 cat >> try.msg <<'EOQS'
4752 If $libs contains -lsfio, and sfio is mis-configured, then it
4753 sometimes (apparently) runs and exits with a 0 status, but with no
4754 output!  It may have to do with sfio's use of _exit vs. exit.
4755
4756 EOQS
4757                                 rp="You have a big problem.  Shall I abort Configure"
4758                                 dflt=y
4759                                 ;;
4760                         esac
4761                         ;;
4762                 esac
4763         else
4764                 echo "The program compiled OK, but exited with status $?." >>try.msg
4765                 rp="You have a problem.  Shall I abort Configure"
4766                 dflt=y
4767         fi
4768 else
4769         echo "I can't compile the test program." >>try.msg
4770         rp="You have a BIG problem.  Shall I abort Configure"
4771         dflt=y
4772 fi
4773 case "$dflt" in
4774 y)
4775         $cat try.msg >&4
4776         case "$knowitall" in
4777         '')
4778                 echo "(The supplied flags or libraries might be incorrect.)"
4779                 ;;
4780         *) dflt=n;;
4781         esac
4782         echo " "
4783         . ./myread
4784         case "$ans" in
4785         n*|N*) ;;
4786         *)      echo "Ok.  Stopping Configure." >&4
4787                 exit 1
4788                 ;;
4789         esac
4790         ;;
4791 n) echo "OK, that should do.";;
4792 esac
4793 $rm -f try try.* core
4794
4795 : define a shorthand compile call
4796 compile='
4797 mc_file=$1;
4798 shift;
4799 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4800 : define a shorthand compile call for compilations that should be ok.
4801 compile_ok='
4802 mc_file=$1;
4803 shift;
4804 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4805
4806 : check for lengths of integral types
4807 echo " "
4808 case "$intsize" in
4809 '')
4810         echo "Checking to see how big your integers are..." >&4
4811         $cat >try.c <<'EOCP'
4812 #include <stdio.h>
4813 int main()
4814 {
4815         printf("intsize=%d;\n", (int)sizeof(int));
4816         printf("longsize=%d;\n", (int)sizeof(long));
4817         printf("shortsize=%d;\n", (int)sizeof(short));
4818         exit(0);
4819 }
4820 EOCP
4821         set try
4822         if eval $compile_ok && $run ./try > /dev/null; then
4823                 eval `$run ./try`
4824                 echo "Your integers are $intsize bytes long."
4825                 echo "Your long integers are $longsize bytes long."
4826                 echo "Your short integers are $shortsize bytes long."
4827         else
4828                 $cat >&4 <<EOM
4829 !
4830 Help! I can't compile and run the intsize test program: please enlighten me!
4831 (This is probably a misconfiguration in your system or libraries, and
4832 you really ought to fix it.  Still, I'll try anyway.)
4833 !
4834 EOM
4835                 dflt=4
4836                 rp="What is the size of an integer (in bytes)?"
4837                 . ./myread
4838                 intsize="$ans"
4839                 dflt=$intsize
4840                 rp="What is the size of a long integer (in bytes)?"
4841                 . ./myread
4842                 longsize="$ans"
4843                 dflt=2
4844                 rp="What is the size of a short integer (in bytes)?"
4845                 . ./myread
4846                 shortsize="$ans"
4847         fi
4848         ;;
4849 esac
4850 $rm -f try try.*
4851
4852 : check for void type
4853 echo " "
4854 echo "Checking to see how well your C compiler groks the void type..." >&4
4855 case "$voidflags" in
4856 '')
4857         $cat >try.c <<'EOCP'
4858 #if TRY & 1
4859 void sub() {
4860 #else
4861 sub() {
4862 #endif
4863         extern void moo();      /* function returning void */
4864         void (*goo)();          /* ptr to func returning void */
4865 #if TRY & 8
4866         void *hue;              /* generic ptr */
4867 #endif
4868 #if TRY & 2
4869         void (*foo[10])();
4870 #endif
4871
4872 #if TRY & 4
4873         if(goo == moo) {
4874                 exit(0);
4875         }
4876 #endif
4877         exit(0);
4878 }
4879 int main() { sub(); }
4880 EOCP
4881         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4882                 voidflags=$defvoidused
4883         echo "Good.  It appears to support void to the level $package wants.">&4
4884                 if $contains warning .out >/dev/null 2>&1; then
4885                         echo "However, you might get some warnings that look like this:"
4886                         $cat .out
4887                 fi
4888         else
4889 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4890                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4891                         echo "It supports 1..."
4892                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4893                                 echo "It also supports 2..."
4894                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4895                                         voidflags=7
4896                                         echo "And it supports 4 but not 8 definitely."
4897                                 else
4898                                         echo "It doesn't support 4..."
4899                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4900                                                 voidflags=11
4901                                                 echo "But it supports 8."
4902                                         else
4903                                                 voidflags=3
4904                                                 echo "Neither does it support 8."
4905                                         fi
4906                                 fi
4907                         else
4908                                 echo "It does not support 2..."
4909                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4910                                         voidflags=13
4911                                         echo "But it supports 4 and 8."
4912                                 else
4913                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4914                                                 voidflags=5
4915                                                 echo "And it supports 4 but has not heard about 8."
4916                                         else
4917                                                 echo "However it supports 8 but not 4."
4918                                         fi
4919                                 fi
4920                         fi
4921                 else
4922                         echo "There is no support at all for void."
4923                         voidflags=0
4924                 fi
4925         fi
4926 esac
4927 case "$voidflags" in
4928 "$defvoidused") ;;
4929 *)      $cat >&4 <<'EOM'
4930   Support flag bits are:
4931     1: basic void declarations.
4932     2: arrays of pointers to functions returning void.
4933     4: operations between pointers to and addresses of void functions.
4934     8: generic void pointers.
4935 EOM
4936         dflt="$voidflags";
4937         rp="Your void support flags add up to what?"
4938         . ./myread
4939         voidflags="$ans"
4940         ;;
4941 esac
4942 $rm -f try.* .out
4943
4944 : check for length of pointer
4945 echo " "
4946 case "$ptrsize" in
4947 '')
4948         echo "Checking to see how big your pointers are..." >&4
4949         if test "$voidflags" -gt 7; then
4950                 echo '#define VOID_PTR char *' > try.c
4951         else
4952                 echo '#define VOID_PTR void *' > try.c
4953         fi
4954         $cat >>try.c <<'EOCP'
4955 #include <stdio.h>
4956 int main()
4957 {
4958     printf("%d\n", (int)sizeof(VOID_PTR));
4959     exit(0);
4960 }
4961 EOCP
4962         set try
4963         if eval $compile_ok; then
4964                 ptrsize=`$run ./try`
4965                 echo "Your pointers are $ptrsize bytes long."
4966         else
4967                 dflt='4'
4968                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4969                 rp="What is the size of a pointer (in bytes)?"
4970                 . ./myread
4971                 ptrsize="$ans"
4972         fi
4973         ;;
4974 esac
4975 $rm -f try.c 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 "$use64bitall" in
5377 "$define"|true|[yY]*)
5378         case "$ptrsize" in
5379         4)      cat <<EOM >&4
5380
5381 *** You have chosen a maximally 64-bit build, but your pointers
5382 *** are only 4 bytes wide, disabling maximal 64-bitness.
5383
5384 EOM
5385                 use64bitall="$undef"
5386                 case "$use64bitint" in
5387                 "$define"|true|[yY]*) ;;
5388                 *)      cat <<EOM >&4
5389
5390 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5391
5392 EOM
5393                         use64bitint="$define"
5394                         ;;
5395                 esac
5396                 ;;
5397         esac
5398         ;;
5399 esac
5400
5401 case "$use64bitint" in
5402 "$define"|true|[yY]*)
5403 : Look for a hint-file generated 'call-back-unit'.  If the
5404 : user has specified that a 64-bit perl is to be built,
5405 : we may need to set or change some other defaults.
5406         if $test -f use64bitint.cbu; then
5407                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5408                 . ./use64bitint.cbu
5409         fi
5410         case "$longsize" in
5411         4) case "$archname64" in
5412            '') archname64=64int ;;
5413            esac
5414            ;;
5415         esac
5416         ;;
5417 esac
5418
5419 case "$use64bitall" in
5420 "$define"|true|[yY]*)
5421 : Look for a hint-file generated 'call-back-unit'.  If the
5422 : user has specified that a maximally 64-bit perl is to be built,
5423 : we may need to set or change some other defaults.
5424         if $test -f use64bitall.cbu; then
5425                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5426                 . ./use64bitall.cbu
5427         fi
5428         case "$longsize" in
5429         4) case "$archname64" in
5430            ''|64int) archname64=64all ;;
5431            esac
5432            ;;
5433         esac
5434         ;;
5435 esac
5436
5437 echo " "
5438 echo "Checking for GNU C Library..." >&4
5439 cat >try.c <<EOM
5440 #include <stdio.h>
5441 int main()
5442 {
5443 #ifdef __GLIBC__
5444     exit(0);
5445 #else
5446     exit(1);
5447 #endif
5448 }
5449 EOM
5450 set try
5451 if eval $compile_ok && $run ./try; then
5452         val="$define"
5453         echo "You are using the GNU C Library"
5454 else
5455         val="$undef"
5456         echo "You are not using the GNU C Library"
5457 fi
5458 $rm -f try try.*
5459 set d_gnulibc
5460 eval $setvar
5461
5462 : see if nm is to be used to determine whether a symbol is defined or not
5463 case "$usenm" in
5464 '')
5465         dflt=''
5466         case "$d_gnulibc" in
5467         "$define")
5468                 echo " "
5469                 echo "nm probably won't work on the GNU C Library." >&4
5470                 dflt=n
5471                 ;;
5472         esac
5473         case "$dflt" in
5474         '') 
5475                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5476                         echo " "
5477                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5478                         echo "'nm' won't be sufficient on this sytem." >&4
5479                         dflt=n
5480                 fi
5481                 ;;
5482         esac
5483         case "$dflt" in
5484         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5485                 if $test $dflt -gt 20; then
5486                         dflt=y
5487                 else
5488                         dflt=n
5489                 fi
5490                 ;;
5491         esac
5492         ;;
5493 *)
5494         case "$usenm" in
5495         true|$define) dflt=y;;
5496         *) dflt=n;;
5497         esac
5498         ;;
5499 esac
5500 $cat <<EOM
5501
5502 I can use $nm to extract the symbols from your C libraries. This
5503 is a time consuming task which may generate huge output on the disk (up
5504 to 3 megabytes) but that should make the symbols extraction faster. The
5505 alternative is to skip the 'nm' extraction part and to compile a small
5506 test program instead to determine whether each symbol is present. If
5507 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5508 this may be the best solution.
5509
5510 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5511
5512 EOM
5513 rp="Shall I use $nm to extract C symbols from the libraries?"
5514 . ./myread
5515 case "$ans" in
5516 [Nn]*) usenm=false;;
5517 *) usenm=true;;
5518 esac
5519
5520 runnm=$usenm
5521 case "$reuseval" in
5522 true) runnm=false;;
5523 esac
5524
5525 : nm options which may be necessary
5526 case "$nm_opt" in
5527 '') if $test -f /mach_boot; then
5528                 nm_opt=''       # Mach
5529         elif $test -d /usr/ccs/lib; then
5530                 nm_opt='-p'     # Solaris (and SunOS?)
5531         elif $test -f /dgux; then
5532                 nm_opt='-p'     # DG-UX
5533         elif $test -f /lib64/rld; then
5534                 nm_opt='-p'     # 64-bit Irix
5535         else
5536                 nm_opt=''
5537         fi;;
5538 esac
5539
5540 : nm options which may be necessary for shared libraries but illegal
5541 : for archive libraries.  Thank you, Linux.
5542 case "$nm_so_opt" in
5543 '')     case "$myuname" in
5544         *linux*)
5545                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5546                         nm_so_opt='--dynamic'
5547                 fi
5548                 ;;
5549         esac
5550         ;;
5551 esac
5552
5553 case "$runnm" in
5554 true)
5555 : get list of predefined functions in a handy place
5556 echo " "
5557 case "$libc" in
5558 '') libc=unknown
5559         case "$libs" in
5560         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5561         esac
5562         ;;
5563 esac
5564 case "$libs" in
5565 '') ;;
5566 *)  for thislib in $libs; do
5567         case "$thislib" in
5568         -lc|-lc_s)
5569                 : Handle C library specially below.
5570                 ;;
5571         -l*)
5572                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5573                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5574                         :
5575                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5576                         :
5577                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5578                         :
5579                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5580                         :
5581                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5582                         :
5583                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5584                         :
5585                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5586                         :
5587                 else
5588                         try=''
5589                 fi
5590                 libnames="$libnames $try"
5591                 ;;
5592         *) libnames="$libnames $thislib" ;;
5593         esac
5594         done
5595         ;;
5596 esac
5597 xxx=normal
5598 case "$libc" in
5599 unknown)
5600         set /lib/libc.$so
5601         for xxx in $libpth; do
5602                 $test -r $1 || set $xxx/libc.$so
5603                 : The messy sed command sorts on library version numbers.
5604                 $test -r $1 || \
5605                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5606                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5607                                 h
5608                                 s/[0-9][0-9]*/0000&/g
5609                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5610                                 G
5611                                 s/\n/ /' | \
5612                          $sort | $sed -e 's/^.* //'`
5613                 eval set \$$#
5614         done
5615         $test -r $1 || set /usr/ccs/lib/libc.$so
5616         $test -r $1 || set /lib/libsys_s$_a
5617         ;;
5618 *)
5619         set blurfl
5620         ;;
5621 esac
5622 if $test -r "$1"; then
5623         echo "Your (shared) C library seems to be in $1."
5624         libc="$1"
5625 elif $test -r /lib/libc && $test -r /lib/clib; then
5626         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5627         xxx=apollo
5628         libc='/lib/clib /lib/libc'
5629         if $test -r /lib/syslib; then
5630                 echo "(Your math library is in /lib/syslib.)"
5631                 libc="$libc /lib/syslib"
5632         fi
5633 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5634         echo "Your C library seems to be in $libc, as you said before."
5635 elif $test -r $incpath/usr/lib/libc$_a; then
5636         libc=$incpath/usr/lib/libc$_a;
5637         echo "Your C library seems to be in $libc.  That's fine."
5638 elif $test -r /lib/libc$_a; then
5639         libc=/lib/libc$_a;
5640         echo "Your C library seems to be in $libc.  You're normal."
5641 else
5642         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5643                 :
5644         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5645                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5646         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5647                 :
5648         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5649                 :
5650         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5651                 :
5652         else
5653                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5654         fi
5655         if $test -r "$tans"; then
5656                 echo "Your C library seems to be in $tans, of all places."
5657                 libc=$tans
5658         else
5659                 libc='blurfl'
5660         fi
5661 fi
5662 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5663         dflt="$libc"
5664         cat <<EOM
5665
5666 If the guess above is wrong (which it might be if you're using a strange
5667 compiler, or your machine supports multiple models), you can override it here.
5668
5669 EOM
5670 else
5671         dflt=''
5672         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5673         cat >&4 <<EOM
5674 I can't seem to find your C library.  I've looked in the following places:
5675
5676 EOM
5677         $sed 's/^/      /' libpath
5678         cat <<EOM
5679
5680 None of these seems to contain your C library. I need to get its name...
5681
5682 EOM
5683 fi
5684 fn=f
5685 rp='Where is your C library?'
5686 . ./getfile
5687 libc="$ans"
5688
5689 echo " "
5690 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5691 set X `cat libnames`
5692 shift
5693 xxx=files
5694 case $# in 1) xxx=file; esac
5695 echo "Extracting names from the following $xxx for later perusal:" >&4
5696 echo " "
5697 $sed 's/^/      /' libnames >&4
5698 echo " "
5699 $echo $n "This may take a while...$c" >&4
5700
5701 for file in $*; do
5702         case $file in
5703         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5704         *) $nm $nm_opt $file 2>/dev/null;;
5705         esac
5706 done >libc.tmp
5707
5708 $echo $n ".$c"
5709 $grep fprintf libc.tmp > libc.ptf
5710 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5711 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5712 xxx='[ADTSIW]'
5713 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5714         eval $xscan;\
5715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5716                 eval $xrun
5717 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5718         eval $xscan;\
5719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5720                 eval $xrun
5721 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5722         eval $xscan;\
5723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5724                 eval $xrun
5725 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5738                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5739         eval $xscan;\
5740         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5741                 eval $xrun
5742 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5743         eval $xscan;\
5744         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5745                 eval $xrun
5746 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5747         eval $xscan;\
5748         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5749                 eval $xrun
5750 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5751         eval $xscan;\
5752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753                 eval $xrun
5754 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5763         eval $xscan;\
5764         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5765                 eval $xrun
5766 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5767         eval $xscan;\
5768         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5769                 eval $xrun
5770 else
5771         $nm -p $* 2>/dev/null >libc.tmp
5772         $grep fprintf libc.tmp > libc.ptf
5773         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5774                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5775         then
5776                 nm_opt='-p'
5777                 eval $xrun
5778         else
5779                 echo " "
5780                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5781                 com=''
5782                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5783                         for thisname in $libnames $libc; do
5784                                 $ar t $thisname >>libc.tmp
5785                         done
5786                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5787                         echo "Ok." >&4
5788                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5789                         # Repeat libc to extract forwarders to DLL entries too
5790                         for thisname in $libnames $libc; do
5791                                 $ar tv $thisname >>libc.tmp
5792                                 # Revision 50 of EMX has bug in $ar.
5793                                 # it will not extract forwarders to DLL entries
5794                                 # Use emximp which will extract exactly them.
5795                                 emximp -o tmp.imp $thisname \
5796                                     2>/dev/null && \
5797                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5798                                     < tmp.imp >>libc.tmp
5799                                 $rm tmp.imp
5800                         done
5801                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5802                         echo "Ok." >&4
5803                 else
5804                         echo "$ar didn't seem to work right." >&4
5805                         echo "Maybe this is a Cray...trying bld instead..." >&4
5806                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5807                         then
5808                                 for thisname in $libnames; do
5809                                         bld t $libnames | \
5810                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5811                                         $ar t $thisname >>libc.tmp
5812                                 done
5813                                 echo "Ok." >&4
5814                         else
5815                                 echo "That didn't work either.  Giving up." >&4
5816                                 exit 1
5817                         fi
5818                 fi
5819         fi
5820 fi
5821 nm_extract="$com"
5822 if $test -f /lib/syscalls.exp; then
5823         echo " "
5824         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5825         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5826 fi
5827 ;;
5828 esac
5829 $rm -f libnames libpath
5830
5831 : is a C symbol defined?
5832 csym='tlook=$1;
5833 case "$3" in
5834 -v) tf=libc.tmp; tc=""; tdc="";;
5835 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5836 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5837 esac;
5838 tx=yes;
5839 case "$reuseval-$4" in
5840 true-) ;;
5841 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5842 esac;
5843 case "$tx" in
5844 yes)
5845         case "$runnm" in
5846         true)
5847                 if $contains $tlook $tf >/dev/null 2>&1;
5848                 then tval=true;
5849                 else tval=false;
5850                 fi;;
5851         *)
5852                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5853                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5854                 then tval=true;
5855                 else tval=false;
5856                 fi;
5857                 $rm -f t t.c;;
5858         esac;;
5859 *)
5860         case "$tval" in
5861         $define) tval=true;;
5862         *) tval=false;;
5863         esac;;
5864 esac;
5865 eval "$2=$tval"'
5866
5867 : define an is-in-libc? function
5868 inlibc='echo " "; td=$define; tu=$undef;
5869 sym=$1; var=$2; eval "was=\$$2";
5870 tx=yes;
5871 case "$reuseval$was" in
5872 true) ;;
5873 true*) tx=no;;
5874 esac;
5875 case "$tx" in
5876 yes)
5877         set $sym tres -f;
5878         eval $csym;
5879         case "$tres" in
5880         true)
5881                 echo "$sym() found." >&4;
5882                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5883         *)
5884                 echo "$sym() NOT found." >&4;
5885                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5886         esac;;
5887 *)
5888         case "$was" in
5889         $define) echo "$sym() found." >&4;;
5890         *) echo "$sym() NOT found." >&4;;
5891         esac;;
5892 esac'
5893
5894 : see if sqrtl exists
5895 set sqrtl d_sqrtl
5896 eval $inlibc
5897
5898 : check for length of double
5899 echo " "
5900 case "$doublesize" in
5901 '')
5902         echo "Checking to see how big your double precision numbers are..." >&4
5903         $cat >try.c <<'EOCP'
5904 #include <stdio.h>
5905 int main()
5906 {
5907     printf("%d\n", (int)sizeof(double));
5908     exit(0);
5909 }
5910 EOCP
5911         set try
5912         if eval $compile_ok; then
5913                 doublesize=`$run ./try`
5914                 echo "Your double is $doublesize bytes long."
5915         else
5916                 dflt='8'
5917                 echo "(I can't seem to compile the test program.  Guessing...)"
5918                 rp="What is the size of a double precision number (in bytes)?"
5919                 . ./myread
5920                 doublesize="$ans"
5921         fi
5922         ;;
5923 esac
5924 $rm -f try.c try
5925
5926 : check for long doubles
5927 echo " "
5928 echo "Checking to see if you have long double..." >&4
5929 echo 'int main() { long double x = 7.0; }' > try.c
5930 set try
5931 if eval $compile; then
5932         val="$define"
5933         echo "You have long double."
5934 else
5935         val="$undef"
5936         echo "You do not have long double."
5937 fi
5938 $rm try.*
5939 set d_longdbl
5940 eval $setvar
5941
5942 : check for length of long double
5943 case "${d_longdbl}${longdblsize}" in
5944 $define)
5945         echo " "
5946         echo "Checking to see how big your long doubles are..." >&4
5947         $cat >try.c <<'EOCP'
5948 #include <stdio.h>
5949 int main()
5950 {
5951         printf("%d\n", sizeof(long double));
5952 }
5953 EOCP
5954         set try
5955         set try
5956         if eval $compile; then
5957                 longdblsize=`$run ./try`
5958                 echo "Your long doubles are $longdblsize bytes long."
5959         else
5960                 dflt='8'
5961                 echo " "
5962                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5963                 rp="What is the size of a long double (in bytes)?"
5964                 . ./myread
5965                 longdblsize="$ans"
5966         fi
5967         if $test "X$doublesize" = "X$longdblsize"; then
5968                 echo "(That isn't any different from an ordinary double.)"
5969         fi      
5970         ;;
5971 esac
5972 $rm -f try.* try
5973
5974 echo " "
5975
5976 if $test X"$d_longdbl" = X"$define"; then
5977
5978 echo "Checking how to print long doubles..." >&4
5979
5980 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5981         $cat >try.c <<'EOCP'
5982 #include <sys/types.h>
5983 #include <stdio.h>
5984 int main() {
5985   double d = 123.456;
5986   printf("%.3f\n", d);
5987 }
5988 EOCP
5989         set try
5990         if eval $compile; then
5991                 yyy=`$run ./try`
5992                 case "$yyy" in
5993                 123.456)
5994                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5995                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5996                         echo "We will use %f."
5997                         ;;
5998                 esac
5999         fi
6000 fi
6001
6002 if $test X"$sPRIfldbl" = X; then
6003         $cat >try.c <<'EOCP'
6004 #include <sys/types.h>
6005 #include <stdio.h>
6006 int main() {
6007   long double d = 123.456;
6008   printf("%.3Lf\n", d);
6009 }
6010 EOCP
6011         set try
6012         if eval $compile; then
6013                 yyy=`$run ./try`
6014                 case "$yyy" in
6015                 123.456)
6016                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6017                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6018                         echo "We will use %Lf."
6019                         ;;
6020                 esac
6021         fi
6022 fi
6023
6024 if $test X"$sPRIfldbl" = X; then
6025         $cat >try.c <<'EOCP'
6026 #include <sys/types.h>
6027 #include <stdio.h>
6028 int main() {
6029   long double d = 123.456;
6030   printf("%.3llf\n", d);
6031 }
6032 EOCP
6033         set try
6034         if eval $compile; then
6035                 yyy=`$run ./try`
6036                 case "$yyy" in
6037                 123.456)
6038                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6039                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6040                         echo "We will use %llf."
6041                         ;;
6042                 esac
6043         fi
6044 fi
6045
6046 if $test X"$sPRIfldbl" = X; then
6047         $cat >try.c <<'EOCP'
6048 #include <sys/types.h>
6049 #include <stdio.h>
6050 int main() {
6051   long double d = 123.456;
6052   printf("%.3lf\n", d);
6053 }
6054 EOCP
6055         set try
6056         if eval $compile; then
6057                 yyy=`$run ./try`
6058                 case "$yyy" in
6059                 123.456)
6060                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6061                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6062                         echo "We will use %lf."
6063                         ;;
6064                 esac
6065         fi
6066 fi
6067
6068 if $test X"$sPRIfldbl" = X; then
6069         echo "Cannot figure out how to print long doubles." >&4
6070 else
6071         sSCNfldbl=$sPRIfldbl    # expect consistency
6072 fi
6073
6074 $rm -f try try.*
6075
6076 fi # d_longdbl
6077
6078 case "$sPRIfldbl" in
6079 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6080         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6081         d_SCNfldbl="$undef";
6082         ;;
6083 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6084         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6085         d_SCNfldbl="$define";
6086         ;;
6087 esac
6088
6089 : see if modfl exists
6090 set modfl d_modfl
6091 eval $inlibc
6092
6093 d_modfl_pow32_bug="$undef"
6094
6095 case "$d_longdbl$d_modfl" in
6096 $define$define)
6097         $cat <<EOM
6098 Checking to see whether your modfl() is okay for large values...
6099 EOM
6100 $cat >try.c <<EOCP
6101 #include <math.h> 
6102 #include <stdio.h>
6103 int main() {
6104     long double nv = 4294967303.15;
6105     long double v, w;
6106     v = modfl(nv, &w);         
6107 #ifdef __GLIBC__
6108     printf("glibc");
6109 #endif
6110     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6111     return 0;
6112 }
6113 EOCP
6114         case "$osname:$gccversion" in
6115         aix:)   saveccflags="$ccflags"
6116                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6117         esac
6118         set try
6119         if eval $compile; then
6120                 foo=`$run ./try`
6121                 case "$foo" in
6122                 *" 4294967303.150000 1.150000 4294967302.000000")
6123                         echo >&4 "Your modfl() is broken for large values."
6124                         d_modfl_pow32_bug="$define"
6125                         case "$foo" in
6126                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6127                         ;;
6128                         esac
6129                         ;;
6130                 *" 4294967303.150000 0.150000 4294967303.000000")
6131                         echo >&4 "Your modfl() seems okay for large values."
6132                         ;;
6133                 *)      echo >&4 "I don't understand your modfl() at all."
6134                         d_modfl="$undef"
6135                         ;;
6136                 esac
6137                 $rm -f try.* try core core.try.*
6138         else
6139                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6140                 d_modfl="$undef"
6141         fi
6142         case "$osname:$gccversion" in
6143         aix:)   ccflags="$saveccflags" ;; # restore
6144         esac
6145         ;;
6146 esac
6147
6148 case "$ccflags" in
6149 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6150 esac
6151
6152 case "$uselongdouble" in
6153 $define|true|[yY]*)     dflt='y';;
6154 *) dflt='n';;
6155 esac
6156 cat <<EOM
6157
6158 Perl can be built to take advantage of long doubles which
6159 (if available) may give more accuracy and range for floating point numbers.
6160
6161 If this doesn't make any sense to you, just accept the default '$dflt'.
6162 EOM
6163 rp='Try to use long doubles if available?'
6164 . ./myread
6165 case "$ans" in
6166 y|Y)    val="$define"   ;;
6167 *)      val="$undef"    ;;
6168 esac
6169 set uselongdouble
6170 eval $setvar
6171
6172 case "$uselongdouble" in
6173 true|[yY]*) uselongdouble="$define" ;;
6174 esac
6175
6176 case "$uselongdouble" in
6177 $define)
6178 : Look for a hint-file generated 'call-back-unit'.  If the
6179 : user has specified that long doubles should be used,
6180 : we may need to set or change some other defaults.
6181         if $test -f uselongdouble.cbu; then
6182                 echo "Your platform has some specific hints for long doubles, using them..."
6183                 . ./uselongdouble.cbu
6184         else
6185                 $cat <<EOM
6186 (Your platform doesn't have any specific hints for long doubles.)
6187 EOM
6188         fi
6189         ;;
6190 esac
6191
6192 message=X
6193 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6194 $define:$define:$define)
6195         : You have both
6196         ;;
6197 $define:$define:$undef)
6198         message="I could not find modfl"
6199         ;;
6200 $define:$undef:$define)
6201         message="I could not find sqrtl"
6202         ;;
6203 $define:$undef:$undef)
6204         message="I found neither sqrtl nor modfl"
6205         ;;
6206 esac
6207
6208 if $test "$message" != X; then
6209         $cat <<EOM >&4
6210
6211 *** You requested the use of long doubles but you do not seem to have
6212 *** the mathematic functions for long doubles.
6213 *** ($message)
6214 *** I'm disabling the use of long doubles.
6215
6216 EOM
6217
6218         uselongdouble=$undef
6219 fi
6220
6221 case "$useperlio" in
6222 $define|true|[yY]*|'')  dflt='y';;
6223 *) dflt='n';;
6224 esac
6225 cat <<EOM
6226
6227 Previous version of $package used the standard IO mechanisms as
6228 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6229 alternate IO mechanisms via the PerlIO abstraction layer, but the
6230 stdio mechanism is still available if needed.  The abstraction layer
6231 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6232 Using PerlIO with sfio may cause problems with some extension modules.
6233
6234 If this doesn't make any sense to you, just accept the default '$dflt'.
6235 EOM
6236 rp='Use the PerlIO abstraction layer?'
6237 . ./myread
6238 case "$ans" in
6239 y|Y) 
6240         val="$define"
6241         ;;
6242 *)      
6243         echo "Ok, doing things the stdio way."
6244         val="$undef"
6245         ;;
6246 esac
6247 set useperlio
6248 eval $setvar 
6249
6250 case "$usesocks" in
6251 $define|true|[yY]*)
6252         case "$useperlio" in
6253         $define|true|[yY]*) ;;
6254         *)      cat >&4 <<EOM
6255
6256 You are using the SOCKS proxy protocol library which means that you
6257 should also use the PerlIO layer.  You may be headed for trouble.
6258
6259 EOM
6260                 ;;
6261         esac
6262         ;;
6263 esac
6264
6265         
6266 : determine the architecture name
6267 echo " "
6268 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6269         tarch=`arch`"-$osname"
6270 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6271         if uname -m > tmparch 2>&1 ; then
6272                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6273                         -e 's/$/'"-$osname/" tmparch`
6274         else
6275                 tarch="$osname"
6276         fi
6277         $rm -f tmparch
6278 else
6279         tarch="$osname"
6280 fi
6281 case "$myarchname" in
6282 ''|"$tarch") ;;
6283 *)
6284         echo "(Your architecture name used to be $myarchname.)"
6285         archname=''
6286         ;;
6287 esac
6288 case "$targetarch" in
6289 '') ;;
6290 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6291 esac
6292 myarchname="$tarch"
6293 case "$archname" in
6294 '') dflt="$tarch";;
6295 *) dflt="$archname";;
6296 esac
6297 rp='What is your architecture name'
6298 . ./myread
6299 archname="$ans"
6300 case "$usethreads" in
6301 $define)
6302         echo "Threads selected." >&4
6303         case "$archname" in
6304         *-thread*) echo "...and architecture name already has -thread." >&4
6305                 ;;
6306         *)      archname="$archname-thread"
6307                 echo "...setting architecture name to $archname." >&4
6308                 ;;
6309         esac
6310         ;;
6311 esac
6312 case "$usemultiplicity" in
6313 $define)
6314         echo "Multiplicity selected." >&4
6315         case "$archname" in
6316         *-multi*) echo "...and architecture name already has -multi." >&4
6317                 ;;
6318         *)      archname="$archname-multi"
6319                 echo "...setting architecture name to $archname." >&4
6320                 ;;
6321         esac
6322         ;;
6323 esac
6324 case "$use64bitint$use64bitall" in
6325 *"$define"*)
6326         case "$archname64" in
6327         '')
6328                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6329                 ;;
6330         *)
6331                 case "$use64bitint" in
6332                 "$define") echo "64 bit integers selected." >&4 ;;
6333                 esac
6334                 case "$use64bitall" in
6335                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6336                 esac
6337                 case "$archname" in
6338                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6339                         ;;
6340                 *)      archname="$archname-$archname64"
6341                         echo "...setting architecture name to $archname." >&4
6342                         ;;
6343                 esac
6344                 ;;
6345         esac
6346 esac
6347 case "$uselongdouble" in
6348 $define)
6349         echo "Long doubles selected." >&4
6350         case "$longdblsize" in
6351         $doublesize)
6352                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6353                 ;;
6354         *)
6355                 case "$archname" in
6356                 *-ld*) echo "...and architecture name already has -ld." >&4
6357                         ;;
6358                 *)      archname="$archname-ld"
6359                         echo "...setting architecture name to $archname." >&4
6360                         ;;
6361                 esac
6362                 ;;
6363         esac
6364         ;;
6365 esac
6366 case "$useperlio" in
6367 $define)
6368         echo "Perlio selected." >&4
6369         ;;
6370 *)
6371         echo "Perlio not selected, using stdio." >&4
6372         case "$archname" in
6373         *-stdio*) echo "...and architecture name already has -stdio." >&4
6374                 ;;
6375         *)      archname="$archname-stdio"
6376                 echo "...setting architecture name to $archname." >&4
6377                 ;;
6378         esac
6379         ;;
6380 esac
6381
6382 : determine root of directory hierarchy where package will be installed.
6383 case "$prefix" in
6384 '')
6385         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6386         ;;
6387 *)
6388         dflt="$prefix"
6389         ;;
6390 esac
6391 $cat <<EOM
6392
6393 By default, $package will be installed in $dflt/bin, manual pages
6394 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6395 installation directories. Typically this is something like /usr/local.
6396 If you wish to have binaries under /usr/bin but other parts of the
6397 installation under /usr/local, that's ok: you will be prompted
6398 separately for each of the installation directories, the prefix being
6399 only used to set the defaults.
6400
6401 EOM
6402 fn=d~
6403 rp='Installation prefix to use?'
6404 . ./getfile
6405 oldprefix=''
6406 case "$prefix" in
6407 '') ;;
6408 *)
6409         case "$ans" in
6410         "$prefix") ;;
6411         *) oldprefix="$prefix";;
6412         esac
6413         ;;
6414 esac
6415 prefix="$ans"
6416 prefixexp="$ansexp"
6417
6418 case "$afsroot" in
6419 '')     afsroot=/afs ;;
6420 *)      afsroot=$afsroot ;;
6421 esac
6422
6423 : is AFS running?
6424 echo " "
6425 case "$afs" in
6426 $define|true)   afs=true ;;
6427 $undef|false)   afs=false ;;
6428 *)      if test -d $afsroot; then
6429                 afs=true
6430         else
6431                 afs=false
6432         fi
6433         ;;
6434 esac
6435 if $afs; then
6436         echo "AFS may be running... I'll be extra cautious then..." >&4
6437 else
6438         echo "AFS does not seem to be running..." >&4
6439 fi
6440
6441 : determine installation prefix for where package is to be installed.
6442 if $afs; then 
6443 $cat <<EOM
6444
6445 Since you are running AFS, I need to distinguish the directory in which
6446 files will reside from the directory in which they are installed (and from
6447 which they are presumably copied to the former directory by occult means).
6448
6449 EOM
6450         case "$installprefix" in
6451         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6452         *) dflt="$installprefix";;
6453         esac
6454 else
6455 $cat <<EOM
6456
6457 In some special cases, particularly when building $package for distribution,
6458 it is convenient to distinguish between the directory in which files should 
6459 be installed from the directory ($prefix) in which they 
6460 will eventually reside.  For most users, these two directories are the same.
6461
6462 EOM
6463         case "$installprefix" in
6464         '') dflt=$prefix ;;
6465         *) dflt=$installprefix;;
6466         esac
6467 fi
6468 fn=d~
6469 rp='What installation prefix should I use for installing files?'
6470 . ./getfile
6471 installprefix="$ans"
6472 installprefixexp="$ansexp"
6473
6474 : set the prefixit variable, to compute a suitable default value
6475 prefixit='case "$3" in
6476 ""|none)
6477         case "$oldprefix" in
6478         "") eval "$1=\"\$$2\"";;
6479         *)
6480                 case "$3" in
6481                 "") eval "$1=";;
6482                 none)
6483                         eval "tp=\"\$$2\"";
6484                         case "$tp" in
6485                         ""|" ") eval "$1=\"\$$2\"";;
6486                         *) eval "$1=";;
6487                         esac;;
6488                 esac;;
6489         esac;;
6490 *)
6491         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6492         case "$tp" in
6493         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6494         /*-$oldprefix/*|\~*-$oldprefix/*)
6495                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6496         *) eval "$1=\"\$$2\"";;
6497         esac;;
6498 esac'
6499
6500 : get the patchlevel
6501 echo " "
6502 echo "Getting the current patchlevel..." >&4
6503 if $test -r $rsrc/patchlevel.h;then
6504         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6505         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6506         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6507         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6508         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6509         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6510        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6511 else
6512         revision=0
6513         patchlevel=0
6514         subversion=0
6515         api_revision=0
6516         api_version=0
6517         api_subversion=0
6518         perl_patchlevel=0
6519         $echo "(You do not have patchlevel.h.  Eek.)"
6520 fi
6521 if $test -r $rsrc/.patch ; then  
6522         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6523                 perl_patchlevel=`cat $rsrc/.patch`
6524         fi
6525 fi
6526 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6527 version_patchlevel_string="version $patchlevel subversion $subversion"
6528 case "$perl_patchlevel" in
6529 0|'') ;;
6530 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6531 esac
6532
6533 $echo "(You have $package $version_patchlevel_string.)"
6534
6535 case "$osname" in
6536 dos|vms)
6537         : XXX Should be a Configure test for double-dots in filenames.
6538         version=`echo $revision $patchlevel $subversion | \
6539                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6540         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6541                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6542         ;;
6543 *)
6544         version=`echo $revision $patchlevel $subversion | \
6545                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6546         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6547                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6548         ;;
6549 esac
6550 : Special case the 5.005_xx maintenance series, which used 5.005
6551 : without any subversion label as a subdirectory in $sitelib
6552 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6553         api_versionstring='5.005'
6554 fi
6555
6556 : determine installation style
6557 : For now, try to deduce it from prefix unless it is already set.
6558 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6559 case "$installstyle" in
6560 '')     case "$prefix" in
6561                 *perl*) dflt='lib';;
6562                 *) dflt='lib/perl5' ;;
6563         esac
6564         ;;
6565 *)      dflt="$installstyle" ;;
6566 esac
6567 : Probably not worth prompting for this since we prompt for all
6568 : the directories individually, and the prompt would be too long and
6569 : confusing anyway.
6570 installstyle=$dflt
6571
6572 : determine where private library files go
6573 : Usual default is /usr/local/lib/perl5/$version.
6574 : Also allow things like /opt/perl/lib/$version, since 
6575 : /opt/perl/lib/perl5... would be redundant.
6576 : The default "style" setting is made in installstyle.U
6577 case "$installstyle" in
6578 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6579 *)       set dflt privlib lib/$version ;;
6580 esac
6581 eval $prefixit
6582 $cat <<EOM
6583
6584 There are some auxiliary files for $package that need to be put into a
6585 private library directory that is accessible by everyone.
6586
6587 EOM
6588 fn=d~+
6589 rp='Pathname where the private library files will reside?'
6590 . ./getfile
6591 privlib="$ans"
6592 privlibexp="$ansexp"
6593 : Change installation prefix, if necessary.
6594 if $test X"$prefix" != X"$installprefix"; then
6595         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6596 else
6597         installprivlib="$privlibexp"
6598 fi
6599
6600 : set the prefixup variable, to restore leading tilda escape
6601 prefixup='case "$prefixexp" in
6602 "$prefix") ;;
6603 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6604 esac'
6605
6606 : determine where public architecture dependent libraries go
6607 set archlib archlib
6608 eval $prefixit
6609 : privlib default is /usr/local/lib/$package/$version
6610 : archlib default is /usr/local/lib/$package/$version/$archname
6611 : privlib may have an optional trailing /share.
6612 tdflt=`echo $privlib | $sed 's,/share$,,'`
6613 tdflt=$tdflt/$archname
6614 case "$archlib" in
6615 '')     dflt=$tdflt
6616         ;;
6617 *)      dflt="$archlib"
6618     ;;
6619 esac
6620 $cat <<EOM
6621
6622 $spackage contains architecture-dependent library files.  If you are
6623 sharing libraries in a heterogeneous environment, you might store
6624 these files in a separate location.  Otherwise, you can just include
6625 them with the rest of the public library files.
6626
6627 EOM
6628 fn=d+~
6629 rp='Where do you want to put the public architecture-dependent libraries?'
6630 . ./getfile
6631 archlib="$ans"
6632 archlibexp="$ansexp"
6633 if $test X"$archlib" = X"$privlib"; then
6634         d_archlib="$undef"
6635 else
6636         d_archlib="$define"
6637 fi
6638 : Change installation prefix, if necessary.
6639 if $test X"$prefix" != X"$installprefix"; then
6640         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6641 else
6642         installarchlib="$archlibexp"
6643 fi
6644
6645
6646 : Binary compatibility with 5.005 is not possible for builds
6647 : with advanced features
6648 case "$usethreads$usemultiplicity" in
6649 *define*)
6650         bincompat5005="$undef"
6651         d_bincompat5005="$undef"
6652         ;;
6653 *)      $cat <<EOM
6654
6655 This version of Perl can be compiled for binary compatibility with 5.005.
6656 If you decide to do so, you will be able to continue using most of the
6657 extensions that were compiled for Perl 5.005.
6658
6659 EOM
6660         case "$bincompat5005$d_bincompat5005" in
6661         *"$undef"*) dflt=n ;;
6662         *) dflt=y ;;
6663         esac
6664         rp='Binary compatibility with Perl 5.005?'
6665         . ./myread
6666         case "$ans" in
6667         y*) val="$define" ;;
6668         *)  val="$undef" ;;
6669         esac
6670         set d_bincompat5005
6671         eval $setvar
6672         case "$d_bincompat5005" in
6673         "$define")
6674                 bincompat5005="$define"
6675                 ;;
6676         *)      bincompat5005="$undef"
6677                 d_bincompat5005="$undef"
6678                 ;;
6679         esac
6680         ;;
6681 esac
6682
6683
6684 : see if setuid scripts can be secure
6685 $cat <<EOM
6686
6687 Some kernels have a bug that prevents setuid #! scripts from being
6688 secure.  Some sites have disabled setuid #! scripts because of this.
6689
6690 First let's decide if your kernel supports secure setuid #! scripts.
6691 (If setuid #! scripts would be secure but have been disabled anyway,
6692 don't say that they are secure if asked.)
6693
6694 EOM
6695
6696 val="$undef"
6697 if $test -d /dev/fd; then
6698         echo "#!$ls" >reflect
6699         chmod +x,u+s reflect
6700         ./reflect >flect 2>&1
6701         if $contains "/dev/fd" flect >/dev/null; then
6702                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6703                 val="$define"
6704         else
6705                 $cat <<EOM
6706 If you are not sure if they are secure, I can check but I'll need a
6707 username and password different from the one you are using right now.
6708 If you don't have such a username or don't want me to test, simply
6709 enter 'none'.
6710
6711 EOM
6712                 rp='Other username to test security of setuid scripts with?'
6713                 dflt='none'
6714                 . ./myread
6715                 case "$ans" in
6716                 n|none)
6717                         case "$d_suidsafe" in
6718                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6719                                 dflt=n;;
6720                         "$undef")
6721                                 echo "Well, the $hint value is *not* secure." >&4
6722                                 dflt=n;;
6723                         *)      echo "Well, the $hint value *is* secure." >&4
6724                                 dflt=y;;
6725                         esac
6726                         ;;
6727                 *)
6728                         $rm -f reflect flect
6729                         echo "#!$ls" >reflect
6730                         chmod +x,u+s reflect
6731                         echo >flect
6732                         chmod a+w flect
6733                         echo '"su" will (probably) prompt you for '"$ans's password."
6734                         su $ans -c './reflect >flect'
6735                         if $contains "/dev/fd" flect >/dev/null; then
6736                                 echo "Okay, it looks like setuid scripts are secure." >&4
6737                                 dflt=y
6738                         else
6739                                 echo "I don't think setuid scripts are secure." >&4
6740                                 dflt=n
6741                         fi
6742                         ;;
6743                 esac
6744                 rp='Does your kernel have *secure* setuid scripts?'
6745                 . ./myread
6746                 case "$ans" in
6747                 [yY]*)  val="$define";;
6748                 *)      val="$undef";;
6749                 esac
6750         fi
6751 else
6752         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6753         echo "(That's for file descriptors, not floppy disks.)"
6754         val="$undef"
6755 fi
6756 set d_suidsafe
6757 eval $setvar
6758
6759 $rm -f reflect flect
6760
6761 : now see if they want to do setuid emulation
6762 echo " "
6763 val="$undef"
6764 case "$d_suidsafe" in
6765 "$define")
6766         val="$undef"
6767         echo "No need to emulate SUID scripts since they are secure here." >&4
6768         ;;
6769 *)
6770         $cat <<EOM
6771 Some systems have disabled setuid scripts, especially systems where
6772 setuid scripts cannot be secure.  On systems where setuid scripts have
6773 been disabled, the setuid/setgid bits on scripts are currently
6774 useless.  It is possible for $package to detect those bits and emulate
6775 setuid/setgid in a secure fashion.  This emulation will only work if
6776 setuid scripts have been disabled in your kernel.
6777
6778 EOM
6779         case "$d_dosuid" in
6780         "$define") dflt=y ;;
6781         *) dflt=n ;;
6782         esac
6783         rp="Do you want to do setuid/setgid emulation?"
6784         . ./myread
6785         case "$ans" in
6786         [yY]*)  val="$define";;
6787         *)      val="$undef";;
6788         esac
6789         ;;
6790 esac
6791 set d_dosuid
6792 eval $setvar
6793
6794 : see if this is a malloc.h system
6795 set malloc.h i_malloc
6796 eval $inhdr
6797
6798 : see if stdlib is available
6799 set stdlib.h i_stdlib
6800 eval $inhdr
6801
6802 : determine which malloc to compile in
6803 echo " "
6804 case "$usemymalloc" in
6805 [yY]*|true|$define)     dflt='y' ;;
6806 [nN]*|false|$undef)     dflt='n' ;;
6807 *)      case "$ptrsize" in
6808         4) dflt='y' ;;
6809         *) dflt='n' ;;
6810         esac
6811         ;;
6812 esac
6813 rp="Do you wish to attempt to use the malloc that comes with $package?"
6814 . ./myread
6815 usemymalloc="$ans"
6816 case "$ans" in
6817 y*|true)
6818         usemymalloc='y'
6819         mallocsrc='malloc.c'
6820         mallocobj="malloc$_o"
6821         d_mymalloc="$define"
6822         case "$libs" in
6823         *-lmalloc*)
6824                 : Remove malloc from list of libraries to use
6825                 echo "Removing unneeded -lmalloc from library list" >&4
6826                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6827                 shift
6828                 libs="$*"
6829                 echo "libs = $libs" >&4
6830                 ;;
6831         esac
6832         ;;
6833 *)
6834         usemymalloc='n'
6835         mallocsrc=''
6836         mallocobj=''
6837         d_mymalloc="$undef"
6838         ;;
6839 esac
6840
6841 : compute the return types of malloc and free
6842 echo " "
6843 $cat >malloc.c <<END
6844 #$i_malloc I_MALLOC
6845 #$i_stdlib I_STDLIB
6846 #include <stdio.h>
6847 #include <sys/types.h>
6848 #ifdef I_MALLOC
6849 #include <malloc.h>
6850 #endif
6851 #ifdef I_STDLIB
6852 #include <stdlib.h>
6853 #endif
6854 #ifdef TRY_MALLOC
6855 void *malloc();
6856 #endif
6857 #ifdef TRY_FREE
6858 void free();
6859 #endif
6860 END
6861 case "$malloctype" in
6862 '')
6863         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6864                 malloctype='void *'
6865         else
6866                 malloctype='char *'
6867         fi
6868         ;;
6869 esac
6870 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6871
6872 case "$freetype" in
6873 '')
6874         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6875                 freetype='void'
6876         else
6877                 freetype='int'
6878         fi
6879         ;;
6880 esac
6881 echo "Your system uses $freetype free(), it would seem." >&4
6882 $rm -f malloc.[co]
6883 $cat <<EOM
6884
6885 After $package is installed, you may wish to install various
6886 add-on modules and utilities.  Typically, these add-ons will
6887 be installed under $prefix with the rest
6888 of this package.  However, you may wish to install such add-ons
6889 elsewhere under a different prefix.
6890
6891 If you do not wish to put everything under a single prefix, that's
6892 ok.  You will be prompted for the individual locations; this siteprefix
6893 is only used to suggest the defaults.
6894
6895 The default should be fine for most people.
6896
6897 EOM
6898 fn=d~+
6899 rp='Installation prefix to use for add-on modules and utilities?'
6900 : XXX Here might be another good place for an installstyle setting.
6901 case "$siteprefix" in
6902 '') dflt=$prefix ;;
6903 *)  dflt=$siteprefix ;;
6904 esac
6905 . ./getfile
6906 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6907 oldsiteprefix=''
6908 case "$siteprefix" in
6909 '') ;;
6910 *)      case "$ans" in
6911         "$prefix") ;;
6912         *) oldsiteprefix="$prefix";;
6913         esac
6914         ;;
6915 esac
6916 siteprefix="$ans"
6917 siteprefixexp="$ansexp"
6918
6919 : determine where site specific libraries go.
6920 : Usual default is /usr/local/lib/perl5/site_perl/$version
6921 : The default "style" setting is made in installstyle.U
6922 : XXX No longer works with Prefixit stuff.
6923 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6924 case "$sitelib" in
6925 '') case "$installstyle" in
6926         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6927         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6928         esac
6929         ;;
6930 *)      dflt="$sitelib"
6931         ;;
6932 esac
6933 $cat <<EOM
6934
6935 The installation process will create a directory for
6936 site-specific extensions and modules.  Most users find it convenient
6937 to place all site-specific files in this directory rather than in the
6938 main distribution directory.
6939
6940 EOM
6941 fn=d~+
6942 rp='Pathname for the site-specific library files?'
6943 . ./getfile
6944 sitelib="$ans"
6945 sitelibexp="$ansexp"
6946 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6947 : Change installation prefix, if necessary.
6948 if $test X"$prefix" != X"$installprefix"; then
6949         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6950 else
6951         installsitelib="$sitelibexp"
6952 fi
6953
6954 : determine where site specific architecture-dependent libraries go.
6955 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6956 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6957 : sitelib may have an optional trailing /share.
6958 case "$sitearch" in
6959 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6960         dflt="$dflt/$archname"
6961         ;;
6962 *)      dflt="$sitearch"
6963         ;;
6964 esac
6965 set sitearch sitearch none
6966 eval $prefixit
6967 $cat <<EOM
6968
6969 The installation process will also create a directory for
6970 architecture-dependent site-specific extensions and modules.
6971
6972 EOM
6973 fn=d~+
6974 rp='Pathname for the site-specific architecture-dependent library files?'
6975 . ./getfile
6976 sitearch="$ans"
6977 sitearchexp="$ansexp"
6978 : Change installation prefix, if necessary.
6979 if $test X"$prefix" != X"$installprefix"; then
6980         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6981 else
6982         installsitearch="$sitearchexp"
6983 fi
6984
6985 $cat <<EOM
6986
6987 The installation process will also create a directory for
6988 vendor-supplied add-ons.  Vendors who supply perl with their system
6989 may find it convenient to place all vendor-supplied files in this
6990 directory rather than in the main distribution directory.  This will
6991 ease upgrades between binary-compatible maintenance versions of perl.
6992
6993 Of course you may also use these directories in whatever way you see
6994 fit.  For example, you might use them to access modules shared over a
6995 company-wide network.
6996
6997 The default answer should be fine for most people.
6998 This causes further questions about vendor add-ons to be skipped
6999 and no vendor-specific directories will be configured for perl.
7000
7001 EOM
7002 rp='Do you want to configure vendor-specific add-on directories?'
7003 case "$usevendorprefix" in
7004 define|true|[yY]*) dflt=y ;;
7005 *)      : User may have set vendorprefix directly on Configure command line.
7006         case "$vendorprefix" in
7007         ''|' ') dflt=n ;;
7008         *)      dflt=y ;;
7009         esac
7010         ;;
7011 esac
7012 . ./myread
7013 case "$ans" in
7014 [yY]*)  fn=d~+
7015         rp='Installation prefix to use for vendor-supplied add-ons?'
7016         case "$vendorprefix" in
7017         '') dflt='' ;;
7018         *)  dflt=$vendorprefix ;;
7019         esac
7020         . ./getfile
7021         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7022         oldvendorprefix=''
7023         case "$vendorprefix" in
7024         '') ;;
7025         *)      case "$ans" in
7026                 "$prefix") ;;
7027                 *) oldvendorprefix="$prefix";;
7028                 esac
7029                 ;;
7030         esac
7031         usevendorprefix="$define"
7032         vendorprefix="$ans"
7033         vendorprefixexp="$ansexp"
7034         ;;
7035 *)      usevendorprefix="$undef"
7036         vendorprefix=''
7037         vendorprefixexp=''
7038         ;;
7039 esac
7040
7041 case "$vendorprefix" in
7042 '')     d_vendorlib="$undef"
7043         vendorlib=''
7044         vendorlibexp=''
7045         ;;
7046 *)      d_vendorlib="$define"
7047         : determine where vendor-supplied modules go.
7048         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7049         case "$vendorlib" in
7050         '')
7051                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7052                 case "$installstyle" in
7053                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7054                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7055                 esac
7056                 ;;
7057         *)      dflt="$vendorlib"
7058                 ;;
7059         esac
7060         fn=d~+
7061         rp='Pathname for the vendor-supplied library files?'
7062         . ./getfile
7063         vendorlib="$ans"
7064         vendorlibexp="$ansexp"
7065         ;;
7066 esac
7067 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7068 : Change installation prefix, if necessary.
7069 if $test X"$prefix" != X"$installprefix"; then
7070         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7071 else
7072         installvendorlib="$vendorlibexp"
7073 fi
7074
7075 case "$vendorprefix" in
7076 '')     d_vendorarch="$undef"
7077         vendorarch=''
7078         vendorarchexp=''
7079         ;;
7080 *)      d_vendorarch="$define"
7081         : determine where vendor-supplied architecture-dependent libraries go.
7082         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7083         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7084         : vendorlib may have an optional trailing /share.
7085         case "$vendorarch" in
7086         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7087                 dflt="$dflt/$archname"
7088                 ;;
7089         *)      dflt="$vendorarch" ;;
7090         esac
7091         fn=d~+
7092         rp='Pathname for vendor-supplied architecture-dependent files?'
7093         . ./getfile
7094         vendorarch="$ans"
7095         vendorarchexp="$ansexp"
7096         ;;
7097 esac
7098 : Change installation prefix, if necessary.
7099 if $test X"$prefix" != X"$installprefix"; then
7100         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7101 else
7102         installvendorarch="$vendorarchexp"
7103 fi
7104
7105 : Final catch-all directories to search
7106 $cat <<EOM
7107
7108 Lastly, you can have perl look in other directories for extensions and
7109 modules in addition to those already specified.
7110 These directories will be searched after 
7111         $sitearch 
7112         $sitelib 
7113 EOM
7114 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7115 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7116 echo ' '
7117 case "$otherlibdirs" in
7118 ''|' ') dflt='none' ;;
7119 *)      dflt="$otherlibdirs" ;;
7120 esac
7121 $cat <<EOM
7122 Enter a colon-separated set of extra paths to include in perl's @INC
7123 search path, or enter 'none' for no extra paths.
7124
7125 EOM
7126
7127 rp='Colon-separated list of additional directories for perl to search?'
7128 . ./myread
7129 case "$ans" in
7130 ' '|''|none)    otherlibdirs=' ' ;;     
7131 *)      otherlibdirs="$ans" ;;
7132 esac
7133 case "$otherlibdirs" in
7134 ' ') val=$undef ;;
7135 *)      val=$define ;;
7136 esac
7137 set d_perl_otherlibdirs
7138 eval $setvar
7139
7140 : Cruising for prototypes
7141 echo " "
7142 echo "Checking out function prototypes..." >&4
7143 $cat >prototype.c <<'EOCP'
7144 int main(int argc, char *argv[]) {
7145         exit(0);}
7146 EOCP
7147 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7148         echo "Your C compiler appears to support function prototypes."
7149         val="$define"
7150 else
7151         echo "Your C compiler doesn't seem to understand function prototypes."
7152         val="$undef"
7153 fi
7154 set prototype
7155 eval $setvar
7156 $rm -f prototype*
7157
7158 case "$prototype" in
7159 "$define") ;;
7160 *)      ansi2knr='ansi2knr'
7161         echo " "
7162         cat <<EOM >&4
7163
7164 $me:  FATAL ERROR:
7165 This version of $package can only be compiled by a compiler that 
7166 understands function prototypes.  Unfortunately, your C compiler 
7167         $cc $ccflags
7168 doesn't seem to understand them.  Sorry about that.
7169
7170 If GNU cc is available for your system, perhaps you could try that instead.  
7171
7172 Eventually, we hope to support building Perl with pre-ANSI compilers.
7173 If you would like to help in that effort, please contact <perlbug@perl.org>.
7174
7175 Aborting Configure now.
7176 EOM
7177         exit 2
7178         ;;
7179 esac
7180
7181 : determine where public executables go
7182 echo " "
7183 set dflt bin bin
7184 eval $prefixit
7185 fn=d~
7186 rp='Pathname where the public executables will reside?'
7187 . ./getfile
7188 if $test "X$ansexp" != "X$binexp"; then
7189         installbin=''
7190 fi
7191 bin="$ans"
7192 binexp="$ansexp"
7193 : Change installation prefix, if necessary.
7194 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7195 if $test X"$prefix" != X"$installprefix"; then
7196         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7197 else
7198         installbin="$binexp"
7199 fi
7200
7201 echo " "
7202 case "$extras" in
7203 '') dflt='n';;
7204 *) dflt='y';;
7205 esac
7206 cat <<EOM
7207 Perl can be built with extra modules or bundles of modules which
7208 will be fetched from the CPAN and installed alongside Perl.
7209
7210 Notice that you will need access to the CPAN; either via the Internet,
7211 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7212 be asked later to configure the CPAN.pm module which will in turn do
7213 the installation of the rest of the extra modules or bundles.)
7214
7215 Notice also that if the modules require any external software such as
7216 libraries and headers (the libz library and the zlib.h header for the
7217 Compress::Zlib module, for example) you MUST have any such software
7218 already installed, this configuration process will NOT install such
7219 things for you.
7220
7221 If this doesn't make any sense to you, just accept the default '$dflt'.
7222 EOM
7223 rp='Install any extra modules (y or n)?'
7224 . ./myread
7225 case "$ans" in
7226 y|Y)
7227         cat <<EOM
7228
7229 Please list any extra modules or bundles to be installed from CPAN,
7230 with spaces between the names.  The names can be in any format the
7231 'install' command of CPAN.pm will understand.  (Answer 'none',
7232 without the quotes, to install no extra modules or bundles.)
7233 EOM
7234         rp='Extras?'
7235         dflt="$extras"
7236         . ./myread
7237         extras="$ans"
7238 esac
7239 case "$extras" in
7240 ''|'none')
7241         val=''
7242         $rm -f ../extras.lst
7243         ;;
7244 *)      echo "(Saving the list of extras for later...)"
7245         echo "$extras" > ../extras.lst
7246         val="'$extras'"
7247         ;;
7248 esac
7249 set extras
7250 eval $setvar
7251 echo " "
7252
7253 : Find perl5.005 or later.
7254 echo "Looking for a previously installed perl5.005 or later... "
7255 case "$perl5" in
7256 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7257                 : Check if this perl is recent and can load a simple module
7258                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7259                         perl5=$tdir/perl
7260                         break;
7261                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7262                         perl5=$tdir/perl5
7263                         break;
7264                 fi
7265         done
7266         ;;
7267 *)      perl5="$perl5"
7268         ;;
7269 esac
7270 case "$perl5" in
7271 '')     echo "None found.  That's ok.";;
7272 *)      echo "Using $perl5." ;;
7273 esac
7274
7275 : Determine list of previous versions to include in @INC
7276 $cat > getverlist <<EOPL
7277 #!$perl5 -w
7278 use File::Basename;
7279 \$api_versionstring = "$api_versionstring";
7280 \$version = "$version";
7281 \$stem = "$sitelib_stem";
7282 \$archname = "$archname";
7283 EOPL
7284         $cat >> getverlist <<'EOPL'
7285 # Can't have leading @ because metaconfig interprets it as a command!
7286 ;@inc_version_list=();
7287 # XXX Redo to do opendir/readdir? 
7288 if (-d $stem) {
7289     chdir($stem);
7290     ;@candidates = glob("5.*");
7291 }
7292 else {
7293     ;@candidates = ();
7294 }
7295
7296 # XXX ToDo:  These comparisons must be reworked when two-digit
7297 # subversions come along, so that 5.7.10 compares as greater than
7298 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7299 # widespread that we can use the built-in version vectors rather
7300 # than reinventing them here.  For 5.6.0, however, we must
7301 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7302 foreach $d (@candidates) {
7303     if ($d lt $version) {
7304         if ($d ge $api_versionstring) {
7305             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7306         }
7307         elsif ($d ge "5.005") {
7308             unshift(@inc_version_list, grep { -d } $d);
7309         }
7310     }
7311     else {
7312         # Skip newer version.  I.e. don't look in
7313         # 5.7.0 if we're installing 5.6.1.
7314     }
7315 }
7316
7317 if (@inc_version_list) {
7318     print join(' ', @inc_version_list);
7319 }
7320 else {
7321     # Blank space to preserve value for next Configure run.
7322     print " ";
7323 }
7324 EOPL
7325 chmod +x getverlist
7326 case "$inc_version_list" in
7327 '')     if test -x "$perl5$exe_ext"; then
7328                 dflt=`$perl5 getverlist`
7329         else
7330                 dflt='none'
7331         fi
7332         ;;
7333 $undef) dflt='none' ;;
7334 *)  eval dflt=\"$inc_version_list\" ;;
7335 esac
7336 case "$dflt" in
7337 ''|' ') dflt=none ;;
7338 esac
7339 case "$dflt" in
7340 5.005) case "$bincompat5005" in
7341        $define|true|[yY]*) ;;
7342        *) dflt=none ;;
7343        esac
7344        ;;
7345 esac
7346 $cat <<'EOM'
7347
7348 In order to ease the process of upgrading, this version of perl 
7349 can be configured to use modules built and installed with earlier 
7350 versions of perl that were installed under $prefix.  Specify here
7351 the list of earlier versions that this version of perl should check.
7352 If Configure detected no earlier versions of perl installed under
7353 $prefix, then the list will be empty.  Answer 'none' to tell perl
7354 to not search earlier versions.
7355
7356 The default should almost always be sensible, so if you're not sure,
7357 just accept the default.
7358 EOM
7359
7360 rp='List of earlier versions to include in @INC?'
7361 . ./myread
7362 case "$ans" in
7363 [Nn]one|''|' ') inc_version_list=' ' ;;
7364 *) inc_version_list="$ans" ;;
7365 esac
7366 case "$inc_version_list" in
7367 ''|' ') 
7368         inc_version_list_init='0';;
7369 *)      inc_version_list_init=`echo $inc_version_list |
7370                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7371         ;;
7372 esac
7373 $rm -f getverlist
7374
7375 : determine whether to install perl also as /usr/bin/perl
7376
7377 echo " "
7378 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7379         $cat <<EOM
7380 Many scripts expect perl to be installed as /usr/bin/perl.
7381 I can install the perl you are about to compile also as /usr/bin/perl
7382 (in addition to $installbin/perl).
7383 EOM
7384         case "$installusrbinperl" in
7385         "$undef"|[nN]*) dflt='n';;
7386         *)              dflt='y';;
7387         esac
7388         rp="Do you want to install perl as /usr/bin/perl?"
7389         . ./myread
7390         case "$ans" in
7391         [yY]*)  val="$define";;
7392         *)      val="$undef" ;;
7393         esac
7394 else
7395         val="$undef"
7396 fi
7397 set installusrbinperl
7398 eval $setvar
7399
7400 : see if dld is available
7401 set dld.h i_dld
7402 eval $inhdr
7403
7404 : see if dlopen exists
7405 xxx_runnm="$runnm"
7406 runnm=false
7407 set dlopen d_dlopen
7408 eval $inlibc
7409 runnm="$xxx_runnm"
7410
7411 : determine which dynamic loading, if any, to compile in
7412 echo " "
7413 dldir="ext/DynaLoader"
7414 case "$usedl" in
7415 $define|y|true)
7416         dflt='y'
7417         usedl="$define"
7418         ;;
7419 $undef|n|false)
7420         dflt='n'
7421         usedl="$undef"
7422         ;;
7423 *) 
7424         dflt='n'
7425         case "$d_dlopen" in
7426             $define) dflt='y' ;;
7427         esac
7428         case "$i_dld" in
7429             $define) dflt='y' ;;
7430         esac
7431         : Does a dl_xxx.xs file exist for this operating system
7432         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7433         ;;
7434 esac
7435 rp="Do you wish to use dynamic loading?"
7436 . ./myread
7437 usedl="$ans"
7438 case "$ans" in
7439 y*) usedl="$define"
7440         case "$dlsrc" in
7441         '')
7442                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7443                         dflt="$dldir/dl_${osname}.xs"
7444                 elif $test "$d_dlopen" = "$define" ; then
7445                         dflt="$dldir/dl_dlopen.xs"
7446                 elif $test "$i_dld" = "$define" ; then
7447                         dflt="$dldir/dl_dld.xs"
7448                 else
7449                         dflt=''
7450                 fi
7451                 ;;
7452         *)      dflt="$dldir/$dlsrc"
7453                 ;;
7454         esac
7455     echo "The following dynamic loading files are available:"
7456         : Can not go over to $dldir because getfile has path hard-coded in.
7457         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7458         rp="Source file to use for dynamic loading"
7459         fn="fne"
7460         gfpth="$src"
7461         . ./getfile
7462         usedl="$define"
7463         : emulate basename
7464         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7465
7466         $cat << EOM
7467
7468 Some systems may require passing special flags to $cc -c to
7469 compile modules that will be used to create a shared library.
7470 To use no flags, say "none".
7471
7472 EOM
7473     case "$cccdlflags" in
7474     '') case "$gccversion" in
7475                 '') case "$osname" in
7476                         hpux)   dflt='+z' ;;
7477                         next)   dflt='none' ;;
7478                         irix*)  dflt='-KPIC' ;;
7479                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7480                         sunos)  dflt='-pic' ;;
7481                         *)      dflt='none' ;;
7482                     esac
7483                         ;;
7484                 *)  case "$osname" in
7485                         darwin) dflt='none' ;;
7486                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7487                         *)      dflt='-fpic' ;;
7488                     esac ;;
7489             esac ;;
7490         ' ') dflt='none' ;;
7491     *)  dflt="$cccdlflags" ;;
7492     esac
7493     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7494     . ./myread
7495     case "$ans" in
7496     none) cccdlflags=' ' ;;
7497     *) cccdlflags="$ans" ;;
7498     esac
7499
7500     cat << EOM
7501
7502 Some systems use ld to create libraries that can be dynamically loaded,
7503 while other systems (such as those using ELF) use $cc.
7504
7505 EOM
7506         case "$ld" in
7507         '')     $cat >try.c <<'EOM'
7508 /* Test for whether ELF binaries are produced */
7509 #include <fcntl.h>
7510 #include <stdlib.h>
7511 int main() {
7512         char b[4];
7513         int i = open("a.out",O_RDONLY);
7514         if(i == -1) 
7515                 exit(1); /* fail */
7516         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7517                 exit(0); /* succeed (yes, it's ELF) */
7518         else
7519                 exit(1); /* fail */
7520 }
7521 EOM
7522                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7523                         cat <<EOM
7524 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7525 EOM
7526                         dflt="$cc"
7527                 else
7528                         echo "I'll use ld to build dynamic libraries."
7529                         dflt='ld'
7530                 fi
7531                 rm -f try.c a.out
7532                 ;;
7533         *)      dflt="$ld"
7534                 ;;
7535         esac
7536
7537     rp="What command should be used to create dynamic libraries?"
7538     . ./myread
7539         ld="$ans"
7540
7541     cat << EOM
7542
7543 Some systems may require passing special flags to $ld to create a
7544 library that can be dynamically loaded.  If your ld flags include
7545 -L/other/path options to locate libraries outside your loader's normal
7546 search path, you may need to specify those -L options here as well.  To
7547 use no flags, say "none".
7548
7549 EOM
7550     case "$lddlflags" in
7551     '') case "$osname" in
7552                         beos) dflt='-nostart' ;;
7553                         hpux) dflt='-b';
7554                               case "$gccversion" in
7555                               '') dflt="$dflt +vnocompatwarnings" ;;
7556                               esac
7557                               ;;        
7558                         linux|irix*)    dflt='-shared' ;;
7559                         next)  dflt='none' ;;
7560                         solaris) dflt='-G' ;;
7561                         sunos) dflt='-assert nodefinitions' ;;
7562                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7563                 *)     dflt='none' ;;
7564                         esac
7565                         ;;
7566     *) dflt="$lddlflags" ;;
7567     esac
7568
7569         : Try to guess additional flags to pick up local libraries.
7570         : Be careful not to append to a plain 'none'
7571         case "$dflt" in
7572         none) dflt='' ;;
7573         esac
7574         for thisflag in $ldflags; do
7575                 case "$thisflag" in
7576                 -L*|-R*|-Wl,-R*)
7577                         case " $dflt " in
7578                         *" $thisflag "*) ;;
7579                         *) dflt="$dflt $thisflag" ;;
7580                         esac
7581                         ;;
7582                 esac
7583         done
7584
7585         case "$dflt" in
7586         ''|' ') dflt='none' ;;
7587         esac
7588
7589     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7590     . ./myread
7591     case "$ans" in
7592     none) lddlflags=' ' ;;
7593     *) lddlflags="$ans" ;;
7594     esac
7595
7596         cat <<EOM
7597
7598 Some systems may require passing special flags to $cc to indicate that
7599 the resulting executable will use dynamic linking.  To use no flags,
7600 say "none".
7601
7602 EOM
7603     case "$ccdlflags" in
7604     '') case "$osname" in
7605                 hpux)   dflt='-Wl,-E' ;;
7606                 linux)  dflt='-rdynamic' ;;
7607                 next)   dflt='none' ;;
7608                 sunos)  dflt='none' ;;
7609                 *)      dflt='none' ;;
7610             esac ;;
7611     ' ')  dflt='none' ;;
7612     *)  dflt="$ccdlflags" ;;
7613     esac
7614     rp="Any special flags to pass to $cc to use dynamic linking?"
7615     . ./myread
7616     case "$ans" in
7617     none) ccdlflags=' ' ;;
7618     *) ccdlflags="$ans" ;;
7619     esac
7620     ;;
7621 *)  usedl="$undef"
7622         ld='ld'
7623     dlsrc='dl_none.xs'
7624     lddlflags=''
7625     ccdlflags=''
7626     ;;
7627 esac
7628
7629 also=''
7630 case "$usedl" in
7631 $undef)
7632         # No dynamic loading being used, so don't bother even to prompt.
7633         useshrplib='false'
7634         ;;
7635 *)      case "$useshrplib" in
7636         '')     case "$osname" in
7637                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7638                         dflt=y
7639                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7640                         ;;
7641                 next*)
7642                         case "$osvers" in
7643                         4*)     dflt=y
7644                                 also='Building a shared libperl is needed for MAB support.'
7645                                 ;;
7646                         *)      dflt=n
7647                                 ;;
7648                         esac
7649                         ;;
7650                 *)      dflt=n
7651                         ;;
7652                 esac
7653                 ;;
7654         $define|true|[Yy]*)
7655                 dflt=y
7656                 ;;
7657         *)      dflt=n
7658                 ;;
7659         esac
7660         $cat << EOM
7661
7662 The perl executable is normally obtained by linking perlmain.c with
7663 libperl${_a}, any static extensions (usually just DynaLoader), and
7664 any other libraries needed on this system (such as -lm, etc.).  Since
7665 your system supports dynamic loading, it is probably possible to build
7666 a shared libperl.$so.  If you will have more than one executable linked
7667 to libperl.$so, this will significantly reduce the size of each
7668 executable, but it may have a noticeable affect on performance.  The
7669 default is probably sensible for your system.
7670 $also
7671
7672 EOM
7673         rp="Build a shared libperl.$so (y/n)"
7674         . ./myread
7675         case "$ans" in
7676         true|$define|[Yy]*)
7677                 useshrplib='true'  ;;
7678         *)      useshrplib='false' ;;
7679         esac
7680         ;;
7681 esac
7682
7683 case "$useshrplib" in
7684 true)
7685         case "$libperl" in
7686         '')
7687                 # Figure out a good name for libperl.so.  Since it gets stored in
7688                 # a version-specific architecture-dependent library, the version
7689                 # number isn't really that important, except for making cc/ld happy.
7690                 #
7691                 # A name such as libperl.so.3.1
7692                 majmin="libperl.$so.$patchlevel.$subversion"
7693                 # A name such as libperl.so.301
7694                 majonly=`echo $patchlevel $subversion |
7695                         $awk '{printf "%d%02d", $1, $2}'`
7696                 majonly=libperl.$so.$majonly
7697                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7698                 # rely on figuring it out from the naming of libc.
7699                 case "${osname}${osvers}" in
7700                 next4*)
7701                         dflt=libperl.5.$so
7702                         # XXX How handle the --version stuff for MAB?
7703                         ;;
7704                 linux*)  # ld won't link with a bare -lperl otherwise.
7705                         dflt=libperl.$so
7706                         ;;
7707                 cygwin*) # ld links against an importlib
7708                         dflt=libperl$lib_ext
7709                         ;;
7710                 *)      # Try to guess based on whether libc has major.minor.
7711                         case "$libc" in
7712                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7713                         *libc.$so.[0-9]*) dflt=$majonly ;;
7714                         *)      dflt=libperl.$so ;;
7715                         esac
7716                         ;;
7717                 esac
7718                 ;;
7719         *)      dflt=$libperl
7720                 ;;
7721         esac
7722         cat << EOM
7723
7724 I need to select a good name for the shared libperl.  If your system uses
7725 library names with major and minor numbers, then you might want something
7726 like $majmin.  Alternatively, if your system uses a single version
7727 number for shared libraries, then you might want to use $majonly.
7728 Or, your system might be quite happy with a simple libperl.$so.
7729
7730 Since the shared libperl will get installed into a version-specific
7731 architecture-dependent directory, the version number of the shared perl
7732 library probably isn't important, so the default should be o.k.
7733
7734 EOM
7735         rp='What name do you want to give to the shared libperl?'
7736         . ./myread
7737         libperl=$ans
7738         echo "Ok, I'll use $libperl"
7739         ;;
7740 *)
7741         libperl="libperl${_a}"
7742         ;;
7743 esac
7744
7745 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7746 case "$shrpdir" in
7747 '') ;;
7748 *)      $cat >&4 <<EOM
7749 WARNING:  Use of the shrpdir variable for the installation location of
7750 the shared $libperl is not supported.  It was never documented and
7751 will not work in this version.  Let me (perlbug@perl.org)
7752 know of any problems this may cause.
7753
7754 EOM
7755         case "$shrpdir" in
7756         "$archlibexp/CORE")
7757                 $cat >&4 <<EOM
7758 But your current setting of $shrpdir is
7759 the default anyway, so it's harmless.
7760 EOM
7761                 ;;
7762         *)
7763                 $cat >&4 <<EOM
7764 Further, your current attempted setting of $shrpdir
7765 conflicts with the value of $archlibexp/CORE
7766 that installperl will use.
7767 EOM
7768                 ;;
7769         esac
7770         ;;
7771 esac
7772
7773 # How will the perl executable find the installed shared $libperl?
7774 # Add $xxx to ccdlflags.
7775 # If we can't figure out a command-line option, use $shrpenv to
7776 # set env LD_RUN_PATH.  The main perl makefile uses this.
7777 shrpdir=$archlibexp/CORE
7778 xxx=''
7779 tmp_shrpenv=''
7780 if "$useshrplib"; then
7781     case "$osname" in 
7782         aix)
7783                 # We'll set it in Makefile.SH...
7784                 ;;
7785         solaris)
7786                 xxx="-R $shrpdir"
7787                 ;;
7788         freebsd|netbsd)
7789                 xxx="-Wl,-R$shrpdir"
7790                 ;;
7791         bsdos|linux|irix*|dec_osf)
7792                 xxx="-Wl,-rpath,$shrpdir"
7793                 ;;
7794         next)
7795                 # next doesn't like the default...
7796                 ;;
7797         beos)
7798                 # beos doesn't like the default, either.
7799                 ;;
7800         hpux*)
7801                 # hpux doesn't like the default, either.
7802                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7803                 ;;
7804         *)
7805                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7806                 ;;
7807         esac
7808         case "$xxx" in
7809         '') ;;
7810         *)      
7811                 # Only add $xxx if it isn't already in ccdlflags.
7812                 case " $ccdlflags " in
7813                 *" $xxx "*)     ;;
7814                 *)      ccdlflags="$ccdlflags $xxx"
7815                         cat <<EOM >&4
7816
7817 Adding $xxx to the flags
7818 passed to $ld so that the perl executable will find the 
7819 installed shared $libperl.
7820
7821 EOM
7822                         ;;
7823                 esac
7824                 ;;
7825         esac
7826 fi
7827 # Fix ccdlflags in AIX for building external extensions.
7828 # (For building Perl itself bare -bE:perl.exp is needed,
7829 #  Makefile.SH takes care of this.)
7830 case "$osname" in
7831 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7832 esac
7833 # Respect a hint or command-line value.
7834 case "$shrpenv" in
7835 '') shrpenv="$tmp_shrpenv" ;;
7836 esac
7837 case "$ldlibpthname" in
7838 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7839 none)   ldlibpthname='' ;;
7840 esac
7841
7842 : determine where manual pages are on this system
7843 echo " "
7844 case "$sysman" in
7845 '') 
7846         syspath='/usr/share/man/man1 /usr/man/man1'
7847         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7848         syspath="$syspath /usr/man/u_man/man1"
7849         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7850         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7851         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7852         sysman=`./loc . /usr/man/man1 $syspath`
7853         ;;
7854 esac
7855 if $test -d "$sysman"; then
7856         echo "System manual is in $sysman." >&4
7857 else
7858         echo "Could not find manual pages in source form." >&4
7859 fi
7860
7861 : determine where manual pages go
7862 set man1dir man1dir none
7863 eval $prefixit
7864 $cat <<EOM
7865
7866 $spackage has manual pages available in source form.
7867 EOM
7868 case "$nroff" in
7869 nroff)
7870         echo "However, you don't have nroff, so they're probably useless to you."
7871         case "$man1dir" in
7872         '') man1dir="none";;
7873         esac;;
7874 esac
7875 echo "If you don't want the manual sources installed, answer 'none'."
7876 case "$man1dir" in
7877 ' ') dflt=none
7878         ;;
7879 '')
7880         lookpath="$prefixexp/share/man/man1"
7881         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7882         lookpath="$lookpath $prefixexp/man/p_man/man1"
7883         lookpath="$lookpath $prefixexp/man/u_man/man1"
7884         lookpath="$lookpath $prefixexp/man/man.1"
7885         case "$sysman" in
7886         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7887         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7888         esac
7889         set dflt
7890         eval $prefixup
7891         ;;
7892 *)  dflt="$man1dir"
7893         ;;
7894 esac
7895 echo " "
7896 fn=dn+~
7897 rp="Where do the main $spackage manual pages (source) go?"
7898 . ./getfile
7899 if $test "X$man1direxp" != "X$ansexp"; then
7900         installman1dir=''
7901 fi
7902 man1dir="$ans"
7903 man1direxp="$ansexp"
7904 case "$man1dir" in
7905 '')     man1dir=' '
7906         installman1dir='';;
7907 esac
7908
7909 : Change installation prefix, if necessary.
7910 if $test X"$prefix" != X"$installprefix"; then
7911         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7912 else
7913         installman1dir="$man1direxp"
7914 fi
7915
7916 : What suffix to use on installed man pages
7917
7918 case "$man1dir" in
7919 ' ')
7920         man1ext='0'
7921         ;;
7922 *)
7923         rp="What suffix should be used for the main $spackage man pages?"
7924         case "$man1ext" in
7925         '')     case "$man1dir" in
7926                 *1)  dflt=1 ;;
7927                 *1p) dflt=1p ;;
7928                 *1pm) dflt=1pm ;;
7929                 *l) dflt=l;;
7930                 *n) dflt=n;;
7931                 *o) dflt=o;;
7932                 *p) dflt=p;;
7933                 *C) dflt=C;;
7934                 *L) dflt=L;;
7935                 *L1) dflt=L1;;
7936                 *) dflt=1;;
7937                 esac
7938                 ;;
7939         *)      dflt="$man1ext";;
7940         esac
7941         . ./myread
7942         man1ext="$ans"
7943         ;;
7944 esac
7945
7946 : see if we can have long filenames
7947 echo " "
7948 first=123456789abcdef
7949 $rm -f $first
7950 if (echo hi >$first) 2>/dev/null; then
7951         if $test -f 123456789abcde; then
7952                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7953                 val="$undef"
7954         else
7955                 echo 'You can have filenames longer than 14 characters.'>&4
7956                 val="$define"
7957         fi
7958 else
7959         $cat <<'EOM'
7960 You can't have filenames longer than 14 chars.
7961 You can't even think about them!
7962 EOM
7963         val="$undef"
7964 fi 
7965 set d_flexfnam
7966 eval $setvar
7967 $rm -rf 123456789abcde*
7968
7969 : determine where library module manual pages go
7970 set man3dir man3dir none
7971 eval $prefixit
7972 $cat <<EOM
7973
7974 $spackage has manual pages for many of the library modules.
7975 EOM
7976
7977 case "$nroff" in
7978 nroff)
7979         $cat <<'EOM'
7980 However, you don't have nroff, so they're probably useless to you.
7981 EOM
7982         case "$man3dir" in
7983         '') man3dir="none";;
7984         esac;;
7985 esac
7986
7987 case "$d_flexfnam" in
7988 undef)
7989         $cat <<'EOM'
7990 However, your system can't handle the long file names like File::Basename.3. 
7991 EOM
7992         case "$man3dir" in
7993         '') man3dir="none";;
7994         esac;;
7995 esac
7996
7997 echo "If you don't want the manual sources installed, answer 'none'."
7998 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7999 case "$man3dir" in
8000 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8001         if $test -d "$privlib/man/man3"; then
8002                 cat <<EOM >&4
8003
8004 WARNING:  Previous versions of perl installed man3 pages into
8005 $privlib/man/man3.  This version will suggest a 
8006 new default of $dflt.  
8007 EOM
8008                 tdflt=$dflt
8009                 dflt='n'
8010                 rp='Do you wish to preserve the old behavior?(y/n)'
8011                 . ./myread
8012                 case "$ans" in
8013                 y*) dflt="$privlib/man/man3" ;;
8014                 *)  dflt=$tdflt ;;
8015                 esac
8016     fi
8017         ;;
8018 *)      dflt="$man3dir" ;;
8019 esac
8020 case "$dflt" in
8021 ' ') dflt=none ;;
8022 esac
8023 echo " "
8024 fn=dn+~
8025 rp="Where do the $package library man pages (source) go?"
8026 . ./getfile
8027 man3dir="$ans"
8028 man3direxp="$ansexp"
8029 case "$man3dir" in
8030 '')     man3dir=' '
8031         installman3dir='';;
8032 esac
8033
8034 : Change installation prefix, if necessary.
8035 if $test X"$prefix" != X"$installprefix"; then
8036         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8037 else
8038         installman3dir="$man3direxp"
8039 fi
8040
8041 : What suffix to use on installed man pages
8042 case "$man3dir" in
8043 ' ')
8044         man3ext='0'
8045         ;;
8046 *)
8047         rp="What suffix should be used for the $package library man pages?"
8048         case "$man3ext" in
8049         '')     case "$man3dir" in
8050                 *3)  dflt=3 ;;
8051                 *3p) dflt=3p ;;
8052                 *3pm) dflt=3pm ;;
8053                 *l) dflt=l;;
8054                 *n) dflt=n;;
8055                 *o) dflt=o;;
8056                 *p) dflt=p;;
8057                 *C) dflt=C;;
8058                 *L) dflt=L;;
8059                 *L3) dflt=L3;;
8060                 *) dflt=3;;
8061                 esac
8062                 ;;
8063         *)      dflt="$man3ext";;
8064         esac
8065         . ./myread
8066         man3ext="$ans"
8067         ;;
8068 esac
8069
8070 : see if we have to deal with yellow pages, now NIS.
8071 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8072         if $test -f /usr/etc/nibindd; then
8073                 echo " "
8074                 echo "I'm fairly confident you're on a NeXT."
8075                 echo " "
8076                 rp='Do you get the hosts file via NetInfo?'
8077                 dflt=y
8078                 case "$hostcat" in
8079                 nidump*) ;;
8080                 '') ;;
8081                 *) dflt=n;;
8082                 esac
8083                 . ./myread
8084                 case "$ans" in
8085                 y*) hostcat='nidump hosts .';;
8086                 *)      case "$hostcat" in
8087                         nidump*) hostcat='';;
8088                         esac
8089                         ;;
8090                 esac
8091         fi
8092         case "$hostcat" in
8093         nidump*) ;;
8094         *)
8095                 case "$hostcat" in
8096                 *ypcat*) dflt=y;;
8097                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8098                                 dflt=y
8099                         else
8100                                 dflt=n
8101                         fi;;
8102                 *) dflt=n;;
8103                 esac
8104                 echo " "
8105                 rp='Are you getting the hosts file via yellow pages?'
8106                 . ./myread
8107                 case "$ans" in
8108                 y*) hostcat='ypcat hosts';;
8109                 *) hostcat='cat /etc/hosts';;
8110                 esac
8111                 ;;
8112         esac
8113 fi
8114 case "$hostcat" in
8115 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8116 esac
8117 case "$groupcat" in
8118 '') test -f /etc/group && groupcat='cat /etc/group';;
8119 esac
8120 case "$passcat" in
8121 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8122 esac
8123
8124 : now get the host name
8125 echo " "
8126 echo "Figuring out host name..." >&4
8127 case "$myhostname" in
8128 '') cont=true
8129         echo 'Maybe "hostname" will work...'
8130         if tans=`sh -c hostname 2>&1` ; then
8131                 myhostname=$tans
8132                 phostname=hostname
8133                 cont=''
8134         fi
8135         ;;
8136 *) cont='';;
8137 esac
8138 if $test "$cont"; then
8139         if ./xenix; then
8140                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8141                 if tans=`cat /etc/systemid 2>&1` ; then
8142                         myhostname=$tans
8143                         phostname='cat /etc/systemid'
8144                         echo "Whadyaknow.  Xenix always was a bit strange..."
8145                         cont=''
8146                 fi
8147         elif $test -r /etc/systemid; then
8148                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8149         fi
8150 fi
8151 if $test "$cont"; then
8152         echo 'No, maybe "uuname -l" will work...'
8153         if tans=`sh -c 'uuname -l' 2>&1` ; then
8154                 myhostname=$tans
8155                 phostname='uuname -l'
8156         else
8157                 echo 'Strange.  Maybe "uname -n" will work...'
8158                 if tans=`sh -c 'uname -n' 2>&1` ; then
8159                         myhostname=$tans
8160                         phostname='uname -n'
8161                 else
8162                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8163                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8164                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8165                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8166                         else
8167                                 case "$myhostname" in
8168                                 '') echo "Does this machine have an identity crisis or something?"
8169                                         phostname='';;
8170                                 *)
8171                                         echo "Well, you said $myhostname before..."
8172                                         phostname='echo $myhostname';;
8173                                 esac
8174                         fi
8175                 fi
8176         fi
8177 fi
8178 case "$myhostname" in
8179 '') myhostname=noname ;;
8180 esac
8181 : you do not want to know about this
8182 set $myhostname
8183 myhostname=$1
8184
8185 : verify guess
8186 if $test "$myhostname" ; then
8187         dflt=y
8188         rp='Your host name appears to be "'$myhostname'".'" Right?"
8189         . ./myread
8190         case "$ans" in
8191         y*) ;;
8192         *) myhostname='';;
8193         esac
8194 fi
8195
8196 : bad guess or no guess
8197 while $test "X$myhostname" = X ; do
8198         dflt=''
8199         rp="Please type the (one word) name of your host:"
8200         . ./myread
8201         myhostname="$ans"
8202 done
8203
8204 : translate upper to lower if necessary
8205 case "$myhostname" in
8206 *[A-Z]*)
8207         echo "(Normalizing case in your host name)"
8208         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8209         ;;
8210 esac
8211
8212 case "$myhostname" in
8213 *.*)
8214         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8215         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8216         echo "(Trimming domain name from host name--host name is now $myhostname)"
8217         ;;
8218 *) case "$mydomain" in
8219         '')
8220                 {
8221                         test "X$hostcat" = "Xypcat hosts" &&
8222                         ypmatch "$myhostname" hosts 2>/dev/null |\
8223                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8224                         $test -s hosts
8225                 } || {
8226                         test "X$hostcat" != "X" &&
8227                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8228                                         /[       ]$myhostname[  . ]/p" > hosts
8229                 }
8230                 tmp_re="[       . ]"
8231                 if $test -f hosts; then
8232                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8233                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8234                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8235                                 hosts | $sort | $uniq | \
8236                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8237                         case `$echo X$dflt` in
8238                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8239                                 dflt=.
8240                                 ;;
8241                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8242                                 ;;
8243                         esac
8244                 else
8245                         echo "(I cannot locate a hosts database anywhere)"
8246                         dflt=.
8247                 fi
8248                 case "$dflt" in
8249                 .)
8250                         tans=`./loc resolv.conf X /etc /usr/etc`
8251                         if $test -f "$tans"; then
8252                                 echo "(Attempting domain name extraction from $tans)"
8253                                 dflt=.`$sed -n -e 's/   / /g' \
8254                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8255                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8256                                 case "$dflt" in
8257                                 .) dflt=.`$sed -n -e 's/        / /g' \
8258                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8259                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8260                                         ;;
8261                                 esac
8262                         fi
8263                         ;;
8264                 esac
8265                 case "$dflt" in
8266                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8267                         dflt=.`sh -c domainname 2>/dev/null`
8268                         case "$dflt" in
8269                         '') dflt='.';;
8270                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8271                         esac
8272                         ;;
8273                 esac
8274                 case "$dflt$osname" in
8275                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8276                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8277                         ;;
8278                 esac
8279                 case "$dflt" in
8280                 .) echo "(Lost all hope -- silly guess then)"
8281                         dflt='.nonet'
8282                         ;;
8283                 esac
8284                 $rm -f hosts
8285                 ;;
8286         *) dflt="$mydomain";;
8287         esac;;
8288 esac
8289 echo " "
8290 rp="What is your domain name?"
8291 . ./myread
8292 tans="$ans"
8293 case "$ans" in
8294 '') ;;
8295 .*) ;;
8296 *) tans=".$tans";;
8297 esac
8298 mydomain="$tans"
8299
8300 : translate upper to lower if necessary
8301 case "$mydomain" in
8302 *[A-Z]*)
8303         echo "(Normalizing case in your domain name)"
8304         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8305         ;;
8306 esac
8307
8308 : a little sanity check here
8309 case "$phostname" in
8310 '') ;;
8311 *)
8312         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8313         $myhostname$mydomain|$myhostname) ;;
8314         *)
8315                 case "$phostname" in
8316                 sed*)
8317                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8318                         ;;
8319                 *)
8320                         echo "(That doesn't agree with your $phostname command, by the way.)"
8321                         ;;
8322                 esac
8323         ;;
8324         esac
8325         ;;
8326 esac
8327
8328 $cat <<EOM
8329
8330 I need to get your e-mail address in Internet format if possible, i.e.
8331 something like user@host.domain. Please answer accurately since I have
8332 no easy means to double check it. The default value provided below
8333 is most probably close to reality but may not be valid from outside
8334 your organization...
8335
8336 EOM
8337 cont=x
8338 while test "$cont"; do
8339         case "$cf_email" in
8340         '') dflt="$cf_by@$myhostname$mydomain";;
8341         *) dflt="$cf_email";;
8342         esac
8343         rp='What is your e-mail address?'
8344         . ./myread
8345         cf_email="$ans"
8346         case "$cf_email" in
8347         *@*.*) cont='' ;;
8348         *)
8349                 rp='Address does not look like an Internet one.  Use it anyway?'
8350                 case "$fastread" in
8351                 yes) dflt=y ;;
8352                 *) dflt=n ;;
8353                 esac
8354                 . ./myread
8355                 case "$ans" in
8356                 y*) cont='' ;;
8357                 *) echo " " ;;
8358                 esac
8359                 ;;
8360         esac
8361 done
8362
8363 $cat <<EOM
8364
8365 If you or somebody else will be maintaining perl at your site, please
8366 fill in the correct e-mail address here so that they may be contacted
8367 if necessary. Currently, the "perlbug" program included with perl
8368 will send mail to this address in addition to perlbug@perl.org. You may
8369 enter "none" for no administrator.
8370
8371 EOM
8372 case "$perladmin" in
8373 '') dflt="$cf_email";;
8374 *) dflt="$perladmin";;
8375 esac
8376 rp='Perl administrator e-mail address'
8377 . ./myread
8378 perladmin="$ans"
8379
8380 : determine whether to only install version-specific parts.
8381 echo " "
8382 $cat <<EOM
8383 Do you want to install only the version-specific parts of the perl
8384 distribution?  Usually you do *not* want to do this.
8385 EOM
8386 case "$versiononly" in
8387 "$define"|[Yy]*|true) dflt='y' ;;
8388 *) dflt='n';
8389 esac
8390 rp="Do you want to install only the version-specific parts of perl?"
8391 . ./myread
8392 case "$ans" in
8393 [yY]*)  val="$define";;
8394 *)      val="$undef" ;;
8395 esac
8396 set versiononly
8397 eval $setvar
8398
8399 case "$versiononly" in
8400 "$define") inc_version_list=''
8401            inc_version_list_init=0
8402            ;;
8403 esac
8404
8405 : figure out how to guarantee perl startup
8406 case "$startperl" in
8407 '')
8408         case "$sharpbang" in
8409         *!)
8410                 $cat <<EOH
8411
8412 I can use the #! construct to start perl on your system. This will
8413 make startup of perl scripts faster, but may cause problems if you
8414 want to share those scripts and perl is not in a standard place
8415 ($binexp/perl) on all your platforms. The alternative is to force
8416 a shell by starting the script with a single ':' character.
8417
8418 EOH
8419                 case "$versiononly" in
8420                 "$define")      dflt="$binexp/perl$version";;  
8421                 *)              dflt="$binexp/perl";;
8422                 esac
8423                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8424                 . ./myread
8425                 case "$ans" in
8426                 none)   startperl=": # use perl";;
8427                 *)      startperl="#!$ans"
8428                         if $test 30 -lt `echo "$ans" | wc -c`; then
8429                                 $cat >&4 <<EOM
8430
8431 WARNING:  Some systems limit the #! command to 32 characters.
8432 If you experience difficulty running Perl scripts with #!, try
8433 installing Perl in a directory with a shorter pathname.
8434
8435 EOM
8436                         fi ;;
8437                 esac
8438                 ;;
8439         *) startperl=": # use perl"
8440                 ;;
8441         esac
8442         ;;
8443 esac
8444 echo "I'll use $startperl to start perl scripts."
8445
8446 : figure best path for perl in scripts
8447 case "$perlpath" in
8448 '')
8449         case "$versiononly" in
8450         "$define")      perlpath="$binexp/perl$version";;
8451         *)              perlpath="$binexp/perl";;
8452         esac
8453         case "$startperl" in
8454         *!*) ;;
8455         *)
8456                 $cat <<EOH
8457
8458 I will use the "eval 'exec'" idiom to start Perl on your system.
8459 I can use the full path of your Perl binary for this purpose, but
8460 doing so may cause problems if you want to share those scripts and
8461 Perl is not always in a standard place ($binexp/perl).
8462
8463 EOH
8464                 dflt="$binexp/perl"
8465                 rp="What path shall I use in \"eval 'exec'\"?"
8466                 . ./myread
8467                 perlpath="$ans"
8468                 ;;
8469         esac
8470         ;;
8471 esac
8472 case "$startperl" in
8473 *!*)    ;;
8474 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8475 esac
8476
8477 : determine where public executable scripts go
8478 set scriptdir scriptdir
8479 eval $prefixit
8480 case "$scriptdir" in
8481 '')
8482         dflt="$bin"
8483         : guess some guesses
8484         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8485         $test -d /usr/share/bin     && dflt=/usr/share/bin
8486         $test -d /usr/local/script  && dflt=/usr/local/script
8487         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8488         $test -d $prefixexp/script  && dflt=$prefixexp/script
8489         set dflt
8490         eval $prefixup
8491         ;;
8492 *)  dflt="$scriptdir"
8493         ;;
8494 esac
8495 $cat <<EOM
8496  
8497 Some installations have a separate directory just for executable scripts so
8498 that they can mount it across multiple architectures but keep the scripts in
8499 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8500 Or you might just lump your scripts in with all your other executables.
8501  
8502 EOM
8503 fn=d~
8504 rp='Where do you keep publicly executable scripts?'
8505 . ./getfile
8506 if $test "X$ansexp" != "X$scriptdirexp"; then
8507         installscript=''
8508 fi
8509 scriptdir="$ans"
8510 scriptdirexp="$ansexp"
8511 : Change installation prefix, if necessary.
8512 if $test X"$prefix" != X"$installprefix"; then
8513         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8514 else
8515         installscript="$scriptdirexp"
8516 fi
8517
8518 : determine where add-on public executables go
8519 case "$sitebin" in
8520 '')     dflt=$siteprefix/bin ;;
8521 *)      dflt=$sitebin ;;
8522 esac
8523 fn=d~
8524 rp='Pathname where the add-on public executables should be installed?'
8525 . ./getfile
8526 sitebin="$ans"
8527 sitebinexp="$ansexp"
8528 : Change installation prefix, if necessary.
8529 if $test X"$prefix" != X"$installprefix"; then
8530         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8531 else
8532         installsitebin="$sitebinexp"
8533 fi
8534
8535 : define an is-a-typedef? function
8536 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8537 case "$inclist" in
8538 "") inclist="sys/types.h";;
8539 esac;
8540 eval "varval=\$$var";
8541 case "$varval" in
8542 "")
8543         $rm -f temp.c;
8544         for inc in $inclist; do
8545                 echo "#include <$inc>" >>temp.c;
8546         done;
8547         echo "#ifdef $type" >> temp.c;
8548         echo "printf(\"We have $type\");" >> temp.c;
8549         echo "#endif" >> temp.c;
8550         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8551         if $contains $type temp.E >/dev/null 2>&1; then
8552                 eval "$var=\$type";
8553         else
8554                 eval "$var=\$def";
8555         fi;
8556         $rm -f temp.?;;
8557 *) eval "$var=\$varval";;
8558 esac'
8559
8560 : define an is-a-typedef? function that prompts if the type is not available.
8561 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8562 case "$inclist" in
8563 "") inclist="sys/types.h";;
8564 esac;
8565 eval "varval=\$$var";
8566 case "$varval" in
8567 "")
8568         $rm -f temp.c;
8569         for inc in $inclist; do
8570                 echo "#include <$inc>" >>temp.c;
8571         done;
8572         echo "#ifdef $type" >> temp.c;
8573         echo "printf(\"We have $type\");" >> temp.c;
8574         echo "#endif" >> temp.c;
8575         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8576         echo " " ;
8577         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8578         if $contains $type temp.E >/dev/null 2>&1; then
8579                 echo "$type found." >&4;
8580                 eval "$var=\$type";
8581         else
8582                 echo "$type NOT found." >&4;
8583                 dflt="$def";
8584                 . ./myread ;
8585                 eval "$var=\$ans";
8586         fi;
8587         $rm -f temp.?;;
8588 *) eval "$var=\$varval";;
8589 esac'
8590
8591 : see what type lseek is declared as in the kernel
8592 rp="What is the type used for lseek's offset on this system?"
8593 set off_t lseektype long stdio.h sys/types.h
8594 eval $typedef_ask
8595
8596 echo " "
8597 echo "Checking to see how big your file offsets are..." >&4
8598 $cat >try.c <<EOCP
8599 #include <sys/types.h>
8600 #include <stdio.h>
8601 int main()
8602 {
8603     printf("%d\n", (int)sizeof($lseektype));
8604     return(0); 
8605 }
8606 EOCP
8607 set try
8608 if eval $compile_ok; then
8609         lseeksize=`$run ./try`
8610         echo "Your file offsets are $lseeksize bytes long."
8611 else
8612         dflt=$longsize
8613         echo " "
8614         echo "(I can't seem to compile the test program.  Guessing...)"
8615         rp="What is the size of your file offsets (in bytes)?"
8616         . ./myread
8617         lseeksize="$ans"
8618 fi
8619 $rm -f try.c try
8620
8621 : see what type file positions are declared as in the library
8622 rp="What is the type for file position used by fsetpos()?"
8623 set fpos_t fpostype long stdio.h sys/types.h
8624 eval $typedef_ask
8625
8626 echo " "
8627 case "$fpostype" in
8628 *_t) zzz="$fpostype"    ;;
8629 *)   zzz="fpos_t"       ;;
8630 esac
8631 echo "Checking the size of $zzz..." >&4 
8632 cat > try.c <<EOCP
8633 #include <sys/types.h>
8634 #include <stdio.h>
8635 int main() {
8636     printf("%d\n", (int)sizeof($fpostype));
8637     exit(0);
8638 }
8639 EOCP
8640 set try
8641 if eval $compile_ok; then
8642         yyy=`$run ./try`
8643         case "$yyy" in
8644         '')     fpossize=4
8645                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8646                 ;;
8647         *)      fpossize=$yyy
8648                 echo "Your $zzz is $fpossize bytes long."
8649                 ;;
8650         esac
8651 else
8652         dflt="$longsize"
8653         echo " " >&4
8654         echo "(I can't compile the test program.  Guessing...)" >&4
8655         rp="What is the size of your file positions (in bytes)?"
8656         . ./myread
8657         fpossize="$ans"
8658 fi
8659
8660
8661
8662 # Backward compatibility (uselfs is deprecated).
8663 case "$uselfs" in
8664 "$define"|true|[yY]*)
8665         cat <<EOM >&4
8666
8667 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8668 EOM
8669         uselargefiles="$define"
8670         ;;
8671 esac                          
8672
8673 case "$lseeksize:$fpossize" in
8674 8:8) cat <<EOM
8675
8676 You can have files larger than 2 gigabytes.
8677 EOM
8678    val="$define" ;;
8679 *)    case "$uselargefiles" in
8680    "$undef"|false|[nN]*) dflt='n' ;;
8681    *)   dflt='y' ;;
8682    esac
8683    cat <<EOM
8684
8685 Perl can be built to understand large files (files larger than 2 gigabytes)
8686 on some systems.  To do so, Configure can be run with -Duselargefiles.
8687
8688 If this doesn't make any sense to you, just accept the default '$dflt'.
8689 EOM
8690    rp='Try to understand large files, if available?'
8691    . ./myread
8692    case "$ans" in
8693    y|Y)         val="$define" ;;
8694    *)           val="$undef"  ;;
8695    esac
8696    ;;
8697 esac
8698 set uselargefiles
8699 eval $setvar
8700 case "$uselargefiles" in
8701 "$define")
8702 : Look for a hint-file generated 'call-back-unit'.  If the
8703 : user has specified that a large files perl is to be built,
8704 : we may need to set or change some other defaults.
8705         if $test -f uselargefiles.cbu; then
8706                 echo "Your platform has some specific hints for large file builds, using them..."
8707                 . ./uselargefiles.cbu
8708                 echo " "
8709                 echo "Rechecking to see how big your file offsets are..." >&4
8710                 $cat >try.c <<EOCP
8711 #include <sys/types.h>
8712 #include <stdio.h>
8713 int main()
8714 {
8715     printf("%d\n", (int)sizeof($lseektype));
8716     return(0); 
8717 }
8718 EOCP
8719                 set try
8720                 if eval $compile_ok; then
8721                         lseeksize=`$run ./try`
8722                         $echo "Your file offsets are now $lseeksize bytes long."
8723                 else
8724                         dflt="$lseeksize"
8725                         echo " "
8726                         echo "(I can't seem to compile the test program.  Guessing...)"
8727                         rp="What is the size of your file offsets (in bytes)?"
8728                         . ./myread
8729                         lseeksize="$ans"
8730                 fi
8731                 case "$fpostype" in
8732                 *_t) zzz="$fpostype"    ;;
8733                 *)   zzz="fpos_t"       ;;
8734                 esac
8735                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8736                 $cat > try.c <<EOCP
8737 #include <sys/types.h>
8738 #include <stdio.h>
8739 int main() {
8740     printf("%d\n", (int)sizeof($fpostype));
8741     exit(0);
8742 }
8743 EOCP
8744                 set try
8745                 if eval $compile_ok; then
8746                         yyy=`$run ./try`
8747                         dflt="$lseeksize"
8748                         case "$yyy" in
8749                         '')     echo " "
8750                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8751                                 ;;
8752                         *)      fpossize=$yyy
8753                                 echo " $fpossize bytes." >&4
8754                                 ;;
8755                         esac
8756                 else
8757                         dflt="$fpossize"
8758                         echo " "
8759                         echo "(I can't compile the test program.  Guessing...)" >&4
8760                         rp="What is the size of your file positions (in bytes)?"
8761                         . ./myread
8762                         fpossize="$ans"
8763                 fi
8764                 $rm -f try.c try
8765         fi
8766         ;;
8767 esac
8768
8769 case "$vendorprefix" in
8770 '')     d_vendorbin="$undef"
8771         vendorbin=''
8772         vendorbinexp=''
8773         ;;
8774 *)      d_vendorbin="$define"
8775         : determine where vendor-supplied executables go.
8776         case "$vendorbin" in
8777         '') dflt=$vendorprefix/bin ;;
8778         *)      dflt="$vendorbin" ;;
8779         esac
8780         fn=d~+
8781         rp='Pathname for the vendor-supplied executables directory?'
8782         . ./getfile
8783         vendorbin="$ans"
8784         vendorbinexp="$ansexp"
8785         ;;
8786 esac
8787 : Change installation prefix, if necessary.
8788 if $test X"$prefix" != X"$installprefix"; then
8789         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8790 else
8791         installvendorbin="$vendorbinexp"
8792 fi
8793
8794 : see if qgcvt exists
8795 set qgcvt d_qgcvt
8796 eval $inlibc
8797
8798 : Check how to convert floats to strings.
8799
8800 if test "X$d_Gconvert" = X; then
8801
8802 echo " "
8803 echo "Checking for an efficient way to convert floats to strings."
8804 echo " " > try.c
8805 case "$uselongdouble" in
8806 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8807 esac
8808 case "$d_longdbl" in
8809 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8810 esac
8811 case "$d_PRIgldbl" in
8812 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8813 esac
8814 $cat >>try.c <<EOP
8815 #ifdef TRY_gconvert
8816 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8817 char *myname = "gconvert";
8818 #endif
8819 #ifdef TRY_gcvt
8820 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8821 char *myname = "gcvt";
8822 #endif
8823 #ifdef TRY_qgcvt
8824 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8825 char *myname = "qgcvt";
8826 #define DOUBLETYPE long double
8827 #endif
8828 #ifdef TRY_sprintf
8829 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8830 #ifdef HAS_PRIgldbl
8831 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8832 #else
8833 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8834 #endif
8835 #else
8836 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8837 #endif
8838 char *myname = "sprintf";
8839 #endif
8840
8841 #ifndef DOUBLETYPE
8842 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8843 #define DOUBLETYPE long double
8844 #else
8845 #define DOUBLETYPE double
8846 #endif
8847 #endif
8848
8849 #include <stdio.h>
8850
8851 #define I_STDLIB $i_stdlib
8852 #ifdef I_STDLIB
8853 #include <stdlib.h>
8854 #endif
8855
8856 int
8857 checkit(expect, got)
8858 char *expect;
8859 char *got;
8860 {
8861     if (strcmp(expect, got)) {
8862                 printf("%s oddity:  Expected %s, got %s\n",
8863                         myname, expect, got);
8864                 exit(1);
8865         }
8866 }
8867
8868 int main()
8869
8870         char buf[64]; 
8871         buf[63] = '\0';
8872
8873         /* This must be 1st test on (which?) platform */
8874         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8875         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8876         checkit("0.1", buf);
8877
8878         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8879         checkit("0.01", buf);
8880
8881         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8882         checkit("0.001", buf);
8883
8884         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8885         checkit("0.0001", buf);
8886
8887         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8888         if (strlen(buf) > 5)
8889             checkit("9e-005", buf); /* for Microsoft ?? */
8890         else
8891             checkit("9e-05", buf);
8892
8893         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8894         checkit("1", buf);
8895
8896         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8897         checkit("1.1", buf);
8898
8899         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8900         checkit("1.01", buf);
8901
8902         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8903         checkit("1.001", buf);
8904
8905         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8906         checkit("1.0001", buf);
8907
8908         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8909         checkit("1.00001", buf);
8910
8911         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8912         checkit("1.000001", buf);
8913
8914         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8915         checkit("0", buf);
8916
8917         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8918         checkit("-1", buf);
8919
8920         /* Some Linux gcvt's give 1.e+5 here. */
8921         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8922         checkit("100000", buf);
8923         
8924         /* Some Linux gcvt's give -1.e+5 here. */
8925         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8926         checkit("-100000", buf);
8927
8928         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8929         checkit("123.456", buf);
8930
8931         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8932         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8933         /* 34 should be enough to scare even long double
8934          * places into using the e notation. */
8935         if (strlen(buf) > 5)
8936             checkit("1e+034", buf); /* for Microsoft */
8937         else
8938             checkit("1e+34", buf);
8939
8940         /* For Perl, if you add additional tests here, also add them to
8941          * t/base/num.t for benefit of platforms not using Configure or
8942          * overriding d_Gconvert */
8943
8944         exit(0);
8945 }
8946 EOP
8947 : first add preferred functions to our list
8948 xxx_list=""
8949 for xxx_convert in $gconvert_preference; do
8950     case $xxx_convert in
8951     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8952     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8953     esac 
8954 done
8955 : then add any others
8956 for xxx_convert in gconvert gcvt sprintf; do
8957     case "$xxx_list" in
8958     *$xxx_convert*) ;;
8959     *) xxx_list="$xxx_list $xxx_convert" ;;
8960     esac 
8961 done
8962
8963 case "$d_longdbl$uselongdouble" in
8964 "$define$define")
8965     : again, add prefered functions to our list first
8966     xxx_ld_list=""
8967     for xxx_convert in $gconvert_ld_preference; do
8968         case $xxx_convert in
8969         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8970         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8971         esac
8972     done
8973     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8974     for xxx_convert in qgcvt sprintf $xxx_list; do
8975         case "$xxx_ld_list" in
8976         $xxx_convert*|*" $xxx_convert"*) ;;
8977         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8978         esac
8979     done
8980     : if sprintf cannot do long doubles, move it to the end
8981     if test "$d_PRIgldbl" != "$define"; then
8982         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8983     fi
8984     : if no qgcvt, remove it
8985     if test "$d_qgcvt" != "$define"; then
8986         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8987     fi
8988     : use the ld_list
8989     xxx_list="$xxx_ld_list"
8990     ;;
8991 esac
8992
8993 for xxx_convert in $xxx_list; do
8994         echo "Trying $xxx_convert..."
8995         $rm -f try try$_o
8996         set try -DTRY_$xxx_convert
8997         if eval $compile; then
8998                 echo "$xxx_convert() found." >&4
8999                 if $run ./try; then
9000                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9001                         break;
9002                 else
9003                         echo "...But $xxx_convert didn't work as I expected."
9004                         xxx_convert=''
9005                 fi
9006         else
9007                 echo "$xxx_convert NOT found." >&4
9008         fi
9009 done
9010
9011 if test X$xxx_convert = X; then
9012     echo "*** WHOA THERE!!! ***" >&4
9013     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9014     xxx_convert=sprintf
9015 fi
9016
9017 case "$xxx_convert" in
9018 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9019 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9020 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9021 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9022    "$define$define$define")
9023       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9024    "$define$define$undef")
9025       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9026    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9027    esac
9028    ;;  
9029 esac
9030
9031 fi
9032
9033 : see if _fwalk exists
9034 set fwalk d__fwalk
9035 eval $inlibc
9036
9037 : Initialize h_fcntl
9038 h_fcntl=false
9039
9040 : Initialize h_sysfile
9041 h_sysfile=false
9042
9043 : access call always available on UNIX
9044 set access d_access
9045 eval $inlibc
9046
9047 : locate the flags for 'access()'
9048 case "$d_access" in
9049 "$define")
9050         echo " "
9051         $cat >access.c <<'EOCP'
9052 #include <sys/types.h>
9053 #ifdef I_FCNTL
9054 #include <fcntl.h>
9055 #endif
9056 #ifdef I_SYS_FILE
9057 #include <sys/file.h>
9058 #endif
9059 #ifdef I_UNISTD
9060 #include <unistd.h>
9061 #endif
9062 int main() {
9063         exit(R_OK);
9064 }
9065 EOCP
9066         : check sys/file.h first, no particular reason here
9067         if $test `./findhdr sys/file.h` && \
9068                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9069                 h_sysfile=true;
9070                 echo "<sys/file.h> defines the *_OK access constants." >&4
9071         elif $test `./findhdr fcntl.h` && \
9072                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9073                 h_fcntl=true;
9074                 echo "<fcntl.h> defines the *_OK access constants." >&4
9075         elif $test `./findhdr unistd.h` && \
9076                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9077                 echo "<unistd.h> defines the *_OK access constants." >&4
9078         else
9079                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9080         fi
9081         ;;
9082 esac
9083 $rm -f access*
9084
9085 : see if accessx exists
9086 set accessx d_accessx
9087 eval $inlibc
9088
9089 : see if alarm exists
9090 set alarm d_alarm
9091 eval $inlibc
9092
9093 : see if POSIX threads are available
9094 set pthread.h i_pthread
9095 eval $inhdr
9096
9097 : define a fucntion to check prototypes
9098 $cat > protochk <<EOSH
9099 $startsh
9100 cc="$cc"
9101 optimize="$optimize"
9102 ccflags="$ccflags"
9103 prototype="$prototype"
9104 define="$define"
9105 rm=$rm
9106 usethreads=$usethreads
9107 i_pthread=$i_pthread
9108 pthread_h_first=$pthread_h_first
9109 EOSH
9110
9111 $cat >> protochk <<'EOSH'
9112
9113 $rm -f try.c
9114 foo="$1"
9115 shift
9116 while test $# -ge 2; do
9117         case "$1" in
9118                 $define) echo "#include <$2>" >> try.c ;;
9119                 literal) echo "$2" >> try.c ;;
9120         esac
9121     # Extra magic for the benefit of systems that need pthread.h
9122     # to be included early to correctly detect threadsafe functions.
9123     # Such functions must guarantee themselves, though, that the usethreads
9124     # and i_pthread have been defined, before calling protochk.
9125     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9126         echo "#include <pthread.h>" >> try.c
9127         pthread_h_done=yes
9128     fi
9129     shift 2
9130 done
9131 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9132 cat >> try.c <<'EOCP'
9133 #ifdef CAN_PROTOTYPE
9134 #define _(args) args
9135 #else
9136 #define _(args) ()
9137 #endif
9138 EOCP
9139 echo "$foo" >> try.c
9140 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9141 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9142 status=$?
9143 $rm -f try.[co]
9144 exit $status
9145 EOSH
9146 chmod +x protochk
9147 $eunicefix protochk
9148
9149 hasproto='varname=$1; func=$2; shift; shift;
9150 while $test $# -ge 2; do
9151         case "$1" in
9152         $define) echo "#include <$2>";;
9153         esac ;
9154     shift 2;
9155 done > try.c;
9156 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9157 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9158         echo "$func() prototype found.";
9159         val="$define";
9160 else
9161         echo "$func() prototype NOT found.";
9162         val="$undef";
9163 fi;
9164 set $varname;
9165 eval $setvar;
9166 $rm -f try.c tryout.c'
9167
9168 : see if sys/types.h has to be included
9169 set sys/types.h i_systypes
9170 eval $inhdr
9171
9172 : see if sys/select.h has to be included
9173 set sys/select.h i_sysselct
9174 eval $inhdr
9175
9176 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9177 while $test $# -ge 2; do
9178         case "$1" in
9179         $define) echo "#include <$2>";;
9180         esac ;
9181     shift 2;
9182 done > try.c;
9183 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9184 set try;
9185 if eval $compile; then
9186         val="$define";
9187 else
9188         val="$undef";
9189 fi;
9190 set $varname;
9191 eval $setvar;
9192 $rm -f try.c try.o'
9193
9194 : see if we should include time.h, sys/time.h, or both
9195 echo " "
9196 if test "X$timeincl" = X; then
9197         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9198         $echo $n "I'm now running the test program...$c"
9199         $cat >try.c <<'EOCP'
9200 #include <sys/types.h>
9201 #ifdef I_TIME
9202 #include <time.h>
9203 #endif
9204 #ifdef I_SYSTIME
9205 #ifdef SYSTIMEKERNEL
9206 #define KERNEL
9207 #endif
9208 #include <sys/time.h>
9209 #endif
9210 #ifdef I_SYSSELECT
9211 #include <sys/select.h>
9212 #endif
9213 int main()
9214 {
9215         struct tm foo;
9216 #ifdef S_TIMEVAL
9217         struct timeval bar;
9218 #endif
9219 #ifdef S_TIMEZONE
9220         struct timezone tzp;
9221 #endif
9222         if (foo.tm_sec == foo.tm_sec)
9223                 exit(0);
9224 #ifdef S_TIMEVAL
9225         if (bar.tv_sec == bar.tv_sec)
9226                 exit(0);
9227 #endif
9228         exit(1);
9229 }
9230 EOCP
9231         flags=''
9232         for s_timezone in '-DS_TIMEZONE' ''; do
9233         sysselect=''
9234         for s_timeval in '-DS_TIMEVAL' ''; do
9235         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9236         for i_time in '' '-DI_TIME'; do
9237         for i_systime in '-DI_SYSTIME' ''; do
9238                 case "$flags" in
9239                 '') $echo $n ".$c"
9240                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9241                         if eval $compile; then
9242                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9243                                 shift
9244                                 flags="$*"
9245                                 echo " "
9246                                 $echo $n "Succeeded with $flags$c"
9247                         fi
9248                         ;;
9249                 esac
9250         done
9251         done
9252         done
9253         done
9254         done
9255         timeincl=''
9256         echo " "
9257         case "$flags" in
9258         *SYSTIMEKERNEL*) i_systimek="$define"
9259                 timeincl=`./findhdr sys/time.h`
9260                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9261         *) i_systimek="$undef";;
9262         esac
9263         case "$flags" in
9264         *I_TIME*) i_time="$define"
9265                 timeincl=`./findhdr time.h`" $timeincl"
9266                 echo "We'll include <time.h>." >&4;;
9267         *) i_time="$undef";;
9268         esac
9269         case "$flags" in
9270         *I_SYSTIME*) i_systime="$define"
9271                 timeincl=`./findhdr sys/time.h`" $timeincl"
9272                 echo "We'll include <sys/time.h>." >&4;;
9273         *) i_systime="$undef";;
9274         esac
9275         $rm -f try.c try
9276 fi
9277 : see if struct tm knows about tm_zone
9278 case "$i_systime$i_time" in
9279 *$define*) 
9280         echo " "
9281         echo "Checking to see if your struct tm has tm_zone field..." >&4
9282         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9283         eval $hasfield
9284         ;;
9285 *)      val="$undef"
9286         set d_tm_tm_zone
9287         eval $setvar
9288         ;;
9289 esac
9290 case "$d_tm_tm_zone" in
9291 "$define")      echo "Yes, it does."   ;;
9292 *)              echo "No, it doesn't." ;;
9293 esac
9294 : see if struct tm knows about tm_gmtoff
9295 case "$i_systime$i_time" in
9296 *$define*) 
9297         echo " "
9298         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9299         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9300         eval $hasfield
9301         ;;
9302 *)      val="$undef"
9303         set d_tm_tm_gmtoff
9304         eval $setvar
9305         ;;
9306 esac
9307 case "$d_tm_tm_gmtoff" in
9308 "$define")      echo "Yes, it does."   ;;
9309 *)              echo "No, it doesn't." ;;
9310 esac
9311
9312 : see if asctime_r exists
9313 set asctime_r d_asctime_r
9314 eval $inlibc
9315 case "$d_asctime_r" in
9316 "$define")
9317         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
9318         case "time" in
9319         time)
9320                 hdrs="$hdrs $i_systime sys/time.h"
9321                 ;;
9322         esac
9323         case "$d_asctime_r_proto:$usethreads" in
9324         ":define")      d_asctime_r_proto=define
9325                 set d_asctime_r_proto asctime_r $hdrs
9326                 eval $hasproto ;;
9327         *)      ;;
9328         esac
9329         case "$d_asctime_r_proto" in
9330         define)
9331         case "$asctime_r_proto" in
9332         ''|0) try='char* asctime_r(const struct tm*, char*);'
9333         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9334         esac
9335         case "$asctime_r_proto" in
9336         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9337         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9338         esac
9339         case "$asctime_r_proto" in
9340         ''|0) try='int asctime_r(const struct tm*, char*);'
9341         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9342         esac
9343         case "$asctime_r_proto" in
9344         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9345         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9346         esac
9347         case "$asctime_r_proto" in
9348         ''|0)   d_asctime_r=undef
9349                 asctime_r_proto=0
9350                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9351         * )     case "$asctime_r_proto" in
9352                 REENTRANT_PROTO*) ;;
9353                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9354                 esac
9355                 echo "Prototype: $try" ;;
9356         esac
9357         ;;
9358         *)      case "$usethreads" in
9359                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9360                 esac
9361                 d_asctime_r=undef
9362                 asctime_r_proto=0
9363                 ;;
9364         esac
9365         ;;
9366 *)      asctime_r_proto=0
9367         ;;
9368 esac
9369
9370 : see if atolf exists
9371 set atolf d_atolf
9372 eval $inlibc
9373
9374 : see if atoll exists
9375 set atoll d_atoll
9376 eval $inlibc
9377
9378 : Look for GNU-cc style attribute checking
9379 echo " "
9380 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9381 $cat >attrib.c <<'EOCP'
9382 #include <stdio.h>
9383 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9384 EOCP
9385 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9386         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9387                 echo "Your C compiler doesn't fully support __attribute__."
9388                 val="$undef"
9389         else
9390                 echo "Your C compiler supports __attribute__."
9391                 val="$define"
9392         fi
9393 else
9394         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9395         val="$undef"
9396 fi
9397 set d_attribut
9398 eval $setvar
9399 $rm -f attrib*
9400
9401 : see if bcmp exists
9402 set bcmp d_bcmp
9403 eval $inlibc
9404
9405 : see if bcopy exists
9406 set bcopy d_bcopy
9407 eval $inlibc
9408
9409 : see if this is a unistd.h system
9410 set unistd.h i_unistd
9411 eval $inhdr
9412
9413 : see if getpgrp exists
9414 set getpgrp d_getpgrp
9415 eval $inlibc
9416
9417 case "$d_getpgrp" in
9418 "$define")
9419         echo " "
9420         echo "Checking to see which flavor of getpgrp is in use..."
9421         $cat >try.c <<EOP
9422 #$i_unistd I_UNISTD
9423 #include <sys/types.h>
9424 #ifdef I_UNISTD
9425 #  include <unistd.h>
9426 #endif
9427 int main()
9428 {
9429         if (getuid() == 0) {
9430                 printf("(I see you are running Configure as super-user...)\n");
9431                 setuid(1);
9432         }
9433 #ifdef TRY_BSD_PGRP
9434         if (getpgrp(1) == 0)
9435                 exit(0);
9436 #else
9437         if (getpgrp() > 0)
9438                 exit(0);
9439 #endif
9440         exit(1);
9441 }
9442 EOP
9443         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9444                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9445                 val="$define"
9446         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9447                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9448                 val="$undef"
9449         else
9450                 echo "I can't seem to compile and run the test program."
9451                 if ./usg; then
9452                         xxx="a USG one, i.e. you use getpgrp()."
9453                 else
9454                         # SVR4 systems can appear rather BSD-ish.
9455                         case "$i_unistd" in
9456                         $undef)
9457                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9458                                 val="$define"
9459                                 ;;
9460                         $define)
9461                                 xxx="probably a USG one, i.e. you use getpgrp()."
9462                                 val="$undef"
9463                                 ;;
9464                         esac
9465                 fi
9466                 echo "Assuming your getpgrp is $xxx" >&4
9467         fi
9468         ;;
9469 *) val="$undef";;
9470 esac
9471 set d_bsdgetpgrp
9472 eval $setvar
9473 $rm -f try try.*
9474
9475 : see if setpgrp exists
9476 set setpgrp d_setpgrp
9477 eval $inlibc
9478
9479 case "$d_setpgrp" in
9480 "$define")
9481         echo " "
9482         echo "Checking to see which flavor of setpgrp is in use..."
9483         $cat >try.c <<EOP
9484 #$i_unistd I_UNISTD
9485 #include <sys/types.h>
9486 #ifdef I_UNISTD
9487 #  include <unistd.h>
9488 #endif
9489 int main()
9490 {
9491         if (getuid() == 0) {
9492                 printf("(I see you are running Configure as super-user...)\n");
9493                 setuid(1);
9494         }
9495 #ifdef TRY_BSD_PGRP
9496         if (-1 == setpgrp(1, 1))
9497                 exit(0);
9498 #else
9499         if (setpgrp() != -1)
9500                 exit(0);
9501 #endif
9502         exit(1);
9503 }
9504 EOP
9505         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9506                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9507                 val="$define"
9508         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9509                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9510                 val="$undef"
9511         else
9512                 echo "(I can't seem to compile and run the test program.)"
9513                 if ./usg; then
9514                         xxx="a USG one, i.e. you use setpgrp()."
9515                 else
9516                         # SVR4 systems can appear rather BSD-ish.
9517                         case "$i_unistd" in
9518                         $undef)
9519                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9520                                 val="$define"
9521                                 ;;
9522                         $define)
9523                                 xxx="probably a USG one, i.e. you use setpgrp()."
9524                                 val="$undef"
9525                                 ;;
9526                         esac
9527                 fi
9528                 echo "Assuming your setpgrp is $xxx" >&4
9529         fi
9530         ;;
9531 *) val="$undef";;
9532 esac
9533 set d_bsdsetpgrp
9534 eval $setvar
9535 $rm -f try try.*
9536 : see if bzero exists
9537 set bzero d_bzero
9538 eval $inlibc
9539
9540 : see if signal is declared as pointer to function returning int or void
9541 echo " "
9542 xxx=`./findhdr signal.h`
9543 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9544 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9545         echo "You have int (*signal())() instead of void." >&4
9546         val="$undef"
9547 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9548         echo "You have void (*signal())()." >&4
9549         val="$define"
9550 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9551         echo "You have int (*signal())() instead of void." >&4
9552         val="$undef"
9553 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9554         echo "You have void (*signal())()." >&4
9555         val="$define"
9556 else
9557         case "$d_voidsig" in
9558         '')
9559         echo "I can't determine whether signal handler returns void or int..." >&4
9560                 dflt=void
9561                 rp="What type does your signal handler return?"
9562                 . ./myread
9563                 case "$ans" in
9564                 v*) val="$define";;
9565                 *) val="$undef";;
9566                 esac;;
9567         "$define")
9568                 echo "As you already told me, signal handler returns void." >&4
9569                 val="$define"
9570                 ;;
9571         *)      echo "As you already told me, signal handler returns int." >&4
9572                 val="$undef"
9573                 ;;
9574         esac
9575 fi
9576 set d_voidsig
9577 eval $setvar
9578 case "$d_voidsig" in
9579 "$define") signal_t="void";;
9580 *) signal_t="int";;
9581 esac
9582 $rm -f $$.tmp
9583
9584 : check for ability to cast large floats to 32-bit ints.
9585 echo " "
9586 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9587 if $test "$intsize" -ge 4; then
9588         xxx=int
9589 else
9590         xxx=long
9591 fi
9592 $cat >try.c <<EOCP
9593 #include <stdio.h>
9594 #include <sys/types.h>
9595 #include <signal.h>
9596 $signal_t blech(s) int s; { exit(3); }
9597 int main()
9598 {
9599         $xxx i32;
9600         double f, g;
9601         int result = 0;
9602         char str[16];
9603         signal(SIGFPE, blech);
9604
9605         /* Don't let compiler optimize the test away.  Store the number 
9606            in a writable string for gcc to pass to sscanf under HP/UX.
9607         */
9608         sprintf(str, "2147483647");
9609         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9610         g = 10 * f;
9611         i32  = ($xxx) g;
9612
9613         /* x86 processors will probably give 0x8000 0000, which is a
9614        sign change.  We don't want that.  We want to mimic SPARC
9615            behavior here, which is to preserve the sign and give
9616            back 0x7fff ffff.
9617         */
9618         if (i32 != ($xxx) f)
9619                 result |= 1;
9620         exit(result);
9621 }
9622 EOCP
9623 set try
9624 if eval $compile_ok; then
9625         $run ./try
9626         yyy=$?
9627 else
9628         echo "(I can't seem to compile the test program--assuming it can't)"
9629         yyy=1
9630 fi
9631 case "$yyy" in
9632 0)      val="$define"
9633         echo "Yup, it can."
9634         ;;
9635 *)      val="$undef"
9636         echo "Nope, it can't."
9637         ;;
9638 esac
9639 set d_casti32
9640 eval $setvar
9641 $rm -f try try.*
9642
9643 : check for ability to cast negative floats to unsigned
9644 echo " "
9645 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9646 $cat >try.c <<EOCP
9647 #include <stdio.h>
9648 #include <sys/types.h>
9649 #include <signal.h>
9650 $signal_t blech(s) int s; { exit(7); }
9651 $signal_t blech_in_list(s) int s; { exit(4); }
9652 unsigned long dummy_long(p) unsigned long p; { return p; }
9653 unsigned int dummy_int(p) unsigned int p; { return p; }
9654 unsigned short dummy_short(p) unsigned short p; { return p; }
9655 int main()
9656 {
9657         double f;
9658         unsigned long along;
9659         unsigned int aint;
9660         unsigned short ashort;
9661         int result = 0;
9662         char str[16];
9663         
9664         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9665            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9666            optimized the whole file away
9667         */
9668         /* Store the number in a writable string for gcc to pass to 
9669            sscanf under HP/UX.
9670         */
9671         sprintf(str, "-123");
9672         sscanf(str, "%lf", &f);  /* f = -123.; */
9673
9674         signal(SIGFPE, blech);
9675         along = (unsigned long)f;
9676         aint = (unsigned int)f;
9677         ashort = (unsigned short)f;
9678         if (along != (unsigned long)-123)
9679                 result |= 1;
9680         if (aint != (unsigned int)-123)
9681                 result |= 1;
9682         if (ashort != (unsigned short)-123)
9683                 result |= 1;
9684         sprintf(str, "1073741824.");
9685         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9686         f = f + f;
9687         along = 0;
9688         along = (unsigned long)f;
9689         if (along != 0x80000000)
9690                 result |= 2;
9691         f -= 1.;
9692         along = 0;
9693         along = (unsigned long)f;
9694         if (along != 0x7fffffff)
9695                 result |= 1;
9696         f += 2.;
9697         along = 0;
9698         along = (unsigned long)f;
9699         if (along != 0x80000001)
9700                 result |= 2;
9701         if (result)
9702                 exit(result);
9703         signal(SIGFPE, blech_in_list);
9704         sprintf(str, "123.");
9705         sscanf(str, "%lf", &f);  /* f = 123.; */
9706         along = dummy_long((unsigned long)f);
9707         aint = dummy_int((unsigned int)f);
9708         ashort = dummy_short((unsigned short)f);
9709         if (along != (unsigned long)123)
9710                 result |= 4;
9711         if (aint != (unsigned int)123)
9712                 result |= 4;
9713         if (ashort != (unsigned short)123)
9714                 result |= 4;
9715         exit(result);
9716
9717 }
9718 EOCP
9719 set try
9720 if eval $compile_ok; then
9721         $run ./try
9722         castflags=$?
9723 else
9724         echo "(I can't seem to compile the test program--assuming it can't)"
9725         castflags=7
9726 fi
9727 case "$castflags" in
9728 0)      val="$define"
9729         echo "Yup, it can."
9730         ;;
9731 *)      val="$undef"
9732         echo "Nope, it can't."
9733         ;;
9734 esac
9735 set d_castneg
9736 eval $setvar
9737 $rm -f try.*
9738
9739 : see if vprintf exists
9740 echo " "
9741 if set vprintf val -f d_vprintf; eval $csym; $val; then
9742         echo 'vprintf() found.' >&4
9743         val="$define"
9744         $cat >try.c <<'EOF'
9745 #include <varargs.h>
9746
9747 int main() { xxx("foo"); }
9748
9749 xxx(va_alist)
9750 va_dcl
9751 {
9752         va_list args;
9753         char buf[10];
9754
9755         va_start(args);
9756         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9757 }
9758 EOF
9759         set try
9760         if eval $compile && $run ./try; then
9761                 echo "Your vsprintf() returns (int)." >&4
9762                 val2="$undef"
9763         else
9764                 echo "Your vsprintf() returns (char*)." >&4
9765                 val2="$define"
9766         fi
9767 else
9768         echo 'vprintf() NOT found.' >&4
9769                 val="$undef"
9770                 val2="$undef"
9771 fi
9772 $rm -f try try.*
9773 set d_vprintf
9774 eval $setvar
9775 val=$val2
9776 set d_charvspr
9777 eval $setvar
9778
9779 : see if chown exists
9780 set chown d_chown
9781 eval $inlibc
9782
9783 : see if chroot exists
9784 set chroot d_chroot
9785 eval $inlibc
9786
9787 : see if chsize exists
9788 set chsize d_chsize
9789 eval $inlibc
9790
9791 : see if class exists
9792 set class d_class
9793 eval $inlibc
9794
9795 hasstruct='varname=$1; struct=$2; shift; shift;
9796 while $test $# -ge 2; do
9797         case "$1" in
9798         $define) echo "#include <$2>";;
9799         esac ;
9800     shift 2;
9801 done > try.c;
9802 echo "int main () { struct $struct foo; }" >> try.c;
9803 set try;
9804 if eval $compile; then
9805         val="$define";
9806 else
9807         val="$undef";
9808 fi;
9809 set $varname;
9810 eval $setvar;
9811 $rm -f try.c try.o'
9812
9813 socketlib=''
9814 sockethdr=''
9815 : see whether socket exists
9816 echo " "
9817 $echo $n "Hmm... $c" >&4
9818 if set socket val -f d_socket; eval $csym; $val; then
9819         echo "Looks like you have Berkeley networking support." >&4
9820         d_socket="$define"
9821         if set setsockopt val -f; eval $csym; $val; then
9822                 d_oldsock="$undef"
9823         else
9824                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9825                 d_oldsock="$define"
9826         fi
9827 else
9828         if $contains socklib libc.list >/dev/null 2>&1; then
9829                 echo "Looks like you have Berkeley networking support." >&4
9830                 d_socket="$define"
9831                 : we will have to assume that it supports the 4.2 BSD interface
9832                 d_oldsock="$undef"
9833         else
9834                 echo "You don't have Berkeley networking in libc$_a..." >&4
9835                 if test "X$d_socket" = "X$define"; then
9836                    echo "...but you seem to believe that you have sockets." >&4
9837                 else
9838                         for net in net socket
9839                         do
9840                                 if test -f /usr/lib/lib$net$_a; then
9841                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9842                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9843                                         if $contains socket libc.list >/dev/null 2>&1; then
9844                                                 d_socket="$define"
9845                                                 socketlib="-l$net"
9846                                                 case "$net" in
9847                                                 net)
9848                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9849                                                         sockethdr="-I/usr/netinclude"
9850                                                         ;;
9851                                                 esac
9852                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9853                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9854                                                         d_oldsock="$undef"
9855                                                 else
9856                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9857                                                         d_oldsock="$define"
9858                                                 fi
9859                                                 break
9860                                         fi
9861                                 fi
9862                         done
9863                         if test "X$d_socket" != "X$define"; then
9864                            echo "or anywhere else I see." >&4
9865                            d_socket="$undef"
9866                            d_oldsock="$undef"
9867                         fi
9868                 fi
9869         fi
9870 fi
9871
9872 : see if socketpair exists
9873 set socketpair d_sockpair
9874 eval $inlibc
9875
9876
9877 echo " "
9878 echo "Checking the availability of certain socket constants..." >&4
9879 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9880         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9881         $cat >try.c <<EOF
9882 #include <sys/types.h>
9883 #include <sys/socket.h>
9884 int main() {
9885     int i = $ENUM;
9886 }
9887 EOF
9888         val="$undef"
9889         set try; if eval $compile; then
9890                 val="$define"
9891         fi
9892         set d_${enum}; eval $setvar
9893         $rm -f try.c try
9894 done
9895
9896 : see if this is a sys/uio.h system
9897 set sys/uio.h i_sysuio
9898 eval $inhdr
9899
9900
9901 echo " "
9902 echo "Checking to see if your system supports struct cmsghdr..." >&4
9903 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9904 eval $hasstruct
9905 case "$d_cmsghdr_s" in
9906 "$define")      echo "Yes, it does."   ;;
9907 *)              echo "No, it doesn't." ;;
9908 esac
9909
9910
9911 : check for const keyword
9912 echo " "
9913 echo 'Checking to see if your C compiler knows about "const"...' >&4
9914 $cat >const.c <<'EOCP'
9915 typedef struct spug { int drokk; } spug;
9916 int main()
9917 {
9918         const char *foo;
9919         const spug y;
9920 }
9921 EOCP
9922 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9923         val="$define"
9924         echo "Yup, it does."
9925 else
9926         val="$undef"
9927         echo "Nope, it doesn't."
9928 fi
9929 set d_const
9930 eval $setvar
9931
9932 : see if crypt exists
9933 echo " "
9934 set crypt d_crypt
9935 eval $inlibc
9936 case "$d_crypt" in
9937 $define) cryptlib='' ;;
9938 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9939                 echo 'crypt() found.' >&4
9940                 val="$define"
9941                 cryptlib=''
9942         else
9943                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9944                 if $test -z "$cryptlib"; then
9945                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9946                 else
9947                         cryptlib=-lcrypt
9948                 fi
9949                 if $test -z "$cryptlib"; then
9950                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9951                 else
9952                         cryptlib=-lcrypt
9953                 fi
9954                 if $test -z "$cryptlib"; then
9955                         cryptlib=`./loc libcrypt$_a "" $libpth`
9956                 else
9957                         cryptlib=-lcrypt
9958                 fi
9959                 if $test -z "$cryptlib"; then
9960                         echo 'crypt() NOT found.' >&4
9961                         val="$undef"
9962                 else
9963                         val="$define"
9964                 fi
9965         fi
9966         set d_crypt
9967         eval $setvar
9968         ;;
9969 esac
9970
9971 : see if this is a crypt.h system
9972 set crypt.h i_crypt
9973 eval $inhdr
9974
9975 : see if crypt_r exists
9976 set crypt_r d_crypt_r
9977 eval $inlibc
9978 case "$d_crypt_r" in
9979 "$define")
9980         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9981         case "crypt" in
9982         time)
9983                 hdrs="$hdrs $i_systime sys/time.h"
9984                 ;;
9985         esac
9986         case "$d_crypt_r_proto:$usethreads" in
9987         ":define")      d_crypt_r_proto=define
9988                 set d_crypt_r_proto crypt_r $hdrs
9989                 eval $hasproto ;;
9990         *)      ;;
9991         esac
9992         case "$d_crypt_r_proto" in
9993         define)
9994         case "$crypt_r_proto" in
9995         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9996         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9997         esac
9998         case "$crypt_r_proto" in
9999         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10000         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10001         esac
10002         case "$crypt_r_proto" in
10003         ''|0)   d_crypt_r=undef
10004                 crypt_r_proto=0
10005                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10006         * )     case "$crypt_r_proto" in
10007                 REENTRANT_PROTO*) ;;
10008                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10009                 esac
10010                 echo "Prototype: $try" ;;
10011         esac
10012         ;;
10013         *)      case "$usethreads" in
10014                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10015                 esac
10016                 d_crypt_r=undef
10017                 crypt_r_proto=0
10018                 ;;
10019         esac
10020         ;;
10021 *)      crypt_r_proto=0
10022         ;;
10023 esac
10024
10025 : get csh whereabouts
10026 case "$csh" in
10027 'csh') val="$undef" ;;
10028 *) val="$define" ;;
10029 esac
10030 set d_csh
10031 eval $setvar
10032 : Respect a hint or command line value for full_csh.
10033 case "$full_csh" in
10034 '') full_csh=$csh ;;
10035 esac
10036
10037 : see if ctermid_r exists
10038 set ctermid_r d_ctermid_r
10039 eval $inlibc
10040 case "$d_ctermid_r" in
10041 "$define")
10042         hdrs="$i_systypes sys/types.h define stdio.h "
10043         case "stdio" in
10044         time)
10045                 hdrs="$hdrs $i_systime sys/time.h"
10046                 ;;
10047         esac
10048         case "$d_ctermid_r_proto:$usethreads" in
10049         ":define")      d_ctermid_r_proto=define
10050                 set d_ctermid_r_proto ctermid_r $hdrs
10051                 eval $hasproto ;;
10052         *)      ;;
10053         esac
10054         case "$d_ctermid_r_proto" in
10055         define)
10056         case "$ctermid_r_proto" in
10057         ''|0) try='char* ctermid_r(char*);'
10058         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10059         esac
10060         case "$ctermid_r_proto" in
10061         ''|0)   d_ctermid_r=undef
10062                 ctermid_r_proto=0
10063                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10064         * )     case "$ctermid_r_proto" in
10065                 REENTRANT_PROTO*) ;;
10066                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10067                 esac
10068                 echo "Prototype: $try" ;;
10069         esac
10070         ;;
10071         *)      case "$usethreads" in
10072                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10073                 esac
10074                 d_ctermid_r=undef
10075                 ctermid_r_proto=0
10076                 ;;
10077         esac
10078         ;;
10079 *)      ctermid_r_proto=0
10080         ;;
10081 esac
10082
10083 : see if ctime_r exists
10084 set ctime_r d_ctime_r
10085 eval $inlibc
10086 case "$d_ctime_r" in
10087 "$define")
10088         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
10089         case "time" in
10090         time)
10091                 hdrs="$hdrs $i_systime sys/time.h"
10092                 ;;
10093         esac
10094         case "$d_ctime_r_proto:$usethreads" in
10095         ":define")      d_ctime_r_proto=define
10096                 set d_ctime_r_proto ctime_r $hdrs
10097                 eval $hasproto ;;
10098         *)      ;;
10099         esac
10100         case "$d_ctime_r_proto" in
10101         define)
10102         case "$ctime_r_proto" in
10103         ''|0) try='char* ctime_r(const time_t*, char*);'
10104         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10105         esac
10106         case "$ctime_r_proto" in
10107         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10108         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10109         esac
10110         case "$ctime_r_proto" in
10111         ''|0) try='int ctime_r(const time_t*, char*);'
10112         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10113         esac
10114         case "$ctime_r_proto" in
10115         ''|0) try='int ctime_r(const time_t*, char*, int);'
10116         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10117         esac
10118         case "$ctime_r_proto" in
10119         ''|0)   d_ctime_r=undef
10120                 ctime_r_proto=0
10121                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10122         * )     case "$ctime_r_proto" in
10123                 REENTRANT_PROTO*) ;;
10124                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10125                 esac
10126                 echo "Prototype: $try" ;;
10127         esac
10128         ;;
10129         *)      case "$usethreads" in
10130                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10131                 esac
10132                 d_ctime_r=undef
10133                 ctime_r_proto=0
10134                 ;;
10135         esac
10136         ;;
10137 *)      ctime_r_proto=0
10138         ;;
10139 esac
10140
10141 : see if cuserid exists
10142 set cuserid d_cuserid
10143 eval $inlibc
10144
10145 : see if this is a limits.h system
10146 set limits.h i_limits
10147 eval $inhdr
10148
10149 : see if this is a float.h system
10150 set float.h i_float
10151 eval $inhdr
10152
10153 : See if number of significant digits in a double precision number is known
10154 echo " "
10155 $cat >dbl_dig.c <<EOM
10156 #$i_limits I_LIMITS
10157 #$i_float I_FLOAT
10158 #ifdef I_LIMITS
10159 #include <limits.h>
10160 #endif
10161 #ifdef I_FLOAT
10162 #include <float.h>
10163 #endif
10164 #ifdef DBL_DIG
10165 printf("Contains DBL_DIG");
10166 #endif
10167 EOM
10168 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10169 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10170         echo "DBL_DIG found." >&4
10171         val="$define"
10172 else
10173         echo "DBL_DIG NOT found." >&4
10174         val="$undef"
10175 fi
10176 $rm -f dbl_dig.?
10177 set d_dbl_dig
10178 eval $setvar
10179
10180 : see if dbm.h is available
10181 : see if dbmclose exists
10182 set dbmclose d_dbmclose
10183 eval $inlibc
10184
10185 case "$d_dbmclose" in
10186 $define)
10187         set dbm.h i_dbm
10188         eval $inhdr
10189         case "$i_dbm" in
10190         $define)
10191                 val="$undef"
10192                 set i_rpcsvcdbm
10193                 eval $setvar
10194                 ;;
10195         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10196                 eval $inhdr
10197                 ;;
10198         esac
10199         ;;
10200 *)      echo "We won't be including <dbm.h>"
10201         val="$undef"
10202         set i_dbm
10203         eval $setvar
10204         val="$undef"
10205         set i_rpcsvcdbm
10206         eval $setvar
10207         ;;
10208 esac
10209
10210 : see if prototype for dbminit is available
10211 echo " "
10212 set d_dbminitproto dbminit $i_dbm dbm.h
10213 eval $hasproto
10214
10215 : see if difftime exists
10216 set difftime d_difftime
10217 eval $inlibc
10218
10219 : see if this is a dirent system
10220 echo " "
10221 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10222         val="$define"
10223         echo "<dirent.h> found." >&4
10224 else
10225         val="$undef"
10226         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10227                 echo "<sys/dir.h> found." >&4
10228                 echo " "
10229         else
10230                 xinc=`./findhdr sys/ndir.h`
10231         fi
10232         echo "<dirent.h> NOT found." >&4
10233 fi
10234 set i_dirent
10235 eval $setvar
10236
10237 : Look for type of directory structure.
10238 echo " "
10239 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10240
10241 case "$direntrytype" in
10242 ''|' ')
10243         case "$i_dirent" in
10244         $define) guess1='struct dirent' ;;
10245         *) guess1='struct direct'  ;;
10246         esac
10247         ;;
10248 *)      guess1="$direntrytype"
10249         ;;
10250 esac
10251
10252 case "$guess1" in
10253 'struct dirent') guess2='struct direct' ;;
10254 *) guess2='struct dirent' ;;
10255 esac
10256                 
10257 if $contains "$guess1" try.c >/dev/null 2>&1; then
10258         direntrytype="$guess1"
10259         echo "Your directory entries are $direntrytype." >&4
10260 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10261         direntrytype="$guess2"
10262         echo "Your directory entries seem to be $direntrytype." >&4
10263 else
10264         echo "I don't recognize your system's directory entries." >&4
10265         rp="What type is used for directory entries on this system?"
10266         dflt="$guess1"
10267         . ./myread
10268         direntrytype="$ans"
10269 fi
10270 $rm -f try.c
10271
10272
10273 : see if the directory entry stores field length
10274 echo " "
10275 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10276 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10277         echo "Good, your directory entry keeps length information in d_namlen." >&4
10278         val="$define"
10279 else
10280         echo "Your directory entry does not know about the d_namlen field." >&4
10281         val="$undef"
10282 fi
10283 set d_dirnamlen
10284 eval $setvar
10285 $rm -f try.c
10286
10287 : see if this is an sysdir system
10288 set sys/dir.h i_sysdir
10289 eval $inhdr
10290
10291 : see if this is an sysndir system
10292 set sys/ndir.h i_sysndir
10293 eval $inhdr
10294
10295 : Look for dirfd
10296 echo " "
10297 $cat >dirfd.c <<EOM
10298 #include <stdio.h>
10299 #$i_dirent I_DIRENT             /**/
10300 #$i_sysdir I_SYS_DIR            /**/
10301 #$i_sysndir I_SYS_NDIR          /**/
10302 #$i_systypes I_SYS_TYPES        /**/
10303 #if defined(I_SYS_TYPES)
10304 #include <sys/types.h>
10305 #endif
10306 #if defined(I_DIRENT)
10307 #include <dirent.h>
10308 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10309 #include <sys/dir.h>
10310 #endif
10311 #else
10312 #ifdef I_SYS_NDIR
10313 #include <sys/ndir.h>
10314 #else
10315 #ifdef I_SYS_DIR
10316 #ifdef hp9000s500
10317 #include <ndir.h>       /* may be wrong in the future */
10318 #else
10319 #include <sys/dir.h>
10320 #endif
10321 #endif
10322 #endif
10323 #endif 
10324 int main() {
10325         DIR *dirp = opendir(".");
10326         if (dirfd(dirp) >= 0)
10327                 exit(0);
10328         else
10329                 exit(1);
10330 }
10331 EOM
10332 set dirfd
10333 if eval $compile; then
10334         val="$define"
10335 fi
10336 case "$val" in
10337 $define)        echo "dirfd() found." >&4       ;;
10338 *)              echo "dirfd() NOT found." >&4   ;;
10339 esac
10340 set d_dirfd
10341 eval $setvar
10342 $rm -f dirfd*
10343
10344 : see if dlerror exists
10345 xxx_runnm="$runnm"
10346 runnm=false
10347 set dlerror d_dlerror
10348 eval $inlibc
10349 runnm="$xxx_runnm"
10350
10351 : see if dlfcn is available
10352 set dlfcn.h i_dlfcn
10353 eval $inhdr
10354
10355 case "$usedl" in
10356 $define|y|true)
10357         $cat << EOM
10358
10359 On a few systems, the dynamically loaded modules that perl generates and uses
10360 will need a different extension than shared libs. The default will probably
10361 be appropriate.
10362
10363 EOM
10364         case "$dlext" in
10365         '')     dflt="$so" ;;
10366         *)      dflt="$dlext" ;;
10367         esac
10368         rp='What is the extension of dynamically loaded modules'
10369         . ./myread
10370         dlext="$ans"
10371         ;;
10372 *)
10373         dlext="none"
10374         ;;
10375 esac
10376
10377 : Check if dlsym need a leading underscore
10378 echo " "
10379 val="$undef"
10380
10381 case "$dlsrc" in
10382 dl_dlopen.xs)
10383         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10384         $cat >dyna.c <<'EOM'
10385 fred () { }
10386 EOM
10387
10388 $cat >fred.c<<EOM
10389
10390 #include <stdio.h>
10391 #$i_dlfcn I_DLFCN
10392 #ifdef I_DLFCN
10393 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10394 #else
10395 #include <sys/types.h>
10396 #include <nlist.h>
10397 #include <link.h>
10398 #endif
10399
10400 extern int fred() ;
10401
10402 int main()
10403 {
10404     void * handle ;
10405     void * symbol ;
10406 #ifndef RTLD_LAZY
10407     int mode = 1 ;
10408 #else
10409     int mode = RTLD_LAZY ;
10410 #endif
10411     handle = dlopen("./dyna.$dlext", mode) ;
10412     if (handle == NULL) {
10413         printf ("1\n") ;
10414         fflush (stdout) ;
10415         exit(0);
10416     }
10417     symbol = dlsym(handle, "fred") ;
10418     if (symbol == NULL) {
10419         /* try putting a leading underscore */
10420         symbol = dlsym(handle, "_fred") ;
10421         if (symbol == NULL) {
10422             printf ("2\n") ;
10423             fflush (stdout) ;
10424             exit(0);
10425         }
10426         printf ("3\n") ;
10427     }
10428     else
10429         printf ("4\n") ;
10430     fflush (stdout) ;
10431     exit(0);
10432 }
10433 EOM
10434         : Call the object file tmp-dyna.o in case dlext=o.
10435         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10436                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10437                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10438                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10439                 xxx=`$run ./fred`
10440                 case $xxx in
10441                 1)      echo "Test program failed using dlopen." >&4
10442                         echo "Perhaps you should not use dynamic loading." >&4;;
10443                 2)      echo "Test program failed using dlsym." >&4
10444                         echo "Perhaps you should not use dynamic loading." >&4;;
10445                 3)      echo "dlsym needs a leading underscore" >&4
10446                         val="$define" ;;
10447                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10448                 esac
10449         else
10450                 echo "I can't compile and run the test program." >&4
10451                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10452         fi
10453         ;;
10454 esac
10455                 
10456 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10457
10458 set d_dlsymun
10459 eval $setvar
10460
10461 : see if drand48_r exists
10462 set drand48_r d_drand48_r
10463 eval $inlibc
10464 case "$d_drand48_r" in
10465 "$define")
10466         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10467         case "stdlib" in
10468         time)
10469                 hdrs="$hdrs $i_systime sys/time.h"
10470                 ;;
10471         esac
10472         case "$d_drand48_r_proto:$usethreads" in
10473         ":define")      d_drand48_r_proto=define
10474                 set d_drand48_r_proto drand48_r $hdrs
10475                 eval $hasproto ;;
10476         *)      ;;
10477         esac
10478         case "$d_drand48_r_proto" in
10479         define)
10480         case "$drand48_r_proto" in
10481         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10482         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10483         esac
10484         case "$drand48_r_proto" in
10485         ''|0)   d_drand48_r=undef
10486                 drand48_r_proto=0
10487                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10488         * )     case "$drand48_r_proto" in
10489                 REENTRANT_PROTO*) ;;
10490                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10491                 esac
10492                 echo "Prototype: $try" ;;
10493         esac
10494         ;;
10495         *)      case "$usethreads" in
10496                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10497                 esac
10498                 d_drand48_r=undef
10499                 drand48_r_proto=0
10500                 ;;
10501         esac
10502         ;;
10503 *)      drand48_r_proto=0
10504         ;;
10505 esac
10506
10507 : see if prototype for drand48 is available
10508 echo " "
10509 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10510 eval $hasproto
10511
10512 : see if dup2 exists
10513 set dup2 d_dup2
10514 eval $inlibc
10515
10516 : see if eaccess exists
10517 set eaccess d_eaccess
10518 eval $inlibc
10519
10520 : see if endgrent exists
10521 set endgrent d_endgrent
10522 eval $inlibc
10523
10524 : see if this is an grp system
10525 set grp.h i_grp
10526 eval $inhdr
10527
10528 case "$i_grp" in
10529 $define)
10530         xxx=`./findhdr grp.h`
10531         $cppstdin $cppflags $cppminus < $xxx >$$.h
10532
10533         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10534                 val="$define"
10535         else
10536                 val="$undef"
10537         fi
10538         set d_grpasswd
10539         eval $setvar
10540
10541         $rm -f $$.h
10542         ;;
10543 *)
10544         val="$undef";
10545         set d_grpasswd; eval $setvar
10546         ;;
10547 esac
10548
10549 : see if endgrent_r exists
10550 set endgrent_r d_endgrent_r
10551 eval $inlibc
10552 case "$d_endgrent_r" in
10553 "$define")
10554         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10555         case "grp" in
10556         time)
10557                 hdrs="$hdrs $i_systime sys/time.h"
10558                 ;;
10559         esac
10560         case "$d_endgrent_r_proto:$usethreads" in
10561         ":define")      d_endgrent_r_proto=define
10562                 set d_endgrent_r_proto endgrent_r $hdrs
10563                 eval $hasproto ;;
10564         *)      ;;
10565         esac
10566         case "$d_endgrent_r_proto" in
10567         define)
10568         case "$endgrent_r_proto" in
10569         ''|0) try='int endgrent_r(FILE**);'
10570         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10571         esac
10572         case "$endgrent_r_proto" in
10573         ''|0) try='void endgrent_r(FILE**);'
10574         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10575         esac
10576         case "$endgrent_r_proto" in
10577         ''|0)   d_endgrent_r=undef
10578                 endgrent_r_proto=0
10579                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10580         * )     case "$endgrent_r_proto" in
10581                 REENTRANT_PROTO*) ;;
10582                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10583                 esac
10584                 echo "Prototype: $try" ;;
10585         esac
10586         ;;
10587         *)      case "$usethreads" in
10588                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10589                 esac
10590                 d_endgrent_r=undef
10591                 endgrent_r_proto=0
10592                 ;;
10593         esac
10594         ;;
10595 *)      endgrent_r_proto=0
10596         ;;
10597 esac
10598
10599 : see if endhostent exists
10600 set endhostent d_endhent
10601 eval $inlibc
10602
10603 : see if this is a netdb.h system
10604 set netdb.h i_netdb
10605 eval $inhdr
10606
10607 : see if endhostent_r exists
10608 set endhostent_r d_endhostent_r
10609 eval $inlibc
10610 case "$d_endhostent_r" in
10611 "$define")
10612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10613         case "netdb" in
10614         time)
10615                 hdrs="$hdrs $i_systime sys/time.h"
10616                 ;;
10617         esac
10618         case "$d_endhostent_r_proto:$usethreads" in
10619         ":define")      d_endhostent_r_proto=define
10620                 set d_endhostent_r_proto endhostent_r $hdrs
10621                 eval $hasproto ;;
10622         *)      ;;
10623         esac
10624         case "$d_endhostent_r_proto" in
10625         define)
10626         case "$endhostent_r_proto" in
10627         ''|0) try='int endhostent_r(struct hostent_data*);'
10628         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10629         esac
10630         case "$endhostent_r_proto" in
10631         ''|0) try='void endhostent_r(struct hostent_data*);'
10632         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10633         esac
10634         case "$endhostent_r_proto" in
10635         ''|0)   d_endhostent_r=undef
10636                 endhostent_r_proto=0
10637                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10638         * )     case "$endhostent_r_proto" in
10639                 REENTRANT_PROTO*) ;;
10640                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10641                 esac
10642                 echo "Prototype: $try" ;;
10643         esac
10644         ;;
10645         *)      case "$usethreads" in
10646                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10647                 esac
10648                 d_endhostent_r=undef
10649                 endhostent_r_proto=0
10650                 ;;
10651         esac
10652         ;;
10653 *)      endhostent_r_proto=0
10654         ;;
10655 esac
10656
10657 : see if endnetent exists
10658 set endnetent d_endnent
10659 eval $inlibc
10660
10661 : see if endnetent_r exists
10662 set endnetent_r d_endnetent_r
10663 eval $inlibc
10664 case "$d_endnetent_r" in
10665 "$define")
10666         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10667         case "netdb" in
10668         time)
10669                 hdrs="$hdrs $i_systime sys/time.h"
10670                 ;;
10671         esac
10672         case "$d_endnetent_r_proto:$usethreads" in
10673         ":define")      d_endnetent_r_proto=define
10674                 set d_endnetent_r_proto endnetent_r $hdrs
10675                 eval $hasproto ;;
10676         *)      ;;
10677         esac
10678         case "$d_endnetent_r_proto" in
10679         define)
10680         case "$endnetent_r_proto" in
10681         ''|0) try='int endnetent_r(struct netent_data*);'
10682         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10683         esac
10684         case "$endnetent_r_proto" in
10685         ''|0) try='void endnetent_r(struct netent_data*);'
10686         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10687         esac
10688         case "$endnetent_r_proto" in
10689         ''|0)   d_endnetent_r=undef
10690                 endnetent_r_proto=0
10691                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10692         * )     case "$endnetent_r_proto" in
10693                 REENTRANT_PROTO*) ;;
10694                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10695                 esac
10696                 echo "Prototype: $try" ;;
10697         esac
10698         ;;
10699         *)      case "$usethreads" in
10700                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10701                 esac
10702                 d_endnetent_r=undef
10703                 endnetent_r_proto=0
10704                 ;;
10705         esac
10706         ;;
10707 *)      endnetent_r_proto=0
10708         ;;
10709 esac
10710
10711 : see if endprotoent exists
10712 set endprotoent d_endpent
10713 eval $inlibc
10714
10715 : see if endprotoent_r exists
10716 set endprotoent_r d_endprotoent_r
10717 eval $inlibc
10718 case "$d_endprotoent_r" in
10719 "$define")
10720         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10721         case "netdb" in
10722         time)
10723                 hdrs="$hdrs $i_systime sys/time.h"
10724                 ;;
10725         esac
10726         case "$d_endprotoent_r_proto:$usethreads" in
10727         ":define")      d_endprotoent_r_proto=define
10728                 set d_endprotoent_r_proto endprotoent_r $hdrs
10729                 eval $hasproto ;;
10730         *)      ;;
10731         esac
10732         case "$d_endprotoent_r_proto" in
10733         define)
10734         case "$endprotoent_r_proto" in
10735         ''|0) try='int endprotoent_r(struct protoent_data*);'
10736         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10737         esac
10738         case "$endprotoent_r_proto" in
10739         ''|0) try='void endprotoent_r(struct protoent_data*);'
10740         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10741         esac
10742         case "$endprotoent_r_proto" in
10743         ''|0)   d_endprotoent_r=undef
10744                 endprotoent_r_proto=0
10745                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10746         * )     case "$endprotoent_r_proto" in
10747                 REENTRANT_PROTO*) ;;
10748                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10749                 esac
10750                 echo "Prototype: $try" ;;
10751         esac
10752         ;;
10753         *)      case "$usethreads" in
10754                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10755                 esac
10756                 d_endprotoent_r=undef
10757                 endprotoent_r_proto=0
10758                 ;;
10759         esac
10760         ;;
10761 *)      endprotoent_r_proto=0
10762         ;;
10763 esac
10764
10765 : see if endpwent exists
10766 set endpwent d_endpwent
10767 eval $inlibc
10768
10769 : see if this is a pwd.h system
10770 set pwd.h i_pwd
10771 eval $inhdr
10772
10773 case "$i_pwd" in
10774 $define)
10775         xxx=`./findhdr pwd.h`
10776         $cppstdin $cppflags $cppminus < $xxx >$$.h
10777
10778         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10779                 val="$define"
10780         else
10781                 val="$undef"
10782         fi
10783         set d_pwquota
10784         eval $setvar
10785
10786         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10787                 val="$define"
10788         else
10789                 val="$undef"
10790         fi
10791         set d_pwage
10792         eval $setvar
10793
10794         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10795                 val="$define"
10796         else
10797                 val="$undef"
10798         fi
10799         set d_pwchange
10800         eval $setvar
10801
10802         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10803                 val="$define"
10804         else
10805                 val="$undef"
10806         fi
10807         set d_pwclass
10808         eval $setvar
10809
10810         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10811                 val="$define"
10812         else
10813                 val="$undef"
10814         fi
10815         set d_pwexpire
10816         eval $setvar
10817
10818         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10819                 val="$define"
10820         else
10821                 val="$undef"
10822         fi
10823         set d_pwcomment
10824         eval $setvar
10825
10826         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10827                 val="$define"
10828         else
10829                 val="$undef"
10830         fi
10831         set d_pwgecos
10832         eval $setvar
10833
10834         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10835                 val="$define"
10836         else
10837                 val="$undef"
10838         fi
10839         set d_pwpasswd
10840         eval $setvar
10841
10842         $rm -f $$.h
10843         ;;
10844 *)
10845         val="$undef"; 
10846         set d_pwquota; eval $setvar
10847         set d_pwage; eval $setvar
10848         set d_pwchange; eval $setvar
10849         set d_pwclass; eval $setvar
10850         set d_pwexpire; eval $setvar
10851         set d_pwcomment; eval $setvar
10852         set d_pwgecos; eval $setvar
10853         set d_pwpasswd; eval $setvar
10854         ;;
10855 esac
10856
10857 : see if endpwent_r exists
10858 set endpwent_r d_endpwent_r
10859 eval $inlibc
10860 case "$d_endpwent_r" in
10861 "$define")
10862         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10863         case "pwd" in
10864         time)
10865                 hdrs="$hdrs $i_systime sys/time.h"
10866                 ;;
10867         esac
10868         case "$d_endpwent_r_proto:$usethreads" in
10869         ":define")      d_endpwent_r_proto=define
10870                 set d_endpwent_r_proto endpwent_r $hdrs
10871                 eval $hasproto ;;
10872         *)      ;;
10873         esac
10874         case "$d_endpwent_r_proto" in
10875         define)
10876         case "$endpwent_r_proto" in
10877         ''|0) try='int endpwent_r(FILE**);'
10878         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10879         esac
10880         case "$endpwent_r_proto" in
10881         ''|0) try='void endpwent_r(FILE**);'
10882         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10883         esac
10884         case "$endpwent_r_proto" in
10885         ''|0)   d_endpwent_r=undef
10886                 endpwent_r_proto=0
10887                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10888         * )     case "$endpwent_r_proto" in
10889                 REENTRANT_PROTO*) ;;
10890                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10891                 esac
10892                 echo "Prototype: $try" ;;
10893         esac
10894         ;;
10895         *)      case "$usethreads" in
10896                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10897                 esac
10898                 d_endpwent_r=undef
10899                 endpwent_r_proto=0
10900                 ;;
10901         esac
10902         ;;
10903 *)      endpwent_r_proto=0
10904         ;;
10905 esac
10906
10907 : see if endservent exists
10908 set endservent d_endsent
10909 eval $inlibc
10910
10911 : see if endservent_r exists
10912 set endservent_r d_endservent_r
10913 eval $inlibc
10914 case "$d_endservent_r" in
10915 "$define")
10916         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10917         case "netdb" in
10918         time)
10919                 hdrs="$hdrs $i_systime sys/time.h"
10920                 ;;
10921         esac
10922         case "$d_endservent_r_proto:$usethreads" in
10923         ":define")      d_endservent_r_proto=define
10924                 set d_endservent_r_proto endservent_r $hdrs
10925                 eval $hasproto ;;
10926         *)      ;;
10927         esac
10928         case "$d_endservent_r_proto" in
10929         define)
10930         case "$endservent_r_proto" in
10931         ''|0) try='int endservent_r(struct servent_data*);'
10932         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10933         esac
10934         case "$endservent_r_proto" in
10935         ''|0) try='void endservent_r(struct servent_data*);'
10936         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10937         esac
10938         case "$endservent_r_proto" in
10939         ''|0)   d_endservent_r=undef
10940                 endservent_r_proto=0
10941                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10942         * )     case "$endservent_r_proto" in
10943                 REENTRANT_PROTO*) ;;
10944                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10945                 esac
10946                 echo "Prototype: $try" ;;
10947         esac
10948         ;;
10949         *)      case "$usethreads" in
10950                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10951                 esac
10952                 d_endservent_r=undef
10953                 endservent_r_proto=0
10954                 ;;
10955         esac
10956         ;;
10957 *)      endservent_r_proto=0
10958         ;;
10959 esac
10960
10961 : Locate the flags for 'open()'
10962 echo " "
10963 $cat >try.c <<'EOCP'
10964 #include <sys/types.h>
10965 #ifdef I_FCNTL
10966 #include <fcntl.h>
10967 #endif
10968 #ifdef I_SYS_FILE
10969 #include <sys/file.h>
10970 #endif
10971 int main() {
10972         if(O_RDONLY);
10973 #ifdef O_TRUNC
10974         exit(0);
10975 #else
10976         exit(1);
10977 #endif
10978 }
10979 EOCP
10980 : check sys/file.h first to get FREAD on Sun
10981 if $test `./findhdr sys/file.h` && \
10982                 set try -DI_SYS_FILE && eval $compile; then
10983         h_sysfile=true;
10984         echo "<sys/file.h> defines the O_* constants..." >&4
10985         if $run ./try; then
10986                 echo "and you have the 3 argument form of open()." >&4
10987                 val="$define"
10988         else
10989                 echo "but not the 3 argument form of open().  Oh, well." >&4
10990                 val="$undef"
10991         fi
10992 elif $test `./findhdr fcntl.h` && \
10993                 set try -DI_FCNTL && eval $compile; then
10994         h_fcntl=true;
10995         echo "<fcntl.h> defines the O_* constants..." >&4
10996         if $run ./try; then
10997                 echo "and you have the 3 argument form of open()." >&4
10998                 val="$define"
10999         else
11000                 echo "but not the 3 argument form of open().  Oh, well." >&4
11001                 val="$undef"
11002         fi
11003 else
11004         val="$undef"
11005         echo "I can't find the O_* constant definitions!  You got problems." >&4
11006 fi
11007 set d_open3
11008 eval $setvar
11009 $rm -f try try.*
11010
11011 : see which of string.h or strings.h is needed
11012 echo " "
11013 strings=`./findhdr string.h`
11014 if $test "$strings" && $test -r "$strings"; then
11015         echo "Using <string.h> instead of <strings.h>." >&4
11016         val="$define"
11017 else
11018         val="$undef"
11019         strings=`./findhdr strings.h`
11020         if $test "$strings" && $test -r "$strings"; then
11021                 echo "Using <strings.h> instead of <string.h>." >&4
11022         else
11023                 echo "No string header found -- You'll surely have problems." >&4
11024         fi
11025 fi
11026 set i_string
11027 eval $setvar
11028 case "$i_string" in
11029 "$undef") strings=`./findhdr strings.h`;;
11030 *)        strings=`./findhdr string.h`;;
11031 esac
11032
11033 : see if this is a sys/file.h system
11034 val=''
11035 set sys/file.h val
11036 eval $inhdr
11037
11038 : do we need to include sys/file.h ?
11039 case "$val" in
11040 "$define")
11041         echo " "
11042         if $h_sysfile; then
11043                 val="$define"
11044                 echo "We'll be including <sys/file.h>." >&4
11045         else
11046                 val="$undef"
11047                 echo "We won't be including <sys/file.h>." >&4
11048         fi
11049         ;;
11050 *)
11051         h_sysfile=false
11052         ;;
11053 esac
11054 set i_sysfile
11055 eval $setvar
11056
11057 : see if fcntl.h is there
11058 val=''
11059 set fcntl.h val
11060 eval $inhdr
11061
11062 : see if we can include fcntl.h
11063 case "$val" in
11064 "$define")
11065         echo " "
11066         if $h_fcntl; then
11067                 val="$define"
11068                 echo "We'll be including <fcntl.h>." >&4
11069         else
11070                 val="$undef"
11071                 if $h_sysfile; then
11072         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11073                 else
11074                         echo "We won't be including <fcntl.h>." >&4
11075                 fi
11076         fi
11077         ;;
11078 *)
11079         h_fcntl=false
11080         val="$undef"
11081         ;;
11082 esac
11083 set i_fcntl
11084 eval $setvar
11085
11086 : check for non-blocking I/O stuff
11087 case "$h_sysfile" in
11088 true) echo "#include <sys/file.h>" > head.c;;
11089 *)
11090        case "$h_fcntl" in
11091        true) echo "#include <fcntl.h>" > head.c;;
11092        *) echo "#include <sys/fcntl.h>" > head.c;;
11093        esac
11094        ;;
11095 esac
11096 echo " "
11097 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11098 case "$o_nonblock" in
11099 '')
11100         $cat head.c > try.c
11101         $cat >>try.c <<EOCP
11102 #include <stdio.h>
11103 #include <stdlib.h>
11104 #$i_fcntl I_FCNTL
11105 #ifdef I_FCNTL
11106 #include <fcntl.h>
11107 #endif
11108 int main() {
11109 #ifdef O_NONBLOCK
11110         printf("O_NONBLOCK\n");
11111         exit(0);
11112 #endif
11113 #ifdef O_NDELAY
11114         printf("O_NDELAY\n");
11115         exit(0);
11116 #endif
11117 #ifdef FNDELAY
11118         printf("FNDELAY\n");
11119         exit(0);
11120 #endif
11121         exit(0);
11122 }
11123 EOCP
11124         set try
11125         if eval $compile_ok; then
11126                 o_nonblock=`$run ./try`
11127                 case "$o_nonblock" in
11128                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11129                 *) echo "Seems like we can use $o_nonblock.";;
11130                 esac
11131         else
11132                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11133         fi
11134         ;;
11135 *) echo "Using $hint value $o_nonblock.";;
11136 esac
11137 $rm -f try try.* .out core
11138
11139 echo " "
11140 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11141 case "$eagain" in
11142 '')
11143         $cat head.c > try.c
11144         $cat >>try.c <<EOCP
11145 #include <errno.h>
11146 #include <sys/types.h>
11147 #include <signal.h>
11148 #include <stdio.h> 
11149 #include <stdlib.h> 
11150 #$i_fcntl I_FCNTL
11151 #ifdef I_FCNTL
11152 #include <fcntl.h>
11153 #endif
11154 #define MY_O_NONBLOCK $o_nonblock
11155 #ifndef errno  /* XXX need better Configure test */
11156 extern int errno;
11157 #endif
11158 #$i_unistd I_UNISTD
11159 #ifdef I_UNISTD
11160 #include <unistd.h>
11161 #endif
11162 #$i_string I_STRING
11163 #ifdef I_STRING
11164 #include <string.h>
11165 #else
11166 #include <strings.h>
11167 #endif
11168 $signal_t blech(x) int x; { exit(3); }
11169 EOCP
11170         $cat >> try.c <<'EOCP'
11171 int main()
11172 {
11173         int pd[2];
11174         int pu[2];
11175         char buf[1];
11176         char string[100];
11177
11178         pipe(pd);       /* Down: child -> parent */
11179         pipe(pu);       /* Up: parent -> child */
11180         if (0 != fork()) {
11181                 int ret;
11182                 close(pd[1]);   /* Parent reads from pd[0] */
11183                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11184 #ifdef F_SETFL
11185                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11186                         exit(1);
11187 #else
11188                 exit(4);
11189 #endif
11190                 signal(SIGALRM, blech);
11191                 alarm(5);
11192                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11193                         exit(2);
11194                 sprintf(string, "%d\n", ret);
11195                 write(2, string, strlen(string));
11196                 alarm(0);
11197 #ifdef EAGAIN
11198                 if (errno == EAGAIN) {
11199                         printf("EAGAIN\n");
11200                         goto ok;
11201                 }
11202 #endif
11203 #ifdef EWOULDBLOCK
11204                 if (errno == EWOULDBLOCK)
11205                         printf("EWOULDBLOCK\n");
11206 #endif
11207         ok:
11208                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11209                 sleep(2);                               /* Give it time to close our pipe */
11210                 alarm(5);
11211                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11212                 alarm(0);
11213                 sprintf(string, "%d\n", ret);
11214                 write(4, string, strlen(string));
11215                 exit(0);
11216         }
11217
11218         close(pd[0]);                   /* We write to pd[1] */
11219         close(pu[1]);                   /* We read from pu[0] */
11220         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11221         close(pd[1]);                   /* Pipe pd is now fully closed! */
11222         exit(0);                                /* Bye bye, thank you for playing! */
11223 }
11224 EOCP
11225         set try
11226         if eval $compile_ok; then
11227                 echo "$startsh" >mtry
11228                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11229                 chmod +x mtry
11230                 ./mtry >/dev/null 2>&1
11231                 case $? in
11232                 0) eagain=`$cat try.out`;;
11233                 1) echo "Could not perform non-blocking setting!";;
11234                 2) echo "I did a successful read() for something that was not there!";;
11235                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11236                 4) echo "Could not find F_SETFL!";;
11237                 *) echo "Something terribly wrong happened during testing.";;
11238                 esac
11239                 rd_nodata=`$cat try.ret`
11240                 echo "A read() system call with no data present returns $rd_nodata."
11241                 case "$rd_nodata" in
11242                 0|-1) ;;
11243                 *)
11244                         echo "(That's peculiar, fixing that to be -1.)"
11245                         rd_nodata=-1
11246                         ;;
11247                 esac
11248                 case "$eagain" in
11249                 '')
11250                         echo "Forcing errno EAGAIN on read() with no data available."
11251                         eagain=EAGAIN
11252                         ;;
11253                 *)
11254                         echo "Your read() sets errno to $eagain when no data is available."
11255                         ;;
11256                 esac
11257                 status=`$cat try.err`
11258                 case "$status" in
11259                 0) echo "And it correctly returns 0 to signal EOF.";;
11260                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11261                 *) echo "However, your read() returns '$status' on EOF??";;
11262                 esac
11263                 val="$define"
11264                 if test "$status" = "$rd_nodata"; then
11265                         echo "WARNING: you can't distinguish between EOF and no data!"
11266                         val="$undef"
11267                 fi
11268         else
11269                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11270                 eagain=EAGAIN
11271         fi
11272         set d_eofnblk
11273         eval $setvar
11274         ;;
11275 *)
11276         echo "Using $hint value $eagain."
11277         echo "Your read() returns $rd_nodata when no data is present."
11278         case "$d_eofnblk" in
11279         "$define") echo "And you can see EOF because read() returns 0.";;
11280         "$undef") echo "But you can't see EOF status from read() returned value.";;
11281         *)
11282                 echo "(Assuming you can't see EOF status from read anyway.)"
11283                 d_eofnblk=$undef
11284                 ;;
11285         esac
11286         ;;
11287 esac
11288 $rm -f try try.* .out core head.c mtry
11289
11290 : see if fchdir exists
11291 set fchdir d_fchdir
11292 eval $inlibc
11293
11294 : see if fchmod exists
11295 set fchmod d_fchmod
11296 eval $inlibc
11297
11298 : see if fchown exists
11299 set fchown d_fchown
11300 eval $inlibc
11301
11302 : see if this is an fcntl system
11303 set fcntl d_fcntl
11304 eval $inlibc
11305
11306 echo " "
11307 : See if fcntl-based locking works.
11308 $cat >try.c <<EOCP
11309 #include <stdlib.h>
11310 #include <unistd.h>
11311 #include <fcntl.h>
11312 #include <signal.h>
11313 $signal_t blech(x) int x; { exit(3); }
11314 int main() {
11315 #if defined(F_SETLK) && defined(F_SETLKW)
11316      struct flock flock;
11317      int retval, fd;
11318      fd = open("try.c", O_RDONLY);
11319      flock.l_type = F_RDLCK;
11320      flock.l_whence = SEEK_SET;
11321      flock.l_start = flock.l_len = 0;
11322      signal(SIGALRM, blech);
11323      alarm(10);
11324      retval = fcntl(fd, F_SETLK, &flock);
11325      close(fd);
11326      (retval < 0 ? exit(2) : exit(0));
11327 #else
11328      exit(2);
11329 #endif
11330 }
11331 EOCP
11332 echo "Checking if fcntl-based file locking works... "
11333 case "$d_fcntl" in
11334 "$define")
11335         set try
11336         if eval $compile_ok; then
11337                 if $run ./try; then
11338                         echo "Yes, it seems to work."
11339                         val="$define"
11340                 else
11341                         echo "Nope, it didn't work."
11342                         val="$undef"
11343                         case "$?" in
11344                         3) $cat >&4 <<EOM
11345 ***
11346 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11347 *** This is (almost) impossible.
11348 *** If your NFS lock daemons are not feeling well, something like
11349 *** this may happen, please investigate.  Cannot continue, aborting.
11350 ***
11351 EOM
11352                                 exit 1
11353                                 ;;
11354                         esac
11355                 fi
11356         else
11357                 echo "I'm unable to compile the test program, so I'll assume not."
11358                 val="$undef"
11359         fi
11360         ;;
11361 *) val="$undef";
11362         echo "Nope, since you don't even have fcntl()."
11363         ;;
11364 esac
11365 set d_fcntl_can_lock
11366 eval $setvar
11367 $rm -f try*
11368
11369
11370 : check for fd_set items
11371 $cat <<EOM
11372
11373 Checking to see how well your C compiler handles fd_set and friends ...
11374 EOM
11375 $cat >try.c <<EOCP
11376 #$i_systime I_SYS_TIME
11377 #$i_sysselct I_SYS_SELECT
11378 #$d_socket HAS_SOCKET
11379 #include <sys/types.h>
11380 #ifdef HAS_SOCKET
11381 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11382 #endif
11383 #ifdef I_SYS_TIME
11384 #include <sys/time.h>
11385 #endif
11386 #ifdef I_SYS_SELECT
11387 #include <sys/select.h>
11388 #endif
11389 int main() {
11390         fd_set fds;
11391
11392 #ifdef TRYBITS
11393         if(fds.fds_bits);
11394 #endif
11395
11396 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11397         exit(0);
11398 #else
11399         exit(1);
11400 #endif
11401 }
11402 EOCP
11403 set try -DTRYBITS
11404 if eval $compile; then
11405         d_fds_bits="$define"
11406         d_fd_set="$define"
11407         echo "Well, your system knows about the normal fd_set typedef..." >&4
11408         if $run ./try; then
11409                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11410                 d_fd_macros="$define"
11411         else
11412                 $cat >&4 <<'EOM'
11413 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11414 EOM
11415                 d_fd_macros="$undef"
11416         fi
11417 else
11418         $cat <<'EOM'
11419 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11420 EOM
11421         set try
11422         if eval $compile; then
11423                 d_fds_bits="$undef"
11424                 d_fd_set="$define"
11425                 echo "Well, your system has some sort of fd_set available..." >&4
11426                 if $run ./try; then
11427                         echo "and you have the normal fd_set macros." >&4
11428                         d_fd_macros="$define"
11429                 else
11430                         $cat <<'EOM'
11431 but not the normal fd_set macros!  Gross!  More work for me...
11432 EOM
11433                         d_fd_macros="$undef"
11434                 fi
11435         else
11436         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11437                 d_fd_set="$undef"
11438                 d_fds_bits="$undef"
11439                 d_fd_macros="$undef"
11440         fi
11441 fi
11442 $rm -f try try.*
11443
11444 : see if fgetpos exists
11445 set fgetpos d_fgetpos
11446 eval $inlibc
11447
11448 : see if finite exists
11449 set finite d_finite
11450 eval $inlibc
11451
11452 : see if finitel exists
11453 set finitel d_finitel
11454 eval $inlibc
11455
11456 : see if flock exists
11457 set flock d_flock
11458 eval $inlibc
11459
11460 : see if prototype for flock is available
11461 echo " "
11462 set d_flockproto flock $i_sysfile sys/file.h
11463 eval $hasproto
11464
11465 : see if fork exists
11466 set fork d_fork
11467 eval $inlibc
11468
11469 : see if fp_class exists
11470 set fp_class d_fp_class
11471 eval $inlibc
11472
11473 : see if pathconf exists
11474 set pathconf d_pathconf
11475 eval $inlibc
11476
11477 : see if fpathconf exists
11478 set fpathconf d_fpathconf
11479 eval $inlibc
11480
11481 : see if fpclass exists
11482 set fpclass d_fpclass
11483 eval $inlibc
11484
11485 : see if fpclassify exists
11486 set fpclassify d_fpclassify
11487 eval $inlibc
11488
11489 : see if fpclassl exists
11490 set fpclassl d_fpclassl
11491 eval $inlibc
11492
11493
11494 : check for fpos64_t
11495 echo " "
11496 echo "Checking to see if you have fpos64_t..." >&4
11497 $cat >try.c <<EOCP
11498 #include <stdio.h>
11499 int main() { fpos64_t x = 7; }
11500 EOCP
11501 set try
11502 if eval $compile; then
11503         val="$define"
11504         echo "You have fpos64_t."
11505 else
11506         val="$undef"
11507         echo "You do not have fpos64_t."
11508         case "$fpossize" in
11509         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11510         esac
11511 fi
11512 $rm -f try.* try
11513 set d_fpos64_t
11514 eval $setvar
11515
11516 : see if frexpl exists
11517 set frexpl d_frexpl
11518 eval $inlibc
11519
11520 : see if this is a sys/param system
11521 set sys/param.h i_sysparam
11522 eval $inhdr
11523
11524 : see if this is a sys/mount.h system
11525 set sys/mount.h i_sysmount
11526 eval $inhdr
11527
11528
11529 echo " "
11530 echo "Checking to see if your system supports struct fs_data..." >&4
11531 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11532 eval $hasstruct
11533 case "$d_fs_data_s" in
11534 "$define")      echo "Yes, it does."   ;;
11535 *)              echo "No, it doesn't." ;;
11536 esac
11537
11538 : see if fseeko exists
11539 set fseeko d_fseeko
11540 eval $inlibc
11541 case "$longsize" in
11542 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11543 esac
11544
11545 : see if fsetpos exists
11546 set fsetpos d_fsetpos
11547 eval $inlibc
11548
11549
11550 : see if fstatfs exists
11551 set fstatfs d_fstatfs
11552 eval $inlibc
11553
11554
11555 : see if statvfs exists
11556 set statvfs d_statvfs
11557 eval $inlibc
11558
11559 : see if fstatvfs exists
11560 set fstatvfs d_fstatvfs
11561 eval $inlibc
11562
11563
11564 : see if fsync exists
11565 set fsync d_fsync
11566 eval $inlibc
11567
11568 : see if ftello exists
11569 set ftello d_ftello
11570 eval $inlibc
11571 case "$longsize" in
11572 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11573 esac
11574
11575 : see if getcwd exists
11576 set getcwd d_getcwd
11577 eval $inlibc
11578
11579 : see if getespwnam exists
11580 set getespwnam d_getespwnam
11581 eval $inlibc
11582
11583
11584 : see if getfsstat exists
11585 set getfsstat d_getfsstat
11586 eval $inlibc
11587
11588 : see if getgrent exists
11589 set getgrent d_getgrent
11590 eval $inlibc
11591
11592 : see if getgrent_r exists
11593 set getgrent_r d_getgrent_r
11594 eval $inlibc
11595 case "$d_getgrent_r" in
11596 "$define")
11597         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11598         case "grp" in
11599         time)
11600                 hdrs="$hdrs $i_systime sys/time.h"
11601                 ;;
11602         esac
11603         case "$d_getgrent_r_proto:$usethreads" in
11604         ":define")      d_getgrent_r_proto=define
11605                 set d_getgrent_r_proto getgrent_r $hdrs
11606                 eval $hasproto ;;
11607         *)      ;;
11608         esac
11609         case "$d_getgrent_r_proto" in
11610         define)
11611         case "$getgrent_r_proto" in
11612         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11613         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11614         esac
11615         case "$getgrent_r_proto" in
11616         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11617         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11618         esac
11619         case "$getgrent_r_proto" in
11620         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11621         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11622         esac
11623         case "$getgrent_r_proto" in
11624         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11625         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11626         esac
11627         case "$getgrent_r_proto" in
11628         ''|0) try='int getgrent_r(struct group*, char*, int);'
11629         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11630         esac
11631         case "$getgrent_r_proto" in
11632         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11633         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11634         esac
11635         case "$getgrent_r_proto" in
11636         ''|0)   d_getgrent_r=undef
11637                 getgrent_r_proto=0
11638                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11639         * )     case "$getgrent_r_proto" in
11640                 REENTRANT_PROTO*) ;;
11641                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11642                 esac
11643                 echo "Prototype: $try" ;;
11644         esac
11645         ;;
11646         *)      case "$usethreads" in
11647                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11648                 esac
11649                 d_getgrent_r=undef
11650                 getgrent_r_proto=0
11651                 ;;
11652         esac
11653         ;;
11654 *)      getgrent_r_proto=0
11655         ;;
11656 esac
11657
11658 : see if getgrgid_r exists
11659 set getgrgid_r d_getgrgid_r
11660 eval $inlibc
11661 case "$d_getgrgid_r" in
11662 "$define")
11663         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11664         case "grp" in
11665         time)
11666                 hdrs="$hdrs $i_systime sys/time.h"
11667                 ;;
11668         esac
11669         case "$d_getgrgid_r_proto:$usethreads" in
11670         ":define")      d_getgrgid_r_proto=define
11671                 set d_getgrgid_r_proto getgrgid_r $hdrs
11672                 eval $hasproto ;;
11673         *)      ;;
11674         esac
11675         case "$d_getgrgid_r_proto" in
11676         define)
11677         case "$getgrgid_r_proto" in
11678         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11679         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11680         esac
11681         case "$getgrgid_r_proto" in
11682         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11683         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11684         esac
11685         case "$getgrgid_r_proto" in
11686         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11687         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11688         esac
11689         case "$getgrgid_r_proto" in
11690         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11691         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11692         esac
11693         case "$getgrgid_r_proto" in
11694         ''|0)   d_getgrgid_r=undef
11695                 getgrgid_r_proto=0
11696                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11697         * )     case "$getgrgid_r_proto" in
11698                 REENTRANT_PROTO*) ;;
11699                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11700                 esac
11701                 echo "Prototype: $try" ;;
11702         esac
11703         ;;
11704         *)      case "$usethreads" in
11705                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11706                 esac
11707                 d_getgrgid_r=undef
11708                 getgrgid_r_proto=0
11709                 ;;
11710         esac
11711         ;;
11712 *)      getgrgid_r_proto=0
11713         ;;
11714 esac
11715
11716 : see if getgrnam_r exists
11717 set getgrnam_r d_getgrnam_r
11718 eval $inlibc
11719 case "$d_getgrnam_r" in
11720 "$define")
11721         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11722         case "grp" in
11723         time)
11724                 hdrs="$hdrs $i_systime sys/time.h"
11725                 ;;
11726         esac
11727         case "$d_getgrnam_r_proto:$usethreads" in
11728         ":define")      d_getgrnam_r_proto=define
11729                 set d_getgrnam_r_proto getgrnam_r $hdrs
11730                 eval $hasproto ;;
11731         *)      ;;
11732         esac
11733         case "$d_getgrnam_r_proto" in
11734         define)
11735         case "$getgrnam_r_proto" in
11736         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11737         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11738         esac
11739         case "$getgrnam_r_proto" in
11740         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11741         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11742         esac
11743         case "$getgrnam_r_proto" in
11744         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11745         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11746         esac
11747         case "$getgrnam_r_proto" in
11748         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11749         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11750         esac
11751         case "$getgrnam_r_proto" in
11752         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11753         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11754         esac
11755         case "$getgrnam_r_proto" in
11756         ''|0)   d_getgrnam_r=undef
11757                 getgrnam_r_proto=0
11758                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11759         * )     case "$getgrnam_r_proto" in
11760                 REENTRANT_PROTO*) ;;
11761                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11762                 esac
11763                 echo "Prototype: $try" ;;
11764         esac
11765         ;;
11766         *)      case "$usethreads" in
11767                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11768                 esac
11769                 d_getgrnam_r=undef
11770                 getgrnam_r_proto=0
11771                 ;;
11772         esac
11773         ;;
11774 *)      getgrnam_r_proto=0
11775         ;;
11776 esac
11777
11778 : see if gethostbyaddr exists
11779 set gethostbyaddr d_gethbyaddr
11780 eval $inlibc
11781
11782 : see if gethostbyname exists
11783 set gethostbyname d_gethbyname
11784 eval $inlibc
11785
11786 : see if gethostent exists
11787 set gethostent d_gethent
11788 eval $inlibc
11789
11790 : see how we will look up host name
11791 echo " "
11792 call=''
11793 if set gethostname val -f d_gethname; eval $csym; $val; then
11794         echo 'gethostname() found.' >&4
11795         d_gethname="$define"
11796         call=gethostname
11797 fi
11798 if set uname val -f d_uname; eval $csym; $val; then
11799         if ./xenix; then
11800                 $cat <<'EOM'
11801 uname() was found, but you're running xenix, and older versions of xenix
11802 have a broken uname(). If you don't really know whether your xenix is old
11803 enough to have a broken system call, use the default answer.
11804
11805 EOM
11806                 dflt=y
11807                 case "$d_uname" in
11808                 "$define") dflt=n;;
11809                 esac
11810                 rp='Is your uname() broken?'
11811                 . ./myread
11812                 case "$ans" in
11813                 n*) d_uname="$define"; call=uname;;
11814                 esac
11815         else
11816                 echo 'uname() found.' >&4
11817                 d_uname="$define"
11818                 case "$call" in
11819                 '') call=uname ;;
11820                 esac
11821         fi
11822 fi
11823 case "$d_gethname" in
11824 '') d_gethname="$undef";;
11825 esac
11826 case "$d_uname" in
11827 '') d_uname="$undef";;
11828 esac
11829 case "$d_uname$d_gethname" in
11830 *define*)
11831         dflt=n
11832         cat <<EOM
11833  
11834 Every now and then someone has a $call() that lies about the hostname
11835 but can't be fixed for political or economic reasons.  If you wish, I can
11836 pretend $call() isn't there and maybe compute hostname at run-time
11837 thanks to the '$phostname' command.
11838
11839 EOM
11840         rp="Shall I ignore $call() from now on?"
11841         . ./myread
11842         case "$ans" in
11843         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11844         esac;;
11845 esac
11846 case "$phostname" in
11847 '') aphostname='';;
11848 *) case "$aphostname" in
11849         /*) ;;
11850         *) set X $phostname
11851                 shift
11852                 file=$1
11853                 shift
11854                 file=`./loc $file $file $pth`
11855                 aphostname=`echo $file $*`
11856                 ;;
11857         esac
11858         ;;
11859 esac
11860 case "$d_uname$d_gethname" in
11861 *define*) ;;
11862 *)
11863         case "$phostname" in
11864         '')
11865                 echo "There will be no way for $package to get your hostname." >&4;;
11866         *)
11867         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11868                 ;;
11869         esac;;
11870 esac
11871 case "$d_phostname" in
11872 '') d_phostname="$undef";;
11873 esac
11874
11875 : see if gethostbyaddr_r exists
11876 set gethostbyaddr_r d_gethostbyaddr_r
11877 eval $inlibc
11878 case "$d_gethostbyaddr_r" in
11879 "$define")
11880         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11881         case "netdb" in
11882         time)
11883                 hdrs="$hdrs $i_systime sys/time.h"
11884                 ;;
11885         esac
11886         case "$d_gethostbyaddr_r_proto:$usethreads" in
11887         ":define")      d_gethostbyaddr_r_proto=define
11888                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11889                 eval $hasproto ;;
11890         *)      ;;
11891         esac
11892         case "$d_gethostbyaddr_r_proto" in
11893         define)
11894         case "$gethostbyaddr_r_proto" in
11895         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11896         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11897         esac
11898         case "$gethostbyaddr_r_proto" in
11899         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11900         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11901         esac
11902         case "$gethostbyaddr_r_proto" in
11903         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11904         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11905         esac
11906         case "$gethostbyaddr_r_proto" in
11907         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11908         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11909         esac
11910         case "$gethostbyaddr_r_proto" in
11911         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11912         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11913         esac
11914         case "$gethostbyaddr_r_proto" in
11915         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11916         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11917         esac
11918         case "$gethostbyaddr_r_proto" in
11919         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11920         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11921         esac
11922         case "$gethostbyaddr_r_proto" in
11923         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11924         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11925         esac
11926         case "$gethostbyaddr_r_proto" in
11927         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11928         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11929         esac
11930         case "$gethostbyaddr_r_proto" in
11931         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11932         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11933         esac
11934         case "$gethostbyaddr_r_proto" in
11935         ''|0)   d_gethostbyaddr_r=undef
11936                 gethostbyaddr_r_proto=0
11937                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11938         * )     case "$gethostbyaddr_r_proto" in
11939                 REENTRANT_PROTO*) ;;
11940                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11941                 esac
11942                 echo "Prototype: $try" ;;
11943         esac
11944         ;;
11945         *)      case "$usethreads" in
11946                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11947                 esac
11948                 d_gethostbyaddr_r=undef
11949                 gethostbyaddr_r_proto=0
11950                 ;;
11951         esac
11952         ;;
11953 *)      gethostbyaddr_r_proto=0
11954         ;;
11955 esac
11956
11957 : see if gethostbyname_r exists
11958 set gethostbyname_r d_gethostbyname_r
11959 eval $inlibc
11960 case "$d_gethostbyname_r" in
11961 "$define")
11962         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11963         case "netdb" in
11964         time)
11965                 hdrs="$hdrs $i_systime sys/time.h"
11966                 ;;
11967         esac
11968         case "$d_gethostbyname_r_proto:$usethreads" in
11969         ":define")      d_gethostbyname_r_proto=define
11970                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11971                 eval $hasproto ;;
11972         *)      ;;
11973         esac
11974         case "$d_gethostbyname_r_proto" in
11975         define)
11976         case "$gethostbyname_r_proto" in
11977         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11978         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11979         esac
11980         case "$gethostbyname_r_proto" in
11981         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11982         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11983         esac
11984         case "$gethostbyname_r_proto" in
11985         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11986         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11987         esac
11988         case "$gethostbyname_r_proto" in
11989         ''|0)   d_gethostbyname_r=undef
11990                 gethostbyname_r_proto=0
11991                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11992         * )     case "$gethostbyname_r_proto" in
11993                 REENTRANT_PROTO*) ;;
11994                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11995                 esac
11996                 echo "Prototype: $try" ;;
11997         esac
11998         ;;
11999         *)      case "$usethreads" in
12000                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12001                 esac
12002                 d_gethostbyname_r=undef
12003                 gethostbyname_r_proto=0
12004                 ;;
12005         esac
12006         ;;
12007 *)      gethostbyname_r_proto=0
12008         ;;
12009 esac
12010
12011 : see if gethostent_r exists
12012 set gethostent_r d_gethostent_r
12013 eval $inlibc
12014 case "$d_gethostent_r" in
12015 "$define")
12016         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12017         case "netdb" in
12018         time)
12019                 hdrs="$hdrs $i_systime sys/time.h"
12020                 ;;
12021         esac
12022         case "$d_gethostent_r_proto:$usethreads" in
12023         ":define")      d_gethostent_r_proto=define
12024                 set d_gethostent_r_proto gethostent_r $hdrs
12025                 eval $hasproto ;;
12026         *)      ;;
12027         esac
12028         case "$d_gethostent_r_proto" in
12029         define)
12030         case "$gethostent_r_proto" in
12031         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12032         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12033         esac
12034         case "$gethostent_r_proto" in
12035         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12036         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12037         esac
12038         case "$gethostent_r_proto" in
12039         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12040         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12041         esac
12042         case "$gethostent_r_proto" in
12043         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12044         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12045         esac
12046         case "$gethostent_r_proto" in
12047         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12048         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12049         esac
12050         case "$gethostent_r_proto" in
12051         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12052         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12053         esac
12054         case "$gethostent_r_proto" in
12055         ''|0)   d_gethostent_r=undef
12056                 gethostent_r_proto=0
12057                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12058         * )     case "$gethostent_r_proto" in
12059                 REENTRANT_PROTO*) ;;
12060                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12061                 esac
12062                 echo "Prototype: $try" ;;
12063         esac
12064         ;;
12065         *)      case "$usethreads" in
12066                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12067                 esac
12068                 d_gethostent_r=undef
12069                 gethostent_r_proto=0
12070                 ;;
12071         esac
12072         ;;
12073 *)      gethostent_r_proto=0
12074         ;;
12075 esac
12076
12077 : see if prototypes for various gethostxxx netdb.h functions are available
12078 echo " "
12079 set d_gethostprotos gethostent $i_netdb netdb.h
12080 eval $hasproto
12081
12082 : see if getitimer exists
12083 set getitimer d_getitimer
12084 eval $inlibc
12085
12086 : see if getlogin exists
12087 set getlogin d_getlogin
12088 eval $inlibc
12089
12090 : see if getlogin_r exists
12091 set getlogin_r d_getlogin_r
12092 eval $inlibc
12093 case "$d_getlogin_r" in
12094 "$define")
12095         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12096         case "unistd" in
12097         time)
12098                 hdrs="$hdrs $i_systime sys/time.h"
12099                 ;;
12100         esac
12101         case "$d_getlogin_r_proto:$usethreads" in
12102         ":define")      d_getlogin_r_proto=define
12103                 set d_getlogin_r_proto getlogin_r $hdrs
12104                 eval $hasproto ;;
12105         *)      ;;
12106         esac
12107         case "$d_getlogin_r_proto" in
12108         define)
12109         case "$getlogin_r_proto" in
12110         ''|0) try='int getlogin_r(char*, size_t);'
12111         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12112         esac
12113         case "$getlogin_r_proto" in
12114         ''|0) try='int getlogin_r(char*, int);'
12115         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12116         esac
12117         case "$getlogin_r_proto" in
12118         ''|0) try='char* getlogin_r(char*, size_t);'
12119         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12120         esac
12121         case "$getlogin_r_proto" in
12122         ''|0) try='char* getlogin_r(char*, int);'
12123         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12124         esac
12125         case "$getlogin_r_proto" in
12126         ''|0)   d_getlogin_r=undef
12127                 getlogin_r_proto=0
12128                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12129         * )     case "$getlogin_r_proto" in
12130                 REENTRANT_PROTO*) ;;
12131                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12132                 esac
12133                 echo "Prototype: $try" ;;
12134         esac
12135         ;;
12136         *)      case "$usethreads" in
12137                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12138                 esac
12139                 d_getlogin_r=undef
12140                 getlogin_r_proto=0
12141                 ;;
12142         esac
12143         ;;
12144 *)      getlogin_r_proto=0
12145         ;;
12146 esac
12147
12148 : see if getmnt exists
12149 set getmnt d_getmnt
12150 eval $inlibc
12151
12152 : see if getmntent exists
12153 set getmntent d_getmntent
12154 eval $inlibc
12155
12156 : see if getnetbyaddr exists
12157 set getnetbyaddr d_getnbyaddr
12158 eval $inlibc
12159
12160 : see if getnetbyname exists
12161 set getnetbyname d_getnbyname
12162 eval $inlibc
12163
12164 : see if getnetent exists
12165 set getnetent d_getnent
12166 eval $inlibc
12167
12168 : see if getnetbyaddr_r exists
12169 set getnetbyaddr_r d_getnetbyaddr_r
12170 eval $inlibc
12171 case "$d_getnetbyaddr_r" in
12172 "$define")
12173         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12174         case "netdb" in
12175         time)
12176                 hdrs="$hdrs $i_systime sys/time.h"
12177                 ;;
12178         esac
12179         case "$d_getnetbyaddr_r_proto:$usethreads" in
12180         ":define")      d_getnetbyaddr_r_proto=define
12181                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12182                 eval $hasproto ;;
12183         *)      ;;
12184         esac
12185         case "$d_getnetbyaddr_r_proto" in
12186         define)
12187         case "$getnetbyaddr_r_proto" in
12188         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12189         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12190         esac
12191         case "$getnetbyaddr_r_proto" in
12192         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12193         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12194         esac
12195         case "$getnetbyaddr_r_proto" in
12196         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12197         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12198         esac
12199         case "$getnetbyaddr_r_proto" in
12200         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12201         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12202         esac
12203         case "$getnetbyaddr_r_proto" in
12204         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12205         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12206         esac
12207         case "$getnetbyaddr_r_proto" in
12208         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12209         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12210         esac
12211         case "$getnetbyaddr_r_proto" in
12212         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12213         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12214         esac
12215         case "$getnetbyaddr_r_proto" in
12216         ''|0)   d_getnetbyaddr_r=undef
12217                 getnetbyaddr_r_proto=0
12218                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12219         * )     case "$getnetbyaddr_r_proto" in
12220                 REENTRANT_PROTO*) ;;
12221                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12222                 esac
12223                 echo "Prototype: $try" ;;
12224         esac
12225         ;;
12226         *)      case "$usethreads" in
12227                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12228                 esac
12229                 d_getnetbyaddr_r=undef
12230                 getnetbyaddr_r_proto=0
12231                 ;;
12232         esac
12233         ;;
12234 *)      getnetbyaddr_r_proto=0
12235         ;;
12236 esac
12237
12238 : see if getnetbyname_r exists
12239 set getnetbyname_r d_getnetbyname_r
12240 eval $inlibc
12241 case "$d_getnetbyname_r" in
12242 "$define")
12243         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12244         case "netdb" in
12245         time)
12246                 hdrs="$hdrs $i_systime sys/time.h"
12247                 ;;
12248         esac
12249         case "$d_getnetbyname_r_proto:$usethreads" in
12250         ":define")      d_getnetbyname_r_proto=define
12251                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12252                 eval $hasproto ;;
12253         *)      ;;
12254         esac
12255         case "$d_getnetbyname_r_proto" in
12256         define)
12257         case "$getnetbyname_r_proto" in
12258         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12259         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12260         esac
12261         case "$getnetbyname_r_proto" in
12262         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12263         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12264         esac
12265         case "$getnetbyname_r_proto" in
12266         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12267         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12268         esac
12269         case "$getnetbyname_r_proto" in
12270         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12271         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12272         esac
12273         case "$getnetbyname_r_proto" in
12274         ''|0)   d_getnetbyname_r=undef
12275                 getnetbyname_r_proto=0
12276                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12277         * )     case "$getnetbyname_r_proto" in
12278                 REENTRANT_PROTO*) ;;
12279                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12280                 esac
12281                 echo "Prototype: $try" ;;
12282         esac
12283         ;;
12284         *)      case "$usethreads" in
12285                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12286                 esac
12287                 d_getnetbyname_r=undef
12288                 getnetbyname_r_proto=0
12289                 ;;
12290         esac
12291         ;;
12292 *)      getnetbyname_r_proto=0
12293         ;;
12294 esac
12295
12296 : see if getnetent_r exists
12297 set getnetent_r d_getnetent_r
12298 eval $inlibc
12299 case "$d_getnetent_r" in
12300 "$define")
12301         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12302         case "netdb" in
12303         time)
12304                 hdrs="$hdrs $i_systime sys/time.h"
12305                 ;;
12306         esac
12307         case "$d_getnetent_r_proto:$usethreads" in
12308         ":define")      d_getnetent_r_proto=define
12309                 set d_getnetent_r_proto getnetent_r $hdrs
12310                 eval $hasproto ;;
12311         *)      ;;
12312         esac
12313         case "$d_getnetent_r_proto" in
12314         define)
12315         case "$getnetent_r_proto" in
12316         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12317         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12318         esac
12319         case "$getnetent_r_proto" in
12320         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12321         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12322         esac
12323         case "$getnetent_r_proto" in
12324         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12325         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12326         esac
12327         case "$getnetent_r_proto" in
12328         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12329         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12330         esac
12331         case "$getnetent_r_proto" in
12332         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12333         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12334         esac
12335         case "$getnetent_r_proto" in
12336         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12337         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12338         esac
12339         case "$getnetent_r_proto" in
12340         ''|0)   d_getnetent_r=undef
12341                 getnetent_r_proto=0
12342                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12343         * )     case "$getnetent_r_proto" in
12344                 REENTRANT_PROTO*) ;;
12345                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12346                 esac
12347                 echo "Prototype: $try" ;;
12348         esac
12349         ;;
12350         *)      case "$usethreads" in
12351                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12352                 esac
12353                 d_getnetent_r=undef
12354                 getnetent_r_proto=0
12355                 ;;
12356         esac
12357         ;;
12358 *)      getnetent_r_proto=0
12359         ;;
12360 esac
12361
12362 : see if prototypes for various getnetxxx netdb.h functions are available
12363 echo " "
12364 set d_getnetprotos getnetent $i_netdb netdb.h
12365 eval $hasproto
12366
12367 : see if getpagesize exists
12368 set getpagesize d_getpagsz
12369 eval $inlibc
12370
12371
12372 : see if getprotobyname exists
12373 set getprotobyname d_getpbyname
12374 eval $inlibc
12375
12376 : see if getprotobynumber exists
12377 set getprotobynumber d_getpbynumber
12378 eval $inlibc
12379
12380 : see if getprotoent exists
12381 set getprotoent d_getpent
12382 eval $inlibc
12383
12384 : see if getpgid exists
12385 set getpgid d_getpgid
12386 eval $inlibc
12387
12388 : see if getpgrp2 exists
12389 set getpgrp2 d_getpgrp2
12390 eval $inlibc
12391
12392 : see if getppid exists
12393 set getppid d_getppid
12394 eval $inlibc
12395
12396 : see if getpriority exists
12397 set getpriority d_getprior
12398 eval $inlibc
12399
12400 : see if getprotobyname_r exists
12401 set getprotobyname_r d_getprotobyname_r
12402 eval $inlibc
12403 case "$d_getprotobyname_r" in
12404 "$define")
12405         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12406         case "netdb" in
12407         time)
12408                 hdrs="$hdrs $i_systime sys/time.h"
12409                 ;;
12410         esac
12411         case "$d_getprotobyname_r_proto:$usethreads" in
12412         ":define")      d_getprotobyname_r_proto=define
12413                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12414                 eval $hasproto ;;
12415         *)      ;;
12416         esac
12417         case "$d_getprotobyname_r_proto" in
12418         define)
12419         case "$getprotobyname_r_proto" in
12420         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12421         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12422         esac
12423         case "$getprotobyname_r_proto" in
12424         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12425         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12426         esac
12427         case "$getprotobyname_r_proto" in
12428         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12429         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12430         esac
12431         case "$getprotobyname_r_proto" in
12432         ''|0)   d_getprotobyname_r=undef
12433                 getprotobyname_r_proto=0
12434                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12435         * )     case "$getprotobyname_r_proto" in
12436                 REENTRANT_PROTO*) ;;
12437                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12438                 esac
12439                 echo "Prototype: $try" ;;
12440         esac
12441         ;;
12442         *)      case "$usethreads" in
12443                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12444                 esac
12445                 d_getprotobyname_r=undef
12446                 getprotobyname_r_proto=0
12447                 ;;
12448         esac
12449         ;;
12450 *)      getprotobyname_r_proto=0
12451         ;;
12452 esac
12453
12454 : see if getprotobynumber_r exists
12455 set getprotobynumber_r d_getprotobynumber_r
12456 eval $inlibc
12457 case "$d_getprotobynumber_r" in
12458 "$define")
12459         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12460         case "netdb" in
12461         time)
12462                 hdrs="$hdrs $i_systime sys/time.h"
12463                 ;;
12464         esac
12465         case "$d_getprotobynumber_r_proto:$usethreads" in
12466         ":define")      d_getprotobynumber_r_proto=define
12467                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12468                 eval $hasproto ;;
12469         *)      ;;
12470         esac
12471         case "$d_getprotobynumber_r_proto" in
12472         define)
12473         case "$getprotobynumber_r_proto" in
12474         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12475         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12476         esac
12477         case "$getprotobynumber_r_proto" in
12478         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12479         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12480         esac
12481         case "$getprotobynumber_r_proto" in
12482         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12483         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12484         esac
12485         case "$getprotobynumber_r_proto" in
12486         ''|0)   d_getprotobynumber_r=undef
12487                 getprotobynumber_r_proto=0
12488                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12489         * )     case "$getprotobynumber_r_proto" in
12490                 REENTRANT_PROTO*) ;;
12491                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12492                 esac
12493                 echo "Prototype: $try" ;;
12494         esac
12495         ;;
12496         *)      case "$usethreads" in
12497                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12498                 esac
12499                 d_getprotobynumber_r=undef
12500                 getprotobynumber_r_proto=0
12501                 ;;
12502         esac
12503         ;;
12504 *)      getprotobynumber_r_proto=0
12505         ;;
12506 esac
12507
12508 : see if getprotoent_r exists
12509 set getprotoent_r d_getprotoent_r
12510 eval $inlibc
12511 case "$d_getprotoent_r" in
12512 "$define")
12513         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12514         case "netdb" in
12515         time)
12516                 hdrs="$hdrs $i_systime sys/time.h"
12517                 ;;
12518         esac
12519         case "$d_getprotoent_r_proto:$usethreads" in
12520         ":define")      d_getprotoent_r_proto=define
12521                 set d_getprotoent_r_proto getprotoent_r $hdrs
12522                 eval $hasproto ;;
12523         *)      ;;
12524         esac
12525         case "$d_getprotoent_r_proto" in
12526         define)
12527         case "$getprotoent_r_proto" in
12528         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12529         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12530         esac
12531         case "$getprotoent_r_proto" in
12532         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12533         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12534         esac
12535         case "$getprotoent_r_proto" in
12536         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12537         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12538         esac
12539         case "$getprotoent_r_proto" in
12540         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12541         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12542         esac
12543         case "$getprotoent_r_proto" in
12544         ''|0)   d_getprotoent_r=undef
12545                 getprotoent_r_proto=0
12546                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12547         * )     case "$getprotoent_r_proto" in
12548                 REENTRANT_PROTO*) ;;
12549                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12550                 esac
12551                 echo "Prototype: $try" ;;
12552         esac
12553         ;;
12554         *)      case "$usethreads" in
12555                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12556                 esac
12557                 d_getprotoent_r=undef
12558                 getprotoent_r_proto=0
12559                 ;;
12560         esac
12561         ;;
12562 *)      getprotoent_r_proto=0
12563         ;;
12564 esac
12565
12566 : see if prototypes for various getprotoxxx netdb.h functions are available
12567 echo " "
12568 set d_getprotoprotos getprotoent $i_netdb netdb.h
12569 eval $hasproto
12570
12571 : see if getprpwnam exists
12572 set getprpwnam d_getprpwnam
12573 eval $inlibc
12574
12575 : see if getpwent exists
12576 set getpwent d_getpwent
12577 eval $inlibc
12578
12579 : see if getpwent_r exists
12580 set getpwent_r d_getpwent_r
12581 eval $inlibc
12582 case "$d_getpwent_r" in
12583 "$define")
12584         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12585         case "pwd" in
12586         time)
12587                 hdrs="$hdrs $i_systime sys/time.h"
12588                 ;;
12589         esac
12590         case "$d_getpwent_r_proto:$usethreads" in
12591         ":define")      d_getpwent_r_proto=define
12592                 set d_getpwent_r_proto getpwent_r $hdrs
12593                 eval $hasproto ;;
12594         *)      ;;
12595         esac
12596         case "$d_getpwent_r_proto" in
12597         define)
12598         case "$getpwent_r_proto" in
12599         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12600         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12601         esac
12602         case "$getpwent_r_proto" in
12603         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12604         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12605         esac
12606         case "$getpwent_r_proto" in
12607         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12608         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12609         esac
12610         case "$getpwent_r_proto" in
12611         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12612         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12613         esac
12614         case "$getpwent_r_proto" in
12615         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12616         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12617         esac
12618         case "$getpwent_r_proto" in
12619         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12620         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12621         esac
12622         case "$getpwent_r_proto" in
12623         ''|0)   d_getpwent_r=undef
12624                 getpwent_r_proto=0
12625                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12626         * )     case "$getpwent_r_proto" in
12627                 REENTRANT_PROTO*) ;;
12628                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12629                 esac
12630                 echo "Prototype: $try" ;;
12631         esac
12632         ;;
12633         *)      case "$usethreads" in
12634                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12635                 esac
12636                 d_getpwent_r=undef
12637                 getpwent_r_proto=0
12638                 ;;
12639         esac
12640         ;;
12641 *)      getpwent_r_proto=0
12642         ;;
12643 esac
12644
12645 : see if getpwnam_r exists
12646 set getpwnam_r d_getpwnam_r
12647 eval $inlibc
12648 case "$d_getpwnam_r" in
12649 "$define")
12650         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12651         case "pwd" in
12652         time)
12653                 hdrs="$hdrs $i_systime sys/time.h"
12654                 ;;
12655         esac
12656         case "$d_getpwnam_r_proto:$usethreads" in
12657         ":define")      d_getpwnam_r_proto=define
12658                 set d_getpwnam_r_proto getpwnam_r $hdrs
12659                 eval $hasproto ;;
12660         *)      ;;
12661         esac
12662         case "$d_getpwnam_r_proto" in
12663         define)
12664         case "$getpwnam_r_proto" in
12665         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12666         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12667         esac
12668         case "$getpwnam_r_proto" in
12669         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12670         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12671         esac
12672         case "$getpwnam_r_proto" in
12673         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12674         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12675         esac
12676         case "$getpwnam_r_proto" in
12677         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12678         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12679         esac
12680         case "$getpwnam_r_proto" in
12681         ''|0)   d_getpwnam_r=undef
12682                 getpwnam_r_proto=0
12683                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12684         * )     case "$getpwnam_r_proto" in
12685                 REENTRANT_PROTO*) ;;
12686                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12687                 esac
12688                 echo "Prototype: $try" ;;
12689         esac
12690         ;;
12691         *)      case "$usethreads" in
12692                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12693                 esac
12694                 d_getpwnam_r=undef
12695                 getpwnam_r_proto=0
12696                 ;;
12697         esac
12698         ;;
12699 *)      getpwnam_r_proto=0
12700         ;;
12701 esac
12702
12703 : see if getpwuid_r exists
12704 set getpwuid_r d_getpwuid_r
12705 eval $inlibc
12706 case "$d_getpwuid_r" in
12707 "$define")
12708         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12709         case "pwd" in
12710         time)
12711                 hdrs="$hdrs $i_systime sys/time.h"
12712                 ;;
12713         esac
12714         case "$d_getpwuid_r_proto:$usethreads" in
12715         ":define")      d_getpwuid_r_proto=define
12716                 set d_getpwuid_r_proto getpwuid_r $hdrs
12717                 eval $hasproto ;;
12718         *)      ;;
12719         esac
12720         case "$d_getpwuid_r_proto" in
12721         define)
12722         case "$getpwuid_r_proto" in
12723         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12724         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12725         esac
12726         case "$getpwuid_r_proto" in
12727         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12728         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12729         esac
12730         case "$getpwuid_r_proto" in
12731         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12732         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12733         esac
12734         case "$getpwuid_r_proto" in
12735         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12736         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12737         esac
12738         case "$getpwuid_r_proto" in
12739         ''|0)   d_getpwuid_r=undef
12740                 getpwuid_r_proto=0
12741                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12742         * )     case "$getpwuid_r_proto" in
12743                 REENTRANT_PROTO*) ;;
12744                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12745                 esac
12746                 echo "Prototype: $try" ;;
12747         esac
12748         ;;
12749         *)      case "$usethreads" in
12750                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12751                 esac
12752                 d_getpwuid_r=undef
12753                 getpwuid_r_proto=0
12754                 ;;
12755         esac
12756         ;;
12757 *)      getpwuid_r_proto=0
12758         ;;
12759 esac
12760
12761
12762 : see if getservbyname exists
12763 set getservbyname d_getsbyname
12764 eval $inlibc
12765
12766 : see if getservbyport exists
12767 set getservbyport d_getsbyport
12768 eval $inlibc
12769
12770 : see if getservent exists
12771 set getservent d_getsent
12772 eval $inlibc
12773
12774 : see if getservbyname_r exists
12775 set getservbyname_r d_getservbyname_r
12776 eval $inlibc
12777 case "$d_getservbyname_r" in
12778 "$define")
12779         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12780         case "netdb" in
12781         time)
12782                 hdrs="$hdrs $i_systime sys/time.h"
12783                 ;;
12784         esac
12785         case "$d_getservbyname_r_proto:$usethreads" in
12786         ":define")      d_getservbyname_r_proto=define
12787                 set d_getservbyname_r_proto getservbyname_r $hdrs
12788                 eval $hasproto ;;
12789         *)      ;;
12790         esac
12791         case "$d_getservbyname_r_proto" in
12792         define)
12793         case "$getservbyname_r_proto" in
12794         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12795         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12796         esac
12797         case "$getservbyname_r_proto" in
12798         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12799         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12800         esac
12801         case "$getservbyname_r_proto" in
12802         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12803         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12804         esac
12805         case "$getservbyname_r_proto" in
12806         ''|0)   d_getservbyname_r=undef
12807                 getservbyname_r_proto=0
12808                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12809         * )     case "$getservbyname_r_proto" in
12810                 REENTRANT_PROTO*) ;;
12811                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12812                 esac
12813                 echo "Prototype: $try" ;;
12814         esac
12815         ;;
12816         *)      case "$usethreads" in
12817                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12818                 esac
12819                 d_getservbyname_r=undef
12820                 getservbyname_r_proto=0
12821                 ;;
12822         esac
12823         ;;
12824 *)      getservbyname_r_proto=0
12825         ;;
12826 esac
12827
12828 : see if getservbyport_r exists
12829 set getservbyport_r d_getservbyport_r
12830 eval $inlibc
12831 case "$d_getservbyport_r" in
12832 "$define")
12833         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12834         case "netdb" in
12835         time)
12836                 hdrs="$hdrs $i_systime sys/time.h"
12837                 ;;
12838         esac
12839         case "$d_getservbyport_r_proto:$usethreads" in
12840         ":define")      d_getservbyport_r_proto=define
12841                 set d_getservbyport_r_proto getservbyport_r $hdrs
12842                 eval $hasproto ;;
12843         *)      ;;
12844         esac
12845         case "$d_getservbyport_r_proto" in
12846         define)
12847         case "$getservbyport_r_proto" in
12848         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12849         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12850         esac
12851         case "$getservbyport_r_proto" in
12852         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12853         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12854         esac
12855         case "$getservbyport_r_proto" in
12856         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12857         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12858         esac
12859         case "$getservbyport_r_proto" in
12860         ''|0)   d_getservbyport_r=undef
12861                 getservbyport_r_proto=0
12862                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12863         * )     case "$getservbyport_r_proto" in
12864                 REENTRANT_PROTO*) ;;
12865                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12866                 esac
12867                 echo "Prototype: $try" ;;
12868         esac
12869         ;;
12870         *)      case "$usethreads" in
12871                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12872                 esac
12873                 d_getservbyport_r=undef
12874                 getservbyport_r_proto=0
12875                 ;;
12876         esac
12877         ;;
12878 *)      getservbyport_r_proto=0
12879         ;;
12880 esac
12881
12882 : see if getservent_r exists
12883 set getservent_r d_getservent_r
12884 eval $inlibc
12885 case "$d_getservent_r" in
12886 "$define")
12887         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12888         case "netdb" in
12889         time)
12890                 hdrs="$hdrs $i_systime sys/time.h"
12891                 ;;
12892         esac
12893         case "$d_getservent_r_proto:$usethreads" in
12894         ":define")      d_getservent_r_proto=define
12895                 set d_getservent_r_proto getservent_r $hdrs
12896                 eval $hasproto ;;
12897         *)      ;;
12898         esac
12899         case "$d_getservent_r_proto" in
12900         define)
12901         case "$getservent_r_proto" in
12902         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12903         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12904         esac
12905         case "$getservent_r_proto" in
12906         ''|0) try='int getservent_r(struct servent*, char*, int);'
12907         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12908         esac
12909         case "$getservent_r_proto" in
12910         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12911         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12912         esac
12913         case "$getservent_r_proto" in
12914         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12915         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12916         esac
12917         case "$getservent_r_proto" in
12918         ''|0)   d_getservent_r=undef
12919                 getservent_r_proto=0
12920                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12921         * )     case "$getservent_r_proto" in
12922                 REENTRANT_PROTO*) ;;
12923                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12924                 esac
12925                 echo "Prototype: $try" ;;
12926         esac
12927         ;;
12928         *)      case "$usethreads" in
12929                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12930                 esac
12931                 d_getservent_r=undef
12932                 getservent_r_proto=0
12933                 ;;
12934         esac
12935         ;;
12936 *)      getservent_r_proto=0
12937         ;;
12938 esac
12939
12940 : see if prototypes for various getservxxx netdb.h functions are available
12941 echo " "
12942 set d_getservprotos getservent $i_netdb netdb.h
12943 eval $hasproto
12944
12945 : see if getspnam exists
12946 set getspnam d_getspnam
12947 eval $inlibc
12948
12949 : see if this is a shadow.h system
12950 set shadow.h i_shadow
12951 eval $inhdr
12952
12953 : see if getspnam_r exists
12954 set getspnam_r d_getspnam_r
12955 eval $inlibc
12956 case "$d_getspnam_r" in
12957 "$define")
12958         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12959         case "shadow" in
12960         time)
12961                 hdrs="$hdrs $i_systime sys/time.h"
12962                 ;;
12963         esac
12964         case "$d_getspnam_r_proto:$usethreads" in
12965         ":define")      d_getspnam_r_proto=define
12966                 set d_getspnam_r_proto getspnam_r $hdrs
12967                 eval $hasproto ;;
12968         *)      ;;
12969         esac
12970         case "$d_getspnam_r_proto" in
12971         define)
12972         case "$getspnam_r_proto" in
12973         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12974         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12975         esac
12976         case "$getspnam_r_proto" in
12977         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12978         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12979         esac
12980         case "$getspnam_r_proto" in
12981         ''|0)   d_getspnam_r=undef
12982                 getspnam_r_proto=0
12983                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12984         * )     case "$getspnam_r_proto" in
12985                 REENTRANT_PROTO*) ;;
12986                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12987                 esac
12988                 echo "Prototype: $try" ;;
12989         esac
12990         ;;
12991         *)      case "$usethreads" in
12992                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12993                 esac
12994                 d_getspnam_r=undef
12995                 getspnam_r_proto=0
12996                 ;;
12997         esac
12998         ;;
12999 *)      getspnam_r_proto=0
13000         ;;
13001 esac
13002
13003 : see if gettimeofday or ftime exists
13004 set gettimeofday d_gettimeod
13005 eval $inlibc
13006 case "$d_gettimeod" in
13007 "$undef")
13008         set ftime d_ftime 
13009         eval $inlibc
13010         ;;
13011 *)
13012         val="$undef"; set d_ftime; eval $setvar
13013         ;;
13014 esac
13015 case "$d_gettimeod$d_ftime" in
13016 "$undef$undef")
13017         echo " "
13018         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13019         ;;
13020 esac
13021
13022 : see if gmtime_r exists
13023 set gmtime_r d_gmtime_r
13024 eval $inlibc
13025 case "$d_gmtime_r" in
13026 "$define")
13027         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
13028         case "time" in
13029         time)
13030                 hdrs="$hdrs $i_systime sys/time.h"
13031                 ;;
13032         esac
13033         case "$d_gmtime_r_proto:$usethreads" in
13034         ":define")      d_gmtime_r_proto=define
13035                 set d_gmtime_r_proto gmtime_r $hdrs
13036                 eval $hasproto ;;
13037         *)      ;;
13038         esac
13039         case "$d_gmtime_r_proto" in
13040         define)
13041         case "$gmtime_r_proto" in
13042         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13043         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13044         esac
13045         case "$gmtime_r_proto" in
13046         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13047         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13048         esac
13049         case "$gmtime_r_proto" in
13050         ''|0)   d_gmtime_r=undef
13051                 gmtime_r_proto=0
13052                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13053         * )     case "$gmtime_r_proto" in
13054                 REENTRANT_PROTO*) ;;
13055                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13056                 esac
13057                 echo "Prototype: $try" ;;
13058         esac
13059         ;;
13060         *)      case "$usethreads" in
13061                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13062                 esac
13063                 d_gmtime_r=undef
13064                 gmtime_r_proto=0
13065                 ;;
13066         esac
13067         ;;
13068 *)      gmtime_r_proto=0
13069         ;;
13070 esac
13071
13072 : see if hasmntopt exists
13073 set hasmntopt d_hasmntopt
13074 eval $inlibc
13075
13076 : see if this is a netinet/in.h or sys/in.h system
13077 set netinet/in.h i_niin sys/in.h i_sysin
13078 eval $inhdr
13079
13080 : see if arpa/inet.h has to be included
13081 set arpa/inet.h i_arpainet
13082 eval $inhdr
13083
13084 : see if htonl --and friends-- exists
13085 val=''
13086 set htonl val
13087 eval $inlibc
13088
13089 : Maybe they are macros.
13090 case "$val" in
13091 $undef)
13092         $cat >htonl.c <<EOM
13093 #include <stdio.h>
13094 #include <sys/types.h>
13095 #$i_niin I_NETINET_IN
13096 #$i_sysin I_SYS_IN
13097 #$i_arpainet I_ARPA_INET
13098 #ifdef I_NETINET_IN
13099 #include <netinet/in.h>
13100 #endif
13101 #ifdef I_SYS_IN
13102 #include <sys/in.h>
13103 #endif
13104 #ifdef I_ARPA_INET
13105 #include <arpa/inet.h>
13106 #endif
13107 #ifdef htonl
13108 printf("Defined as a macro.");
13109 #endif
13110 EOM
13111         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13112         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13113                 val="$define"
13114                 echo "But it seems to be defined as a macro." >&4
13115         fi
13116         $rm -f htonl.?
13117         ;;
13118 esac
13119 set d_htonl
13120 eval $setvar
13121
13122 : index or strchr
13123 echo " "
13124 if set index val -f; eval $csym; $val; then
13125         if set strchr val -f d_strchr; eval $csym; $val; then
13126                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13127                         val="$define"
13128                         vali="$undef"
13129                         echo "strchr() found." >&4
13130                 else
13131                         val="$undef"
13132                         vali="$define"
13133                         echo "index() found." >&4
13134                 fi
13135         else
13136                 val="$undef"
13137                 vali="$define"
13138                 echo "index() found." >&4
13139         fi
13140 else
13141         if set strchr val -f d_strchr; eval $csym; $val; then
13142                 val="$define"
13143                 vali="$undef"
13144                 echo "strchr() found." >&4
13145         else
13146                 echo "No index() or strchr() found!" >&4
13147                 val="$undef"
13148                 vali="$undef"
13149         fi
13150 fi
13151 set d_strchr; eval $setvar
13152 val="$vali"
13153 set d_index; eval $setvar
13154
13155 : check whether inet_aton exists
13156 set inet_aton d_inetaton
13157 eval $inlibc
13158
13159 : Look for isascii
13160 echo " "
13161 $cat >isascii.c <<'EOCP'
13162 #include <stdio.h>
13163 #include <ctype.h>
13164 int main() {
13165         int c = 'A';
13166         if (isascii(c))
13167                 exit(0);
13168         else
13169                 exit(1);
13170 }
13171 EOCP
13172 set isascii
13173 if eval $compile; then
13174         echo "isascii() found." >&4
13175         val="$define"
13176 else
13177         echo "isascii() NOT found." >&4
13178         val="$undef"
13179 fi
13180 set d_isascii
13181 eval $setvar
13182 $rm -f isascii*
13183
13184 : see if isfinite exists
13185 set isfinite d_isfinite
13186 eval $inlibc
13187
13188 : see if isinf exists
13189 set isinf d_isinf
13190 eval $inlibc
13191
13192 : see if isnan exists
13193 set isnan d_isnan
13194 eval $inlibc
13195
13196 : see if isnanl exists
13197 set isnanl d_isnanl
13198 eval $inlibc
13199
13200 : see if killpg exists
13201 set killpg d_killpg
13202 eval $inlibc
13203
13204 : see if lchown exists
13205 echo " "
13206 $cat > try.c <<'EOCP'
13207 /* System header to define __stub macros and hopefully few prototypes,
13208     which can conflict with char lchown(); below.  */
13209 #include <assert.h>
13210 /* Override any gcc2 internal prototype to avoid an error.  */
13211 /* We use char because int might match the return type of a gcc2
13212    builtin and then its argument prototype would still apply.  */
13213 char lchown();
13214 int main() {
13215     /*  The GNU C library defines this for functions which it implements
13216         to always fail with ENOSYS.  Some functions are actually named
13217         something starting with __ and the normal name is an alias.  */
13218 #if defined (__stub_lchown) || defined (__stub___lchown)
13219 choke me
13220 #else
13221 lchown();
13222 #endif
13223 ; return 0; }
13224 EOCP
13225 set try
13226 if eval $compile; then
13227     $echo "lchown() found." >&4
13228     val="$define"
13229 else
13230     $echo "lchown() NOT found." >&4
13231     val="$undef"
13232 fi
13233 set d_lchown
13234 eval $setvar
13235
13236 : See if number of significant digits in a double precision number is known
13237 echo " "
13238 $cat >ldbl_dig.c <<EOM
13239 #$i_limits I_LIMITS
13240 #$i_float I_FLOAT
13241 #ifdef I_LIMITS
13242 #include <limits.h>
13243 #endif
13244 #ifdef I_FLOAT
13245 #include <float.h>
13246 #endif
13247 #ifdef LDBL_DIG
13248 printf("Contains LDBL_DIG");
13249 #endif
13250 EOM
13251 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13252 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13253         echo "LDBL_DIG found." >&4
13254         val="$define"
13255 else
13256         echo "LDBL_DIG NOT found." >&4
13257         val="$undef"
13258 fi
13259 $rm -f ldbl_dig.?
13260 set d_ldbl_dig
13261 eval $setvar
13262
13263 : see if link exists
13264 set link d_link
13265 eval $inlibc
13266
13267 : see if localtime_r exists
13268 set localtime_r d_localtime_r
13269 eval $inlibc
13270 case "$d_localtime_r" in
13271 "$define")
13272         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
13273         case "time" in
13274         time)
13275                 hdrs="$hdrs $i_systime sys/time.h"
13276                 ;;
13277         esac
13278         case "$d_localtime_r_proto:$usethreads" in
13279         ":define")      d_localtime_r_proto=define
13280                 set d_localtime_r_proto localtime_r $hdrs
13281                 eval $hasproto ;;
13282         *)      ;;
13283         esac
13284         case "$d_localtime_r_proto" in
13285         define)
13286         case "$localtime_r_proto" in
13287         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13288         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13289         esac
13290         case "$localtime_r_proto" in
13291         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13292         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13293         esac
13294         case "$localtime_r_proto" in
13295         ''|0)   d_localtime_r=undef
13296                 localtime_r_proto=0
13297                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13298         * )     case "$localtime_r_proto" in
13299                 REENTRANT_PROTO*) ;;
13300                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13301                 esac
13302                 echo "Prototype: $try" ;;
13303         esac
13304         ;;
13305         *)      case "$usethreads" in
13306                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13307                 esac
13308                 d_localtime_r=undef
13309                 localtime_r_proto=0
13310                 ;;
13311         esac
13312         ;;
13313 *)      localtime_r_proto=0
13314         ;;
13315 esac
13316
13317 : see if localeconv exists
13318 set localeconv d_locconv
13319 eval $inlibc
13320
13321 : see if lockf exists
13322 set lockf d_lockf
13323 eval $inlibc
13324
13325 : see if prototype for lseek is available
13326 echo " "
13327 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13328 eval $hasproto
13329
13330 : see if lstat exists
13331 set lstat d_lstat
13332 eval $inlibc
13333
13334 : see if madvise exists
13335 set madvise d_madvise
13336 eval $inlibc
13337
13338 : see if mblen exists
13339 set mblen d_mblen
13340 eval $inlibc
13341
13342 : see if mbstowcs exists
13343 set mbstowcs d_mbstowcs
13344 eval $inlibc
13345
13346 : see if mbtowc exists
13347 set mbtowc d_mbtowc
13348 eval $inlibc
13349
13350 : see if memchr exists
13351 set memchr d_memchr
13352 eval $inlibc
13353
13354 : see if memcmp exists
13355 set memcmp d_memcmp
13356 eval $inlibc
13357
13358 : see if memcpy exists
13359 set memcpy d_memcpy
13360 eval $inlibc
13361
13362 : see if memmove exists
13363 set memmove d_memmove
13364 eval $inlibc
13365
13366 : see if memset exists
13367 set memset d_memset
13368 eval $inlibc
13369
13370 : see if mkdir exists
13371 set mkdir d_mkdir
13372 eval $inlibc
13373
13374 : see if mkdtemp exists
13375 set mkdtemp d_mkdtemp
13376 eval $inlibc
13377
13378 : see if mkfifo exists
13379 set mkfifo d_mkfifo
13380 eval $inlibc
13381
13382 : see if mkstemp exists
13383 set mkstemp d_mkstemp
13384 eval $inlibc
13385
13386 : see if mkstemps exists
13387 set mkstemps d_mkstemps
13388 eval $inlibc
13389
13390 : see if mktime exists
13391 set mktime d_mktime
13392 eval $inlibc
13393
13394 : see if this is a sys/mman.h system
13395 set sys/mman.h i_sysmman
13396 eval $inhdr
13397
13398 : see if mmap exists
13399 set mmap d_mmap
13400 eval $inlibc
13401 : see what shmat returns
13402 : default to something harmless
13403 mmaptype='void *'
13404 case "$i_sysmman$d_mmap" in
13405 "$define$define")
13406         $cat >mmap.c <<'END'
13407 #include <sys/mman.h>
13408 void *mmap();
13409 END
13410         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13411                 mmaptype='void *'
13412         else
13413                 mmaptype='caddr_t'
13414         fi
13415         echo "and it returns ($mmaptype)." >&4
13416         ;;
13417 esac
13418
13419
13420
13421 : see if mprotect exists
13422 set mprotect d_mprotect
13423 eval $inlibc
13424
13425 : see if msgctl exists
13426 set msgctl d_msgctl
13427 eval $inlibc
13428
13429 : see if msgget exists
13430 set msgget d_msgget
13431 eval $inlibc
13432
13433 : see if msgsnd exists
13434 set msgsnd d_msgsnd
13435 eval $inlibc
13436
13437 : see if msgrcv exists
13438 set msgrcv d_msgrcv
13439 eval $inlibc
13440
13441 : see how much of the 'msg*(2)' library is present.
13442 h_msg=true
13443 echo " "
13444 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13445 *"$undef"*) h_msg=false;;
13446 esac
13447 case "$osname" in
13448 freebsd)
13449     case "`ipcs 2>&1`" in
13450     "SVID messages"*"not configured"*)
13451         echo "Your $osname does not have the msg*(2) configured." >&4
13452         h_msg=false
13453         val="$undef"
13454         set msgctl d_msgctl
13455         eval $setvar
13456         set msgget d_msgget
13457         eval $setvar
13458         set msgsnd d_msgsnd
13459         eval $setvar
13460         set msgrcv d_msgrcv
13461         eval $setvar
13462         ;;
13463     esac
13464     ;;
13465 esac
13466 : we could also check for sys/ipc.h ...
13467 if $h_msg && $test `./findhdr sys/msg.h`; then
13468         echo "You have the full msg*(2) library." >&4
13469         val="$define"
13470 else
13471         echo "You don't have the full msg*(2) library." >&4
13472         val="$undef"
13473 fi
13474 set d_msg
13475 eval $setvar
13476
13477
13478 echo " "
13479 echo "Checking to see if your system supports struct msghdr..." >&4
13480 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13481 eval $hasstruct
13482 case "$d_msghdr_s" in
13483 "$define")      echo "Yes, it does."   ;;
13484 *)              echo "No, it doesn't." ;;
13485 esac
13486
13487
13488 : see if msync exists
13489 set msync d_msync
13490 eval $inlibc
13491
13492 : see if munmap exists
13493 set munmap d_munmap
13494 eval $inlibc
13495
13496 : see if nice exists
13497 set nice d_nice
13498 eval $inlibc
13499
13500 : see if this is a langinfo.h system
13501 set langinfo.h i_langinfo
13502 eval $inhdr
13503
13504 : see if nl_langinfo exists
13505 set nl_langinfo d_nl_langinfo
13506 eval $inlibc
13507
13508 : check for length of character
13509 echo " "
13510 case "$charsize" in
13511 '')
13512         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13513         $cat >try.c <<'EOCP'
13514 #include <stdio.h>
13515 int main()
13516 {
13517     printf("%d\n", (int)sizeof(char));
13518     exit(0);
13519 }
13520 EOCP
13521         set try
13522         if eval $compile_ok; then
13523                 dflt=`$run ./try`
13524         else
13525                 dflt='1'
13526                 echo "(I can't seem to compile the test program.  Guessing...)"
13527         fi
13528         ;;
13529 *)
13530         dflt="$charsize"
13531         ;;
13532 esac
13533 rp="What is the size of a character (in bytes)?"
13534 . ./myread
13535 charsize="$ans"
13536 $rm -f try.c try
13537
13538 : check for volatile keyword
13539 echo " "
13540 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13541 $cat >try.c <<'EOCP'
13542 int main()
13543 {
13544         typedef struct _goo_struct goo_struct;
13545         goo_struct * volatile goo = ((goo_struct *)0);
13546         struct _goo_struct {
13547                 long long_int;
13548                 int reg_int;
13549                 char char_var;
13550         };
13551         typedef unsigned short foo_t;
13552         char *volatile foo;
13553         volatile int bar;
13554         volatile foo_t blech;
13555         foo = foo;
13556 }
13557 EOCP
13558 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13559         val="$define"
13560         echo "Yup, it does."
13561 else
13562         val="$undef"
13563         echo "Nope, it doesn't."
13564 fi
13565 set d_volatile
13566 eval $setvar
13567 $rm -f try.*
13568
13569
13570 echo " "
13571 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13572
13573 case "$use64bitint:$d_quad:$quadtype" in
13574 define:define:?*)
13575         ivtype="$quadtype"
13576         uvtype="$uquadtype"
13577         ivsize=8
13578         uvsize=8
13579         ;;
13580 *)      ivtype="long"
13581         uvtype="unsigned long"
13582         ivsize=$longsize
13583         uvsize=$longsize
13584         ;;
13585 esac
13586
13587 case "$uselongdouble:$d_longdbl" in
13588 define:define)
13589         nvtype="long double"
13590         nvsize=$longdblsize
13591         ;;
13592 *)      nvtype=double
13593         nvsize=$doublesize
13594         ;;
13595 esac
13596
13597 $echo "(IV will be "$ivtype", $ivsize bytes)"
13598 $echo "(UV will be "$uvtype", $uvsize bytes)"
13599 $echo "(NV will be "$nvtype", $nvsize bytes)"
13600
13601 $cat >try.c <<EOCP
13602 #$i_inttypes I_INTTYPES
13603 #ifdef I_INTTYPES
13604 #include <inttypes.h>
13605 #endif
13606 #include <stdio.h>
13607 int main() {
13608 #ifdef INT8
13609    int8_t i =  INT8_MAX;
13610   uint8_t u = UINT8_MAX;
13611   printf("int8_t\n");
13612 #endif
13613 #ifdef INT16
13614    int16_t i =  INT16_MAX;
13615   uint16_t i = UINT16_MAX;
13616   printf("int16_t\n");
13617 #endif
13618 #ifdef INT32
13619    int32_t i =  INT32_MAX;
13620   uint32_t u = UINT32_MAX;
13621   printf("int32_t\n");
13622 #endif
13623 }
13624 EOCP
13625
13626 case "$i8type" in
13627 '')     case "$charsize" in
13628         1)      i8type=char
13629                 u8type="unsigned char"
13630                 i8size=$charsize
13631                 u8size=$charsize
13632                 ;;
13633         esac
13634         ;;
13635 esac
13636 case "$i8type" in
13637 '')     set try -DINT8
13638         if eval $compile; then
13639                 case "`$run ./try`" in
13640                 int8_t) i8type=int8_t
13641                         u8type=uint8_t
13642                         i8size=1
13643                         u8size=1
13644                         ;;
13645                 esac
13646         fi
13647         ;;
13648 esac
13649 case "$i8type" in
13650 '')     if $test $charsize -ge 1; then
13651                 i8type=char
13652                 u8type="unsigned char"
13653                 i8size=$charsize
13654                 u8size=$charsize
13655         fi
13656         ;;
13657 esac
13658
13659 case "$i16type" in
13660 '')     case "$shortsize" in
13661         2)      i16type=short
13662                 u16type="unsigned short"
13663                 i16size=$shortsize
13664                 u16size=$shortsize
13665                 ;;
13666         esac
13667         ;;
13668 esac
13669 case "$i16type" in
13670 '')     set try -DINT16
13671         if eval $compile; then
13672                 case "`$run ./try`" in
13673                 int16_t)
13674                         i16type=int16_t
13675                         u16type=uint16_t
13676                         i16size=2
13677                         u16size=2
13678                         ;;
13679                 esac
13680         fi
13681         ;;
13682 esac
13683 case "$i16type" in
13684 '')     if $test $shortsize -ge 2; then
13685                 i16type=short
13686                 u16type="unsigned short"
13687                 i16size=$shortsize
13688                 u16size=$shortsize
13689         fi
13690         ;;
13691 esac
13692
13693 case "$i32type" in
13694 '')     case "$longsize" in
13695         4)      i32type=long
13696                 u32type="unsigned long"
13697                 i32size=$longsize
13698                 u32size=$longsize
13699                 ;;
13700         *)      case "$intsize" in
13701                 4)      i32type=int
13702                         u32type="unsigned int"
13703                         i32size=$intsize
13704                         u32size=$intsize
13705                         ;;
13706                 esac
13707                 ;;
13708         esac
13709         ;;
13710 esac
13711 case "$i32type" in
13712 '')     set try -DINT32
13713         if eval $compile; then
13714                 case "`$run ./try`" in
13715                 int32_t)
13716                         i32type=int32_t
13717                         u32type=uint32_t
13718                         i32size=4
13719                         u32size=4
13720                         ;;
13721                 esac
13722         fi
13723         ;;
13724 esac
13725 case "$i32type" in
13726 '')     if $test $intsize -ge 4; then
13727                 i32type=int
13728                 u32type="unsigned int"
13729                 i32size=$intsize
13730                 u32size=$intsize
13731         fi
13732         ;;
13733 esac
13734
13735 case "$i64type" in
13736 '')     case "$d_quad:$quadtype" in
13737         define:?*)
13738                 i64type="$quadtype"
13739                 u64type="$uquadtype"
13740                 i64size=8
13741                 u64size=8
13742                 ;;
13743         esac
13744         ;;
13745 esac
13746
13747 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13748 : volatile so that the compiler has to store it out to memory.
13749 if test X"$d_volatile" = X"$define"; then
13750         volatile=volatile
13751 fi
13752 $cat <<EOP >try.c
13753 #include <stdio.h>
13754 #include <sys/types.h>
13755 #include <signal.h>
13756 #ifdef SIGFPE
13757 $volatile int bletched = 0;
13758 $signal_t blech(s) int s; { bletched = 1; }
13759 #endif
13760 int main() {
13761     $uvtype u = 0;
13762     $nvtype d;
13763     int     n = 8 * $uvsize;
13764     int     i;
13765 #ifdef SIGFPE
13766     signal(SIGFPE, blech);
13767 #endif
13768
13769     for (i = 0; i < n; i++) {
13770       u = u << 1 | ($uvtype)1;
13771       d = ($nvtype)u;
13772       if (($uvtype)d != u)
13773         break;
13774       if (d <= 0)
13775         break;
13776       d = ($nvtype)(u - 1);
13777       if (($uvtype)d != (u - 1))
13778         break;
13779 #ifdef SIGFPE
13780       if (bletched) {
13781         break;
13782 #endif
13783       } 
13784     }
13785     printf("%d\n", ((i == n) ? -n : i));
13786     exit(0);
13787 }
13788 EOP
13789 set try
13790
13791 d_nv_preserves_uv="$undef"
13792 if eval $compile; then
13793         nv_preserves_uv_bits="`$run ./try`"
13794 fi
13795 case "$nv_preserves_uv_bits" in
13796 \-[1-9]*)       
13797         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13798         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13799         d_nv_preserves_uv="$define"
13800         ;;
13801 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13802         d_nv_preserves_uv="$undef" ;;
13803 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13804         nv_preserves_uv_bits="$undef" ;;
13805 esac
13806
13807 $rm -f try.* try
13808
13809
13810 : check for off64_t
13811 echo " "
13812 echo "Checking to see if you have off64_t..." >&4
13813 $cat >try.c <<EOCP
13814 #include <sys/types.h>
13815 #include <unistd.h>
13816 int main() { off64_t x = 7; }
13817 EOCP
13818 set try
13819 if eval $compile; then
13820         val="$define"
13821         echo "You have off64_t."
13822 else
13823         val="$undef"
13824         echo "You do not have off64_t."
13825         case "$lseeksize" in
13826         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13827         esac
13828 fi
13829 $rm -f try.* try
13830 set d_off64_t
13831 eval $setvar
13832
13833 : how to create joinable pthreads
13834 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13835         echo " "
13836         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13837         $cat >try.c <<'EOCP'
13838 #include <pthread.h>
13839 int main() {
13840     int detachstate = JOINABLE;
13841 }
13842 EOCP
13843         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13844         if eval $compile; then
13845                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13846                 val="$undef" # Yes, undef.
13847                 set d_old_pthread_create_joinable
13848                 eval $setvar
13849                 val=""
13850                 set old_pthread_create_joinable
13851                 eval $setvar
13852         else
13853                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13854                 if eval $compile; then
13855                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13856                         val="$define"
13857                         set d_old_pthread_create_joinable
13858                         eval $setvar
13859                         val=PTHREAD_CREATE_UNDETACHED
13860                         set old_pthread_create_joinable
13861                         eval $setvar
13862                 else            
13863                         set try -DJOINABLE=__UNDETACHED
13864                         if eval $compile; then
13865                                 echo "You seem to use __UNDETACHED." >&4
13866                                 val="$define"
13867                                 set d_old_pthread_create_joinable
13868                                 eval $setvar
13869                                 val=__UNDETACHED
13870                                 set old_pthread_create_joinable
13871                                 eval $setvar
13872                         else
13873                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13874                                 val="$define"
13875                                 set d_old_pthread_create_joinable
13876                                 eval $setvar
13877                                 val=0
13878                                 set old_pthread_create_joinable
13879                                 eval $setvar
13880                         fi
13881                 fi
13882         fi
13883         $rm -f try try.*
13884 else
13885     d_old_pthread_create_joinable="$undef"
13886     old_pthread_create_joinable=""
13887 fi
13888
13889 : see if pause exists
13890 set pause d_pause
13891 eval $inlibc
13892
13893 : see if pipe exists
13894 set pipe d_pipe
13895 eval $inlibc
13896
13897 : see if poll exists
13898 set poll d_poll
13899 eval $inlibc
13900
13901 : see if readlink exists
13902 set readlink d_readlink
13903 eval $inlibc
13904
13905 echo " "
13906 procselfexe=''
13907 val="$undef"
13908 case "$d_readlink" in
13909 "$define")
13910         if $issymlink /proc/self/exe ; then
13911                 $ls -l /proc/self/exe > reflect
13912                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13913                         echo "You have Linux-like /proc/self/exe."
13914                         procselfexe='"/proc/self/exe"'
13915                         val="$define"
13916                 fi
13917         fi
13918         if $issymlink /proc/curproc/file ; then
13919                 $ls -l /proc/curproc/file > reflect
13920                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13921                         echo "You have BSD-like /proc/curproc/file."
13922                         procselfexe='"/proc/curproc/file"'
13923                         val="$define"
13924                 fi
13925         fi
13926         ;;
13927 esac
13928 $rm -f reflect
13929 set d_procselfexe
13930 eval $setvar
13931
13932 : see whether the pthread_atfork exists
13933 $cat >try.c <<EOP
13934 #include <pthread.h>
13935 #include <stdio.h>
13936 int main() {
13937 #ifdef  PTHREAD_ATFORK
13938         pthread_atfork(NULL,NULL,NULL);
13939 #endif
13940 }
13941 EOP
13942
13943 : see if pthread_atfork exists
13944 set try -DPTHREAD_ATFORK
13945 if eval $compile; then
13946     val="$define"
13947 else
13948     val="$undef"
13949 fi
13950 case "$usethreads" in
13951 $define)
13952         case "$val" in
13953         $define) echo 'pthread_atfork found.' >&4        ;;
13954         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13955         esac
13956 esac
13957 set d_pthread_atfork
13958 eval $setvar
13959
13960
13961 : see whether the various POSIXish _yields exist
13962 $cat >try.c <<EOP
13963 #include <pthread.h>
13964 #include <stdio.h>
13965 int main() {
13966 #ifdef SCHED_YIELD
13967         sched_yield();
13968 #else
13969 #ifdef PTHREAD_YIELD
13970         pthread_yield();
13971 #else
13972 #ifdef PTHREAD_YIELD_NULL
13973         pthread_yield(NULL);
13974 #endif
13975 #endif
13976 #endif
13977 }
13978 EOP
13979 : see if sched_yield exists
13980 set try -DSCHED_YIELD
13981 if eval $compile; then
13982     val="$define"
13983     sched_yield='sched_yield()'
13984 else
13985     val="$undef"
13986 fi
13987 case "$usethreads" in
13988 $define)
13989         case "$val" in
13990         $define) echo 'sched_yield() found.' >&4        ;;
13991         *)       echo 'sched_yield() NOT found.' >&4    ;;
13992         esac
13993 esac
13994 set d_sched_yield
13995 eval $setvar
13996
13997 : see if pthread_yield exists
13998 set try -DPTHREAD_YIELD
13999 if eval $compile; then
14000     val="$define"
14001     case "$sched_yield" in
14002     '') sched_yield='pthread_yield()' ;;
14003     esac
14004 else
14005     set try -DPTHREAD_YIELD_NULL
14006     if eval $compile; then
14007         val="$define"
14008         case "$sched_yield" in
14009         '') sched_yield='pthread_yield(NULL)' ;;
14010         esac
14011     else
14012         val="$undef"
14013     fi
14014 fi
14015 case "$usethreads" in
14016 $define)
14017         case "$val" in
14018         $define) echo 'pthread_yield() found.' >&4      ;;
14019         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14020         esac
14021         ;;
14022 esac
14023 set d_pthread_yield
14024 eval $setvar
14025
14026 case "$sched_yield" in
14027 '') sched_yield=undef ;;
14028 esac
14029
14030 $rm -f try try.*
14031
14032 : see if random_r exists
14033 set random_r d_random_r
14034 eval $inlibc
14035 case "$d_random_r" in
14036 "$define")
14037         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14038         case "stdlib" in
14039         time)
14040                 hdrs="$hdrs $i_systime sys/time.h"
14041                 ;;
14042         esac
14043         case "$d_random_r_proto:$usethreads" in
14044         ":define")      d_random_r_proto=define
14045                 set d_random_r_proto random_r $hdrs
14046                 eval $hasproto ;;
14047         *)      ;;
14048         esac
14049         case "$d_random_r_proto" in
14050         define)
14051         case "$random_r_proto" in
14052         ''|0) try='int random_r(int*, struct random_data*);'
14053         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14054         esac
14055         case "$random_r_proto" in
14056         ''|0)   d_random_r=undef
14057                 random_r_proto=0
14058                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14059         * )     case "$random_r_proto" in
14060                 REENTRANT_PROTO*) ;;
14061                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14062                 esac
14063                 echo "Prototype: $try" ;;
14064         esac
14065         ;;
14066         *)      case "$usethreads" in
14067                 define) echo "random_r has no prototype, not using it." >&4 ;;
14068                 esac
14069                 d_random_r=undef
14070                 random_r_proto=0
14071                 ;;
14072         esac
14073         ;;
14074 *)      random_r_proto=0
14075         ;;
14076 esac
14077
14078 : see if readdir and friends exist
14079 set readdir d_readdir
14080 eval $inlibc
14081 set seekdir d_seekdir
14082 eval $inlibc
14083 set telldir d_telldir
14084 eval $inlibc
14085 set rewinddir d_rewinddir
14086 eval $inlibc
14087
14088 : see if readdir64_r exists
14089 set readdir64_r d_readdir64_r
14090 eval $inlibc
14091 case "$d_readdir64_r" in
14092 "$define")
14093         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14094         case "dirent" in
14095         time)
14096                 hdrs="$hdrs $i_systime sys/time.h"
14097                 ;;
14098         esac
14099         case "$d_readdir64_r_proto:$usethreads" in
14100         ":define")      d_readdir64_r_proto=define
14101                 set d_readdir64_r_proto readdir64_r $hdrs
14102                 eval $hasproto ;;
14103         *)      ;;
14104         esac
14105         case "$d_readdir64_r_proto" in
14106         define)
14107         case "$readdir64_r_proto" in
14108         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14109         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14110         esac
14111         case "$readdir64_r_proto" in
14112         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14113         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14114         esac
14115         case "$readdir64_r_proto" in
14116         ''|0)   d_readdir64_r=undef
14117                 readdir64_r_proto=0
14118                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14119         * )     case "$readdir64_r_proto" in
14120                 REENTRANT_PROTO*) ;;
14121                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14122                 esac
14123                 echo "Prototype: $try" ;;
14124         esac
14125         ;;
14126         *)      case "$usethreads" in
14127                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14128                 esac
14129                 d_readdir64_r=undef
14130                 readdir64_r_proto=0
14131                 ;;
14132         esac
14133         ;;
14134 *)      readdir64_r_proto=0
14135         ;;
14136 esac
14137
14138 : see if readdir_r exists
14139 set readdir_r d_readdir_r
14140 eval $inlibc
14141 case "$d_readdir_r" in
14142 "$define")
14143         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14144         case "dirent" in
14145         time)
14146                 hdrs="$hdrs $i_systime sys/time.h"
14147                 ;;
14148         esac
14149         case "$d_readdir_r_proto:$usethreads" in
14150         ":define")      d_readdir_r_proto=define
14151                 set d_readdir_r_proto readdir_r $hdrs
14152                 eval $hasproto ;;
14153         *)      ;;
14154         esac
14155         case "$d_readdir_r_proto" in
14156         define)
14157         case "$readdir_r_proto" in
14158         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14159         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14160         esac
14161         case "$readdir_r_proto" in
14162         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14163         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14164         esac
14165         case "$readdir_r_proto" in
14166         ''|0)   d_readdir_r=undef
14167                 readdir_r_proto=0
14168                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14169         * )     case "$readdir_r_proto" in
14170                 REENTRANT_PROTO*) ;;
14171                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14172                 esac
14173                 echo "Prototype: $try" ;;
14174         esac
14175         ;;
14176         *)      case "$usethreads" in
14177                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14178                 esac
14179                 d_readdir_r=undef
14180                 readdir_r_proto=0
14181                 ;;
14182         esac
14183         ;;
14184 *)      readdir_r_proto=0
14185         ;;
14186 esac
14187
14188 : see if readv exists
14189 set readv d_readv
14190 eval $inlibc
14191
14192 : see if recvmsg exists
14193 set recvmsg d_recvmsg
14194 eval $inlibc
14195
14196 : see if rename exists
14197 set rename d_rename
14198 eval $inlibc
14199
14200 : see if rmdir exists
14201 set rmdir d_rmdir
14202 eval $inlibc
14203
14204 : see if memory.h is available.
14205 val=''
14206 set memory.h val
14207 eval $inhdr
14208
14209 : See if it conflicts with string.h
14210 case "$val" in
14211 $define)
14212         case "$strings" in
14213         '') ;;
14214         *)
14215                 $cppstdin $cppflags $cppminus < $strings > mem.h
14216                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14217                         echo " "
14218                         echo "We won't be including <memory.h>."
14219                         val="$undef"
14220                 fi
14221                 $rm -f mem.h
14222                 ;;
14223         esac
14224 esac
14225 set i_memory
14226 eval $setvar
14227
14228 : can bcopy handle overlapping blocks?
14229 echo " "
14230 val="$undef"
14231 case "$d_memmove" in
14232 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14233 *)      case "$d_bcopy" in
14234         "$define")
14235                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14236                 $cat >try.c <<EOCP
14237 #$i_memory I_MEMORY
14238 #$i_stdlib I_STDLIB
14239 #$i_string I_STRING
14240 #$i_unistd I_UNISTD
14241 EOCP
14242         $cat >>try.c <<'EOCP'
14243 #include <stdio.h>
14244 #ifdef I_MEMORY
14245 #  include <memory.h>
14246 #endif
14247 #ifdef I_STDLIB
14248 #  include <stdlib.h>
14249 #endif
14250 #ifdef I_STRING
14251 #  include <string.h>
14252 #else
14253 #  include <strings.h>
14254 #endif
14255 #ifdef I_UNISTD
14256 #  include <unistd.h>  /* Needed for NetBSD */
14257 #endif
14258 int main()
14259 {
14260 char buf[128], abc[128];
14261 char *b;
14262 int len;
14263 int off;
14264 int align;
14265
14266 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14267    try to store the string in read-only memory. */
14268 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14269
14270 for (align = 7; align >= 0; align--) {
14271         for (len = 36; len; len--) {
14272                 b = buf+align;
14273                 bcopy(abc, b, len);
14274                 for (off = 1; off <= len; off++) {
14275                         bcopy(b, b+off, len);
14276                         bcopy(b+off, b, len);
14277                         if (bcmp(b, abc, len))
14278                                 exit(1);
14279                 }
14280         }
14281 }
14282 exit(0);
14283 }
14284 EOCP
14285                 set try
14286                 if eval $compile_ok; then
14287                         if ./try 2>/dev/null; then
14288                                 echo "Yes, it can."
14289                                 val="$define"
14290                         else
14291                                 echo "It can't, sorry."
14292                         fi
14293                 else
14294                         echo "(I can't compile the test program, so we'll assume not...)"
14295                 fi
14296                 ;;
14297         esac
14298         $rm -f try.* try core
14299         ;;
14300 esac
14301 set d_safebcpy
14302 eval $setvar
14303
14304 : can memcpy handle overlapping blocks?
14305 echo " "
14306 val="$undef"
14307 case "$d_memmove" in
14308 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14309 *)      case "$d_memcpy" in
14310         "$define")
14311                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14312                 $cat >try.c <<EOCP
14313 #$i_memory I_MEMORY
14314 #$i_stdlib I_STDLIB
14315 #$i_string I_STRING
14316 #$i_unistd I_UNISTD
14317 EOCP
14318         $cat >>try.c <<'EOCP'
14319 #include <stdio.h>
14320 #ifdef I_MEMORY
14321 #  include <memory.h>
14322 #endif
14323 #ifdef I_STDLIB
14324 #  include <stdlib.h>
14325 #endif
14326 #ifdef I_STRING
14327 #  include <string.h>
14328 #else
14329 #  include <strings.h>
14330 #endif
14331 #ifdef I_UNISTD
14332 #  include <unistd.h>  /* Needed for NetBSD */
14333 #endif
14334 int main()
14335 {
14336 char buf[128], abc[128];
14337 char *b;
14338 int len;
14339 int off;
14340 int align;
14341
14342 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14343    try to store the string in read-only memory. */
14344 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14345
14346 for (align = 7; align >= 0; align--) {
14347         for (len = 36; len; len--) {
14348                 b = buf+align;
14349                 memcpy(b, abc, len);
14350                 for (off = 1; off <= len; off++) {
14351                         memcpy(b+off, b, len);
14352                         memcpy(b, b+off, len);
14353                         if (memcmp(b, abc, len))
14354                                 exit(1);
14355                 }
14356         }
14357 }
14358 exit(0);
14359 }
14360 EOCP
14361                 set try
14362                 if eval $compile_ok; then
14363                         if ./try 2>/dev/null; then
14364                                 echo "Yes, it can."
14365                                 val="$define"
14366                         else
14367                                 echo "It can't, sorry."
14368                         fi
14369                 else
14370                         echo "(I can't compile the test program, so we'll assume not...)"
14371                 fi
14372                 ;;
14373         esac
14374         $rm -f try.* try core
14375         ;;
14376 esac
14377 set d_safemcpy
14378 eval $setvar
14379
14380 : can memcmp be trusted to compare relative magnitude?
14381 val="$undef"
14382 case "$d_memcmp" in
14383 "$define")
14384         echo " "
14385         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14386         $cat >try.c <<EOCP
14387 #$i_memory I_MEMORY
14388 #$i_stdlib I_STDLIB
14389 #$i_string I_STRING
14390 #$i_unistd I_UNISTD
14391 EOCP
14392         $cat >>try.c <<'EOCP'
14393 #include <stdio.h>
14394 #ifdef I_MEMORY
14395 #  include <memory.h>
14396 #endif
14397 #ifdef I_STDLIB
14398 #  include <stdlib.h>
14399 #endif
14400 #ifdef I_STRING
14401 #  include <string.h>
14402 #else
14403 #  include <strings.h>
14404 #endif
14405 #ifdef I_UNISTD
14406 #  include <unistd.h>  /* Needed for NetBSD */
14407 #endif
14408 int main()
14409 {
14410 char a = -1;
14411 char b = 0;
14412 if ((a < b) && memcmp(&a, &b, 1) < 0)
14413         exit(1);
14414 exit(0);
14415 }
14416 EOCP
14417         set try
14418         if eval $compile_ok; then
14419                 if $run ./try 2>/dev/null; then
14420                         echo "Yes, it can."
14421                         val="$define"
14422                 else
14423                         echo "No, it can't (it uses signed chars)."
14424                 fi
14425         else
14426                 echo "(I can't compile the test program, so we'll assume not...)"
14427         fi
14428         ;;
14429 esac
14430 $rm -f try.* try core
14431 set d_sanemcmp
14432 eval $setvar
14433
14434 : see if prototype for sbrk is available
14435 echo " "
14436 set d_sbrkproto sbrk $i_unistd unistd.h
14437 eval $hasproto
14438
14439 : see if select exists
14440 set select d_select
14441 eval $inlibc
14442
14443 : see if semctl exists
14444 set semctl d_semctl
14445 eval $inlibc
14446
14447 : see if semget exists
14448 set semget d_semget
14449 eval $inlibc
14450
14451 : see if semop exists
14452 set semop d_semop
14453 eval $inlibc
14454
14455 : see how much of the 'sem*(2)' library is present.
14456 h_sem=true
14457 echo " "
14458 case "$d_semctl$d_semget$d_semop" in
14459 *"$undef"*) h_sem=false;;
14460 esac
14461 case "$osname" in
14462 freebsd)
14463     case "`ipcs 2>&1`" in
14464     "SVID messages"*"not configured"*)
14465         echo "Your $osname does not have the sem*(2) configured." >&4
14466         h_sem=false
14467         val="$undef"
14468         set semctl d_semctl
14469         eval $setvar
14470         set semget d_semget
14471         eval $setvar
14472         set semop d_semop
14473         eval $setvar
14474         ;;
14475     esac
14476     ;;
14477 esac
14478 : we could also check for sys/ipc.h ...
14479 if $h_sem && $test `./findhdr sys/sem.h`; then
14480         echo "You have the full sem*(2) library." >&4
14481         val="$define"
14482 else
14483         echo "You don't have the full sem*(2) library." >&4
14484         val="$undef"
14485 fi
14486 set d_sem
14487 eval $setvar
14488
14489 : see whether sys/sem.h defines union semun
14490 echo " "
14491 $cat > try.c <<'END'
14492 #include <sys/types.h>
14493 #include <sys/ipc.h>
14494 #include <sys/sem.h>
14495 int main () { union semun semun; semun.buf = 0; }
14496 END
14497 set try
14498 if eval $compile; then
14499     echo "You have union semun in <sys/sem.h>." >&4
14500     val="$define"
14501 else
14502     echo "You do not have union semun in <sys/sem.h>." >&4
14503     val="$undef"
14504 fi
14505 $rm -f try try.c try.h
14506 set d_union_semun
14507 eval $setvar
14508
14509 : see how to do semctl IPC_STAT
14510 case "$d_sem" in
14511 $define)
14512     : see whether semctl IPC_STAT can use union semun
14513     echo " "
14514     $cat > try.h <<END
14515 #ifndef S_IRUSR
14516 #   ifdef S_IREAD
14517 #       define S_IRUSR S_IREAD
14518 #       define S_IWUSR S_IWRITE
14519 #       define S_IXUSR S_IEXEC
14520 #   else
14521 #       define S_IRUSR 0400
14522 #       define S_IWUSR 0200
14523 #       define S_IXUSR 0100
14524 #   endif
14525 #   define S_IRGRP (S_IRUSR>>3)
14526 #   define S_IWGRP (S_IWUSR>>3)
14527 #   define S_IXGRP (S_IXUSR>>3)
14528 #   define S_IROTH (S_IRUSR>>6)
14529 #   define S_IWOTH (S_IWUSR>>6)
14530 #   define S_IXOTH (S_IXUSR>>6)
14531 #endif
14532 #ifndef S_IRWXU
14533 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14534 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14535 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14536 #endif
14537 END
14538
14539     $cat > try.c <<END
14540 #include <sys/types.h>
14541 #include <sys/ipc.h>
14542 #include <sys/sem.h>
14543 #include <sys/stat.h>
14544 #include <stdio.h>
14545 #include <errno.h>
14546 #include "try.h"
14547 #ifndef errno
14548 extern int errno;
14549 #endif
14550 #$d_union_semun HAS_UNION_SEMUN
14551 int main() {
14552     union semun
14553 #ifndef HAS_UNION_SEMUN
14554     {
14555         int val;
14556         struct semid_ds *buf;
14557         unsigned short *array;
14558     }
14559 #endif
14560     arg;
14561     int sem, st;
14562
14563 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14564     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14565     if (sem > -1) {
14566         struct semid_ds argbuf;
14567         arg.buf = &argbuf;
14568 #       ifdef IPC_STAT
14569         st = semctl(sem, 0, IPC_STAT, arg);
14570         if (st == 0)
14571             printf("semun\n");
14572         else
14573 #       endif /* IPC_STAT */
14574             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14575 #       ifdef IPC_RMID
14576         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14577 #       endif /* IPC_RMID */
14578             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14579     } else
14580 #endif /* IPC_PRIVATE && ... */
14581         printf("semget failed: errno = %d\n", errno);
14582   return 0;
14583 }
14584 END
14585     val="$undef"
14586     set try
14587     if eval $compile; then
14588         xxx=`$run ./try`
14589         case "$xxx" in
14590         semun) val="$define" ;;
14591         esac
14592     fi
14593     $rm -f try try.c
14594     set d_semctl_semun
14595     eval $setvar
14596     case "$d_semctl_semun" in
14597     $define)
14598         echo "You can use union semun for semctl IPC_STAT." >&4
14599         also='also'
14600         ;;
14601     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14602         also=''
14603         ;;
14604     esac
14605
14606     : see whether semctl IPC_STAT can use struct semid_ds pointer
14607     $cat > try.c <<'END'
14608 #include <sys/types.h>
14609 #include <sys/ipc.h>
14610 #include <sys/sem.h>
14611 #include <sys/stat.h>
14612 #include "try.h"
14613 #include <stdio.h>
14614 #include <errno.h>
14615 #ifndef errno
14616 extern int errno;
14617 #endif
14618 int main() {
14619     struct semid_ds arg;
14620     int sem, st;
14621
14622 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14623     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14624     if (sem > -1) {
14625 #       ifdef IPC_STAT
14626         st = semctl(sem, 0, IPC_STAT, &arg);
14627         if (st == 0)
14628             printf("semid_ds\n");
14629         else
14630 #       endif /* IPC_STAT */
14631             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14632 #       ifdef IPC_RMID
14633         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14634 #       endif /* IPC_RMID */
14635             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14636     } else
14637 #endif /* IPC_PRIVATE && ... */
14638         printf("semget failed: errno = %d\n", errno);
14639
14640     return 0;
14641 }
14642 END
14643     val="$undef"
14644     set try
14645     if eval $compile; then
14646         xxx=`$run ./try`
14647         case "$xxx" in
14648         semid_ds) val="$define" ;;
14649         esac
14650     fi
14651     $rm -f try try.c
14652     set d_semctl_semid_ds
14653     eval $setvar
14654     case "$d_semctl_semid_ds" in
14655     $define)
14656         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14657         ;;
14658     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14659         ;;
14660     esac
14661     $rm -f try.h
14662     ;;
14663 *)  val="$undef"
14664
14665     # We do not have the full sem*(2) library, so assume we can not
14666     # use either.
14667
14668     set d_semctl_semun
14669     eval $setvar
14670
14671     set d_semctl_semid_ds
14672     eval $setvar
14673     ;;
14674 esac
14675
14676 : see if sendmsg exists
14677 set sendmsg d_sendmsg
14678 eval $inlibc
14679
14680 : see if setegid exists
14681 set setegid d_setegid
14682 eval $inlibc
14683
14684 : see if seteuid exists
14685 set seteuid d_seteuid
14686 eval $inlibc
14687
14688 : see if setgrent exists
14689 set setgrent d_setgrent
14690 eval $inlibc
14691
14692 : see if setgrent_r exists
14693 set setgrent_r d_setgrent_r
14694 eval $inlibc
14695 case "$d_setgrent_r" in
14696 "$define")
14697         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14698         case "grp" in
14699         time)
14700                 hdrs="$hdrs $i_systime sys/time.h"
14701                 ;;
14702         esac
14703         case "$d_setgrent_r_proto:$usethreads" in
14704         ":define")      d_setgrent_r_proto=define
14705                 set d_setgrent_r_proto setgrent_r $hdrs
14706                 eval $hasproto ;;
14707         *)      ;;
14708         esac
14709         case "$d_setgrent_r_proto" in
14710         define)
14711         case "$setgrent_r_proto" in
14712         ''|0) try='int setgrent_r(FILE**);'
14713         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14714         esac
14715         case "$setgrent_r_proto" in
14716         ''|0) try='void setgrent_r(FILE**);'
14717         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14718         esac
14719         case "$setgrent_r_proto" in
14720         ''|0)   d_setgrent_r=undef
14721                 setgrent_r_proto=0
14722                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14723         * )     case "$setgrent_r_proto" in
14724                 REENTRANT_PROTO*) ;;
14725                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14726                 esac
14727                 echo "Prototype: $try" ;;
14728         esac
14729         ;;
14730         *)      case "$usethreads" in
14731                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14732                 esac
14733                 d_setgrent_r=undef
14734                 setgrent_r_proto=0
14735                 ;;
14736         esac
14737         ;;
14738 *)      setgrent_r_proto=0
14739         ;;
14740 esac
14741
14742 : see if sethostent exists
14743 set sethostent d_sethent
14744 eval $inlibc
14745
14746 : see if sethostent_r exists
14747 set sethostent_r d_sethostent_r
14748 eval $inlibc
14749 case "$d_sethostent_r" in
14750 "$define")
14751         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14752         case "netdb" in
14753         time)
14754                 hdrs="$hdrs $i_systime sys/time.h"
14755                 ;;
14756         esac
14757         case "$d_sethostent_r_proto:$usethreads" in
14758         ":define")      d_sethostent_r_proto=define
14759                 set d_sethostent_r_proto sethostent_r $hdrs
14760                 eval $hasproto ;;
14761         *)      ;;
14762         esac
14763         case "$d_sethostent_r_proto" in
14764         define)
14765         case "$sethostent_r_proto" in
14766         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14767         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14768         esac
14769         case "$sethostent_r_proto" in
14770         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14771         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14772         esac
14773         case "$sethostent_r_proto" in
14774         ''|0)   d_sethostent_r=undef
14775                 sethostent_r_proto=0
14776                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14777         * )     case "$sethostent_r_proto" in
14778                 REENTRANT_PROTO*) ;;
14779                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14780                 esac
14781                 echo "Prototype: $try" ;;
14782         esac
14783         ;;
14784         *)      case "$usethreads" in
14785                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14786                 esac
14787                 d_sethostent_r=undef
14788                 sethostent_r_proto=0
14789                 ;;
14790         esac
14791         ;;
14792 *)      sethostent_r_proto=0
14793         ;;
14794 esac
14795
14796 : see if setitimer exists
14797 set setitimer d_setitimer
14798 eval $inlibc
14799
14800 : see if setlinebuf exists
14801 set setlinebuf d_setlinebuf
14802 eval $inlibc
14803
14804 : see if setlocale exists
14805 set setlocale d_setlocale
14806 eval $inlibc
14807
14808 : see if locale.h is available
14809 set locale.h i_locale
14810 eval $inhdr
14811
14812 : see if setlocale_r exists
14813 set setlocale_r d_setlocale_r
14814 eval $inlibc
14815 case "$d_setlocale_r" in
14816 "$define")
14817         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14818         case "locale" in
14819         time)
14820                 hdrs="$hdrs $i_systime sys/time.h"
14821                 ;;
14822         esac
14823         case "$d_setlocale_r_proto:$usethreads" in
14824         ":define")      d_setlocale_r_proto=define
14825                 set d_setlocale_r_proto setlocale_r $hdrs
14826                 eval $hasproto ;;
14827         *)      ;;
14828         esac
14829         case "$d_setlocale_r_proto" in
14830         define)
14831         case "$setlocale_r_proto" in
14832         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14833         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14834         esac
14835         case "$setlocale_r_proto" in
14836         ''|0)   d_setlocale_r=undef
14837                 setlocale_r_proto=0
14838                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14839         * )     case "$setlocale_r_proto" in
14840                 REENTRANT_PROTO*) ;;
14841                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14842                 esac
14843                 echo "Prototype: $try" ;;
14844         esac
14845         ;;
14846         *)      case "$usethreads" in
14847                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14848                 esac
14849                 d_setlocale_r=undef
14850                 setlocale_r_proto=0
14851                 ;;
14852         esac
14853         ;;
14854 *)      setlocale_r_proto=0
14855         ;;
14856 esac
14857
14858 : see if setnetent exists
14859 set setnetent d_setnent
14860 eval $inlibc
14861
14862 : see if setnetent_r exists
14863 set setnetent_r d_setnetent_r
14864 eval $inlibc
14865 case "$d_setnetent_r" in
14866 "$define")
14867         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14868         case "netdb" in
14869         time)
14870                 hdrs="$hdrs $i_systime sys/time.h"
14871                 ;;
14872         esac
14873         case "$d_setnetent_r_proto:$usethreads" in
14874         ":define")      d_setnetent_r_proto=define
14875                 set d_setnetent_r_proto setnetent_r $hdrs
14876                 eval $hasproto ;;
14877         *)      ;;
14878         esac
14879         case "$d_setnetent_r_proto" in
14880         define)
14881         case "$setnetent_r_proto" in
14882         ''|0) try='int setnetent_r(int, struct netent_data*);'
14883         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14884         esac
14885         case "$setnetent_r_proto" in
14886         ''|0) try='void setnetent_r(int, struct netent_data*);'
14887         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14888         esac
14889         case "$setnetent_r_proto" in
14890         ''|0)   d_setnetent_r=undef
14891                 setnetent_r_proto=0
14892                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14893         * )     case "$setnetent_r_proto" in
14894                 REENTRANT_PROTO*) ;;
14895                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14896                 esac
14897                 echo "Prototype: $try" ;;
14898         esac
14899         ;;
14900         *)      case "$usethreads" in
14901                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14902                 esac
14903                 d_setnetent_r=undef
14904                 setnetent_r_proto=0
14905                 ;;
14906         esac
14907         ;;
14908 *)      setnetent_r_proto=0
14909         ;;
14910 esac
14911
14912 : see if setprotoent exists
14913 set setprotoent d_setpent
14914 eval $inlibc
14915
14916 : see if setpgid exists
14917 set setpgid d_setpgid
14918 eval $inlibc
14919
14920 : see if setpgrp2 exists
14921 set setpgrp2 d_setpgrp2
14922 eval $inlibc
14923
14924 : see if setpriority exists
14925 set setpriority d_setprior
14926 eval $inlibc
14927
14928 : see if setproctitle exists
14929 set setproctitle d_setproctitle
14930 eval $inlibc
14931
14932 : see if setprotoent_r exists
14933 set setprotoent_r d_setprotoent_r
14934 eval $inlibc
14935 case "$d_setprotoent_r" in
14936 "$define")
14937         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14938         case "netdb" in
14939         time)
14940                 hdrs="$hdrs $i_systime sys/time.h"
14941                 ;;
14942         esac
14943         case "$d_setprotoent_r_proto:$usethreads" in
14944         ":define")      d_setprotoent_r_proto=define
14945                 set d_setprotoent_r_proto setprotoent_r $hdrs
14946                 eval $hasproto ;;
14947         *)      ;;
14948         esac
14949         case "$d_setprotoent_r_proto" in
14950         define)
14951         case "$setprotoent_r_proto" in
14952         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14953         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14954         esac
14955         case "$setprotoent_r_proto" in
14956         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14957         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14958         esac
14959         case "$setprotoent_r_proto" in
14960         ''|0)   d_setprotoent_r=undef
14961                 setprotoent_r_proto=0
14962                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14963         * )     case "$setprotoent_r_proto" in
14964                 REENTRANT_PROTO*) ;;
14965                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14966                 esac
14967                 echo "Prototype: $try" ;;
14968         esac
14969         ;;
14970         *)      case "$usethreads" in
14971                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14972                 esac
14973                 d_setprotoent_r=undef
14974                 setprotoent_r_proto=0
14975                 ;;
14976         esac
14977         ;;
14978 *)      setprotoent_r_proto=0
14979         ;;
14980 esac
14981
14982 : see if setpwent exists
14983 set setpwent d_setpwent
14984 eval $inlibc
14985
14986 : see if setpwent_r exists
14987 set setpwent_r d_setpwent_r
14988 eval $inlibc
14989 case "$d_setpwent_r" in
14990 "$define")
14991         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14992         case "pwd" in
14993         time)
14994                 hdrs="$hdrs $i_systime sys/time.h"
14995                 ;;
14996         esac
14997         case "$d_setpwent_r_proto:$usethreads" in
14998         ":define")      d_setpwent_r_proto=define
14999                 set d_setpwent_r_proto setpwent_r $hdrs
15000                 eval $hasproto ;;
15001         *)      ;;
15002         esac
15003         case "$d_setpwent_r_proto" in
15004         define)
15005         case "$setpwent_r_proto" in
15006         ''|0) try='int setpwent_r(FILE**);'
15007         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15008         esac
15009         case "$setpwent_r_proto" in
15010         ''|0) try='void setpwent_r(FILE**);'
15011         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15012         esac
15013         case "$setpwent_r_proto" in
15014         ''|0)   d_setpwent_r=undef
15015                 setpwent_r_proto=0
15016                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15017         * )     case "$setpwent_r_proto" in
15018                 REENTRANT_PROTO*) ;;
15019                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15020                 esac
15021                 echo "Prototype: $try" ;;
15022         esac
15023         ;;
15024         *)      case "$usethreads" in
15025                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15026                 esac
15027                 d_setpwent_r=undef
15028                 setpwent_r_proto=0
15029                 ;;
15030         esac
15031         ;;
15032 *)      setpwent_r_proto=0
15033         ;;
15034 esac
15035
15036 : see if setregid exists
15037 set setregid d_setregid
15038 eval $inlibc
15039 set setresgid d_setresgid
15040 eval $inlibc
15041
15042 : see if setreuid exists
15043 set setreuid d_setreuid
15044 eval $inlibc
15045 set setresuid d_setresuid
15046 eval $inlibc
15047
15048 : see if setrgid exists
15049 set setrgid d_setrgid
15050 eval $inlibc
15051
15052 : see if setruid exists
15053 set setruid d_setruid
15054 eval $inlibc
15055
15056 : see if setservent exists
15057 set setservent d_setsent
15058 eval $inlibc
15059
15060 : see if setservent_r exists
15061 set setservent_r d_setservent_r
15062 eval $inlibc
15063 case "$d_setservent_r" in
15064 "$define")
15065         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15066         case "netdb" in
15067         time)
15068                 hdrs="$hdrs $i_systime sys/time.h"
15069                 ;;
15070         esac
15071         case "$d_setservent_r_proto:$usethreads" in
15072         ":define")      d_setservent_r_proto=define
15073                 set d_setservent_r_proto setservent_r $hdrs
15074                 eval $hasproto ;;
15075         *)      ;;
15076         esac
15077         case "$d_setservent_r_proto" in
15078         define)
15079         case "$setservent_r_proto" in
15080         ''|0) try='int setservent_r(int, struct servent_data*);'
15081         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15082         esac
15083         case "$setservent_r_proto" in
15084         ''|0) try='void setservent_r(int, struct servent_data*);'
15085         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15086         esac
15087         case "$setservent_r_proto" in
15088         ''|0)   d_setservent_r=undef
15089                 setservent_r_proto=0
15090                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15091         * )     case "$setservent_r_proto" in
15092                 REENTRANT_PROTO*) ;;
15093                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15094                 esac
15095                 echo "Prototype: $try" ;;
15096         esac
15097         ;;
15098         *)      case "$usethreads" in
15099                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15100                 esac
15101                 d_setservent_r=undef
15102                 setservent_r_proto=0
15103                 ;;
15104         esac
15105         ;;
15106 *)      setservent_r_proto=0
15107         ;;
15108 esac
15109
15110 : see if setsid exists
15111 set setsid d_setsid
15112 eval $inlibc
15113
15114 : see if setvbuf exists
15115 set setvbuf d_setvbuf
15116 eval $inlibc
15117
15118 : see if sfio.h is available
15119 set sfio.h i_sfio
15120 eval $inhdr
15121
15122
15123 : see if sfio library is available
15124 case "$i_sfio" in
15125 $define)
15126         val=''
15127         set sfreserve val
15128         eval $inlibc
15129         ;;
15130 *)
15131         val="$undef"
15132         ;;
15133 esac
15134 : Ok, but do we want to use it.
15135 case "$val" in
15136 $define)
15137         case "$usesfio" in
15138         true|$define|[yY]*) dflt='y';;
15139         *) dflt='n';;
15140         esac
15141         echo "$package can use the sfio library, but it is experimental."
15142         case "$useperlio" in
15143         "$undef")
15144             echo "For sfio also the PerlIO abstraction layer is needed."
15145             echo "Earlier you said you wouldn't want that."
15146             ;;
15147         esac
15148         rp="You seem to have sfio available, do you want to try using it?"
15149         . ./myread
15150         case "$ans" in
15151         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15152                 useperlio="$define"
15153                 val="$define"
15154                 ;;
15155         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15156                 val="$undef"
15157                 ;;
15158         esac
15159         ;;
15160 *)      case "$usesfio" in
15161         true|$define|[yY]*)
15162                 echo "Sorry, cannot find sfio on this machine." >&4
15163                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15164                 val="$undef"
15165                 ;;
15166         esac
15167         ;;
15168 esac
15169 set d_sfio
15170 eval $setvar
15171 case "$d_sfio" in
15172 $define) usesfio='true';;
15173 *) usesfio='false';;
15174 esac
15175 case "$d_sfio" in
15176 $define) ;;
15177 *)      : Remove sfio from list of libraries to use
15178         case "$libs" in
15179         *-lsfio*)
15180                 echo "Removing unneeded -lsfio from library list" >&4
15181                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15182                 shift
15183                 libs="$*"
15184                 echo "libs = $libs" >&4
15185                 ;;
15186         esac
15187 ;;
15188 esac
15189
15190
15191 : see if shmctl exists
15192 set shmctl d_shmctl
15193 eval $inlibc
15194
15195 : see if shmget exists
15196 set shmget d_shmget
15197 eval $inlibc
15198
15199 : see if shmat exists
15200 set shmat d_shmat
15201 eval $inlibc
15202 : see what shmat returns
15203 case "$d_shmat" in
15204 "$define")
15205         $cat >shmat.c <<'END'
15206 #include <sys/shm.h>
15207 void *shmat();
15208 END
15209         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15210                 shmattype='void *'
15211         else
15212                 shmattype='char *'
15213         fi
15214         echo "and it returns ($shmattype)." >&4
15215         : see if a prototype for shmat is available
15216         xxx=`./findhdr sys/shm.h`
15217         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15218         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15219                 val="$define"
15220         else
15221                 val="$undef"
15222         fi
15223         $rm -f shmat.[co]
15224         ;;
15225 *)
15226         val="$undef"
15227         ;;
15228 esac
15229 set d_shmatprototype
15230 eval $setvar
15231
15232 : see if shmdt exists
15233 set shmdt d_shmdt
15234 eval $inlibc
15235
15236 : see how much of the 'shm*(2)' library is present.
15237 h_shm=true
15238 echo " "
15239 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15240 *"$undef"*) h_shm=false;;
15241 esac
15242 case "$osname" in
15243 freebsd)
15244     case "`ipcs 2>&1`" in
15245     "SVID shared memory"*"not configured"*)
15246         echo "Your $osname does not have the shm*(2) configured." >&4
15247         h_shm=false
15248         val="$undef"
15249         set shmctl d_shmctl
15250         evat $setvar
15251         set shmget d_shmget
15252         evat $setvar
15253         set shmat d_shmat
15254         evat $setvar
15255         set shmdt d_shmdt
15256         evat $setvar
15257         ;;
15258     esac
15259     ;;
15260 esac
15261 : we could also check for sys/ipc.h ...
15262 if $h_shm && $test `./findhdr sys/shm.h`; then
15263         echo "You have the full shm*(2) library." >&4
15264         val="$define"
15265 else
15266         echo "You don't have the full shm*(2) library." >&4
15267         val="$undef"
15268 fi
15269 set d_shm
15270 eval $setvar
15271
15272 echo " "
15273 : see if we have sigaction
15274 if set sigaction val -f d_sigaction; eval $csym; $val; then
15275         echo 'sigaction() found.' >&4
15276         $cat > try.c <<'EOP'
15277 #include <stdio.h>
15278 #include <sys/types.h>
15279 #include <signal.h>
15280 int main()
15281 {
15282     struct sigaction act, oact;
15283     act.sa_flags = 0;
15284     oact.sa_handler = 0;
15285     /* so that act and oact are used */
15286     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15287 }
15288 EOP
15289         set try
15290         if eval $compile_ok; then
15291                 val="$define"
15292         else
15293                 echo "But you don't seem to have a useable struct sigaction." >&4
15294                 val="$undef"
15295         fi
15296 else
15297         echo 'sigaction NOT found.' >&4
15298         val="$undef"
15299 fi
15300 set d_sigaction; eval $setvar
15301 $rm -f try try$_o try.c
15302
15303 : see if sigprocmask exists
15304 set sigprocmask d_sigprocmask
15305 eval $inlibc
15306
15307 : see if sigsetjmp exists
15308 echo " "
15309 case "$d_sigsetjmp" in
15310 '')
15311         $cat >try.c <<'EOP'
15312 #include <setjmp.h>
15313 sigjmp_buf env;
15314 int set = 1;
15315 int main()
15316 {
15317         if (sigsetjmp(env,1))
15318                 exit(set);
15319         set = 0;
15320         siglongjmp(env, 1);
15321         exit(1);
15322 }
15323 EOP
15324         set try
15325         if eval $compile; then
15326                 if $run ./try >/dev/null 2>&1; then
15327                         echo "POSIX sigsetjmp found." >&4
15328                         val="$define"
15329                 else
15330                         $cat >&4 <<EOM
15331 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15332 I'll ignore them.
15333 EOM
15334                         val="$undef"
15335                 fi
15336         else
15337                 echo "sigsetjmp not found." >&4
15338                 val="$undef"
15339         fi
15340         ;;
15341 *) val="$d_sigsetjmp"
15342         case "$d_sigsetjmp" in
15343         $define) echo "POSIX sigsetjmp found." >&4;;
15344         $undef) echo "sigsetjmp not found." >&4;;
15345         esac
15346         ;;
15347 esac
15348 set d_sigsetjmp
15349 eval $setvar
15350 $rm -f try.c try
15351
15352 : see if sockatmark exists
15353 set sockatmark d_sockatmark
15354 eval $inlibc
15355
15356 : see if prototype for sockatmark is available
15357 echo " "
15358 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15359 eval $hasproto
15360
15361 : see if socks5_init exists
15362 set socks5_init d_socks5_init
15363 eval $inlibc
15364
15365 : see if srand48_r exists
15366 set srand48_r d_srand48_r
15367 eval $inlibc
15368 case "$d_srand48_r" in
15369 "$define")
15370         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15371         case "stdlib" in
15372         time)
15373                 hdrs="$hdrs $i_systime sys/time.h"
15374                 ;;
15375         esac
15376         case "$d_srand48_r_proto:$usethreads" in
15377         ":define")      d_srand48_r_proto=define
15378                 set d_srand48_r_proto srand48_r $hdrs
15379                 eval $hasproto ;;
15380         *)      ;;
15381         esac
15382         case "$d_srand48_r_proto" in
15383         define)
15384         case "$srand48_r_proto" in
15385         ''|0) try='int srand48_r(long, struct drand48_data*);'
15386         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15387         esac
15388         case "$srand48_r_proto" in
15389         ''|0)   d_srand48_r=undef
15390                 srand48_r_proto=0
15391                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15392         * )     case "$srand48_r_proto" in
15393                 REENTRANT_PROTO*) ;;
15394                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15395                 esac
15396                 echo "Prototype: $try" ;;
15397         esac
15398         ;;
15399         *)      case "$usethreads" in
15400                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15401                 esac
15402                 d_srand48_r=undef
15403                 srand48_r_proto=0
15404                 ;;
15405         esac
15406         ;;
15407 *)      srand48_r_proto=0
15408         ;;
15409 esac
15410
15411 : see if srandom_r exists
15412 set srandom_r d_srandom_r
15413 eval $inlibc
15414 case "$d_srandom_r" in
15415 "$define")
15416         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15417         case "stdlib" in
15418         time)
15419                 hdrs="$hdrs $i_systime sys/time.h"
15420                 ;;
15421         esac
15422         case "$d_srandom_r_proto:$usethreads" in
15423         ":define")      d_srandom_r_proto=define
15424                 set d_srandom_r_proto srandom_r $hdrs
15425                 eval $hasproto ;;
15426         *)      ;;
15427         esac
15428         case "$d_srandom_r_proto" in
15429         define)
15430         case "$srandom_r_proto" in
15431         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15432         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15433         esac
15434         case "$srandom_r_proto" in
15435         ''|0)   d_srandom_r=undef
15436                 srandom_r_proto=0
15437                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15438         * )     case "$srandom_r_proto" in
15439                 REENTRANT_PROTO*) ;;
15440                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15441                 esac
15442                 echo "Prototype: $try" ;;
15443         esac
15444         ;;
15445         *)      case "$usethreads" in
15446                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15447                 esac
15448                 d_srandom_r=undef
15449                 srandom_r_proto=0
15450                 ;;
15451         esac
15452         ;;
15453 *)      srandom_r_proto=0
15454         ;;
15455 esac
15456
15457 : see if prototype for setresgid is available
15458 echo " "
15459 set d_sresgproto setresgid $i_unistd unistd.h
15460 eval $hasproto
15461
15462 : see if prototype for setresuid is available
15463 echo " "
15464 set d_sresuproto setresuid $i_unistd unistd.h
15465 eval $hasproto
15466
15467 : see if sys/stat.h is available
15468 set sys/stat.h i_sysstat
15469 eval $inhdr
15470
15471
15472 : see if stat knows about block sizes
15473 echo " "
15474 echo "Checking to see if your struct stat has st_blocks field..." >&4
15475 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15476 eval $hasfield
15477
15478
15479 : see if this is a sys/vfs.h system
15480 set sys/vfs.h i_sysvfs
15481 eval $inhdr
15482
15483
15484 : see if this is a sys/statfs.h system
15485 set sys/statfs.h i_sysstatfs
15486 eval $inhdr
15487
15488
15489 echo " "
15490 echo "Checking to see if your system supports struct statfs..." >&4
15491 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
15492 eval $hasstruct
15493 case "$d_statfs_s" in
15494 "$define")      echo "Yes, it does."   ;;
15495 *)              echo "No, it doesn't." ;;
15496 esac
15497
15498
15499
15500 : see if struct statfs knows about f_flags
15501 case "$d_statfs_s" in
15502 define) 
15503         echo " "
15504         echo "Checking to see if your struct statfs has f_flags field..." >&4
15505         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
15506         eval $hasfield
15507         ;;
15508 *)      val="$undef"
15509         set d_statfs_f_flags
15510         eval $setvar
15511         ;;
15512 esac
15513 case "$d_statfs_f_flags" in
15514 "$define")      echo "Yes, it does."   ;;
15515 *)              echo "No, it doesn't." ;;
15516 esac
15517
15518 : see if _ptr and _cnt from stdio act std
15519 echo " "
15520
15521 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15522         echo "(Looks like you have stdio.h from BSD.)"
15523         case "$stdio_ptr" in
15524         '') stdio_ptr='((fp)->_p)'
15525                 ptr_lval=$define
15526                 ;;
15527         *)      ptr_lval=$d_stdio_ptr_lval;;
15528         esac
15529         case "$stdio_cnt" in
15530         '') stdio_cnt='((fp)->_r)'
15531                 cnt_lval=$define
15532                 ;;
15533         *)      cnt_lval=$d_stdio_cnt_lval;;
15534         esac
15535         case "$stdio_base" in
15536         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15537         esac
15538         case "$stdio_bufsiz" in
15539         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15540         esac
15541 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15542         echo "(Looks like you have stdio.h from Linux.)"
15543         case "$stdio_ptr" in
15544         '') stdio_ptr='((fp)->_IO_read_ptr)'
15545                 ptr_lval=$define
15546                 ;;
15547         *)      ptr_lval=$d_stdio_ptr_lval;;
15548         esac
15549         case "$stdio_cnt" in
15550         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15551                 cnt_lval=$undef
15552                 ;;
15553         *)      cnt_lval=$d_stdio_cnt_lval;;
15554         esac
15555         case "$stdio_base" in
15556         '') stdio_base='((fp)->_IO_read_base)';;
15557         esac
15558         case "$stdio_bufsiz" in
15559         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15560         esac
15561 else
15562         case "$stdio_ptr" in
15563         '') stdio_ptr='((fp)->_ptr)'
15564                 ptr_lval=$define
15565                 ;;
15566         *)      ptr_lval=$d_stdio_ptr_lval;;
15567         esac
15568         case "$stdio_cnt" in
15569         '') stdio_cnt='((fp)->_cnt)'
15570                 cnt_lval=$define
15571                 ;;
15572         *)      cnt_lval=$d_stdio_cnt_lval;;
15573         esac
15574         case "$stdio_base" in
15575         '') stdio_base='((fp)->_base)';;
15576         esac
15577         case "$stdio_bufsiz" in
15578         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15579         esac
15580 fi
15581
15582 : test whether _ptr and _cnt really work
15583 echo "Checking how std your stdio is..." >&4
15584 $cat >try.c <<EOP
15585 #include <stdio.h>
15586 #define FILE_ptr(fp)    $stdio_ptr
15587 #define FILE_cnt(fp)    $stdio_cnt
15588 int main() {
15589         FILE *fp = fopen("try.c", "r");
15590         char c = getc(fp);
15591         if (
15592                 18 <= FILE_cnt(fp) &&
15593                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15594         )
15595                 exit(0);
15596         exit(1);
15597 }
15598 EOP
15599 val="$undef"
15600 set try
15601 if eval $compile && $to try.c; then
15602         if $run ./try; then
15603                 echo "Your stdio acts pretty std."
15604                 val="$define"
15605         else
15606                 echo "Your stdio isn't very std."
15607         fi
15608 else
15609         echo "Your stdio doesn't appear very std."
15610 fi
15611 $rm -f try.c try
15612 set d_stdstdio
15613 eval $setvar
15614
15615 : Can _ptr be used as an lvalue?
15616 case "$d_stdstdio$ptr_lval" in
15617 $define$define) val=$define ;;
15618 *) val=$undef ;;
15619 esac
15620 set d_stdio_ptr_lval
15621 eval $setvar
15622
15623 : Can _cnt be used as an lvalue?
15624 case "$d_stdstdio$cnt_lval" in
15625 $define$define) val=$define ;;
15626 *) val=$undef ;;
15627 esac
15628 set d_stdio_cnt_lval
15629 eval $setvar
15630
15631
15632 : test whether setting _ptr sets _cnt as a side effect
15633 d_stdio_ptr_lval_sets_cnt="$undef"
15634 d_stdio_ptr_lval_nochange_cnt="$undef"
15635 case "$d_stdio_ptr_lval$d_stdstdio" in
15636 $define$define)
15637         echo "Checking to see what happens if we set the stdio ptr..." >&4
15638 $cat >try.c <<EOP
15639 #include <stdio.h>
15640 /* Can we scream? */
15641 /* Eat dust sed :-) */
15642 /* In the buffer space, no one can hear you scream. */
15643 #define FILE_ptr(fp)    $stdio_ptr
15644 #define FILE_cnt(fp)    $stdio_cnt
15645 #include <sys/types.h>
15646 int main() {
15647         FILE *fp = fopen("try.c", "r");
15648         int c;
15649         char *ptr;
15650         size_t cnt;
15651         if (!fp) {
15652             puts("Fail even to read");
15653             exit(1);
15654         }
15655         c = getc(fp); /* Read away the first # */
15656         if (c == EOF) {
15657             puts("Fail even to read");
15658             exit(1);
15659         }
15660         if (!(
15661                 18 <= FILE_cnt(fp) &&
15662                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15663         )) {
15664                 puts("Fail even to read");
15665                 exit (1);
15666         }
15667         ptr = (char*) FILE_ptr(fp);
15668         cnt = (size_t)FILE_cnt(fp);
15669
15670         FILE_ptr(fp) += 42;
15671
15672         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15673                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15674                 exit (1);
15675         }
15676         if (FILE_cnt(fp) <= 20) {
15677                 printf ("Fail (<20 chars to test)");
15678                 exit (1);
15679         }
15680         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15681                 puts("Fail compare");
15682                 exit (1);
15683         }
15684         if (cnt == FILE_cnt(fp)) {
15685                 puts("Pass_unchanged");
15686                 exit (0);
15687         }       
15688         if (FILE_cnt(fp) == (cnt - 42)) {
15689                 puts("Pass_changed");
15690                 exit (0);
15691         }
15692         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15693         return 1;
15694
15695 }
15696 EOP
15697         set try
15698         if eval $compile && $to try.c; then
15699                 case `$run ./try` in
15700                 Pass_changed)
15701                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15702                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15703                 Pass_unchanged)
15704                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15705                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15706                 Fail*)
15707                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15708                 *)
15709                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15710         esac
15711         else
15712                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15713         fi
15714         $rm -f try.c try
15715         ;;
15716 esac
15717
15718 : see if _base is also standard
15719 val="$undef"
15720 case "$d_stdstdio" in
15721 $define)
15722         $cat >try.c <<EOP
15723 #include <stdio.h>
15724 #define FILE_base(fp)   $stdio_base
15725 #define FILE_bufsiz(fp) $stdio_bufsiz
15726 int main() {
15727         FILE *fp = fopen("try.c", "r");
15728         char c = getc(fp);
15729         if (
15730                 19 <= FILE_bufsiz(fp) &&
15731                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15732         )
15733                 exit(0);
15734         exit(1);
15735 }
15736 EOP
15737         set try
15738         if eval $compile && $to try.c; then
15739                 if $run ./try; then
15740                         echo "And its _base field acts std."
15741                         val="$define"
15742                 else
15743                         echo "But its _base field isn't std."
15744                 fi
15745         else
15746                 echo "However, it seems to be lacking the _base field."
15747         fi
15748         $rm -f try.c try
15749         ;;
15750 esac
15751 set d_stdiobase
15752 eval $setvar
15753
15754 $cat >&4 <<EOM
15755 Checking how to access stdio streams by file descriptor number...
15756 EOM
15757 case "$stdio_stream_array" in
15758 '')     $cat >try.c <<EOCP
15759 #include <stdio.h>
15760 int main() {
15761   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15762     printf("yes\n");
15763 }
15764 EOCP
15765         for s in _iob __iob __sF
15766         do
15767                 set try -DSTDIO_STREAM_ARRAY=$s
15768                 if eval $compile; then
15769                         case "`$run ./try`" in
15770                         yes)    stdio_stream_array=$s; break ;;
15771                         esac
15772                 fi
15773         done
15774         $rm -f try.* try$exe_ext
15775 esac
15776 case "$stdio_stream_array" in
15777 '')     $cat >&4 <<EOM
15778 I can't figure out how to access stdio streams by file descriptor number.
15779 EOM
15780         d_stdio_stream_array="$undef"
15781         ;;
15782 *)      $cat >&4 <<EOM
15783 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15784 EOM
15785         d_stdio_stream_array="$define"
15786         ;;
15787 esac
15788
15789 : see if strcoll exists
15790 set strcoll d_strcoll
15791 eval $inlibc
15792
15793 : check for structure copying
15794 echo " "
15795 echo "Checking to see if your C compiler can copy structs..." >&4
15796 $cat >try.c <<'EOCP'
15797 int main()
15798 {
15799         struct blurfl {
15800                 int dyick;
15801         } foo, bar;
15802
15803         foo = bar;
15804 }
15805 EOCP
15806 if $cc -c try.c >/dev/null 2>&1 ; then
15807         val="$define"
15808         echo "Yup, it can."
15809 else
15810         val="$undef"
15811         echo "Nope, it can't."
15812 fi
15813 set d_strctcpy
15814 eval $setvar
15815 $rm -f try.*
15816
15817 : see if strerror and/or sys_errlist[] exist
15818 echo " "
15819 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15820     if set strerror val -f d_strerror; eval $csym; $val; then
15821                 echo 'strerror() found.' >&4
15822                 d_strerror="$define"
15823                 d_strerrm='strerror(e)'
15824                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15825                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15826                         d_syserrlst="$define"
15827                 else
15828                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15829                         d_syserrlst="$undef"
15830                 fi
15831     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15832                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15833                 echo 'strerror() found in string header.' >&4
15834                 d_strerror="$define"
15835                 d_strerrm='strerror(e)'
15836                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15837                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15838                                 d_syserrlst="$define"
15839                 else
15840                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15841                         d_syserrlst="$undef"
15842                 fi
15843     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15844                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15845                 d_strerror="$undef"
15846                 d_syserrlst="$define"
15847                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15848     else
15849                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15850                 d_strerror="$undef"
15851                 d_syserrlst="$undef"
15852                 d_strerrm='"unknown"'
15853     fi
15854 fi
15855
15856 : see if strerror_r exists
15857 set strerror_r d_strerror_r
15858 eval $inlibc
15859 case "$d_strerror_r" in
15860 "$define")
15861         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15862         case "string" in
15863         time)
15864                 hdrs="$hdrs $i_systime sys/time.h"
15865                 ;;
15866         esac
15867         case "$d_strerror_r_proto:$usethreads" in
15868         ":define")      d_strerror_r_proto=define
15869                 set d_strerror_r_proto strerror_r $hdrs
15870                 eval $hasproto ;;
15871         *)      ;;
15872         esac
15873         case "$d_strerror_r_proto" in
15874         define)
15875         case "$strerror_r_proto" in
15876         ''|0) try='int strerror_r(int, char*, size_t);'
15877         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15878         esac
15879         case "$strerror_r_proto" in
15880         ''|0) try='int strerror_r(int, char*, int);'
15881         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15882         esac
15883         case "$strerror_r_proto" in
15884         ''|0) try='char* strerror_r(int, char*, size_t);'
15885         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15886         esac
15887         case "$strerror_r_proto" in
15888         ''|0)   d_strerror_r=undef
15889                 strerror_r_proto=0
15890                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15891         * )     case "$strerror_r_proto" in
15892                 REENTRANT_PROTO*) ;;
15893                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15894                 esac
15895                 echo "Prototype: $try" ;;
15896         esac
15897         ;;
15898         *)      case "$usethreads" in
15899                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15900                 esac
15901                 d_strerror_r=undef
15902                 strerror_r_proto=0
15903                 ;;
15904         esac
15905         ;;
15906 *)      strerror_r_proto=0
15907         ;;
15908 esac
15909
15910 : see if strftime exists
15911 set strftime d_strftime
15912 eval $inlibc
15913
15914 : see if strtod exists
15915 set strtod d_strtod
15916 eval $inlibc
15917
15918 : see if strtol exists
15919 set strtol d_strtol
15920 eval $inlibc
15921
15922 : see if strtold exists
15923 set strtold d_strtold
15924 eval $inlibc
15925
15926 : see if strtoll exists
15927 set strtoll d_strtoll
15928 eval $inlibc
15929
15930 case "$d_longlong-$d_strtoll" in
15931 "$define-$define")
15932         $cat <<EOM
15933 Checking whether your strtoll() works okay...
15934 EOM
15935         $cat >try.c <<'EOCP'
15936 #include <errno.h>
15937 #ifdef __hpux
15938 #define strtoll __strtoll
15939 #endif
15940 #ifdef __EMX__
15941 #define strtoll _strtoll
15942 #endif
15943 #include <stdio.h>
15944 extern long long int strtoll(char *s, char **, int); 
15945 static int bad = 0;
15946 int check(char *s, long long ell, int een) {
15947         long long gll;
15948         errno = 0;
15949         gll = strtoll(s, 0, 10);
15950         if (!((gll == ell) && (errno == een)))
15951                 bad++;
15952 }
15953 int main() {
15954         check(" 1",                                      1LL, 0);
15955         check(" 0",                                      0LL, 0);
15956         check("-1",                                     -1LL, 0);
15957         check("-9223372036854775808", -9223372036854775808LL, 0);
15958         check("-9223372036854775808", -9223372036854775808LL, 0);
15959         check(" 9223372036854775807",  9223372036854775807LL, 0);
15960         check("-9223372036854775808", -9223372036854775808LL, 0);
15961         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15962         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15963         if (!bad)
15964                 printf("ok\n");
15965 }
15966 EOCP
15967         set try
15968         if eval $compile; then
15969                 yyy=`$run ./try`
15970                 case "$yyy" in
15971                 ok) echo "Your strtoll() seems to be working okay." ;;
15972                 *) cat <<EOM >&4
15973 Your strtoll() doesn't seem to be working okay.
15974 EOM
15975                    d_strtoll="$undef"
15976                    ;;
15977                 esac
15978         else
15979                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15980                 d_strtoll="$undef"
15981         fi
15982         ;;
15983 esac
15984
15985 : see if strtoq exists
15986 set strtoq d_strtoq
15987 eval $inlibc
15988
15989 : see if strtoul exists
15990 set strtoul d_strtoul
15991 eval $inlibc
15992
15993 case "$d_strtoul" in
15994 "$define")
15995         $cat <<EOM
15996 Checking whether your strtoul() works okay...
15997 EOM
15998         $cat >try.c <<'EOCP'
15999 #include <errno.h>
16000 #include <stdio.h>
16001 extern unsigned long int strtoul(char *s, char **, int); 
16002 static int bad = 0;
16003 void check(char *s, unsigned long eul, int een) {
16004         unsigned long gul;
16005         errno = 0;
16006         gul = strtoul(s, 0, 10);
16007         if (!((gul == eul) && (errno == een)))
16008                 bad++;
16009 }
16010 int main() {
16011         check(" 1", 1L, 0);
16012         check(" 0", 0L, 0);
16013 EOCP
16014         case "$longsize" in
16015         8)
16016             $cat >>try.c <<'EOCP'
16017         check("18446744073709551615", 18446744073709551615UL, 0);
16018         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16019 #if 0 /* strtoul() for /^-/ strings is undefined. */
16020         check("-1", 18446744073709551615UL, 0);
16021         check("-18446744073709551614", 2, 0);
16022         check("-18446744073709551615", 1, 0);
16023         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16024         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16025 #endif
16026 EOCP
16027                 ;;
16028         4)
16029                     $cat >>try.c <<'EOCP'
16030         check("4294967295", 4294967295UL, 0);
16031         check("4294967296", 4294967295UL, ERANGE);
16032 #if 0 /* strtoul() for /^-/ strings is undefined. */
16033         check("-1", 4294967295UL, 0);
16034         check("-4294967294", 2, 0);
16035         check("-4294967295", 1, 0);
16036         check("-4294967296", 4294967295UL, ERANGE);
16037         check("-4294967297", 4294967295UL, ERANGE);
16038 #endif
16039 EOCP
16040                 ;;
16041         *)
16042 : Should we write these tests to be more portable by sprintf-ing
16043 : ~0 and then manipulating that char string as input for strtol?
16044                 ;;
16045         esac
16046         $cat >>try.c <<'EOCP'
16047         if (!bad)
16048                 printf("ok\n");
16049         return 0;
16050 }
16051 EOCP
16052         set try
16053         if eval $compile; then
16054                 case "`$run ./try`" in
16055                 ok) echo "Your strtoul() seems to be working okay." ;;
16056                 *) cat <<EOM >&4
16057 Your strtoul() doesn't seem to be working okay.
16058 EOM
16059                    d_strtoul="$undef"
16060                    ;;
16061                 esac
16062         fi
16063         ;;
16064 esac
16065
16066 : see if strtoull exists
16067 set strtoull d_strtoull
16068 eval $inlibc
16069
16070 case "$d_longlong-$d_strtoull" in
16071 "$define-$define")
16072         $cat <<EOM
16073 Checking whether your strtoull() works okay...
16074 EOM
16075         $cat >try.c <<'EOCP'
16076 #include <errno.h>
16077 #ifdef __hpux
16078 #define strtoull __strtoull
16079 #endif
16080 #include <stdio.h>
16081 extern unsigned long long int strtoull(char *s, char **, int); 
16082 static int bad = 0;
16083 int check(char *s, long long eull, int een) {
16084         long long gull;
16085         errno = 0;
16086         gull = strtoull(s, 0, 10);
16087         if (!((gull == eull) && (errno == een)))
16088                 bad++;
16089 }
16090 int main() {
16091         check(" 1",                                        1LL, 0);
16092         check(" 0",                                        0LL, 0);
16093         check("18446744073709551615",  18446744073709551615ULL, 0);
16094         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16095 #if 0 /* strtoull() for /^-/ strings is undefined. */
16096         check("-1",                    18446744073709551615ULL, 0);
16097         check("-18446744073709551614",                     2LL, 0);
16098         check("-18446744073709551615",                     1LL, 0);
16099         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16100         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16101 #endif
16102         if (!bad)
16103                 printf("ok\n");
16104 }
16105 EOCP
16106         set try
16107         if eval $compile; then
16108                 case "`$run ./try`" in
16109                 ok) echo "Your strtoull() seems to be working okay." ;;
16110                 *) cat <<EOM >&4
16111 Your strtoull() doesn't seem to be working okay.
16112 EOM
16113                    d_strtoull="$undef"
16114                    ;;
16115                 esac
16116         fi
16117         ;;
16118 esac
16119
16120 : see if strtouq exists
16121 set strtouq d_strtouq
16122 eval $inlibc
16123
16124 case "$d_strtouq" in
16125 "$define")
16126         $cat <<EOM
16127 Checking whether your strtouq() works okay...
16128 EOM
16129         $cat >try.c <<'EOCP'
16130 #include <errno.h>
16131 #include <stdio.h>
16132 extern unsigned long long int strtouq(char *s, char **, int); 
16133 static int bad = 0;
16134 void check(char *s, unsigned long long eull, int een) {
16135         unsigned long long gull;
16136         errno = 0;
16137         gull = strtouq(s, 0, 10);
16138         if (!((gull == eull) && (errno == een)))
16139                 bad++;
16140 }
16141 int main() {
16142         check(" 1",                                        1LL, 0);
16143         check(" 0",                                        0LL, 0);
16144         check("18446744073709551615",  18446744073709551615ULL, 0);
16145         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16146 #if 0 /* strtouq() for /^-/ strings is undefined. */
16147         check("-1",                    18446744073709551615ULL, 0);
16148         check("-18446744073709551614",                     2LL, 0);
16149         check("-18446744073709551615",                     1LL, 0);
16150         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16151         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16152 #endif
16153         if (!bad)
16154                 printf("ok\n");
16155         return 0;
16156 }
16157 EOCP
16158         set try
16159         if eval $compile; then
16160                 case "`$run ./try`" in
16161                 ok) echo "Your strtouq() seems to be working okay." ;;
16162                 *) cat <<EOM >&4
16163 Your strtouq() doesn't seem to be working okay.
16164 EOM
16165                    d_strtouq="$undef"
16166                    ;;
16167                 esac
16168         fi
16169         ;;
16170 esac
16171
16172 : see if strxfrm exists
16173 set strxfrm d_strxfrm
16174 eval $inlibc
16175
16176 : see if symlink exists
16177 set symlink d_symlink
16178 eval $inlibc
16179
16180 : see if syscall exists
16181 set syscall d_syscall
16182 eval $inlibc
16183
16184 : see if prototype for syscall is available
16185 echo " "
16186 set d_syscallproto syscall $i_unistd unistd.h
16187 eval $hasproto
16188
16189 : see if sysconf exists
16190 set sysconf d_sysconf
16191 eval $inlibc
16192
16193 : see if system exists
16194 set system d_system
16195 eval $inlibc
16196
16197 : see if tcgetpgrp exists
16198 set tcgetpgrp d_tcgetpgrp
16199 eval $inlibc
16200
16201 : see if tcsetpgrp exists
16202 set tcsetpgrp d_tcsetpgrp
16203 eval $inlibc
16204
16205 : see if prototype for telldir is available
16206 echo " "
16207 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16208 eval $hasproto
16209
16210 : see if time exists
16211 echo " "
16212 if test "X$d_time" = X -o X"$timetype" = X; then
16213     if set time val -f d_time; eval $csym; $val; then
16214                 echo 'time() found.' >&4
16215                 val="$define"
16216                 rp="What is the type returned by time() on this system?"
16217                 set time_t timetype long stdio.h sys/types.h
16218                 eval $typedef_ask
16219     else
16220                 echo 'time() not found, hope that will do.' >&4
16221                 val="$undef"
16222                 timetype='int';
16223     fi
16224     set d_time
16225     eval $setvar
16226 fi
16227
16228 : see if this is a sys/times.h system
16229 set sys/times.h i_systimes
16230 eval $inhdr
16231
16232 : see if times exists
16233 echo " "
16234 if set times val -f d_times; eval $csym; $val; then
16235         echo 'times() found.' >&4
16236         d_times="$define"
16237         inc=''
16238         case "$i_systimes" in
16239         "$define") inc='sys/times.h';;
16240         esac
16241         rp="What is the type returned by times() on this system?"
16242         set clock_t clocktype long stdio.h sys/types.h $inc
16243         eval $typedef_ask
16244 else
16245         echo 'times() NOT found, hope that will do.' >&4
16246         d_times="$undef"
16247         clocktype='int'
16248 fi
16249
16250 : see if tmpnam_r exists
16251 set tmpnam_r d_tmpnam_r
16252 eval $inlibc
16253 case "$d_tmpnam_r" in
16254 "$define")
16255         hdrs="$i_systypes sys/types.h define stdio.h "
16256         case "stdio" in
16257         time)
16258                 hdrs="$hdrs $i_systime sys/time.h"
16259                 ;;
16260         esac
16261         case "$d_tmpnam_r_proto:$usethreads" in
16262         ":define")      d_tmpnam_r_proto=define
16263                 set d_tmpnam_r_proto tmpnam_r $hdrs
16264                 eval $hasproto ;;
16265         *)      ;;
16266         esac
16267         case "$d_tmpnam_r_proto" in
16268         define)
16269         case "$tmpnam_r_proto" in
16270         ''|0) try='char* tmpnam_r(char*);'
16271         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16272         esac
16273         case "$tmpnam_r_proto" in
16274         ''|0)   d_tmpnam_r=undef
16275                 tmpnam_r_proto=0
16276                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16277         * )     case "$tmpnam_r_proto" in
16278                 REENTRANT_PROTO*) ;;
16279                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16280                 esac
16281                 echo "Prototype: $try" ;;
16282         esac
16283         ;;
16284         *)      case "$usethreads" in
16285                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16286                 esac
16287                 d_tmpnam_r=undef
16288                 tmpnam_r_proto=0
16289                 ;;
16290         esac
16291         ;;
16292 *)      tmpnam_r_proto=0
16293         ;;
16294 esac
16295
16296 : see if truncate exists
16297 set truncate d_truncate
16298 eval $inlibc
16299
16300 : see if ttyname_r exists
16301 set ttyname_r d_ttyname_r
16302 eval $inlibc
16303 case "$d_ttyname_r" in
16304 "$define")
16305         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16306         case "unistd" in
16307         time)
16308                 hdrs="$hdrs $i_systime sys/time.h"
16309                 ;;
16310         esac
16311         case "$d_ttyname_r_proto:$usethreads" in
16312         ":define")      d_ttyname_r_proto=define
16313                 set d_ttyname_r_proto ttyname_r $hdrs
16314                 eval $hasproto ;;
16315         *)      ;;
16316         esac
16317         case "$d_ttyname_r_proto" in
16318         define)
16319         case "$ttyname_r_proto" in
16320         ''|0) try='int ttyname_r(int, char*, size_t);'
16321         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16322         esac
16323         case "$ttyname_r_proto" in
16324         ''|0) try='int ttyname_r(int, char*, int);'
16325         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16326         esac
16327         case "$ttyname_r_proto" in
16328         ''|0) try='char* ttyname_r(int, char*, int);'
16329         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16330         esac
16331         case "$ttyname_r_proto" in
16332         ''|0)   d_ttyname_r=undef
16333                 ttyname_r_proto=0
16334                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16335         * )     case "$ttyname_r_proto" in
16336                 REENTRANT_PROTO*) ;;
16337                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16338                 esac
16339                 echo "Prototype: $try" ;;
16340         esac
16341         ;;
16342         *)      case "$usethreads" in
16343                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16344                 esac
16345                 d_ttyname_r=undef
16346                 ttyname_r_proto=0
16347                 ;;
16348         esac
16349         ;;
16350 *)      ttyname_r_proto=0
16351         ;;
16352 esac
16353
16354 : see if tzname[] exists
16355 echo " "
16356 if set tzname val -a d_tzname; eval $csym; $val; then
16357         val="$define"
16358         echo 'tzname[] found.' >&4
16359 else
16360         val="$undef"
16361         echo 'tzname[] NOT found.' >&4
16362 fi
16363 set d_tzname
16364 eval $setvar
16365
16366 case "$osname" in
16367 next|rhapsody|darwin) multiarch="$define" ;;
16368 esac
16369 case "$multiarch" in
16370 ''|[nN]*) multiarch="$undef" ;;
16371 esac
16372
16373 : check for ordering of bytes in a long
16374 echo " "
16375 case "$usecrosscompile$multiarch" in
16376 *$define*)
16377         $cat <<EOM
16378 You seem to be either cross-compiling or doing a multiarchitecture build,
16379 skipping the byteorder check.
16380
16381 EOM
16382         byteorder='ffff'
16383         ;;
16384 *)
16385         case "$byteorder" in
16386         '')
16387                 $cat <<'EOM'
16388 In the following, larger digits indicate more significance.  A big-endian
16389 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16390 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16391 machines may have weird orders like 3412.  A Cray will report 87654321,
16392 an Alpha will report 12345678. If the test program works the default is
16393 probably right.
16394 I'm now running the test program...
16395 EOM
16396                 $cat >try.c <<'EOCP'
16397 #include <stdio.h>
16398 int main()
16399 {
16400         int i;
16401         union {
16402                 unsigned long l;
16403                 char c[sizeof(long)];
16404         } u;
16405
16406         if (sizeof(long) > 4)
16407                 u.l = (0x08070605L << 32) | 0x04030201L;
16408         else
16409                 u.l = 0x04030201L;
16410         for (i = 0; i < sizeof(long); i++)
16411                 printf("%c", u.c[i]+'0');
16412         printf("\n");
16413         exit(0);
16414 }
16415 EOCP
16416                 xxx_prompt=y
16417                 set try
16418                 if eval $compile && ./try > /dev/null; then
16419                         dflt=`$run ./try`
16420                         case "$dflt" in
16421                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16422                                 echo "(The test program ran ok.)"
16423                                 echo "byteorder=$dflt"
16424                                 xxx_prompt=n
16425                         ;;
16426                         ????|????????) echo "(The test program ran ok.)" ;;
16427                         *) echo "(The test program didn't run right for some reason.)" ;;
16428                         esac
16429                 else
16430                         dflt='4321'
16431                         cat <<'EOM'
16432 (I can't seem to compile the test program.  Guessing big-endian...)
16433 EOM
16434                 fi
16435                 case "$xxx_prompt" in
16436                 y)
16437                         rp="What is the order of bytes in a long?"
16438                         . ./myread
16439                         byteorder="$ans"
16440                         ;;
16441                 *)      byteorder=$dflt
16442                         ;;
16443                 esac
16444                 ;;
16445         esac
16446         $rm -f try.c try
16447         ;;
16448 esac
16449
16450
16451 $cat <<EOM
16452
16453 Checking to see whether you can access character data unalignedly...
16454 EOM
16455 case "$d_u32align" in
16456 '')   $cat >try.c <<EOCP
16457 #include <stdio.h>
16458 #define U32 $u32type
16459 #define BYTEORDER 0x$byteorder
16460 #define U8 $u8type
16461 #include <signal.h>
16462 #ifdef SIGBUS
16463 $signal_t bletch(s) int s; { exit(4); }
16464 #endif
16465 int main() {
16466 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16467     U8 buf[8];
16468     U32 *up;
16469     int i;
16470
16471     if (sizeof(U32) != 4) {
16472         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16473         exit(1);
16474     }
16475
16476     fflush(stdout);
16477
16478 #ifdef SIGBUS
16479     signal(SIGBUS, bletch);
16480 #endif
16481
16482     buf[0] = 0;
16483     buf[1] = 0;
16484     buf[2] = 0;
16485     buf[3] = 1;
16486     buf[5] = 0;
16487     buf[6] = 0;
16488     buf[7] = 0;
16489     buf[8] = 1;
16490
16491     for (i = 0; i < 4; i++) {
16492         up = (U32*)(buf + i);
16493         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16494                (*up == 1 << (8*(3-i)))  /* little-endian */
16495               )
16496            )
16497         {
16498             printf("read failed (%x)\n", *up);
16499             exit(2);
16500         }
16501     }
16502
16503     /* write test */
16504     for (i = 0; i < 4; i++) {
16505         up = (U32*)(buf + i);
16506         *up = 0xBeef;
16507         if (*up != 0xBeef) {
16508             printf("write failed (%x)\n", *up);
16509             exit(3);
16510         }
16511     }
16512
16513     exit(0);
16514 #else
16515     printf("1\n");
16516     exit(1);
16517 #endif
16518     return 0;
16519 }
16520 EOCP
16521 set try
16522 if eval $compile_ok; then
16523         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16524         $run ./try 2>&1 >/dev/null
16525         case "$?" in
16526         0)      cat >&4 <<EOM
16527 You can access character data pretty unalignedly.
16528 EOM
16529                 d_u32align="$undef"
16530                 ;;
16531         *)      cat >&4 <<EOM
16532 It seems that you must access character data in an aligned manner.
16533 EOM
16534                 d_u32align="$define"
16535                 ;;
16536         esac
16537 else
16538         rp='Can you access character data at unaligned addresses?'
16539         dflt='n'
16540         . ./myread
16541         case "$ans" in
16542         [yY]*)  d_u32align="$undef"  ;;
16543         *)      d_u32align="$define" ;;
16544         esac
16545 fi
16546 $rm -f core core.try.* try.core
16547 ;;
16548 esac
16549
16550 : see if ualarm exists
16551 set ualarm d_ualarm
16552 eval $inlibc
16553
16554 : see if umask exists
16555 set umask d_umask
16556 eval $inlibc
16557
16558 : see if unordered exists
16559 set unordered d_unordered
16560 eval $inlibc
16561
16562 : see if usleep exists
16563 set usleep d_usleep
16564 eval $inlibc
16565
16566 : see if prototype for usleep is available
16567 echo " "
16568 set d_usleepproto usleep $i_unistd unistd.h
16569 eval $hasproto
16570
16571 : see if ustat exists
16572 set ustat d_ustat
16573 eval $inlibc
16574
16575 : backward compatibility for d_hvfork
16576 if test X$d_hvfork != X; then
16577         d_vfork="$d_hvfork"
16578         d_hvfork=''
16579 fi
16580 : see if there is a vfork
16581 val=''
16582 set vfork val
16583 eval $inlibc
16584
16585 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16586 : perl on Solaris 2.x, and probably elsewhere.
16587 case "$val" in
16588 $define)
16589         echo " "
16590         case "$usevfork" in
16591         false) dflt='n';;
16592         *) dflt='y';;
16593         esac
16594         cat <<'EOM'
16595  
16596 Perl can only use a vfork() that doesn't suffer from strict
16597 restrictions on calling functions or modifying global data in
16598 the child.  For example, glibc-2.1 contains such a vfork()
16599 that is unsuitable.  If your system provides a proper fork()
16600 call, chances are that you do NOT want perl to use vfork().
16601
16602 EOM
16603         rp="Do you still want to use vfork()?"
16604         . ./myread
16605         case "$ans" in
16606         y|Y) ;;
16607         *)
16608                 echo "Ok, we won't use vfork()."
16609                 val="$undef"
16610                 ;;
16611         esac
16612         ;;
16613 esac
16614 set d_vfork
16615 eval $setvar
16616 case "$d_vfork" in
16617 $define) usevfork='true';;
16618 *) usevfork='false';;
16619 esac
16620
16621 : see if closedir exists
16622 set closedir d_closedir
16623 eval $inlibc
16624
16625 case "$d_closedir" in
16626 "$define")
16627         echo " "
16628         echo "Checking whether closedir() returns a status..." >&4
16629         cat > try.c <<EOM
16630 #$i_dirent I_DIRENT             /**/
16631 #$i_sysdir I_SYS_DIR            /**/
16632 #$i_sysndir I_SYS_NDIR          /**/
16633 #$i_systypes I_SYS_TYPES        /**/
16634
16635 #if defined(I_SYS_TYPES)
16636 #include <sys/types.h>
16637 #endif
16638 #if defined(I_DIRENT)
16639 #include <dirent.h>
16640 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16641 #include <sys/dir.h>
16642 #endif
16643 #else
16644 #ifdef I_SYS_NDIR
16645 #include <sys/ndir.h>
16646 #else
16647 #ifdef I_SYS_DIR
16648 #ifdef hp9000s500
16649 #include <ndir.h>       /* may be wrong in the future */
16650 #else
16651 #include <sys/dir.h>
16652 #endif
16653 #endif
16654 #endif
16655 #endif 
16656 int main() { return closedir(opendir(".")); }
16657 EOM
16658         set try
16659         if eval $compile_ok; then
16660                 if $run ./try > /dev/null 2>&1 ; then
16661                         echo "Yes, it does."
16662                         val="$undef"
16663                 else
16664                         echo "No, it doesn't."
16665                         val="$define"
16666                 fi
16667         else
16668                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16669                 val="$define"
16670         fi
16671         ;;
16672 *)
16673         val="$undef";
16674         ;;
16675 esac
16676 set d_void_closedir
16677 eval $setvar
16678 $rm -f try try.*
16679 : see if there is a wait4
16680 set wait4 d_wait4
16681 eval $inlibc
16682
16683 : see if waitpid exists
16684 set waitpid d_waitpid
16685 eval $inlibc
16686
16687 : see if wcstombs exists
16688 set wcstombs d_wcstombs
16689 eval $inlibc
16690
16691 : see if wctomb exists
16692 set wctomb d_wctomb
16693 eval $inlibc
16694
16695 : see if writev exists
16696 set writev d_writev
16697 eval $inlibc
16698
16699 : preserve RCS keywords in files with variable substitution, grrr
16700 Date='$Date'
16701 Id='$Id'
16702 Log='$Log'
16703 RCSfile='$RCSfile'
16704 Revision='$Revision'
16705
16706 : check for alignment requirements
16707 echo " "
16708 case "$usecrosscompile$multiarch" in
16709 *$define*)
16710         $cat <<EOM
16711 You seem to be either cross-compiling or doing a multiarchitecture build,
16712 skipping the memory alignment check.
16713
16714 EOM
16715         case "$alignbytes" in
16716         '') alignbytes=8 ;;
16717         esac
16718         ;;
16719 *)
16720         case "$alignbytes" in
16721         '') echo "Checking alignment constraints..." >&4
16722                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16723                         $cat >try.c <<'EOCP'
16724 typedef long double NV;
16725 EOCP
16726                 else
16727                         $cat >try.c <<'EOCP'
16728 typedef double NV;
16729 EOCP
16730                 fi
16731                 $cat >>try.c <<'EOCP'
16732 #include <stdio.h>
16733 struct foobar {
16734         char foo;
16735         NV bar;
16736 } try_algn;
16737 int main()
16738 {
16739     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16740     return(0);
16741 }
16742 EOCP
16743                 set try
16744                 if eval $compile_ok; then
16745                         dflt=`$run ./try`
16746                 else
16747                         dflt='8'
16748                         echo "(I can't seem to compile the test program...)"
16749                 fi
16750                 ;;
16751         *) dflt="$alignbytes"
16752                 ;;
16753         esac
16754         rp="Doubles must be aligned on a how-many-byte boundary?"
16755         . ./myread
16756         alignbytes="$ans"
16757         $rm -f try.c try
16758         ;;
16759 esac
16760
16761
16762 : set the base revision
16763 baserev=5.0
16764
16765 : how do we catenate cpp tokens here?
16766 echo " "
16767 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16768 $cat >cpp_stuff.c <<'EOCP'
16769 #define RCAT(a,b)a/**/b
16770 #define ACAT(a,b)a ## b
16771 RCAT(Rei,ser)
16772 ACAT(Cir,cus)
16773 EOCP
16774 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16775 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16776         echo "Oh!  Smells like ANSI's been here." >&4
16777         echo "We can catify or stringify, separately or together!"
16778         cpp_stuff=42
16779 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16780         echo "Ah, yes!  The good old days!" >&4
16781         echo "However, in the good old days we don't know how to stringify and"
16782         echo "catify at the same time."
16783         cpp_stuff=1
16784 else
16785         $cat >&4 <<EOM
16786 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16787 to have to edit the values of CAT[2-5] in config.h...
16788 EOM
16789         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16790 fi
16791 $rm -f cpp_stuff.*
16792
16793 : see if this is a db.h system
16794 set db.h i_db
16795 eval $inhdr
16796
16797 case "$i_db" in
16798 $define)
16799         : Check db version.
16800         echo " "
16801         echo "Checking Berkeley DB version ..." >&4
16802         $cat >try.c <<EOCP
16803 #$d_const HASCONST
16804 #ifndef HASCONST
16805 #define const
16806 #endif
16807 #include <sys/types.h>
16808 #include <stdio.h>
16809 #include <db.h>
16810 int main(int argc, char *argv[])
16811 {
16812 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16813     int Major, Minor, Patch ;
16814     unsigned long Version ;
16815     (void)db_version(&Major, &Minor, &Patch) ;
16816     if (argc == 2) {
16817         printf("%d %d %d %d %d %d\n",
16818                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16819                Major, Minor, Patch);
16820         exit(0);
16821     }
16822     printf("You have Berkeley DB Version 2 or greater.\n");
16823
16824     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16825                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16826     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16827                 Major, Minor, Patch) ;
16828
16829     /* check that db.h & libdb are compatible */
16830     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16831         printf("db.h and libdb are incompatible.\n") ;
16832         exit(3);        
16833     }
16834
16835     printf("db.h and libdb are compatible.\n") ;
16836
16837     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16838                 + DB_VERSION_PATCH ;
16839
16840     /* needs to be >= 2.3.4 */
16841     if (Version < 2003004) {
16842     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16843         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16844         exit(2);        
16845     }
16846
16847     exit(0);
16848 #else
16849 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16850     if (argc == 2) {
16851         printf("1 0 0\n");
16852         exit(0);
16853     }
16854     printf("You have Berkeley DB Version 1.\n");
16855     exit(0);    /* DB version < 2: the coast is clear. */
16856 #else
16857     exit(1);    /* <db.h> not Berkeley DB? */
16858 #endif
16859 #endif
16860 }
16861 EOCP
16862         set try
16863         if eval $compile_ok && $run ./try; then
16864                 echo 'Looks OK.' >&4
16865                 set `$run ./try 1`
16866                 db_version_major=$1
16867                 db_version_minor=$2
16868                 db_version_patch=$3
16869         else
16870                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16871                 i_db=$undef
16872                 case " $libs " in
16873                 *"-ldb "*)
16874                         : Remove db from list of libraries to use
16875                         echo "Removing unusable -ldb from library list" >&4
16876                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16877                         shift
16878                         libs="$*"
16879                         echo "libs = $libs" >&4
16880                         ;;
16881                 esac
16882         fi
16883         $rm -f try.*
16884         ;;
16885 esac
16886
16887 case "$i_db" in
16888 define)
16889         : Check the return type needed for hash 
16890         echo " "
16891         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16892         $cat >try.c <<EOCP
16893 #$d_const HASCONST
16894 #ifndef HASCONST
16895 #define const
16896 #endif
16897 #include <sys/types.h>
16898 #include <db.h>
16899
16900 #ifndef DB_VERSION_MAJOR
16901 u_int32_t hash_cb (ptr, size)
16902 const void *ptr;
16903 size_t size;
16904 {
16905 }
16906 HASHINFO info;
16907 int main()
16908 {
16909         info.hash = hash_cb;
16910 }
16911 #endif
16912 EOCP
16913         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16914                 if $contains warning try.out >>/dev/null 2>&1 ; then
16915                         db_hashtype='int'
16916                 else
16917                         db_hashtype='u_int32_t'
16918                 fi
16919         else
16920                 : XXX Maybe we should just give up here.
16921                 db_hashtype=u_int32_t
16922                 $cat try.out >&4
16923                 echo "Help:  I can't seem to compile the db test program." >&4
16924                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16925         fi
16926         $rm -f try.*
16927         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16928         ;;
16929 *)      db_hashtype=u_int32_t
16930         ;;
16931 esac
16932 case "$i_db" in
16933 define)
16934         : Check the return type needed for prefix 
16935         echo " "
16936         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16937         cat >try.c <<EOCP
16938 #$d_const HASCONST
16939 #ifndef HASCONST
16940 #define const
16941 #endif
16942 #include <sys/types.h>
16943 #include <db.h>
16944
16945 #ifndef DB_VERSION_MAJOR
16946 size_t prefix_cb (key1, key2)
16947 const DBT *key1;
16948 const DBT *key2;
16949 {
16950 }
16951 BTREEINFO info;
16952 int main()
16953 {
16954         info.prefix = prefix_cb;
16955 }
16956 #endif
16957 EOCP
16958         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16959                 if $contains warning try.out >>/dev/null 2>&1 ; then
16960                         db_prefixtype='int'
16961                 else
16962                         db_prefixtype='size_t'
16963                 fi
16964         else
16965                 db_prefixtype='size_t'
16966                 : XXX Maybe we should just give up here.
16967                 $cat try.out >&4
16968                 echo "Help:  I can't seem to compile the db test program." >&4
16969                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16970         fi
16971         $rm -f try.*
16972         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16973         ;;
16974 *)      db_prefixtype='size_t'
16975         ;;
16976 esac
16977
16978
16979 : How can we generate normalized random numbers ?
16980 echo " "
16981 echo "Looking for a random number function..." >&4
16982 case "$randfunc" in
16983 '')
16984         if set drand48 val -f; eval $csym; $val; then
16985                 dflt="drand48"
16986                 echo "Good, found drand48()." >&4
16987         elif set random val -f; eval $csym; $val; then
16988                 dflt="random"
16989                 echo "OK, found random()." >&4
16990         else
16991                 dflt="rand"
16992                 echo "Yick, looks like I have to use rand()." >&4
16993         fi
16994         echo " "
16995         ;;
16996 *)
16997         dflt="$randfunc"
16998         ;;
16999 esac
17000 cont=true
17001
17002 case "$ccflags" in
17003 *-Dmy_rand=*|*-Dmy_srand=*)
17004         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17005         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17006         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17007         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17008         ;;
17009 esac
17010
17011 while $test "$cont"; do
17012         rp="Use which function to generate random numbers?"
17013         . ./myread
17014         if $test "$ans" = "$dflt"; then
17015                 : null
17016         else
17017                 randbits=''
17018         fi
17019         randfunc="$ans"
17020         if set $ans val -f; eval $csym; $val; then
17021                 cont=''
17022         else
17023                 dflt=y
17024                 rp="I cannot find function $ans. Use that name anyway?"
17025                 . ./myread
17026                 dflt=rand
17027                 case "$ans" in
17028                         [yY]*) cont='';;
17029                 esac
17030         fi
17031         case "$cont" in
17032         '')
17033                 case "$randfunc" in
17034                 drand48)
17035                         drand01="drand48()"
17036                         seedfunc="srand48"
17037                         randbits=48
17038                         randseedtype=long
17039                         ;;
17040                 rand|random)
17041                         case "$randbits" in
17042                         '')
17043 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17044                                 $cat >try.c <<EOCP
17045 #$i_unistd I_UNISTD
17046 #$i_stdlib I_STDLIB
17047 #include <stdio.h>
17048 #ifdef I_UNISTD
17049 #  include <unistd.h>
17050 #endif
17051 #ifdef I_STDLIB
17052 #  include <stdlib.h>
17053 #endif
17054 int main()
17055 {
17056         register int i;
17057         register unsigned long tmp;
17058         register unsigned long max = 0L;
17059
17060         for (i = 1000; i; i--) {
17061                 tmp = (unsigned long) $randfunc();
17062                 if (tmp > max) max = tmp;
17063         }
17064         for (i = 0; max; i++)
17065                 max /= 2;
17066         printf("%d\n",i);
17067 }
17068 EOCP
17069                                 set try
17070                                 if eval $compile_ok; then
17071                                         dflt=`try`
17072                                 else
17073                                         dflt='?'
17074                                         echo "(I can't seem to compile the test program...)"
17075                                 fi
17076                                 ;;
17077                         *)
17078                                 dflt="$randbits"
17079                                 ;;
17080                         esac
17081                         rp="How many bits does your $randfunc() function produce?"
17082                         . ./myread
17083                         randbits="$ans"
17084                         $rm -f try.c try
17085                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17086                         seedfunc="s$randfunc"
17087                         randseedtype=unsigned
17088                         ;;
17089                 *)
17090                         dflt="31"
17091                         rp="How many bits does your $randfunc() function produce?"
17092                         . ./myread
17093                         randbits="$ans"
17094                         seedfunc="s$randfunc"
17095                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17096                         if set $seedfunc val -f; eval $csym; $val; then
17097                                 echo "(Using $seedfunc() to seed random generator)"
17098                         else
17099                                 echo "(Warning: no $seedfunc() to seed random generator)"
17100                                 seedfunc=rand
17101                         fi
17102                         randseedtype=unsigned
17103                         ;;
17104                 esac
17105                 ;;
17106         esac
17107 done
17108
17109 echo " "
17110 echo "Determining whether or not we are on an EBCDIC system..." >&4
17111 $cat >try.c <<'EOM'
17112 int main()
17113 {
17114   if ('M'==0xd4) return 0;
17115   return 1;
17116 }
17117 EOM
17118
17119 val=$undef
17120 set try
17121 if eval $compile_ok; then
17122         if $run ./try; then
17123                 echo "You seem to speak EBCDIC." >&4
17124                 val="$define"
17125         else
17126                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17127         fi
17128 else
17129         echo "I'm unable to compile the test program." >&4
17130         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17131 fi
17132 $rm -f try try.*
17133 set ebcdic
17134 eval $setvar
17135
17136 echo " "
17137 $cat >&4 <<EOM
17138 Checking how to flush all pending stdio output...
17139 EOM
17140 # I only know how to find the first 32 possibly open files on SunOS.
17141 # See also hints/sunos_4_1.sh and util.c  --AD
17142 case "$osname" in
17143 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17144 esac
17145 $cat >>try.c <<EOCP
17146 #include <stdio.h>
17147 #$i_unistd I_UNISTD
17148 #ifdef I_UNISTD
17149 # include <unistd.h>
17150 #endif
17151 #$d_sysconf HAS_SYSCONF
17152 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17153 #ifdef HAS_STDIO_STREAM_ARRAY
17154 # define STDIO_STREAM_ARRAY $stdio_stream_array
17155 #endif
17156 int main() {
17157   FILE* p;
17158   unlink("try.out");
17159   p = fopen("try.out", "w");
17160 #ifdef TRY_FPUTC
17161   fputc('x', p);
17162 #else
17163 # ifdef TRY_FPRINTF
17164   fprintf(p, "x");
17165 # endif
17166 #endif
17167 #ifdef TRY_FFLUSH_NULL
17168   fflush(NULL);
17169 #endif
17170 #ifdef TRY_FFLUSH_ALL
17171   {
17172     long open_max = -1;
17173 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17174     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17175 # else
17176 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17177     open_max = sysconf(_SC_OPEN_MAX);
17178 #  else
17179 #   ifdef FOPEN_MAX
17180     open_max = FOPEN_MAX;
17181 #   else
17182 #    ifdef OPEN_MAX
17183     open_max = OPEN_MAX;
17184 #    else
17185 #     ifdef _NFILE
17186     open_max = _NFILE;
17187 #     endif
17188 #    endif
17189 #   endif
17190 #  endif
17191 # endif 
17192 # ifdef HAS_STDIO_STREAM_ARRAY
17193     if (open_max > 0) {
17194       long i;
17195       for (i = 0; i < open_max; i++)
17196             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17197                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17198                 STDIO_STREAM_ARRAY[i]._flag)
17199                 fflush(&STDIO_STREAM_ARRAY[i]);
17200     }   
17201   }
17202 # endif
17203 #endif
17204   _exit(42);
17205 }
17206 EOCP
17207 : first we have to find out how _not_ to flush
17208 $to try.c
17209 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17210     output=''
17211     set try -DTRY_FPUTC
17212     if eval $compile; then
17213             $run ./try 2>/dev/null
17214             code="$?"
17215             $from try.out
17216             if $test ! -s try.out -a "X$code" = X42; then
17217                 output=-DTRY_FPUTC
17218             fi
17219     fi
17220     case "$output" in
17221     '')
17222             set try -DTRY_FPRINTF
17223             if eval $compile; then
17224                     $run ./try 2>/dev/null
17225                     code="$?"
17226                     $from try.out
17227                     if $test ! -s try.out -a "X$code" = X42; then
17228                         output=-DTRY_FPRINTF
17229                     fi
17230             fi
17231         ;;
17232     esac
17233 fi
17234 : check for fflush NULL behaviour
17235 case "$fflushNULL" in
17236 '')     set try -DTRY_FFLUSH_NULL $output
17237         if eval $compile; then
17238                 $run ./try 2>/dev/null
17239                 code="$?"
17240                 $from try.out
17241                 if $test -s try.out -a "X$code" = X42; then
17242                         fflushNULL="`$cat try.out`"
17243                 else
17244                         if $test "X$code" != X42; then
17245                                 $cat >&4 <<EOM
17246 (If this test failed, don't worry, we'll try another method shortly.)
17247 EOM
17248                         fi
17249                 fi
17250         fi
17251         $rm -f core try.core core.try.*
17252         case "$fflushNULL" in
17253         x)      $cat >&4 <<EOM
17254 Your fflush(NULL) works okay for output streams.
17255 Let's see if it clobbers input pipes...
17256 EOM
17257 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17258 # bug that improperly flushes the input end of pipes.  So we avoid the
17259 # autoflush on fork/system/exec support for now. :-(
17260 $cat >tryp.c <<EOCP
17261 #include <stdio.h>
17262 int
17263 main(int argc, char **argv)
17264 {
17265     char buf[1024];
17266     int i;
17267     char *bp = buf;
17268     while (1) {
17269         while ((i = getc(stdin)) != -1
17270                && (*bp++ = i) != '\n'
17271                && bp < &buf[1024])
17272         /* DO NOTHING */ ;
17273         *bp = '\0';
17274         fprintf(stdout, "%s", buf);
17275         fflush(NULL);
17276         if (i == -1)
17277             return 0;
17278         bp = buf;
17279     }
17280 }
17281 EOCP
17282                 fflushNULL="$define"
17283                 set tryp
17284                 if eval $compile; then
17285                     $rm -f tryp.out
17286                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17287                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17288                        $cat >&4 <<EOM
17289 fflush(NULL) seems to behave okay with input streams.
17290 EOM
17291                         fflushNULL="$define"
17292                     else
17293                         $cat >&4 <<EOM
17294 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17295 EOM
17296                         fflushNULL="$undef"
17297                     fi
17298                 fi
17299                 $rm -f core tryp.c tryp.core core.tryp.*
17300                 ;;
17301         '')     $cat >&4 <<EOM
17302 Your fflush(NULL) isn't working (contrary to ANSI C).
17303 EOM
17304                 fflushNULL="$undef"
17305                 ;;
17306         *)      $cat >&4 <<EOM
17307 Cannot figure out whether your fflush(NULL) works or not.
17308 I'm assuming it doesn't (contrary to ANSI C).
17309 EOM
17310                 fflushNULL="$undef"
17311                 ;;
17312         esac
17313         ;;
17314 $define|true|[yY]*)
17315         fflushNULL="$define"
17316         ;;
17317 *)
17318         fflushNULL="$undef"
17319         ;;
17320 esac
17321 : check explicit looping only if NULL did not work, and if the pipe
17322 : bug does not show up on an explicit flush too
17323 case "$fflushNULL" in
17324 "$undef")
17325         $cat >tryp.c <<EOCP
17326 #include <stdio.h>
17327 int
17328 main(int argc, char **argv)
17329 {
17330     char buf[1024];
17331     int i;
17332     char *bp = buf;
17333     while (1) {
17334         while ((i = getc(stdin)) != -1
17335                && (*bp++ = i) != '\n'
17336                && bp < &buf[1024])
17337         /* DO NOTHING */ ;
17338         *bp = '\0';
17339         fprintf(stdout, "%s", buf);
17340         fflush(stdin);
17341         if (i == -1)
17342             return 0;
17343         bp = buf;
17344     }
17345 }
17346 EOCP
17347         set tryp
17348         if eval $compile; then
17349             $rm -f tryp.out
17350             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17351             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17352                $cat >&4 <<EOM
17353 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17354 EOM
17355                 : now check for fflushall behaviour
17356                 case "$fflushall" in
17357                 '')     set try -DTRY_FFLUSH_ALL $output
17358                         if eval $compile; then
17359                                 $cat >&4 <<EOM
17360 (Now testing the other method--but note that this also may fail.)
17361 EOM
17362                                 $run ./try 2>/dev/null
17363                                 code=$?
17364                                 $from try.out
17365                                 if $test -s try.out -a "X$code" = X42; then
17366                                         fflushall="`$cat try.out`"
17367                                 fi
17368                         fi
17369                         $rm -f core try.core core.try.*
17370                         case "$fflushall" in
17371                         x)      $cat >&4 <<EOM
17372 Whew. Flushing explicitly all the stdio streams works.
17373 EOM
17374                                 fflushall="$define"
17375                                 ;;
17376                         '')     $cat >&4 <<EOM
17377 Sigh. Flushing explicitly all the stdio streams doesn't work.
17378 EOM
17379                                 fflushall="$undef"
17380                                 ;;
17381                         *)      $cat >&4 <<EOM
17382 Cannot figure out whether flushing stdio streams explicitly works or not.
17383 I'm assuming it doesn't.
17384 EOM
17385                                 fflushall="$undef"
17386                                 ;;
17387                         esac
17388                         ;;
17389                 "$define"|true|[yY]*)
17390                         fflushall="$define"
17391                         ;;
17392                 *)
17393                         fflushall="$undef"
17394                         ;;
17395                 esac
17396             else
17397                 $cat >&4 <<EOM
17398 All is futile.  Even fflush(stdin) clobbers input pipes!
17399 EOM
17400                 fflushall="$undef"
17401             fi
17402         else
17403             fflushall="$undef"
17404         fi
17405         $rm -f core tryp.c tryp.core core.tryp.*
17406         ;;
17407 *)      fflushall="$undef"
17408         ;;
17409 esac
17410
17411 case "$fflushNULL$fflushall" in
17412 undefundef)
17413         $cat <<EOM
17414 OK, I give up.  I cannot figure out how to flush pending stdio output.
17415 We won't be flushing handles at all before fork/exec/popen.
17416 EOM
17417         ;;
17418 esac
17419 $rm -f try.* try$exe_ext
17420
17421 : Store the full pathname to the ar program for use in the C program
17422 : Respect a hint or command line value for full_ar.
17423 case "$full_ar" in
17424 '') full_ar=$ar ;;
17425 esac
17426
17427 : Store the full pathname to the sed program for use in the C program
17428 full_sed=$sed
17429
17430 : see what type gids are declared as in the kernel
17431 echo " "
17432 echo "Looking for the type for group ids returned by getgid()."
17433 set gid_t gidtype xxx stdio.h sys/types.h
17434 eval $typedef
17435 case "$gidtype" in
17436 xxx)
17437         xxx=`./findhdr sys/user.h`
17438         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17439         case $1 in
17440         unsigned) dflt="$1 $2" ;;
17441         *) dflt="$1" ;;
17442         esac
17443         ;;
17444 *) dflt="$gidtype";;
17445 esac
17446 case "$gidtype" in
17447 gid_t) echo "gid_t found." ;;
17448 *)      rp="What is the type for group ids returned by getgid()?"
17449         . ./myread
17450         gidtype="$ans"
17451         ;;
17452 esac
17453
17454 echo " "
17455 case "$gidtype" in
17456 *_t) zzz="$gidtype"     ;;
17457 *)   zzz="gid"          ;;
17458 esac
17459 echo "Checking the size of $zzz..." >&4 
17460 cat > try.c <<EOCP
17461 #include <sys/types.h>
17462 #include <stdio.h>
17463 int main() {
17464     printf("%d\n", (int)sizeof($gidtype));
17465     exit(0);
17466 }
17467 EOCP
17468 set try
17469 if eval $compile_ok; then
17470         yyy=`$run ./try`
17471         case "$yyy" in
17472         '')     gidsize=4
17473                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17474                 ;;
17475         *)      gidsize=$yyy
17476                 echo "Your $zzz is $gidsize bytes long."
17477                 ;;
17478         esac
17479 else
17480         gidsize=4
17481         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17482 fi
17483
17484
17485 echo " "
17486 case "$gidtype" in
17487 *_t) zzz="$gidtype"     ;;
17488 *)   zzz="gid"          ;;
17489 esac
17490 echo "Checking the sign of $zzz..." >&4 
17491 cat > try.c <<EOCP
17492 #include <sys/types.h>
17493 #include <stdio.h>
17494 int main() {
17495         $gidtype foo = -1;
17496         if (foo < 0)
17497                 printf("-1\n");
17498         else
17499                 printf("1\n");
17500 }
17501 EOCP
17502 set try
17503 if eval $compile; then
17504         yyy=`$run ./try`
17505         case "$yyy" in
17506         '')     gidsign=1
17507                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17508                 ;;
17509         *)      gidsign=$yyy
17510                 case "$gidsign" in
17511                  1) echo "Your $zzz is unsigned." ;;
17512                 -1) echo "Your $zzz is signed."   ;;
17513                 esac
17514                 ;;
17515         esac
17516 else
17517         gidsign=1
17518         echo "(I can't compile the test program--guessing unsigned.)" >&4
17519 fi
17520
17521
17522 echo " "
17523
17524 if $test X"$quadtype" != X; then
17525
17526 echo "Checking how to print 64-bit integers..." >&4
17527
17528 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17529         $cat >try.c <<'EOCP'
17530 #include <sys/types.h>
17531 #include <stdio.h>
17532 int main() {
17533   int q = 12345678901;
17534   printf("%ld\n", q);
17535 }
17536 EOCP
17537         set try
17538         if eval $compile; then
17539                 yyy=`$run ./try`
17540                 case "$yyy" in
17541                 12345678901)
17542                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17543                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17544                         echo "We will use %d."
17545                         ;;
17546                 esac
17547         fi
17548 fi
17549
17550 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17551         $cat >try.c <<'EOCP'
17552 #include <sys/types.h>
17553 #include <stdio.h>
17554 int main() {
17555   long q = 12345678901;
17556   printf("%ld\n", q);
17557 }
17558 EOCP
17559         set try
17560         if eval $compile; then
17561                 yyy=`$run ./try`
17562                 case "$yyy" in
17563                 12345678901)
17564                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17565                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17566                         echo "We will use %ld."
17567                         ;;
17568                 esac
17569         fi
17570 fi
17571
17572 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17573         $cat >try.c <<'EOCP'
17574 #include <sys/types.h>
17575 #include <inttypes.h>
17576 #include <stdio.h>
17577 int main() {
17578   int64_t q = 12345678901;
17579   printf("%" PRId64 "\n", q);
17580 }
17581 EOCP
17582         set try
17583         if eval $compile; then
17584                 yyy=`$run ./try`
17585                 case "$yyy" in
17586                 12345678901)
17587                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17588                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17589                         echo "We will use the C9X style."
17590                         ;;
17591                 esac
17592         fi
17593 fi
17594
17595 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17596         $cat >try.c <<EOCP
17597 #include <sys/types.h>
17598 #include <stdio.h>
17599 int main() {
17600   $quadtype q = 12345678901;
17601   printf("%Ld\n", q);
17602 }
17603 EOCP
17604         set try
17605         if eval $compile; then
17606                 yyy=`$run ./try`
17607                 case "$yyy" in
17608                 12345678901)
17609                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17610                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17611                         echo "We will use %Ld."
17612                         ;;
17613                 esac
17614         fi
17615 fi
17616
17617 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17618         $cat >try.c <<'EOCP'
17619 #include <sys/types.h>
17620 #include <stdio.h>
17621 int main() {
17622   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17623   printf("%lld\n", q);
17624 }
17625 EOCP
17626         set try
17627         if eval $compile; then
17628                 yyy=`$run ./try`
17629                 case "$yyy" in
17630                 12345678901)
17631                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17632                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17633                         echo "We will use the %lld style."
17634                         ;;
17635                 esac
17636         fi
17637 fi
17638
17639 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17640         $cat >try.c <<EOCP
17641 #include <sys/types.h>
17642 #include <stdio.h>
17643 int main() {
17644   $quadtype q = 12345678901;
17645   printf("%qd\n", q);
17646 }
17647 EOCP
17648         set try
17649         if eval $compile; then
17650                 yyy=`$run ./try`
17651                 case "$yyy" in
17652                 12345678901)
17653                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17654                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17655                         echo "We will use %qd."
17656                         ;;
17657                 esac
17658         fi
17659 fi
17660
17661 if $test X"$sPRId64" = X; then
17662         echo "Cannot figure out how to print 64-bit integers." >&4
17663 fi
17664
17665 $rm -f try try.*
17666
17667 fi
17668
17669 case "$sPRId64" in
17670 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17671         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17672         ;;
17673 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17674         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17675         ;;
17676 esac
17677
17678
17679 echo " "
17680 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17681
17682 if $test X"$ivsize" = X8; then
17683         ivdformat="$sPRId64"
17684         uvuformat="$sPRIu64"
17685         uvoformat="$sPRIo64"
17686         uvxformat="$sPRIx64"
17687         uvXUformat="$sPRIXU64"
17688 else
17689         if $test X"$ivsize" = X"$longsize"; then
17690                 ivdformat='"ld"'
17691                 uvuformat='"lu"'
17692                 uvoformat='"lo"'
17693                 uvxformat='"lx"'
17694                 uvXUformat='"lX"'
17695         else
17696                 if $test X"$ivsize" = X"$intsize"; then
17697                         ivdformat='"d"'
17698                         uvuformat='"u"'
17699                         uvoformat='"o"'
17700                         uvxformat='"x"'
17701                         uvXUformat='"X"'
17702                 else
17703                         : far out
17704                         if $test X"$ivsize" = X"$shortsize"; then
17705                                 ivdformat='"hd"'
17706                                 uvuformat='"hu"'
17707                                 uvoformat='"ho"'
17708                                 uvxformat='"hx"'
17709                                 uvXUformat='"hX"'
17710                         fi
17711                 fi
17712         fi
17713 fi
17714
17715 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17716         nveformat="$sPRIeldbl"
17717         nvfformat="$sPRIfldbl"
17718         nvgformat="$sPRIgldbl"
17719         nvEUformat="$sPRIEUldbl"
17720         nvFUformat="$sPRIFUldbl"
17721         nvGUformat="$sPRIGUldbl"
17722 else
17723         nveformat='"e"'
17724         nvfformat='"f"'
17725         nvgformat='"g"'
17726         nvEUformat='"E"'
17727         nvFUformat='"F"'
17728         nvGUformat='"G"'
17729 fi
17730
17731 case "$ivdformat" in
17732 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17733     exit 1
17734     ;;
17735 esac
17736
17737
17738 echo " "
17739 $echo "Checking the format string to be used for gids..." >&4
17740
17741 case "$gidsign" in
17742 -1)     if $test X"$gidsize" = X"$ivsize"; then
17743                 gidformat="$ivdformat"
17744         else
17745                 if $test X"$gidsize" = X"$longsize"; then
17746                         gidformat='"ld"'
17747                 else
17748                         if $test X"$gidsize" = X"$intsize"; then
17749                                 gidformat='"d"'
17750                         else
17751                                 if $test X"$gidsize" = X"$shortsize"; then
17752                                         gidformat='"hd"'
17753                                 fi
17754                         fi
17755                 fi
17756         fi
17757         ;;
17758 *)      if $test X"$gidsize" = X"$uvsize"; then
17759                 gidformat="$uvuformat"
17760         else
17761                 if $test X"$gidsize" = X"$longsize"; then
17762                         gidformat='"lu"'
17763                 else
17764                         if $test X"$gidsize" = X"$intsize"; then
17765                                 gidformat='"u"'
17766                         else
17767                                 if $test X"$gidsize" = X"$shortsize"; then
17768                                         gidformat='"hu"'
17769                                 fi
17770                         fi
17771                 fi
17772         fi
17773         ;;
17774 esac
17775
17776 : see if getgroups exists
17777 set getgroups d_getgrps
17778 eval $inlibc
17779
17780 : see if setgroups exists
17781 set setgroups d_setgrps
17782 eval $inlibc
17783
17784
17785 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17786 echo " "
17787 case "$d_getgrps$d_setgrps" in
17788 *define*)
17789         case "$groupstype" in
17790         '') dflt="$gidtype" ;;
17791         *)  dflt="$groupstype" ;;
17792         esac
17793         $cat <<EOM
17794 What type of pointer is the second argument to getgroups() and setgroups()?
17795 Usually this is the same as group ids, $gidtype, but not always.
17796
17797 EOM
17798         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17799         . ./myread
17800         groupstype="$ans"
17801         ;;
17802 *)  groupstype="$gidtype";;
17803 esac
17804
17805 echo " "
17806 echo "Checking if your $make program sets \$(MAKE)..." >&4
17807 case "$make_set_make" in
17808 '')
17809         $sed 's/^X //' > testmake.mak << 'EOF'
17810 Xall:
17811 X       @echo 'maketemp="$(MAKE)"'
17812 EOF
17813         case "`$make -f testmake.mak 2>/dev/null`" in
17814         *maketemp=*) make_set_make='#' ;;
17815         *)      make_set_make="MAKE=$make" ;;
17816         esac
17817         $rm -f testmake.mak
17818         ;;
17819 esac
17820 case "$make_set_make" in
17821 '#') echo "Yup, it does.";;
17822 *) echo "Nope, it doesn't.";;
17823 esac
17824
17825 : see what type is used for mode_t
17826 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17827 set mode_t modetype int stdio.h sys/types.h
17828 eval $typedef_ask
17829
17830 : see if stdarg is available
17831 echo " "
17832 if $test `./findhdr stdarg.h`; then
17833         echo "<stdarg.h> found." >&4
17834         valstd="$define"
17835 else
17836         echo "<stdarg.h> NOT found." >&4
17837         valstd="$undef"
17838 fi
17839
17840 : see if varags is available
17841 echo " "
17842 if $test `./findhdr varargs.h`; then
17843         echo "<varargs.h> found." >&4
17844 else
17845         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17846 fi
17847
17848 : set up the varargs testing programs
17849 $cat > varargs.c <<EOP
17850 #ifdef I_STDARG
17851 #include <stdarg.h>
17852 #endif
17853 #ifdef I_VARARGS
17854 #include <varargs.h>
17855 #endif
17856
17857 #ifdef I_STDARG
17858 int f(char *p, ...)
17859 #else
17860 int f(va_alist)
17861 va_dcl
17862 #endif
17863 {
17864         va_list ap;
17865 #ifndef I_STDARG
17866         char *p;
17867 #endif
17868 #ifdef I_STDARG
17869         va_start(ap,p);
17870 #else
17871         va_start(ap);
17872         p = va_arg(ap, char *);
17873 #endif
17874         va_end(ap);
17875 }
17876 EOP
17877 $cat > varargs <<EOP
17878 $startsh
17879 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17880         echo "true"
17881 else
17882         echo "false"
17883 fi
17884 $rm -f varargs$_o
17885 EOP
17886 chmod +x varargs
17887
17888 : now check which varargs header should be included
17889 echo " "
17890 i_varhdr=''
17891 case "$valstd" in
17892 "$define")
17893         if `./varargs I_STDARG`; then
17894                 val='stdarg.h'
17895         elif `./varargs I_VARARGS`; then
17896                 val='varargs.h'
17897         fi
17898         ;;
17899 *)
17900         if `./varargs I_VARARGS`; then
17901                 val='varargs.h'
17902         fi
17903         ;;
17904 esac
17905 case "$val" in
17906 '')
17907 echo "I could not find the definition for va_dcl... You have problems..." >&4
17908         val="$undef"; set i_stdarg; eval $setvar
17909         val="$undef"; set i_varargs; eval $setvar
17910         ;;
17911 *) 
17912         set i_varhdr
17913         eval $setvar
17914         case "$i_varhdr" in
17915         stdarg.h)
17916                 val="$define"; set i_stdarg; eval $setvar
17917                 val="$undef"; set i_varargs; eval $setvar
17918                 ;;
17919         varargs.h)
17920                 val="$undef"; set i_stdarg; eval $setvar
17921                 val="$define"; set i_varargs; eval $setvar
17922                 ;;
17923         esac
17924         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17925 esac
17926 $rm -f varargs*
17927
17928 : see if we need va_copy
17929 echo " "
17930 case "$i_stdarg" in
17931 "$define")
17932         $cat >try.c <<EOCP
17933 #include <stdarg.h>
17934 #include <stdio.h>
17935 #$i_stdlib I_STDLIB
17936 #ifdef I_STDLIB
17937 #include <stdlib.h>
17938 #endif
17939 #include <signal.h>
17940
17941 int
17942 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17943 {
17944   return vfprintf(f, fmt, *valp);
17945 }
17946  
17947 int    
17948 myvfprintf(FILE *f, const  char *fmt, va_list val)
17949 {
17950   return ivfprintf(f, fmt, &val);
17951 }
17952       
17953 int
17954 myprintf(char *fmt, ...) 
17955 {
17956   va_list val;
17957   va_start(val, fmt);
17958   return myvfprintf(stdout, fmt, val); 
17959 }         
17960
17961 int
17962 main(int ac, char **av)
17963 {
17964   signal(SIGSEGV, exit);
17965
17966   myprintf("%s%cs all right, then\n", "that", '\'');                            
17967   exit(0);      
17968 }
17969 EOCP
17970         set try
17971         if eval $compile && $run ./try 2>&1 >/dev/null; then
17972                 case "`$run ./try`" in
17973                 "that's all right, then")
17974                         okay=yes
17975                         ;;
17976                 esac
17977         fi
17978         case "$okay" in
17979         yes)    echo "It seems that you don't need va_copy()." >&4
17980                 need_va_copy="$undef"
17981                 ;;
17982         *)      echo "It seems that va_copy() or similar will be needed." >&4
17983                 need_va_copy="$define"
17984                 ;;
17985         esac
17986         $rm -f try.* core core.* *.core *.core.*
17987         ;;
17988 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17989         ;;
17990 esac
17991
17992 : see what type is used for size_t
17993 rp="What is the type used for the length parameter for string functions?"
17994 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17995 eval $typedef_ask
17996
17997 : check for type of arguments to gethostbyaddr. 
17998 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17999         case "$d_gethbyaddr" in
18000         $define)
18001                 $cat <<EOM
18002
18003 Checking to see what type of arguments are accepted by gethostbyaddr().
18004 EOM
18005                 hdrs="$define sys/types.h
18006                         $d_socket sys/socket.h 
18007                         $i_niin netinet/in.h 
18008                         $i_netdb netdb.h
18009                         $i_unistd unistd.h"
18010                 : The first arg can 'char *' or 'void *'
18011                 : The second arg is some of integral type
18012                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18013                         for yyy in size_t long int; do
18014                                 case "$netdb_host_type" in
18015                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18016                                         if ./protochk "$try" $hdrs; then
18017                                                 echo "Your system accepts $xxx for the first arg."
18018                                                 echo "...and $yyy for the second arg."
18019                                                 netdb_host_type="$xxx"
18020                                                 netdb_hlen_type="$yyy"
18021                                         fi
18022                                         ;;
18023                                 esac
18024                         done
18025                 done
18026                 : In case none of those worked, prompt the user.
18027                 case "$netdb_host_type" in
18028                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18029                         dflt='char *'
18030                         . ./myread
18031                         netdb_host_type=$ans
18032                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18033                         dflt="$sizetype"
18034                         . ./myread
18035                         netdb_hlen_type=$ans
18036                         ;;
18037                 esac
18038                 ;;
18039         *)      : no gethostbyaddr, so pick harmless defaults
18040                 netdb_host_type='char *'
18041                 netdb_hlen_type="$sizetype"
18042                 ;;
18043         esac
18044         # Remove the "const" if needed. -- but then we'll have a 
18045         # prototype clash!
18046         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18047 fi
18048
18049 : check for type of argument to gethostbyname. 
18050 if test "X$netdb_name_type" = X ; then
18051         case "$d_gethbyname" in
18052         $define)
18053                 $cat <<EOM
18054
18055 Checking to see what type of argument is accepted by gethostbyname().
18056 EOM
18057                 hdrs="$define sys/types.h
18058                         $d_socket sys/socket.h 
18059                         $i_niin netinet/in.h 
18060                         $i_netdb netdb.h
18061                         $i_unistd unistd.h"
18062                 for xxx in "const char *" "char *"; do
18063                         case "$netdb_name_type" in
18064                         '')     try="extern struct hostent *gethostbyname($xxx);"
18065                                 if ./protochk "$try" $hdrs; then
18066                                         echo "Your system accepts $xxx."
18067                                         netdb_name_type="$xxx"
18068                                 fi
18069                                 ;;
18070                         esac
18071                 done
18072                 : In case none of those worked, prompt the user.
18073                 case "$netdb_name_type" in
18074                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18075                         dflt='char *'
18076                         . ./myread
18077                         netdb_name_type=$ans
18078                         ;;
18079                 esac
18080                 ;;
18081         *)      : no gethostbyname, so pick harmless default
18082                 netdb_name_type='char *'
18083                 ;;
18084         esac
18085 fi
18086
18087 : check for type of 1st argument to getnetbyaddr. 
18088 if test "X$netdb_net_type" = X ; then
18089         case "$d_getnbyaddr" in
18090         $define)
18091                 $cat <<EOM
18092
18093 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18094 EOM
18095                 hdrs="$define sys/types.h
18096                         $d_socket sys/socket.h 
18097                         $i_niin netinet/in.h 
18098                         $i_netdb netdb.h
18099                         $i_unistd unistd.h"
18100                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18101                         case "$netdb_net_type" in
18102                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18103                                 if ./protochk "$try" $hdrs; then
18104                                         echo "Your system accepts $xxx."
18105                                         netdb_net_type="$xxx"
18106                                 fi
18107                                 ;;
18108                         esac
18109                 done
18110                 : In case none of those worked, prompt the user.
18111                 case "$netdb_net_type" in
18112                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18113                         dflt='long'
18114                         . ./myread
18115                         netdb_net_type=$ans
18116                         ;;
18117                 esac
18118                 ;;
18119         *)      : no getnetbyaddr, so pick harmless default
18120                 netdb_net_type='long'
18121                 ;;
18122         esac
18123 fi
18124 : locate the preferred pager for this system
18125 case "$pager" in
18126 '')
18127         dflt=''
18128         case "$pg" in
18129         /*) dflt=$pg;;
18130         [a-zA-Z]:/*) dflt=$pg;;
18131         esac
18132         case "$more" in
18133         /*) dflt=$more;;
18134         [a-zA-Z]:/*) dflt=$more;;
18135         esac
18136         case "$less" in
18137         /*) dflt=$less;;
18138         [a-zA-Z]:/*) dflt=$less;;
18139         esac
18140         case "$dflt" in
18141         '') dflt=/usr/ucb/more;;
18142         esac
18143         ;;
18144 *) dflt="$pager";;
18145 esac
18146 echo " "
18147 fn=f/
18148 rp='What pager is used on your system?'
18149 . ./getfile
18150 pager="$ans"
18151
18152 : see what type pids are declared as in the kernel
18153 rp="What is the type of process ids on this system?"
18154 set pid_t pidtype int stdio.h sys/types.h
18155 eval $typedef_ask
18156
18157 : Find earliest binary compatible site_perl subdirectory perl can use.
18158 case "$bincompat5005" in
18159 "$define") xs_apiversion='5.005' ;;
18160 *) xs_apiversion=$version ;;   # The current site_perl version.
18161 esac
18162 : Find earliest pure perl site_perl subdirectory perl can use.
18163 : The versioned directories started at 5.005.
18164 pm_apiversion='5.005'
18165
18166 : see if ar generates random libraries by itself
18167 echo " "
18168 echo "Checking how to generate random libraries on your machine..." >&4
18169 echo 'int bar1() { return bar2(); }' > bar1.c
18170 echo 'int bar2() { return 2; }' > bar2.c
18171 $cat > foo.c <<'EOP'
18172 int main() { printf("%d\n", bar1()); exit(0); }
18173 EOP
18174 $cc $ccflags -c bar1.c >/dev/null 2>&1
18175 $cc $ccflags -c bar2.c >/dev/null 2>&1
18176 $cc $ccflags -c foo.c >/dev/null 2>&1
18177 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18178 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18179         $run ./foobar >/dev/null 2>&1; then
18180         echo "$ar appears to generate random libraries itself."
18181         orderlib=false
18182         ranlib=":"
18183 elif $ar ts bar$_a >/dev/null 2>&1 &&
18184         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18185         $run ./foobar >/dev/null 2>&1; then
18186                 echo "a table of contents needs to be added with '$ar ts'."
18187                 orderlib=false
18188                 ranlib="$ar ts"
18189 else
18190         case "$ranlib" in
18191         :) ranlib='';;
18192         '')
18193                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18194                 $test -f $ranlib || ranlib=''
18195                 ;;
18196         esac
18197         if $test -n "$ranlib"; then
18198                 echo "your system has '$ranlib'; we'll use that."
18199                 orderlib=false
18200         else
18201                 echo "your system doesn't seem to support random libraries"
18202                 echo "so we'll use lorder and tsort to order the libraries."
18203                 orderlib=true
18204                 ranlib=":"
18205         fi
18206 fi
18207 $rm -f foo* bar* 
18208
18209 : check for type of arguments to select. 
18210 case "$selecttype" in
18211 '') case "$d_select" in
18212         $define)
18213                 echo " "
18214                 $cat <<EOM
18215 Checking to see what type of arguments are accepted by select().
18216 EOM
18217                 hdrs="$define sys/types.h
18218                         $i_systime sys/time.h 
18219                         $i_sysselct sys/select.h
18220                         $d_socket sys/socket.h"
18221                 : The first arg can be int, unsigned, or size_t
18222                 : The last arg may or may not be 'const'
18223                 val=''
18224                 : void pointer has been seen but using that
18225                 : breaks the selectminbits test
18226                 for xxx in 'fd_set *' 'int *'; do
18227                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18228                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18229                                         case "$val" in
18230                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18231                                                 if ./protochk "$try" $hdrs; then
18232                                                         echo "Your system accepts $xxx."
18233                                                         val="$xxx"
18234                                                 fi
18235                                                 ;;
18236                                         esac
18237                                 done
18238                         done
18239                 done
18240                 case "$val" in
18241                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18242                         case "$d_fd_set" in
18243                                 $define) dflt="fd_set *" ;;
18244                                 *)              dflt="int *" ;;
18245                         esac
18246                         . ./myread
18247                         val=$ans
18248                         ;;
18249                 esac
18250                 selecttype="$val"
18251                 ;;
18252         *)      : no select, so pick a harmless default
18253                 selecttype='int *'
18254                 ;;
18255         esac
18256         ;;
18257 esac
18258
18259 : check for the select 'width'
18260 case "$selectminbits" in
18261 '') case "$d_select" in
18262         $define)
18263                 $cat <<EOM
18264
18265 Checking to see on how many bits at a time your select() operates...
18266 EOM
18267                 $cat >try.c <<EOCP
18268 #include <sys/types.h>
18269 #$i_time I_TIME
18270 #$i_systime I_SYS_TIME
18271 #$i_systimek I_SYS_TIME_KERNEL
18272 #ifdef I_TIME
18273 #   include <time.h>
18274 #endif
18275 #ifdef I_SYS_TIME
18276 #   ifdef I_SYS_TIME_KERNEL
18277 #       define KERNEL
18278 #   endif
18279 #   include <sys/time.h>
18280 #   ifdef I_SYS_TIME_KERNEL
18281 #       undef KERNEL
18282 #   endif
18283 #endif
18284 #$i_sysselct I_SYS_SELECT
18285 #ifdef I_SYS_SELECT
18286 #include <sys/select.h>
18287 #endif
18288 #$d_socket HAS_SOCKET
18289 #ifdef HAS_SOCKET
18290 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18291 #endif
18292 #include <stdio.h>
18293 $selecttype b;
18294 #define S sizeof(*(b))
18295 #define MINBITS 64
18296 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18297 #define NBITS  (NBYTES * 8)
18298 int main() {
18299     char s[NBYTES];
18300     struct timeval t;
18301     int i;
18302     FILE* fp;
18303     int fd;
18304
18305     fclose(stdin);
18306     fp = fopen("try.c", "r");
18307     if (fp == 0)
18308       exit(1);
18309     fd = fileno(fp);
18310     if (fd < 0)
18311       exit(2);
18312     b = ($selecttype)s;
18313     for (i = 0; i < NBITS; i++)
18314         FD_SET(i, b);
18315     t.tv_sec  = 0;
18316     t.tv_usec = 0;
18317     select(fd + 1, b, 0, 0, &t);
18318     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18319     printf("%d\n", i + 1);
18320     return 0;
18321 }
18322 EOCP
18323                 set try
18324                 if eval $compile_ok; then
18325                         selectminbits=`$run ./try`
18326                         case "$selectminbits" in
18327                         '')     cat >&4 <<EOM
18328 Cannot figure out on how many bits at a time your select() operates.
18329 I'll play safe and guess it is 32 bits.
18330 EOM
18331                                 selectminbits=32
18332                                 bits="32 bits"
18333                                 ;;
18334                         1)      bits="1 bit" ;;
18335                         *)      bits="$selectminbits bits" ;;
18336                         esac
18337                         echo "Your select() operates on $bits at a time." >&4
18338                 else
18339                         rp='What is the minimum number of bits your select() operates on?'
18340                         case "$byteorder" in
18341                         1234|12345678)  dflt=32 ;;
18342                         *)              dflt=1  ;;
18343                         esac
18344                         . ./myread
18345                         val=$ans
18346                         selectminbits="$val"
18347                 fi
18348                 $rm -f try.* try
18349                 ;;
18350         *)      : no select, so pick a harmless default
18351                 selectminbits='32'
18352                 ;;
18353         esac
18354         ;;
18355 esac
18356
18357 : Trace out the files included by signal.h, then look for SIGxxx names.
18358 : Remove SIGARRAYSIZE used by HPUX.
18359 : Remove SIGSTKSIZE used by Linux.
18360 : Remove SIGSTKSZ used by Posix.
18361 : Remove SIGTYP void lines used by OS2.
18362 : Some cpps, like os390, dont give the file name anywhere
18363 if [ "X$fieldn" = X ]; then
18364         : Just make some guesses.  We check them later.
18365         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18366 else
18367         xxx=`echo '#include <signal.h>' |
18368         $cppstdin $cppminus $cppflags 2>/dev/null |
18369         $grep '^[       ]*#.*include' | 
18370         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18371 fi
18372 : Check this list of files to be sure we have parsed the cpp output ok.
18373 : This will also avoid potentially non-existent files, such 
18374 : as ../foo/bar.h
18375 xxxfiles=''
18376 for xx in $xxx /dev/null ; do
18377         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18378 done
18379 : If we have found no files, at least try signal.h
18380 case "$xxxfiles" in
18381 '')     xxxfiles=`./findhdr signal.h` ;;
18382 esac
18383 xxx=`awk '
18384 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18385         print substr($2, 4, 20)
18386 }
18387 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18388         print substr($3, 4, 20)
18389 }' $xxxfiles`
18390 : Append some common names just in case the awk scan failed.
18391 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18392 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18393 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18394 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18395 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18396
18397 : generate a few handy files for later
18398 $cat > signal.c <<'EOCP'
18399 #include <sys/types.h>
18400 #include <signal.h>
18401 #include <stdio.h>
18402 int main() {
18403
18404 /* Strange style to avoid deeply-nested #if/#else/#endif */
18405 #ifndef NSIG
18406 #  ifdef _NSIG
18407 #    define NSIG (_NSIG)
18408 #  endif
18409 #endif
18410
18411 #ifndef NSIG
18412 #  ifdef SIGMAX
18413 #    define NSIG (SIGMAX+1)
18414 #  endif
18415 #endif
18416
18417 #ifndef NSIG
18418 #  ifdef SIG_MAX
18419 #    define NSIG (SIG_MAX+1)
18420 #  endif
18421 #endif
18422
18423 #ifndef NSIG
18424 #  ifdef MAXSIG
18425 #    define NSIG (MAXSIG+1)
18426 #  endif
18427 #endif
18428
18429 #ifndef NSIG
18430 #  ifdef MAX_SIG
18431 #    define NSIG (MAX_SIG+1)
18432 #  endif
18433 #endif
18434
18435 #ifndef NSIG
18436 #  ifdef SIGARRAYSIZE
18437 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18438 #  endif
18439 #endif
18440
18441 #ifndef NSIG
18442 #  ifdef _sys_nsig
18443 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18444 #  endif
18445 #endif
18446
18447 /* Default to some arbitrary number that's big enough to get most
18448    of the common signals.
18449 */
18450 #ifndef NSIG
18451 #    define NSIG 50
18452 #endif
18453
18454 printf("NSIG %d\n", NSIG);
18455
18456 #ifndef JUST_NSIG
18457
18458 EOCP
18459
18460 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18461 {
18462         printf "#ifdef SIG"; printf $1; printf "\n"
18463         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18464         printf $1; printf ");\n"
18465         printf "#endif\n"
18466 }
18467 END {
18468         printf "#endif /* JUST_NSIG */\n";
18469         printf "exit(0);\n}\n";
18470 }
18471 ' >>signal.c
18472 $cat >signal.awk <<'EOP'
18473 BEGIN { ndups = 0 }
18474 $1 ~ /^NSIG$/ { nsig = $2 }
18475 ($1 !~ /^NSIG$/) && (NF == 2) {
18476     if ($2 > maxsig) { maxsig = $2 }
18477     if (sig_name[$2]) {
18478         dup_name[ndups] = $1
18479         dup_num[ndups] = $2
18480         ndups++ 
18481     }
18482     else {
18483         sig_name[$2] = $1
18484         sig_num[$2] = $2
18485     }
18486 }
18487 END { 
18488     if (nsig == 0) {
18489         nsig = maxsig + 1
18490     }
18491     printf("NSIG %d\n", nsig);
18492     for (n = 1; n < nsig; n++) {
18493         if (sig_name[n]) {
18494             printf("%s %d\n", sig_name[n], sig_num[n])
18495         }
18496         else {
18497             printf("NUM%d %d\n", n, n) 
18498         }
18499     }
18500     for (n = 0; n < ndups; n++) {
18501         printf("%s %d\n", dup_name[n], dup_num[n])
18502     }
18503 }
18504 EOP
18505 $cat >signal_cmd <<EOS
18506 $startsh
18507 if $test -s signal.lst; then
18508     echo "Using your existing signal.lst file"
18509         exit 0
18510 fi
18511 xxx="$xxx"
18512 EOS
18513 $cat >>signal_cmd <<'EOS'
18514
18515 set signal
18516 if eval $compile_ok; then
18517         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18518 else
18519         echo "(I can't seem be able to compile the whole test program)" >&4
18520         echo "(I'll try it in little pieces.)" >&4
18521         set signal -DJUST_NSIG
18522         if eval $compile_ok; then
18523                 $run ./signal$_exe > signal.nsg
18524                 $cat signal.nsg
18525         else
18526                 echo "I can't seem to figure out how many signals you have." >&4
18527                 echo "Guessing 50." >&4
18528                 echo 'NSIG 50' > signal.nsg
18529         fi
18530         : Now look at all the signal names, one at a time.
18531         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18532                 $cat > signal.c <<EOCP
18533 #include <sys/types.h>
18534 #include <signal.h>
18535 #include <stdio.h>
18536 int main() {
18537 printf("$xx %d\n", SIG${xx});
18538 return 0;
18539 }
18540 EOCP
18541                 set signal
18542                 if eval $compile; then
18543                         echo "SIG${xx} found."
18544                         $run ./signal$_exe  >> signal.ls1
18545                 else
18546                         echo "SIG${xx} NOT found."
18547                 fi
18548         done
18549         if $test -s signal.ls1; then
18550                 $cat signal.nsg signal.ls1 |
18551                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18552         fi
18553
18554 fi
18555 if $test -s signal.lst; then
18556         :
18557 else
18558         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18559         echo 'kill -l' >signal
18560         set X `csh -f <signal`
18561         $rm -f signal
18562         shift
18563         case $# in
18564         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18565         esac
18566         echo $@ | $tr ' ' $trnl | \
18567             $awk '{ printf "%s %d\n", $1, ++s; }
18568                   END { printf "NSIG %d\n", ++s }' >signal.lst
18569 fi
18570 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18571 EOS
18572 chmod a+x signal_cmd
18573 $eunicefix signal_cmd
18574
18575 : generate list of signal names
18576 echo " "
18577 case "$sig_name_init" in
18578 '') doinit=yes ;;
18579 *)  case "$sig_num_init" in
18580     ''|*,*) doinit=yes ;;
18581     esac ;;
18582 esac
18583 case "$doinit" in
18584 yes)
18585         echo "Generating a list of signal names and numbers..." >&4
18586         . ./signal_cmd
18587         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18588         sig_name=`$awk 'BEGIN { printf "ZERO " }
18589                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18590         sig_num=`$awk  'BEGIN { printf "0 " }
18591                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18592         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18593                              !/^NSIG/   { printf "\"%s\", ", $1 }
18594                              END        { printf "0\n" }' signal.lst`
18595         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18596                              !/^NSIG/   { printf "%d, ", $2}
18597                              END        { printf "0\n"}' signal.lst`
18598         ;;
18599 esac
18600 echo "The following $sig_count signals are available:"
18601 echo " "
18602 echo $sig_name | $awk \
18603 'BEGIN { linelen = 0 }
18604 {
18605         for (i = 1; i <= NF; i++) {
18606                 name = "SIG" $i " "
18607                 linelen = linelen + length(name)
18608                 if (linelen > 70) {
18609                         printf "\n"
18610                         linelen = length(name)
18611                 }
18612                 printf "%s", name
18613         }
18614         printf "\n"
18615 }'
18616 sig_size=`echo $sig_name | awk '{print NF}'`
18617 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18618
18619 echo " "
18620 case "$sizetype" in
18621 *_t) zzz="$sizetype"    ;;
18622 *)   zzz="filesize"     ;;
18623 esac
18624 echo "Checking the size of $zzz..." >&4 
18625 cat > try.c <<EOCP
18626 #include <sys/types.h>
18627 #include <stdio.h>
18628 int main() {
18629     printf("%d\n", (int)sizeof($sizetype));
18630     exit(0);
18631 }
18632 EOCP
18633 set try
18634 if eval $compile_ok; then
18635         yyy=`$run ./try`
18636         case "$yyy" in
18637         '')     sizesize=4
18638                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18639                 ;;
18640         *)      sizesize=$yyy
18641                 echo "Your $zzz size is $sizesize bytes."
18642                 ;;
18643         esac
18644 else
18645         sizesize=4
18646         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18647 fi
18648
18649
18650 : check for socklen_t
18651 echo " "
18652 echo "Checking to see if you have socklen_t..." >&4
18653 $cat >try.c <<EOCP
18654 #include <sys/types.h>
18655 #$d_socket HAS_SOCKET
18656 #ifdef HAS_SOCKET
18657 #include <sys/socket.h>
18658 #endif
18659 int main() { socklen_t x = 16; }
18660 EOCP
18661 set try
18662 if eval $compile; then
18663         val="$define"
18664         echo "You have socklen_t."
18665 else
18666         val="$undef"
18667         echo "You do not have socklen_t."
18668         case "$sizetype" in
18669         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18670         esac
18671 fi
18672 $rm -f try try.*
18673 set d_socklen_t
18674 eval $setvar
18675
18676 : see if this is a socks.h system
18677 set socks.h i_socks
18678 eval $inhdr
18679
18680 : check for type of the size argument to socket calls
18681 case "$d_socket" in
18682 "$define")
18683         $cat <<EOM
18684
18685 Checking to see what type is the last argument of accept().
18686 EOM
18687         yyy=''
18688         case "$d_socklen_t" in
18689         "$define") yyy="$yyy socklen_t"
18690         esac
18691         yyy="$yyy $sizetype int long unsigned"
18692         for xxx in $yyy; do
18693                 case "$socksizetype" in
18694                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18695                         case "$usesocks" in
18696                         "$define")
18697                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18698                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18699                                         socksizetype="$xxx"
18700                                 fi
18701                                 ;;
18702                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18703                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18704                                         socksizetype="$xxx"
18705                                 fi
18706                                 ;;
18707                         esac
18708                         ;;
18709                 esac
18710         done
18711 : In case none of those worked, prompt the user.
18712         case "$socksizetype" in
18713         '')     rp='What is the type for socket address structure sizes?'
18714                 dflt='int'
18715                 . ./myread
18716                 socksizetype=$ans
18717                 ;;
18718         esac
18719         ;;
18720 *)      : no sockets, so pick relatively harmless default
18721         socksizetype='int'
18722         ;;
18723 esac
18724
18725 : see what type is used for signed size_t
18726 set ssize_t ssizetype int stdio.h sys/types.h
18727 eval $typedef
18728 dflt="$ssizetype"
18729 $cat > try.c <<EOM
18730 #include <stdio.h>
18731 #include <sys/types.h>
18732 #define Size_t $sizetype
18733 #define SSize_t $dflt
18734 int main()
18735 {
18736         if (sizeof(Size_t) == sizeof(SSize_t))
18737                 printf("$dflt\n");
18738         else if (sizeof(Size_t) == sizeof(int))
18739                 printf("int\n");
18740         else 
18741                 printf("long\n");
18742         exit(0);
18743 }
18744 EOM
18745 echo " "
18746 set try
18747 if eval $compile_ok && $run ./try > /dev/null; then
18748         ssizetype=`$run ./try`
18749         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18750 else
18751         $cat >&4 <<EOM
18752 Help! I can't compile and run the ssize_t test program: please enlighten me!
18753 (This is probably a misconfiguration in your system or libraries, and
18754 you really ought to fix it.  Still, I'll try anyway.)
18755
18756 I need a type that is the same size as $sizetype, but is guaranteed to
18757 be signed.  Common values are ssize_t, int and long.
18758
18759 EOM
18760         rp="What signed type is the same size as $sizetype?"
18761         . ./myread
18762         ssizetype="$ans"
18763 fi
18764 $rm -f try try.*
18765
18766 : see what type of char stdio uses.
18767 echo " "
18768 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18769 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18770         echo "Your stdio uses unsigned chars." >&4
18771         stdchar="unsigned char"
18772 else
18773         echo "Your stdio uses signed chars." >&4
18774         stdchar="char"
18775 fi
18776 $rm -f stdioh
18777
18778
18779
18780 : see what type uids are declared as in the kernel
18781 echo " "
18782 echo "Looking for the type for user ids returned by getuid()."
18783 set uid_t uidtype xxx stdio.h sys/types.h
18784 eval $typedef
18785 case "$uidtype" in
18786 xxx)
18787         xxx=`./findhdr sys/user.h`
18788         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18789         case $1 in
18790         unsigned) dflt="$1 $2" ;;
18791         *) dflt="$1" ;;
18792         esac
18793         ;;
18794 *) dflt="$uidtype";;
18795 esac
18796 case "$uidtype" in
18797 uid_t)  echo "uid_t found." ;;
18798 *)      rp="What is the type for user ids returned by getuid()?"
18799         . ./myread
18800         uidtype="$ans"
18801         ;;
18802 esac
18803
18804 echo " "
18805 case "$uidtype" in
18806 *_t) zzz="$uidtype"     ;;
18807 *)   zzz="uid"          ;;
18808 esac
18809 echo "Checking the size of $zzz..." >&4 
18810 cat > try.c <<EOCP
18811 #include <sys/types.h>
18812 #include <stdio.h>
18813 int main() {
18814     printf("%d\n", (int)sizeof($uidtype));
18815     exit(0);
18816 }
18817 EOCP
18818 set try
18819 if eval $compile_ok; then
18820         yyy=`$run ./try`
18821         case "$yyy" in
18822         '')     uidsize=4
18823                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18824                 ;;
18825         *)      uidsize=$yyy
18826                 echo "Your $zzz is $uidsize bytes long."
18827                 ;;
18828         esac
18829 else
18830         uidsize=4
18831         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18832 fi
18833
18834 echo " "
18835 case "$uidtype" in
18836 *_t) zzz="$uidtype"     ;;
18837 *)   zzz="uid"          ;;
18838 esac
18839 echo "Checking the sign of $zzz..." >&4
18840 cat > try.c <<EOCP
18841 #include <sys/types.h>
18842 #include <stdio.h>
18843 int main() {
18844         $uidtype foo = -1;
18845         if (foo < 0)
18846                 printf("-1\n");
18847         else
18848                 printf("1\n");
18849 }
18850 EOCP
18851 set try
18852 if eval $compile; then
18853         yyy=`$run ./try`
18854         case "$yyy" in
18855         '')     uidsign=1
18856                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18857                 ;;
18858         *)      uidsign=$yyy
18859                 case "$uidsign" in
18860                  1) echo "Your $zzz is unsigned." ;;
18861                 -1) echo "Your $zzz is signed."   ;;
18862                 esac
18863                 ;;
18864         esac
18865 else
18866         uidsign=1
18867         echo "(I can't compile the test program--guessing unsigned.)" >&4
18868 fi
18869
18870
18871
18872 echo " "
18873 $echo "Checking the format string to be used for uids..." >&4
18874
18875 case "$uidsign" in
18876 -1)     if $test X"$uidsize" = X"$ivsize"; then
18877                 uidformat="$ivdformat"
18878         else
18879                 if $test X"$uidsize" = X"$longsize"; then
18880                         uidformat='"ld"'
18881                 else
18882                         if $test X"$uidsize" = X"$intsize"; then
18883                                 uidformat='"d"'
18884                         else
18885                                 if $test X"$uidsize" = X"$shortsize"; then
18886                                         uidformat='"hd"'
18887                                 fi
18888                         fi
18889                 fi
18890         fi
18891         ;;
18892 *)      if $test X"$uidsize" = X"$uvsize"; then
18893                 uidformat="$uvuformat"
18894         else
18895                 if $test X"$uidsize" = X"$longsize"; then
18896                         uidformat='"lu"'
18897                 else
18898                         if $test X"$uidsize" = X"$intsize"; then
18899                                 uidformat='"u"'
18900                         else
18901                                 if $test X"$uidsize" = X"$shortsize"; then
18902                                         uidformat='"hu"'
18903                                 fi
18904                         fi
18905                 fi
18906         fi
18907         ;;
18908 esac
18909
18910 : determine compiler compiler
18911 case "$yacc" in
18912 '')
18913         dflt=yacc;;
18914 *)
18915         dflt="$yacc";;
18916 esac
18917 echo " "
18918 comp='yacc'
18919 if $test -f "$byacc$_exe"; then
18920         dflt="$byacc"
18921         comp="byacc or $comp"
18922 fi
18923 if $test -f "$bison$_exe"; then
18924         comp="$comp or bison -y"
18925 fi
18926 rp="Which compiler compiler ($comp) shall I use?"
18927 . ./myread
18928 yacc="$ans"
18929 case "$yacc" in
18930 *bis*)
18931         case "$yacc" in
18932         *-y*) ;;
18933         *)
18934                 yacc="$yacc -y"
18935                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18936                 ;;
18937         esac
18938         ;;
18939 esac
18940
18941 : see if this is a fp.h system
18942 set fp.h i_fp
18943 eval $inhdr
18944
18945 : see if this is a fp_class.h system
18946 set fp_class.h i_fp_class
18947 eval $inhdr
18948
18949 : see if this is a ieeefp.h system
18950 case "$i_ieeefp" in
18951 '' ) set ieeefp.h i_ieeefp
18952      eval $inhdr
18953      ;;
18954 esac
18955
18956 : see if this is a libutil.h system
18957 set libutil.h i_libutil
18958 eval $inhdr
18959
18960 : see if mach cthreads are available
18961 if test "X$usethreads" = "X$define"; then
18962         set mach/cthreads.h i_machcthr
18963         eval $inhdr
18964 else
18965         i_machcthr="$undef"
18966 fi
18967
18968
18969
18970 : see if this is a math.h system
18971 set math.h i_math
18972 eval $inhdr
18973
18974 : see if this is a mntent.h system
18975 set mntent.h i_mntent
18976 eval $inhdr
18977
18978 : see if ndbm.h is available
18979 set ndbm.h t_ndbm
18980 eval $inhdr
18981
18982 case "$t_ndbm" in
18983 $undef)
18984     # Some Linux distributions such as RedHat 7.1 put the
18985     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18986     if $test -f /usr/include/gdbm/ndbm.h; then
18987         echo '<gdbm/ndbm.h> found.'
18988         ccflags="$ccflags -I/usr/include/gdbm"
18989         cppflags="$cppflags -I/usr/include/gdbm"
18990         t_ndbm=$define
18991     fi
18992     ;;
18993 esac
18994
18995 case "$t_ndbm" in
18996 $define)
18997         : see if dbm_open exists
18998         set dbm_open d_dbm_open
18999         eval $inlibc
19000         case "$d_dbm_open" in
19001         $undef)
19002                 t_ndbm="$undef"
19003                 echo "We won't be including <ndbm.h>"
19004                 ;;
19005         esac
19006         ;;
19007 esac
19008 val="$t_ndbm"
19009 set i_ndbm
19010 eval $setvar
19011
19012 : see if net/errno.h is available
19013 val=''
19014 set net/errno.h val
19015 eval $inhdr
19016
19017 : Unfortunately, it causes problems on some systems.  Arrgh.
19018 case "$val" in
19019 $define)
19020         cat > try.c <<'EOM'
19021 #include <stdio.h>
19022 #include <errno.h>
19023 #include <net/errno.h>
19024 int func()
19025 {
19026         return ENOTSOCK;
19027 }
19028 EOM
19029         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19030                 echo "We'll be including <net/errno.h>." >&4
19031         else
19032                 echo "We won't be including <net/errno.h>." >&4
19033                 val="$undef"
19034         fi
19035         $rm -f try.* try
19036         ;;
19037 esac
19038 set i_neterrno
19039 eval $setvar
19040
19041 : see if netinet/tcp.h is available
19042 set netinet/tcp.h i_netinettcp
19043 eval $inhdr
19044
19045 : see if this is a poll.h system
19046 set poll.h i_poll
19047 eval $inhdr
19048
19049 : see if this is a prot.h system
19050 set prot.h i_prot
19051 eval $inhdr
19052
19053 echo " "
19054 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19055 $cat <<'EOSH' > Cppsym.know
19056 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19057 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19058 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19059 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19060 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19061 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19062 bull c cadmus clipper CMU COFF COMPILER_VERSION
19063 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19064 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19065 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19066 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19067 GLIBC GLIBC_MINOR
19068 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19069 H3050R H3050RX hbullx20 hcx host_mips
19070 hp200 hp300 hp700 HP700 hp800 hp9000
19071 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19072 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19073 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19074 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19075 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19076 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19077 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19078 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19079 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19080 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19081 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19082 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19083 MATH_HAS_NO_SIDE_EFFECTS
19084 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19085 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19086 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19087 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19088 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19089 NetBSD news1500 news1700 news1800 news1900 news3700
19090 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19091 ns32016 ns32332 ns32k nsc32000
19092 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19093 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19094 pc532 pdp11 PGC PIC plexus PORTAR posix
19095 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19096 POSIX_C_SOURCE POSIX_SOURCE POWER
19097 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19098 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19099 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19100 sony sony_news sonyrisc sparc sparclite spectrum
19101 stardent stdc STDC_EXT stratos sun sun3 sun386
19102 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19103 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19104 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19105 sysV68 sysV88 Tek4132 Tek4300 titan
19106 TM3200 TM5400 TM5600
19107 tower tower32 tower32_200 tower32_600 tower32_700
19108 tower32_800 tower32_850 tss
19109 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19110 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19111 unix UNIX95 UNIX99 unixpc unos
19112 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19113 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19114 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19115 USGr4 USGr4_2
19116 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19117 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19118 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19119 z8000
19120 EOSH
19121 # Maybe put other stuff here too.
19122 cat <<EOSH >>Cppsym.know
19123 $osname
19124 EOSH
19125 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19126 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19127 $cat Cppsym.know > Cppsym.c
19128 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19129 $rm -f Cppsym.a Cppsym.b Cppsym.c
19130 cat <<EOSH > Cppsym
19131 $startsh
19132 if $test \$# -gt 0; then
19133     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19134     if $test -s Cppsym.got; then
19135         $rm -f Cppsym.got
19136         exit 0
19137     fi
19138     $rm -f Cppsym.got
19139     exit 1
19140 else
19141     $tr " " "$trnl" | ./Cppsym.try
19142     exit 0
19143 fi
19144 EOSH
19145 chmod +x Cppsym
19146 $eunicefix Cppsym
19147 cat <<EOSH > Cppsym.try
19148 $startsh
19149 cat <<'EOCP' > try.c
19150 #include <stdio.h>
19151 int main() {
19152 EOCP
19153 $awk \\
19154 EOSH
19155 cat <<'EOSH' >> Cppsym.try
19156 'length($1) > 0 {
19157     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
19158     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
19159     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
19160     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
19161 }'       >> try.c
19162 echo 'return 0;}' >> try.c
19163 EOSH
19164 cat <<EOSH >> Cppsym.try
19165 ccflags="$ccflags"
19166 case "$osname-$gccversion" in
19167 irix-) ccflags="\$ccflags -woff 1178" ;;
19168 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19169 esac
19170 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19171 EOSH
19172 chmod +x Cppsym.try
19173 $eunicefix Cppsym.try
19174 ./Cppsym < Cppsym.know > Cppsym.true
19175 : now check the C compiler for additional symbols
19176 postprocess_cc_v=''
19177 case "$osname" in
19178 aix) postprocess_cc_v="|$tr , ' '" ;;
19179 esac
19180 $cat >ccsym <<EOS
19181 $startsh
19182 $cat >tmp.c <<EOF
19183 extern int foo;
19184 EOF
19185 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19186 do
19187         case "\$i" in
19188         -D*) echo "\$i" | $sed 's/^-D//';;
19189         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
19190         esac
19191 done
19192 $rm -f try.c
19193 EOS
19194 postprocess_cc_v=''
19195 chmod +x ccsym
19196 $eunicefix ccsym
19197 ./ccsym > ccsym1.raw
19198 if $test -s ccsym1.raw; then
19199        $sort ccsym1.raw | $uniq >ccsym.raw
19200 else
19201        mv ccsym1.raw ccsym.raw
19202 fi
19203
19204 $awk '/\=/ { print $0; next }
19205         { print $0"=1" }' ccsym.raw >ccsym.list
19206 $awk '/\=/ { print $0; next }
19207         { print $0"=1" }' Cppsym.true >ccsym.true
19208 $comm -13 ccsym.true ccsym.list >ccsym.own
19209 $comm -12 ccsym.true ccsym.list >ccsym.com
19210 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19211 also=''
19212 if $test -z ccsym.raw; then
19213         echo "Your C compiler doesn't seem to define any symbols!" >&4
19214         echo " "
19215         echo "However, your C preprocessor defines the following symbols:"
19216         $cat Cppsym.true
19217         ccsymbols=''
19218         cppsymbols=`$cat Cppsym.true`
19219         cppsymbols=`echo $cppsymbols`
19220         cppccsymbols="$cppsymbols"
19221 else
19222         if $test -s ccsym.com; then
19223                 echo "Your C compiler and pre-processor define these symbols:"
19224                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19225                 also='also '
19226                 symbols='ones'
19227                 cppccsymbols=`$cat ccsym.com`
19228                 cppccsymbols=`echo $cppccsymbols`
19229                 $test "$silent" || sleep 1
19230         fi
19231         if $test -s ccsym.cpp; then
19232                 $test "$also" && echo " "
19233                 echo "Your C pre-processor ${also}defines the following symbols:"
19234                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19235                 also='further '
19236                 cppsymbols=`$cat ccsym.cpp`
19237                 cppsymbols=`echo $cppsymbols`
19238                 $test "$silent" || sleep 1
19239         fi
19240         if $test -s ccsym.own; then
19241                 $test "$also" && echo " "
19242                 echo "Your C compiler ${also}defines the following cpp symbols:"
19243                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19244                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19245                 ccsymbols=`$cat ccsym.own`
19246                 ccsymbols=`echo $ccsymbols`
19247                 $test "$silent" || sleep 1
19248         fi
19249 fi
19250
19251 : see if this is a termio system
19252 val="$undef"
19253 val2="$undef"
19254 val3="$undef"
19255 if $test `./findhdr termios.h`; then
19256         set tcsetattr i_termios
19257         eval $inlibc
19258         val3="$i_termios"
19259 fi
19260 echo " "
19261 case "$val3" in
19262 "$define") echo "You have POSIX termios.h... good!" >&4;;
19263 *) if ./Cppsym pyr; then
19264                 case "`/bin/universe`" in
19265                 ucb) if $test `./findhdr sgtty.h`; then
19266                                 val2="$define"
19267                                 echo "<sgtty.h> found." >&4
19268                         else
19269                                 echo "System is pyramid with BSD universe."
19270                                 echo "<sgtty.h> not found--you could have problems." >&4
19271                         fi;;
19272                 *) if $test `./findhdr termio.h`; then
19273                                 val="$define"
19274                                 echo "<termio.h> found." >&4
19275                         else
19276                                 echo "System is pyramid with USG universe."
19277                                 echo "<termio.h> not found--you could have problems." >&4
19278                         fi;;
19279                 esac
19280         elif ./usg; then
19281                 if $test `./findhdr termio.h`; then
19282                         echo "<termio.h> found." >&4
19283                         val="$define"
19284                 elif $test `./findhdr sgtty.h`; then
19285                         echo "<sgtty.h> found." >&4
19286                         val2="$define"
19287                 else
19288 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19289                 fi
19290         else
19291                 if $test `./findhdr sgtty.h`; then
19292                         echo "<sgtty.h> found." >&4
19293                         val2="$define"
19294                 elif $test `./findhdr termio.h`; then
19295                         echo "<termio.h> found." >&4
19296                         val="$define"
19297                 else
19298 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19299                 fi
19300         fi;;
19301 esac
19302 set i_termio; eval $setvar
19303 val=$val2; set i_sgtty; eval $setvar
19304 val=$val3; set i_termios; eval $setvar
19305
19306 : see if stddef is available
19307 set stddef.h i_stddef
19308 eval $inhdr
19309
19310 : see if this is a sunmath.h system
19311 set sunmath.h i_sunmath
19312 eval $inhdr
19313
19314 : see if sys/access.h is available
19315 set sys/access.h i_sysaccess
19316 eval $inhdr
19317
19318 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19319 set sys/filio.h i_sysfilio
19320 eval $inhdr
19321 echo " "
19322 if $test `./findhdr sys/ioctl.h`; then
19323         val="$define"
19324         echo '<sys/ioctl.h> found.' >&4
19325 else
19326         val="$undef"
19327         if $test $i_sysfilio = "$define"; then
19328             echo '<sys/ioctl.h> NOT found.' >&4
19329         else
19330                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19331                 $test $i_termio = "$define" && xxx="termio.h"
19332                 $test $i_termios = "$define" && xxx="termios.h"
19333 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19334         fi
19335 fi
19336 set i_sysioctl
19337 eval $setvar
19338
19339 : see if socket ioctl defs are in sys/sockio.h
19340 echo " "
19341 xxx=`./findhdr sys/sockio.h`
19342 if $test "$xxx"; then
19343         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19344                 val="$define"
19345                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19346         else
19347                 val="$undef"
19348                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19349         fi
19350 else
19351         val="$undef"
19352         $cat <<EOM
19353 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19354 EOM
19355 fi
19356 set i_syssockio
19357 eval $setvar
19358
19359
19360 : see if this is a syslog.h system
19361 set syslog.h i_syslog
19362 eval $inhdr
19363
19364
19365 : see if this is a sys/mode.h system
19366 set sys/mode.h i_sysmode
19367 eval $inhdr
19368
19369 : see if sys/resource.h has to be included
19370 set sys/resource.h i_sysresrc
19371 eval $inhdr
19372
19373 : see if sys/security.h is available
19374 set sys/security.h i_syssecrt
19375 eval $inhdr
19376
19377 : see if this is a sys/statvfs.h system
19378 set sys/statvfs.h i_sysstatvfs
19379 eval $inhdr
19380
19381 : see if this is a sys/un.h system
19382 set sys/un.h i_sysun
19383 eval $inhdr
19384
19385
19386 : see if this is a sys/utsname.h system
19387 set sys/utsname.h i_sysutsname
19388 eval $inhdr
19389
19390 : see if this is a syswait system
19391 set sys/wait.h i_syswait
19392 eval $inhdr
19393
19394 : see if this is a ustat.h system
19395 set ustat.h i_ustat
19396 eval $inhdr
19397
19398 : see if this is an utime system
19399 set utime.h i_utime
19400 eval $inhdr
19401
19402 : see if this is a values.h system
19403 set values.h i_values
19404 eval $inhdr
19405
19406 : see if this is a vfork system
19407 case "$d_vfork" in
19408 "$define")
19409         set vfork.h i_vfork
19410         eval $inhdr
19411         ;;
19412 *)
19413         i_vfork="$undef"
19414         ;;
19415 esac
19416
19417 : see if gdbm.h is available
19418 set gdbm.h t_gdbm
19419 eval $inhdr
19420 case "$t_gdbm" in
19421 $define)
19422         : see if gdbm_open exists
19423         set gdbm_open d_gdbm_open
19424         eval $inlibc
19425         case "$d_gdbm_open" in
19426         $undef)
19427                 t_gdbm="$undef"
19428                 echo "We won't be including <gdbm.h>"
19429                 ;;
19430         esac
19431         ;;
19432 esac
19433 val="$t_gdbm"
19434 set i_gdbm
19435 eval $setvar
19436
19437 echo " "
19438 echo "Looking for extensions..." >&4
19439 : If we are using the old config.sh, known_extensions may contain
19440 : old or inaccurate or duplicate values.
19441 known_extensions=''
19442 nonxs_extensions=''
19443 : We do not use find because it might not be available.
19444 : We do not just use MANIFEST because the user may have dropped
19445 : some additional extensions into the source tree and expect them
19446 : to be built.
19447
19448 : Function to recursively find available extensions, ignoring DynaLoader
19449 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19450 find_extensions='
19451     for xxx in *; do
19452        case "$xxx" in
19453            DynaLoader|dynaload) ;;
19454            *)
19455            if $test -f $xxx/$xxx.xs; then
19456                known_extensions="$known_extensions $1$xxx";
19457            elif $test -f $xxx/Makefile.PL; then
19458                nonxs_extensions="$nonxs_extensions $1$xxx";
19459            else
19460                if $test -d $xxx -a $# -lt 10; then
19461                    set $1$xxx/ $*;
19462                    cd "$xxx";
19463                    eval $find_extensions;
19464                    cd ..;
19465                    shift;
19466                fi;
19467            fi
19468            ;;
19469        esac;
19470     done'
19471 tdir=`pwd`
19472 cd "$rsrc/ext"
19473 set X
19474 shift
19475 eval $find_extensions
19476 # Special case:  Add in threads/shared since it is not picked up by the
19477 # recursive find above (and adding in general recursive finding breaks
19478 # SDBM_File/sdbm).  A.D.  10/25/2001.
19479 known_extensions="$known_extensions threads/shared"
19480 set X $nonxs_extensions
19481 shift
19482 nonxs_extensions="$*"
19483 set X $known_extensions
19484 shift
19485 known_extensions="$*"
19486 cd "$tdir"
19487
19488 : Now see which are supported on this system.
19489 avail_ext=''
19490 for xxx in $known_extensions ; do
19491         case "$xxx" in
19492         DB_File|db_file)
19493                 case "$i_db" in
19494                 $define) avail_ext="$avail_ext $xxx" ;;
19495                 esac
19496                 ;;
19497         GDBM_File|gdbm_fil)
19498                 case "$i_gdbm" in 
19499                 $define) avail_ext="$avail_ext $xxx" ;;
19500                 esac
19501                 ;;
19502         I18N/Langinfo|i18n_lan)
19503                 case "$i_langinfo$d_nl_langinfo" in 
19504                 $define$define) avail_ext="$avail_ext $xxx" ;;
19505                 esac
19506                 ;;
19507         NDBM_File|ndbm_fil)
19508                 case "$i_ndbm" in
19509                 $define)
19510                     case "$osname-$use64bitint" in
19511                     cygwin-*|hpux-define)
19512                         case "$libs" in
19513                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19514                         esac
19515                         ;;
19516                     *) avail_ext="$avail_ext $xxx" ;;
19517                     esac
19518                     ;;
19519                 esac
19520                 ;;
19521         ODBM_File|odbm_fil) 
19522                 case "${i_dbm}${i_rpcsvcdbm}" in
19523                 *"${define}"*)
19524                     case "$osname-$use64bitint" in
19525                     cygwin-*|hpux-define)
19526                         case "$libs" in
19527                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19528                         esac
19529                         ;;
19530                     *) avail_ext="$avail_ext $xxx" ;;
19531                     esac
19532                     ;;
19533                 esac
19534                 ;;
19535         POSIX|posix)
19536                 case "$useposix" in
19537                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19538                 esac
19539                 ;;
19540         Opcode|opcode)
19541                 case "$useopcode" in
19542                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19543                 esac
19544                 ;;
19545         Socket|socket)
19546                 case "$d_socket" in 
19547                 true|$define|y)
19548                     case "$osname" in
19549                     beos) ;; # not unless BONE
19550                     *) avail_ext="$avail_ext $xxx" ;;
19551                     esac
19552                     ;;
19553                 esac
19554                 ;;
19555         Sys/Syslog|sys/syslog)
19556                 : XXX syslog requires socket
19557                 case "$d_socket" in 
19558                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19559                 esac
19560                 ;;
19561         Thread|thread)
19562                 case "$usethreads" in
19563                 true|$define|y)
19564                         case "$useithreads" in
19565                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19566                         esac
19567                 esac
19568                 ;;
19569         threads|threads/shared)
19570                 case "$usethreads" in
19571                 true|$define|y)
19572                         case "$useithreads" in
19573                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
19574                         esac
19575                 esac
19576                 ;;
19577         IPC/SysV|ipc/sysv)
19578                 : XXX Do we need a useipcsysv variable here
19579                 case "${d_msg}${d_sem}${d_shm}" in 
19580                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19581                 esac
19582                 ;;
19583         *)      avail_ext="$avail_ext $xxx"
19584                 ;;
19585         esac
19586 done
19587
19588 set X $avail_ext
19589 shift
19590 avail_ext="$*"
19591
19592 : Now see which nonxs extensions are supported on this system.
19593 : For now assume all are.
19594 nonxs_ext=''
19595 for xxx in $nonxs_extensions ; do
19596         case "$xxx" in
19597         *)      nonxs_ext="$nonxs_ext $xxx"
19598                 ;;
19599         esac
19600 done
19601
19602 set X $nonxs_ext
19603 shift
19604 nonxs_ext="$*"
19605
19606 case $usedl in
19607 $define)
19608         $cat <<EOM
19609 A number of extensions are supplied with $package.  You may choose to
19610 compile these extensions for dynamic loading (the default), compile
19611 them into the $package executable (static loading), or not include
19612 them at all.  Answer "none" to include no extensions.
19613 Note that DynaLoader is always built and need not be mentioned here.
19614
19615 EOM
19616         case "$dynamic_ext" in
19617         '') dflt="$avail_ext" ;;
19618         *)      dflt="$dynamic_ext"
19619                 # Perhaps we are reusing an old out-of-date config.sh.
19620                 case "$hint" in
19621                 previous)
19622                         if test X"$dynamic_ext" != X"$avail_ext"; then
19623                                 $cat <<EOM
19624 NOTICE:  Your previous config.sh list may be incorrect. 
19625 The extensions now available to you are 
19626         ${avail_ext}
19627 but the default list from your previous config.sh is
19628         ${dynamic_ext} 
19629
19630 EOM
19631                         fi
19632                         ;;
19633                 esac
19634                 ;;
19635         esac
19636         case "$dflt" in
19637         '')     dflt=none;;
19638         esac
19639         rp="What extensions do you wish to load dynamically?"
19640         . ./myread
19641         case "$ans" in
19642         none) dynamic_ext=' ' ;;
19643         *) dynamic_ext="$ans" ;;
19644         esac
19645
19646         case "$static_ext" in
19647         '')
19648                 : Exclude those already listed in dynamic linking
19649                 dflt=''
19650                 for xxx in $avail_ext; do
19651                         case " $dynamic_ext " in
19652                         *" $xxx "*) ;;
19653                         *) dflt="$dflt $xxx" ;;
19654                         esac
19655                 done
19656                 set X $dflt
19657                 shift
19658                 dflt="$*"
19659                 ;;
19660         *)  dflt="$static_ext" 
19661                 ;;
19662         esac
19663
19664         case "$dflt" in
19665         '')     dflt=none;;
19666         esac
19667         rp="What extensions do you wish to load statically?"
19668         . ./myread
19669         case "$ans" in
19670         none) static_ext=' ' ;;
19671         *) static_ext="$ans" ;;
19672         esac
19673         ;;
19674 *)
19675         $cat <<EOM
19676 A number of extensions are supplied with $package.  Answer "none" 
19677 to include no extensions. 
19678 Note that DynaLoader is always built and need not be mentioned here.
19679
19680 EOM
19681         case "$static_ext" in
19682         '') dflt="$avail_ext" ;;
19683         *)      dflt="$static_ext"
19684                 # Perhaps we are reusing an old out-of-date config.sh.
19685                 case "$hint" in
19686                 previous)
19687                         if test X"$static_ext" != X"$avail_ext"; then
19688                                 $cat <<EOM
19689 NOTICE:  Your previous config.sh list may be incorrect. 
19690 The extensions now available to you are 
19691         ${avail_ext}
19692 but the default list from your previous config.sh is
19693         ${static_ext} 
19694
19695 EOM
19696                         fi
19697                         ;;
19698                 esac
19699                 ;;
19700         esac
19701         : Exclude those that are not xs extensions
19702         case "$dflt" in
19703         '')     dflt=none;;
19704         *)  case " $dflt " in
19705             *" Encode "*) # Add the subextensions of Encode
19706                 cd "$rsrc/ext"
19707                 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19708                         dflt="$dflt Encode/$xxx"
19709                 done
19710                 cd "$tdir"
19711                 ;;
19712             esac
19713             ;;
19714         esac
19715         rp="What extensions do you wish to include?"
19716         . ./myread
19717         case "$ans" in
19718         none) static_ext=' ' ;;
19719         *) static_ext="$ans" ;;
19720         esac
19721         ;;
19722 esac
19723
19724 set X $dynamic_ext $static_ext $nonxs_ext
19725 shift
19726 extensions="$*"
19727
19728 : Remove libraries needed only for extensions
19729 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19730 : The exception is SunOS 4.x, which needs them.
19731 case "${osname}X${osvers}" in
19732 sunos*X4*)
19733     perllibs="$libs"
19734     ;;
19735 *) case "$usedl" in
19736     $define|true|[yY]*)
19737             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19738             shift
19739             perllibs="$*"
19740             ;;
19741     *)  perllibs="$libs"
19742             ;;
19743     esac
19744     ;;
19745 esac
19746
19747 : Remove build directory name from cppstdin so it can be used from
19748 : either the present location or the final installed location.
19749 echo " "
19750 : Get out of the UU directory to get correct path name.
19751 cd ..
19752 case "$cppstdin" in
19753 `pwd`/cppstdin)
19754         echo "Stripping down cppstdin path name"
19755         cppstdin=cppstdin
19756         ;;
19757 esac
19758 cd UU
19759
19760 : end of configuration questions
19761 echo " "
19762 echo "End of configuration questions."
19763 echo " "
19764
19765 : back to where it started
19766 if test -d ../UU; then
19767         cd ..
19768 fi
19769
19770 : configuration may be patched via a 'config.arch' file
19771 if $test -f config.arch; then
19772         echo "I see a config.arch file, loading it."
19773         . ./config.arch
19774 fi
19775
19776 : configuration may be patched via a 'config.over' file
19777 if $test -f config.over; then
19778         echo " "
19779         dflt=y
19780         rp='I see a config.over file.  Do you wish to load it?'
19781         . UU/myread
19782         case "$ans" in
19783         n*) echo "OK, I'll ignore it.";;
19784         *)      . ./config.over
19785                 echo "Configuration override changes have been loaded."
19786                 ;;
19787         esac
19788 fi
19789
19790 : in case they want portability, strip down executable paths
19791 case "$d_portable" in
19792 "$define")
19793         echo " "
19794         echo "Stripping down executable paths..." >&4
19795         for file in $loclist $trylist; do
19796                 eval temp=\$$file
19797                 eval $file=`basename $temp`
19798         done
19799         ;;
19800 esac
19801
19802 : create config.sh file
19803 echo " "
19804 echo "Creating config.sh..." >&4
19805 $spitshell <<EOT >config.sh
19806 $startsh
19807 #
19808 # This file was produced by running the Configure script. It holds all the
19809 # definitions figured out by Configure. Should you modify one of these values,
19810 # do not forget to propagate your changes by running "Configure -der". You may
19811 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19812 #
19813
19814 # Package name      : $package
19815 # Source directory  : $src
19816 # Configuration time: $cf_time
19817 # Configured by     : $cf_by
19818 # Target system     : $myuname
19819
19820 Author='$Author'
19821 Date='$Date'
19822 Header='$Header'
19823 Id='$Id'
19824 Locker='$Locker'
19825 Log='$Log'
19826 Mcc='$Mcc'
19827 RCSfile='$RCSfile'
19828 Revision='$Revision'
19829 Source='$Source'
19830 State='$State'
19831 _a='$_a'
19832 _exe='$_exe'
19833 _o='$_o'
19834 afs='$afs'
19835 afsroot='$afsroot'
19836 alignbytes='$alignbytes'
19837 ansi2knr='$ansi2knr'
19838 aphostname='$aphostname'
19839 api_revision='$api_revision'
19840 api_subversion='$api_subversion'
19841 api_version='$api_version'
19842 api_versionstring='$api_versionstring'
19843 ar='$ar'
19844 archlib='$archlib'
19845 archlibexp='$archlibexp'
19846 archname64='$archname64'
19847 archname='$archname'
19848 archobjs='$archobjs'
19849 asctime_r_proto='$asctime_r_proto'
19850 awk='$awk'
19851 baserev='$baserev'
19852 bash='$bash'
19853 bin='$bin'
19854 bincompat5005='$bincompat5005'
19855 binexp='$binexp'
19856 bison='$bison'
19857 byacc='$byacc'
19858 byteorder='$byteorder'
19859 c='$c'
19860 castflags='$castflags'
19861 cat='$cat'
19862 cc='$cc'
19863 cccdlflags='$cccdlflags'
19864 ccdlflags='$ccdlflags'
19865 ccflags='$ccflags'
19866 ccflags_uselargefiles='$ccflags_uselargefiles'
19867 ccname='$ccname'
19868 ccsymbols='$ccsymbols'
19869 ccversion='$ccversion'
19870 cf_by='$cf_by'
19871 cf_email='$cf_email'
19872 cf_time='$cf_time'
19873 charsize='$charsize'
19874 chgrp='$chgrp'
19875 chmod='$chmod'
19876 chown='$chown'
19877 clocktype='$clocktype'
19878 comm='$comm'
19879 compress='$compress'
19880 contains='$contains'
19881 cp='$cp'
19882 cpio='$cpio'
19883 cpp='$cpp'
19884 cpp_stuff='$cpp_stuff'
19885 cppccsymbols='$cppccsymbols'
19886 cppflags='$cppflags'
19887 cpplast='$cpplast'
19888 cppminus='$cppminus'
19889 cpprun='$cpprun'
19890 cppstdin='$cppstdin'
19891 cppsymbols='$cppsymbols'
19892 crypt_r_proto='$crypt_r_proto'
19893 cryptlib='$cryptlib'
19894 csh='$csh'
19895 ctermid_r_proto='$ctermid_r_proto'
19896 ctime_r_proto='$ctime_r_proto'
19897 d_Gconvert='$d_Gconvert'
19898 d_PRIEUldbl='$d_PRIEUldbl'
19899 d_PRIFUldbl='$d_PRIFUldbl'
19900 d_PRIGUldbl='$d_PRIGUldbl'
19901 d_PRIXU64='$d_PRIXU64'
19902 d_PRId64='$d_PRId64'
19903 d_PRIeldbl='$d_PRIeldbl'
19904 d_PRIfldbl='$d_PRIfldbl'
19905 d_PRIgldbl='$d_PRIgldbl'
19906 d_PRIi64='$d_PRIi64'
19907 d_PRIo64='$d_PRIo64'
19908 d_PRIu64='$d_PRIu64'
19909 d_PRIx64='$d_PRIx64'
19910 d_SCNfldbl='$d_SCNfldbl'
19911 d__fwalk='$d__fwalk'
19912 d_access='$d_access'
19913 d_accessx='$d_accessx'
19914 d_alarm='$d_alarm'
19915 d_archlib='$d_archlib'
19916 d_asctime_r='$d_asctime_r'
19917 d_atolf='$d_atolf'
19918 d_atoll='$d_atoll'
19919 d_attribut='$d_attribut'
19920 d_bcmp='$d_bcmp'
19921 d_bcopy='$d_bcopy'
19922 d_bincompat5005='$d_bincompat5005'
19923 d_bsd='$d_bsd'
19924 d_bsdgetpgrp='$d_bsdgetpgrp'
19925 d_bsdsetpgrp='$d_bsdsetpgrp'
19926 d_bzero='$d_bzero'
19927 d_casti32='$d_casti32'
19928 d_castneg='$d_castneg'
19929 d_charvspr='$d_charvspr'
19930 d_chown='$d_chown'
19931 d_chroot='$d_chroot'
19932 d_chsize='$d_chsize'
19933 d_class='$d_class'
19934 d_closedir='$d_closedir'
19935 d_cmsghdr_s='$d_cmsghdr_s'
19936 d_const='$d_const'
19937 d_crypt='$d_crypt'
19938 d_crypt_r='$d_crypt_r'
19939 d_csh='$d_csh'
19940 d_ctermid_r='$d_ctermid_r'
19941 d_ctime_r='$d_ctime_r'
19942 d_cuserid='$d_cuserid'
19943 d_dbl_dig='$d_dbl_dig'
19944 d_dbminitproto='$d_dbminitproto'
19945 d_difftime='$d_difftime'
19946 d_dirfd='$d_dirfd'
19947 d_dirnamlen='$d_dirnamlen'
19948 d_dlerror='$d_dlerror'
19949 d_dlopen='$d_dlopen'
19950 d_dlsymun='$d_dlsymun'
19951 d_dosuid='$d_dosuid'
19952 d_drand48_r='$d_drand48_r'
19953 d_drand48proto='$d_drand48proto'
19954 d_dup2='$d_dup2'
19955 d_eaccess='$d_eaccess'
19956 d_endgrent='$d_endgrent'
19957 d_endgrent_r='$d_endgrent_r'
19958 d_endhent='$d_endhent'
19959 d_endhostent_r='$d_endhostent_r'
19960 d_endnent='$d_endnent'
19961 d_endnetent_r='$d_endnetent_r'
19962 d_endpent='$d_endpent'
19963 d_endprotoent_r='$d_endprotoent_r'
19964 d_endpwent='$d_endpwent'
19965 d_endpwent_r='$d_endpwent_r'
19966 d_endsent='$d_endsent'
19967 d_endservent_r='$d_endservent_r'
19968 d_eofnblk='$d_eofnblk'
19969 d_eunice='$d_eunice'
19970 d_fchdir='$d_fchdir'
19971 d_fchmod='$d_fchmod'
19972 d_fchown='$d_fchown'
19973 d_fcntl='$d_fcntl'
19974 d_fcntl_can_lock='$d_fcntl_can_lock'
19975 d_fd_macros='$d_fd_macros'
19976 d_fd_set='$d_fd_set'
19977 d_fds_bits='$d_fds_bits'
19978 d_fgetpos='$d_fgetpos'
19979 d_finite='$d_finite'
19980 d_finitel='$d_finitel'
19981 d_flexfnam='$d_flexfnam'
19982 d_flock='$d_flock'
19983 d_flockproto='$d_flockproto'
19984 d_fork='$d_fork'
19985 d_fp_class='$d_fp_class'
19986 d_fpathconf='$d_fpathconf'
19987 d_fpclass='$d_fpclass'
19988 d_fpclassify='$d_fpclassify'
19989 d_fpclassl='$d_fpclassl'
19990 d_fpos64_t='$d_fpos64_t'
19991 d_frexpl='$d_frexpl'
19992 d_fs_data_s='$d_fs_data_s'
19993 d_fseeko='$d_fseeko'
19994 d_fsetpos='$d_fsetpos'
19995 d_fstatfs='$d_fstatfs'
19996 d_fstatvfs='$d_fstatvfs'
19997 d_fsync='$d_fsync'
19998 d_ftello='$d_ftello'
19999 d_ftime='$d_ftime'
20000 d_getcwd='$d_getcwd'
20001 d_getespwnam='$d_getespwnam'
20002 d_getfsstat='$d_getfsstat'
20003 d_getgrent='$d_getgrent'
20004 d_getgrent_r='$d_getgrent_r'
20005 d_getgrgid_r='$d_getgrgid_r'
20006 d_getgrnam_r='$d_getgrnam_r'
20007 d_getgrps='$d_getgrps'
20008 d_gethbyaddr='$d_gethbyaddr'
20009 d_gethbyname='$d_gethbyname'
20010 d_gethent='$d_gethent'
20011 d_gethname='$d_gethname'
20012 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20013 d_gethostbyname_r='$d_gethostbyname_r'
20014 d_gethostent_r='$d_gethostent_r'
20015 d_gethostprotos='$d_gethostprotos'
20016 d_getitimer='$d_getitimer'
20017 d_getlogin='$d_getlogin'
20018 d_getlogin_r='$d_getlogin_r'
20019 d_getmnt='$d_getmnt'
20020 d_getmntent='$d_getmntent'
20021 d_getnbyaddr='$d_getnbyaddr'
20022 d_getnbyname='$d_getnbyname'
20023 d_getnent='$d_getnent'
20024 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20025 d_getnetbyname_r='$d_getnetbyname_r'
20026 d_getnetent_r='$d_getnetent_r'
20027 d_getnetprotos='$d_getnetprotos'
20028 d_getpagsz='$d_getpagsz'
20029 d_getpbyname='$d_getpbyname'
20030 d_getpbynumber='$d_getpbynumber'
20031 d_getpent='$d_getpent'
20032 d_getpgid='$d_getpgid'
20033 d_getpgrp2='$d_getpgrp2'
20034 d_getpgrp='$d_getpgrp'
20035 d_getppid='$d_getppid'
20036 d_getprior='$d_getprior'
20037 d_getprotobyname_r='$d_getprotobyname_r'
20038 d_getprotobynumber_r='$d_getprotobynumber_r'
20039 d_getprotoent_r='$d_getprotoent_r'
20040 d_getprotoprotos='$d_getprotoprotos'
20041 d_getprpwnam='$d_getprpwnam'
20042 d_getpwent='$d_getpwent'
20043 d_getpwent_r='$d_getpwent_r'
20044 d_getpwnam_r='$d_getpwnam_r'
20045 d_getpwuid_r='$d_getpwuid_r'
20046 d_getsbyname='$d_getsbyname'
20047 d_getsbyport='$d_getsbyport'
20048 d_getsent='$d_getsent'
20049 d_getservbyname_r='$d_getservbyname_r'
20050 d_getservbyport_r='$d_getservbyport_r'
20051 d_getservent_r='$d_getservent_r'
20052 d_getservprotos='$d_getservprotos'
20053 d_getspnam='$d_getspnam'
20054 d_getspnam_r='$d_getspnam_r'
20055 d_gettimeod='$d_gettimeod'
20056 d_gmtime_r='$d_gmtime_r'
20057 d_gnulibc='$d_gnulibc'
20058 d_grpasswd='$d_grpasswd'
20059 d_hasmntopt='$d_hasmntopt'
20060 d_htonl='$d_htonl'
20061 d_index='$d_index'
20062 d_inetaton='$d_inetaton'
20063 d_int64_t='$d_int64_t'
20064 d_isascii='$d_isascii'
20065 d_isfinite='$d_isfinite'
20066 d_isinf='$d_isinf'
20067 d_isnan='$d_isnan'
20068 d_isnanl='$d_isnanl'
20069 d_killpg='$d_killpg'
20070 d_lchown='$d_lchown'
20071 d_ldbl_dig='$d_ldbl_dig'
20072 d_link='$d_link'
20073 d_localtime_r='$d_localtime_r'
20074 d_locconv='$d_locconv'
20075 d_lockf='$d_lockf'
20076 d_longdbl='$d_longdbl'
20077 d_longlong='$d_longlong'
20078 d_lseekproto='$d_lseekproto'
20079 d_lstat='$d_lstat'
20080 d_madvise='$d_madvise'
20081 d_mblen='$d_mblen'
20082 d_mbstowcs='$d_mbstowcs'
20083 d_mbtowc='$d_mbtowc'
20084 d_memchr='$d_memchr'
20085 d_memcmp='$d_memcmp'
20086 d_memcpy='$d_memcpy'
20087 d_memmove='$d_memmove'
20088 d_memset='$d_memset'
20089 d_mkdir='$d_mkdir'
20090 d_mkdtemp='$d_mkdtemp'
20091 d_mkfifo='$d_mkfifo'
20092 d_mkstemp='$d_mkstemp'
20093 d_mkstemps='$d_mkstemps'
20094 d_mktime='$d_mktime'
20095 d_mmap='$d_mmap'
20096 d_modfl='$d_modfl'
20097 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20098 d_mprotect='$d_mprotect'
20099 d_msg='$d_msg'
20100 d_msg_ctrunc='$d_msg_ctrunc'
20101 d_msg_dontroute='$d_msg_dontroute'
20102 d_msg_oob='$d_msg_oob'
20103 d_msg_peek='$d_msg_peek'
20104 d_msg_proxy='$d_msg_proxy'
20105 d_msgctl='$d_msgctl'
20106 d_msgget='$d_msgget'
20107 d_msghdr_s='$d_msghdr_s'
20108 d_msgrcv='$d_msgrcv'
20109 d_msgsnd='$d_msgsnd'
20110 d_msync='$d_msync'
20111 d_munmap='$d_munmap'
20112 d_mymalloc='$d_mymalloc'
20113 d_nice='$d_nice'
20114 d_nl_langinfo='$d_nl_langinfo'
20115 d_nv_preserves_uv='$d_nv_preserves_uv'
20116 d_off64_t='$d_off64_t'
20117 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20118 d_oldpthreads='$d_oldpthreads'
20119 d_oldsock='$d_oldsock'
20120 d_open3='$d_open3'
20121 d_pathconf='$d_pathconf'
20122 d_pause='$d_pause'
20123 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20124 d_phostname='$d_phostname'
20125 d_pipe='$d_pipe'
20126 d_poll='$d_poll'
20127 d_portable='$d_portable'
20128 d_procselfexe='$d_procselfexe'
20129 d_pthread_atfork='$d_pthread_atfork'
20130 d_pthread_yield='$d_pthread_yield'
20131 d_pwage='$d_pwage'
20132 d_pwchange='$d_pwchange'
20133 d_pwclass='$d_pwclass'
20134 d_pwcomment='$d_pwcomment'
20135 d_pwexpire='$d_pwexpire'
20136 d_pwgecos='$d_pwgecos'
20137 d_pwpasswd='$d_pwpasswd'
20138 d_pwquota='$d_pwquota'
20139 d_qgcvt='$d_qgcvt'
20140 d_quad='$d_quad'
20141 d_random_r='$d_random_r'
20142 d_readdir64_r='$d_readdir64_r'
20143 d_readdir='$d_readdir'
20144 d_readdir_r='$d_readdir_r'
20145 d_readlink='$d_readlink'
20146 d_readv='$d_readv'
20147 d_recvmsg='$d_recvmsg'
20148 d_rename='$d_rename'
20149 d_rewinddir='$d_rewinddir'
20150 d_rmdir='$d_rmdir'
20151 d_safebcpy='$d_safebcpy'
20152 d_safemcpy='$d_safemcpy'
20153 d_sanemcmp='$d_sanemcmp'
20154 d_sbrkproto='$d_sbrkproto'
20155 d_sched_yield='$d_sched_yield'
20156 d_scm_rights='$d_scm_rights'
20157 d_seekdir='$d_seekdir'
20158 d_select='$d_select'
20159 d_sem='$d_sem'
20160 d_semctl='$d_semctl'
20161 d_semctl_semid_ds='$d_semctl_semid_ds'
20162 d_semctl_semun='$d_semctl_semun'
20163 d_semget='$d_semget'
20164 d_semop='$d_semop'
20165 d_sendmsg='$d_sendmsg'
20166 d_setegid='$d_setegid'
20167 d_seteuid='$d_seteuid'
20168 d_setgrent='$d_setgrent'
20169 d_setgrent_r='$d_setgrent_r'
20170 d_setgrps='$d_setgrps'
20171 d_sethent='$d_sethent'
20172 d_sethostent_r='$d_sethostent_r'
20173 d_setitimer='$d_setitimer'
20174 d_setlinebuf='$d_setlinebuf'
20175 d_setlocale='$d_setlocale'
20176 d_setlocale_r='$d_setlocale_r'
20177 d_setnent='$d_setnent'
20178 d_setnetent_r='$d_setnetent_r'
20179 d_setpent='$d_setpent'
20180 d_setpgid='$d_setpgid'
20181 d_setpgrp2='$d_setpgrp2'
20182 d_setpgrp='$d_setpgrp'
20183 d_setprior='$d_setprior'
20184 d_setproctitle='$d_setproctitle'
20185 d_setprotoent_r='$d_setprotoent_r'
20186 d_setpwent='$d_setpwent'
20187 d_setpwent_r='$d_setpwent_r'
20188 d_setregid='$d_setregid'
20189 d_setresgid='$d_setresgid'
20190 d_setresuid='$d_setresuid'
20191 d_setreuid='$d_setreuid'
20192 d_setrgid='$d_setrgid'
20193 d_setruid='$d_setruid'
20194 d_setsent='$d_setsent'
20195 d_setservent_r='$d_setservent_r'
20196 d_setsid='$d_setsid'
20197 d_setvbuf='$d_setvbuf'
20198 d_sfio='$d_sfio'
20199 d_shm='$d_shm'
20200 d_shmat='$d_shmat'
20201 d_shmatprototype='$d_shmatprototype'
20202 d_shmctl='$d_shmctl'
20203 d_shmdt='$d_shmdt'
20204 d_shmget='$d_shmget'
20205 d_sigaction='$d_sigaction'
20206 d_sigprocmask='$d_sigprocmask'
20207 d_sigsetjmp='$d_sigsetjmp'
20208 d_sockatmark='$d_sockatmark'
20209 d_sockatmarkproto='$d_sockatmarkproto'
20210 d_socket='$d_socket'
20211 d_socklen_t='$d_socklen_t'
20212 d_sockpair='$d_sockpair'
20213 d_socks5_init='$d_socks5_init'
20214 d_sqrtl='$d_sqrtl'
20215 d_srand48_r='$d_srand48_r'
20216 d_srandom_r='$d_srandom_r'
20217 d_sresgproto='$d_sresgproto'
20218 d_sresuproto='$d_sresuproto'
20219 d_statblks='$d_statblks'
20220 d_statfs_f_flags='$d_statfs_f_flags'
20221 d_statfs_s='$d_statfs_s'
20222 d_statvfs='$d_statvfs'
20223 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20224 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20225 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20226 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20227 d_stdio_stream_array='$d_stdio_stream_array'
20228 d_stdiobase='$d_stdiobase'
20229 d_stdstdio='$d_stdstdio'
20230 d_strchr='$d_strchr'
20231 d_strcoll='$d_strcoll'
20232 d_strctcpy='$d_strctcpy'
20233 d_strerrm='$d_strerrm'
20234 d_strerror='$d_strerror'
20235 d_strerror_r='$d_strerror_r'
20236 d_strftime='$d_strftime'
20237 d_strtod='$d_strtod'
20238 d_strtol='$d_strtol'
20239 d_strtold='$d_strtold'
20240 d_strtoll='$d_strtoll'
20241 d_strtoq='$d_strtoq'
20242 d_strtoul='$d_strtoul'
20243 d_strtoull='$d_strtoull'
20244 d_strtouq='$d_strtouq'
20245 d_strxfrm='$d_strxfrm'
20246 d_suidsafe='$d_suidsafe'
20247 d_symlink='$d_symlink'
20248 d_syscall='$d_syscall'
20249 d_syscallproto='$d_syscallproto'
20250 d_sysconf='$d_sysconf'
20251 d_sysernlst='$d_sysernlst'
20252 d_syserrlst='$d_syserrlst'
20253 d_system='$d_system'
20254 d_tcgetpgrp='$d_tcgetpgrp'
20255 d_tcsetpgrp='$d_tcsetpgrp'
20256 d_telldir='$d_telldir'
20257 d_telldirproto='$d_telldirproto'
20258 d_time='$d_time'
20259 d_times='$d_times'
20260 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20261 d_tm_tm_zone='$d_tm_tm_zone'
20262 d_tmpnam_r='$d_tmpnam_r'
20263 d_truncate='$d_truncate'
20264 d_ttyname_r='$d_ttyname_r'
20265 d_tzname='$d_tzname'
20266 d_u32align='$d_u32align'
20267 d_ualarm='$d_ualarm'
20268 d_umask='$d_umask'
20269 d_uname='$d_uname'
20270 d_union_semun='$d_union_semun'
20271 d_unordered='$d_unordered'
20272 d_usleep='$d_usleep'
20273 d_usleepproto='$d_usleepproto'
20274 d_ustat='$d_ustat'
20275 d_vendorarch='$d_vendorarch'
20276 d_vendorbin='$d_vendorbin'
20277 d_vendorlib='$d_vendorlib'
20278 d_vfork='$d_vfork'
20279 d_void_closedir='$d_void_closedir'
20280 d_voidsig='$d_voidsig'
20281 d_voidtty='$d_voidtty'
20282 d_volatile='$d_volatile'
20283 d_vprintf='$d_vprintf'
20284 d_wait4='$d_wait4'
20285 d_waitpid='$d_waitpid'
20286 d_wcstombs='$d_wcstombs'
20287 d_wctomb='$d_wctomb'
20288 d_writev='$d_writev'
20289 d_xenix='$d_xenix'
20290 date='$date'
20291 db_hashtype='$db_hashtype'
20292 db_prefixtype='$db_prefixtype'
20293 db_version_major='$db_version_major'
20294 db_version_minor='$db_version_minor'
20295 db_version_patch='$db_version_patch'
20296 defvoidused='$defvoidused'
20297 direntrytype='$direntrytype'
20298 dlext='$dlext'
20299 dlsrc='$dlsrc'
20300 doublesize='$doublesize'
20301 drand01='$drand01'
20302 drand48_r_proto='$drand48_r_proto'
20303 dynamic_ext='$dynamic_ext'
20304 eagain='$eagain'
20305 ebcdic='$ebcdic'
20306 echo='$echo'
20307 egrep='$egrep'
20308 emacs='$emacs'
20309 endgrent_r_proto='$endgrent_r_proto'
20310 endhostent_r_proto='$endhostent_r_proto'
20311 endnetent_r_proto='$endnetent_r_proto'
20312 endprotoent_r_proto='$endprotoent_r_proto'
20313 endpwent_r_proto='$endpwent_r_proto'
20314 endservent_r_proto='$endservent_r_proto'
20315 eunicefix='$eunicefix'
20316 exe_ext='$exe_ext'
20317 expr='$expr'
20318 extensions='$extensions'
20319 extras='$extras'
20320 fflushNULL='$fflushNULL'
20321 fflushall='$fflushall'
20322 find='$find'
20323 firstmakefile='$firstmakefile'
20324 flex='$flex'
20325 fpossize='$fpossize'
20326 fpostype='$fpostype'
20327 freetype='$freetype'
20328 from='$from'
20329 full_ar='$full_ar'
20330 full_csh='$full_csh'
20331 full_sed='$full_sed'
20332 gccosandvers='$gccosandvers'
20333 gccversion='$gccversion'
20334 getgrent_r_proto='$getgrent_r_proto'
20335 getgrgid_r_proto='$getgrgid_r_proto'
20336 getgrnam_r_proto='$getgrnam_r_proto'
20337 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20338 gethostbyname_r_proto='$gethostbyname_r_proto'
20339 gethostent_r_proto='$gethostent_r_proto'
20340 getlogin_r_proto='$getlogin_r_proto'
20341 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20342 getnetbyname_r_proto='$getnetbyname_r_proto'
20343 getnetent_r_proto='$getnetent_r_proto'
20344 getprotobyname_r_proto='$getprotobyname_r_proto'
20345 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20346 getprotoent_r_proto='$getprotoent_r_proto'
20347 getpwent_r_proto='$getpwent_r_proto'
20348 getpwnam_r_proto='$getpwnam_r_proto'
20349 getpwuid_r_proto='$getpwuid_r_proto'
20350 getservbyname_r_proto='$getservbyname_r_proto'
20351 getservbyport_r_proto='$getservbyport_r_proto'
20352 getservent_r_proto='$getservent_r_proto'
20353 getspnam_r_proto='$getspnam_r_proto'
20354 gidformat='$gidformat'
20355 gidsign='$gidsign'
20356 gidsize='$gidsize'
20357 gidtype='$gidtype'
20358 glibpth='$glibpth'
20359 gmake='$gmake'
20360 gmtime_r_proto='$gmtime_r_proto'
20361 grep='$grep'
20362 groupcat='$groupcat'
20363 groupstype='$groupstype'
20364 gzip='$gzip'
20365 h_fcntl='$h_fcntl'
20366 h_sysfile='$h_sysfile'
20367 hint='$hint'
20368 hostcat='$hostcat'
20369 i16size='$i16size'
20370 i16type='$i16type'
20371 i32size='$i32size'
20372 i32type='$i32type'
20373 i64size='$i64size'
20374 i64type='$i64type'
20375 i8size='$i8size'
20376 i8type='$i8type'
20377 i_arpainet='$i_arpainet'
20378 i_bsdioctl='$i_bsdioctl'
20379 i_crypt='$i_crypt'
20380 i_db='$i_db'
20381 i_dbm='$i_dbm'
20382 i_dirent='$i_dirent'
20383 i_dld='$i_dld'
20384 i_dlfcn='$i_dlfcn'
20385 i_fcntl='$i_fcntl'
20386 i_float='$i_float'
20387 i_fp='$i_fp'
20388 i_fp_class='$i_fp_class'
20389 i_gdbm='$i_gdbm'
20390 i_grp='$i_grp'
20391 i_ieeefp='$i_ieeefp'
20392 i_inttypes='$i_inttypes'
20393 i_langinfo='$i_langinfo'
20394 i_libutil='$i_libutil'
20395 i_limits='$i_limits'
20396 i_locale='$i_locale'
20397 i_machcthr='$i_machcthr'
20398 i_malloc='$i_malloc'
20399 i_math='$i_math'
20400 i_memory='$i_memory'
20401 i_mntent='$i_mntent'
20402 i_ndbm='$i_ndbm'
20403 i_netdb='$i_netdb'
20404 i_neterrno='$i_neterrno'
20405 i_netinettcp='$i_netinettcp'
20406 i_niin='$i_niin'
20407 i_poll='$i_poll'
20408 i_prot='$i_prot'
20409 i_pthread='$i_pthread'
20410 i_pwd='$i_pwd'
20411 i_rpcsvcdbm='$i_rpcsvcdbm'
20412 i_sfio='$i_sfio'
20413 i_sgtty='$i_sgtty'
20414 i_shadow='$i_shadow'
20415 i_socks='$i_socks'
20416 i_stdarg='$i_stdarg'
20417 i_stddef='$i_stddef'
20418 i_stdlib='$i_stdlib'
20419 i_string='$i_string'
20420 i_sunmath='$i_sunmath'
20421 i_sysaccess='$i_sysaccess'
20422 i_sysdir='$i_sysdir'
20423 i_sysfile='$i_sysfile'
20424 i_sysfilio='$i_sysfilio'
20425 i_sysin='$i_sysin'
20426 i_sysioctl='$i_sysioctl'
20427 i_syslog='$i_syslog'
20428 i_sysmman='$i_sysmman'
20429 i_sysmode='$i_sysmode'
20430 i_sysmount='$i_sysmount'
20431 i_sysndir='$i_sysndir'
20432 i_sysparam='$i_sysparam'
20433 i_sysresrc='$i_sysresrc'
20434 i_syssecrt='$i_syssecrt'
20435 i_sysselct='$i_sysselct'
20436 i_syssockio='$i_syssockio'
20437 i_sysstat='$i_sysstat'
20438 i_sysstatfs='$i_sysstatfs'
20439 i_sysstatvfs='$i_sysstatvfs'
20440 i_systime='$i_systime'
20441 i_systimek='$i_systimek'
20442 i_systimes='$i_systimes'
20443 i_systypes='$i_systypes'
20444 i_sysuio='$i_sysuio'
20445 i_sysun='$i_sysun'
20446 i_sysutsname='$i_sysutsname'
20447 i_sysvfs='$i_sysvfs'
20448 i_syswait='$i_syswait'
20449 i_termio='$i_termio'
20450 i_termios='$i_termios'
20451 i_time='$i_time'
20452 i_unistd='$i_unistd'
20453 i_ustat='$i_ustat'
20454 i_utime='$i_utime'
20455 i_values='$i_values'
20456 i_varargs='$i_varargs'
20457 i_varhdr='$i_varhdr'
20458 i_vfork='$i_vfork'
20459 ignore_versioned_solibs='$ignore_versioned_solibs'
20460 inc_version_list='$inc_version_list'
20461 inc_version_list_init='$inc_version_list_init'
20462 incpath='$incpath'
20463 inews='$inews'
20464 installarchlib='$installarchlib'
20465 installbin='$installbin'
20466 installman1dir='$installman1dir'
20467 installman3dir='$installman3dir'
20468 installprefix='$installprefix'
20469 installprefixexp='$installprefixexp'
20470 installprivlib='$installprivlib'
20471 installscript='$installscript'
20472 installsitearch='$installsitearch'
20473 installsitebin='$installsitebin'
20474 installsitelib='$installsitelib'
20475 installstyle='$installstyle'
20476 installusrbinperl='$installusrbinperl'
20477 installvendorarch='$installvendorarch'
20478 installvendorbin='$installvendorbin'
20479 installvendorlib='$installvendorlib'
20480 intsize='$intsize'
20481 issymlink='$issymlink'
20482 ivdformat='$ivdformat'
20483 ivsize='$ivsize'
20484 ivtype='$ivtype'
20485 known_extensions='$known_extensions'
20486 ksh='$ksh'
20487 ld='$ld'
20488 lddlflags='$lddlflags'
20489 ldflags='$ldflags'
20490 ldflags_uselargefiles='$ldflags_uselargefiles'
20491 ldlibpthname='$ldlibpthname'
20492 less='$less'
20493 lib_ext='$lib_ext'
20494 libc='$libc'
20495 libperl='$libperl'
20496 libpth='$libpth'
20497 libs='$libs'
20498 libsdirs='$libsdirs'
20499 libsfiles='$libsfiles'
20500 libsfound='$libsfound'
20501 libspath='$libspath'
20502 libswanted='$libswanted'
20503 libswanted_uselargefiles='$libswanted_uselargefiles'
20504 line='$line'
20505 lint='$lint'
20506 lkflags='$lkflags'
20507 ln='$ln'
20508 lns='$lns'
20509 localtime_r_proto='$localtime_r_proto'
20510 locincpth='$locincpth'
20511 loclibpth='$loclibpth'
20512 longdblsize='$longdblsize'
20513 longlongsize='$longlongsize'
20514 longsize='$longsize'
20515 lp='$lp'
20516 lpr='$lpr'
20517 ls='$ls'
20518 lseeksize='$lseeksize'
20519 lseektype='$lseektype'
20520 mail='$mail'
20521 mailx='$mailx'
20522 make='$make'
20523 make_set_make='$make_set_make'
20524 mallocobj='$mallocobj'
20525 mallocsrc='$mallocsrc'
20526 malloctype='$malloctype'
20527 man1dir='$man1dir'
20528 man1direxp='$man1direxp'
20529 man1ext='$man1ext'
20530 man3dir='$man3dir'
20531 man3direxp='$man3direxp'
20532 man3ext='$man3ext'
20533 mips_type='$mips_type'
20534 mkdir='$mkdir'
20535 mmaptype='$mmaptype'
20536 modetype='$modetype'
20537 more='$more'
20538 multiarch='$multiarch'
20539 mv='$mv'
20540 myarchname='$myarchname'
20541 mydomain='$mydomain'
20542 myhostname='$myhostname'
20543 myuname='$myuname'
20544 n='$n'
20545 need_va_copy='$need_va_copy'
20546 netdb_hlen_type='$netdb_hlen_type'
20547 netdb_host_type='$netdb_host_type'
20548 netdb_name_type='$netdb_name_type'
20549 netdb_net_type='$netdb_net_type'
20550 nm='$nm'
20551 nm_opt='$nm_opt'
20552 nm_so_opt='$nm_so_opt'
20553 nonxs_ext='$nonxs_ext'
20554 nroff='$nroff'
20555 nvEUformat='$nvEUformat'
20556 nvFUformat='$nvFUformat'
20557 nvGUformat='$nvGUformat'
20558 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20559 nveformat='$nveformat'
20560 nvfformat='$nvfformat'
20561 nvgformat='$nvgformat'
20562 nvsize='$nvsize'
20563 nvtype='$nvtype'
20564 o_nonblock='$o_nonblock'
20565 obj_ext='$obj_ext'
20566 old_pthread_create_joinable='$old_pthread_create_joinable'
20567 optimize='$optimize'
20568 orderlib='$orderlib'
20569 osname='$osname'
20570 osvers='$osvers'
20571 otherlibdirs='$otherlibdirs'
20572 package='$package'
20573 pager='$pager'
20574 passcat='$passcat'
20575 patchlevel='$patchlevel'
20576 path_sep='$path_sep'
20577 perl5='$perl5'
20578 perl='$perl'
20579 perl_patchlevel='$perl_patchlevel'
20580 perladmin='$perladmin'
20581 perllibs='$perllibs'
20582 perlpath='$perlpath'
20583 pg='$pg'
20584 phostname='$phostname'
20585 pidtype='$pidtype'
20586 plibpth='$plibpth'
20587 pm_apiversion='$pm_apiversion'
20588 pmake='$pmake'
20589 pr='$pr'
20590 prefix='$prefix'
20591 prefixexp='$prefixexp'
20592 privlib='$privlib'
20593 privlibexp='$privlibexp'
20594 procselfexe='$procselfexe'
20595 prototype='$prototype'
20596 ptrsize='$ptrsize'
20597 quadkind='$quadkind'
20598 quadtype='$quadtype'
20599 randbits='$randbits'
20600 randfunc='$randfunc'
20601 random_r_proto='$random_r_proto'
20602 randseedtype='$randseedtype'
20603 ranlib='$ranlib'
20604 rd_nodata='$rd_nodata'
20605 readdir64_r_proto='$readdir64_r_proto'
20606 readdir_r_proto='$readdir_r_proto'
20607 revision='$revision'
20608 rm='$rm'
20609 rmail='$rmail'
20610 run='$run'
20611 runnm='$runnm'
20612 sPRIEUldbl='$sPRIEUldbl'
20613 sPRIFUldbl='$sPRIFUldbl'
20614 sPRIGUldbl='$sPRIGUldbl'
20615 sPRIXU64='$sPRIXU64'
20616 sPRId64='$sPRId64'
20617 sPRIeldbl='$sPRIeldbl'
20618 sPRIfldbl='$sPRIfldbl'
20619 sPRIgldbl='$sPRIgldbl'
20620 sPRIi64='$sPRIi64'
20621 sPRIo64='$sPRIo64'
20622 sPRIu64='$sPRIu64'
20623 sPRIx64='$sPRIx64'
20624 sSCNfldbl='$sSCNfldbl'
20625 sched_yield='$sched_yield'
20626 scriptdir='$scriptdir'
20627 scriptdirexp='$scriptdirexp'
20628 sed='$sed'
20629 seedfunc='$seedfunc'
20630 selectminbits='$selectminbits'
20631 selecttype='$selecttype'
20632 sendmail='$sendmail'
20633 setgrent_r_proto='$setgrent_r_proto'
20634 sethostent_r_proto='$sethostent_r_proto'
20635 setlocale_r_proto='$setlocale_r_proto'
20636 setnetent_r_proto='$setnetent_r_proto'
20637 setprotoent_r_proto='$setprotoent_r_proto'
20638 setpwent_r_proto='$setpwent_r_proto'
20639 setservent_r_proto='$setservent_r_proto'
20640 sh='$sh'
20641 shar='$shar'
20642 sharpbang='$sharpbang'
20643 shmattype='$shmattype'
20644 shortsize='$shortsize'
20645 shrpenv='$shrpenv'
20646 shsharp='$shsharp'
20647 sig_count='$sig_count'
20648 sig_name='$sig_name'
20649 sig_name_init='$sig_name_init'
20650 sig_num='$sig_num'
20651 sig_num_init='$sig_num_init'
20652 sig_size='$sig_size'
20653 signal_t='$signal_t'
20654 sitearch='$sitearch'
20655 sitearchexp='$sitearchexp'
20656 sitebin='$sitebin'
20657 sitebinexp='$sitebinexp'
20658 sitelib='$sitelib'
20659 sitelib_stem='$sitelib_stem'
20660 sitelibexp='$sitelibexp'
20661 siteprefix='$siteprefix'
20662 siteprefixexp='$siteprefixexp'
20663 sizesize='$sizesize'
20664 sizetype='$sizetype'
20665 sleep='$sleep'
20666 smail='$smail'
20667 so='$so'
20668 sockethdr='$sockethdr'
20669 socketlib='$socketlib'
20670 socksizetype='$socksizetype'
20671 sort='$sort'
20672 spackage='$spackage'
20673 spitshell='$spitshell'
20674 srand48_r_proto='$srand48_r_proto'
20675 srandom_r_proto='$srandom_r_proto'
20676 src='$src'
20677 ssizetype='$ssizetype'
20678 startperl='$startperl'
20679 startsh='$startsh'
20680 static_ext='$static_ext'
20681 stdchar='$stdchar'
20682 stdio_base='$stdio_base'
20683 stdio_bufsiz='$stdio_bufsiz'
20684 stdio_cnt='$stdio_cnt'
20685 stdio_filbuf='$stdio_filbuf'
20686 stdio_ptr='$stdio_ptr'
20687 stdio_stream_array='$stdio_stream_array'
20688 strerror_r_proto='$strerror_r_proto'
20689 strings='$strings'
20690 submit='$submit'
20691 subversion='$subversion'
20692 sysman='$sysman'
20693 tail='$tail'
20694 tar='$tar'
20695 targetarch='$targetarch'
20696 tbl='$tbl'
20697 tee='$tee'
20698 test='$test'
20699 timeincl='$timeincl'
20700 timetype='$timetype'
20701 tmpnam_r_proto='$tmpnam_r_proto'
20702 to='$to'
20703 touch='$touch'
20704 tr='$tr'
20705 trnl='$trnl'
20706 troff='$troff'
20707 ttyname_r_proto='$ttyname_r_proto'
20708 u16size='$u16size'
20709 u16type='$u16type'
20710 u32size='$u32size'
20711 u32type='$u32type'
20712 u64size='$u64size'
20713 u64type='$u64type'
20714 u8size='$u8size'
20715 u8type='$u8type'
20716 uidformat='$uidformat'
20717 uidsign='$uidsign'
20718 uidsize='$uidsize'
20719 uidtype='$uidtype'
20720 uname='$uname'
20721 uniq='$uniq'
20722 uquadtype='$uquadtype'
20723 use5005threads='$use5005threads'
20724 use64bitall='$use64bitall'
20725 use64bitint='$use64bitint'
20726 usecrosscompile='$usecrosscompile'
20727 usedl='$usedl'
20728 useithreads='$useithreads'
20729 uselargefiles='$uselargefiles'
20730 uselongdouble='$uselongdouble'
20731 usemorebits='$usemorebits'
20732 usemultiplicity='$usemultiplicity'
20733 usemymalloc='$usemymalloc'
20734 usenm='$usenm'
20735 useopcode='$useopcode'
20736 useperlio='$useperlio'
20737 useposix='$useposix'
20738 usereentrant='$usereentrant'
20739 usesfio='$usesfio'
20740 useshrplib='$useshrplib'
20741 usesocks='$usesocks'
20742 usethreads='$usethreads'
20743 usevendorprefix='$usevendorprefix'
20744 usevfork='$usevfork'
20745 usrinc='$usrinc'
20746 uuname='$uuname'
20747 uvXUformat='$uvXUformat'
20748 uvoformat='$uvoformat'
20749 uvsize='$uvsize'
20750 uvtype='$uvtype'
20751 uvuformat='$uvuformat'
20752 uvxformat='$uvxformat'
20753 vendorarch='$vendorarch'
20754 vendorarchexp='$vendorarchexp'
20755 vendorbin='$vendorbin'
20756 vendorbinexp='$vendorbinexp'
20757 vendorlib='$vendorlib'
20758 vendorlib_stem='$vendorlib_stem'
20759 vendorlibexp='$vendorlibexp'
20760 vendorprefix='$vendorprefix'
20761 vendorprefixexp='$vendorprefixexp'
20762 version='$version'
20763 version_patchlevel_string='$version_patchlevel_string'
20764 versiononly='$versiononly'
20765 vi='$vi'
20766 voidflags='$voidflags'
20767 xlibpth='$xlibpth'
20768 xs_apiversion='$xs_apiversion'
20769 yacc='$yacc'
20770 yaccflags='$yaccflags'
20771 zcat='$zcat'
20772 zip='$zip'
20773 EOT
20774
20775 : Add in command line options if available
20776 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20777
20778 : add special variables
20779 $test -f $src/patchlevel.h && \
20780 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20781 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20782 echo "PERL_CONFIG_SH=true" >>config.sh
20783
20784 : propagate old symbols
20785 if $test -f UU/config.sh; then
20786         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20787         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20788         $sort | $uniq -u >UU/oldsyms
20789         set X `cat UU/oldsyms`
20790         shift
20791         case $# in
20792         0) ;;
20793         *)
20794                 cat <<EOM
20795 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20796 EOM
20797                 echo "# Variables propagated from previous config.sh file." >>config.sh
20798                 for sym in `cat UU/oldsyms`; do
20799                         echo "    Propagating $hint variable "'$'"$sym..."
20800                         eval 'tmp="$'"${sym}"'"'
20801                         echo "$tmp" | \
20802                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20803                 done
20804                 ;;
20805         esac
20806 fi
20807
20808 : Finish up by extracting the .SH files
20809 case "$alldone" in
20810 exit)
20811         $rm -rf UU
20812         echo "Extraction done."
20813         exit 0
20814         ;;
20815 cont)
20816         ;;
20817 '')
20818         dflt=''
20819         nostick=true
20820         $cat <<EOM
20821
20822 If you'd like to make any changes to the config.sh file before I begin
20823 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20824
20825 EOM
20826         rp="Press return or use a shell escape to edit config.sh:"
20827         . UU/myread
20828         nostick=''
20829         case "$ans" in
20830         '') ;;
20831         *) : in case they cannot read
20832                 sh 1>&4 -c "$ans";;
20833         esac
20834         ;;
20835 esac
20836
20837 : if this fails, just run all the .SH files by hand
20838 . ./config.sh
20839
20840 echo " "
20841 exec 1>&4
20842 pwd=`pwd`
20843 . ./UU/extract
20844 cd "$pwd"
20845
20846 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20847         dflt=y
20848         case "$silent" in
20849         true) ;;
20850         *)
20851                 $cat <<EOM
20852
20853 Now you need to generate make dependencies by running "$make depend".
20854 You might prefer to run it in background: "$make depend > makedepend.out &"
20855 It can take a while, so you might not want to run it right now.
20856
20857 EOM
20858                 ;;
20859         esac
20860         rp="Run $make depend now?"
20861         . UU/myread
20862         case "$ans" in
20863         y*)
20864                 $make depend && echo "Now you must run '$make'."
20865                 ;;
20866         *)
20867                 echo "You must run '$make depend' then '$make'."
20868                 ;;
20869         esac
20870 elif test -f [Mm]akefile; then
20871         echo " "
20872         echo "Now you must run a $make."
20873 else
20874         echo "Configure done."
20875 fi
20876
20877 if $test -f Policy.sh; then
20878     $cat <<EOM
20879
20880 If you compile $package on a different machine or from a different object
20881 directory, copy the Policy.sh file from this object directory to the
20882 new one before you run Configure -- this will help you with most of
20883 the policy defaults.
20884
20885 EOM
20886 fi
20887 if $test -f config.msg; then
20888     echo "Hmm.  I also noted the following information while running:"
20889     echo " "
20890     $cat config.msg >&4
20891     $rm -f config.msg
20892 fi
20893 $rm -f kit*isdone ark*isdone
20894 $rm -rf UU
20895
20896 : End of Configure
20897