Support crypt_r(const char*,const char*, CRYPTD*).
[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 Mar 19 18:17:12 EET 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 bincompat5005=''
305 d_bincompat5005=''
306 byteorder=''
307 cc=''
308 ccflags=''
309 cppflags=''
310 ldflags=''
311 lkflags=''
312 locincpth=''
313 optimize=''
314 cf_email=''
315 cf_by=''
316 cf_time=''
317 charsize=''
318 contains=''
319 cpp_stuff=''
320 cpplast=''
321 cppminus=''
322 cpprun=''
323 cppstdin=''
324 d__fwalk=''
325 d_access=''
326 d_accessx=''
327 d_alarm=''
328 asctime_r_proto=''
329 d_asctime_r=''
330 d_attribut=''
331 d_bcmp=''
332 d_bcopy=''
333 d_bzero=''
334 d_casti32=''
335 castflags=''
336 d_castneg=''
337 d_chown=''
338 d_chroot=''
339 d_chsize=''
340 d_class=''
341 d_closedir=''
342 d_void_closedir=''
343 d_cmsghdr_s=''
344 d_const=''
345 cryptlib=''
346 d_crypt=''
347 crypt_r_proto=''
348 d_crypt_r=''
349 d_csh=''
350 full_csh=''
351 ctermid_r_proto=''
352 d_ctermid_r=''
353 ctime_r_proto=''
354 d_ctime_r=''
355 d_cuserid=''
356 d_dbl_dig=''
357 d_dbminitproto=''
358 d_difftime=''
359 d_dirfd=''
360 d_dlerror=''
361 d_dlopen=''
362 d_dlsymun=''
363 d_dosuid=''
364 d_suidsafe=''
365 d_drand48_r=''
366 drand48_r_proto=''
367 d_drand48proto=''
368 d_dup2=''
369 d_eaccess=''
370 d_endgrent=''
371 d_endgrent_r=''
372 endgrent_r_proto=''
373 d_endhent=''
374 d_endhostent_r=''
375 endhostent_r_proto=''
376 d_endnent=''
377 d_endnetent_r=''
378 endnetent_r_proto=''
379 d_endpent=''
380 d_endprotoent_r=''
381 endprotoent_r_proto=''
382 d_endpwent=''
383 d_endpwent_r=''
384 endpwent_r_proto=''
385 d_endsent=''
386 d_endservent_r=''
387 endservent_r_proto=''
388 d_fchdir=''
389 d_fchmod=''
390 d_fchown=''
391 d_fcntl=''
392 d_fcntl_can_lock=''
393 d_fd_macros=''
394 d_fd_set=''
395 d_fds_bits=''
396 d_fgetpos=''
397 d_finite=''
398 d_finitel=''
399 d_flexfnam=''
400 d_flock=''
401 d_flockproto=''
402 d_fork=''
403 d_fp_class=''
404 d_fpclass=''
405 d_fpclassify=''
406 d_fpclassl=''
407 d_fpos64_t=''
408 d_frexpl=''
409 d_fs_data_s=''
410 d_fseeko=''
411 d_fsetpos=''
412 d_fstatfs=''
413 d_fsync=''
414 d_ftello=''
415 d_ftime=''
416 d_gettimeod=''
417 d_Gconvert=''
418 d_getcwd=''
419 d_getespwnam=''
420 d_getfsstat=''
421 d_getgrent=''
422 d_getgrent_r=''
423 getgrent_r_proto=''
424 d_getgrgid_r=''
425 getgrgid_r_proto=''
426 d_getgrnam_r=''
427 getgrnam_r_proto=''
428 d_getgrps=''
429 d_gethbyaddr=''
430 d_gethbyname=''
431 d_gethent=''
432 aphostname=''
433 d_gethname=''
434 d_phostname=''
435 d_uname=''
436 d_gethostbyaddr_r=''
437 gethostbyaddr_r_proto=''
438 d_gethostbyname_r=''
439 gethostbyname_r_proto=''
440 d_gethostent_r=''
441 gethostent_r_proto=''
442 d_gethostprotos=''
443 d_getitimer=''
444 d_getlogin=''
445 d_getlogin_r=''
446 getlogin_r_proto=''
447 d_getmnt=''
448 d_getmntent=''
449 d_getnbyaddr=''
450 d_getnbyname=''
451 d_getnent=''
452 d_getnetbyaddr_r=''
453 getnetbyaddr_r_proto=''
454 d_getnetbyname_r=''
455 getnetbyname_r_proto=''
456 d_getnetent_r=''
457 getnetent_r_proto=''
458 d_getnetprotos=''
459 d_getpagsz=''
460 d_getpent=''
461 d_getpgid=''
462 d_getpgrp2=''
463 d_bsdgetpgrp=''
464 d_getpgrp=''
465 d_getppid=''
466 d_getprior=''
467 d_getpbyname=''
468 d_getpbynumber=''
469 d_getprotobyname_r=''
470 getprotobyname_r_proto=''
471 d_getprotobynumber_r=''
472 getprotobynumber_r_proto=''
473 d_getprotoent_r=''
474 getprotoent_r_proto=''
475 d_getprotoprotos=''
476 d_getprpwnam=''
477 d_getpwent=''
478 d_getpwent_r=''
479 getpwent_r_proto=''
480 d_getpwnam_r=''
481 getpwnam_r_proto=''
482 d_getpwuid_r=''
483 getpwuid_r_proto=''
484 d_getsent=''
485 d_getservbyname_r=''
486 getservbyname_r_proto=''
487 d_getservbyport_r=''
488 getservbyport_r_proto=''
489 d_getservent_r=''
490 getservent_r_proto=''
491 d_getservprotos=''
492 d_getspnam=''
493 d_getspnam_r=''
494 getspnam_r_proto=''
495 d_getsbyname=''
496 d_getsbyport=''
497 d_gmtime_r=''
498 gmtime_r_proto=''
499 d_gnulibc=''
500 d_hasmntopt=''
501 d_htonl=''
502 d_inetaton=''
503 d_int64_t=''
504 d_isascii=''
505 d_isfinite=''
506 d_isinf=''
507 d_isnan=''
508 d_isnanl=''
509 d_killpg=''
510 d_lchown=''
511 d_ldbl_dig=''
512 d_link=''
513 d_localtime_r=''
514 localtime_r_proto=''
515 d_locconv=''
516 d_lockf=''
517 d_longdbl=''
518 longdblsize=''
519 d_longlong=''
520 longlongsize=''
521 d_lseekproto=''
522 d_lstat=''
523 d_madvise=''
524 d_mblen=''
525 d_mbstowcs=''
526 d_mbtowc=''
527 d_memchr=''
528 d_memcmp=''
529 d_memcpy=''
530 d_memmove=''
531 d_memset=''
532 d_mkdir=''
533 d_mkdtemp=''
534 d_mkfifo=''
535 d_mkstemp=''
536 d_mkstemps=''
537 d_mktime=''
538 d_mmap=''
539 mmaptype=''
540 d_modfl=''
541 d_modfl_pow32_bug=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nice=''
552 d_nl_langinfo=''
553 d_off64_t=''
554 d_open3=''
555 d_fpathconf=''
556 d_pathconf=''
557 d_pause=''
558 d_pipe=''
559 d_poll=''
560 d_portable=''
561 d_procselfexe=''
562 procselfexe=''
563 d_old_pthread_create_joinable=''
564 old_pthread_create_joinable=''
565 d_pthread_atfork=''
566 d_pthread_yield=''
567 d_sched_yield=''
568 sched_yield=''
569 d_qgcvt=''
570 d_random_r=''
571 random_r_proto=''
572 d_readdir64_r=''
573 readdir64_r_proto=''
574 d_readdir=''
575 d_rewinddir=''
576 d_seekdir=''
577 d_telldir=''
578 d_readdir_r=''
579 readdir_r_proto=''
580 d_readlink=''
581 d_readv=''
582 d_recvmsg=''
583 d_rename=''
584 d_rmdir=''
585 d_safebcpy=''
586 d_safemcpy=''
587 d_sanemcmp=''
588 d_sbrkproto=''
589 d_select=''
590 d_sem=''
591 d_semctl=''
592 d_semget=''
593 d_semop=''
594 d_sendmsg=''
595 d_setegid=''
596 d_seteuid=''
597 d_setgrent=''
598 d_setgrent_r=''
599 setgrent_r_proto=''
600 d_setgrps=''
601 d_sethent=''
602 d_sethostent_r=''
603 sethostent_r_proto=''
604 d_setitimer=''
605 d_setlinebuf=''
606 d_setlocale=''
607 d_setlocale_r=''
608 setlocale_r_proto=''
609 d_setnent=''
610 d_setnetent_r=''
611 setnetent_r_proto=''
612 d_setpent=''
613 d_setpgid=''
614 d_setpgrp2=''
615 d_bsdsetpgrp=''
616 d_setpgrp=''
617 d_setprior=''
618 d_setproctitle=''
619 d_setprotoent_r=''
620 setprotoent_r_proto=''
621 d_setpwent=''
622 d_setpwent_r=''
623 setpwent_r_proto=''
624 d_setregid=''
625 d_setresgid=''
626 d_setresuid=''
627 d_setreuid=''
628 d_setrgid=''
629 d_setruid=''
630 d_setsent=''
631 d_setservent_r=''
632 setservent_r_proto=''
633 d_setsid=''
634 d_setvbuf=''
635 d_sfio=''
636 usesfio=''
637 d_shm=''
638 d_shmat=''
639 d_shmatprototype=''
640 shmattype=''
641 d_shmctl=''
642 d_shmdt=''
643 d_shmget=''
644 d_sigaction=''
645 d_sigprocmask=''
646 d_sigsetjmp=''
647 d_sockatmark=''
648 d_sockatmarkproto=''
649 d_msg_ctrunc=''
650 d_msg_dontroute=''
651 d_msg_oob=''
652 d_msg_peek=''
653 d_msg_proxy=''
654 d_oldsock=''
655 d_scm_rights=''
656 d_socket=''
657 d_sockpair=''
658 sockethdr=''
659 socketlib=''
660 d_socklen_t=''
661 d_socks5_init=''
662 d_sqrtl=''
663 d_srand48_r=''
664 srand48_r_proto=''
665 d_srandom_r=''
666 srandom_r_proto=''
667 d_sresgproto=''
668 d_sresuproto=''
669 d_statblks=''
670 d_statfs_f_flags=''
671 d_statfs_s=''
672 d_fstatvfs=''
673 d_statvfs=''
674 d_stdio_cnt_lval=''
675 d_stdio_ptr_lval=''
676 d_stdio_ptr_lval_nochange_cnt=''
677 d_stdio_ptr_lval_sets_cnt=''
678 d_stdiobase=''
679 d_stdstdio=''
680 stdio_base=''
681 stdio_bufsiz=''
682 stdio_cnt=''
683 stdio_filbuf=''
684 stdio_ptr=''
685 d_index=''
686 d_strchr=''
687 d_strcoll=''
688 d_strctcpy=''
689 d_strerrm=''
690 d_strerror=''
691 d_sysernlst=''
692 d_syserrlst=''
693 d_strerror_r=''
694 strerror_r_proto=''
695 d_strftime=''
696 d_strtod=''
697 d_strtol=''
698 d_strtold=''
699 d_strtoll=''
700 d_strtoq=''
701 d_strtoul=''
702 d_strtoull=''
703 d_strtouq=''
704 d_strxfrm=''
705 d_symlink=''
706 d_syscall=''
707 d_syscallproto=''
708 d_sysconf=''
709 d_system=''
710 d_tcgetpgrp=''
711 d_tcsetpgrp=''
712 d_telldirproto=''
713 d_time=''
714 timetype=''
715 clocktype=''
716 d_times=''
717 d_tmpnam_r=''
718 tmpnam_r_proto=''
719 d_truncate=''
720 d_ttyname_r=''
721 ttyname_r_proto=''
722 d_tzname=''
723 d_u32align=''
724 d_ualarm=''
725 d_umask=''
726 d_semctl_semid_ds=''
727 d_semctl_semun=''
728 d_union_semun=''
729 d_unordered=''
730 d_usleep=''
731 d_usleepproto=''
732 d_ustat=''
733 d_vfork=''
734 usevfork=''
735 d_voidsig=''
736 signal_t=''
737 d_volatile=''
738 d_charvspr=''
739 d_vprintf=''
740 d_wait4=''
741 d_waitpid=''
742 d_wcstombs=''
743 d_wctomb=''
744 d_writev=''
745 dlext=''
746 cccdlflags=''
747 ccdlflags=''
748 dlsrc=''
749 ld=''
750 lddlflags=''
751 usedl=''
752 doublesize=''
753 ebcdic=''
754 fflushNULL=''
755 fflushall=''
756 fpossize=''
757 fpostype=''
758 gccosandvers=''
759 gccversion=''
760 gidformat=''
761 gidsign=''
762 gidsize=''
763 gidtype=''
764 groupstype=''
765 h_fcntl=''
766 h_sysfile=''
767 i_arpainet=''
768 i_crypt=''
769 db_hashtype=''
770 db_prefixtype=''
771 db_version_major=''
772 db_version_minor=''
773 db_version_patch=''
774 i_db=''
775 i_dbm=''
776 i_rpcsvcdbm=''
777 d_dirnamlen=''
778 direntrytype=''
779 i_dirent=''
780 i_dld=''
781 i_dlfcn=''
782 i_fcntl=''
783 i_float=''
784 i_fp=''
785 i_fp_class=''
786 i_gdbm=''
787 d_grpasswd=''
788 i_grp=''
789 i_ieeefp=''
790 i_inttypes=''
791 i_langinfo=''
792 i_libutil=''
793 i_limits=''
794 i_locale=''
795 i_machcthr=''
796 i_malloc=''
797 i_math=''
798 i_memory=''
799 i_mntent=''
800 i_ndbm=''
801 i_netdb=''
802 i_neterrno=''
803 i_netinettcp=''
804 i_niin=''
805 i_sysin=''
806 i_poll=''
807 i_prot=''
808 i_pthread=''
809 d_pwage=''
810 d_pwchange=''
811 d_pwclass=''
812 d_pwcomment=''
813 d_pwexpire=''
814 d_pwgecos=''
815 d_pwpasswd=''
816 d_pwquota=''
817 i_pwd=''
818 i_sfio=''
819 i_shadow=''
820 i_socks=''
821 i_stddef=''
822 i_stdlib=''
823 i_string=''
824 strings=''
825 i_sunmath=''
826 i_sysaccess=''
827 i_sysdir=''
828 i_sysfile=''
829 d_voidtty=''
830 i_bsdioctl=''
831 i_sysfilio=''
832 i_sysioctl=''
833 i_syssockio=''
834 i_syslog=''
835 i_sysmman=''
836 i_sysmode=''
837 i_sysmount=''
838 i_sysndir=''
839 i_sysparam=''
840 i_sysresrc=''
841 i_syssecrt=''
842 i_sysselct=''
843 i_sysstat=''
844 i_sysstatfs=''
845 i_sysstatvfs=''
846 i_systimes=''
847 i_systypes=''
848 i_sysuio=''
849 i_sysun=''
850 i_sysutsname=''
851 i_sysvfs=''
852 i_syswait=''
853 i_sgtty=''
854 i_termio=''
855 i_termios=''
856 d_tm_tm_gmtoff=''
857 d_tm_tm_zone=''
858 i_systime=''
859 i_systimek=''
860 i_time=''
861 timeincl=''
862 i_unistd=''
863 i_ustat=''
864 i_utime=''
865 i_values=''
866 i_stdarg=''
867 i_varargs=''
868 i_varhdr=''
869 i_vfork=''
870 inc_version_list=''
871 inc_version_list_init=''
872 installprefix=''
873 installprefixexp=''
874 installstyle=''
875 installusrbinperl=''
876 intsize=''
877 longsize=''
878 shortsize=''
879 issymlink=''
880 libc=''
881 ldlibpthname=''
882 libperl=''
883 shrpenv=''
884 useshrplib=''
885 glibpth=''
886 libpth=''
887 loclibpth=''
888 plibpth=''
889 xlibpth=''
890 ignore_versioned_solibs=''
891 libs=''
892 libsdirs=''
893 libsfiles=''
894 libsfound=''
895 libspath=''
896 lns=''
897 d_PRIEUldbl=''
898 d_PRIFUldbl=''
899 d_PRIGUldbl=''
900 d_PRIeldbl=''
901 d_PRIfldbl=''
902 d_PRIgldbl=''
903 d_SCNfldbl=''
904 sPRIEUldbl=''
905 sPRIFUldbl=''
906 sPRIGUldbl=''
907 sPRIeldbl=''
908 sPRIfldbl=''
909 sPRIgldbl=''
910 sSCNfldbl=''
911 lseeksize=''
912 lseektype=''
913 make_set_make=''
914 d_mymalloc=''
915 freetype=''
916 mallocobj=''
917 mallocsrc=''
918 malloctype=''
919 usemymalloc=''
920 installman1dir=''
921 man1dir=''
922 man1direxp=''
923 man1ext=''
924 installman3dir=''
925 man3dir=''
926 man3direxp=''
927 man3ext=''
928 modetype=''
929 multiarch=''
930 mydomain=''
931 myhostname=''
932 phostname=''
933 c=''
934 n=''
935 d_eofnblk=''
936 eagain=''
937 o_nonblock=''
938 rd_nodata=''
939 need_va_copy=''
940 netdb_hlen_type=''
941 netdb_host_type=''
942 netdb_name_type=''
943 netdb_net_type=''
944 groupcat=''
945 hostcat=''
946 passcat=''
947 orderlib=''
948 ranlib=''
949 d_perl_otherlibdirs=''
950 otherlibdirs=''
951 package=''
952 spackage=''
953 pager=''
954 api_revision=''
955 api_subversion=''
956 api_version=''
957 api_versionstring=''
958 patchlevel=''
959 perl_patchlevel=''
960 revision=''
961 subversion=''
962 version=''
963 version_patchlevel_string=''
964 perl5=''
965 perladmin=''
966 perlpath=''
967 d_nv_preserves_uv=''
968 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                 esac
2392             fi
2393         fi
2394     fi
2395     $rm -f try try.*
2396     ;;
2397 esac
2398 EOSC
2399
2400 cat <<EOS >checkcc
2401 $startsh
2402 EOS
2403 cat <<'EOSC' >>checkcc
2404 case "$cc" in        
2405 '') ;;
2406 *)  $rm -f try try.*              
2407     $cat >try.c <<EOM
2408 int main(int argc, char *argv[]) {
2409   return 0;
2410 }
2411 EOM
2412     if $cc -o try $ccflags $ldflags try.c; then
2413        :
2414     else
2415         if $test X"$despair" = Xyes; then
2416            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2417         fi
2418         $cat >&4 <<EOM         
2419 You need to find a working C compiler.
2420 Either (purchase and) install the C compiler supplied by your OS vendor,
2421 or for a free C compiler try http://gcc.gnu.org/
2422 I cannot continue any further, aborting.
2423 EOM
2424         exit 1
2425     fi
2426     $rm -f try try.*
2427     ;;
2428 esac
2429 EOSC
2430
2431 : determine whether symbolic links are supported
2432 echo " "
2433 $touch blurfl
2434 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2435         echo "Symbolic links are supported." >&4
2436         lns="$ln -s"
2437 else
2438         echo "Symbolic links are NOT supported." >&4
2439         lns="$ln"
2440 fi
2441 $rm -f blurfl sym
2442
2443 : determine whether symbolic links are supported
2444 echo " "
2445 case "$lns" in
2446 *"ln"*" -s")
2447         echo "Checking how to test for symbolic links..." >&4
2448         $lns blurfl sym
2449         if $test "X$issymlink" = X; then
2450                 case "$newsh" in
2451                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2452                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2453                 esac
2454                 if test $? = 0; then
2455                         issymlink="test -h"
2456                 else
2457                         echo "Your builtin 'test -h' may be broken." >&4
2458                         case "$test" in
2459                         /*)     ;;
2460                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2461                                 for p in $pth
2462                                 do
2463                                         if test -f "$p/$test"; then
2464                                                 test="$p/$test"
2465                                                 break
2466                                         fi
2467                                 done
2468                                 ;;
2469                         esac
2470                         case "$test" in
2471                         /*)
2472                                 echo "Trying external '$test -h'." >&4
2473                                 issymlink="$test -h"
2474                                 if $test ! -h sym >/dev/null 2>&1; then
2475                                         echo "External '$test -h' is broken, too." >&4
2476                                         issymlink=''
2477                                 fi
2478                                 ;;
2479                         *)      issymlink='' ;;
2480                         esac
2481                 fi              
2482         fi
2483         if $test "X$issymlink" = X; then
2484                 if $test -L sym 2>/dev/null; then
2485                         issymlink="$test -L"
2486                         echo "The builtin '$test -L' worked." >&4
2487                 fi
2488         fi
2489         if $test "X$issymlink" != X; then
2490                 echo "You can test for symbolic links with '$issymlink'." >&4
2491         else
2492                 echo "I do not know how you can test for symbolic links." >&4
2493         fi
2494         $rm -f blurfl sym
2495         ;;
2496 *)      echo "No symbolic links, so not testing for their testing..." >&4
2497         ;;
2498 esac
2499 echo " "
2500
2501
2502 case "$mksymlinks" in
2503 $define|true|[yY]*)
2504         case "$src" in
2505         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2506                 exit 1
2507                 ;;
2508         *)      case "$lns:$issymlink" in
2509                 *"ln"*" -s:"*"test -"?)
2510                         echo "Creating the symbolic links..." >&4
2511                         echo "(First creating the subdirectories...)" >&4
2512                         cd ..
2513                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2514                                 read directory
2515                                 test -z "$directory" && break
2516                                 mkdir -p $directory
2517                         done
2518                         # Sanity check 1.
2519                         if test ! -d t/base; then
2520                                 echo "Failed to create the subdirectories.  Aborting." >&4
2521                                 exit 1
2522                         fi
2523                         echo "(Then creating the symlinks...)" >&4
2524                         awk '{print $1}' $src/MANIFEST | while true; do
2525                                 read filename
2526                                 test -z "$filename" && break
2527                                 if test -f $filename; then
2528                                         if $issymlink $filename; then
2529                                                 rm -f $filename
2530                                         fi
2531                                 fi
2532                                 if test -f $filename; then
2533                                         echo "$filename already exists, not symlinking."
2534                                 else
2535                                         ln -s $src/$filename $filename
2536                                 fi
2537                         done
2538                         # Sanity check 2.
2539                         if test ! -f t/base/lex.t; then
2540                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2541                                 exit 1
2542                         fi
2543                         cd UU
2544                         ;;
2545                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2546                         ;;
2547                 esac
2548                 ;;
2549         esac
2550         ;;
2551 esac
2552
2553
2554 case "$usecrosscompile" in
2555 $define|true|[yY]*)
2556         $echo "Cross-compiling..."
2557         croak=''
2558         case "$cc" in
2559         *-*-gcc) # A cross-compiling gcc, probably.
2560             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2561             ar=$targetarch-ar
2562             # leave out ld, choosing it is more complex
2563             nm=$targetarch-nm
2564             ranlib=$targetarch-ranlib
2565             $echo 'extern int foo;' > try.c
2566             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2567             shift
2568             if $test $# -gt 0; then
2569                 incpth="$incpth $*"
2570                 incpth="`$echo $incpth|$sed 's/^ //'`"
2571                 echo "Guessing incpth '$incpth'." >&4
2572                 for i in $*; do
2573                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2574                     if $test -d $j; then
2575                         libpth="$libpth $j"
2576                     fi
2577                 done   
2578                 libpth="`$echo $libpth|$sed 's/^ //'`"
2579                 echo "Guessing libpth '$libpth'." >&4
2580             fi
2581             $rm -f try.c
2582             ;;
2583         esac
2584         case "$targetarch" in
2585         '') echo "Targetarch not defined." >&4; croak=y ;;
2586         *)  echo "Using targetarch $targetarch." >&4 ;;
2587         esac
2588         case "$incpth" in
2589         '') echo "Incpth not defined." >&4; croak=y ;;
2590         *)  echo "Using incpth '$incpth'." >&4 ;;
2591         esac
2592         case "$libpth" in
2593         '') echo "Libpth not defined." >&4; croak=y ;;
2594         *)  echo "Using libpth '$libpth'." >&4 ;;
2595         esac
2596         case "$usrinc" in
2597         '') for i in $incpth; do
2598                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2599                     usrinc=$i
2600                     echo "Guessing usrinc $usrinc." >&4
2601                     break
2602                 fi
2603             done
2604             case "$usrinc" in
2605             '') echo "Usrinc not defined." >&4; croak=y ;;
2606             esac
2607             ;;
2608         *)  echo "Using usrinc $usrinc." >&4 ;;
2609         esac
2610         case "$targethost" in
2611         '') echo "Targethost not defined." >&4; croak=y ;;
2612         *)  echo "Using targethost $targethost." >&4
2613         esac
2614         locincpth=' '
2615         loclibpth=' '
2616         case "$croak" in
2617         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2618         esac
2619         case "$src" in
2620         /*) run=$src/Cross/run
2621             targetmkdir=$src/Cross/mkdir
2622             to=$src/Cross/to
2623             from=$src/Cross/from
2624             ;;
2625         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2626             run=$pwd/Cross/run
2627             targetmkdir=$pwd/Cross/mkdir
2628             to=$pwd/Cross/to
2629             from=$pwd/Cross/from
2630             ;;
2631         esac
2632         case "$targetrun" in
2633         '') targetrun=ssh ;;
2634         esac
2635         case "$targetto" in
2636         '') targetto=scp ;;
2637         esac
2638         case "$targetfrom" in
2639         '') targetfrom=scp ;;
2640         esac
2641         run=$run-$targetrun
2642         to=$to-$targetto
2643         from=$from-$targetfrom
2644         case "$targetdir" in
2645         '')  targetdir=/tmp
2646              echo "Guessing targetdir $targetdir." >&4
2647              ;;
2648         esac
2649         case "$targetuser" in
2650         '')  targetuser=root
2651              echo "Guessing targetuser $targetuser." >&4
2652              ;;
2653         esac
2654         case "$targetfrom" in
2655         scp)    q=-q ;;
2656         *)      q='' ;;
2657         esac
2658         case "$targetrun" in
2659         ssh|rsh)
2660             cat >$run <<EOF
2661 #!/bin/sh
2662 case "\$1" in
2663 -cwd)
2664   shift
2665   cwd=\$1
2666   shift
2667   ;;
2668 esac
2669 case "\$cwd" in
2670 '') cwd=$targetdir ;;
2671 esac
2672 exe=\$1
2673 shift
2674 if $test ! -f \$exe.xok; then
2675   $to \$exe
2676   $touch \$exe.xok
2677 fi
2678 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2679 EOF
2680             ;;
2681         *)  echo "Unknown targetrun '$targetrun'" >&4
2682             exit 1
2683             ;;
2684         esac
2685         case "$targetmkdir" in
2686         */Cross/mkdir)
2687             cat >$targetmkdir <<EOF
2688 #!/bin/sh
2689 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2690 EOF
2691             $chmod a+rx $targetmkdir
2692             ;;
2693         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2694             exit 1
2695             ;;
2696         esac
2697         case "$targetto" in
2698         scp|rcp)
2699             cat >$to <<EOF
2700 #!/bin/sh
2701 for f in \$@
2702 do
2703   case "\$f" in
2704   /*)
2705     $targetmkdir \`dirname \$f\`
2706     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2707     ;;
2708   *)
2709     $targetmkdir $targetdir/\`dirname \$f\`
2710     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2711     ;;
2712   esac
2713 done
2714 exit 0
2715 EOF
2716             ;;
2717         cp) cat >$to <<EOF
2718 #!/bin/sh
2719 for f in \$@
2720 do
2721   case "\$f" in
2722   /*)
2723     $mkdir -p $targetdir/\`dirname \$f\`
2724     $cp \$f $targetdir/\$f || exit 1
2725     ;;
2726   *)
2727     $targetmkdir $targetdir/\`dirname \$f\`
2728     $cp \$f $targetdir/\$f || exit 1
2729     ;;
2730   esac
2731 done
2732 exit 0
2733 EOF
2734             ;;
2735         *)  echo "Unknown targetto '$targetto'" >&4
2736             exit 1
2737             ;;
2738         esac
2739         case "$targetfrom" in
2740         scp|rcp)
2741           cat >$from <<EOF
2742 #!/bin/sh
2743 for f in \$@
2744 do
2745   $rm -f \$f
2746   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2747 done
2748 exit 0
2749 EOF
2750             ;;
2751         cp) cat >$from <<EOF
2752 #!/bin/sh
2753 for f in \$@
2754 do
2755   $rm -f \$f
2756   cp $targetdir/\$f . || exit 1
2757 done
2758 exit 0
2759 EOF
2760             ;;
2761         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2762             exit 1
2763             ;;
2764         esac
2765         if $test ! -f $run; then
2766             echo "Target 'run' script '$run' not found." >&4
2767         else
2768             $chmod a+rx $run
2769         fi
2770         if $test ! -f $to; then
2771             echo "Target 'to' script '$to' not found." >&4
2772         else
2773             $chmod a+rx $to
2774         fi
2775         if $test ! -f $from; then
2776             echo "Target 'from' script '$from' not found." >&4
2777         else
2778             $chmod a+rx $from
2779         fi
2780         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2781             exit 1
2782         fi
2783         cat >&4 <<EOF
2784 Using '$run' for remote execution,
2785 and '$from' and '$to'
2786 for remote file transfer.
2787 EOF
2788         ;;
2789 *)      run=''
2790         to=:
2791         from=:
2792         usecrosscompile='undef'
2793         targetarch=''
2794         ;;
2795 esac
2796
2797 : see whether [:lower:] and [:upper:] are supported character classes
2798 echo " "
2799 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2800 ABYZ)
2801         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2802         up='[:upper:]'
2803         low='[:lower:]'
2804         ;;
2805 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2806         # (0xc9 and 0xd1), therefore that is a nice testing point.
2807         if test "X$up" = X -o "X$low" = X; then
2808             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2809             ij) up='[A-Z]'
2810                 low='[a-z]'
2811                 ;;
2812             esac
2813         fi
2814         if test "X$up" = X -o "X$low" = X; then
2815             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2816             ij) up='A-Z'
2817                 low='a-z'
2818                 ;;
2819             esac
2820         fi
2821         if test "X$up" = X -o "X$low" = X; then
2822             case "`echo IJ | od -x 2>/dev/null`" in
2823             *C9D1*|*c9d1*)
2824                 echo "Hey, this might be EBCDIC." >&4
2825                 if test "X$up" = X -o "X$low" = X; then
2826                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2827                     ij) up='[A-IJ-RS-Z]'
2828                         low='[a-ij-rs-z]'
2829                         ;;
2830                     esac
2831                 fi
2832                 if test "X$up" = X -o "X$low" = X; then
2833                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2834                     ij) up='A-IJ-RS-Z'
2835                         low='a-ij-rs-z'
2836                         ;;
2837                     esac
2838                 fi
2839                 ;;
2840             esac
2841         fi
2842 esac
2843 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2844 ij)
2845     echo "Using $up and $low to convert case." >&4
2846     ;;
2847 *)
2848     echo "I don't know how to translate letters from upper to lower case." >&4
2849     echo "Your tr is not acting any way I know of." >&4
2850     exit 1
2851     ;;
2852 esac
2853 : set up the translation script tr, must be called with ./tr of course
2854 cat >tr <<EOSC
2855 $startsh
2856 case "\$1\$2" in
2857 '[A-Z][a-z]') exec $tr '$up' '$low';;
2858 '[a-z][A-Z]') exec $tr '$low' '$up';;
2859 esac
2860 exec $tr "\$@"
2861 EOSC
2862 chmod +x tr
2863 $eunicefix tr
2864
2865 : Try to determine whether config.sh was made on this system
2866 case "$config_sh" in
2867 '')
2868 myuname=`$uname -a 2>/dev/null`
2869 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2870 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2871 # because the A-Z/a-z are not consecutive.
2872 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2873         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2874 newmyuname="$myuname"
2875 dflt=n
2876 case "$knowitall" in
2877 '')
2878         if test -f ../config.sh; then
2879                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2880                         eval "`grep myuname= ../config.sh`"
2881                 fi
2882                 if test "X$myuname" = "X$newmyuname"; then
2883                         dflt=y
2884                 fi
2885         fi
2886         ;;
2887 *) dflt=y;;
2888 esac
2889
2890 : Get old answers from old config file if Configure was run on the
2891 : same system, otherwise use the hints.
2892 hint=default
2893 cd ..
2894 if test -f config.sh; then
2895         echo " "
2896         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2897         . UU/myread
2898         case "$ans" in
2899         n*|N*) echo "OK, I'll ignore it."
2900                 mv config.sh config.sh.old
2901                 myuname="$newmyuname"
2902                 ;;
2903         *)  echo "Fetching default answers from your old config.sh file..." >&4
2904                 tmp_n="$n"
2905                 tmp_c="$c"
2906                 tmp_sh="$sh"
2907                 . ./config.sh
2908                 cp config.sh UU
2909                 n="$tmp_n"
2910                 c="$tmp_c"
2911                 : Older versions did not always set $sh.  Catch re-use of such
2912                 : an old config.sh.
2913                 case "$sh" in
2914                 '') sh="$tmp_sh" ;;
2915                 esac
2916                 hint=previous
2917                 ;;
2918         esac
2919 fi
2920 . ./UU/checkcc
2921 if test ! -f config.sh; then
2922         $cat <<EOM
2923
2924 First time through, eh?  I have some defaults handy for some systems
2925 that need some extra help getting the Configure answers right:
2926
2927 EOM
2928         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2929         dflt=''
2930         : Half the following guesses are probably wrong... If you have better
2931         : tests or hints, please send them to perlbug@perl.org
2932         : The metaconfig authors would also appreciate a copy...
2933         $test -f /irix && osname=irix
2934         $test -f /xenix && osname=sco_xenix
2935         $test -f /dynix && osname=dynix
2936         $test -f /dnix && osname=dnix
2937         $test -f /lynx.os && osname=lynxos
2938         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2939         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2940         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2941         $test -f /bin/mips && /bin/mips && osname=mips
2942         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2943                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2944         $test -d /usr/apollo/bin && osname=apollo
2945         $test -f /etc/saf/_sactab && osname=svr4
2946         $test -d /usr/include/minix && osname=minix
2947         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2948         if $test -d /MachTen -o -d /MachTen_Folder; then
2949                 osname=machten
2950                 if $test -x /sbin/version; then
2951                         osvers=`/sbin/version | $awk '{print $2}' |
2952                         $sed -e 's/[A-Za-z]$//'`
2953                 elif $test -x /usr/etc/version; then
2954                         osvers=`/usr/etc/version | $awk '{print $2}' |
2955                         $sed -e 's/[A-Za-z]$//'`
2956                 else
2957                         osvers="$2.$3"
2958                 fi
2959         fi
2960
2961         $test -f /sys/posix.dll &&
2962                 $test -f /usr/bin/what &&
2963                 set X `/usr/bin/what /sys/posix.dll` &&
2964                 $test "$3" = UWIN &&
2965                 osname=uwin &&
2966                 osvers="$5"
2967
2968         if $test -f $uname; then
2969                 set X $myuname
2970                 shift
2971
2972                 case "$5" in
2973                 fps*) osname=fps ;;
2974                 mips*)
2975                         case "$4" in
2976                         umips) osname=umips ;;
2977                         *) osname=mips ;;
2978                         esac;;
2979                 [23]100) osname=mips ;;
2980                 next*) osname=next ;;
2981                 i386*)
2982                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2983                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2984                                 osname='sco'
2985                                 osvers=$tmp
2986                         elif $test -f /etc/kconfig; then
2987                                 osname=isc
2988                                 if test "$lns" = "$ln -s"; then
2989                                         osvers=4
2990                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2991                                         osvers=3
2992                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2993                                         osvers=2
2994                                 fi
2995                         fi
2996                         tmp=''
2997                         ;;
2998                 pc*)
2999                         if test -n "$DJGPP"; then
3000                                 osname=dos
3001                                 osvers=djgpp
3002                         fi
3003                         ;;
3004                 esac
3005
3006                 case "$1" in
3007                 aix) osname=aix
3008                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3009                         case "$tmp" in
3010                         'not found') osvers="$4"."$3" ;;
3011                         '<3240'|'<>3240') osvers=3.2.0 ;;
3012                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3013                         '=3250'|'>3250') osvers=3.2.5 ;;
3014                         *) osvers=$tmp;;
3015                         esac
3016                         ;;
3017                 bsd386) osname=bsd386
3018                         osvers=`$uname -r`
3019                         ;;
3020                 cygwin*) osname=cygwin
3021                         osvers="$3"
3022                         ;;
3023                 *dc.osx) osname=dcosx
3024                         osvers="$3"
3025                         ;;
3026                 dnix) osname=dnix
3027                         osvers="$3"
3028                         ;;
3029                 domainos) osname=apollo
3030                         osvers="$3"
3031                         ;;
3032                 dgux) osname=dgux 
3033                         osvers="$3"
3034                         ;;
3035                 dynixptx*) osname=dynixptx
3036                         osvers=`echo "$4"|sed 's/^v//'`
3037                         ;;
3038                 freebsd) osname=freebsd 
3039                         osvers="$3" ;;
3040                 genix) osname=genix ;;
3041                 hp*) osname=hpux 
3042                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3043                         ;;
3044                 irix*) osname=irix
3045                         case "$3" in
3046                         4*) osvers=4 ;;
3047                         5*) osvers=5 ;;
3048                         *)      osvers="$3" ;;
3049                         esac
3050                         ;;
3051                 linux) osname=linux
3052                         case "$3" in
3053                         *)      osvers="$3" ;;
3054                         esac
3055                         ;;
3056                 MiNT) osname=mint
3057                         ;;
3058                 netbsd*) osname=netbsd
3059                         osvers="$3"
3060                         ;;
3061                 news-os) osvers="$3"
3062                         case "$3" in
3063                         4*) osname=newsos4 ;;
3064                         *) osname=newsos ;;
3065                         esac
3066                         ;;
3067                 next*) osname=next ;;
3068                 nonstop-ux) osname=nonstopux ;;
3069                 POSIX-BC | posix-bc ) osname=posix-bc
3070                         osvers="$3"
3071                         ;;
3072                 powerux | power_ux | powermax_os | powermaxos | \
3073                 powerunix | power_unix) osname=powerux
3074                         osvers="$3"
3075                         ;;
3076                 qnx) osname=qnx
3077                         osvers="$4"
3078                         ;;
3079                 solaris) osname=solaris
3080                         case "$3" in
3081                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3082                         *)      osvers="$3" ;;
3083                         esac
3084                         ;;
3085                 sunos) osname=sunos
3086                         case "$3" in
3087                         5*) osname=solaris
3088                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3089                         *)      osvers="$3" ;;
3090                         esac
3091                         ;;
3092                 titanos) osname=titanos
3093                         case "$3" in
3094                         1*) osvers=1 ;;
3095                         2*) osvers=2 ;;
3096                         3*) osvers=3 ;;
3097                         4*) osvers=4 ;;
3098                         *)      osvers="$3" ;;
3099                         esac
3100                         ;;
3101                 ultrix) osname=ultrix
3102                         osvers="$3"
3103                         ;;
3104                 osf1|mls+)      case "$5" in
3105                                 alpha)
3106                                         osname=dec_osf
3107                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3108                                         case "$osvers" in
3109                                         [1-9].[0-9]*) ;;
3110                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3111                                         esac
3112                                         ;;
3113                         hp*)    osname=hp_osf1  ;;
3114                         mips)   osname=mips_osf1 ;;
3115                         esac
3116                         ;;
3117                 unixware) osname=svr5
3118                         osvers="$4"
3119                         ;;
3120                 uts)    osname=uts
3121                         osvers="$3"
3122                         ;;
3123                 vos) osvers="$3"
3124                         ;;
3125                 $2) case "$osname" in
3126                         *isc*) ;;
3127                         *freebsd*) ;;
3128                         svr*)
3129                                 : svr4.x or possibly later
3130                                 case "svr$3" in 
3131                                 ${osname}*)
3132                                         osname=svr$3
3133                                         osvers=$4
3134                                         ;;
3135                                 esac
3136                                 case "$osname" in
3137                                 svr4.0)
3138                                         : Check for ESIX
3139                                         if test -f /stand/boot ; then
3140                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3141                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3142                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3143                                                         if test -n "$isesix"; then
3144                                                                 osname=esix4
3145                                                         fi
3146                                                 fi
3147                                         fi
3148                                         ;;
3149                                 esac
3150                                 ;;
3151                         *)      if test -f /etc/systemid; then
3152                                         osname=sco
3153                                         set `echo $3 | $sed 's/\./ /g'` $4
3154                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3155                                                 osvers=$1.$2.$3
3156                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3157                                                 osvers=$1.$2
3158                                         elif $test -f $src/hints/sco_$1.sh; then
3159                                                 osvers=$1
3160                                         fi
3161                                 else
3162                                         case "$osname" in
3163                                         '') : Still unknown.  Probably a generic Sys V.
3164                                                 osname="sysv"
3165                                                 osvers="$3"
3166                                                 ;;
3167                                         esac
3168                                 fi
3169                                 ;;
3170                         esac
3171                         ;;
3172                 *)      case "$osname" in
3173                         '') : Still unknown.  Probably a generic BSD.
3174                                 osname="$1"
3175                                 osvers="$3"
3176                                 ;;
3177                         esac
3178                         ;;
3179                 esac
3180         else
3181                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3182                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3183                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3184                                 osname=news_os
3185                         fi
3186                         $rm -f UU/kernel.what
3187                 elif test -d c:/.; then
3188                         set X $myuname
3189                         osname=os2
3190                         osvers="$5"
3191                 fi
3192         fi
3193         
3194         case "$targetarch" in
3195         '') ;;
3196         *)  hostarch=$osname
3197             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3198             osvers=''
3199             ;;
3200         esac
3201
3202         : Now look for a hint file osname_osvers, unless one has been
3203         : specified already.
3204         case "$hintfile" in
3205         ''|' ')
3206                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3207                 : Also try without trailing minor version numbers.
3208                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3209                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3210                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3211                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3212                 case "$file" in
3213                 '') dflt=none ;;
3214                 *)  case "$osvers" in
3215                         '') dflt=$file
3216                                 ;;
3217                         *)  if $test -f $src/hints/$file.sh ; then
3218                                         dflt=$file
3219                                 elif $test -f $src/hints/$xfile.sh ; then
3220                                         dflt=$xfile
3221                                 elif $test -f $src/hints/$xxfile.sh ; then
3222                                         dflt=$xxfile
3223                                 elif $test -f $src/hints/$xxxfile.sh ; then
3224                                         dflt=$xxxfile
3225                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3226                                         dflt=$xxxxfile
3227                                 elif $test -f "$src/hints/${osname}.sh" ; then
3228                                         dflt="${osname}"
3229                                 else
3230                                         dflt=none
3231                                 fi
3232                                 ;;
3233                         esac
3234                         ;;
3235                 esac
3236                 if $test -f Policy.sh ; then
3237                         case "$dflt" in
3238                         *Policy*) ;;
3239                         none) dflt="Policy" ;;
3240                         *) dflt="Policy $dflt" ;;
3241                         esac
3242                 fi
3243                 ;;
3244         *)
3245                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3246                 ;;
3247         esac
3248
3249         if $test -f Policy.sh ; then
3250                 $cat <<EOM
3251
3252 There's also a Policy hint file available, which should make the
3253 site-specific (policy) questions easier to answer.
3254 EOM
3255
3256         fi
3257
3258         $cat <<EOM
3259
3260 You may give one or more space-separated answers, or "none" if appropriate.
3261 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3262 is a good thing.  DO NOT give a wrong version or a wrong OS.
3263
3264 EOM
3265
3266         rp="Which of these apply, if any?"
3267         . UU/myread
3268         tans=$ans
3269         for file in $tans; do
3270                 if $test X$file = XPolicy -a -f Policy.sh; then
3271                         . Policy.sh
3272                         $cat Policy.sh >> UU/config.sh
3273                 elif $test -f $src/hints/$file.sh; then
3274                         . $src/hints/$file.sh
3275                         $cat $src/hints/$file.sh >> UU/config.sh
3276                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3277                         : nothing
3278                 else
3279                         : Give one chance to correct a possible typo.
3280                         echo "$file.sh does not exist"
3281                         dflt=$file
3282                         rp="hint to use instead?"
3283                         . UU/myread
3284                         for file in $ans; do
3285                                 if $test -f "$src/hints/$file.sh"; then
3286                                         . $src/hints/$file.sh
3287                                         $cat $src/hints/$file.sh >> UU/config.sh
3288                                 elif $test X$ans = X -o X$ans = Xnone ; then
3289                                         : nothing
3290                                 else
3291                                         echo "$file.sh does not exist -- ignored."
3292                                 fi
3293                         done
3294                 fi
3295         done
3296
3297         hint=recommended
3298         : Remember our hint file for later.
3299         if $test -f "$src/hints/$file.sh" ; then
3300                 hintfile="$file"
3301         else
3302                 hintfile=''
3303         fi
3304 fi
3305 cd UU
3306 ;;
3307 *)
3308         echo " "
3309         echo "Fetching default answers from $config_sh..." >&4
3310         tmp_n="$n"
3311         tmp_c="$c"
3312         cd ..
3313         cp $config_sh config.sh 2>/dev/null
3314         chmod +w config.sh
3315         . ./config.sh
3316         cd UU
3317         cp ../config.sh .
3318         n="$tmp_n"
3319         c="$tmp_c"
3320         hint=previous
3321         ;;
3322 esac
3323 test "$override" && . ./optdef.sh
3324
3325 : Restore computed paths
3326 for file in $loclist $trylist; do
3327         eval $file="\$_$file"
3328 done
3329
3330 cat << EOM
3331
3332 Configure uses the operating system name and version to set some defaults.
3333 The default value is probably right if the name rings a bell. Otherwise,
3334 since spelling matters for me, either accept the default or answer "none"
3335 to leave it blank.
3336
3337 EOM
3338 case "$osname" in
3339         ''|' ')
3340                 case "$hintfile" in
3341                 ''|' '|none) dflt=none ;;
3342                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3343                 esac
3344                 ;;
3345         *) dflt="$osname" ;;
3346 esac
3347 rp="Operating system name?"
3348 . ./myread
3349 case "$ans" in
3350 none)  osname='' ;;
3351 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3352 esac
3353 echo " "
3354 case "$osvers" in
3355         ''|' ')
3356                 case "$hintfile" in
3357                 ''|' '|none) dflt=none ;;
3358                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3359                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3360                         case "$dflt" in
3361                         ''|' ') dflt=none ;;
3362                         esac
3363                         ;;
3364                 esac
3365                 ;;
3366         *) dflt="$osvers" ;;
3367 esac
3368 rp="Operating system version?"
3369 . ./myread
3370 case "$ans" in
3371 none)  osvers='' ;;
3372 *) osvers="$ans" ;;
3373 esac
3374
3375
3376 . ./posthint.sh
3377
3378 : who configured the system
3379 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3380 cf_by=`(logname) 2>/dev/null`
3381 case "$cf_by" in
3382 "")
3383         cf_by=`(whoami) 2>/dev/null`
3384         case "$cf_by" in
3385         "") cf_by=unknown ;;
3386         esac ;;
3387 esac
3388
3389 : set up the script used to warn in case of inconsistency
3390 cat <<EOS >whoa
3391 $startsh
3392 EOS
3393 cat <<'EOSC' >>whoa
3394 dflt=y
3395 echo " "
3396 echo "*** WHOA THERE!!! ***" >&4
3397 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3398 rp="    Keep the $hint value?"
3399 . ./myread
3400 case "$ans" in
3401 y) td=$was; tu=$was;;
3402 esac
3403 EOSC
3404
3405 : function used to set $1 to $val
3406 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3407 case "$val$was" in
3408 $define$undef) . ./whoa; eval "$var=\$td";;
3409 $undef$define) . ./whoa; eval "$var=\$tu";;
3410 *) eval "$var=$val";;
3411 esac'
3412
3413 case "$usethreads" in
3414 $define|true|[yY]*)     dflt='y';;
3415 *) dflt='n';;
3416 esac
3417 cat <<EOM
3418
3419 Perl can be built to take advantage of threads on some systems.
3420 To do so, Configure can be run with -Dusethreads.
3421
3422 Note that threading is a highly experimental feature, and
3423 some known race conditions still remain.  If you choose to try
3424 it, be very sure to not actually deploy it for production
3425 purposes.  README.threads has more details, and is required
3426 reading if you enable threads.
3427
3428 If this doesn't make any sense to you, just accept the default '$dflt'.
3429 EOM
3430 rp='Build a threading Perl?'
3431 . ./myread
3432 case "$ans" in
3433 y|Y)    val="$define" ;;
3434 *)      val="$undef" ;;
3435 esac
3436 set usethreads
3437 eval $setvar
3438
3439 case "$usethreads" in
3440 $define)
3441         $cat <<EOM
3442
3443 As of 5.5.640, Perl has two different internal threading implementations,
3444 the 5.005 version (5005threads) and an interpreter-based version
3445 (ithreads) that has one interpreter per thread.  Both are very 
3446 experimental.  This arrangement exists to help developers work out
3447 which one is better.
3448
3449 If you're a casual user, you probably don't want interpreter-threads
3450 at this time.  But if you do, the 'threads' module allows their use,
3451 and the 'Thread' module offers an interface to both 5005threads and
3452 ithreads (whichever has been configured).
3453 EOM
3454         : Default to ithreads unless overridden on command line or with
3455         : old config.sh
3456         dflt='y'
3457         case "$use5005threads" in
3458                 $define|true|[yY]*) dflt='n';;
3459         esac
3460         case "$useithreads" in
3461                 $undef|false|[nN]*) dflt='n';;
3462         esac
3463         rp='Use interpreter-based ithreads?'
3464         . ./myread
3465         case "$ans" in
3466         y|Y)    val="$define" ;;
3467         *)      val="$undef" ;;
3468         esac
3469         set useithreads
3470         eval $setvar
3471         : Now set use5005threads to the opposite value.
3472         case "$useithreads" in
3473         $define) val="$undef" ;;
3474         *) val="$define" ;;
3475         esac
3476         set use5005threads
3477         eval $setvar
3478         ;;
3479 *)
3480         useithreads="$undef"
3481         use5005threads="$undef"
3482         ;;
3483 esac
3484
3485 case "$useithreads$use5005threads" in
3486 "$define$define")
3487         $cat >&4 <<EOM
3488
3489 You cannot have both the ithreads and the 5.005 threads enabled
3490 at the same time.  Disabling the 5.005 threads since they are
3491 much less stable than the ithreads.
3492
3493 EOM
3494         use5005threads="$undef"
3495         ;;
3496 esac
3497
3498 case "$d_oldpthreads" in
3499 '')     : Configure tests would be welcome here.  For now, assume undef.
3500         val="$undef" ;;
3501 *)      val="$d_oldpthreads" ;;
3502 esac
3503 set d_oldpthreads
3504 eval $setvar
3505
3506
3507 case "$usethreads" in
3508 "$define"|true|[yY]*)
3509 : Look for a hint-file generated 'call-back-unit'.  If the
3510 : user has specified that a threading perl is to be built,
3511 : we may need to set or change some other defaults.
3512         if $test -f usethreads.cbu; then
3513                 echo "Your platform has some specific hints for threaded builds, using them..."
3514                 . ./usethreads.cbu
3515         else
3516                 $cat <<EOM
3517 (Your platform doesn't have any specific hints for threaded builds.
3518  Assuming POSIX threads, then.)
3519 EOM
3520         fi
3521         ;;
3522 esac
3523
3524 cat <<EOM
3525
3526 Perl can be built so that multiple Perl interpreters can coexist
3527 within the same Perl executable.
3528 EOM
3529
3530 case "$useithreads" in
3531 $define)
3532         cat <<EOM
3533 This multiple interpreter support is required for interpreter-based threads.
3534 EOM
3535         val="$define"
3536         ;;
3537 *)      case "$usemultiplicity" in
3538         $define|true|[yY]*)     dflt='y';;
3539         *) dflt='n';;
3540         esac
3541         echo " "
3542         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3543         rp='Build Perl for multiplicity?'
3544         . ./myread
3545         case "$ans" in
3546         y|Y)    val="$define" ;;
3547         *)      val="$undef" ;;
3548         esac
3549         ;;
3550 esac
3551 set usemultiplicity
3552 eval $setvar
3553
3554
3555 case "$usemorebits" in
3556 "$define"|true|[yY]*)
3557         use64bitint="$define"
3558         uselongdouble="$define"
3559         usemorebits="$define"
3560         ;;
3561 *)      usemorebits="$undef"
3562         ;;
3563 esac
3564
3565 : make some quick guesses about what we are up against
3566 echo " "
3567 $echo $n "Hmm...  $c"
3568 echo exit 1 >bsd
3569 echo exit 1 >usg
3570 echo exit 1 >v7
3571 echo exit 1 >osf1
3572 echo exit 1 >eunice
3573 echo exit 1 >xenix
3574 echo exit 1 >venix
3575 echo exit 1 >os2
3576 d_bsd="$undef"
3577 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3578 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3579 then
3580         echo "Looks kind of like an OSF/1 system, but we'll see..."
3581         echo exit 0 >osf1
3582 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3583         xxx=`./loc addbib blurfl $pth`
3584         if $test -f $xxx; then
3585         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3586                 echo exit 0 >bsd
3587                 echo exit 0 >usg
3588         else
3589                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3590                         echo "Looks kind of like an extended USG system, but we'll see..."
3591                 else
3592                         echo "Looks kind of like a USG system, but we'll see..."
3593                 fi
3594                 echo exit 0 >usg
3595         fi
3596 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3597         echo "Looks kind of like a BSD system, but we'll see..."
3598         d_bsd="$define"
3599         echo exit 0 >bsd
3600 else
3601         echo "Looks kind of like a Version 7 system, but we'll see..."
3602         echo exit 0 >v7
3603 fi
3604 case "$eunicefix" in
3605 *unixtovms*)
3606         $cat <<'EOI'
3607 There is, however, a strange, musty smell in the air that reminds me of
3608 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3609 EOI
3610         echo exit 0 >eunice
3611         d_eunice="$define"
3612 : it so happens the Eunice I know will not run shell scripts in Unix format
3613         ;;
3614 *)
3615         echo " "
3616         echo "Congratulations.  You aren't running Eunice."
3617         d_eunice="$undef"
3618         ;;
3619 esac
3620 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3621 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3622 : semicolon as a patch separator
3623 case "$p_" in
3624 :) ;;
3625 *)
3626         $cat <<'EOI'
3627 I have the feeling something is not exactly right, however...don't tell me...
3628 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3629 (Or you may be running DOS with DJGPP.)
3630 EOI
3631         echo exit 0 >os2
3632         ;;
3633 esac
3634 if test -f /xenix; then
3635         echo "Actually, this looks more like a XENIX system..."
3636         echo exit 0 >xenix
3637         d_xenix="$define"
3638 else
3639         echo " "
3640         echo "It's not Xenix..."
3641         d_xenix="$undef"
3642 fi
3643 chmod +x xenix
3644 $eunicefix xenix
3645 if test -f /venix; then
3646         echo "Actually, this looks more like a VENIX system..."
3647         echo exit 0 >venix
3648 else
3649         echo " "
3650         if ./xenix; then
3651                 : null
3652         else
3653                 echo "Nor is it Venix..."
3654         fi
3655 fi
3656 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3657 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3658 $rm -f foo
3659
3660 case "$cc" in
3661 '') dflt=cc;;
3662 *) dflt="$cc";;
3663 esac
3664 rp="Use which C compiler?"
3665 . ./myread
3666 cc="$ans"
3667
3668 : See if they have not cc but they do have gcc
3669 . ./trygcc
3670 : Look for a hint-file generated 'call-back-unit'.  Now that the
3671 : user has specified the compiler, we may need to set or change some
3672 : other defaults.
3673 if $test -f cc.cbu; then
3674     . ./cc.cbu
3675 fi
3676 . ./checkcc
3677
3678 echo " "
3679 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3680 $cat >try.c <<EOM
3681 #include <stdio.h>
3682 int main() {
3683 #ifdef __GNUC__
3684 #ifdef __VERSION__
3685         printf("%s\n", __VERSION__);
3686 #else
3687         printf("%s\n", "1");
3688 #endif
3689 #endif
3690         exit(0);
3691 }
3692 EOM
3693 if $cc -o try $ccflags $ldflags try.c; then
3694         gccversion=`$run ./try`
3695         case "$gccversion" in
3696         '') echo "You are not using GNU cc." ;;
3697         *)  echo "You are using GNU cc $gccversion."
3698             ccname=gcc  
3699             ;;
3700         esac
3701 else
3702         echo " "
3703         echo "*** WHOA THERE!!! ***" >&4
3704         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3705         case "$knowitall" in
3706         '')
3707         echo "    You'd better start hunting for one and let me know about it." >&4
3708                 exit 1
3709                 ;;
3710         esac
3711 fi
3712 $rm -f try try.*
3713 case "$gccversion" in
3714 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3715 esac
3716 case "$gccversion" in
3717 '') gccosandvers='' ;;
3718 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3719    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3720    gccshortvers=''
3721    case "$gccosandvers" in
3722    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3723    $osname$osvers) ;; # looking good
3724    $osname*) cat <<EOM >&4
3725
3726 *** WHOA THERE!!! ***
3727
3728     Your gcc has not been compiled for the exact release of
3729     your operating system ($gccosandvers versus $osname$osvers).
3730
3731     In general it is a good idea to keep gcc synchronized with
3732     the operating system because otherwise serious problems
3733     may ensue when trying to compile software, like Perl.
3734
3735     I'm trying to be optimistic here, though, and will continue.
3736     If later during the configuration and build icky compilation
3737     problems appear (headerfile conflicts being the most common
3738     manifestation), I suggest reinstalling the gcc to match
3739     your operating system release.
3740
3741 EOM
3742       ;;
3743    *) gccosandvers='' ;; # failed to parse, better be silent
3744    esac
3745    ;;
3746 esac
3747 case "$ccname" in
3748 '') ccname="$cc" ;;
3749 esac
3750
3751
3752 : decide how portable to be.  Allow command line overrides.
3753 case "$d_portable" in
3754 "$undef") ;;
3755 *)      d_portable="$define" ;;
3756 esac
3757
3758 : set up shell script to do ~ expansion
3759 cat >filexp <<EOSS
3760 $startsh
3761 : expand filename
3762 case "\$1" in
3763  ~/*|~)
3764         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3765         ;;
3766  ~*)
3767         if $test -f /bin/csh; then
3768                 /bin/csh -f -c "glob \$1"
3769                 failed=\$?
3770                 echo ""
3771                 exit \$failed
3772         else
3773                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3774                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3775                 if $test ! -d "\$dir"; then
3776                         me=\`basename \$0\`
3777                         echo "\$me: can't locate home directory for: \$name" >&2
3778                         exit 1
3779                 fi
3780                 case "\$1" in
3781                 */*)
3782                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3783                         ;;
3784                 *)
3785                         echo \$dir
3786                         ;;
3787                 esac
3788         fi
3789         ;;
3790 *)
3791         echo \$1
3792         ;;
3793 esac
3794 EOSS
3795 chmod +x filexp
3796 $eunicefix filexp
3797
3798 : now set up to get a file name
3799 cat <<EOS >getfile
3800 $startsh
3801 EOS
3802 cat <<'EOSC' >>getfile
3803 tilde=''
3804 fullpath=''
3805 already=''
3806 skip=''
3807 none_ok=''
3808 exp_file=''
3809 nopath_ok=''
3810 orig_rp="$rp"
3811 orig_dflt="$dflt"
3812 case "$gfpth" in
3813 '') gfpth='.' ;;
3814 esac
3815
3816 case "$fn" in
3817 *\(*)
3818         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3819         fn=`echo $fn | sed 's/(.*)//'`
3820         ;;
3821 esac
3822
3823 case "$fn" in
3824 *:*)
3825         loc_file=`expr $fn : '.*:\(.*\)'`
3826         fn=`expr $fn : '\(.*\):.*'`
3827         ;;
3828 esac
3829
3830 case "$fn" in
3831 *~*) tilde=true;;
3832 esac
3833 case "$fn" in
3834 */*) fullpath=true;;
3835 esac
3836 case "$fn" in
3837 *+*) skip=true;;
3838 esac
3839 case "$fn" in
3840 *n*) none_ok=true;;
3841 esac
3842 case "$fn" in
3843 *e*) exp_file=true;;
3844 esac
3845 case "$fn" in
3846 *p*) nopath_ok=true;;
3847 esac
3848
3849 case "$fn" in
3850 *f*) type='File';;
3851 *d*) type='Directory';;
3852 *l*) type='Locate';;
3853 esac
3854
3855 what="$type"
3856 case "$what" in
3857 Locate) what='File';;
3858 esac
3859
3860 case "$exp_file" in
3861 '')
3862         case "$d_portable" in
3863         "$define") ;;
3864         *) exp_file=true;;
3865         esac
3866         ;;
3867 esac
3868
3869 cd ..
3870 while test "$type"; do
3871         redo=''
3872         rp="$orig_rp"
3873         dflt="$orig_dflt"
3874         case "$tilde" in
3875         true) rp="$rp (~name ok)";;
3876         esac
3877         . UU/myread
3878         if test -f UU/getfile.ok && \
3879                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3880         then
3881                 value="$ans"
3882                 ansexp="$ans"
3883                 break
3884         fi
3885         case "$ans" in
3886         none)
3887                 value=''
3888                 ansexp=''
3889                 case "$none_ok" in
3890                 true) type='';;
3891                 esac
3892                 ;;
3893         *)
3894                 case "$tilde" in
3895                 '') value="$ans"
3896                         ansexp="$ans";;
3897                 *)
3898                         value=`UU/filexp $ans`
3899                         case $? in
3900                         0)
3901                                 if test "$ans" != "$value"; then
3902                                         echo "(That expands to $value on this system.)"
3903                                 fi
3904                                 ;;
3905                         *) value="$ans";;
3906                         esac
3907                         ansexp="$value"
3908                         case "$exp_file" in
3909                         '') value="$ans";;
3910                         esac
3911                         ;;
3912                 esac
3913                 case "$fullpath" in
3914                 true)
3915                         case "$ansexp" in
3916                         /*) value="$ansexp" ;;
3917                         [a-zA-Z]:/*) value="$ansexp" ;;
3918                         *)
3919                                 redo=true
3920                                 case "$already" in
3921                                 true)
3922                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3923                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3924                                         ;;
3925                                 *)
3926                                 echo "Please give a full path name, starting with slash." >&4
3927                                         case "$tilde" in
3928                                         true)
3929                                 echo "Note that using ~name is ok provided it expands well." >&4
3930                                                 already=true
3931                                                 ;;
3932                                         esac
3933                                 esac
3934                                 ;;
3935                         esac
3936                         ;;
3937                 esac
3938                 case "$redo" in
3939                 '')
3940                         case "$type" in
3941                         File)
3942                                 for fp in $gfpth; do
3943                                         if test "X$fp" = X.; then
3944                                             pf="$ansexp"
3945                                         else    
3946                                             pf="$fp/$ansexp"
3947                                         fi
3948                                         if test -f "$pf"; then
3949                                                 type=''
3950                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3951                                         then
3952                                                 echo "($value is not a plain file, but that's ok.)"
3953                                                 type=''
3954                                         fi
3955                                         if test X"$type" = X; then
3956                                             value="$pf"
3957                                             break
3958                                         fi
3959                                 done
3960                                 ;;
3961                         Directory)
3962                                 for fp in $gfpth; do
3963                                         if test "X$fp" = X.; then
3964                                             dir="$ans"
3965                                             direxp="$ansexp"
3966                                         else    
3967                                             dir="$fp/$ansexp"
3968                                             direxp="$fp/$ansexp"
3969                                         fi
3970                                         if test -d "$direxp"; then
3971                                                 type=''
3972                                                 value="$dir"
3973                                                 break
3974                                         fi
3975                                 done
3976                                 ;;
3977                         Locate)
3978                                 if test -d "$ansexp"; then
3979                                         echo "(Looking for $loc_file in directory $value.)"
3980                                         value="$value/$loc_file"
3981                                         ansexp="$ansexp/$loc_file"
3982                                 fi
3983                                 if test -f "$ansexp"; then
3984                                         type=''
3985                                 fi
3986                                 case "$nopath_ok" in
3987                                 true)   case "$value" in
3988                                         */*) ;;
3989                                         *)      echo "Assuming $value will be in people's path."
3990                                                 type=''
3991                                                 ;;
3992                                         esac
3993                                         ;;
3994                                 esac
3995                                 ;;
3996                         esac
3997
3998                         case "$skip" in
3999                         true) type='';
4000                         esac
4001
4002                         case "$type" in
4003                         '') ;;
4004                         *)
4005                                 if test "$fastread" = yes; then
4006                                         dflt=y
4007                                 else
4008                                         dflt=n
4009                                 fi
4010                                 rp="$what $value doesn't exist.  Use that name anyway?"
4011                                 . UU/myread
4012                                 dflt=''
4013                                 case "$ans" in
4014                                 y*) type='';;
4015                                 *) echo " ";;
4016                                 esac
4017                                 ;;
4018                         esac
4019                         ;;
4020                 esac
4021                 ;;
4022         esac
4023 done
4024 cd UU
4025 ans="$value"
4026 rp="$orig_rp"
4027 dflt="$orig_dflt"
4028 rm -f getfile.ok
4029 test "X$gfpthkeep" != Xy && gfpth=""
4030 EOSC
4031
4032 : What should the include directory be ?
4033 echo " "
4034 $echo $n "Hmm...  $c"
4035 dflt='/usr/include'
4036 incpath=''
4037 mips_type=''
4038 if $test -f /bin/mips && /bin/mips; then
4039         echo "Looks like a MIPS system..."
4040         $cat >usr.c <<'EOCP'
4041 #ifdef SYSTYPE_BSD43
4042 /bsd43
4043 #endif
4044 EOCP
4045         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4046                 dflt='/bsd43/usr/include'
4047                 incpath='/bsd43'
4048                 mips_type='BSD 4.3'
4049         else
4050                 mips_type='System V'
4051         fi
4052         $rm -f usr.c usr.out
4053         echo "and you're compiling with the $mips_type compiler and libraries."
4054         xxx_prompt=y
4055         echo "exit 0" >mips
4056 else
4057         echo "Doesn't look like a MIPS system."
4058         xxx_prompt=n
4059         echo "exit 1" >mips
4060 fi
4061 chmod +x mips
4062 $eunicefix mips
4063 case "$usrinc" in
4064 '') ;;
4065 *) dflt="$usrinc";;
4066 esac
4067 case "$xxx_prompt" in
4068 y)      fn=d/
4069         echo " "
4070         rp='Where are the include files you want to use?'
4071         . ./getfile
4072         usrinc="$ans"
4073         ;;
4074 *)      usrinc="$dflt"
4075         ;;
4076 esac
4077
4078 : see how we invoke the C preprocessor
4079 echo " "
4080 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4081 cat <<'EOT' >testcpp.c
4082 #define ABC abc
4083 #define XYZ xyz
4084 ABC.XYZ
4085 EOT
4086 cd ..
4087 if test ! -f cppstdin; then
4088         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4089                 # AIX cc -E doesn't show the absolute headerfile
4090                 # locations but we'll cheat by using the -M flag.
4091                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4092         else
4093                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4094         fi
4095 else
4096         echo "Keeping your $hint cppstdin wrapper."
4097 fi
4098 chmod 755 cppstdin
4099 wrapper=`pwd`/cppstdin
4100 ok='false'
4101 cd UU
4102
4103 if $test "X$cppstdin" != "X" && \
4104         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4105         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4106 then
4107         echo "You used to use $cppstdin $cppminus so we'll use that again."
4108         case "$cpprun" in
4109         '') echo "But let's see if we can live without a wrapper..." ;;
4110         *)
4111                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4112                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4113                 then
4114                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4115                         ok='true'
4116                 else
4117                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4118                 fi
4119                 ;;
4120         esac
4121 else
4122         case "$cppstdin" in
4123         '') ;;
4124         *)
4125                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4126                 ;;
4127         esac
4128 fi
4129
4130 if $ok; then
4131         : nothing
4132 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4133         $cc -E <testcpp.c >testcpp.out 2>&1; \
4134         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4135         echo "Yup, it does."
4136         x_cpp="$cc -E"
4137         x_minus='';
4138 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4139         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4140         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4141         echo "Yup, it does."
4142         x_cpp="$cc -E"
4143         x_minus='-';
4144 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4145         $cc -P <testcpp.c >testcpp.out 2>&1; \
4146         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4147         echo "Yipee, that works!"
4148         x_cpp="$cc -P"
4149         x_minus='';
4150 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4151         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4152         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4153         echo "At long last!"
4154         x_cpp="$cc -P"
4155         x_minus='-';
4156 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4157         $cpp <testcpp.c >testcpp.out 2>&1; \
4158         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4159         echo "It works!"
4160         x_cpp="$cpp"
4161         x_minus='';
4162 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4163         $cpp - <testcpp.c >testcpp.out 2>&1; \
4164         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4165         echo "Hooray, it works!  I was beginning to wonder."
4166         x_cpp="$cpp"
4167         x_minus='-';
4168 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4169         $wrapper <testcpp.c >testcpp.out 2>&1; \
4170         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4171         x_cpp="$wrapper"
4172         x_minus=''
4173         echo "Eureka!"
4174 else
4175         dflt=''
4176         rp="No dice.  I can't find a C preprocessor.  Name one:"
4177         . ./myread
4178         x_cpp="$ans"
4179         x_minus=''
4180         $x_cpp <testcpp.c >testcpp.out 2>&1
4181         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4182                 echo "OK, that will do." >&4
4183         else
4184 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4185                 exit 1
4186         fi
4187 fi
4188
4189 case "$ok" in
4190 false)
4191         cppstdin="$x_cpp"
4192         cppminus="$x_minus"
4193         cpprun="$x_cpp"
4194         cpplast="$x_minus"
4195         set X $x_cpp
4196         shift
4197         case "$1" in
4198         "$cpp")
4199                 echo "Perhaps can we force $cc -E using a wrapper..."
4200                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4201                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4202                 then
4203                         echo "Yup, we can."
4204                         cppstdin="$wrapper"
4205                         cppminus='';
4206                 else
4207                         echo "Nope, we'll have to live without it..."
4208                 fi
4209                 ;;
4210         esac
4211         case "$cpprun" in
4212         "$wrapper")
4213                 cpprun=''
4214                 cpplast=''
4215                 ;;
4216         esac
4217         ;;
4218 esac
4219
4220 case "$cppstdin" in
4221 "$wrapper"|'cppstdin') ;;
4222 *) $rm -f $wrapper;;
4223 esac
4224 $rm -f testcpp.c testcpp.out
4225
4226 : Set private lib path
4227 case "$plibpth" in
4228 '') if ./mips; then
4229                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4230         fi;;
4231 esac
4232 case "$libpth" in
4233 ' ') dlist='';;
4234 '') dlist="$loclibpth $plibpth $glibpth";;
4235 *) dlist="$libpth";;
4236 esac
4237
4238 : Now check and see which directories actually exist, avoiding duplicates
4239 libpth=''
4240 for xxx in $dlist
4241 do
4242     if $test -d $xxx; then
4243                 case " $libpth " in
4244                 *" $xxx "*) ;;
4245                 *) libpth="$libpth $xxx";;
4246                 esac
4247     fi
4248 done
4249 $cat <<'EOM'
4250
4251 Some systems have incompatible or broken versions of libraries.  Among
4252 the directories listed in the question below, please remove any you
4253 know not to be holding relevant libraries, and add any that are needed.
4254 Say "none" for none.
4255
4256 EOM
4257 case "$libpth" in
4258 '') dflt='none';;
4259 *)
4260         set X $libpth
4261         shift
4262         dflt=${1+"$@"}
4263         ;;
4264 esac
4265 rp="Directories to use for library searches?"
4266 . ./myread
4267 case "$ans" in
4268 none) libpth=' ';;
4269 *) libpth="$ans";;
4270 esac
4271
4272 : compute shared library extension
4273 case "$so" in
4274 '')
4275         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4276                 dflt='sl'
4277         else
4278                 dflt='so'
4279         fi
4280         ;;
4281 *) dflt="$so";;
4282 esac
4283 $cat <<EOM
4284
4285 On some systems, shared libraries may be available.  Answer 'none' if
4286 you want to suppress searching of shared libraries for the remainder
4287 of this configuration.
4288
4289 EOM
4290 rp='What is the file extension used for shared libraries?'
4291 . ./myread
4292 so="$ans"
4293
4294 : Define several unixisms.
4295 : Hints files or command line option can be used to override them.
4296 : The convoluted testing is in case hints files set either the old
4297 : or the new name.
4298 case "$_exe" in
4299 '')     case "$exe_ext" in
4300         '')     ;;
4301         *)      _exe="$exe_ext" ;;
4302         esac
4303         ;;
4304 esac
4305 case "$_a" in
4306 '')     case "$lib_ext" in
4307     '') _a='.a';;
4308         *)      _a="$lib_ext" ;;
4309         esac
4310         ;;
4311 esac
4312 case "$_o" in
4313 '') case "$obj_ext" in
4314         '')     _o='.o';;
4315         *)      _o="$obj_ext";;
4316         esac
4317         ;;
4318 esac
4319 case "$p_" in
4320 '') case "$path_sep" in
4321         '')     p_=':';;
4322         *)      p_="$path_sep";;
4323         esac
4324         ;;
4325 esac
4326 exe_ext=$_exe
4327 lib_ext=$_a
4328 obj_ext=$_o
4329 path_sep=$p_
4330
4331 : Which makefile gets called first.  This is used by make depend.
4332 case "$firstmakefile" in
4333 '') firstmakefile='makefile';;
4334 esac
4335
4336 case "$usesocks" in
4337 $define|true|[yY]*)     dflt='y';;
4338 *) dflt='n';;
4339 esac
4340 cat <<EOM
4341
4342 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4343 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4344 to use the PerlIO abstraction layer, this will be implicitly selected.
4345
4346 If this doesn't make any sense to you, just accept the default '$dflt'.
4347 EOM
4348 rp='Build Perl for SOCKS?'
4349 . ./myread
4350 case "$ans" in
4351 y|Y)    val="$define" ;;     
4352 *)      val="$undef" ;;
4353 esac
4354 set usesocks
4355 eval $setvar
4356
4357 case "$usesocks" in
4358 $define|true|[yY]*) useperlio="$define";;
4359 esac
4360
4361 : Looking for optional libraries
4362 echo " "
4363 echo "Checking for optional libraries..." >&4
4364 case "$libs" in
4365 ' '|'') dflt='';;
4366 *) dflt="$libs";;
4367 esac
4368 case "$libswanted" in
4369 '') libswanted='c_s';;
4370 esac
4371 case "$usesocks" in
4372 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4373 esac
4374 libsfound=''
4375 libsfiles=''
4376 libsdirs=''
4377 libspath=''
4378 for thisdir in $libpth $xlibpth; do
4379   test -d $thisdir && libspath="$libspath $thisdir"
4380 done
4381 for thislib in $libswanted; do
4382         for thisdir in $libspath; do
4383             xxx=''
4384             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4385                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4386                 $test -f "$xxx" && eval $libscheck
4387                 $test -f "$xxx" && libstyle=shared
4388             fi
4389             if test ! -f "$xxx"; then
4390                 xxx=$thisdir/lib$thislib.$so
4391                 $test -f "$xxx" && eval $libscheck
4392                 $test -f "$xxx" && libstyle=shared
4393             fi  
4394             if test ! -f "$xxx"; then
4395                 xxx=$thisdir/lib$thislib$_a
4396                 $test -f "$xxx" && eval $libscheck
4397                 $test -f "$xxx" && libstyle=static
4398             fi
4399             if test ! -f "$xxx"; then
4400                 xxx=$thisdir/$thislib$_a
4401                 $test -f "$xxx" && eval $libscheck
4402                 $test -f "$xxx" && libstyle=static
4403             fi
4404             if test ! -f "$xxx"; then
4405                 xxx=$thisdir/lib${thislib}_s$_a
4406                 $test -f "$xxx" && eval $libscheck
4407                 $test -f "$xxx" && libstyle=static
4408                 $test -f "$xxx" && thislib=${thislib}_s
4409             fi
4410             if test ! -f "$xxx"; then
4411                 xxx=$thisdir/Slib$thislib$_a
4412                 $test -f "$xxx" && eval $libscheck
4413                 $test -f "$xxx" && libstyle=static
4414             fi
4415             if $test -f "$xxx"; then
4416                 case "$libstyle" in
4417                 shared) echo "Found -l$thislib (shared)." ;;
4418                 static) echo "Found -l$thislib." ;;
4419                 *)      echo "Found -l$thislib ($libstyle)." ;;
4420                 esac
4421                 case " $dflt " in
4422                 *"-l$thislib "*);;
4423                 *) dflt="$dflt -l$thislib"
4424                    libsfound="$libsfound $xxx"
4425                    yyy=`basename $xxx`
4426                    libsfiles="$libsfiles $yyy"
4427                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4428                    case " $libsdirs " in
4429                    *" $yyy "*) ;;
4430                    *) libsdirs="$libsdirs $yyy" ;;
4431                    esac
4432                    ;;
4433                 esac
4434                 break
4435             fi  
4436         done
4437         if $test ! -f "$xxx"; then
4438             echo "No -l$thislib."
4439         fi
4440 done
4441 set X $dflt
4442 shift
4443 dflt="$*"
4444 case "$libs" in
4445 '') dflt="$dflt";;
4446 *) dflt="$libs";;
4447 esac
4448 case "$dflt" in
4449 ' '|'') dflt='none';;
4450 esac
4451
4452 $cat <<EOM
4453
4454 In order to compile $package on your machine, a number of libraries
4455 are usually needed.  Include any other special libraries here as well.
4456 Say "none" for none.  The default list is almost always right.
4457 EOM
4458
4459 echo " "
4460 rp="What libraries to use?"
4461 . ./myread
4462 case "$ans" in
4463 none) libs=' ';;
4464 *) libs="$ans";;
4465 esac
4466
4467 : determine optimization, if desired, or use for debug flag also
4468 case "$optimize" in
4469 ' '|$undef) dflt='none';;
4470 '') dflt='-O';;
4471 *) dflt="$optimize";;
4472 esac
4473 $cat <<EOH
4474
4475 By default, $package compiles with the -O flag to use the optimizer.
4476 Alternately, you might want to use the symbolic debugger, which uses
4477 the -g flag (on traditional Unix systems).  Either flag can be
4478 specified here.  To use neither flag, specify the word "none".
4479
4480 EOH
4481 rp="What optimizer/debugger flag should be used?"
4482 . ./myread
4483 optimize="$ans"
4484 case "$optimize" in
4485 'none') optimize=" ";;
4486 esac
4487
4488 dflt=''
4489 : We will not override a previous value, but we might want to
4490 : augment a hint file
4491 case "$hint" in
4492 default|recommended)
4493         case "$gccversion" in
4494         1*) dflt='-fpcc-struct-return' ;;
4495         esac
4496         case "$optimize" in
4497         *-g*) dflt="$dflt -DDEBUGGING";;
4498         esac
4499         case "$gccversion" in
4500         2*) if test -d /etc/conf/kconfig.d &&
4501                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4502                 then
4503                         dflt="$dflt -posix"
4504                 fi
4505                 ;;
4506         esac
4507         case "$gccversion" in
4508         1*) ;;
4509         2.[0-8]*) ;;
4510         ?*)     echo " "
4511                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4512                 echo 'int main(void) { return 0; }' > gcctest.c
4513                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4514                         echo "Yes, it does." 2>&1
4515                         case "$ccflags" in
4516                         *strict-aliasing*) 
4517                                 echo "Leaving current flags $ccflags alone." 2>&1
4518                                 ;;
4519                         *) dflt="$dflt -fno-strict-aliasing" ;;
4520                         esac
4521                 else
4522                         echo "Nope, it doesn't, but that's ok." 2>&1
4523                 fi
4524                 ;;
4525         esac
4526         ;;
4527 esac
4528
4529 case "$mips_type" in
4530 *BSD*|'') inclwanted="$locincpth $usrinc";;
4531 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4532 esac
4533 for thisincl in $inclwanted; do
4534         if $test -d $thisincl; then
4535                 if $test x$thisincl != x$usrinc; then
4536                         case "$dflt" in
4537                         *" -I$thisincl "*);;
4538                         *) dflt="$dflt -I$thisincl ";;
4539                         esac
4540                 fi
4541         fi
4542 done
4543
4544 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4545         xxx=true;
4546 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4547         xxx=true;
4548 else
4549         xxx=false;
4550 fi;
4551 if $xxx; then
4552         case "$dflt" in
4553         *$2*);;
4554         *) dflt="$dflt -D$2";;
4555         esac;
4556 fi'
4557
4558 set signal.h LANGUAGE_C; eval $inctest
4559
4560 case "$usesocks" in
4561 $define)
4562         ccflags="$ccflags -DSOCKS"
4563         ;;
4564 esac
4565
4566 case "$hint" in
4567 default|recommended) dflt="$ccflags $dflt" ;;
4568 *) dflt="$ccflags";;
4569 esac
4570
4571 case "$dflt" in
4572 ''|' ') dflt=none;;
4573 esac
4574
4575 $cat <<EOH
4576
4577 Your C compiler may want other flags.  For this question you should include
4578 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4579 but you should NOT include libraries or ld flags like -lwhatever.  If you
4580 want $package to honor its debug switch, you should include -DDEBUGGING here.
4581 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4582
4583 To use no flags, specify the word "none".
4584
4585 EOH
4586 set X $dflt
4587 shift
4588 dflt=${1+"$@"}
4589 rp="Any additional cc flags?"
4590 . ./myread
4591 case "$ans" in
4592 none) ccflags='';;
4593 *) ccflags="$ans";;
4594 esac
4595
4596 : the following weeds options from ccflags that are of no interest to cpp
4597 case "$cppflags" in
4598 '') cppflags="$ccflags" ;;
4599 *)  cppflags="$cppflags $ccflags" ;;
4600 esac
4601 case "$gccversion" in
4602 1*) cppflags="$cppflags -D__GNUC__"
4603 esac
4604 case "$mips_type" in
4605 '');;
4606 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4607 esac
4608 case "$cppflags" in
4609 '');;
4610 *)
4611         echo " "
4612         echo "Let me guess what the preprocessor flags are..." >&4
4613         set X $cppflags
4614         shift
4615         cppflags=''
4616         $cat >cpp.c <<'EOM'
4617 #define BLURFL foo
4618
4619 BLURFL xx LFRULB
4620 EOM
4621         previous=''
4622         for flag in $*
4623         do
4624                 case "$flag" in
4625                 -*) ftry="$flag";;
4626                 *) ftry="$previous $flag";;
4627                 esac
4628                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4629                         >cpp1.out 2>/dev/null && \
4630                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4631                         >cpp2.out 2>/dev/null && \
4632                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4633                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4634                 then
4635                         cppflags="$cppflags $ftry"
4636                         previous=''
4637                 else
4638                         previous="$flag"
4639                 fi
4640         done
4641         set X $cppflags
4642         shift
4643         cppflags=${1+"$@"}
4644         case "$cppflags" in
4645         *-*)  echo "They appear to be: $cppflags";;
4646         esac
4647         $rm -f cpp.c cpp?.out
4648         ;;
4649 esac
4650
4651 : flags used in final linking phase
4652 case "$ldflags" in
4653 '') if ./venix; then
4654                 dflt='-i -z'
4655         else
4656                 dflt=''
4657         fi
4658         case "$ccflags" in
4659         *-posix*) dflt="$dflt -posix" ;;
4660         esac
4661         ;;
4662 *) dflt="$ldflags";;
4663 esac
4664
4665 : Try to guess additional flags to pick up local libraries.
4666 for thislibdir in $libpth; do
4667         case " $loclibpth " in
4668         *" $thislibdir "*)
4669                 case "$dflt " in 
4670                 *"-L$thislibdir "*) ;;
4671                 *)  dflt="$dflt -L$thislibdir" ;;
4672                 esac
4673                 ;;
4674         esac
4675 done
4676
4677 case "$dflt" in
4678 '') dflt='none' ;;
4679 esac
4680
4681 $cat <<EOH
4682
4683 Your C linker may need flags.  For this question you should
4684 include -L/whatever and any other flags used by the C linker, but you
4685 should NOT include libraries like -lwhatever.
4686
4687 Make sure you include the appropriate -L/path flags if your C linker
4688 does not normally search all of the directories you specified above,
4689 namely
4690         $libpth
4691 To use no flags, specify the word "none".
4692
4693 EOH
4694
4695 rp="Any additional ld flags (NOT including libraries)?"
4696 . ./myread
4697 case "$ans" in
4698 none) ldflags='';;
4699 *) ldflags="$ans";;
4700 esac
4701 rmlist="$rmlist pdp11"
4702
4703 : coherency check
4704 echo " "
4705 echo "Checking your choice of C compiler and flags for coherency..." >&4
4706 $cat > try.c <<'EOF'
4707 #include <stdio.h>
4708 int main() { printf("Ok\n"); exit(0); }
4709 EOF
4710 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4711 shift
4712 $cat >try.msg <<'EOM'
4713 I've tried to compile and run the following simple program:
4714
4715 EOM
4716 $cat try.c >> try.msg
4717
4718 $cat >> try.msg <<EOM
4719
4720 I used the command:
4721
4722         $*
4723         $run ./try
4724
4725 and I got the following output:
4726
4727 EOM
4728 dflt=y
4729 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4730         if $sh -c "$run ./try" >>try.msg 2>&1; then
4731                 xxx=`$run ./try`
4732                 case "$xxx" in
4733                 "Ok") dflt=n ;;
4734                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4735                         case " $libs " in
4736                         *" -lsfio "*)
4737                                 cat >> try.msg <<'EOQS'
4738 If $libs contains -lsfio, and sfio is mis-configured, then it
4739 sometimes (apparently) runs and exits with a 0 status, but with no
4740 output!  It may have to do with sfio's use of _exit vs. exit.
4741
4742 EOQS
4743                                 rp="You have a big problem.  Shall I abort Configure"
4744                                 dflt=y
4745                                 ;;
4746                         esac
4747                         ;;
4748                 esac
4749         else
4750                 echo "The program compiled OK, but exited with status $?." >>try.msg
4751                 rp="You have a problem.  Shall I abort Configure"
4752                 dflt=y
4753         fi
4754 else
4755         echo "I can't compile the test program." >>try.msg
4756         rp="You have a BIG problem.  Shall I abort Configure"
4757         dflt=y
4758 fi
4759 case "$dflt" in
4760 y)
4761         $cat try.msg >&4
4762         case "$knowitall" in
4763         '')
4764                 echo "(The supplied flags or libraries might be incorrect.)"
4765                 ;;
4766         *) dflt=n;;
4767         esac
4768         echo " "
4769         . ./myread
4770         case "$ans" in
4771         n*|N*) ;;
4772         *)      echo "Ok.  Stopping Configure." >&4
4773                 exit 1
4774                 ;;
4775         esac
4776         ;;
4777 n) echo "OK, that should do.";;
4778 esac
4779 $rm -f try try.* core
4780
4781 : define a shorthand compile call
4782 compile='
4783 mc_file=$1;
4784 shift;
4785 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4786 : define a shorthand compile call for compilations that should be ok.
4787 compile_ok='
4788 mc_file=$1;
4789 shift;
4790 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4791
4792 : check for lengths of integral types
4793 echo " "
4794 case "$intsize" in
4795 '')
4796         echo "Checking to see how big your integers are..." >&4
4797         $cat >try.c <<'EOCP'
4798 #include <stdio.h>
4799 int main()
4800 {
4801         printf("intsize=%d;\n", (int)sizeof(int));
4802         printf("longsize=%d;\n", (int)sizeof(long));
4803         printf("shortsize=%d;\n", (int)sizeof(short));
4804         exit(0);
4805 }
4806 EOCP
4807         set try
4808         if eval $compile_ok && $run ./try > /dev/null; then
4809                 eval `$run ./try`
4810                 echo "Your integers are $intsize bytes long."
4811                 echo "Your long integers are $longsize bytes long."
4812                 echo "Your short integers are $shortsize bytes long."
4813         else
4814                 $cat >&4 <<EOM
4815 !
4816 Help! I can't compile and run the intsize test program: please enlighten me!
4817 (This is probably a misconfiguration in your system or libraries, and
4818 you really ought to fix it.  Still, I'll try anyway.)
4819 !
4820 EOM
4821                 dflt=4
4822                 rp="What is the size of an integer (in bytes)?"
4823                 . ./myread
4824                 intsize="$ans"
4825                 dflt=$intsize
4826                 rp="What is the size of a long integer (in bytes)?"
4827                 . ./myread
4828                 longsize="$ans"
4829                 dflt=2
4830                 rp="What is the size of a short integer (in bytes)?"
4831                 . ./myread
4832                 shortsize="$ans"
4833         fi
4834         ;;
4835 esac
4836 $rm -f try try.*
4837
4838 : check for void type
4839 echo " "
4840 echo "Checking to see how well your C compiler groks the void type..." >&4
4841 case "$voidflags" in
4842 '')
4843         $cat >try.c <<'EOCP'
4844 #if TRY & 1
4845 void sub() {
4846 #else
4847 sub() {
4848 #endif
4849         extern void moo();      /* function returning void */
4850         void (*goo)();          /* ptr to func returning void */
4851 #if TRY & 8
4852         void *hue;              /* generic ptr */
4853 #endif
4854 #if TRY & 2
4855         void (*foo[10])();
4856 #endif
4857
4858 #if TRY & 4
4859         if(goo == moo) {
4860                 exit(0);
4861         }
4862 #endif
4863         exit(0);
4864 }
4865 int main() { sub(); }
4866 EOCP
4867         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4868                 voidflags=$defvoidused
4869         echo "Good.  It appears to support void to the level $package wants.">&4
4870                 if $contains warning .out >/dev/null 2>&1; then
4871                         echo "However, you might get some warnings that look like this:"
4872                         $cat .out
4873                 fi
4874         else
4875 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4876                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4877                         echo "It supports 1..."
4878                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4879                                 echo "It also supports 2..."
4880                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4881                                         voidflags=7
4882                                         echo "And it supports 4 but not 8 definitely."
4883                                 else
4884                                         echo "It doesn't support 4..."
4885                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4886                                                 voidflags=11
4887                                                 echo "But it supports 8."
4888                                         else
4889                                                 voidflags=3
4890                                                 echo "Neither does it support 8."
4891                                         fi
4892                                 fi
4893                         else
4894                                 echo "It does not support 2..."
4895                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4896                                         voidflags=13
4897                                         echo "But it supports 4 and 8."
4898                                 else
4899                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4900                                                 voidflags=5
4901                                                 echo "And it supports 4 but has not heard about 8."
4902                                         else
4903                                                 echo "However it supports 8 but not 4."
4904                                         fi
4905                                 fi
4906                         fi
4907                 else
4908                         echo "There is no support at all for void."
4909                         voidflags=0
4910                 fi
4911         fi
4912 esac
4913 case "$voidflags" in
4914 "$defvoidused") ;;
4915 *)      $cat >&4 <<'EOM'
4916   Support flag bits are:
4917     1: basic void declarations.
4918     2: arrays of pointers to functions returning void.
4919     4: operations between pointers to and addresses of void functions.
4920     8: generic void pointers.
4921 EOM
4922         dflt="$voidflags";
4923         rp="Your void support flags add up to what?"
4924         . ./myread
4925         voidflags="$ans"
4926         ;;
4927 esac
4928 $rm -f try.* .out
4929
4930 : check for length of pointer
4931 echo " "
4932 case "$ptrsize" in
4933 '')
4934         echo "Checking to see how big your pointers are..." >&4
4935         if test "$voidflags" -gt 7; then
4936                 echo '#define VOID_PTR char *' > try.c
4937         else
4938                 echo '#define VOID_PTR void *' > try.c
4939         fi
4940         $cat >>try.c <<'EOCP'
4941 #include <stdio.h>
4942 int main()
4943 {
4944     printf("%d\n", (int)sizeof(VOID_PTR));
4945     exit(0);
4946 }
4947 EOCP
4948         set try
4949         if eval $compile_ok; then
4950                 ptrsize=`$run ./try`
4951                 echo "Your pointers are $ptrsize bytes long."
4952         else
4953                 dflt='4'
4954                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4955                 rp="What is the size of a pointer (in bytes)?"
4956                 . ./myread
4957                 ptrsize="$ans"
4958         fi
4959         ;;
4960 esac
4961 $rm -f try.c try
4962
4963 : check for long long
4964 echo " "
4965 echo "Checking to see if you have long long..." >&4
4966 echo 'int main() { long long x = 7; return 0; }' > try.c
4967 set try
4968 if eval $compile; then
4969         val="$define"
4970         echo "You have long long."
4971 else
4972         val="$undef"
4973         echo "You do not have long long."
4974 fi
4975 $rm try.*
4976 set d_longlong
4977 eval $setvar
4978
4979 : check for length of long long
4980 case "${d_longlong}${longlongsize}" in
4981 $define)
4982         echo " "
4983         echo "Checking to see how big your long longs are..." >&4
4984         $cat >try.c <<'EOCP'
4985 #include <stdio.h>
4986 int main()
4987 {
4988     printf("%d\n", (int)sizeof(long long));
4989     return(0);
4990 }
4991 EOCP
4992         set try
4993         if eval $compile_ok; then
4994                 longlongsize=`$run ./try`
4995                 echo "Your long longs are $longlongsize bytes long."
4996         else
4997                 dflt='8'
4998                 echo " "
4999                 echo "(I can't seem to compile the test program.  Guessing...)"
5000                 rp="What is the size of a long long (in bytes)?"
5001                 . ./myread
5002                 longlongsize="$ans"
5003         fi
5004         if $test "X$longsize" = "X$longlongsize"; then
5005                 echo "(That isn't any different from an ordinary long.)"
5006         fi      
5007         ;;
5008 esac
5009 $rm -f try.* try
5010
5011 : determine filename position in cpp output
5012 echo " "
5013 echo "Computing filename position in cpp output for #include directives..." >&4
5014 case "$osname" in
5015 vos) testaccess=-e ;;
5016 *)   testaccess=-r ;;
5017 esac
5018 echo '#include <stdio.h>' > foo.c
5019 $cat >fieldn <<EOF
5020 $startsh
5021 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5022 $grep '^[       ]*#.*stdio\.h' | \
5023 while read cline; do
5024         pos=1
5025         set \$cline
5026         while $test \$# -gt 0; do
5027                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5028                         echo "\$pos"
5029                         exit 0
5030                 fi
5031                 shift
5032                 pos=\`expr \$pos + 1\`
5033         done
5034 done
5035 EOF
5036 chmod +x fieldn
5037 fieldn=`./fieldn`
5038 $rm -f foo.c fieldn
5039 case $fieldn in
5040 '') pos='???';;
5041 1) pos=first;;
5042 2) pos=second;;
5043 3) pos=third;;
5044 *) pos="${fieldn}th";;
5045 esac
5046 echo "Your cpp writes the filename in the $pos field of the line."
5047
5048 case "$osname" in
5049 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5050 *)   cppfilter='' ;;
5051 esac
5052 : locate header file
5053 $cat >findhdr <<EOF
5054 $startsh
5055 wanted=\$1
5056 name=''
5057 for usrincdir in $usrinc
5058 do
5059         if test -f \$usrincdir/\$wanted; then
5060                 echo "\$usrincdir/\$wanted"
5061                 exit 0
5062         fi
5063 done
5064 awkprg='{ print \$$fieldn }'
5065 echo "#include <\$wanted>" > foo\$\$.c
5066 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5067 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5068 while read cline; do
5069         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5070         case "\$name" in
5071         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5072         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5073         *) exit 2;;
5074         esac;
5075 done;
5076 #
5077 # status = 0: grep returned 0 lines, case statement not executed
5078 # status = 1: headerfile found
5079 # status = 2: while loop executed, no headerfile found
5080 #
5081 status=\$?
5082 $rm -f foo\$\$.c;
5083 if test \$status -eq 1; then
5084         exit 0;
5085 fi
5086 exit 1
5087 EOF
5088 chmod +x findhdr
5089
5090 : define an alternate in-header-list? function
5091 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5092 cont=true; xxf="echo \"<\$1> found.\" >&4";
5093 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5094 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5095 esac;
5096 case $# in 4) instead=instead;; *) instead="at last";; esac;
5097 while $test "$cont"; do
5098         xxx=`./findhdr $1`
5099         var=$2; eval "was=\$$2";
5100         if $test "$xxx" && $test -r "$xxx";
5101         then eval $xxf;
5102         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5103                 cont="";
5104         else eval $xxnf;
5105         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5106         set $yyy; shift; shift; yyy=$@;
5107         case $# in 0) cont="";;
5108         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5109                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5110         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5111                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5112         esac;
5113 done;
5114 while $test "$yyy";
5115 do set $yyy; var=$2; eval "was=\$$2";
5116         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5117         set $yyy; shift; shift; yyy=$@;
5118 done'
5119
5120 : see if inttypes.h is available
5121 : we want a real compile instead of Inhdr because some systems
5122 : have an inttypes.h which includes non-existent headers
5123 echo " "
5124 $cat >try.c <<EOCP
5125 #include <inttypes.h>
5126 int main() {
5127         static int32_t foo32 = 0x12345678;
5128 }
5129 EOCP
5130 set try
5131 if eval $compile; then
5132         echo "<inttypes.h> found." >&4
5133         val="$define"
5134 else
5135         echo "<inttypes.h> NOT found." >&4
5136         val="$undef"
5137 fi
5138 $rm -f try.c try
5139 set i_inttypes
5140 eval $setvar
5141
5142 : check for int64_t
5143 echo " "
5144 echo "Checking to see if you have int64_t..." >&4
5145 $cat >try.c <<EOCP
5146 #include <sys/types.h>
5147 #$i_inttypes I_INTTYPES
5148 #ifdef I_INTTYPES
5149 #include <inttypes.h>
5150 #endif
5151 int main() { int64_t x = 7; }
5152 EOCP
5153 set try
5154 if eval $compile; then
5155         val="$define"
5156         echo "You have int64_t."
5157 else
5158         val="$undef"
5159         echo "You do not have int64_t."
5160 fi
5161 $rm -f try try.*
5162 set d_int64_t
5163 eval $setvar
5164
5165
5166 echo " "
5167 echo "Checking which 64-bit integer type we could use..." >&4
5168
5169 case "$intsize" in
5170 8) val=int
5171    set quadtype
5172    eval $setvar
5173    val='"unsigned int"'
5174    set uquadtype
5175    eval $setvar
5176    quadkind=1
5177    ;;
5178 *) case "$longsize" in
5179    8) val=long
5180       set quadtype
5181       eval $setvar
5182       val='"unsigned long"'
5183       set uquadtype
5184       eval $setvar
5185       quadkind=2
5186       ;;
5187    *) case "$d_longlong:$longlongsize" in
5188       define:8)
5189         val='"long long"'
5190         set quadtype
5191         eval $setvar
5192         val='"unsigned long long"'
5193         set uquadtype
5194         eval $setvar
5195         quadkind=3
5196         ;;
5197       *) case "$d_int64_t" in
5198          define)
5199            val=int64_t
5200            set quadtype
5201            eval $setvar
5202            val=uint64_t
5203            set uquadtype
5204            eval $setvar
5205            quadkind=4
5206            ;;
5207          esac
5208          ;;
5209       esac
5210       ;;
5211    esac
5212    ;;
5213 esac
5214
5215 case "$quadtype" in
5216 '')     echo "Alas, no 64-bit integer types in sight." >&4
5217         d_quad="$undef"
5218         ;;
5219 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5220         d_quad="$define"
5221         ;;
5222 esac
5223
5224
5225 case "$uselonglong" in
5226 "$define"|true|[yY]*)
5227         cat <<EOM >&4
5228
5229 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5230 EOM
5231         use64bitint="$define"
5232         ;;
5233 esac                          
5234 case "$use64bits" in
5235 "$define"|true|[yY]*)
5236         cat <<EOM >&4
5237
5238 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5239 EOM
5240         use64bitint="$define"
5241         ;;
5242 esac                          
5243 case "$use64bitints" in
5244 "$define"|true|[yY]*)
5245         cat <<EOM >&4
5246
5247 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5248 EOM
5249         use64bitint="$define"
5250         ;;
5251 esac                          
5252 case "$use64bitsint" in
5253 "$define"|true|[yY]*)
5254         cat <<EOM >&4
5255
5256 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5257 EOM
5258         use64bitint="$define"
5259         ;;
5260 esac                          
5261 case "$uselonglongs" in
5262 "$define"|true|[yY]*)
5263         cat <<EOM >&4
5264
5265 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5266 EOM
5267         use64bitint="$define"
5268         ;;
5269 esac                          
5270 case "$use64bitsall" in
5271 "$define"|true|[yY]*)
5272         cat <<EOM >&4
5273
5274 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5275 EOM
5276         use64bitall="$define"
5277         ;;
5278 esac                          
5279
5280 case "$ccflags" in
5281 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5282 esac
5283 case "$use64bitall" in
5284 "$define"|true|[yY]*) use64bitint="$define" ;;
5285 esac
5286
5287 case "$longsize" in
5288 8) cat <<EOM
5289
5290 You have natively 64-bit long integers.
5291 EOM
5292    val="$define"
5293    ;;
5294 *) case "$use64bitint" in
5295    "$define"|true|[yY]*) dflt='y';;
5296    *) dflt='n';;
5297    esac
5298    case "$d_quad" in
5299    "$define") ;;
5300    *) dflt='n' ;;
5301    esac
5302    cat <<EOM
5303
5304 Perl can be built to take advantage of 64-bit integer types
5305 on some systems.  To do so, Configure can be run with -Duse64bitint.
5306 Choosing this option will most probably introduce binary incompatibilities.
5307
5308 If this doesn't make any sense to you, just accept the default '$dflt'.
5309 (The default has been chosen based on your configuration.)
5310 EOM
5311    rp='Try to use 64-bit integers, if available?'
5312    . ./myread
5313    case "$ans" in
5314    [yY]*) val="$define" ;;
5315    *)     val="$undef"  ;;
5316    esac
5317    ;;
5318 esac
5319 set use64bitint
5320 eval $setvar
5321
5322 case "$use64bitall" in
5323 "$define"|true|[yY]*) dflt='y' ;;
5324 *) case "$longsize" in
5325    8) dflt='y' ;;
5326    *) dflt='n' ;;
5327    esac
5328    ;;
5329 esac    
5330 cat <<EOM
5331
5332 You may also choose to try maximal 64-bitness.  It means using as much
5333 64-bitness as possible on the platform.  This in turn means even more
5334 binary incompatibilities.  On the other hand, your platform may not
5335 have any more 64-bitness available than what you already have chosen.
5336
5337 If this doesn't make any sense to you, just accept the default '$dflt'.
5338 (The default has been chosen based on your configuration.)
5339 EOM
5340 rp='Try to use maximal 64-bit support, if available?'
5341 . ./myread
5342 case "$ans" in
5343 [yY]*) val="$define" ;;
5344 *)     val="$undef"  ;;
5345 esac
5346 set use64bitall
5347 eval $setvar
5348 case "$use64bitall" in
5349 "$define")
5350         case "$use64bitint" in
5351         "$undef")
5352                 cat <<EOM
5353
5354 Since you have chosen a maximally 64-bit build, I'm also turning on
5355 the use of 64-bit integers.
5356 EOM
5357                 use64bitint="$define" ;;
5358         esac
5359         ;;
5360 esac
5361
5362 case "$use64bitall" in
5363 "$define"|true|[yY]*)
5364         case "$ptrsize" in
5365         4)      cat <<EOM >&4
5366
5367 *** You have chosen a maximally 64-bit build, but your pointers
5368 *** are only 4 bytes wide, disabling maximal 64-bitness.
5369
5370 EOM
5371                 use64bitall="$undef"
5372                 case "$use64bitint" in
5373                 "$define"|true|[yY]*) ;;
5374                 *)      cat <<EOM >&4
5375
5376 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5377
5378 EOM
5379                         use64bitint="$define"
5380                         ;;
5381                 esac
5382                 ;;
5383         esac
5384         ;;
5385 esac
5386
5387 case "$use64bitint" in
5388 "$define"|true|[yY]*)
5389 : Look for a hint-file generated 'call-back-unit'.  If the
5390 : user has specified that a 64-bit perl is to be built,
5391 : we may need to set or change some other defaults.
5392         if $test -f use64bitint.cbu; then
5393                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5394                 . ./use64bitint.cbu
5395         fi
5396         case "$longsize" in
5397         4) case "$archname64" in
5398            '') archname64=64int ;;
5399            esac
5400            ;;
5401         esac
5402         ;;
5403 esac
5404
5405 case "$use64bitall" in
5406 "$define"|true|[yY]*)
5407 : Look for a hint-file generated 'call-back-unit'.  If the
5408 : user has specified that a maximally 64-bit perl is to be built,
5409 : we may need to set or change some other defaults.
5410         if $test -f use64bitall.cbu; then
5411                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5412                 . ./use64bitall.cbu
5413         fi
5414         case "$longsize" in
5415         4) case "$archname64" in
5416            ''|64int) archname64=64all ;;
5417            esac
5418            ;;
5419         esac
5420         ;;
5421 esac
5422
5423 echo " "
5424 echo "Checking for GNU C Library..." >&4
5425 cat >try.c <<EOM
5426 #include <stdio.h>
5427 int main()
5428 {
5429 #ifdef __GLIBC__
5430     exit(0);
5431 #else
5432     exit(1);
5433 #endif
5434 }
5435 EOM
5436 set try
5437 if eval $compile_ok && $run ./try; then
5438         val="$define"
5439         echo "You are using the GNU C Library"
5440 else
5441         val="$undef"
5442         echo "You are not using the GNU C Library"
5443 fi
5444 $rm -f try try.*
5445 set d_gnulibc
5446 eval $setvar
5447
5448 : see if nm is to be used to determine whether a symbol is defined or not
5449 case "$usenm" in
5450 '')
5451         dflt=''
5452         case "$d_gnulibc" in
5453         "$define")
5454                 echo " "
5455                 echo "nm probably won't work on the GNU C Library." >&4
5456                 dflt=n
5457                 ;;
5458         esac
5459         case "$dflt" in
5460         '') 
5461                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5462                         echo " "
5463                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5464                         echo "'nm' won't be sufficient on this sytem." >&4
5465                         dflt=n
5466                 fi
5467                 ;;
5468         esac
5469         case "$dflt" in
5470         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5471                 if $test $dflt -gt 20; then
5472                         dflt=y
5473                 else
5474                         dflt=n
5475                 fi
5476                 ;;
5477         esac
5478         ;;
5479 *)
5480         case "$usenm" in
5481         true|$define) dflt=y;;
5482         *) dflt=n;;
5483         esac
5484         ;;
5485 esac
5486 $cat <<EOM
5487
5488 I can use $nm to extract the symbols from your C libraries. This
5489 is a time consuming task which may generate huge output on the disk (up
5490 to 3 megabytes) but that should make the symbols extraction faster. The
5491 alternative is to skip the 'nm' extraction part and to compile a small
5492 test program instead to determine whether each symbol is present. If
5493 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5494 this may be the best solution.
5495
5496 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5497
5498 EOM
5499 rp="Shall I use $nm to extract C symbols from the libraries?"
5500 . ./myread
5501 case "$ans" in
5502 [Nn]*) usenm=false;;
5503 *) usenm=true;;
5504 esac
5505
5506 runnm=$usenm
5507 case "$reuseval" in
5508 true) runnm=false;;
5509 esac
5510
5511 : nm options which may be necessary
5512 case "$nm_opt" in
5513 '') if $test -f /mach_boot; then
5514                 nm_opt=''       # Mach
5515         elif $test -d /usr/ccs/lib; then
5516                 nm_opt='-p'     # Solaris (and SunOS?)
5517         elif $test -f /dgux; then
5518                 nm_opt='-p'     # DG-UX
5519         elif $test -f /lib64/rld; then
5520                 nm_opt='-p'     # 64-bit Irix
5521         else
5522                 nm_opt=''
5523         fi;;
5524 esac
5525
5526 : nm options which may be necessary for shared libraries but illegal
5527 : for archive libraries.  Thank you, Linux.
5528 case "$nm_so_opt" in
5529 '')     case "$myuname" in
5530         *linux*)
5531                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5532                         nm_so_opt='--dynamic'
5533                 fi
5534                 ;;
5535         esac
5536         ;;
5537 esac
5538
5539 case "$runnm" in
5540 true)
5541 : get list of predefined functions in a handy place
5542 echo " "
5543 case "$libc" in
5544 '') libc=unknown
5545         case "$libs" in
5546         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5547         esac
5548         ;;
5549 esac
5550 case "$libs" in
5551 '') ;;
5552 *)  for thislib in $libs; do
5553         case "$thislib" in
5554         -lc|-lc_s)
5555                 : Handle C library specially below.
5556                 ;;
5557         -l*)
5558                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5559                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5560                         :
5561                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5562                         :
5563                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5564                         :
5565                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5566                         :
5567                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5568                         :
5569                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5570                         :
5571                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5572                         :
5573                 else
5574                         try=''
5575                 fi
5576                 libnames="$libnames $try"
5577                 ;;
5578         *) libnames="$libnames $thislib" ;;
5579         esac
5580         done
5581         ;;
5582 esac
5583 xxx=normal
5584 case "$libc" in
5585 unknown)
5586         set /lib/libc.$so
5587         for xxx in $libpth; do
5588                 $test -r $1 || set $xxx/libc.$so
5589                 : The messy sed command sorts on library version numbers.
5590                 $test -r $1 || \
5591                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5592                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5593                                 h
5594                                 s/[0-9][0-9]*/0000&/g
5595                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5596                                 G
5597                                 s/\n/ /' | \
5598                          $sort | $sed -e 's/^.* //'`
5599                 eval set \$$#
5600         done
5601         $test -r $1 || set /usr/ccs/lib/libc.$so
5602         $test -r $1 || set /lib/libsys_s$_a
5603         ;;
5604 *)
5605         set blurfl
5606         ;;
5607 esac
5608 if $test -r "$1"; then
5609         echo "Your (shared) C library seems to be in $1."
5610         libc="$1"
5611 elif $test -r /lib/libc && $test -r /lib/clib; then
5612         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5613         xxx=apollo
5614         libc='/lib/clib /lib/libc'
5615         if $test -r /lib/syslib; then
5616                 echo "(Your math library is in /lib/syslib.)"
5617                 libc="$libc /lib/syslib"
5618         fi
5619 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5620         echo "Your C library seems to be in $libc, as you said before."
5621 elif $test -r $incpath/usr/lib/libc$_a; then
5622         libc=$incpath/usr/lib/libc$_a;
5623         echo "Your C library seems to be in $libc.  That's fine."
5624 elif $test -r /lib/libc$_a; then
5625         libc=/lib/libc$_a;
5626         echo "Your C library seems to be in $libc.  You're normal."
5627 else
5628         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5629                 :
5630         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5631                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5632         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5633                 :
5634         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5635                 :
5636         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5637                 :
5638         else
5639                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5640         fi
5641         if $test -r "$tans"; then
5642                 echo "Your C library seems to be in $tans, of all places."
5643                 libc=$tans
5644         else
5645                 libc='blurfl'
5646         fi
5647 fi
5648 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5649         dflt="$libc"
5650         cat <<EOM
5651
5652 If the guess above is wrong (which it might be if you're using a strange
5653 compiler, or your machine supports multiple models), you can override it here.
5654
5655 EOM
5656 else
5657         dflt=''
5658         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5659         cat >&4 <<EOM
5660 I can't seem to find your C library.  I've looked in the following places:
5661
5662 EOM
5663         $sed 's/^/      /' libpath
5664         cat <<EOM
5665
5666 None of these seems to contain your C library. I need to get its name...
5667
5668 EOM
5669 fi
5670 fn=f
5671 rp='Where is your C library?'
5672 . ./getfile
5673 libc="$ans"
5674
5675 echo " "
5676 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5677 set X `cat libnames`
5678 shift
5679 xxx=files
5680 case $# in 1) xxx=file; esac
5681 echo "Extracting names from the following $xxx for later perusal:" >&4
5682 echo " "
5683 $sed 's/^/      /' libnames >&4
5684 echo " "
5685 $echo $n "This may take a while...$c" >&4
5686
5687 for file in $*; do
5688         case $file in
5689         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5690         *) $nm $nm_opt $file 2>/dev/null;;
5691         esac
5692 done >libc.tmp
5693
5694 $echo $n ".$c"
5695 $grep fprintf libc.tmp > libc.ptf
5696 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5697 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5698 xxx='[ADTSIW]'
5699 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5700         eval $xscan;\
5701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5702                 eval $xrun
5703 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5704         eval $xscan;\
5705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706                 eval $xrun
5707 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5708         eval $xscan;\
5709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710                 eval $xrun
5711 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5724                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 else
5757         $nm -p $* 2>/dev/null >libc.tmp
5758         $grep fprintf libc.tmp > libc.ptf
5759         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5760                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5761         then
5762                 nm_opt='-p'
5763                 eval $xrun
5764         else
5765                 echo " "
5766                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5767                 com=''
5768                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5769                         for thisname in $libnames $libc; do
5770                                 $ar t $thisname >>libc.tmp
5771                         done
5772                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5773                         echo "Ok." >&4
5774                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5775                         # Repeat libc to extract forwarders to DLL entries too
5776                         for thisname in $libnames $libc; do
5777                                 $ar tv $thisname >>libc.tmp
5778                                 # Revision 50 of EMX has bug in $ar.
5779                                 # it will not extract forwarders to DLL entries
5780                                 # Use emximp which will extract exactly them.
5781                                 emximp -o tmp.imp $thisname \
5782                                     2>/dev/null && \
5783                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5784                                     < tmp.imp >>libc.tmp
5785                                 $rm tmp.imp
5786                         done
5787                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5788                         echo "Ok." >&4
5789                 else
5790                         echo "$ar didn't seem to work right." >&4
5791                         echo "Maybe this is a Cray...trying bld instead..." >&4
5792                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5793                         then
5794                                 for thisname in $libnames; do
5795                                         bld t $libnames | \
5796                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5797                                         $ar t $thisname >>libc.tmp
5798                                 done
5799                                 echo "Ok." >&4
5800                         else
5801                                 echo "That didn't work either.  Giving up." >&4
5802                                 exit 1
5803                         fi
5804                 fi
5805         fi
5806 fi
5807 nm_extract="$com"
5808 if $test -f /lib/syscalls.exp; then
5809         echo " "
5810         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5811         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5812 fi
5813 ;;
5814 esac
5815 $rm -f libnames libpath
5816
5817 : is a C symbol defined?
5818 csym='tlook=$1;
5819 case "$3" in
5820 -v) tf=libc.tmp; tc=""; tdc="";;
5821 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5822 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5823 esac;
5824 tx=yes;
5825 case "$reuseval-$4" in
5826 true-) ;;
5827 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5828 esac;
5829 case "$tx" in
5830 yes)
5831         case "$runnm" in
5832         true)
5833                 if $contains $tlook $tf >/dev/null 2>&1;
5834                 then tval=true;
5835                 else tval=false;
5836                 fi;;
5837         *)
5838                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5839                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5840                 then tval=true;
5841                 else tval=false;
5842                 fi;
5843                 $rm -f t t.c;;
5844         esac;;
5845 *)
5846         case "$tval" in
5847         $define) tval=true;;
5848         *) tval=false;;
5849         esac;;
5850 esac;
5851 eval "$2=$tval"'
5852
5853 : define an is-in-libc? function
5854 inlibc='echo " "; td=$define; tu=$undef;
5855 sym=$1; var=$2; eval "was=\$$2";
5856 tx=yes;
5857 case "$reuseval$was" in
5858 true) ;;
5859 true*) tx=no;;
5860 esac;
5861 case "$tx" in
5862 yes)
5863         set $sym tres -f;
5864         eval $csym;
5865         case "$tres" in
5866         true)
5867                 echo "$sym() found." >&4;
5868                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5869         *)
5870                 echo "$sym() NOT found." >&4;
5871                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5872         esac;;
5873 *)
5874         case "$was" in
5875         $define) echo "$sym() found." >&4;;
5876         *) echo "$sym() NOT found." >&4;;
5877         esac;;
5878 esac'
5879
5880 : see if sqrtl exists
5881 set sqrtl d_sqrtl
5882 eval $inlibc
5883
5884 : check for length of double
5885 echo " "
5886 case "$doublesize" in
5887 '')
5888         echo "Checking to see how big your double precision numbers are..." >&4
5889         $cat >try.c <<'EOCP'
5890 #include <stdio.h>
5891 int main()
5892 {
5893     printf("%d\n", (int)sizeof(double));
5894     exit(0);
5895 }
5896 EOCP
5897         set try
5898         if eval $compile_ok; then
5899                 doublesize=`$run ./try`
5900                 echo "Your double is $doublesize bytes long."
5901         else
5902                 dflt='8'
5903                 echo "(I can't seem to compile the test program.  Guessing...)"
5904                 rp="What is the size of a double precision number (in bytes)?"
5905                 . ./myread
5906                 doublesize="$ans"
5907         fi
5908         ;;
5909 esac
5910 $rm -f try.c try
5911
5912 : check for long doubles
5913 echo " "
5914 echo "Checking to see if you have long double..." >&4
5915 echo 'int main() { long double x = 7.0; }' > try.c
5916 set try
5917 if eval $compile; then
5918         val="$define"
5919         echo "You have long double."
5920 else
5921         val="$undef"
5922         echo "You do not have long double."
5923 fi
5924 $rm try.*
5925 set d_longdbl
5926 eval $setvar
5927
5928 : check for length of long double
5929 case "${d_longdbl}${longdblsize}" in
5930 $define)
5931         echo " "
5932         echo "Checking to see how big your long doubles are..." >&4
5933         $cat >try.c <<'EOCP'
5934 #include <stdio.h>
5935 int main()
5936 {
5937         printf("%d\n", sizeof(long double));
5938 }
5939 EOCP
5940         set try
5941         set try
5942         if eval $compile; then
5943                 longdblsize=`$run ./try`
5944                 echo "Your long doubles are $longdblsize bytes long."
5945         else
5946                 dflt='8'
5947                 echo " "
5948                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5949                 rp="What is the size of a long double (in bytes)?"
5950                 . ./myread
5951                 longdblsize="$ans"
5952         fi
5953         if $test "X$doublesize" = "X$longdblsize"; then
5954                 echo "(That isn't any different from an ordinary double.)"
5955         fi      
5956         ;;
5957 esac
5958 $rm -f try.* try
5959
5960 echo " "
5961
5962 if $test X"$d_longdbl" = X"$define"; then
5963
5964 echo "Checking how to print long doubles..." >&4
5965
5966 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5967         $cat >try.c <<'EOCP'
5968 #include <sys/types.h>
5969 #include <stdio.h>
5970 int main() {
5971   double d = 123.456;
5972   printf("%.3f\n", d);
5973 }
5974 EOCP
5975         set try
5976         if eval $compile; then
5977                 yyy=`$run ./try`
5978                 case "$yyy" in
5979                 123.456)
5980                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5981                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5982                         echo "We will use %f."
5983                         ;;
5984                 esac
5985         fi
5986 fi
5987
5988 if $test X"$sPRIfldbl" = X; then
5989         $cat >try.c <<'EOCP'
5990 #include <sys/types.h>
5991 #include <stdio.h>
5992 int main() {
5993   long double d = 123.456;
5994   printf("%.3Lf\n", d);
5995 }
5996 EOCP
5997         set try
5998         if eval $compile; then
5999                 yyy=`$run ./try`
6000                 case "$yyy" in
6001                 123.456)
6002                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6003                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6004                         echo "We will use %Lf."
6005                         ;;
6006                 esac
6007         fi
6008 fi
6009
6010 if $test X"$sPRIfldbl" = X; then
6011         $cat >try.c <<'EOCP'
6012 #include <sys/types.h>
6013 #include <stdio.h>
6014 int main() {
6015   long double d = 123.456;
6016   printf("%.3llf\n", d);
6017 }
6018 EOCP
6019         set try
6020         if eval $compile; then
6021                 yyy=`$run ./try`
6022                 case "$yyy" in
6023                 123.456)
6024                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6025                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6026                         echo "We will use %llf."
6027                         ;;
6028                 esac
6029         fi
6030 fi
6031
6032 if $test X"$sPRIfldbl" = X; then
6033         $cat >try.c <<'EOCP'
6034 #include <sys/types.h>
6035 #include <stdio.h>
6036 int main() {
6037   long double d = 123.456;
6038   printf("%.3lf\n", d);
6039 }
6040 EOCP
6041         set try
6042         if eval $compile; then
6043                 yyy=`$run ./try`
6044                 case "$yyy" in
6045                 123.456)
6046                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6047                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6048                         echo "We will use %lf."
6049                         ;;
6050                 esac
6051         fi
6052 fi
6053
6054 if $test X"$sPRIfldbl" = X; then
6055         echo "Cannot figure out how to print long doubles." >&4
6056 else
6057         sSCNfldbl=$sPRIfldbl    # expect consistency
6058 fi
6059
6060 $rm -f try try.*
6061
6062 fi # d_longdbl
6063
6064 case "$sPRIfldbl" in
6065 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6066         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6067         d_SCNfldbl="$undef";
6068         ;;
6069 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6070         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6071         d_SCNfldbl="$define";
6072         ;;
6073 esac
6074
6075 : see if modfl exists
6076 set modfl d_modfl
6077 eval $inlibc
6078
6079 d_modfl_pow32_bug="$undef"
6080
6081 case "$d_longdbl$d_modfl" in
6082 $define$define)
6083         $cat <<EOM
6084 Checking to see whether your modfl() is okay for large values...
6085 EOM
6086 $cat >try.c <<EOCP
6087 #include <math.h> 
6088 #include <stdio.h>
6089 int main() {
6090     long double nv = 4294967303.15;
6091     long double v, w;
6092     v = modfl(nv, &w);         
6093 #ifdef __GLIBC__
6094     printf("glibc");
6095 #endif
6096     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6097     return 0;
6098 }
6099 EOCP
6100         case "$osname:$gccversion" in
6101         aix:)   saveccflags="$ccflags"
6102                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6103         esac
6104         set try
6105         if eval $compile; then
6106                 foo=`$run ./try`
6107                 case "$foo" in
6108                 *" 4294967303.150000 1.150000 4294967302.000000")
6109                         echo >&4 "Your modfl() is broken for large values."
6110                         d_modfl_pow32_bug="$define"
6111                         case "$foo" in
6112                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6113                         ;;
6114                         esac
6115                         ;;
6116                 *" 4294967303.150000 0.150000 4294967303.000000")
6117                         echo >&4 "Your modfl() seems okay for large values."
6118                         ;;
6119                 *)      echo >&4 "I don't understand your modfl() at all."
6120                         d_modfl="$undef"
6121                         ;;
6122                 esac
6123                 $rm -f try.* try core core.try.*
6124         else
6125                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6126                 d_modfl="$undef"
6127         fi
6128         case "$osname:$gccversion" in
6129         aix:)   ccflags="$saveccflags" ;; # restore
6130         esac
6131         ;;
6132 esac
6133
6134 case "$ccflags" in
6135 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6136 esac
6137
6138 case "$uselongdouble" in
6139 $define|true|[yY]*)     dflt='y';;
6140 *) dflt='n';;
6141 esac
6142 cat <<EOM
6143
6144 Perl can be built to take advantage of long doubles which
6145 (if available) may give more accuracy and range for floating point numbers.
6146
6147 If this doesn't make any sense to you, just accept the default '$dflt'.
6148 EOM
6149 rp='Try to use long doubles if available?'
6150 . ./myread
6151 case "$ans" in
6152 y|Y)    val="$define"   ;;
6153 *)      val="$undef"    ;;
6154 esac
6155 set uselongdouble
6156 eval $setvar
6157
6158 case "$uselongdouble" in
6159 true|[yY]*) uselongdouble="$define" ;;
6160 esac
6161
6162 case "$uselongdouble" in
6163 $define)
6164 : Look for a hint-file generated 'call-back-unit'.  If the
6165 : user has specified that long doubles should be used,
6166 : we may need to set or change some other defaults.
6167         if $test -f uselongdouble.cbu; then
6168                 echo "Your platform has some specific hints for long doubles, using them..."
6169                 . ./uselongdouble.cbu
6170         else
6171                 $cat <<EOM
6172 (Your platform doesn't have any specific hints for long doubles.)
6173 EOM
6174         fi
6175         ;;
6176 esac
6177
6178 message=X
6179 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6180 $define:$define:$define)
6181         : You have both
6182         ;;
6183 $define:$define:$undef)
6184         message="I could not find modfl"
6185         ;;
6186 $define:$undef:$define)
6187         message="I could not find sqrtl"
6188         ;;
6189 $define:$undef:$undef)
6190         message="I found neither sqrtl nor modfl"
6191         ;;
6192 esac
6193
6194 if $test "$message" != X; then
6195         $cat <<EOM >&4
6196
6197 *** You requested the use of long doubles but you do not seem to have
6198 *** the mathematic functions for long doubles.
6199 *** ($message)
6200 *** I'm disabling the use of long doubles.
6201
6202 EOM
6203
6204         uselongdouble=$undef
6205 fi
6206
6207 case "$useperlio" in
6208 $define|true|[yY]*|'')  dflt='y';;
6209 *) dflt='n';;
6210 esac
6211 cat <<EOM
6212
6213 Previous version of $package used the standard IO mechanisms as
6214 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6215 alternate IO mechanisms via the PerlIO abstraction layer, but the
6216 stdio mechanism is still available if needed.  The abstraction layer
6217 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6218 Using PerlIO with sfio may cause problems with some extension modules.
6219
6220 If this doesn't make any sense to you, just accept the default '$dflt'.
6221 EOM
6222 rp='Use the PerlIO abstraction layer?'
6223 . ./myread
6224 case "$ans" in
6225 y|Y) 
6226         val="$define"
6227         ;;
6228 *)      
6229         echo "Ok, doing things the stdio way."
6230         val="$undef"
6231         ;;
6232 esac
6233 set useperlio
6234 eval $setvar 
6235
6236 case "$usesocks" in
6237 $define|true|[yY]*)
6238         case "$useperlio" in
6239         $define|true|[yY]*) ;;
6240         *)      cat >&4 <<EOM
6241
6242 You are using the SOCKS proxy protocol library which means that you
6243 should also use the PerlIO layer.  You may be headed for trouble.
6244
6245 EOM
6246                 ;;
6247         esac
6248         ;;
6249 esac
6250
6251         
6252 : determine the architecture name
6253 echo " "
6254 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6255         tarch=`arch`"-$osname"
6256 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6257         if uname -m > tmparch 2>&1 ; then
6258                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6259                         -e 's/$/'"-$osname/" tmparch`
6260         else
6261                 tarch="$osname"
6262         fi
6263         $rm -f tmparch
6264 else
6265         tarch="$osname"
6266 fi
6267 case "$myarchname" in
6268 ''|"$tarch") ;;
6269 *)
6270         echo "(Your architecture name used to be $myarchname.)"
6271         archname=''
6272         ;;
6273 esac
6274 case "$targetarch" in
6275 '') ;;
6276 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6277 esac
6278 myarchname="$tarch"
6279 case "$archname" in
6280 '') dflt="$tarch";;
6281 *) dflt="$archname";;
6282 esac
6283 rp='What is your architecture name'
6284 . ./myread
6285 archname="$ans"
6286 case "$usethreads" in
6287 $define)
6288         echo "Threads selected." >&4
6289         case "$archname" in
6290         *-thread*) echo "...and architecture name already has -thread." >&4
6291                 ;;
6292         *)      archname="$archname-thread"
6293                 echo "...setting architecture name to $archname." >&4
6294                 ;;
6295         esac
6296         ;;
6297 esac
6298 case "$usemultiplicity" in
6299 $define)
6300         echo "Multiplicity selected." >&4
6301         case "$archname" in
6302         *-multi*) echo "...and architecture name already has -multi." >&4
6303                 ;;
6304         *)      archname="$archname-multi"
6305                 echo "...setting architecture name to $archname." >&4
6306                 ;;
6307         esac
6308         ;;
6309 esac
6310 case "$use64bitint$use64bitall" in
6311 *"$define"*)
6312         case "$archname64" in
6313         '')
6314                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6315                 ;;
6316         *)
6317                 case "$use64bitint" in
6318                 "$define") echo "64 bit integers selected." >&4 ;;
6319                 esac
6320                 case "$use64bitall" in
6321                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6322                 esac
6323                 case "$archname" in
6324                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6325                         ;;
6326                 *)      archname="$archname-$archname64"
6327                         echo "...setting architecture name to $archname." >&4
6328                         ;;
6329                 esac
6330                 ;;
6331         esac
6332 esac
6333 case "$uselongdouble" in
6334 $define)
6335         echo "Long doubles selected." >&4
6336         case "$longdblsize" in
6337         $doublesize)
6338                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6339                 ;;
6340         *)
6341                 case "$archname" in
6342                 *-ld*) echo "...and architecture name already has -ld." >&4
6343                         ;;
6344                 *)      archname="$archname-ld"
6345                         echo "...setting architecture name to $archname." >&4
6346                         ;;
6347                 esac
6348                 ;;
6349         esac
6350         ;;
6351 esac
6352 case "$useperlio" in
6353 $define)
6354         echo "Perlio selected." >&4
6355         ;;
6356 *)
6357         echo "Perlio not selected, using stdio." >&4
6358         case "$archname" in
6359         *-stdio*) echo "...and architecture name already has -stdio." >&4
6360                 ;;
6361         *)      archname="$archname-stdio"
6362                 echo "...setting architecture name to $archname." >&4
6363                 ;;
6364         esac
6365         ;;
6366 esac
6367
6368 : determine root of directory hierarchy where package will be installed.
6369 case "$prefix" in
6370 '')
6371         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6372         ;;
6373 *)
6374         dflt="$prefix"
6375         ;;
6376 esac
6377 $cat <<EOM
6378
6379 By default, $package will be installed in $dflt/bin, manual pages
6380 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6381 installation directories. Typically this is something like /usr/local.
6382 If you wish to have binaries under /usr/bin but other parts of the
6383 installation under /usr/local, that's ok: you will be prompted
6384 separately for each of the installation directories, the prefix being
6385 only used to set the defaults.
6386
6387 EOM
6388 fn=d~
6389 rp='Installation prefix to use?'
6390 . ./getfile
6391 oldprefix=''
6392 case "$prefix" in
6393 '') ;;
6394 *)
6395         case "$ans" in
6396         "$prefix") ;;
6397         *) oldprefix="$prefix";;
6398         esac
6399         ;;
6400 esac
6401 prefix="$ans"
6402 prefixexp="$ansexp"
6403
6404 case "$afsroot" in
6405 '')     afsroot=/afs ;;
6406 *)      afsroot=$afsroot ;;
6407 esac
6408
6409 : is AFS running?
6410 echo " "
6411 case "$afs" in
6412 $define|true)   afs=true ;;
6413 $undef|false)   afs=false ;;
6414 *)      if test -d $afsroot; then
6415                 afs=true
6416         else
6417                 afs=false
6418         fi
6419         ;;
6420 esac
6421 if $afs; then
6422         echo "AFS may be running... I'll be extra cautious then..." >&4
6423 else
6424         echo "AFS does not seem to be running..." >&4
6425 fi
6426
6427 : determine installation prefix for where package is to be installed.
6428 if $afs; then 
6429 $cat <<EOM
6430
6431 Since you are running AFS, I need to distinguish the directory in which
6432 files will reside from the directory in which they are installed (and from
6433 which they are presumably copied to the former directory by occult means).
6434
6435 EOM
6436         case "$installprefix" in
6437         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6438         *) dflt="$installprefix";;
6439         esac
6440 else
6441 $cat <<EOM
6442
6443 In some special cases, particularly when building $package for distribution,
6444 it is convenient to distinguish between the directory in which files should 
6445 be installed from the directory ($prefix) in which they 
6446 will eventually reside.  For most users, these two directories are the same.
6447
6448 EOM
6449         case "$installprefix" in
6450         '') dflt=$prefix ;;
6451         *) dflt=$installprefix;;
6452         esac
6453 fi
6454 fn=d~
6455 rp='What installation prefix should I use for installing files?'
6456 . ./getfile
6457 installprefix="$ans"
6458 installprefixexp="$ansexp"
6459
6460 : set the prefixit variable, to compute a suitable default value
6461 prefixit='case "$3" in
6462 ""|none)
6463         case "$oldprefix" in
6464         "") eval "$1=\"\$$2\"";;
6465         *)
6466                 case "$3" in
6467                 "") eval "$1=";;
6468                 none)
6469                         eval "tp=\"\$$2\"";
6470                         case "$tp" in
6471                         ""|" ") eval "$1=\"\$$2\"";;
6472                         *) eval "$1=";;
6473                         esac;;
6474                 esac;;
6475         esac;;
6476 *)
6477         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6478         case "$tp" in
6479         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6480         /*-$oldprefix/*|\~*-$oldprefix/*)
6481                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6482         *) eval "$1=\"\$$2\"";;
6483         esac;;
6484 esac'
6485
6486 : get the patchlevel
6487 echo " "
6488 echo "Getting the current patchlevel..." >&4
6489 if $test -r $rsrc/patchlevel.h;then
6490         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6491         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6492         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6493         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6494         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6495         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6496        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6497 else
6498         revision=0
6499         patchlevel=0
6500         subversion=0
6501         api_revision=0
6502         api_version=0
6503         api_subversion=0
6504         perl_patchlevel=0
6505         $echo "(You do not have patchlevel.h.  Eek.)"
6506 fi
6507 if $test -r $rsrc/.patch ; then  
6508         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6509                 perl_patchlevel=`cat $rsrc/.patch`
6510         fi
6511 fi
6512 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6513 version_patchlevel_string="version $patchlevel subversion $subversion"
6514 case "$perl_patchlevel" in
6515 0|'') ;;
6516 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6517 esac
6518
6519 $echo "(You have $package $version_patchlevel_string.)"
6520
6521 case "$osname" in
6522 dos|vms)
6523         : XXX Should be a Configure test for double-dots in filenames.
6524         version=`echo $revision $patchlevel $subversion | \
6525                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6526         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6527                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6528         ;;
6529 *)
6530         version=`echo $revision $patchlevel $subversion | \
6531                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6532         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6533                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6534         ;;
6535 esac
6536 : Special case the 5.005_xx maintenance series, which used 5.005
6537 : without any subversion label as a subdirectory in $sitelib
6538 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6539         api_versionstring='5.005'
6540 fi
6541
6542 : determine installation style
6543 : For now, try to deduce it from prefix unless it is already set.
6544 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6545 case "$installstyle" in
6546 '')     case "$prefix" in
6547                 *perl*) dflt='lib';;
6548                 *) dflt='lib/perl5' ;;
6549         esac
6550         ;;
6551 *)      dflt="$installstyle" ;;
6552 esac
6553 : Probably not worth prompting for this since we prompt for all
6554 : the directories individually, and the prompt would be too long and
6555 : confusing anyway.
6556 installstyle=$dflt
6557
6558 : determine where private library files go
6559 : Usual default is /usr/local/lib/perl5/$version.
6560 : Also allow things like /opt/perl/lib/$version, since 
6561 : /opt/perl/lib/perl5... would be redundant.
6562 : The default "style" setting is made in installstyle.U
6563 case "$installstyle" in
6564 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6565 *)       set dflt privlib lib/$version ;;
6566 esac
6567 eval $prefixit
6568 $cat <<EOM
6569
6570 There are some auxiliary files for $package that need to be put into a
6571 private library directory that is accessible by everyone.
6572
6573 EOM
6574 fn=d~+
6575 rp='Pathname where the private library files will reside?'
6576 . ./getfile
6577 privlib="$ans"
6578 privlibexp="$ansexp"
6579 : Change installation prefix, if necessary.
6580 if $test X"$prefix" != X"$installprefix"; then
6581         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6582 else
6583         installprivlib="$privlibexp"
6584 fi
6585
6586 : set the prefixup variable, to restore leading tilda escape
6587 prefixup='case "$prefixexp" in
6588 "$prefix") ;;
6589 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6590 esac'
6591
6592 : determine where public architecture dependent libraries go
6593 set archlib archlib
6594 eval $prefixit
6595 : privlib default is /usr/local/lib/$package/$version
6596 : archlib default is /usr/local/lib/$package/$version/$archname
6597 : privlib may have an optional trailing /share.
6598 tdflt=`echo $privlib | $sed 's,/share$,,'`
6599 tdflt=$tdflt/$archname
6600 case "$archlib" in
6601 '')     dflt=$tdflt
6602         ;;
6603 *)      dflt="$archlib"
6604     ;;
6605 esac
6606 $cat <<EOM
6607
6608 $spackage contains architecture-dependent library files.  If you are
6609 sharing libraries in a heterogeneous environment, you might store
6610 these files in a separate location.  Otherwise, you can just include
6611 them with the rest of the public library files.
6612
6613 EOM
6614 fn=d+~
6615 rp='Where do you want to put the public architecture-dependent libraries?'
6616 . ./getfile
6617 archlib="$ans"
6618 archlibexp="$ansexp"
6619 if $test X"$archlib" = X"$privlib"; then
6620         d_archlib="$undef"
6621 else
6622         d_archlib="$define"
6623 fi
6624 : Change installation prefix, if necessary.
6625 if $test X"$prefix" != X"$installprefix"; then
6626         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6627 else
6628         installarchlib="$archlibexp"
6629 fi
6630
6631
6632 : Binary compatibility with 5.005 is not possible for builds
6633 : with advanced features
6634 case "$usethreads$usemultiplicity" in
6635 *define*)
6636         bincompat5005="$undef"
6637         d_bincompat5005="$undef"
6638         ;;
6639 *)      $cat <<EOM
6640
6641 This version of Perl can be compiled for binary compatibility with 5.005.
6642 If you decide to do so, you will be able to continue using most of the
6643 extensions that were compiled for Perl 5.005.
6644
6645 EOM
6646         case "$bincompat5005$d_bincompat5005" in
6647         *"$undef"*) dflt=n ;;
6648         *) dflt=y ;;
6649         esac
6650         rp='Binary compatibility with Perl 5.005?'
6651         . ./myread
6652         case "$ans" in
6653         y*) val="$define" ;;
6654         *)  val="$undef" ;;
6655         esac
6656         set d_bincompat5005
6657         eval $setvar
6658         case "$d_bincompat5005" in
6659         "$define")
6660                 bincompat5005="$define"
6661                 ;;
6662         *)      bincompat5005="$undef"
6663                 d_bincompat5005="$undef"
6664                 ;;
6665         esac
6666         ;;
6667 esac
6668
6669
6670 : see if setuid scripts can be secure
6671 $cat <<EOM
6672
6673 Some kernels have a bug that prevents setuid #! scripts from being
6674 secure.  Some sites have disabled setuid #! scripts because of this.
6675
6676 First let's decide if your kernel supports secure setuid #! scripts.
6677 (If setuid #! scripts would be secure but have been disabled anyway,
6678 don't say that they are secure if asked.)
6679
6680 EOM
6681
6682 val="$undef"
6683 if $test -d /dev/fd; then
6684         echo "#!$ls" >reflect
6685         chmod +x,u+s reflect
6686         ./reflect >flect 2>&1
6687         if $contains "/dev/fd" flect >/dev/null; then
6688                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6689                 val="$define"
6690         else
6691                 $cat <<EOM
6692 If you are not sure if they are secure, I can check but I'll need a
6693 username and password different from the one you are using right now.
6694 If you don't have such a username or don't want me to test, simply
6695 enter 'none'.
6696
6697 EOM
6698                 rp='Other username to test security of setuid scripts with?'
6699                 dflt='none'
6700                 . ./myread
6701                 case "$ans" in
6702                 n|none)
6703                         case "$d_suidsafe" in
6704                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6705                                 dflt=n;;
6706                         "$undef")
6707                                 echo "Well, the $hint value is *not* secure." >&4
6708                                 dflt=n;;
6709                         *)      echo "Well, the $hint value *is* secure." >&4
6710                                 dflt=y;;
6711                         esac
6712                         ;;
6713                 *)
6714                         $rm -f reflect flect
6715                         echo "#!$ls" >reflect
6716                         chmod +x,u+s reflect
6717                         echo >flect
6718                         chmod a+w flect
6719                         echo '"su" will (probably) prompt you for '"$ans's password."
6720                         su $ans -c './reflect >flect'
6721                         if $contains "/dev/fd" flect >/dev/null; then
6722                                 echo "Okay, it looks like setuid scripts are secure." >&4
6723                                 dflt=y
6724                         else
6725                                 echo "I don't think setuid scripts are secure." >&4
6726                                 dflt=n
6727                         fi
6728                         ;;
6729                 esac
6730                 rp='Does your kernel have *secure* setuid scripts?'
6731                 . ./myread
6732                 case "$ans" in
6733                 [yY]*)  val="$define";;
6734                 *)      val="$undef";;
6735                 esac
6736         fi
6737 else
6738         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6739         echo "(That's for file descriptors, not floppy disks.)"
6740         val="$undef"
6741 fi
6742 set d_suidsafe
6743 eval $setvar
6744
6745 $rm -f reflect flect
6746
6747 : now see if they want to do setuid emulation
6748 echo " "
6749 val="$undef"
6750 case "$d_suidsafe" in
6751 "$define")
6752         val="$undef"
6753         echo "No need to emulate SUID scripts since they are secure here." >&4
6754         ;;
6755 *)
6756         $cat <<EOM
6757 Some systems have disabled setuid scripts, especially systems where
6758 setuid scripts cannot be secure.  On systems where setuid scripts have
6759 been disabled, the setuid/setgid bits on scripts are currently
6760 useless.  It is possible for $package to detect those bits and emulate
6761 setuid/setgid in a secure fashion.  This emulation will only work if
6762 setuid scripts have been disabled in your kernel.
6763
6764 EOM
6765         case "$d_dosuid" in
6766         "$define") dflt=y ;;
6767         *) dflt=n ;;
6768         esac
6769         rp="Do you want to do setuid/setgid emulation?"
6770         . ./myread
6771         case "$ans" in
6772         [yY]*)  val="$define";;
6773         *)      val="$undef";;
6774         esac
6775         ;;
6776 esac
6777 set d_dosuid
6778 eval $setvar
6779
6780 : see if this is a malloc.h system
6781 set malloc.h i_malloc
6782 eval $inhdr
6783
6784 : see if stdlib is available
6785 set stdlib.h i_stdlib
6786 eval $inhdr
6787
6788 : determine which malloc to compile in
6789 echo " "
6790 case "$usemymalloc" in
6791 [yY]*|true|$define)     dflt='y' ;;
6792 [nN]*|false|$undef)     dflt='n' ;;
6793 *)      case "$ptrsize" in
6794         4) dflt='y' ;;
6795         *) dflt='n' ;;
6796         esac
6797         ;;
6798 esac
6799 rp="Do you wish to attempt to use the malloc that comes with $package?"
6800 . ./myread
6801 usemymalloc="$ans"
6802 case "$ans" in
6803 y*|true)
6804         usemymalloc='y'
6805         mallocsrc='malloc.c'
6806         mallocobj="malloc$_o"
6807         d_mymalloc="$define"
6808         case "$libs" in
6809         *-lmalloc*)
6810                 : Remove malloc from list of libraries to use
6811                 echo "Removing unneeded -lmalloc from library list" >&4
6812                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6813                 shift
6814                 libs="$*"
6815                 echo "libs = $libs" >&4
6816                 ;;
6817         esac
6818         ;;
6819 *)
6820         usemymalloc='n'
6821         mallocsrc=''
6822         mallocobj=''
6823         d_mymalloc="$undef"
6824         ;;
6825 esac
6826
6827 : compute the return types of malloc and free
6828 echo " "
6829 $cat >malloc.c <<END
6830 #$i_malloc I_MALLOC
6831 #$i_stdlib I_STDLIB
6832 #include <stdio.h>
6833 #include <sys/types.h>
6834 #ifdef I_MALLOC
6835 #include <malloc.h>
6836 #endif
6837 #ifdef I_STDLIB
6838 #include <stdlib.h>
6839 #endif
6840 #ifdef TRY_MALLOC
6841 void *malloc();
6842 #endif
6843 #ifdef TRY_FREE
6844 void free();
6845 #endif
6846 END
6847 case "$malloctype" in
6848 '')
6849         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6850                 malloctype='void *'
6851         else
6852                 malloctype='char *'
6853         fi
6854         ;;
6855 esac
6856 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6857
6858 case "$freetype" in
6859 '')
6860         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6861                 freetype='void'
6862         else
6863                 freetype='int'
6864         fi
6865         ;;
6866 esac
6867 echo "Your system uses $freetype free(), it would seem." >&4
6868 $rm -f malloc.[co]
6869 $cat <<EOM
6870
6871 After $package is installed, you may wish to install various
6872 add-on modules and utilities.  Typically, these add-ons will
6873 be installed under $prefix with the rest
6874 of this package.  However, you may wish to install such add-ons
6875 elsewhere under a different prefix.
6876
6877 If you do not wish to put everything under a single prefix, that's
6878 ok.  You will be prompted for the individual locations; this siteprefix
6879 is only used to suggest the defaults.
6880
6881 The default should be fine for most people.
6882
6883 EOM
6884 fn=d~+
6885 rp='Installation prefix to use for add-on modules and utilities?'
6886 : XXX Here might be another good place for an installstyle setting.
6887 case "$siteprefix" in
6888 '') dflt=$prefix ;;
6889 *)  dflt=$siteprefix ;;
6890 esac
6891 . ./getfile
6892 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6893 oldsiteprefix=''
6894 case "$siteprefix" in
6895 '') ;;
6896 *)      case "$ans" in
6897         "$prefix") ;;
6898         *) oldsiteprefix="$prefix";;
6899         esac
6900         ;;
6901 esac
6902 siteprefix="$ans"
6903 siteprefixexp="$ansexp"
6904
6905 : determine where site specific libraries go.
6906 : Usual default is /usr/local/lib/perl5/site_perl/$version
6907 : The default "style" setting is made in installstyle.U
6908 : XXX No longer works with Prefixit stuff.
6909 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6910 case "$sitelib" in
6911 '') case "$installstyle" in
6912         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6913         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6914         esac
6915         ;;
6916 *)      dflt="$sitelib"
6917         ;;
6918 esac
6919 $cat <<EOM
6920
6921 The installation process will create a directory for
6922 site-specific extensions and modules.  Most users find it convenient
6923 to place all site-specific files in this directory rather than in the
6924 main distribution directory.
6925
6926 EOM
6927 fn=d~+
6928 rp='Pathname for the site-specific library files?'
6929 . ./getfile
6930 sitelib="$ans"
6931 sitelibexp="$ansexp"
6932 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6933 : Change installation prefix, if necessary.
6934 if $test X"$prefix" != X"$installprefix"; then
6935         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6936 else
6937         installsitelib="$sitelibexp"
6938 fi
6939
6940 : determine where site specific architecture-dependent libraries go.
6941 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6942 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6943 : sitelib may have an optional trailing /share.
6944 case "$sitearch" in
6945 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6946         dflt="$dflt/$archname"
6947         ;;
6948 *)      dflt="$sitearch"
6949         ;;
6950 esac
6951 set sitearch sitearch none
6952 eval $prefixit
6953 $cat <<EOM
6954
6955 The installation process will also create a directory for
6956 architecture-dependent site-specific extensions and modules.
6957
6958 EOM
6959 fn=d~+
6960 rp='Pathname for the site-specific architecture-dependent library files?'
6961 . ./getfile
6962 sitearch="$ans"
6963 sitearchexp="$ansexp"
6964 : Change installation prefix, if necessary.
6965 if $test X"$prefix" != X"$installprefix"; then
6966         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6967 else
6968         installsitearch="$sitearchexp"
6969 fi
6970
6971 $cat <<EOM
6972
6973 The installation process will also create a directory for
6974 vendor-supplied add-ons.  Vendors who supply perl with their system
6975 may find it convenient to place all vendor-supplied files in this
6976 directory rather than in the main distribution directory.  This will
6977 ease upgrades between binary-compatible maintenance versions of perl.
6978
6979 Of course you may also use these directories in whatever way you see
6980 fit.  For example, you might use them to access modules shared over a
6981 company-wide network.
6982
6983 The default answer should be fine for most people.
6984 This causes further questions about vendor add-ons to be skipped
6985 and no vendor-specific directories will be configured for perl.
6986
6987 EOM
6988 rp='Do you want to configure vendor-specific add-on directories?'
6989 case "$usevendorprefix" in
6990 define|true|[yY]*) dflt=y ;;
6991 *)      : User may have set vendorprefix directly on Configure command line.
6992         case "$vendorprefix" in
6993         ''|' ') dflt=n ;;
6994         *)      dflt=y ;;
6995         esac
6996         ;;
6997 esac
6998 . ./myread
6999 case "$ans" in
7000 [yY]*)  fn=d~+
7001         rp='Installation prefix to use for vendor-supplied add-ons?'
7002         case "$vendorprefix" in
7003         '') dflt='' ;;
7004         *)  dflt=$vendorprefix ;;
7005         esac
7006         . ./getfile
7007         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7008         oldvendorprefix=''
7009         case "$vendorprefix" in
7010         '') ;;
7011         *)      case "$ans" in
7012                 "$prefix") ;;
7013                 *) oldvendorprefix="$prefix";;
7014                 esac
7015                 ;;
7016         esac
7017         usevendorprefix="$define"
7018         vendorprefix="$ans"
7019         vendorprefixexp="$ansexp"
7020         ;;
7021 *)      usevendorprefix="$undef"
7022         vendorprefix=''
7023         vendorprefixexp=''
7024         ;;
7025 esac
7026
7027 case "$vendorprefix" in
7028 '')     d_vendorlib="$undef"
7029         vendorlib=''
7030         vendorlibexp=''
7031         ;;
7032 *)      d_vendorlib="$define"
7033         : determine where vendor-supplied modules go.
7034         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7035         case "$vendorlib" in
7036         '')
7037                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7038                 case "$installstyle" in
7039                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7040                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7041                 esac
7042                 ;;
7043         *)      dflt="$vendorlib"
7044                 ;;
7045         esac
7046         fn=d~+
7047         rp='Pathname for the vendor-supplied library files?'
7048         . ./getfile
7049         vendorlib="$ans"
7050         vendorlibexp="$ansexp"
7051         ;;
7052 esac
7053 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7054 : Change installation prefix, if necessary.
7055 if $test X"$prefix" != X"$installprefix"; then
7056         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7057 else
7058         installvendorlib="$vendorlibexp"
7059 fi
7060
7061 case "$vendorprefix" in
7062 '')     d_vendorarch="$undef"
7063         vendorarch=''
7064         vendorarchexp=''
7065         ;;
7066 *)      d_vendorarch="$define"
7067         : determine where vendor-supplied architecture-dependent libraries go.
7068         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7069         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7070         : vendorlib may have an optional trailing /share.
7071         case "$vendorarch" in
7072         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7073                 dflt="$dflt/$archname"
7074                 ;;
7075         *)      dflt="$vendorarch" ;;
7076         esac
7077         fn=d~+
7078         rp='Pathname for vendor-supplied architecture-dependent files?'
7079         . ./getfile
7080         vendorarch="$ans"
7081         vendorarchexp="$ansexp"
7082         ;;
7083 esac
7084 : Change installation prefix, if necessary.
7085 if $test X"$prefix" != X"$installprefix"; then
7086         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7087 else
7088         installvendorarch="$vendorarchexp"
7089 fi
7090
7091 : Final catch-all directories to search
7092 $cat <<EOM
7093
7094 Lastly, you can have perl look in other directories for extensions and
7095 modules in addition to those already specified.
7096 These directories will be searched after 
7097         $sitearch 
7098         $sitelib 
7099 EOM
7100 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7101 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7102 echo ' '
7103 case "$otherlibdirs" in
7104 ''|' ') dflt='none' ;;
7105 *)      dflt="$otherlibdirs" ;;
7106 esac
7107 $cat <<EOM
7108 Enter a colon-separated set of extra paths to include in perl's @INC
7109 search path, or enter 'none' for no extra paths.
7110
7111 EOM
7112
7113 rp='Colon-separated list of additional directories for perl to search?'
7114 . ./myread
7115 case "$ans" in
7116 ' '|''|none)    otherlibdirs=' ' ;;     
7117 *)      otherlibdirs="$ans" ;;
7118 esac
7119 case "$otherlibdirs" in
7120 ' ') val=$undef ;;
7121 *)      val=$define ;;
7122 esac
7123 set d_perl_otherlibdirs
7124 eval $setvar
7125
7126 : Cruising for prototypes
7127 echo " "
7128 echo "Checking out function prototypes..." >&4
7129 $cat >prototype.c <<'EOCP'
7130 int main(int argc, char *argv[]) {
7131         exit(0);}
7132 EOCP
7133 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7134         echo "Your C compiler appears to support function prototypes."
7135         val="$define"
7136 else
7137         echo "Your C compiler doesn't seem to understand function prototypes."
7138         val="$undef"
7139 fi
7140 set prototype
7141 eval $setvar
7142 $rm -f prototype*
7143
7144 case "$prototype" in
7145 "$define") ;;
7146 *)      ansi2knr='ansi2knr'
7147         echo " "
7148         cat <<EOM >&4
7149
7150 $me:  FATAL ERROR:
7151 This version of $package can only be compiled by a compiler that 
7152 understands function prototypes.  Unfortunately, your C compiler 
7153         $cc $ccflags
7154 doesn't seem to understand them.  Sorry about that.
7155
7156 If GNU cc is available for your system, perhaps you could try that instead.  
7157
7158 Eventually, we hope to support building Perl with pre-ANSI compilers.
7159 If you would like to help in that effort, please contact <perlbug@perl.org>.
7160
7161 Aborting Configure now.
7162 EOM
7163         exit 2
7164         ;;
7165 esac
7166
7167 : determine where public executables go
7168 echo " "
7169 set dflt bin bin
7170 eval $prefixit
7171 fn=d~
7172 rp='Pathname where the public executables will reside?'
7173 . ./getfile
7174 if $test "X$ansexp" != "X$binexp"; then
7175         installbin=''
7176 fi
7177 bin="$ans"
7178 binexp="$ansexp"
7179 : Change installation prefix, if necessary.
7180 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7181 if $test X"$prefix" != X"$installprefix"; then
7182         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7183 else
7184         installbin="$binexp"
7185 fi
7186
7187 echo " "
7188 case "$extras" in
7189 '') dflt='n';;
7190 *) dflt='y';;
7191 esac
7192 cat <<EOM
7193 Perl can be built with extra modules or bundles of modules which
7194 will be fetched from the CPAN and installed alongside Perl.
7195
7196 Notice that you will need access to the CPAN; either via the Internet,
7197 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7198 be asked later to configure the CPAN.pm module which will in turn do
7199 the installation of the rest of the extra modules or bundles.)
7200
7201 Notice also that if the modules require any external software such as
7202 libraries and headers (the libz library and the zlib.h header for the
7203 Compress::Zlib module, for example) you MUST have any such software
7204 already installed, this configuration process will NOT install such
7205 things for you.
7206
7207 If this doesn't make any sense to you, just accept the default '$dflt'.
7208 EOM
7209 rp='Install any extra modules (y or n)?'
7210 . ./myread
7211 case "$ans" in
7212 y|Y)
7213         cat <<EOM
7214
7215 Please list any extra modules or bundles to be installed from CPAN,
7216 with spaces between the names.  The names can be in any format the
7217 'install' command of CPAN.pm will understand.  (Answer 'none',
7218 without the quotes, to install no extra modules or bundles.)
7219 EOM
7220         rp='Extras?'
7221         dflt="$extras"
7222         . ./myread
7223         extras="$ans"
7224 esac
7225 case "$extras" in
7226 ''|'none')
7227         val=''
7228         $rm -f ../extras.lst
7229         ;;
7230 *)      echo "(Saving the list of extras for later...)"
7231         echo "$extras" > ../extras.lst
7232         val="'$extras'"
7233         ;;
7234 esac
7235 set extras
7236 eval $setvar
7237 echo " "
7238
7239 : Find perl5.005 or later.
7240 echo "Looking for a previously installed perl5.005 or later... "
7241 case "$perl5" in
7242 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7243                 : Check if this perl is recent and can load a simple module
7244                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7245                         perl5=$tdir/perl
7246                         break;
7247                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7248                         perl5=$tdir/perl5
7249                         break;
7250                 fi
7251         done
7252         ;;
7253 *)      perl5="$perl5"
7254         ;;
7255 esac
7256 case "$perl5" in
7257 '')     echo "None found.  That's ok.";;
7258 *)      echo "Using $perl5." ;;
7259 esac
7260
7261 : Determine list of previous versions to include in @INC
7262 $cat > getverlist <<EOPL
7263 #!$perl5 -w
7264 use File::Basename;
7265 \$api_versionstring = "$api_versionstring";
7266 \$version = "$version";
7267 \$stem = "$sitelib_stem";
7268 \$archname = "$archname";
7269 EOPL
7270         $cat >> getverlist <<'EOPL'
7271 # Can't have leading @ because metaconfig interprets it as a command!
7272 ;@inc_version_list=();
7273 # XXX Redo to do opendir/readdir? 
7274 if (-d $stem) {
7275     chdir($stem);
7276     ;@candidates = glob("5.*");
7277 }
7278 else {
7279     ;@candidates = ();
7280 }
7281
7282 # XXX ToDo:  These comparisons must be reworked when two-digit
7283 # subversions come along, so that 5.7.10 compares as greater than
7284 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7285 # widespread that we can use the built-in version vectors rather
7286 # than reinventing them here.  For 5.6.0, however, we must
7287 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7288 foreach $d (@candidates) {
7289     if ($d lt $version) {
7290         if ($d ge $api_versionstring) {
7291             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7292         }
7293         elsif ($d ge "5.005") {
7294             unshift(@inc_version_list, grep { -d } $d);
7295         }
7296     }
7297     else {
7298         # Skip newer version.  I.e. don't look in
7299         # 5.7.0 if we're installing 5.6.1.
7300     }
7301 }
7302
7303 if (@inc_version_list) {
7304     print join(' ', @inc_version_list);
7305 }
7306 else {
7307     # Blank space to preserve value for next Configure run.
7308     print " ";
7309 }
7310 EOPL
7311 chmod +x getverlist
7312 case "$inc_version_list" in
7313 '')     if test -x "$perl5$exe_ext"; then
7314                 dflt=`$perl5 getverlist`
7315         else
7316                 dflt='none'
7317         fi
7318         ;;
7319 $undef) dflt='none' ;;
7320 *)  eval dflt=\"$inc_version_list\" ;;
7321 esac
7322 case "$dflt" in
7323 ''|' ') dflt=none ;;
7324 esac
7325 case "$dflt" in
7326 5.005) case "$bincompat5005" in
7327        $define|true|[yY]*) ;;
7328        *) dflt=none ;;
7329        esac
7330        ;;
7331 esac
7332 $cat <<'EOM'
7333
7334 In order to ease the process of upgrading, this version of perl 
7335 can be configured to use modules built and installed with earlier 
7336 versions of perl that were installed under $prefix.  Specify here
7337 the list of earlier versions that this version of perl should check.
7338 If Configure detected no earlier versions of perl installed under
7339 $prefix, then the list will be empty.  Answer 'none' to tell perl
7340 to not search earlier versions.
7341
7342 The default should almost always be sensible, so if you're not sure,
7343 just accept the default.
7344 EOM
7345
7346 rp='List of earlier versions to include in @INC?'
7347 . ./myread
7348 case "$ans" in
7349 [Nn]one|''|' ') inc_version_list=' ' ;;
7350 *) inc_version_list="$ans" ;;
7351 esac
7352 case "$inc_version_list" in
7353 ''|' ') 
7354         inc_version_list_init='0';;
7355 *)      inc_version_list_init=`echo $inc_version_list |
7356                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7357         ;;
7358 esac
7359 $rm -f getverlist
7360
7361 : determine whether to install perl also as /usr/bin/perl
7362
7363 echo " "
7364 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7365         $cat <<EOM
7366 Many scripts expect perl to be installed as /usr/bin/perl.
7367 I can install the perl you are about to compile also as /usr/bin/perl
7368 (in addition to $installbin/perl).
7369 EOM
7370         case "$installusrbinperl" in
7371         "$undef"|[nN]*) dflt='n';;
7372         *)              dflt='y';;
7373         esac
7374         rp="Do you want to install perl as /usr/bin/perl?"
7375         . ./myread
7376         case "$ans" in
7377         [yY]*)  val="$define";;
7378         *)      val="$undef" ;;
7379         esac
7380 else
7381         val="$undef"
7382 fi
7383 set installusrbinperl
7384 eval $setvar
7385
7386 : see if dld is available
7387 set dld.h i_dld
7388 eval $inhdr
7389
7390 : see if dlopen exists
7391 xxx_runnm="$runnm"
7392 runnm=false
7393 set dlopen d_dlopen
7394 eval $inlibc
7395 runnm="$xxx_runnm"
7396
7397 : determine which dynamic loading, if any, to compile in
7398 echo " "
7399 dldir="ext/DynaLoader"
7400 case "$usedl" in
7401 $define|y|true)
7402         dflt='y'
7403         usedl="$define"
7404         ;;
7405 $undef|n|false)
7406         dflt='n'
7407         usedl="$undef"
7408         ;;
7409 *) 
7410         dflt='n'
7411         case "$d_dlopen" in
7412             $define) dflt='y' ;;
7413         esac
7414         case "$i_dld" in
7415             $define) dflt='y' ;;
7416         esac
7417         : Does a dl_xxx.xs file exist for this operating system
7418         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7419         ;;
7420 esac
7421 rp="Do you wish to use dynamic loading?"
7422 . ./myread
7423 usedl="$ans"
7424 case "$ans" in
7425 y*) usedl="$define"
7426         case "$dlsrc" in
7427         '')
7428                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7429                         dflt="$dldir/dl_${osname}.xs"
7430                 elif $test "$d_dlopen" = "$define" ; then
7431                         dflt="$dldir/dl_dlopen.xs"
7432                 elif $test "$i_dld" = "$define" ; then
7433                         dflt="$dldir/dl_dld.xs"
7434                 else
7435                         dflt=''
7436                 fi
7437                 ;;
7438         *)      dflt="$dldir/$dlsrc"
7439                 ;;
7440         esac
7441     echo "The following dynamic loading files are available:"
7442         : Can not go over to $dldir because getfile has path hard-coded in.
7443         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7444         rp="Source file to use for dynamic loading"
7445         fn="fne"
7446         gfpth="$src"
7447         . ./getfile
7448         usedl="$define"
7449         : emulate basename
7450         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7451
7452         $cat << EOM
7453
7454 Some systems may require passing special flags to $cc -c to
7455 compile modules that will be used to create a shared library.
7456 To use no flags, say "none".
7457
7458 EOM
7459     case "$cccdlflags" in
7460     '') case "$gccversion" in
7461                 '') case "$osname" in
7462                         hpux)   dflt='+z' ;;
7463                         next)   dflt='none' ;;
7464                         irix*)  dflt='-KPIC' ;;
7465                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7466                         sunos)  dflt='-pic' ;;
7467                         *)      dflt='none' ;;
7468                     esac
7469                         ;;
7470                 *)  case "$osname" in
7471                         darwin) dflt='none' ;;
7472                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7473                         *)      dflt='-fpic' ;;
7474                     esac ;;
7475             esac ;;
7476         ' ') dflt='none' ;;
7477     *)  dflt="$cccdlflags" ;;
7478     esac
7479     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7480     . ./myread
7481     case "$ans" in
7482     none) cccdlflags=' ' ;;
7483     *) cccdlflags="$ans" ;;
7484     esac
7485
7486     cat << EOM
7487
7488 Some systems use ld to create libraries that can be dynamically loaded,
7489 while other systems (such as those using ELF) use $cc.
7490
7491 EOM
7492         case "$ld" in
7493         '')     $cat >try.c <<'EOM'
7494 /* Test for whether ELF binaries are produced */
7495 #include <fcntl.h>
7496 #include <stdlib.h>
7497 int main() {
7498         char b[4];
7499         int i = open("a.out",O_RDONLY);
7500         if(i == -1) 
7501                 exit(1); /* fail */
7502         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7503                 exit(0); /* succeed (yes, it's ELF) */
7504         else
7505                 exit(1); /* fail */
7506 }
7507 EOM
7508                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7509                         cat <<EOM
7510 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7511 EOM
7512                         dflt="$cc"
7513                 else
7514                         echo "I'll use ld to build dynamic libraries."
7515                         dflt='ld'
7516                 fi
7517                 rm -f try.c a.out
7518                 ;;
7519         *)      dflt="$ld"
7520                 ;;
7521         esac
7522
7523     rp="What command should be used to create dynamic libraries?"
7524     . ./myread
7525         ld="$ans"
7526
7527     cat << EOM
7528
7529 Some systems may require passing special flags to $ld to create a
7530 library that can be dynamically loaded.  If your ld flags include
7531 -L/other/path options to locate libraries outside your loader's normal
7532 search path, you may need to specify those -L options here as well.  To
7533 use no flags, say "none".
7534
7535 EOM
7536     case "$lddlflags" in
7537     '') case "$osname" in
7538                         beos) dflt='-nostart' ;;
7539                         hpux) dflt='-b';
7540                               case "$gccversion" in
7541                               '') dflt="$dflt +vnocompatwarnings" ;;
7542                               esac
7543                               ;;        
7544                         linux|irix*)    dflt='-shared' ;;
7545                         next)  dflt='none' ;;
7546                         solaris) dflt='-G' ;;
7547                         sunos) dflt='-assert nodefinitions' ;;
7548                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7549                 *)     dflt='none' ;;
7550                         esac
7551                         ;;
7552     *) dflt="$lddlflags" ;;
7553     esac
7554
7555         : Try to guess additional flags to pick up local libraries.
7556         : Be careful not to append to a plain 'none'
7557         case "$dflt" in
7558         none) dflt='' ;;
7559         esac
7560         for thisflag in $ldflags; do
7561                 case "$thisflag" in
7562                 -L*|-R*|-Wl,-R*)
7563                         case " $dflt " in
7564                         *" $thisflag "*) ;;
7565                         *) dflt="$dflt $thisflag" ;;
7566                         esac
7567                         ;;
7568                 esac
7569         done
7570
7571         case "$dflt" in
7572         ''|' ') dflt='none' ;;
7573         esac
7574
7575     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7576     . ./myread
7577     case "$ans" in
7578     none) lddlflags=' ' ;;
7579     *) lddlflags="$ans" ;;
7580     esac
7581
7582         cat <<EOM
7583
7584 Some systems may require passing special flags to $cc to indicate that
7585 the resulting executable will use dynamic linking.  To use no flags,
7586 say "none".
7587
7588 EOM
7589     case "$ccdlflags" in
7590     '') case "$osname" in
7591                 hpux)   dflt='-Wl,-E' ;;
7592                 linux)  dflt='-rdynamic' ;;
7593                 next)   dflt='none' ;;
7594                 sunos)  dflt='none' ;;
7595                 *)      dflt='none' ;;
7596             esac ;;
7597     ' ')  dflt='none' ;;
7598     *)  dflt="$ccdlflags" ;;
7599     esac
7600     rp="Any special flags to pass to $cc to use dynamic linking?"
7601     . ./myread
7602     case "$ans" in
7603     none) ccdlflags=' ' ;;
7604     *) ccdlflags="$ans" ;;
7605     esac
7606     ;;
7607 *)  usedl="$undef"
7608         ld='ld'
7609     dlsrc='dl_none.xs'
7610     lddlflags=''
7611     ccdlflags=''
7612     ;;
7613 esac
7614
7615 also=''
7616 case "$usedl" in
7617 $undef)
7618         # No dynamic loading being used, so don't bother even to prompt.
7619         useshrplib='false'
7620         ;;
7621 *)      case "$useshrplib" in
7622         '')     case "$osname" in
7623                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7624                         dflt=y
7625                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7626                         ;;
7627                 next*)
7628                         case "$osvers" in
7629                         4*)     dflt=y
7630                                 also='Building a shared libperl is needed for MAB support.'
7631                                 ;;
7632                         *)      dflt=n
7633                                 ;;
7634                         esac
7635                         ;;
7636                 *)      dflt=n
7637                         ;;
7638                 esac
7639                 ;;
7640         $define|true|[Yy]*)
7641                 dflt=y
7642                 ;;
7643         *)      dflt=n
7644                 ;;
7645         esac
7646         $cat << EOM
7647
7648 The perl executable is normally obtained by linking perlmain.c with
7649 libperl${_a}, any static extensions (usually just DynaLoader), and
7650 any other libraries needed on this system (such as -lm, etc.).  Since
7651 your system supports dynamic loading, it is probably possible to build
7652 a shared libperl.$so.  If you will have more than one executable linked
7653 to libperl.$so, this will significantly reduce the size of each
7654 executable, but it may have a noticeable affect on performance.  The
7655 default is probably sensible for your system.
7656 $also
7657
7658 EOM
7659         rp="Build a shared libperl.$so (y/n)"
7660         . ./myread
7661         case "$ans" in
7662         true|$define|[Yy]*)
7663                 useshrplib='true'  ;;
7664         *)      useshrplib='false' ;;
7665         esac
7666         ;;
7667 esac
7668
7669 case "$useshrplib" in
7670 true)
7671         case "$libperl" in
7672         '')
7673                 # Figure out a good name for libperl.so.  Since it gets stored in
7674                 # a version-specific architecture-dependent library, the version
7675                 # number isn't really that important, except for making cc/ld happy.
7676                 #
7677                 # A name such as libperl.so.3.1
7678                 majmin="libperl.$so.$patchlevel.$subversion"
7679                 # A name such as libperl.so.301
7680                 majonly=`echo $patchlevel $subversion |
7681                         $awk '{printf "%d%02d", $1, $2}'`
7682                 majonly=libperl.$so.$majonly
7683                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7684                 # rely on figuring it out from the naming of libc.
7685                 case "${osname}${osvers}" in
7686                 next4*)
7687                         dflt=libperl.5.$so
7688                         # XXX How handle the --version stuff for MAB?
7689                         ;;
7690                 linux*)  # ld won't link with a bare -lperl otherwise.
7691                         dflt=libperl.$so
7692                         ;;
7693                 cygwin*) # ld links against an importlib
7694                         dflt=libperl$lib_ext
7695                         ;;
7696                 *)      # Try to guess based on whether libc has major.minor.
7697                         case "$libc" in
7698                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7699                         *libc.$so.[0-9]*) dflt=$majonly ;;
7700                         *)      dflt=libperl.$so ;;
7701                         esac
7702                         ;;
7703                 esac
7704                 ;;
7705         *)      dflt=$libperl
7706                 ;;
7707         esac
7708         cat << EOM
7709
7710 I need to select a good name for the shared libperl.  If your system uses
7711 library names with major and minor numbers, then you might want something
7712 like $majmin.  Alternatively, if your system uses a single version
7713 number for shared libraries, then you might want to use $majonly.
7714 Or, your system might be quite happy with a simple libperl.$so.
7715
7716 Since the shared libperl will get installed into a version-specific
7717 architecture-dependent directory, the version number of the shared perl
7718 library probably isn't important, so the default should be o.k.
7719
7720 EOM
7721         rp='What name do you want to give to the shared libperl?'
7722         . ./myread
7723         libperl=$ans
7724         echo "Ok, I'll use $libperl"
7725         ;;
7726 *)
7727         libperl="libperl${_a}"
7728         ;;
7729 esac
7730
7731 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7732 case "$shrpdir" in
7733 '') ;;
7734 *)      $cat >&4 <<EOM
7735 WARNING:  Use of the shrpdir variable for the installation location of
7736 the shared $libperl is not supported.  It was never documented and
7737 will not work in this version.  Let me (perlbug@perl.org)
7738 know of any problems this may cause.
7739
7740 EOM
7741         case "$shrpdir" in
7742         "$archlibexp/CORE")
7743                 $cat >&4 <<EOM
7744 But your current setting of $shrpdir is
7745 the default anyway, so it's harmless.
7746 EOM
7747                 ;;
7748         *)
7749                 $cat >&4 <<EOM
7750 Further, your current attempted setting of $shrpdir
7751 conflicts with the value of $archlibexp/CORE
7752 that installperl will use.
7753 EOM
7754                 ;;
7755         esac
7756         ;;
7757 esac
7758
7759 # How will the perl executable find the installed shared $libperl?
7760 # Add $xxx to ccdlflags.
7761 # If we can't figure out a command-line option, use $shrpenv to
7762 # set env LD_RUN_PATH.  The main perl makefile uses this.
7763 shrpdir=$archlibexp/CORE
7764 xxx=''
7765 tmp_shrpenv=''
7766 if "$useshrplib"; then
7767     case "$osname" in 
7768         aix)
7769                 # We'll set it in Makefile.SH...
7770                 ;;
7771         solaris)
7772                 xxx="-R $shrpdir"
7773                 ;;
7774         freebsd|netbsd)
7775                 xxx="-Wl,-R$shrpdir"
7776                 ;;
7777         bsdos|linux|irix*|dec_osf)
7778                 xxx="-Wl,-rpath,$shrpdir"
7779                 ;;
7780         next)
7781                 # next doesn't like the default...
7782                 ;;
7783         beos)
7784                 # beos doesn't like the default, either.
7785                 ;;
7786         hpux*)
7787                 # hpux doesn't like the default, either.
7788                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7789                 ;;
7790         *)
7791                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7792                 ;;
7793         esac
7794         case "$xxx" in
7795         '') ;;
7796         *)      
7797                 # Only add $xxx if it isn't already in ccdlflags.
7798                 case " $ccdlflags " in
7799                 *" $xxx "*)     ;;
7800                 *)      ccdlflags="$ccdlflags $xxx"
7801                         cat <<EOM >&4
7802
7803 Adding $xxx to the flags
7804 passed to $ld so that the perl executable will find the 
7805 installed shared $libperl.
7806
7807 EOM
7808                         ;;
7809                 esac
7810                 ;;
7811         esac
7812 fi
7813 # Fix ccdlflags in AIX for building external extensions.
7814 # (For building Perl itself bare -bE:perl.exp is needed,
7815 #  Makefile.SH takes care of this.)
7816 case "$osname" in
7817 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7818 esac
7819 # Respect a hint or command-line value.
7820 case "$shrpenv" in
7821 '') shrpenv="$tmp_shrpenv" ;;
7822 esac
7823 case "$ldlibpthname" in
7824 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7825 none)   ldlibpthname='' ;;
7826 esac
7827
7828 : determine where manual pages are on this system
7829 echo " "
7830 case "$sysman" in
7831 '') 
7832         syspath='/usr/share/man/man1 /usr/man/man1'
7833         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7834         syspath="$syspath /usr/man/u_man/man1"
7835         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7836         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7837         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7838         sysman=`./loc . /usr/man/man1 $syspath`
7839         ;;
7840 esac
7841 if $test -d "$sysman"; then
7842         echo "System manual is in $sysman." >&4
7843 else
7844         echo "Could not find manual pages in source form." >&4
7845 fi
7846
7847 : determine where manual pages go
7848 set man1dir man1dir none
7849 eval $prefixit
7850 $cat <<EOM
7851
7852 $spackage has manual pages available in source form.
7853 EOM
7854 case "$nroff" in
7855 nroff)
7856         echo "However, you don't have nroff, so they're probably useless to you."
7857         case "$man1dir" in
7858         '') man1dir="none";;
7859         esac;;
7860 esac
7861 echo "If you don't want the manual sources installed, answer 'none'."
7862 case "$man1dir" in
7863 ' ') dflt=none
7864         ;;
7865 '')
7866         lookpath="$prefixexp/share/man/man1"
7867         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7868         lookpath="$lookpath $prefixexp/man/p_man/man1"
7869         lookpath="$lookpath $prefixexp/man/u_man/man1"
7870         lookpath="$lookpath $prefixexp/man/man.1"
7871         case "$sysman" in
7872         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7873         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7874         esac
7875         set dflt
7876         eval $prefixup
7877         ;;
7878 *)  dflt="$man1dir"
7879         ;;
7880 esac
7881 echo " "
7882 fn=dn+~
7883 rp="Where do the main $spackage manual pages (source) go?"
7884 . ./getfile
7885 if $test "X$man1direxp" != "X$ansexp"; then
7886         installman1dir=''
7887 fi
7888 man1dir="$ans"
7889 man1direxp="$ansexp"
7890 case "$man1dir" in
7891 '')     man1dir=' '
7892         installman1dir='';;
7893 esac
7894
7895 : Change installation prefix, if necessary.
7896 if $test X"$prefix" != X"$installprefix"; then
7897         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7898 else
7899         installman1dir="$man1direxp"
7900 fi
7901
7902 : What suffix to use on installed man pages
7903
7904 case "$man1dir" in
7905 ' ')
7906         man1ext='0'
7907         ;;
7908 *)
7909         rp="What suffix should be used for the main $spackage man pages?"
7910         case "$man1ext" in
7911         '')     case "$man1dir" in
7912                 *1)  dflt=1 ;;
7913                 *1p) dflt=1p ;;
7914                 *1pm) dflt=1pm ;;
7915                 *l) dflt=l;;
7916                 *n) dflt=n;;
7917                 *o) dflt=o;;
7918                 *p) dflt=p;;
7919                 *C) dflt=C;;
7920                 *L) dflt=L;;
7921                 *L1) dflt=L1;;
7922                 *) dflt=1;;
7923                 esac
7924                 ;;
7925         *)      dflt="$man1ext";;
7926         esac
7927         . ./myread
7928         man1ext="$ans"
7929         ;;
7930 esac
7931
7932 : see if we can have long filenames
7933 echo " "
7934 first=123456789abcdef
7935 $rm -f $first
7936 if (echo hi >$first) 2>/dev/null; then
7937         if $test -f 123456789abcde; then
7938                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7939                 val="$undef"
7940         else
7941                 echo 'You can have filenames longer than 14 characters.'>&4
7942                 val="$define"
7943         fi
7944 else
7945         $cat <<'EOM'
7946 You can't have filenames longer than 14 chars.
7947 You can't even think about them!
7948 EOM
7949         val="$undef"
7950 fi 
7951 set d_flexfnam
7952 eval $setvar
7953 $rm -rf 123456789abcde*
7954
7955 : determine where library module manual pages go
7956 set man3dir man3dir none
7957 eval $prefixit
7958 $cat <<EOM
7959
7960 $spackage has manual pages for many of the library modules.
7961 EOM
7962
7963 case "$nroff" in
7964 nroff)
7965         $cat <<'EOM'
7966 However, you don't have nroff, so they're probably useless to you.
7967 EOM
7968         case "$man3dir" in
7969         '') man3dir="none";;
7970         esac;;
7971 esac
7972
7973 case "$d_flexfnam" in
7974 undef)
7975         $cat <<'EOM'
7976 However, your system can't handle the long file names like File::Basename.3. 
7977 EOM
7978         case "$man3dir" in
7979         '') man3dir="none";;
7980         esac;;
7981 esac
7982
7983 echo "If you don't want the manual sources installed, answer 'none'."
7984 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7985 case "$man3dir" in
7986 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7987         if $test -d "$privlib/man/man3"; then
7988                 cat <<EOM >&4
7989
7990 WARNING:  Previous versions of perl installed man3 pages into
7991 $privlib/man/man3.  This version will suggest a 
7992 new default of $dflt.  
7993 EOM
7994                 tdflt=$dflt
7995                 dflt='n'
7996                 rp='Do you wish to preserve the old behavior?(y/n)'
7997                 . ./myread
7998                 case "$ans" in
7999                 y*) dflt="$privlib/man/man3" ;;
8000                 *)  dflt=$tdflt ;;
8001                 esac
8002     fi
8003         ;;
8004 *)      dflt="$man3dir" ;;
8005 esac
8006 case "$dflt" in
8007 ' ') dflt=none ;;
8008 esac
8009 echo " "
8010 fn=dn+~
8011 rp="Where do the $package library man pages (source) go?"
8012 . ./getfile
8013 man3dir="$ans"
8014 man3direxp="$ansexp"
8015 case "$man3dir" in
8016 '')     man3dir=' '
8017         installman3dir='';;
8018 esac
8019
8020 : Change installation prefix, if necessary.
8021 if $test X"$prefix" != X"$installprefix"; then
8022         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8023 else
8024         installman3dir="$man3direxp"
8025 fi
8026
8027 : What suffix to use on installed man pages
8028 case "$man3dir" in
8029 ' ')
8030         man3ext='0'
8031         ;;
8032 *)
8033         rp="What suffix should be used for the $package library man pages?"
8034         case "$man3ext" in
8035         '')     case "$man3dir" in
8036                 *3)  dflt=3 ;;
8037                 *3p) dflt=3p ;;
8038                 *3pm) dflt=3pm ;;
8039                 *l) dflt=l;;
8040                 *n) dflt=n;;
8041                 *o) dflt=o;;
8042                 *p) dflt=p;;
8043                 *C) dflt=C;;
8044                 *L) dflt=L;;
8045                 *L3) dflt=L3;;
8046                 *) dflt=3;;
8047                 esac
8048                 ;;
8049         *)      dflt="$man3ext";;
8050         esac
8051         . ./myread
8052         man3ext="$ans"
8053         ;;
8054 esac
8055
8056 : see if we have to deal with yellow pages, now NIS.
8057 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8058         if $test -f /usr/etc/nibindd; then
8059                 echo " "
8060                 echo "I'm fairly confident you're on a NeXT."
8061                 echo " "
8062                 rp='Do you get the hosts file via NetInfo?'
8063                 dflt=y
8064                 case "$hostcat" in
8065                 nidump*) ;;
8066                 '') ;;
8067                 *) dflt=n;;
8068                 esac
8069                 . ./myread
8070                 case "$ans" in
8071                 y*) hostcat='nidump hosts .';;
8072                 *)      case "$hostcat" in
8073                         nidump*) hostcat='';;
8074                         esac
8075                         ;;
8076                 esac
8077         fi
8078         case "$hostcat" in
8079         nidump*) ;;
8080         *)
8081                 case "$hostcat" in
8082                 *ypcat*) dflt=y;;
8083                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8084                                 dflt=y
8085                         else
8086                                 dflt=n
8087                         fi;;
8088                 *) dflt=n;;
8089                 esac
8090                 echo " "
8091                 rp='Are you getting the hosts file via yellow pages?'
8092                 . ./myread
8093                 case "$ans" in
8094                 y*) hostcat='ypcat hosts';;
8095                 *) hostcat='cat /etc/hosts';;
8096                 esac
8097                 ;;
8098         esac
8099 fi
8100 case "$hostcat" in
8101 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8102 esac
8103 case "$groupcat" in
8104 '') test -f /etc/group && groupcat='cat /etc/group';;
8105 esac
8106 case "$passcat" in
8107 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8108 esac
8109
8110 : now get the host name
8111 echo " "
8112 echo "Figuring out host name..." >&4
8113 case "$myhostname" in
8114 '') cont=true
8115         echo 'Maybe "hostname" will work...'
8116         if tans=`sh -c hostname 2>&1` ; then
8117                 myhostname=$tans
8118                 phostname=hostname
8119                 cont=''
8120         fi
8121         ;;
8122 *) cont='';;
8123 esac
8124 if $test "$cont"; then
8125         if ./xenix; then
8126                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8127                 if tans=`cat /etc/systemid 2>&1` ; then
8128                         myhostname=$tans
8129                         phostname='cat /etc/systemid'
8130                         echo "Whadyaknow.  Xenix always was a bit strange..."
8131                         cont=''
8132                 fi
8133         elif $test -r /etc/systemid; then
8134                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8135         fi
8136 fi
8137 if $test "$cont"; then
8138         echo 'No, maybe "uuname -l" will work...'
8139         if tans=`sh -c 'uuname -l' 2>&1` ; then
8140                 myhostname=$tans
8141                 phostname='uuname -l'
8142         else
8143                 echo 'Strange.  Maybe "uname -n" will work...'
8144                 if tans=`sh -c 'uname -n' 2>&1` ; then
8145                         myhostname=$tans
8146                         phostname='uname -n'
8147                 else
8148                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8149                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8150                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8151                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8152                         else
8153                                 case "$myhostname" in
8154                                 '') echo "Does this machine have an identity crisis or something?"
8155                                         phostname='';;
8156                                 *)
8157                                         echo "Well, you said $myhostname before..."
8158                                         phostname='echo $myhostname';;
8159                                 esac
8160                         fi
8161                 fi
8162         fi
8163 fi
8164 case "$myhostname" in
8165 '') myhostname=noname ;;
8166 esac
8167 : you do not want to know about this
8168 set $myhostname
8169 myhostname=$1
8170
8171 : verify guess
8172 if $test "$myhostname" ; then
8173         dflt=y
8174         rp='Your host name appears to be "'$myhostname'".'" Right?"
8175         . ./myread
8176         case "$ans" in
8177         y*) ;;
8178         *) myhostname='';;
8179         esac
8180 fi
8181
8182 : bad guess or no guess
8183 while $test "X$myhostname" = X ; do
8184         dflt=''
8185         rp="Please type the (one word) name of your host:"
8186         . ./myread
8187         myhostname="$ans"
8188 done
8189
8190 : translate upper to lower if necessary
8191 case "$myhostname" in
8192 *[A-Z]*)
8193         echo "(Normalizing case in your host name)"
8194         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8195         ;;
8196 esac
8197
8198 case "$myhostname" in
8199 *.*)
8200         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8201         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8202         echo "(Trimming domain name from host name--host name is now $myhostname)"
8203         ;;
8204 *) case "$mydomain" in
8205         '')
8206                 {
8207                         test "X$hostcat" = "Xypcat hosts" &&
8208                         ypmatch "$myhostname" hosts 2>/dev/null |\
8209                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8210                         $test -s hosts
8211                 } || {
8212                         test "X$hostcat" != "X" &&
8213                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8214                                         /[       ]$myhostname[  . ]/p" > hosts
8215                 }
8216                 tmp_re="[       . ]"
8217                 if $test -f hosts; then
8218                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8219                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8220                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8221                                 hosts | $sort | $uniq | \
8222                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8223                         case `$echo X$dflt` in
8224                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8225                                 dflt=.
8226                                 ;;
8227                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8228                                 ;;
8229                         esac
8230                 else
8231                         echo "(I cannot locate a hosts database anywhere)"
8232                         dflt=.
8233                 fi
8234                 case "$dflt" in
8235                 .)
8236                         tans=`./loc resolv.conf X /etc /usr/etc`
8237                         if $test -f "$tans"; then
8238                                 echo "(Attempting domain name extraction from $tans)"
8239                                 dflt=.`$sed -n -e 's/   / /g' \
8240                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8241                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8242                                 case "$dflt" in
8243                                 .) dflt=.`$sed -n -e 's/        / /g' \
8244                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8245                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8246                                         ;;
8247                                 esac
8248                         fi
8249                         ;;
8250                 esac
8251                 case "$dflt" in
8252                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8253                         dflt=.`sh -c domainname 2>/dev/null`
8254                         case "$dflt" in
8255                         '') dflt='.';;
8256                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8257                         esac
8258                         ;;
8259                 esac
8260                 case "$dflt$osname" in
8261                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8262                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8263                         ;;
8264                 esac
8265                 case "$dflt" in
8266                 .) echo "(Lost all hope -- silly guess then)"
8267                         dflt='.nonet'
8268                         ;;
8269                 esac
8270                 $rm -f hosts
8271                 ;;
8272         *) dflt="$mydomain";;
8273         esac;;
8274 esac
8275 echo " "
8276 rp="What is your domain name?"
8277 . ./myread
8278 tans="$ans"
8279 case "$ans" in
8280 '') ;;
8281 .*) ;;
8282 *) tans=".$tans";;
8283 esac
8284 mydomain="$tans"
8285
8286 : translate upper to lower if necessary
8287 case "$mydomain" in
8288 *[A-Z]*)
8289         echo "(Normalizing case in your domain name)"
8290         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8291         ;;
8292 esac
8293
8294 : a little sanity check here
8295 case "$phostname" in
8296 '') ;;
8297 *)
8298         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8299         $myhostname$mydomain|$myhostname) ;;
8300         *)
8301                 case "$phostname" in
8302                 sed*)
8303                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8304                         ;;
8305                 *)
8306                         echo "(That doesn't agree with your $phostname command, by the way.)"
8307                         ;;
8308                 esac
8309         ;;
8310         esac
8311         ;;
8312 esac
8313
8314 $cat <<EOM
8315
8316 I need to get your e-mail address in Internet format if possible, i.e.
8317 something like user@host.domain. Please answer accurately since I have
8318 no easy means to double check it. The default value provided below
8319 is most probably close to reality but may not be valid from outside
8320 your organization...
8321
8322 EOM
8323 cont=x
8324 while test "$cont"; do
8325         case "$cf_email" in
8326         '') dflt="$cf_by@$myhostname$mydomain";;
8327         *) dflt="$cf_email";;
8328         esac
8329         rp='What is your e-mail address?'
8330         . ./myread
8331         cf_email="$ans"
8332         case "$cf_email" in
8333         *@*.*) cont='' ;;
8334         *)
8335                 rp='Address does not look like an Internet one.  Use it anyway?'
8336                 case "$fastread" in
8337                 yes) dflt=y ;;
8338                 *) dflt=n ;;
8339                 esac
8340                 . ./myread
8341                 case "$ans" in
8342                 y*) cont='' ;;
8343                 *) echo " " ;;
8344                 esac
8345                 ;;
8346         esac
8347 done
8348
8349 $cat <<EOM
8350
8351 If you or somebody else will be maintaining perl at your site, please
8352 fill in the correct e-mail address here so that they may be contacted
8353 if necessary. Currently, the "perlbug" program included with perl
8354 will send mail to this address in addition to perlbug@perl.org. You may
8355 enter "none" for no administrator.
8356
8357 EOM
8358 case "$perladmin" in
8359 '') dflt="$cf_email";;
8360 *) dflt="$perladmin";;
8361 esac
8362 rp='Perl administrator e-mail address'
8363 . ./myread
8364 perladmin="$ans"
8365
8366 : determine whether to only install version-specific parts.
8367 echo " "
8368 $cat <<EOM
8369 Do you want to install only the version-specific parts of the perl
8370 distribution?  Usually you do *not* want to do this.
8371 EOM
8372 case "$versiononly" in
8373 "$define"|[Yy]*|true) dflt='y' ;;
8374 *) dflt='n';
8375 esac
8376 rp="Do you want to install only the version-specific parts of perl?"
8377 . ./myread
8378 case "$ans" in
8379 [yY]*)  val="$define";;
8380 *)      val="$undef" ;;
8381 esac
8382 set versiononly
8383 eval $setvar
8384
8385 : figure out how to guarantee perl startup
8386 case "$startperl" in
8387 '')
8388         case "$sharpbang" in
8389         *!)
8390                 $cat <<EOH
8391
8392 I can use the #! construct to start perl on your system. This will
8393 make startup of perl scripts faster, but may cause problems if you
8394 want to share those scripts and perl is not in a standard place
8395 ($binexp/perl) on all your platforms. The alternative is to force
8396 a shell by starting the script with a single ':' character.
8397
8398 EOH
8399                 case "$versiononly" in
8400                 "$define")      dflt="$binexp/perl$version";;  
8401                 *)              dflt="$binexp/perl";;
8402                 esac
8403                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8404                 . ./myread
8405                 case "$ans" in
8406                 none)   startperl=": # use perl";;
8407                 *)      startperl="#!$ans"
8408                         if $test 30 -lt `echo "$ans" | wc -c`; then
8409                                 $cat >&4 <<EOM
8410
8411 WARNING:  Some systems limit the #! command to 32 characters.
8412 If you experience difficulty running Perl scripts with #!, try
8413 installing Perl in a directory with a shorter pathname.
8414
8415 EOM
8416                         fi ;;
8417                 esac
8418                 ;;
8419         *) startperl=": # use perl"
8420                 ;;
8421         esac
8422         ;;
8423 esac
8424 echo "I'll use $startperl to start perl scripts."
8425
8426 : figure best path for perl in scripts
8427 case "$perlpath" in
8428 '')
8429         case "$versiononly" in
8430         "$define")      perlpath="$binexp/perl$version";;
8431         *)              perlpath="$binexp/perl";;
8432         esac
8433         case "$startperl" in
8434         *!*) ;;
8435         *)
8436                 $cat <<EOH
8437
8438 I will use the "eval 'exec'" idiom to start Perl on your system.
8439 I can use the full path of your Perl binary for this purpose, but
8440 doing so may cause problems if you want to share those scripts and
8441 Perl is not always in a standard place ($binexp/perl).
8442
8443 EOH
8444                 dflt="$binexp/perl"
8445                 rp="What path shall I use in \"eval 'exec'\"?"
8446                 . ./myread
8447                 perlpath="$ans"
8448                 ;;
8449         esac
8450         ;;
8451 esac
8452 case "$startperl" in
8453 *!*)    ;;
8454 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8455 esac
8456
8457 : determine where public executable scripts go
8458 set scriptdir scriptdir
8459 eval $prefixit
8460 case "$scriptdir" in
8461 '')
8462         dflt="$bin"
8463         : guess some guesses
8464         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8465         $test -d /usr/share/bin     && dflt=/usr/share/bin
8466         $test -d /usr/local/script  && dflt=/usr/local/script
8467         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8468         $test -d $prefixexp/script  && dflt=$prefixexp/script
8469         set dflt
8470         eval $prefixup
8471         ;;
8472 *)  dflt="$scriptdir"
8473         ;;
8474 esac
8475 $cat <<EOM
8476  
8477 Some installations have a separate directory just for executable scripts so
8478 that they can mount it across multiple architectures but keep the scripts in
8479 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8480 Or you might just lump your scripts in with all your other executables.
8481  
8482 EOM
8483 fn=d~
8484 rp='Where do you keep publicly executable scripts?'
8485 . ./getfile
8486 if $test "X$ansexp" != "X$scriptdirexp"; then
8487         installscript=''
8488 fi
8489 scriptdir="$ans"
8490 scriptdirexp="$ansexp"
8491 : Change installation prefix, if necessary.
8492 if $test X"$prefix" != X"$installprefix"; then
8493         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8494 else
8495         installscript="$scriptdirexp"
8496 fi
8497
8498 : determine where add-on public executables go
8499 case "$sitebin" in
8500 '')     dflt=$siteprefix/bin ;;
8501 *)      dflt=$sitebin ;;
8502 esac
8503 fn=d~
8504 rp='Pathname where the add-on public executables should be installed?'
8505 . ./getfile
8506 sitebin="$ans"
8507 sitebinexp="$ansexp"
8508 : Change installation prefix, if necessary.
8509 if $test X"$prefix" != X"$installprefix"; then
8510         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8511 else
8512         installsitebin="$sitebinexp"
8513 fi
8514
8515 : define an is-a-typedef? function
8516 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8517 case "$inclist" in
8518 "") inclist="sys/types.h";;
8519 esac;
8520 eval "varval=\$$var";
8521 case "$varval" in
8522 "")
8523         $rm -f temp.c;
8524         for inc in $inclist; do
8525                 echo "#include <$inc>" >>temp.c;
8526         done;
8527         echo "#ifdef $type" >> temp.c;
8528         echo "printf(\"We have $type\");" >> temp.c;
8529         echo "#endif" >> temp.c;
8530         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8531         if $contains $type temp.E >/dev/null 2>&1; then
8532                 eval "$var=\$type";
8533         else
8534                 eval "$var=\$def";
8535         fi;
8536         $rm -f temp.?;;
8537 *) eval "$var=\$varval";;
8538 esac'
8539
8540 : define an is-a-typedef? function that prompts if the type is not available.
8541 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8542 case "$inclist" in
8543 "") inclist="sys/types.h";;
8544 esac;
8545 eval "varval=\$$var";
8546 case "$varval" in
8547 "")
8548         $rm -f temp.c;
8549         for inc in $inclist; do
8550                 echo "#include <$inc>" >>temp.c;
8551         done;
8552         echo "#ifdef $type" >> temp.c;
8553         echo "printf(\"We have $type\");" >> temp.c;
8554         echo "#endif" >> temp.c;
8555         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8556         echo " " ;
8557         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8558         if $contains $type temp.E >/dev/null 2>&1; then
8559                 echo "$type found." >&4;
8560                 eval "$var=\$type";
8561         else
8562                 echo "$type NOT found." >&4;
8563                 dflt="$def";
8564                 . ./myread ;
8565                 eval "$var=\$ans";
8566         fi;
8567         $rm -f temp.?;;
8568 *) eval "$var=\$varval";;
8569 esac'
8570
8571 : see what type lseek is declared as in the kernel
8572 rp="What is the type used for lseek's offset on this system?"
8573 set off_t lseektype long stdio.h sys/types.h
8574 eval $typedef_ask
8575
8576 echo " "
8577 echo "Checking to see how big your file offsets are..." >&4
8578 $cat >try.c <<EOCP
8579 #include <sys/types.h>
8580 #include <stdio.h>
8581 int main()
8582 {
8583     printf("%d\n", (int)sizeof($lseektype));
8584     return(0); 
8585 }
8586 EOCP
8587 set try
8588 if eval $compile_ok; then
8589         lseeksize=`$run ./try`
8590         echo "Your file offsets are $lseeksize bytes long."
8591 else
8592         dflt=$longsize
8593         echo " "
8594         echo "(I can't seem to compile the test program.  Guessing...)"
8595         rp="What is the size of your file offsets (in bytes)?"
8596         . ./myread
8597         lseeksize="$ans"
8598 fi
8599 $rm -f try.c try
8600
8601 : see what type file positions are declared as in the library
8602 rp="What is the type for file position used by fsetpos()?"
8603 set fpos_t fpostype long stdio.h sys/types.h
8604 eval $typedef_ask
8605
8606 echo " "
8607 case "$fpostype" in
8608 *_t) zzz="$fpostype"    ;;
8609 *)   zzz="fpos_t"       ;;
8610 esac
8611 echo "Checking the size of $zzz..." >&4 
8612 cat > try.c <<EOCP
8613 #include <sys/types.h>
8614 #include <stdio.h>
8615 int main() {
8616     printf("%d\n", (int)sizeof($fpostype));
8617     exit(0);
8618 }
8619 EOCP
8620 set try
8621 if eval $compile_ok; then
8622         yyy=`$run ./try`
8623         case "$yyy" in
8624         '')     fpossize=4
8625                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8626                 ;;
8627         *)      fpossize=$yyy
8628                 echo "Your $zzz is $fpossize bytes long."
8629                 ;;
8630         esac
8631 else
8632         dflt="$longsize"
8633         echo " " >&4
8634         echo "(I can't compile the test program.  Guessing...)" >&4
8635         rp="What is the size of your file positions (in bytes)?"
8636         . ./myread
8637         fpossize="$ans"
8638 fi
8639
8640
8641
8642 # Backward compatibility (uselfs is deprecated).
8643 case "$uselfs" in
8644 "$define"|true|[yY]*)
8645         cat <<EOM >&4
8646
8647 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8648 EOM
8649         uselargefiles="$define"
8650         ;;
8651 esac                          
8652
8653 case "$lseeksize:$fpossize" in
8654 8:8) cat <<EOM
8655
8656 You can have files larger than 2 gigabytes.
8657 EOM
8658    val="$define" ;;
8659 *)    case "$uselargefiles" in
8660    "$undef"|false|[nN]*) dflt='n' ;;
8661    *)   dflt='y' ;;
8662    esac
8663    cat <<EOM
8664
8665 Perl can be built to understand large files (files larger than 2 gigabytes)
8666 on some systems.  To do so, Configure can be run with -Duselargefiles.
8667
8668 If this doesn't make any sense to you, just accept the default '$dflt'.
8669 EOM
8670    rp='Try to understand large files, if available?'
8671    . ./myread
8672    case "$ans" in
8673    y|Y)         val="$define" ;;
8674    *)           val="$undef"  ;;
8675    esac
8676    ;;
8677 esac
8678 set uselargefiles
8679 eval $setvar
8680 case "$uselargefiles" in
8681 "$define")
8682 : Look for a hint-file generated 'call-back-unit'.  If the
8683 : user has specified that a large files perl is to be built,
8684 : we may need to set or change some other defaults.
8685         if $test -f uselargefiles.cbu; then
8686                 echo "Your platform has some specific hints for large file builds, using them..."
8687                 . ./uselargefiles.cbu
8688                 echo " "
8689                 echo "Rechecking to see how big your file offsets are..." >&4
8690                 $cat >try.c <<EOCP
8691 #include <sys/types.h>
8692 #include <stdio.h>
8693 int main()
8694 {
8695     printf("%d\n", (int)sizeof($lseektype));
8696     return(0); 
8697 }
8698 EOCP
8699                 set try
8700                 if eval $compile_ok; then
8701                         lseeksize=`$run ./try`
8702                         $echo "Your file offsets are now $lseeksize bytes long."
8703                 else
8704                         dflt="$lseeksize"
8705                         echo " "
8706                         echo "(I can't seem to compile the test program.  Guessing...)"
8707                         rp="What is the size of your file offsets (in bytes)?"
8708                         . ./myread
8709                         lseeksize="$ans"
8710                 fi
8711                 case "$fpostype" in
8712                 *_t) zzz="$fpostype"    ;;
8713                 *)   zzz="fpos_t"       ;;
8714                 esac
8715                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8716                 $cat > try.c <<EOCP
8717 #include <sys/types.h>
8718 #include <stdio.h>
8719 int main() {
8720     printf("%d\n", (int)sizeof($fpostype));
8721     exit(0);
8722 }
8723 EOCP
8724                 set try
8725                 if eval $compile_ok; then
8726                         yyy=`$run ./try`
8727                         dflt="$lseeksize"
8728                         case "$yyy" in
8729                         '')     echo " "
8730                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8731                                 ;;
8732                         *)      fpossize=$yyy
8733                                 echo " $fpossize bytes." >&4
8734                                 ;;
8735                         esac
8736                 else
8737                         dflt="$fpossize"
8738                         echo " "
8739                         echo "(I can't compile the test program.  Guessing...)" >&4
8740                         rp="What is the size of your file positions (in bytes)?"
8741                         . ./myread
8742                         fpossize="$ans"
8743                 fi
8744                 $rm -f try.c try
8745         fi
8746         ;;
8747 esac
8748
8749 case "$vendorprefix" in
8750 '')     d_vendorbin="$undef"
8751         vendorbin=''
8752         vendorbinexp=''
8753         ;;
8754 *)      d_vendorbin="$define"
8755         : determine where vendor-supplied executables go.
8756         case "$vendorbin" in
8757         '') dflt=$vendorprefix/bin ;;
8758         *)      dflt="$vendorbin" ;;
8759         esac
8760         fn=d~+
8761         rp='Pathname for the vendor-supplied executables directory?'
8762         . ./getfile
8763         vendorbin="$ans"
8764         vendorbinexp="$ansexp"
8765         ;;
8766 esac
8767 : Change installation prefix, if necessary.
8768 if $test X"$prefix" != X"$installprefix"; then
8769         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8770 else
8771         installvendorbin="$vendorbinexp"
8772 fi
8773
8774 : see if qgcvt exists
8775 set qgcvt d_qgcvt
8776 eval $inlibc
8777
8778 : Check how to convert floats to strings.
8779
8780 if test "X$d_Gconvert" = X; then
8781
8782 echo " "
8783 echo "Checking for an efficient way to convert floats to strings."
8784 echo " " > try.c
8785 case "$uselongdouble" in
8786 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8787 esac
8788 case "$d_longdbl" in
8789 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8790 esac
8791 case "$d_PRIgldbl" in
8792 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8793 esac
8794 $cat >>try.c <<EOP
8795 #ifdef TRY_gconvert
8796 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8797 char *myname = "gconvert";
8798 #endif
8799 #ifdef TRY_gcvt
8800 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8801 char *myname = "gcvt";
8802 #endif
8803 #ifdef TRY_qgcvt
8804 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8805 char *myname = "qgcvt";
8806 #define DOUBLETYPE long double
8807 #endif
8808 #ifdef TRY_sprintf
8809 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8810 #ifdef HAS_PRIgldbl
8811 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8812 #else
8813 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8814 #endif
8815 #else
8816 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8817 #endif
8818 char *myname = "sprintf";
8819 #endif
8820
8821 #ifndef DOUBLETYPE
8822 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8823 #define DOUBLETYPE long double
8824 #else
8825 #define DOUBLETYPE double
8826 #endif
8827 #endif
8828
8829 #include <stdio.h>
8830
8831 #define I_STDLIB $i_stdlib
8832 #ifdef I_STDLIB
8833 #include <stdlib.h>
8834 #endif
8835
8836 int
8837 checkit(expect, got)
8838 char *expect;
8839 char *got;
8840 {
8841     if (strcmp(expect, got)) {
8842                 printf("%s oddity:  Expected %s, got %s\n",
8843                         myname, expect, got);
8844                 exit(1);
8845         }
8846 }
8847
8848 int main()
8849
8850         char buf[64]; 
8851         buf[63] = '\0';
8852
8853         /* This must be 1st test on (which?) platform */
8854         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8855         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8856         checkit("0.1", buf);
8857
8858         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8859         checkit("0.01", buf);
8860
8861         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8862         checkit("0.001", buf);
8863
8864         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8865         checkit("0.0001", buf);
8866
8867         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8868         if (strlen(buf) > 5)
8869             checkit("9e-005", buf); /* for Microsoft ?? */
8870         else
8871             checkit("9e-05", buf);
8872
8873         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8874         checkit("1", buf);
8875
8876         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8877         checkit("1.1", buf);
8878
8879         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8880         checkit("1.01", buf);
8881
8882         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8883         checkit("1.001", buf);
8884
8885         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8886         checkit("1.0001", buf);
8887
8888         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8889         checkit("1.00001", buf);
8890
8891         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8892         checkit("1.000001", buf);
8893
8894         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8895         checkit("0", buf);
8896
8897         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8898         checkit("-1", buf);
8899
8900         /* Some Linux gcvt's give 1.e+5 here. */
8901         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8902         checkit("100000", buf);
8903         
8904         /* Some Linux gcvt's give -1.e+5 here. */
8905         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8906         checkit("-100000", buf);
8907
8908         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8909         checkit("123.456", buf);
8910
8911         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8912         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8913         /* 34 should be enough to scare even long double
8914          * places into using the e notation. */
8915         if (strlen(buf) > 5)
8916             checkit("1e+034", buf); /* for Microsoft */
8917         else
8918             checkit("1e+34", buf);
8919
8920         /* For Perl, if you add additional tests here, also add them to
8921          * t/base/num.t for benefit of platforms not using Configure or
8922          * overriding d_Gconvert */
8923
8924         exit(0);
8925 }
8926 EOP
8927 : first add preferred functions to our list
8928 xxx_list=""
8929 for xxx_convert in $gconvert_preference; do
8930     case $xxx_convert in
8931     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8932     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8933     esac 
8934 done
8935 : then add any others
8936 for xxx_convert in gconvert gcvt sprintf; do
8937     case "$xxx_list" in
8938     *$xxx_convert*) ;;
8939     *) xxx_list="$xxx_list $xxx_convert" ;;
8940     esac 
8941 done
8942
8943 case "$d_longdbl$uselongdouble" in
8944 "$define$define")
8945     : again, add prefered functions to our list first
8946     xxx_ld_list=""
8947     for xxx_convert in $gconvert_ld_preference; do
8948         case $xxx_convert in
8949         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8950         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8951         esac
8952     done
8953     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8954     for xxx_convert in qgcvt sprintf $xxx_list; do
8955         case "$xxx_ld_list" in
8956         $xxx_convert*|*" $xxx_convert"*) ;;
8957         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8958         esac
8959     done
8960     : if sprintf cannot do long doubles, move it to the end
8961     if test "$d_PRIgldbl" != "$define"; then
8962         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8963     fi
8964     : if no qgcvt, remove it
8965     if test "$d_qgcvt" != "$define"; then
8966         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8967     fi
8968     : use the ld_list
8969     xxx_list="$xxx_ld_list"
8970     ;;
8971 esac
8972
8973 for xxx_convert in $xxx_list; do
8974         echo "Trying $xxx_convert..."
8975         $rm -f try try$_o
8976         set try -DTRY_$xxx_convert
8977         if eval $compile; then
8978                 echo "$xxx_convert() found." >&4
8979                 if $run ./try; then
8980                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8981                         break;
8982                 else
8983                         echo "...But $xxx_convert didn't work as I expected."
8984                         xxx_convert=''
8985                 fi
8986         else
8987                 echo "$xxx_convert NOT found." >&4
8988         fi
8989 done
8990
8991 if test X$xxx_convert = X; then
8992     echo "*** WHOA THERE!!! ***" >&4
8993     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8994     xxx_convert=sprintf
8995 fi
8996
8997 case "$xxx_convert" in
8998 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8999 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9000 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9001 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9002    "$define$define$define")
9003       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9004    "$define$define$undef")
9005       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9006    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9007    esac
9008    ;;  
9009 esac
9010
9011 fi
9012
9013 : see if _fwalk exists
9014 set fwalk d__fwalk
9015 eval $inlibc
9016
9017 : Initialize h_fcntl
9018 h_fcntl=false
9019
9020 : Initialize h_sysfile
9021 h_sysfile=false
9022
9023 : access call always available on UNIX
9024 set access d_access
9025 eval $inlibc
9026
9027 : locate the flags for 'access()'
9028 case "$d_access" in
9029 "$define")
9030         echo " "
9031         $cat >access.c <<'EOCP'
9032 #include <sys/types.h>
9033 #ifdef I_FCNTL
9034 #include <fcntl.h>
9035 #endif
9036 #ifdef I_SYS_FILE
9037 #include <sys/file.h>
9038 #endif
9039 #ifdef I_UNISTD
9040 #include <unistd.h>
9041 #endif
9042 int main() {
9043         exit(R_OK);
9044 }
9045 EOCP
9046         : check sys/file.h first, no particular reason here
9047         if $test `./findhdr sys/file.h` && \
9048                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9049                 h_sysfile=true;
9050                 echo "<sys/file.h> defines the *_OK access constants." >&4
9051         elif $test `./findhdr fcntl.h` && \
9052                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9053                 h_fcntl=true;
9054                 echo "<fcntl.h> defines the *_OK access constants." >&4
9055         elif $test `./findhdr unistd.h` && \
9056                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9057                 echo "<unistd.h> defines the *_OK access constants." >&4
9058         else
9059                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9060         fi
9061         ;;
9062 esac
9063 $rm -f access*
9064
9065 : see if accessx exists
9066 set accessx d_accessx
9067 eval $inlibc
9068
9069 : see if alarm exists
9070 set alarm d_alarm
9071 eval $inlibc
9072
9073 : define a fucntion to check prototypes
9074 $cat > protochk <<EOSH
9075 $startsh
9076 cc="$cc"
9077 optimize="$optimize"
9078 ccflags="$ccflags"
9079 prototype="$prototype"
9080 define="$define"
9081 rm=$rm
9082 EOSH
9083
9084 $cat >> protochk <<'EOSH'
9085
9086 $rm -f try.c
9087 foo="$1"
9088 shift
9089 while test $# -ge 2; do
9090         case "$1" in
9091                 $define) echo "#include <$2>" >> try.c ;;
9092                 literal) echo "$2" >> try.c ;;
9093         esac
9094     shift 2
9095 done
9096 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9097 cat >> try.c <<'EOCP'
9098 #ifdef CAN_PROTOTYPE
9099 #define _(args) args
9100 #else
9101 #define _(args) ()
9102 #endif
9103 EOCP
9104 echo "$foo" >> try.c
9105 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9106 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9107 status=$?
9108 $rm -f try.[co]
9109 exit $status
9110 EOSH
9111 chmod +x protochk
9112 $eunicefix protochk
9113
9114 hasproto='varname=$1; func=$2; shift; shift;
9115 while $test $# -ge 2; do
9116         case "$1" in
9117         $define) echo "#include <$2>";;
9118         esac ;
9119     shift 2;
9120 done > try.c;
9121 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9122 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9123         echo "$func() prototype found.";
9124         val="$define";
9125 else
9126         echo "$func() prototype NOT found.";
9127         val="$undef";
9128 fi;
9129 set $varname;
9130 eval $setvar;
9131 $rm -f try.c tryout.c'
9132
9133 : see if sys/types.h has to be included
9134 set sys/types.h i_systypes
9135 eval $inhdr
9136
9137 : see if sys/select.h has to be included
9138 set sys/select.h i_sysselct
9139 eval $inhdr
9140
9141 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9142 while $test $# -ge 2; do
9143         case "$1" in
9144         $define) echo "#include <$2>";;
9145         esac ;
9146     shift 2;
9147 done > try.c;
9148 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9149 set try;
9150 if eval $compile; then
9151         val="$define";
9152 else
9153         val="$undef";
9154 fi;
9155 set $varname;
9156 eval $setvar;
9157 $rm -f try.c try.o'
9158
9159 : see if we should include time.h, sys/time.h, or both
9160 echo " "
9161 if test "X$timeincl" = X; then
9162         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9163         $echo $n "I'm now running the test program...$c"
9164         $cat >try.c <<'EOCP'
9165 #include <sys/types.h>
9166 #ifdef I_TIME
9167 #include <time.h>
9168 #endif
9169 #ifdef I_SYSTIME
9170 #ifdef SYSTIMEKERNEL
9171 #define KERNEL
9172 #endif
9173 #include <sys/time.h>
9174 #endif
9175 #ifdef I_SYSSELECT
9176 #include <sys/select.h>
9177 #endif
9178 int main()
9179 {
9180         struct tm foo;
9181 #ifdef S_TIMEVAL
9182         struct timeval bar;
9183 #endif
9184 #ifdef S_TIMEZONE
9185         struct timezone tzp;
9186 #endif
9187         if (foo.tm_sec == foo.tm_sec)
9188                 exit(0);
9189 #ifdef S_TIMEVAL
9190         if (bar.tv_sec == bar.tv_sec)
9191                 exit(0);
9192 #endif
9193         exit(1);
9194 }
9195 EOCP
9196         flags=''
9197         for s_timezone in '-DS_TIMEZONE' ''; do
9198         sysselect=''
9199         for s_timeval in '-DS_TIMEVAL' ''; do
9200         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9201         for i_time in '' '-DI_TIME'; do
9202         for i_systime in '-DI_SYSTIME' ''; do
9203                 case "$flags" in
9204                 '') $echo $n ".$c"
9205                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9206                         if eval $compile; then
9207                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9208                                 shift
9209                                 flags="$*"
9210                                 echo " "
9211                                 $echo $n "Succeeded with $flags$c"
9212                         fi
9213                         ;;
9214                 esac
9215         done
9216         done
9217         done
9218         done
9219         done
9220         timeincl=''
9221         echo " "
9222         case "$flags" in
9223         *SYSTIMEKERNEL*) i_systimek="$define"
9224                 timeincl=`./findhdr sys/time.h`
9225                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9226         *) i_systimek="$undef";;
9227         esac
9228         case "$flags" in
9229         *I_TIME*) i_time="$define"
9230                 timeincl=`./findhdr time.h`" $timeincl"
9231                 echo "We'll include <time.h>." >&4;;
9232         *) i_time="$undef";;
9233         esac
9234         case "$flags" in
9235         *I_SYSTIME*) i_systime="$define"
9236                 timeincl=`./findhdr sys/time.h`" $timeincl"
9237                 echo "We'll include <sys/time.h>." >&4;;
9238         *) i_systime="$undef";;
9239         esac
9240         $rm -f try.c try
9241 fi
9242 : see if struct tm knows about tm_zone
9243 case "$i_systime$i_time" in
9244 *$define*) 
9245         echo " "
9246         echo "Checking to see if your struct tm has tm_zone field..." >&4
9247         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9248         eval $hasfield
9249         ;;
9250 *)      val="$undef"
9251         set d_tm_tm_zone
9252         eval $setvar
9253         ;;
9254 esac
9255 case "$d_tm_tm_zone" in
9256 "$define")      echo "Yes, it does."   ;;
9257 *)              echo "No, it doesn't." ;;
9258 esac
9259 : see if struct tm knows about tm_gmtoff
9260 case "$i_systime$i_time" in
9261 *$define*) 
9262         echo " "
9263         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9264         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9265         eval $hasfield
9266         ;;
9267 *)      val="$undef"
9268         set d_tm_tm_gmtoff
9269         eval $setvar
9270         ;;
9271 esac
9272 case "$d_tm_tm_gmtoff" in
9273 "$define")      echo "Yes, it does."   ;;
9274 *)              echo "No, it doesn't." ;;
9275 esac
9276
9277 : see if asctime_r exists
9278 set asctime_r d_asctime_r
9279 eval $inlibc
9280 case "$d_asctime_r" in
9281 "$define")
9282         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
9283         case "$d_asctime_r_proto:$usethreads" in
9284         ":define")      d_asctime_r_proto=define
9285                 set d_asctime_r_proto asctime_r $hdrs
9286                 eval $hasproto ;;
9287         *)      ;;
9288         esac
9289         case "$d_asctime_r_proto" in
9290         define)
9291         case "$asctime_r_proto" in
9292         ''|0) try='char* asctime_r(const struct tm*, char*);'
9293         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9294         esac
9295         case "$asctime_r_proto" in
9296         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9297         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9298         esac
9299         case "$asctime_r_proto" in
9300         ''|0) try='int asctime_r(const struct tm*, char*);'
9301         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9302         esac
9303         case "$asctime_r_proto" in
9304         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9305         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9306         esac
9307         case "$asctime_r_proto" in
9308         '')     d_asctime_r=undef
9309                 asctime_r_proto=0
9310                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9311         * )     case "$asctime_r_proto" in
9312                 REENTRANT_PROTO*) ;;
9313                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9314                 esac
9315                 echo "Prototype: $try" ;;
9316         esac
9317         ;;
9318         *)      case "$usethreads" in
9319                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9320                 esac
9321                 ;;
9322         esac
9323         ;;
9324 *)      asctime_r_proto=0
9325         ;;
9326 esac
9327
9328 : see if atolf exists
9329 set atolf d_atolf
9330 eval $inlibc
9331
9332 : see if atoll exists
9333 set atoll d_atoll
9334 eval $inlibc
9335
9336 : Look for GNU-cc style attribute checking
9337 echo " "
9338 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9339 $cat >attrib.c <<'EOCP'
9340 #include <stdio.h>
9341 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9342 EOCP
9343 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9344         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9345                 echo "Your C compiler doesn't fully support __attribute__."
9346                 val="$undef"
9347         else
9348                 echo "Your C compiler supports __attribute__."
9349                 val="$define"
9350         fi
9351 else
9352         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9353         val="$undef"
9354 fi
9355 set d_attribut
9356 eval $setvar
9357 $rm -f attrib*
9358
9359 : see if bcmp exists
9360 set bcmp d_bcmp
9361 eval $inlibc
9362
9363 : see if bcopy exists
9364 set bcopy d_bcopy
9365 eval $inlibc
9366
9367 : see if this is a unistd.h system
9368 set unistd.h i_unistd
9369 eval $inhdr
9370
9371 : see if getpgrp exists
9372 set getpgrp d_getpgrp
9373 eval $inlibc
9374
9375 case "$d_getpgrp" in
9376 "$define")
9377         echo " "
9378         echo "Checking to see which flavor of getpgrp is in use..."
9379         $cat >try.c <<EOP
9380 #$i_unistd I_UNISTD
9381 #include <sys/types.h>
9382 #ifdef I_UNISTD
9383 #  include <unistd.h>
9384 #endif
9385 int main()
9386 {
9387         if (getuid() == 0) {
9388                 printf("(I see you are running Configure as super-user...)\n");
9389                 setuid(1);
9390         }
9391 #ifdef TRY_BSD_PGRP
9392         if (getpgrp(1) == 0)
9393                 exit(0);
9394 #else
9395         if (getpgrp() > 0)
9396                 exit(0);
9397 #endif
9398         exit(1);
9399 }
9400 EOP
9401         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9402                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9403                 val="$define"
9404         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9405                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9406                 val="$undef"
9407         else
9408                 echo "I can't seem to compile and run the test program."
9409                 if ./usg; then
9410                         xxx="a USG one, i.e. you use getpgrp()."
9411                 else
9412                         # SVR4 systems can appear rather BSD-ish.
9413                         case "$i_unistd" in
9414                         $undef)
9415                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9416                                 val="$define"
9417                                 ;;
9418                         $define)
9419                                 xxx="probably a USG one, i.e. you use getpgrp()."
9420                                 val="$undef"
9421                                 ;;
9422                         esac
9423                 fi
9424                 echo "Assuming your getpgrp is $xxx" >&4
9425         fi
9426         ;;
9427 *) val="$undef";;
9428 esac
9429 set d_bsdgetpgrp
9430 eval $setvar
9431 $rm -f try try.*
9432
9433 : see if setpgrp exists
9434 set setpgrp d_setpgrp
9435 eval $inlibc
9436
9437 case "$d_setpgrp" in
9438 "$define")
9439         echo " "
9440         echo "Checking to see which flavor of setpgrp is in use..."
9441         $cat >try.c <<EOP
9442 #$i_unistd I_UNISTD
9443 #include <sys/types.h>
9444 #ifdef I_UNISTD
9445 #  include <unistd.h>
9446 #endif
9447 int main()
9448 {
9449         if (getuid() == 0) {
9450                 printf("(I see you are running Configure as super-user...)\n");
9451                 setuid(1);
9452         }
9453 #ifdef TRY_BSD_PGRP
9454         if (-1 == setpgrp(1, 1))
9455                 exit(0);
9456 #else
9457         if (setpgrp() != -1)
9458                 exit(0);
9459 #endif
9460         exit(1);
9461 }
9462 EOP
9463         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9464                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9465                 val="$define"
9466         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9467                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9468                 val="$undef"
9469         else
9470                 echo "(I can't seem to compile and run the test program.)"
9471                 if ./usg; then
9472                         xxx="a USG one, i.e. you use setpgrp()."
9473                 else
9474                         # SVR4 systems can appear rather BSD-ish.
9475                         case "$i_unistd" in
9476                         $undef)
9477                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9478                                 val="$define"
9479                                 ;;
9480                         $define)
9481                                 xxx="probably a USG one, i.e. you use setpgrp()."
9482                                 val="$undef"
9483                                 ;;
9484                         esac
9485                 fi
9486                 echo "Assuming your setpgrp is $xxx" >&4
9487         fi
9488         ;;
9489 *) val="$undef";;
9490 esac
9491 set d_bsdsetpgrp
9492 eval $setvar
9493 $rm -f try try.*
9494 : see if bzero exists
9495 set bzero d_bzero
9496 eval $inlibc
9497
9498 : see if signal is declared as pointer to function returning int or void
9499 echo " "
9500 xxx=`./findhdr signal.h`
9501 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9502 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9503         echo "You have int (*signal())() instead of void." >&4
9504         val="$undef"
9505 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9506         echo "You have void (*signal())()." >&4
9507         val="$define"
9508 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9509         echo "You have int (*signal())() instead of void." >&4
9510         val="$undef"
9511 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9512         echo "You have void (*signal())()." >&4
9513         val="$define"
9514 else
9515         case "$d_voidsig" in
9516         '')
9517         echo "I can't determine whether signal handler returns void or int..." >&4
9518                 dflt=void
9519                 rp="What type does your signal handler return?"
9520                 . ./myread
9521                 case "$ans" in
9522                 v*) val="$define";;
9523                 *) val="$undef";;
9524                 esac;;
9525         "$define")
9526                 echo "As you already told me, signal handler returns void." >&4
9527                 val="$define"
9528                 ;;
9529         *)      echo "As you already told me, signal handler returns int." >&4
9530                 val="$undef"
9531                 ;;
9532         esac
9533 fi
9534 set d_voidsig
9535 eval $setvar
9536 case "$d_voidsig" in
9537 "$define") signal_t="void";;
9538 *) signal_t="int";;
9539 esac
9540 $rm -f $$.tmp
9541
9542 : check for ability to cast large floats to 32-bit ints.
9543 echo " "
9544 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9545 if $test "$intsize" -ge 4; then
9546         xxx=int
9547 else
9548         xxx=long
9549 fi
9550 $cat >try.c <<EOCP
9551 #include <stdio.h>
9552 #include <sys/types.h>
9553 #include <signal.h>
9554 $signal_t blech(s) int s; { exit(3); }
9555 int main()
9556 {
9557         $xxx i32;
9558         double f, g;
9559         int result = 0;
9560         char str[16];
9561         signal(SIGFPE, blech);
9562
9563         /* Don't let compiler optimize the test away.  Store the number 
9564            in a writable string for gcc to pass to sscanf under HP/UX.
9565         */
9566         sprintf(str, "2147483647");
9567         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9568         g = 10 * f;
9569         i32  = ($xxx) g;
9570
9571         /* x86 processors will probably give 0x8000 0000, which is a
9572        sign change.  We don't want that.  We want to mimic SPARC
9573            behavior here, which is to preserve the sign and give
9574            back 0x7fff ffff.
9575         */
9576         if (i32 != ($xxx) f)
9577                 result |= 1;
9578         exit(result);
9579 }
9580 EOCP
9581 set try
9582 if eval $compile_ok; then
9583         $run ./try
9584         yyy=$?
9585 else
9586         echo "(I can't seem to compile the test program--assuming it can't)"
9587         yyy=1
9588 fi
9589 case "$yyy" in
9590 0)      val="$define"
9591         echo "Yup, it can."
9592         ;;
9593 *)      val="$undef"
9594         echo "Nope, it can't."
9595         ;;
9596 esac
9597 set d_casti32
9598 eval $setvar
9599 $rm -f try try.*
9600
9601 : check for ability to cast negative floats to unsigned
9602 echo " "
9603 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9604 $cat >try.c <<EOCP
9605 #include <stdio.h>
9606 #include <sys/types.h>
9607 #include <signal.h>
9608 $signal_t blech(s) int s; { exit(7); }
9609 $signal_t blech_in_list(s) int s; { exit(4); }
9610 unsigned long dummy_long(p) unsigned long p; { return p; }
9611 unsigned int dummy_int(p) unsigned int p; { return p; }
9612 unsigned short dummy_short(p) unsigned short p; { return p; }
9613 int main()
9614 {
9615         double f;
9616         unsigned long along;
9617         unsigned int aint;
9618         unsigned short ashort;
9619         int result = 0;
9620         char str[16];
9621         
9622         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9623            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9624            optimized the whole file away
9625         */
9626         /* Store the number in a writable string for gcc to pass to 
9627            sscanf under HP/UX.
9628         */
9629         sprintf(str, "-123");
9630         sscanf(str, "%lf", &f);  /* f = -123.; */
9631
9632         signal(SIGFPE, blech);
9633         along = (unsigned long)f;
9634         aint = (unsigned int)f;
9635         ashort = (unsigned short)f;
9636         if (along != (unsigned long)-123)
9637                 result |= 1;
9638         if (aint != (unsigned int)-123)
9639                 result |= 1;
9640         if (ashort != (unsigned short)-123)
9641                 result |= 1;
9642         sprintf(str, "1073741824.");
9643         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9644         f = f + f;
9645         along = 0;
9646         along = (unsigned long)f;
9647         if (along != 0x80000000)
9648                 result |= 2;
9649         f -= 1.;
9650         along = 0;
9651         along = (unsigned long)f;
9652         if (along != 0x7fffffff)
9653                 result |= 1;
9654         f += 2.;
9655         along = 0;
9656         along = (unsigned long)f;
9657         if (along != 0x80000001)
9658                 result |= 2;
9659         if (result)
9660                 exit(result);
9661         signal(SIGFPE, blech_in_list);
9662         sprintf(str, "123.");
9663         sscanf(str, "%lf", &f);  /* f = 123.; */
9664         along = dummy_long((unsigned long)f);
9665         aint = dummy_int((unsigned int)f);
9666         ashort = dummy_short((unsigned short)f);
9667         if (along != (unsigned long)123)
9668                 result |= 4;
9669         if (aint != (unsigned int)123)
9670                 result |= 4;
9671         if (ashort != (unsigned short)123)
9672                 result |= 4;
9673         exit(result);
9674
9675 }
9676 EOCP
9677 set try
9678 if eval $compile_ok; then
9679         $run ./try
9680         castflags=$?
9681 else
9682         echo "(I can't seem to compile the test program--assuming it can't)"
9683         castflags=7
9684 fi
9685 case "$castflags" in
9686 0)      val="$define"
9687         echo "Yup, it can."
9688         ;;
9689 *)      val="$undef"
9690         echo "Nope, it can't."
9691         ;;
9692 esac
9693 set d_castneg
9694 eval $setvar
9695 $rm -f try.*
9696
9697 : see if vprintf exists
9698 echo " "
9699 if set vprintf val -f d_vprintf; eval $csym; $val; then
9700         echo 'vprintf() found.' >&4
9701         val="$define"
9702         $cat >try.c <<'EOF'
9703 #include <varargs.h>
9704
9705 int main() { xxx("foo"); }
9706
9707 xxx(va_alist)
9708 va_dcl
9709 {
9710         va_list args;
9711         char buf[10];
9712
9713         va_start(args);
9714         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9715 }
9716 EOF
9717         set try
9718         if eval $compile && $run ./try; then
9719                 echo "Your vsprintf() returns (int)." >&4
9720                 val2="$undef"
9721         else
9722                 echo "Your vsprintf() returns (char*)." >&4
9723                 val2="$define"
9724         fi
9725 else
9726         echo 'vprintf() NOT found.' >&4
9727                 val="$undef"
9728                 val2="$undef"
9729 fi
9730 $rm -f try try.*
9731 set d_vprintf
9732 eval $setvar
9733 val=$val2
9734 set d_charvspr
9735 eval $setvar
9736
9737 : see if chown exists
9738 set chown d_chown
9739 eval $inlibc
9740
9741 : see if chroot exists
9742 set chroot d_chroot
9743 eval $inlibc
9744
9745 : see if chsize exists
9746 set chsize d_chsize
9747 eval $inlibc
9748
9749 : see if class exists
9750 set class d_class
9751 eval $inlibc
9752
9753 hasstruct='varname=$1; struct=$2; shift; shift;
9754 while $test $# -ge 2; do
9755         case "$1" in
9756         $define) echo "#include <$2>";;
9757         esac ;
9758     shift 2;
9759 done > try.c;
9760 echo "int main () { struct $struct foo; }" >> try.c;
9761 set try;
9762 if eval $compile; then
9763         val="$define";
9764 else
9765         val="$undef";
9766 fi;
9767 set $varname;
9768 eval $setvar;
9769 $rm -f try.c try.o'
9770
9771 socketlib=''
9772 sockethdr=''
9773 : see whether socket exists
9774 echo " "
9775 $echo $n "Hmm... $c" >&4
9776 if set socket val -f d_socket; eval $csym; $val; then
9777         echo "Looks like you have Berkeley networking support." >&4
9778         d_socket="$define"
9779         if set setsockopt val -f; eval $csym; $val; then
9780                 d_oldsock="$undef"
9781         else
9782                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9783                 d_oldsock="$define"
9784         fi
9785 else
9786         if $contains socklib libc.list >/dev/null 2>&1; then
9787                 echo "Looks like you have Berkeley networking support." >&4
9788                 d_socket="$define"
9789                 : we will have to assume that it supports the 4.2 BSD interface
9790                 d_oldsock="$undef"
9791         else
9792                 echo "You don't have Berkeley networking in libc$_a..." >&4
9793                 if test "X$d_socket" = "X$define"; then
9794                    echo "...but you seem to believe that you have sockets." >&4
9795                 else
9796                         for net in net socket
9797                         do
9798                                 if test -f /usr/lib/lib$net$_a; then
9799                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9800                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9801                                         if $contains socket libc.list >/dev/null 2>&1; then
9802                                                 d_socket="$define"
9803                                                 socketlib="-l$net"
9804                                                 case "$net" in
9805                                                 net)
9806                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9807                                                         sockethdr="-I/usr/netinclude"
9808                                                         ;;
9809                                                 esac
9810                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9811                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9812                                                         d_oldsock="$undef"
9813                                                 else
9814                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9815                                                         d_oldsock="$define"
9816                                                 fi
9817                                                 break
9818                                         fi
9819                                 fi
9820                         done
9821                         if test "X$d_socket" != "X$define"; then
9822                            echo "or anywhere else I see." >&4
9823                            d_socket="$undef"
9824                            d_oldsock="$undef"
9825                         fi
9826                 fi
9827         fi
9828 fi
9829
9830 : see if socketpair exists
9831 set socketpair d_sockpair
9832 eval $inlibc
9833
9834
9835 echo " "
9836 echo "Checking the availability of certain socket constants..." >&4
9837 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9838         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9839         $cat >try.c <<EOF
9840 #include <sys/types.h>
9841 #include <sys/socket.h>
9842 int main() {
9843     int i = $ENUM;
9844 }
9845 EOF
9846         val="$undef"
9847         set try; if eval $compile; then
9848                 val="$define"
9849         fi
9850         set d_${enum}; eval $setvar
9851         $rm -f try.c try
9852 done
9853
9854 : see if this is a sys/uio.h system
9855 set sys/uio.h i_sysuio
9856 eval $inhdr
9857
9858
9859 echo " "
9860 echo "Checking to see if your system supports struct cmsghdr..." >&4
9861 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9862 eval $hasstruct
9863 case "$d_cmsghdr_s" in
9864 "$define")      echo "Yes, it does."   ;;
9865 *)              echo "No, it doesn't." ;;
9866 esac
9867
9868
9869 : check for const keyword
9870 echo " "
9871 echo 'Checking to see if your C compiler knows about "const"...' >&4
9872 $cat >const.c <<'EOCP'
9873 typedef struct spug { int drokk; } spug;
9874 int main()
9875 {
9876         const char *foo;
9877         const spug y;
9878 }
9879 EOCP
9880 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9881         val="$define"
9882         echo "Yup, it does."
9883 else
9884         val="$undef"
9885         echo "Nope, it doesn't."
9886 fi
9887 set d_const
9888 eval $setvar
9889
9890 : see if crypt exists
9891 echo " "
9892 set crypt d_crypt
9893 eval $inlibc
9894 case "$d_crypt" in
9895 $define) cryptlib='' ;;
9896 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9897                 echo 'crypt() found.' >&4
9898                 val="$define"
9899                 cryptlib=''
9900         else
9901                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9902                 if $test -z "$cryptlib"; then
9903                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9904                 else
9905                         cryptlib=-lcrypt
9906                 fi
9907                 if $test -z "$cryptlib"; then
9908                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9909                 else
9910                         cryptlib=-lcrypt
9911                 fi
9912                 if $test -z "$cryptlib"; then
9913                         cryptlib=`./loc libcrypt$_a "" $libpth`
9914                 else
9915                         cryptlib=-lcrypt
9916                 fi
9917                 if $test -z "$cryptlib"; then
9918                         echo 'crypt() NOT found.' >&4
9919                         val="$undef"
9920                 else
9921                         val="$define"
9922                 fi
9923         fi
9924         set d_crypt
9925         eval $setvar
9926         ;;
9927 esac
9928
9929 : see if this is a crypt.h system
9930 set crypt.h i_crypt
9931 eval $inhdr
9932
9933 : see if crypt_r exists
9934 set crypt_r d_crypt_r
9935 eval $inlibc
9936 case "$d_crypt_r" in
9937 "$define")
9938         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9939         case "$d_crypt_r_proto:$usethreads" in
9940         ":define")      d_crypt_r_proto=define
9941                 set d_crypt_r_proto crypt_r $hdrs
9942                 eval $hasproto ;;
9943         *)      ;;
9944         esac
9945         case "$d_crypt_r_proto" in
9946         define)
9947         case "$crypt_r_proto" in
9948         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9949         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9950         esac
9951         case "$crypt_r_proto" in
9952         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9953         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9954         esac
9955         case "$crypt_r_proto" in
9956         '')     d_crypt_r=undef
9957                 crypt_r_proto=0
9958                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9959         * )     case "$crypt_r_proto" in
9960                 REENTRANT_PROTO*) ;;
9961                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9962                 esac
9963                 echo "Prototype: $try" ;;
9964         esac
9965         ;;
9966         *)      case "$usethreads" in
9967                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9968                 esac
9969                 ;;
9970         esac
9971         ;;
9972 *)      crypt_r_proto=0
9973         ;;
9974 esac
9975
9976 : get csh whereabouts
9977 case "$csh" in
9978 'csh') val="$undef" ;;
9979 *) val="$define" ;;
9980 esac
9981 set d_csh
9982 eval $setvar
9983 : Respect a hint or command line value for full_csh.
9984 case "$full_csh" in
9985 '') full_csh=$csh ;;
9986 esac
9987
9988 : see if ctermid_r exists
9989 set ctermid_r d_ctermid_r
9990 eval $inlibc
9991 case "$d_ctermid_r" in
9992 "$define")
9993         hdrs="$i_systypes sys/types.h define stdio.h $i_stdio stdio.h"
9994         case "$d_ctermid_r_proto:$usethreads" in
9995         ":define")      d_ctermid_r_proto=define
9996                 set d_ctermid_r_proto ctermid_r $hdrs
9997                 eval $hasproto ;;
9998         *)      ;;
9999         esac
10000         case "$d_ctermid_r_proto" in
10001         define)
10002         case "$ctermid_r_proto" in
10003         ''|0) try='char* ctermid_r(char*);'
10004         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10005         esac
10006         case "$ctermid_r_proto" in
10007         '')     d_ctermid_r=undef
10008                 ctermid_r_proto=0
10009                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10010         * )     case "$ctermid_r_proto" in
10011                 REENTRANT_PROTO*) ;;
10012                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10013                 esac
10014                 echo "Prototype: $try" ;;
10015         esac
10016         ;;
10017         *)      case "$usethreads" in
10018                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10019                 esac
10020                 ;;
10021         esac
10022         ;;
10023 *)      ctermid_r_proto=0
10024         ;;
10025 esac
10026
10027 : see if ctime_r exists
10028 set ctime_r d_ctime_r
10029 eval $inlibc
10030 case "$d_ctime_r" in
10031 "$define")
10032         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
10033         case "$d_ctime_r_proto:$usethreads" in
10034         ":define")      d_ctime_r_proto=define
10035                 set d_ctime_r_proto ctime_r $hdrs
10036                 eval $hasproto ;;
10037         *)      ;;
10038         esac
10039         case "$d_ctime_r_proto" in
10040         define)
10041         case "$ctime_r_proto" in
10042         ''|0) try='char* ctime_r(const time_t*, char*);'
10043         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10044         esac
10045         case "$ctime_r_proto" in
10046         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10047         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10048         esac
10049         case "$ctime_r_proto" in
10050         ''|0) try='int ctime_r(const time_t*, char*);'
10051         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10052         esac
10053         case "$ctime_r_proto" in
10054         ''|0) try='int ctime_r(const time_t*, char*, int);'
10055         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10056         esac
10057         case "$ctime_r_proto" in
10058         '')     d_ctime_r=undef
10059                 ctime_r_proto=0
10060                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10061         * )     case "$ctime_r_proto" in
10062                 REENTRANT_PROTO*) ;;
10063                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10064                 esac
10065                 echo "Prototype: $try" ;;
10066         esac
10067         ;;
10068         *)      case "$usethreads" in
10069                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10070                 esac
10071                 ;;
10072         esac
10073         ;;
10074 *)      ctime_r_proto=0
10075         ;;
10076 esac
10077
10078 : see if cuserid exists
10079 set cuserid d_cuserid
10080 eval $inlibc
10081
10082 : see if this is a limits.h system
10083 set limits.h i_limits
10084 eval $inhdr
10085
10086 : see if this is a float.h system
10087 set float.h i_float
10088 eval $inhdr
10089
10090 : See if number of significant digits in a double precision number is known
10091 echo " "
10092 $cat >dbl_dig.c <<EOM
10093 #$i_limits I_LIMITS
10094 #$i_float I_FLOAT
10095 #ifdef I_LIMITS
10096 #include <limits.h>
10097 #endif
10098 #ifdef I_FLOAT
10099 #include <float.h>
10100 #endif
10101 #ifdef DBL_DIG
10102 printf("Contains DBL_DIG");
10103 #endif
10104 EOM
10105 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10106 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10107         echo "DBL_DIG found." >&4
10108         val="$define"
10109 else
10110         echo "DBL_DIG NOT found." >&4
10111         val="$undef"
10112 fi
10113 $rm -f dbl_dig.?
10114 set d_dbl_dig
10115 eval $setvar
10116
10117 : see if dbm.h is available
10118 : see if dbmclose exists
10119 set dbmclose d_dbmclose
10120 eval $inlibc
10121
10122 case "$d_dbmclose" in
10123 $define)
10124         set dbm.h i_dbm
10125         eval $inhdr
10126         case "$i_dbm" in
10127         $define)
10128                 val="$undef"
10129                 set i_rpcsvcdbm
10130                 eval $setvar
10131                 ;;
10132         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10133                 eval $inhdr
10134                 ;;
10135         esac
10136         ;;
10137 *)      echo "We won't be including <dbm.h>"
10138         val="$undef"
10139         set i_dbm
10140         eval $setvar
10141         val="$undef"
10142         set i_rpcsvcdbm
10143         eval $setvar
10144         ;;
10145 esac
10146
10147 : see if prototype for dbminit is available
10148 echo " "
10149 set d_dbminitproto dbminit $i_dbm dbm.h
10150 eval $hasproto
10151
10152 : see if difftime exists
10153 set difftime d_difftime
10154 eval $inlibc
10155
10156 : see if this is a dirent system
10157 echo " "
10158 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10159         val="$define"
10160         echo "<dirent.h> found." >&4
10161 else
10162         val="$undef"
10163         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10164                 echo "<sys/dir.h> found." >&4
10165                 echo " "
10166         else
10167                 xinc=`./findhdr sys/ndir.h`
10168         fi
10169         echo "<dirent.h> NOT found." >&4
10170 fi
10171 set i_dirent
10172 eval $setvar
10173
10174 : Look for type of directory structure.
10175 echo " "
10176 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10177
10178 case "$direntrytype" in
10179 ''|' ')
10180         case "$i_dirent" in
10181         $define) guess1='struct dirent' ;;
10182         *) guess1='struct direct'  ;;
10183         esac
10184         ;;
10185 *)      guess1="$direntrytype"
10186         ;;
10187 esac
10188
10189 case "$guess1" in
10190 'struct dirent') guess2='struct direct' ;;
10191 *) guess2='struct dirent' ;;
10192 esac
10193                 
10194 if $contains "$guess1" try.c >/dev/null 2>&1; then
10195         direntrytype="$guess1"
10196         echo "Your directory entries are $direntrytype." >&4
10197 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10198         direntrytype="$guess2"
10199         echo "Your directory entries seem to be $direntrytype." >&4
10200 else
10201         echo "I don't recognize your system's directory entries." >&4
10202         rp="What type is used for directory entries on this system?"
10203         dflt="$guess1"
10204         . ./myread
10205         direntrytype="$ans"
10206 fi
10207 $rm -f try.c
10208
10209
10210 : see if the directory entry stores field length
10211 echo " "
10212 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10213 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10214         echo "Good, your directory entry keeps length information in d_namlen." >&4
10215         val="$define"
10216 else
10217         echo "Your directory entry does not know about the d_namlen field." >&4
10218         val="$undef"
10219 fi
10220 set d_dirnamlen
10221 eval $setvar
10222 $rm -f try.c
10223
10224 : see if this is an sysdir system
10225 set sys/dir.h i_sysdir
10226 eval $inhdr
10227
10228 : see if this is an sysndir system
10229 set sys/ndir.h i_sysndir
10230 eval $inhdr
10231
10232 : Look for dirfd
10233 echo " "
10234 $cat >dirfd.c <<EOM
10235 #include <stdio.h>
10236 #$i_dirent I_DIRENT             /**/
10237 #$i_sysdir I_SYS_DIR            /**/
10238 #$i_sysndir I_SYS_NDIR          /**/
10239 #$i_systypes I_SYS_TYPES        /**/
10240 #if defined(I_SYS_TYPES)
10241 #include <sys/types.h>
10242 #endif
10243 #if defined(I_DIRENT)
10244 #include <dirent.h>
10245 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10246 #include <sys/dir.h>
10247 #endif
10248 #else
10249 #ifdef I_SYS_NDIR
10250 #include <sys/ndir.h>
10251 #else
10252 #ifdef I_SYS_DIR
10253 #ifdef hp9000s500
10254 #include <ndir.h>       /* may be wrong in the future */
10255 #else
10256 #include <sys/dir.h>
10257 #endif
10258 #endif
10259 #endif
10260 #endif 
10261 int main() {
10262         DIR *dirp = opendir(".");
10263         if (dirfd(dirp) >= 0)
10264                 exit(0);
10265         else
10266                 exit(1);
10267 }
10268 EOM
10269 set dirfd
10270 if eval $compile; then
10271         val="$define"
10272 fi
10273 case "$val" in
10274 $define)        echo "dirfd() found." >&4       ;;
10275 *)              echo "dirfd() NOT found." >&4   ;;
10276 esac
10277 set d_dirfd
10278 eval $setvar
10279 $rm -f dirfd*
10280
10281 : see if dlerror exists
10282 xxx_runnm="$runnm"
10283 runnm=false
10284 set dlerror d_dlerror
10285 eval $inlibc
10286 runnm="$xxx_runnm"
10287
10288 : see if dlfcn is available
10289 set dlfcn.h i_dlfcn
10290 eval $inhdr
10291
10292 case "$usedl" in
10293 $define|y|true)
10294         $cat << EOM
10295
10296 On a few systems, the dynamically loaded modules that perl generates and uses
10297 will need a different extension than shared libs. The default will probably
10298 be appropriate.
10299
10300 EOM
10301         case "$dlext" in
10302         '')     dflt="$so" ;;
10303         *)      dflt="$dlext" ;;
10304         esac
10305         rp='What is the extension of dynamically loaded modules'
10306         . ./myread
10307         dlext="$ans"
10308         ;;
10309 *)
10310         dlext="none"
10311         ;;
10312 esac
10313
10314 : Check if dlsym need a leading underscore
10315 echo " "
10316 val="$undef"
10317
10318 case "$dlsrc" in
10319 dl_dlopen.xs)
10320         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10321         $cat >dyna.c <<'EOM'
10322 fred () { }
10323 EOM
10324
10325 $cat >fred.c<<EOM
10326
10327 #include <stdio.h>
10328 #$i_dlfcn I_DLFCN
10329 #ifdef I_DLFCN
10330 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10331 #else
10332 #include <sys/types.h>
10333 #include <nlist.h>
10334 #include <link.h>
10335 #endif
10336
10337 extern int fred() ;
10338
10339 int main()
10340 {
10341     void * handle ;
10342     void * symbol ;
10343 #ifndef RTLD_LAZY
10344     int mode = 1 ;
10345 #else
10346     int mode = RTLD_LAZY ;
10347 #endif
10348     handle = dlopen("./dyna.$dlext", mode) ;
10349     if (handle == NULL) {
10350         printf ("1\n") ;
10351         fflush (stdout) ;
10352         exit(0);
10353     }
10354     symbol = dlsym(handle, "fred") ;
10355     if (symbol == NULL) {
10356         /* try putting a leading underscore */
10357         symbol = dlsym(handle, "_fred") ;
10358         if (symbol == NULL) {
10359             printf ("2\n") ;
10360             fflush (stdout) ;
10361             exit(0);
10362         }
10363         printf ("3\n") ;
10364     }
10365     else
10366         printf ("4\n") ;
10367     fflush (stdout) ;
10368     exit(0);
10369 }
10370 EOM
10371         : Call the object file tmp-dyna.o in case dlext=o.
10372         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10373                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10374                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10375                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10376                 xxx=`$run ./fred`
10377                 case $xxx in
10378                 1)      echo "Test program failed using dlopen." >&4
10379                         echo "Perhaps you should not use dynamic loading." >&4;;
10380                 2)      echo "Test program failed using dlsym." >&4
10381                         echo "Perhaps you should not use dynamic loading." >&4;;
10382                 3)      echo "dlsym needs a leading underscore" >&4
10383                         val="$define" ;;
10384                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10385                 esac
10386         else
10387                 echo "I can't compile and run the test program." >&4
10388                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10389         fi
10390         ;;
10391 esac
10392                 
10393 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10394
10395 set d_dlsymun
10396 eval $setvar
10397
10398 : see if drand48_r exists
10399 set drand48_r d_drand48_r
10400 eval $inlibc
10401 case "$d_drand48_r" in
10402 "$define")
10403         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10404         case "$d_drand48_r_proto:$usethreads" in
10405         ":define")      d_drand48_r_proto=define
10406                 set d_drand48_r_proto drand48_r $hdrs
10407                 eval $hasproto ;;
10408         *)      ;;
10409         esac
10410         case "$d_drand48_r_proto" in
10411         define)
10412         case "$drand48_r_proto" in
10413         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10414         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10415         esac
10416         case "$drand48_r_proto" in
10417         '')     d_drand48_r=undef
10418                 drand48_r_proto=0
10419                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10420         * )     case "$drand48_r_proto" in
10421                 REENTRANT_PROTO*) ;;
10422                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10423                 esac
10424                 echo "Prototype: $try" ;;
10425         esac
10426         ;;
10427         *)      case "$usethreads" in
10428                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10429                 esac
10430                 ;;
10431         esac
10432         ;;
10433 *)      drand48_r_proto=0
10434         ;;
10435 esac
10436
10437 : see if prototype for drand48 is available
10438 echo " "
10439 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10440 eval $hasproto
10441
10442 : see if dup2 exists
10443 set dup2 d_dup2
10444 eval $inlibc
10445
10446 : see if eaccess exists
10447 set eaccess d_eaccess
10448 eval $inlibc
10449
10450 : see if endgrent exists
10451 set endgrent d_endgrent
10452 eval $inlibc
10453
10454 : see if this is an grp system
10455 set grp.h i_grp
10456 eval $inhdr
10457
10458 case "$i_grp" in
10459 $define)
10460         xxx=`./findhdr grp.h`
10461         $cppstdin $cppflags $cppminus < $xxx >$$.h
10462
10463         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10464                 val="$define"
10465         else
10466                 val="$undef"
10467         fi
10468         set d_grpasswd
10469         eval $setvar
10470
10471         $rm -f $$.h
10472         ;;
10473 *)
10474         val="$undef";
10475         set d_grpasswd; eval $setvar
10476         ;;
10477 esac
10478
10479 : see if endgrent_r exists
10480 set endgrent_r d_endgrent_r
10481 eval $inlibc
10482 case "$d_endgrent_r" in
10483 "$define")
10484         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10485         case "$d_endgrent_r_proto:$usethreads" in
10486         ":define")      d_endgrent_r_proto=define
10487                 set d_endgrent_r_proto endgrent_r $hdrs
10488                 eval $hasproto ;;
10489         *)      ;;
10490         esac
10491         case "$d_endgrent_r_proto" in
10492         define)
10493         case "$endgrent_r_proto" in
10494         ''|0) try='int endgrent_r(FILE**);'
10495         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10496         esac
10497         case "$endgrent_r_proto" in
10498         ''|0) try='void endgrent_r(FILE**);'
10499         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10500         esac
10501         case "$endgrent_r_proto" in
10502         '')     d_endgrent_r=undef
10503                 endgrent_r_proto=0
10504                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10505         * )     case "$endgrent_r_proto" in
10506                 REENTRANT_PROTO*) ;;
10507                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10508                 esac
10509                 echo "Prototype: $try" ;;
10510         esac
10511         ;;
10512         *)      case "$usethreads" in
10513                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10514                 esac
10515                 ;;
10516         esac
10517         ;;
10518 *)      endgrent_r_proto=0
10519         ;;
10520 esac
10521
10522 : see if endhostent exists
10523 set endhostent d_endhent
10524 eval $inlibc
10525
10526 : see if this is a netdb.h system
10527 set netdb.h i_netdb
10528 eval $inhdr
10529
10530 : see if endhostent_r exists
10531 set endhostent_r d_endhostent_r
10532 eval $inlibc
10533 case "$d_endhostent_r" in
10534 "$define")
10535         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10536         case "$d_endhostent_r_proto:$usethreads" in
10537         ":define")      d_endhostent_r_proto=define
10538                 set d_endhostent_r_proto endhostent_r $hdrs
10539                 eval $hasproto ;;
10540         *)      ;;
10541         esac
10542         case "$d_endhostent_r_proto" in
10543         define)
10544         case "$endhostent_r_proto" in
10545         ''|0) try='int endhostent_r(struct hostent_data*);'
10546         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_S ;;
10547         esac
10548         case "$endhostent_r_proto" in
10549         ''|0) try='void endhostent_r(struct hostent_data*);'
10550         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_S ;;
10551         esac
10552         case "$endhostent_r_proto" in
10553         '')     d_endhostent_r=undef
10554                 endhostent_r_proto=0
10555                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10556         * )     case "$endhostent_r_proto" in
10557                 REENTRANT_PROTO*) ;;
10558                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10559                 esac
10560                 echo "Prototype: $try" ;;
10561         esac
10562         ;;
10563         *)      case "$usethreads" in
10564                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10565                 esac
10566                 ;;
10567         esac
10568         ;;
10569 *)      endhostent_r_proto=0
10570         ;;
10571 esac
10572
10573 : see if endnetent exists
10574 set endnetent d_endnent
10575 eval $inlibc
10576
10577 : see if endnetent_r exists
10578 set endnetent_r d_endnetent_r
10579 eval $inlibc
10580 case "$d_endnetent_r" in
10581 "$define")
10582         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10583         case "$d_endnetent_r_proto:$usethreads" in
10584         ":define")      d_endnetent_r_proto=define
10585                 set d_endnetent_r_proto endnetent_r $hdrs
10586                 eval $hasproto ;;
10587         *)      ;;
10588         esac
10589         case "$d_endnetent_r_proto" in
10590         define)
10591         case "$endnetent_r_proto" in
10592         ''|0) try='int endnetent_r(struct netent_data*);'
10593         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_S ;;
10594         esac
10595         case "$endnetent_r_proto" in
10596         ''|0) try='void endnetent_r(struct netent_data*);'
10597         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_S ;;
10598         esac
10599         case "$endnetent_r_proto" in
10600         '')     d_endnetent_r=undef
10601                 endnetent_r_proto=0
10602                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10603         * )     case "$endnetent_r_proto" in
10604                 REENTRANT_PROTO*) ;;
10605                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10606                 esac
10607                 echo "Prototype: $try" ;;
10608         esac
10609         ;;
10610         *)      case "$usethreads" in
10611                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10612                 esac
10613                 ;;
10614         esac
10615         ;;
10616 *)      endnetent_r_proto=0
10617         ;;
10618 esac
10619
10620 : see if endprotoent exists
10621 set endprotoent d_endpent
10622 eval $inlibc
10623
10624 : see if endprotoent_r exists
10625 set endprotoent_r d_endprotoent_r
10626 eval $inlibc
10627 case "$d_endprotoent_r" in
10628 "$define")
10629         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10630         case "$d_endprotoent_r_proto:$usethreads" in
10631         ":define")      d_endprotoent_r_proto=define
10632                 set d_endprotoent_r_proto endprotoent_r $hdrs
10633                 eval $hasproto ;;
10634         *)      ;;
10635         esac
10636         case "$d_endprotoent_r_proto" in
10637         define)
10638         case "$endprotoent_r_proto" in
10639         ''|0) try='int endprotoent_r(struct protoent_data*);'
10640         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_S ;;
10641         esac
10642         case "$endprotoent_r_proto" in
10643         ''|0) try='void endprotoent_r(struct protoent_data*);'
10644         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_S ;;
10645         esac
10646         case "$endprotoent_r_proto" in
10647         '')     d_endprotoent_r=undef
10648                 endprotoent_r_proto=0
10649                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10650         * )     case "$endprotoent_r_proto" in
10651                 REENTRANT_PROTO*) ;;
10652                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10653                 esac
10654                 echo "Prototype: $try" ;;
10655         esac
10656         ;;
10657         *)      case "$usethreads" in
10658                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10659                 esac
10660                 ;;
10661         esac
10662         ;;
10663 *)      endprotoent_r_proto=0
10664         ;;
10665 esac
10666
10667 : see if endpwent exists
10668 set endpwent d_endpwent
10669 eval $inlibc
10670
10671 : see if this is a pwd.h system
10672 set pwd.h i_pwd
10673 eval $inhdr
10674
10675 case "$i_pwd" in
10676 $define)
10677         xxx=`./findhdr pwd.h`
10678         $cppstdin $cppflags $cppminus < $xxx >$$.h
10679
10680         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10681                 val="$define"
10682         else
10683                 val="$undef"
10684         fi
10685         set d_pwquota
10686         eval $setvar
10687
10688         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10689                 val="$define"
10690         else
10691                 val="$undef"
10692         fi
10693         set d_pwage
10694         eval $setvar
10695
10696         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10697                 val="$define"
10698         else
10699                 val="$undef"
10700         fi
10701         set d_pwchange
10702         eval $setvar
10703
10704         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10705                 val="$define"
10706         else
10707                 val="$undef"
10708         fi
10709         set d_pwclass
10710         eval $setvar
10711
10712         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10713                 val="$define"
10714         else
10715                 val="$undef"
10716         fi
10717         set d_pwexpire
10718         eval $setvar
10719
10720         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10721                 val="$define"
10722         else
10723                 val="$undef"
10724         fi
10725         set d_pwcomment
10726         eval $setvar
10727
10728         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10729                 val="$define"
10730         else
10731                 val="$undef"
10732         fi
10733         set d_pwgecos
10734         eval $setvar
10735
10736         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10737                 val="$define"
10738         else
10739                 val="$undef"
10740         fi
10741         set d_pwpasswd
10742         eval $setvar
10743
10744         $rm -f $$.h
10745         ;;
10746 *)
10747         val="$undef"; 
10748         set d_pwquota; eval $setvar
10749         set d_pwage; eval $setvar
10750         set d_pwchange; eval $setvar
10751         set d_pwclass; eval $setvar
10752         set d_pwexpire; eval $setvar
10753         set d_pwcomment; eval $setvar
10754         set d_pwgecos; eval $setvar
10755         set d_pwpasswd; eval $setvar
10756         ;;
10757 esac
10758
10759 : see if endpwent_r exists
10760 set endpwent_r d_endpwent_r
10761 eval $inlibc
10762 case "$d_endpwent_r" in
10763 "$define")
10764         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10765         case "$d_endpwent_r_proto:$usethreads" in
10766         ":define")      d_endpwent_r_proto=define
10767                 set d_endpwent_r_proto endpwent_r $hdrs
10768                 eval $hasproto ;;
10769         *)      ;;
10770         esac
10771         case "$d_endpwent_r_proto" in
10772         define)
10773         case "$endpwent_r_proto" in
10774         ''|0) try='int endpwent_r(FILE**);'
10775         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10776         esac
10777         case "$endpwent_r_proto" in
10778         ''|0) try='void endpwent_r(FILE**);'
10779         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10780         esac
10781         case "$endpwent_r_proto" in
10782         '')     d_endpwent_r=undef
10783                 endpwent_r_proto=0
10784                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10785         * )     case "$endpwent_r_proto" in
10786                 REENTRANT_PROTO*) ;;
10787                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10788                 esac
10789                 echo "Prototype: $try" ;;
10790         esac
10791         ;;
10792         *)      case "$usethreads" in
10793                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10794                 esac
10795                 ;;
10796         esac
10797         ;;
10798 *)      endpwent_r_proto=0
10799         ;;
10800 esac
10801
10802 : see if endservent exists
10803 set endservent d_endsent
10804 eval $inlibc
10805
10806 : see if endservent_r exists
10807 set endservent_r d_endservent_r
10808 eval $inlibc
10809 case "$d_endservent_r" in
10810 "$define")
10811         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10812         case "$d_endservent_r_proto:$usethreads" in
10813         ":define")      d_endservent_r_proto=define
10814                 set d_endservent_r_proto endservent_r $hdrs
10815                 eval $hasproto ;;
10816         *)      ;;
10817         esac
10818         case "$d_endservent_r_proto" in
10819         define)
10820         case "$endservent_r_proto" in
10821         ''|0) try='int endservent_r(struct servent_data*);'
10822         ./protochk "extern $try" $hdrs && endservent_r_proto=I_S ;;
10823         esac
10824         case "$endservent_r_proto" in
10825         ''|0) try='void endservent_r(struct servent_data*);'
10826         ./protochk "extern $try" $hdrs && endservent_r_proto=V_S ;;
10827         esac
10828         case "$endservent_r_proto" in
10829         '')     d_endservent_r=undef
10830                 endservent_r_proto=0
10831                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10832         * )     case "$endservent_r_proto" in
10833                 REENTRANT_PROTO*) ;;
10834                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10835                 esac
10836                 echo "Prototype: $try" ;;
10837         esac
10838         ;;
10839         *)      case "$usethreads" in
10840                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10841                 esac
10842                 ;;
10843         esac
10844         ;;
10845 *)      endservent_r_proto=0
10846         ;;
10847 esac
10848
10849 : Locate the flags for 'open()'
10850 echo " "
10851 $cat >try.c <<'EOCP'
10852 #include <sys/types.h>
10853 #ifdef I_FCNTL
10854 #include <fcntl.h>
10855 #endif
10856 #ifdef I_SYS_FILE
10857 #include <sys/file.h>
10858 #endif
10859 int main() {
10860         if(O_RDONLY);
10861 #ifdef O_TRUNC
10862         exit(0);
10863 #else
10864         exit(1);
10865 #endif
10866 }
10867 EOCP
10868 : check sys/file.h first to get FREAD on Sun
10869 if $test `./findhdr sys/file.h` && \
10870                 set try -DI_SYS_FILE && eval $compile; then
10871         h_sysfile=true;
10872         echo "<sys/file.h> defines the O_* constants..." >&4
10873         if $run ./try; then
10874                 echo "and you have the 3 argument form of open()." >&4
10875                 val="$define"
10876         else
10877                 echo "but not the 3 argument form of open().  Oh, well." >&4
10878                 val="$undef"
10879         fi
10880 elif $test `./findhdr fcntl.h` && \
10881                 set try -DI_FCNTL && eval $compile; then
10882         h_fcntl=true;
10883         echo "<fcntl.h> defines the O_* constants..." >&4
10884         if $run ./try; then
10885                 echo "and you have the 3 argument form of open()." >&4
10886                 val="$define"
10887         else
10888                 echo "but not the 3 argument form of open().  Oh, well." >&4
10889                 val="$undef"
10890         fi
10891 else
10892         val="$undef"
10893         echo "I can't find the O_* constant definitions!  You got problems." >&4
10894 fi
10895 set d_open3
10896 eval $setvar
10897 $rm -f try try.*
10898
10899 : see which of string.h or strings.h is needed
10900 echo " "
10901 strings=`./findhdr string.h`
10902 if $test "$strings" && $test -r "$strings"; then
10903         echo "Using <string.h> instead of <strings.h>." >&4
10904         val="$define"
10905 else
10906         val="$undef"
10907         strings=`./findhdr strings.h`
10908         if $test "$strings" && $test -r "$strings"; then
10909                 echo "Using <strings.h> instead of <string.h>." >&4
10910         else
10911                 echo "No string header found -- You'll surely have problems." >&4
10912         fi
10913 fi
10914 set i_string
10915 eval $setvar
10916 case "$i_string" in
10917 "$undef") strings=`./findhdr strings.h`;;
10918 *)        strings=`./findhdr string.h`;;
10919 esac
10920
10921 : see if this is a sys/file.h system
10922 val=''
10923 set sys/file.h val
10924 eval $inhdr
10925
10926 : do we need to include sys/file.h ?
10927 case "$val" in
10928 "$define")
10929         echo " "
10930         if $h_sysfile; then
10931                 val="$define"
10932                 echo "We'll be including <sys/file.h>." >&4
10933         else
10934                 val="$undef"
10935                 echo "We won't be including <sys/file.h>." >&4
10936         fi
10937         ;;
10938 *)
10939         h_sysfile=false
10940         ;;
10941 esac
10942 set i_sysfile
10943 eval $setvar
10944
10945 : see if fcntl.h is there
10946 val=''
10947 set fcntl.h val
10948 eval $inhdr
10949
10950 : see if we can include fcntl.h
10951 case "$val" in
10952 "$define")
10953         echo " "
10954         if $h_fcntl; then
10955                 val="$define"
10956                 echo "We'll be including <fcntl.h>." >&4
10957         else
10958                 val="$undef"
10959                 if $h_sysfile; then
10960         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10961                 else
10962                         echo "We won't be including <fcntl.h>." >&4
10963                 fi
10964         fi
10965         ;;
10966 *)
10967         h_fcntl=false
10968         val="$undef"
10969         ;;
10970 esac
10971 set i_fcntl
10972 eval $setvar
10973
10974 : check for non-blocking I/O stuff
10975 case "$h_sysfile" in
10976 true) echo "#include <sys/file.h>" > head.c;;
10977 *)
10978        case "$h_fcntl" in
10979        true) echo "#include <fcntl.h>" > head.c;;
10980        *) echo "#include <sys/fcntl.h>" > head.c;;
10981        esac
10982        ;;
10983 esac
10984 echo " "
10985 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
10986 case "$o_nonblock" in
10987 '')
10988         $cat head.c > try.c
10989         $cat >>try.c <<EOCP
10990 #include <stdio.h>
10991 #include <stdlib.h>
10992 #$i_fcntl I_FCNTL
10993 #ifdef I_FCNTL
10994 #include <fcntl.h>
10995 #endif
10996 int main() {
10997 #ifdef O_NONBLOCK
10998         printf("O_NONBLOCK\n");
10999         exit(0);
11000 #endif
11001 #ifdef O_NDELAY
11002         printf("O_NDELAY\n");
11003         exit(0);
11004 #endif
11005 #ifdef FNDELAY
11006         printf("FNDELAY\n");
11007         exit(0);
11008 #endif
11009         exit(0);
11010 }
11011 EOCP
11012         set try
11013         if eval $compile_ok; then
11014                 o_nonblock=`$run ./try`
11015                 case "$o_nonblock" in
11016                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11017                 *) echo "Seems like we can use $o_nonblock.";;
11018                 esac
11019         else
11020                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11021         fi
11022         ;;
11023 *) echo "Using $hint value $o_nonblock.";;
11024 esac
11025 $rm -f try try.* .out core
11026
11027 echo " "
11028 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11029 case "$eagain" in
11030 '')
11031         $cat head.c > try.c
11032         $cat >>try.c <<EOCP
11033 #include <errno.h>
11034 #include <sys/types.h>
11035 #include <signal.h>
11036 #include <stdio.h> 
11037 #include <stdlib.h> 
11038 #$i_fcntl I_FCNTL
11039 #ifdef I_FCNTL
11040 #include <fcntl.h>
11041 #endif
11042 #define MY_O_NONBLOCK $o_nonblock
11043 #ifndef errno  /* XXX need better Configure test */
11044 extern int errno;
11045 #endif
11046 #$i_unistd I_UNISTD
11047 #ifdef I_UNISTD
11048 #include <unistd.h>
11049 #endif
11050 #$i_string I_STRING
11051 #ifdef I_STRING
11052 #include <string.h>
11053 #else
11054 #include <strings.h>
11055 #endif
11056 $signal_t blech(x) int x; { exit(3); }
11057 EOCP
11058         $cat >> try.c <<'EOCP'
11059 int main()
11060 {
11061         int pd[2];
11062         int pu[2];
11063         char buf[1];
11064         char string[100];
11065
11066         pipe(pd);       /* Down: child -> parent */
11067         pipe(pu);       /* Up: parent -> child */
11068         if (0 != fork()) {
11069                 int ret;
11070                 close(pd[1]);   /* Parent reads from pd[0] */
11071                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11072 #ifdef F_SETFL
11073                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11074                         exit(1);
11075 #else
11076                 exit(4);
11077 #endif
11078                 signal(SIGALRM, blech);
11079                 alarm(5);
11080                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11081                         exit(2);
11082                 sprintf(string, "%d\n", ret);
11083                 write(2, string, strlen(string));
11084                 alarm(0);
11085 #ifdef EAGAIN
11086                 if (errno == EAGAIN) {
11087                         printf("EAGAIN\n");
11088                         goto ok;
11089                 }
11090 #endif
11091 #ifdef EWOULDBLOCK
11092                 if (errno == EWOULDBLOCK)
11093                         printf("EWOULDBLOCK\n");
11094 #endif
11095         ok:
11096                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11097                 sleep(2);                               /* Give it time to close our pipe */
11098                 alarm(5);
11099                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11100                 alarm(0);
11101                 sprintf(string, "%d\n", ret);
11102                 write(4, string, strlen(string));
11103                 exit(0);
11104         }
11105
11106         close(pd[0]);                   /* We write to pd[1] */
11107         close(pu[1]);                   /* We read from pu[0] */
11108         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11109         close(pd[1]);                   /* Pipe pd is now fully closed! */
11110         exit(0);                                /* Bye bye, thank you for playing! */
11111 }
11112 EOCP
11113         set try
11114         if eval $compile_ok; then
11115                 echo "$startsh" >mtry
11116                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11117                 chmod +x mtry
11118                 ./mtry >/dev/null 2>&1
11119                 case $? in
11120                 0) eagain=`$cat try.out`;;
11121                 1) echo "Could not perform non-blocking setting!";;
11122                 2) echo "I did a successful read() for something that was not there!";;
11123                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11124                 4) echo "Could not find F_SETFL!";;
11125                 *) echo "Something terribly wrong happened during testing.";;
11126                 esac
11127                 rd_nodata=`$cat try.ret`
11128                 echo "A read() system call with no data present returns $rd_nodata."
11129                 case "$rd_nodata" in
11130                 0|-1) ;;
11131                 *)
11132                         echo "(That's peculiar, fixing that to be -1.)"
11133                         rd_nodata=-1
11134                         ;;
11135                 esac
11136                 case "$eagain" in
11137                 '')
11138                         echo "Forcing errno EAGAIN on read() with no data available."
11139                         eagain=EAGAIN
11140                         ;;
11141                 *)
11142                         echo "Your read() sets errno to $eagain when no data is available."
11143                         ;;
11144                 esac
11145                 status=`$cat try.err`
11146                 case "$status" in
11147                 0) echo "And it correctly returns 0 to signal EOF.";;
11148                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11149                 *) echo "However, your read() returns '$status' on EOF??";;
11150                 esac
11151                 val="$define"
11152                 if test "$status" = "$rd_nodata"; then
11153                         echo "WARNING: you can't distinguish between EOF and no data!"
11154                         val="$undef"
11155                 fi
11156         else
11157                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11158                 eagain=EAGAIN
11159         fi
11160         set d_eofnblk
11161         eval $setvar
11162         ;;
11163 *)
11164         echo "Using $hint value $eagain."
11165         echo "Your read() returns $rd_nodata when no data is present."
11166         case "$d_eofnblk" in
11167         "$define") echo "And you can see EOF because read() returns 0.";;
11168         "$undef") echo "But you can't see EOF status from read() returned value.";;
11169         *)
11170                 echo "(Assuming you can't see EOF status from read anyway.)"
11171                 d_eofnblk=$undef
11172                 ;;
11173         esac
11174         ;;
11175 esac
11176 $rm -f try try.* .out core head.c mtry
11177
11178 : see if fchdir exists
11179 set fchdir d_fchdir
11180 eval $inlibc
11181
11182 : see if fchmod exists
11183 set fchmod d_fchmod
11184 eval $inlibc
11185
11186 : see if fchown exists
11187 set fchown d_fchown
11188 eval $inlibc
11189
11190 : see if this is an fcntl system
11191 set fcntl d_fcntl
11192 eval $inlibc
11193
11194 echo " "
11195 : See if fcntl-based locking works.
11196 $cat >try.c <<EOCP
11197 #include <stdlib.h>
11198 #include <unistd.h>
11199 #include <fcntl.h>
11200 #include <signal.h>
11201 $signal_t blech(x) int x; { exit(3); }
11202 int main() {
11203 #if defined(F_SETLK) && defined(F_SETLKW)
11204      struct flock flock;
11205      int retval, fd;
11206      fd = open("try.c", O_RDONLY);
11207      flock.l_type = F_RDLCK;
11208      flock.l_whence = SEEK_SET;
11209      flock.l_start = flock.l_len = 0;
11210      signal(SIGALRM, blech);
11211      alarm(10);
11212      retval = fcntl(fd, F_SETLK, &flock);
11213      close(fd);
11214      (retval < 0 ? exit(2) : exit(0));
11215 #else
11216      exit(2);
11217 #endif
11218 }
11219 EOCP
11220 echo "Checking if fcntl-based file locking works... "
11221 case "$d_fcntl" in
11222 "$define")
11223         set try
11224         if eval $compile_ok; then
11225                 if $run ./try; then
11226                         echo "Yes, it seems to work."
11227                         val="$define"
11228                 else
11229                         echo "Nope, it didn't work."
11230                         val="$undef"
11231                         case "$?" in
11232                         3) $cat >&4 <<EOM
11233 ***
11234 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11235 *** This is (almost) impossible.
11236 *** If your NFS lock daemons are not feeling well, something like
11237 *** this may happen, please investigate.  Cannot continue, aborting.
11238 ***
11239 EOM
11240                                 exit 1
11241                                 ;;
11242                         esac
11243                 fi
11244         else
11245                 echo "I'm unable to compile the test program, so I'll assume not."
11246                 val="$undef"
11247         fi
11248         ;;
11249 *) val="$undef";
11250         echo "Nope, since you don't even have fcntl()."
11251         ;;
11252 esac
11253 set d_fcntl_can_lock
11254 eval $setvar
11255 $rm -f try*
11256
11257
11258 : check for fd_set items
11259 $cat <<EOM
11260
11261 Checking to see how well your C compiler handles fd_set and friends ...
11262 EOM
11263 $cat >try.c <<EOCP
11264 #$i_systime I_SYS_TIME
11265 #$i_sysselct I_SYS_SELECT
11266 #$d_socket HAS_SOCKET
11267 #include <sys/types.h>
11268 #ifdef HAS_SOCKET
11269 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11270 #endif
11271 #ifdef I_SYS_TIME
11272 #include <sys/time.h>
11273 #endif
11274 #ifdef I_SYS_SELECT
11275 #include <sys/select.h>
11276 #endif
11277 int main() {
11278         fd_set fds;
11279
11280 #ifdef TRYBITS
11281         if(fds.fds_bits);
11282 #endif
11283
11284 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11285         exit(0);
11286 #else
11287         exit(1);
11288 #endif
11289 }
11290 EOCP
11291 set try -DTRYBITS
11292 if eval $compile; then
11293         d_fds_bits="$define"
11294         d_fd_set="$define"
11295         echo "Well, your system knows about the normal fd_set typedef..." >&4
11296         if $run ./try; then
11297                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11298                 d_fd_macros="$define"
11299         else
11300                 $cat >&4 <<'EOM'
11301 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11302 EOM
11303                 d_fd_macros="$undef"
11304         fi
11305 else
11306         $cat <<'EOM'
11307 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11308 EOM
11309         set try
11310         if eval $compile; then
11311                 d_fds_bits="$undef"
11312                 d_fd_set="$define"
11313                 echo "Well, your system has some sort of fd_set available..." >&4
11314                 if $run ./try; then
11315                         echo "and you have the normal fd_set macros." >&4
11316                         d_fd_macros="$define"
11317                 else
11318                         $cat <<'EOM'
11319 but not the normal fd_set macros!  Gross!  More work for me...
11320 EOM
11321                         d_fd_macros="$undef"
11322                 fi
11323         else
11324         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11325                 d_fd_set="$undef"
11326                 d_fds_bits="$undef"
11327                 d_fd_macros="$undef"
11328         fi
11329 fi
11330 $rm -f try try.*
11331
11332 : see if fgetpos exists
11333 set fgetpos d_fgetpos
11334 eval $inlibc
11335
11336 : see if finite exists
11337 set finite d_finite
11338 eval $inlibc
11339
11340 : see if finitel exists
11341 set finitel d_finitel
11342 eval $inlibc
11343
11344 : see if flock exists
11345 set flock d_flock
11346 eval $inlibc
11347
11348 : see if prototype for flock is available
11349 echo " "
11350 set d_flockproto flock $i_sysfile sys/file.h
11351 eval $hasproto
11352
11353 : see if fork exists
11354 set fork d_fork
11355 eval $inlibc
11356
11357 : see if fp_class exists
11358 set fp_class d_fp_class
11359 eval $inlibc
11360
11361 : see if pathconf exists
11362 set pathconf d_pathconf
11363 eval $inlibc
11364
11365 : see if fpathconf exists
11366 set fpathconf d_fpathconf
11367 eval $inlibc
11368
11369 : see if fpclass exists
11370 set fpclass d_fpclass
11371 eval $inlibc
11372
11373 : see if fpclassify exists
11374 set fpclassify d_fpclassify
11375 eval $inlibc
11376
11377 : see if fpclassl exists
11378 set fpclassl d_fpclassl
11379 eval $inlibc
11380
11381
11382 : check for fpos64_t
11383 echo " "
11384 echo "Checking to see if you have fpos64_t..." >&4
11385 $cat >try.c <<EOCP
11386 #include <stdio.h>
11387 int main() { fpos64_t x = 7; }
11388 EOCP
11389 set try
11390 if eval $compile; then
11391         val="$define"
11392         echo "You have fpos64_t."
11393 else
11394         val="$undef"
11395         echo "You do not have fpos64_t."
11396         case "$fpossize" in
11397         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11398         esac
11399 fi
11400 $rm -f try.* try
11401 set d_fpos64_t
11402 eval $setvar
11403
11404 : see if frexpl exists
11405 set frexpl d_frexpl
11406 eval $inlibc
11407
11408 : see if this is a sys/param system
11409 set sys/param.h i_sysparam
11410 eval $inhdr
11411
11412 : see if this is a sys/mount.h system
11413 set sys/mount.h i_sysmount
11414 eval $inhdr
11415
11416
11417 echo " "
11418 echo "Checking to see if your system supports struct fs_data..." >&4
11419 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11420 eval $hasstruct
11421 case "$d_fs_data_s" in
11422 "$define")      echo "Yes, it does."   ;;
11423 *)              echo "No, it doesn't." ;;
11424 esac
11425
11426 : see if fseeko exists
11427 set fseeko d_fseeko
11428 eval $inlibc
11429 case "$longsize" in
11430 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11431 esac
11432
11433 : see if fsetpos exists
11434 set fsetpos d_fsetpos
11435 eval $inlibc
11436
11437
11438 : see if fstatfs exists
11439 set fstatfs d_fstatfs
11440 eval $inlibc
11441
11442
11443 : see if statvfs exists
11444 set statvfs d_statvfs
11445 eval $inlibc
11446
11447 : see if fstatvfs exists
11448 set fstatvfs d_fstatvfs
11449 eval $inlibc
11450
11451
11452 : see if fsync exists
11453 set fsync d_fsync
11454 eval $inlibc
11455
11456 : see if ftello exists
11457 set ftello d_ftello
11458 eval $inlibc
11459 case "$longsize" in
11460 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11461 esac
11462
11463 : see if getcwd exists
11464 set getcwd d_getcwd
11465 eval $inlibc
11466
11467 : see if getespwnam exists
11468 set getespwnam d_getespwnam
11469 eval $inlibc
11470
11471
11472 : see if getfsstat exists
11473 set getfsstat d_getfsstat
11474 eval $inlibc
11475
11476 : see if getgrent exists
11477 set getgrent d_getgrent
11478 eval $inlibc
11479
11480 : see if getgrent_r exists
11481 set getgrent_r d_getgrent_r
11482 eval $inlibc
11483 case "$d_getgrent_r" in
11484 "$define")
11485         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11486         case "$d_getgrent_r_proto:$usethreads" in
11487         ":define")      d_getgrent_r_proto=define
11488                 set d_getgrent_r_proto getgrent_r $hdrs
11489                 eval $hasproto ;;
11490         *)      ;;
11491         esac
11492         case "$d_getgrent_r_proto" in
11493         define)
11494         case "$getgrent_r_proto" in
11495         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11496         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11497         esac
11498         case "$getgrent_r_proto" in
11499         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11500         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11501         esac
11502         case "$getgrent_r_proto" in
11503         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11504         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11505         esac
11506         case "$getgrent_r_proto" in
11507         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11508         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11509         esac
11510         case "$getgrent_r_proto" in
11511         ''|0) try='int getgrent_r(struct group*, char*, int);'
11512         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11513         esac
11514         case "$getgrent_r_proto" in
11515         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11516         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11517         esac
11518         case "$getgrent_r_proto" in
11519         '')     d_getgrent_r=undef
11520                 getgrent_r_proto=0
11521                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11522         * )     case "$getgrent_r_proto" in
11523                 REENTRANT_PROTO*) ;;
11524                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11525                 esac
11526                 echo "Prototype: $try" ;;
11527         esac
11528         ;;
11529         *)      case "$usethreads" in
11530                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11531                 esac
11532                 ;;
11533         esac
11534         ;;
11535 *)      getgrent_r_proto=0
11536         ;;
11537 esac
11538
11539 : see if getgrgid_r exists
11540 set getgrgid_r d_getgrgid_r
11541 eval $inlibc
11542 case "$d_getgrgid_r" in
11543 "$define")
11544         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11545         case "$d_getgrgid_r_proto:$usethreads" in
11546         ":define")      d_getgrgid_r_proto=define
11547                 set d_getgrgid_r_proto getgrgid_r $hdrs
11548                 eval $hasproto ;;
11549         *)      ;;
11550         esac
11551         case "$d_getgrgid_r_proto" in
11552         define)
11553         case "$getgrgid_r_proto" in
11554         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11555         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11556         esac
11557         case "$getgrgid_r_proto" in
11558         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11559         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11560         esac
11561         case "$getgrgid_r_proto" in
11562         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11563         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11564         esac
11565         case "$getgrgid_r_proto" in
11566         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11567         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11568         esac
11569         case "$getgrgid_r_proto" in
11570         '')     d_getgrgid_r=undef
11571                 getgrgid_r_proto=0
11572                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11573         * )     case "$getgrgid_r_proto" in
11574                 REENTRANT_PROTO*) ;;
11575                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11576                 esac
11577                 echo "Prototype: $try" ;;
11578         esac
11579         ;;
11580         *)      case "$usethreads" in
11581                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11582                 esac
11583                 ;;
11584         esac
11585         ;;
11586 *)      getgrgid_r_proto=0
11587         ;;
11588 esac
11589
11590 : see if getgrnam_r exists
11591 set getgrnam_r d_getgrnam_r
11592 eval $inlibc
11593 case "$d_getgrnam_r" in
11594 "$define")
11595         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11596         case "$d_getgrnam_r_proto:$usethreads" in
11597         ":define")      d_getgrnam_r_proto=define
11598                 set d_getgrnam_r_proto getgrnam_r $hdrs
11599                 eval $hasproto ;;
11600         *)      ;;
11601         esac
11602         case "$d_getgrnam_r_proto" in
11603         define)
11604         case "$getgrnam_r_proto" in
11605         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11606         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11607         esac
11608         case "$getgrnam_r_proto" in
11609         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11610         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11611         esac
11612         case "$getgrnam_r_proto" in
11613         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11614         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11615         esac
11616         case "$getgrnam_r_proto" in
11617         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11618         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11619         esac
11620         case "$getgrnam_r_proto" in
11621         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11622         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11623         esac
11624         case "$getgrnam_r_proto" in
11625         '')     d_getgrnam_r=undef
11626                 getgrnam_r_proto=0
11627                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11628         * )     case "$getgrnam_r_proto" in
11629                 REENTRANT_PROTO*) ;;
11630                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11631                 esac
11632                 echo "Prototype: $try" ;;
11633         esac
11634         ;;
11635         *)      case "$usethreads" in
11636                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11637                 esac
11638                 ;;
11639         esac
11640         ;;
11641 *)      getgrnam_r_proto=0
11642         ;;
11643 esac
11644
11645 : see if gethostbyaddr exists
11646 set gethostbyaddr d_gethbyaddr
11647 eval $inlibc
11648
11649 : see if gethostbyname exists
11650 set gethostbyname d_gethbyname
11651 eval $inlibc
11652
11653 : see if gethostent exists
11654 set gethostent d_gethent
11655 eval $inlibc
11656
11657 : see how we will look up host name
11658 echo " "
11659 call=''
11660 if set gethostname val -f d_gethname; eval $csym; $val; then
11661         echo 'gethostname() found.' >&4
11662         d_gethname="$define"
11663         call=gethostname
11664 fi
11665 if set uname val -f d_uname; eval $csym; $val; then
11666         if ./xenix; then
11667                 $cat <<'EOM'
11668 uname() was found, but you're running xenix, and older versions of xenix
11669 have a broken uname(). If you don't really know whether your xenix is old
11670 enough to have a broken system call, use the default answer.
11671
11672 EOM
11673                 dflt=y
11674                 case "$d_uname" in
11675                 "$define") dflt=n;;
11676                 esac
11677                 rp='Is your uname() broken?'
11678                 . ./myread
11679                 case "$ans" in
11680                 n*) d_uname="$define"; call=uname;;
11681                 esac
11682         else
11683                 echo 'uname() found.' >&4
11684                 d_uname="$define"
11685                 case "$call" in
11686                 '') call=uname ;;
11687                 esac
11688         fi
11689 fi
11690 case "$d_gethname" in
11691 '') d_gethname="$undef";;
11692 esac
11693 case "$d_uname" in
11694 '') d_uname="$undef";;
11695 esac
11696 case "$d_uname$d_gethname" in
11697 *define*)
11698         dflt=n
11699         cat <<EOM
11700  
11701 Every now and then someone has a $call() that lies about the hostname
11702 but can't be fixed for political or economic reasons.  If you wish, I can
11703 pretend $call() isn't there and maybe compute hostname at run-time
11704 thanks to the '$phostname' command.
11705
11706 EOM
11707         rp="Shall I ignore $call() from now on?"
11708         . ./myread
11709         case "$ans" in
11710         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11711         esac;;
11712 esac
11713 case "$phostname" in
11714 '') aphostname='';;
11715 *) case "$aphostname" in
11716         /*) ;;
11717         *) set X $phostname
11718                 shift
11719                 file=$1
11720                 shift
11721                 file=`./loc $file $file $pth`
11722                 aphostname=`echo $file $*`
11723                 ;;
11724         esac
11725         ;;
11726 esac
11727 case "$d_uname$d_gethname" in
11728 *define*) ;;
11729 *)
11730         case "$phostname" in
11731         '')
11732                 echo "There will be no way for $package to get your hostname." >&4;;
11733         *)
11734         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11735                 ;;
11736         esac;;
11737 esac
11738 case "$d_phostname" in
11739 '') d_phostname="$undef";;
11740 esac
11741
11742 : see if gethostbyaddr_r exists
11743 set gethostbyaddr_r d_gethostbyaddr_r
11744 eval $inlibc
11745 case "$d_gethostbyaddr_r" in
11746 "$define")
11747         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11748         case "$d_gethostbyaddr_r_proto:$usethreads" in
11749         ":define")      d_gethostbyaddr_r_proto=define
11750                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11751                 eval $hasproto ;;
11752         *)      ;;
11753         esac
11754         case "$d_gethostbyaddr_r_proto" in
11755         define)
11756         case "$gethostbyaddr_r_proto" in
11757         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11758         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11759         esac
11760         case "$gethostbyaddr_r_proto" in
11761         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11762         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11763         esac
11764         case "$gethostbyaddr_r_proto" in
11765         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11766         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11767         esac
11768         case "$gethostbyaddr_r_proto" in
11769         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11770         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11771         esac
11772         case "$gethostbyaddr_r_proto" in
11773         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11774         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11775         esac
11776         case "$gethostbyaddr_r_proto" in
11777         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11778         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11779         esac
11780         case "$gethostbyaddr_r_proto" in
11781         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11782         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11783         esac
11784         case "$gethostbyaddr_r_proto" in
11785         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11786         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11787         esac
11788         case "$gethostbyaddr_r_proto" in
11789         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11790         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11791         esac
11792         case "$gethostbyaddr_r_proto" in
11793         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11794         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11795         esac
11796         case "$gethostbyaddr_r_proto" in
11797         '')     d_gethostbyaddr_r=undef
11798                 gethostbyaddr_r_proto=0
11799                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11800         * )     case "$gethostbyaddr_r_proto" in
11801                 REENTRANT_PROTO*) ;;
11802                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11803                 esac
11804                 echo "Prototype: $try" ;;
11805         esac
11806         ;;
11807         *)      case "$usethreads" in
11808                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11809                 esac
11810                 ;;
11811         esac
11812         ;;
11813 *)      gethostbyaddr_r_proto=0
11814         ;;
11815 esac
11816
11817 : see if gethostbyname_r exists
11818 set gethostbyname_r d_gethostbyname_r
11819 eval $inlibc
11820 case "$d_gethostbyname_r" in
11821 "$define")
11822         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11823         case "$d_gethostbyname_r_proto:$usethreads" in
11824         ":define")      d_gethostbyname_r_proto=define
11825                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11826                 eval $hasproto ;;
11827         *)      ;;
11828         esac
11829         case "$d_gethostbyname_r_proto" in
11830         define)
11831         case "$gethostbyname_r_proto" in
11832         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11833         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11834         esac
11835         case "$gethostbyname_r_proto" in
11836         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11837         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11838         esac
11839         case "$gethostbyname_r_proto" in
11840         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11841         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11842         esac
11843         case "$gethostbyname_r_proto" in
11844         '')     d_gethostbyname_r=undef
11845                 gethostbyname_r_proto=0
11846                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11847         * )     case "$gethostbyname_r_proto" in
11848                 REENTRANT_PROTO*) ;;
11849                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11850                 esac
11851                 echo "Prototype: $try" ;;
11852         esac
11853         ;;
11854         *)      case "$usethreads" in
11855                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11856                 esac
11857                 ;;
11858         esac
11859         ;;
11860 *)      gethostbyname_r_proto=0
11861         ;;
11862 esac
11863
11864 : see if gethostent_r exists
11865 set gethostent_r d_gethostent_r
11866 eval $inlibc
11867 case "$d_gethostent_r" in
11868 "$define")
11869         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11870         case "$d_gethostent_r_proto:$usethreads" in
11871         ":define")      d_gethostent_r_proto=define
11872                 set d_gethostent_r_proto gethostent_r $hdrs
11873                 eval $hasproto ;;
11874         *)      ;;
11875         esac
11876         case "$d_gethostent_r_proto" in
11877         define)
11878         case "$gethostent_r_proto" in
11879         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11880         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11881         esac
11882         case "$gethostent_r_proto" in
11883         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11884         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11885         esac
11886         case "$gethostent_r_proto" in
11887         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11888         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11889         esac
11890         case "$gethostent_r_proto" in
11891         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11892         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11893         esac
11894         case "$gethostent_r_proto" in
11895         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11896         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11897         esac
11898         case "$gethostent_r_proto" in
11899         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11900         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11901         esac
11902         case "$gethostent_r_proto" in
11903         '')     d_gethostent_r=undef
11904                 gethostent_r_proto=0
11905                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11906         * )     case "$gethostent_r_proto" in
11907                 REENTRANT_PROTO*) ;;
11908                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11909                 esac
11910                 echo "Prototype: $try" ;;
11911         esac
11912         ;;
11913         *)      case "$usethreads" in
11914                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11915                 esac
11916                 ;;
11917         esac
11918         ;;
11919 *)      gethostent_r_proto=0
11920         ;;
11921 esac
11922
11923 : see if prototypes for various gethostxxx netdb.h functions are available
11924 echo " "
11925 set d_gethostprotos gethostent $i_netdb netdb.h
11926 eval $hasproto
11927
11928 : see if getitimer exists
11929 set getitimer d_getitimer
11930 eval $inlibc
11931
11932 : see if getlogin exists
11933 set getlogin d_getlogin
11934 eval $inlibc
11935
11936 : see if getlogin_r exists
11937 set getlogin_r d_getlogin_r
11938 eval $inlibc
11939 case "$d_getlogin_r" in
11940 "$define")
11941         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11942         case "$d_getlogin_r_proto:$usethreads" in
11943         ":define")      d_getlogin_r_proto=define
11944                 set d_getlogin_r_proto getlogin_r $hdrs
11945                 eval $hasproto ;;
11946         *)      ;;
11947         esac
11948         case "$d_getlogin_r_proto" in
11949         define)
11950         case "$getlogin_r_proto" in
11951         ''|0) try='int getlogin_r(char*, size_t);'
11952         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11953         esac
11954         case "$getlogin_r_proto" in
11955         ''|0) try='int getlogin_r(char*, int);'
11956         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11957         esac
11958         case "$getlogin_r_proto" in
11959         ''|0) try='char* getlogin_r(char*, size_t);'
11960         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11961         esac
11962         case "$getlogin_r_proto" in
11963         ''|0) try='char* getlogin_r(char*, int);'
11964         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11965         esac
11966         case "$getlogin_r_proto" in
11967         '')     d_getlogin_r=undef
11968                 getlogin_r_proto=0
11969                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
11970         * )     case "$getlogin_r_proto" in
11971                 REENTRANT_PROTO*) ;;
11972                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
11973                 esac
11974                 echo "Prototype: $try" ;;
11975         esac
11976         ;;
11977         *)      case "$usethreads" in
11978                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
11979                 esac
11980                 ;;
11981         esac
11982         ;;
11983 *)      getlogin_r_proto=0
11984         ;;
11985 esac
11986
11987 : see if getmnt exists
11988 set getmnt d_getmnt
11989 eval $inlibc
11990
11991 : see if getmntent exists
11992 set getmntent d_getmntent
11993 eval $inlibc
11994
11995 : see if getnetbyaddr exists
11996 set getnetbyaddr d_getnbyaddr
11997 eval $inlibc
11998
11999 : see if getnetbyname exists
12000 set getnetbyname d_getnbyname
12001 eval $inlibc
12002
12003 : see if getnetent exists
12004 set getnetent d_getnent
12005 eval $inlibc
12006
12007 : see if getnetbyaddr_r exists
12008 set getnetbyaddr_r d_getnetbyaddr_r
12009 eval $inlibc
12010 case "$d_getnetbyaddr_r" in
12011 "$define")
12012         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12013         case "$d_getnetbyaddr_r_proto:$usethreads" in
12014         ":define")      d_getnetbyaddr_r_proto=define
12015                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12016                 eval $hasproto ;;
12017         *)      ;;
12018         esac
12019         case "$d_getnetbyaddr_r_proto" in
12020         define)
12021         case "$getnetbyaddr_r_proto" in
12022         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12023         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12024         esac
12025         case "$getnetbyaddr_r_proto" in
12026         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12027         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12028         esac
12029         case "$getnetbyaddr_r_proto" in
12030         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12031         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12032         esac
12033         case "$getnetbyaddr_r_proto" in
12034         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12035         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12036         esac
12037         case "$getnetbyaddr_r_proto" in
12038         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12039         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12040         esac
12041         case "$getnetbyaddr_r_proto" in
12042         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12043         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12044         esac
12045         case "$getnetbyaddr_r_proto" in
12046         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12047         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12048         esac
12049         case "$getnetbyaddr_r_proto" in
12050         '')     d_getnetbyaddr_r=undef
12051                 getnetbyaddr_r_proto=0
12052                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12053         * )     case "$getnetbyaddr_r_proto" in
12054                 REENTRANT_PROTO*) ;;
12055                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12056                 esac
12057                 echo "Prototype: $try" ;;
12058         esac
12059         ;;
12060         *)      case "$usethreads" in
12061                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12062                 esac
12063                 ;;
12064         esac
12065         ;;
12066 *)      getnetbyaddr_r_proto=0
12067         ;;
12068 esac
12069
12070 : see if getnetbyname_r exists
12071 set getnetbyname_r d_getnetbyname_r
12072 eval $inlibc
12073 case "$d_getnetbyname_r" in
12074 "$define")
12075         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12076         case "$d_getnetbyname_r_proto:$usethreads" in
12077         ":define")      d_getnetbyname_r_proto=define
12078                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12079                 eval $hasproto ;;
12080         *)      ;;
12081         esac
12082         case "$d_getnetbyname_r_proto" in
12083         define)
12084         case "$getnetbyname_r_proto" in
12085         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12086         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12087         esac
12088         case "$getnetbyname_r_proto" in
12089         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12090         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12091         esac
12092         case "$getnetbyname_r_proto" in
12093         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12094         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12095         esac
12096         case "$getnetbyname_r_proto" in
12097         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12098         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12099         esac
12100         case "$getnetbyname_r_proto" in
12101         '')     d_getnetbyname_r=undef
12102                 getnetbyname_r_proto=0
12103                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12104         * )     case "$getnetbyname_r_proto" in
12105                 REENTRANT_PROTO*) ;;
12106                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12107                 esac
12108                 echo "Prototype: $try" ;;
12109         esac
12110         ;;
12111         *)      case "$usethreads" in
12112                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12113                 esac
12114                 ;;
12115         esac
12116         ;;
12117 *)      getnetbyname_r_proto=0
12118         ;;
12119 esac
12120
12121 : see if getnetent_r exists
12122 set getnetent_r d_getnetent_r
12123 eval $inlibc
12124 case "$d_getnetent_r" in
12125 "$define")
12126         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12127         case "$d_getnetent_r_proto:$usethreads" in
12128         ":define")      d_getnetent_r_proto=define
12129                 set d_getnetent_r_proto getnetent_r $hdrs
12130                 eval $hasproto ;;
12131         *)      ;;
12132         esac
12133         case "$d_getnetent_r_proto" in
12134         define)
12135         case "$getnetent_r_proto" in
12136         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12137         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12138         esac
12139         case "$getnetent_r_proto" in
12140         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12141         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12142         esac
12143         case "$getnetent_r_proto" in
12144         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12145         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12146         esac
12147         case "$getnetent_r_proto" in
12148         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12149         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12150         esac
12151         case "$getnetent_r_proto" in
12152         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12153         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12154         esac
12155         case "$getnetent_r_proto" in
12156         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12157         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12158         esac
12159         case "$getnetent_r_proto" in
12160         '')     d_getnetent_r=undef
12161                 getnetent_r_proto=0
12162                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12163         * )     case "$getnetent_r_proto" in
12164                 REENTRANT_PROTO*) ;;
12165                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12166                 esac
12167                 echo "Prototype: $try" ;;
12168         esac
12169         ;;
12170         *)      case "$usethreads" in
12171                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12172                 esac
12173                 ;;
12174         esac
12175         ;;
12176 *)      getnetent_r_proto=0
12177         ;;
12178 esac
12179
12180 : see if prototypes for various getnetxxx netdb.h functions are available
12181 echo " "
12182 set d_getnetprotos getnetent $i_netdb netdb.h
12183 eval $hasproto
12184
12185 : see if getpagesize exists
12186 set getpagesize d_getpagsz
12187 eval $inlibc
12188
12189
12190 : see if getprotobyname exists
12191 set getprotobyname d_getpbyname
12192 eval $inlibc
12193
12194 : see if getprotobynumber exists
12195 set getprotobynumber d_getpbynumber
12196 eval $inlibc
12197
12198 : see if getprotoent exists
12199 set getprotoent d_getpent
12200 eval $inlibc
12201
12202 : see if getpgid exists
12203 set getpgid d_getpgid
12204 eval $inlibc
12205
12206 : see if getpgrp2 exists
12207 set getpgrp2 d_getpgrp2
12208 eval $inlibc
12209
12210 : see if getppid exists
12211 set getppid d_getppid
12212 eval $inlibc
12213
12214 : see if getpriority exists
12215 set getpriority d_getprior
12216 eval $inlibc
12217
12218 : see if getprotobyname_r exists
12219 set getprotobyname_r d_getprotobyname_r
12220 eval $inlibc
12221 case "$d_getprotobyname_r" in
12222 "$define")
12223         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12224         case "$d_getprotobyname_r_proto:$usethreads" in
12225         ":define")      d_getprotobyname_r_proto=define
12226                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12227                 eval $hasproto ;;
12228         *)      ;;
12229         esac
12230         case "$d_getprotobyname_r_proto" in
12231         define)
12232         case "$getprotobyname_r_proto" in
12233         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12234         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12235         esac
12236         case "$getprotobyname_r_proto" in
12237         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12238         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12239         esac
12240         case "$getprotobyname_r_proto" in
12241         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12242         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12243         esac
12244         case "$getprotobyname_r_proto" in
12245         '')     d_getprotobyname_r=undef
12246                 getprotobyname_r_proto=0
12247                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12248         * )     case "$getprotobyname_r_proto" in
12249                 REENTRANT_PROTO*) ;;
12250                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12251                 esac
12252                 echo "Prototype: $try" ;;
12253         esac
12254         ;;
12255         *)      case "$usethreads" in
12256                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12257                 esac
12258                 ;;
12259         esac
12260         ;;
12261 *)      getprotobyname_r_proto=0
12262         ;;
12263 esac
12264
12265 : see if getprotobynumber_r exists
12266 set getprotobynumber_r d_getprotobynumber_r
12267 eval $inlibc
12268 case "$d_getprotobynumber_r" in
12269 "$define")
12270         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12271         case "$d_getprotobynumber_r_proto:$usethreads" in
12272         ":define")      d_getprotobynumber_r_proto=define
12273                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12274                 eval $hasproto ;;
12275         *)      ;;
12276         esac
12277         case "$d_getprotobynumber_r_proto" in
12278         define)
12279         case "$getprotobynumber_r_proto" in
12280         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12281         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12282         esac
12283         case "$getprotobynumber_r_proto" in
12284         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12285         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12286         esac
12287         case "$getprotobynumber_r_proto" in
12288         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12289         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12290         esac
12291         case "$getprotobynumber_r_proto" in
12292         '')     d_getprotobynumber_r=undef
12293                 getprotobynumber_r_proto=0
12294                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12295         * )     case "$getprotobynumber_r_proto" in
12296                 REENTRANT_PROTO*) ;;
12297                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12298                 esac
12299                 echo "Prototype: $try" ;;
12300         esac
12301         ;;
12302         *)      case "$usethreads" in
12303                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12304                 esac
12305                 ;;
12306         esac
12307         ;;
12308 *)      getprotobynumber_r_proto=0
12309         ;;
12310 esac
12311
12312 : see if getprotoent_r exists
12313 set getprotoent_r d_getprotoent_r
12314 eval $inlibc
12315 case "$d_getprotoent_r" in
12316 "$define")
12317         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12318         case "$d_getprotoent_r_proto:$usethreads" in
12319         ":define")      d_getprotoent_r_proto=define
12320                 set d_getprotoent_r_proto getprotoent_r $hdrs
12321                 eval $hasproto ;;
12322         *)      ;;
12323         esac
12324         case "$d_getprotoent_r_proto" in
12325         define)
12326         case "$getprotoent_r_proto" in
12327         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12328         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12329         esac
12330         case "$getprotoent_r_proto" in
12331         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12332         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12333         esac
12334         case "$getprotoent_r_proto" in
12335         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12336         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12337         esac
12338         case "$getprotoent_r_proto" in
12339         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12340         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12341         esac
12342         case "$getprotoent_r_proto" in
12343         '')     d_getprotoent_r=undef
12344                 getprotoent_r_proto=0
12345                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12346         * )     case "$getprotoent_r_proto" in
12347                 REENTRANT_PROTO*) ;;
12348                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12349                 esac
12350                 echo "Prototype: $try" ;;
12351         esac
12352         ;;
12353         *)      case "$usethreads" in
12354                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12355                 esac
12356                 ;;
12357         esac
12358         ;;
12359 *)      getprotoent_r_proto=0
12360         ;;
12361 esac
12362
12363 : see if prototypes for various getprotoxxx netdb.h functions are available
12364 echo " "
12365 set d_getprotoprotos getprotoent $i_netdb netdb.h
12366 eval $hasproto
12367
12368 : see if getprpwnam exists
12369 set getprpwnam d_getprpwnam
12370 eval $inlibc
12371
12372 : see if getpwent exists
12373 set getpwent d_getpwent
12374 eval $inlibc
12375
12376 : see if getpwent_r exists
12377 set getpwent_r d_getpwent_r
12378 eval $inlibc
12379 case "$d_getpwent_r" in
12380 "$define")
12381         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12382         case "$d_getpwent_r_proto:$usethreads" in
12383         ":define")      d_getpwent_r_proto=define
12384                 set d_getpwent_r_proto getpwent_r $hdrs
12385                 eval $hasproto ;;
12386         *)      ;;
12387         esac
12388         case "$d_getpwent_r_proto" in
12389         define)
12390         case "$getpwent_r_proto" in
12391         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12392         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12393         esac
12394         case "$getpwent_r_proto" in
12395         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12396         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12397         esac
12398         case "$getpwent_r_proto" in
12399         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12400         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12401         esac
12402         case "$getpwent_r_proto" in
12403         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12404         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12405         esac
12406         case "$getpwent_r_proto" in
12407         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12408         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12409         esac
12410         case "$getpwent_r_proto" in
12411         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12412         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12413         esac
12414         case "$getpwent_r_proto" in
12415         '')     d_getpwent_r=undef
12416                 getpwent_r_proto=0
12417                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12418         * )     case "$getpwent_r_proto" in
12419                 REENTRANT_PROTO*) ;;
12420                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12421                 esac
12422                 echo "Prototype: $try" ;;
12423         esac
12424         ;;
12425         *)      case "$usethreads" in
12426                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12427                 esac
12428                 ;;
12429         esac
12430         ;;
12431 *)      getpwent_r_proto=0
12432         ;;
12433 esac
12434
12435 : see if getpwnam_r exists
12436 set getpwnam_r d_getpwnam_r
12437 eval $inlibc
12438 case "$d_getpwnam_r" in
12439 "$define")
12440         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12441         case "$d_getpwnam_r_proto:$usethreads" in
12442         ":define")      d_getpwnam_r_proto=define
12443                 set d_getpwnam_r_proto getpwnam_r $hdrs
12444                 eval $hasproto ;;
12445         *)      ;;
12446         esac
12447         case "$d_getpwnam_r_proto" in
12448         define)
12449         case "$getpwnam_r_proto" in
12450         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12451         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12452         esac
12453         case "$getpwnam_r_proto" in
12454         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12455         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12456         esac
12457         case "$getpwnam_r_proto" in
12458         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12459         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12460         esac
12461         case "$getpwnam_r_proto" in
12462         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12463         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12464         esac
12465         case "$getpwnam_r_proto" in
12466         '')     d_getpwnam_r=undef
12467                 getpwnam_r_proto=0
12468                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12469         * )     case "$getpwnam_r_proto" in
12470                 REENTRANT_PROTO*) ;;
12471                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12472                 esac
12473                 echo "Prototype: $try" ;;
12474         esac
12475         ;;
12476         *)      case "$usethreads" in
12477                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12478                 esac
12479                 ;;
12480         esac
12481         ;;
12482 *)      getpwnam_r_proto=0
12483         ;;
12484 esac
12485
12486 : see if getpwuid_r exists
12487 set getpwuid_r d_getpwuid_r
12488 eval $inlibc
12489 case "$d_getpwuid_r" in
12490 "$define")
12491         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12492         case "$d_getpwuid_r_proto:$usethreads" in
12493         ":define")      d_getpwuid_r_proto=define
12494                 set d_getpwuid_r_proto getpwuid_r $hdrs
12495                 eval $hasproto ;;
12496         *)      ;;
12497         esac
12498         case "$d_getpwuid_r_proto" in
12499         define)
12500         case "$getpwuid_r_proto" in
12501         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12502         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12503         esac
12504         case "$getpwuid_r_proto" in
12505         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12506         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12507         esac
12508         case "$getpwuid_r_proto" in
12509         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12510         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12511         esac
12512         case "$getpwuid_r_proto" in
12513         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12514         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12515         esac
12516         case "$getpwuid_r_proto" in
12517         '')     d_getpwuid_r=undef
12518                 getpwuid_r_proto=0
12519                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12520         * )     case "$getpwuid_r_proto" in
12521                 REENTRANT_PROTO*) ;;
12522                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12523                 esac
12524                 echo "Prototype: $try" ;;
12525         esac
12526         ;;
12527         *)      case "$usethreads" in
12528                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12529                 esac
12530                 ;;
12531         esac
12532         ;;
12533 *)      getpwuid_r_proto=0
12534         ;;
12535 esac
12536
12537
12538 : see if getservbyname exists
12539 set getservbyname d_getsbyname
12540 eval $inlibc
12541
12542 : see if getservbyport exists
12543 set getservbyport d_getsbyport
12544 eval $inlibc
12545
12546 : see if getservent exists
12547 set getservent d_getsent
12548 eval $inlibc
12549
12550 : see if getservbyname_r exists
12551 set getservbyname_r d_getservbyname_r
12552 eval $inlibc
12553 case "$d_getservbyname_r" in
12554 "$define")
12555         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12556         case "$d_getservbyname_r_proto:$usethreads" in
12557         ":define")      d_getservbyname_r_proto=define
12558                 set d_getservbyname_r_proto getservbyname_r $hdrs
12559                 eval $hasproto ;;
12560         *)      ;;
12561         esac
12562         case "$d_getservbyname_r_proto" in
12563         define)
12564         case "$getservbyname_r_proto" in
12565         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12566         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12567         esac
12568         case "$getservbyname_r_proto" in
12569         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12570         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12571         esac
12572         case "$getservbyname_r_proto" in
12573         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12574         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12575         esac
12576         case "$getservbyname_r_proto" in
12577         '')     d_getservbyname_r=undef
12578                 getservbyname_r_proto=0
12579                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12580         * )     case "$getservbyname_r_proto" in
12581                 REENTRANT_PROTO*) ;;
12582                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12583                 esac
12584                 echo "Prototype: $try" ;;
12585         esac
12586         ;;
12587         *)      case "$usethreads" in
12588                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12589                 esac
12590                 ;;
12591         esac
12592         ;;
12593 *)      getservbyname_r_proto=0
12594         ;;
12595 esac
12596
12597 : see if getservbyport_r exists
12598 set getservbyport_r d_getservbyport_r
12599 eval $inlibc
12600 case "$d_getservbyport_r" in
12601 "$define")
12602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12603         case "$d_getservbyport_r_proto:$usethreads" in
12604         ":define")      d_getservbyport_r_proto=define
12605                 set d_getservbyport_r_proto getservbyport_r $hdrs
12606                 eval $hasproto ;;
12607         *)      ;;
12608         esac
12609         case "$d_getservbyport_r_proto" in
12610         define)
12611         case "$getservbyport_r_proto" in
12612         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12613         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12614         esac
12615         case "$getservbyport_r_proto" in
12616         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12617         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12618         esac
12619         case "$getservbyport_r_proto" in
12620         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12621         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12622         esac
12623         case "$getservbyport_r_proto" in
12624         '')     d_getservbyport_r=undef
12625                 getservbyport_r_proto=0
12626                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12627         * )     case "$getservbyport_r_proto" in
12628                 REENTRANT_PROTO*) ;;
12629                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12630                 esac
12631                 echo "Prototype: $try" ;;
12632         esac
12633         ;;
12634         *)      case "$usethreads" in
12635                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12636                 esac
12637                 ;;
12638         esac
12639         ;;
12640 *)      getservbyport_r_proto=0
12641         ;;
12642 esac
12643
12644 : see if getservent_r exists
12645 set getservent_r d_getservent_r
12646 eval $inlibc
12647 case "$d_getservent_r" in
12648 "$define")
12649         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12650         case "$d_getservent_r_proto:$usethreads" in
12651         ":define")      d_getservent_r_proto=define
12652                 set d_getservent_r_proto getservent_r $hdrs
12653                 eval $hasproto ;;
12654         *)      ;;
12655         esac
12656         case "$d_getservent_r_proto" in
12657         define)
12658         case "$getservent_r_proto" in
12659         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12660         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12661         esac
12662         case "$getservent_r_proto" in
12663         ''|0) try='int getservent_r(struct servent*, char*, int);'
12664         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12665         esac
12666         case "$getservent_r_proto" in
12667         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12668         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12669         esac
12670         case "$getservent_r_proto" in
12671         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12672         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12673         esac
12674         case "$getservent_r_proto" in
12675         '')     d_getservent_r=undef
12676                 getservent_r_proto=0
12677                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12678         * )     case "$getservent_r_proto" in
12679                 REENTRANT_PROTO*) ;;
12680                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12681                 esac
12682                 echo "Prototype: $try" ;;
12683         esac
12684         ;;
12685         *)      case "$usethreads" in
12686                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12687                 esac
12688                 ;;
12689         esac
12690         ;;
12691 *)      getservent_r_proto=0
12692         ;;
12693 esac
12694
12695 : see if prototypes for various getservxxx netdb.h functions are available
12696 echo " "
12697 set d_getservprotos getservent $i_netdb netdb.h
12698 eval $hasproto
12699
12700 : see if getspnam exists
12701 set getspnam d_getspnam
12702 eval $inlibc
12703
12704 : see if this is a shadow.h system
12705 set shadow.h i_shadow
12706 eval $inhdr
12707
12708 : see if getspnam_r exists
12709 set getspnam_r d_getspnam_r
12710 eval $inlibc
12711 case "$d_getspnam_r" in
12712 "$define")
12713         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12714         case "$d_getspnam_r_proto:$usethreads" in
12715         ":define")      d_getspnam_r_proto=define
12716                 set d_getspnam_r_proto getspnam_r $hdrs
12717                 eval $hasproto ;;
12718         *)      ;;
12719         esac
12720         case "$d_getspnam_r_proto" in
12721         define)
12722         case "$getspnam_r_proto" in
12723         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12724         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12725         esac
12726         case "$getspnam_r_proto" in
12727         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12728         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12729         esac
12730         case "$getspnam_r_proto" in
12731         '')     d_getspnam_r=undef
12732                 getspnam_r_proto=0
12733                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12734         * )     case "$getspnam_r_proto" in
12735                 REENTRANT_PROTO*) ;;
12736                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12737                 esac
12738                 echo "Prototype: $try" ;;
12739         esac
12740         ;;
12741         *)      case "$usethreads" in
12742                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12743                 esac
12744                 ;;
12745         esac
12746         ;;
12747 *)      getspnam_r_proto=0
12748         ;;
12749 esac
12750
12751 : see if gettimeofday or ftime exists
12752 set gettimeofday d_gettimeod
12753 eval $inlibc
12754 case "$d_gettimeod" in
12755 "$undef")
12756         set ftime d_ftime 
12757         eval $inlibc
12758         ;;
12759 *)
12760         val="$undef"; set d_ftime; eval $setvar
12761         ;;
12762 esac
12763 case "$d_gettimeod$d_ftime" in
12764 "$undef$undef")
12765         echo " "
12766         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12767         ;;
12768 esac
12769
12770 : see if gmtime_r exists
12771 set gmtime_r d_gmtime_r
12772 eval $inlibc
12773 case "$d_gmtime_r" in
12774 "$define")
12775         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
12776         case "$d_gmtime_r_proto:$usethreads" in
12777         ":define")      d_gmtime_r_proto=define
12778                 set d_gmtime_r_proto gmtime_r $hdrs
12779                 eval $hasproto ;;
12780         *)      ;;
12781         esac
12782         case "$d_gmtime_r_proto" in
12783         define)
12784         case "$gmtime_r_proto" in
12785         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12786         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12787         esac
12788         case "$gmtime_r_proto" in
12789         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12790         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12791         esac
12792         case "$gmtime_r_proto" in
12793         '')     d_gmtime_r=undef
12794                 gmtime_r_proto=0
12795                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12796         * )     case "$gmtime_r_proto" in
12797                 REENTRANT_PROTO*) ;;
12798                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12799                 esac
12800                 echo "Prototype: $try" ;;
12801         esac
12802         ;;
12803         *)      case "$usethreads" in
12804                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12805                 esac
12806                 ;;
12807         esac
12808         ;;
12809 *)      gmtime_r_proto=0
12810         ;;
12811 esac
12812
12813 : see if hasmntopt exists
12814 set hasmntopt d_hasmntopt
12815 eval $inlibc
12816
12817 : see if this is a netinet/in.h or sys/in.h system
12818 set netinet/in.h i_niin sys/in.h i_sysin
12819 eval $inhdr
12820
12821 : see if arpa/inet.h has to be included
12822 set arpa/inet.h i_arpainet
12823 eval $inhdr
12824
12825 : see if htonl --and friends-- exists
12826 val=''
12827 set htonl val
12828 eval $inlibc
12829
12830 : Maybe they are macros.
12831 case "$val" in
12832 $undef)
12833         $cat >htonl.c <<EOM
12834 #include <stdio.h>
12835 #include <sys/types.h>
12836 #$i_niin I_NETINET_IN
12837 #$i_sysin I_SYS_IN
12838 #$i_arpainet I_ARPA_INET
12839 #ifdef I_NETINET_IN
12840 #include <netinet/in.h>
12841 #endif
12842 #ifdef I_SYS_IN
12843 #include <sys/in.h>
12844 #endif
12845 #ifdef I_ARPA_INET
12846 #include <arpa/inet.h>
12847 #endif
12848 #ifdef htonl
12849 printf("Defined as a macro.");
12850 #endif
12851 EOM
12852         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12853         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12854                 val="$define"
12855                 echo "But it seems to be defined as a macro." >&4
12856         fi
12857         $rm -f htonl.?
12858         ;;
12859 esac
12860 set d_htonl
12861 eval $setvar
12862
12863 : index or strchr
12864 echo " "
12865 if set index val -f; eval $csym; $val; then
12866         if set strchr val -f d_strchr; eval $csym; $val; then
12867                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12868                         val="$define"
12869                         vali="$undef"
12870                         echo "strchr() found." >&4
12871                 else
12872                         val="$undef"
12873                         vali="$define"
12874                         echo "index() found." >&4
12875                 fi
12876         else
12877                 val="$undef"
12878                 vali="$define"
12879                 echo "index() found." >&4
12880         fi
12881 else
12882         if set strchr val -f d_strchr; eval $csym; $val; then
12883                 val="$define"
12884                 vali="$undef"
12885                 echo "strchr() found." >&4
12886         else
12887                 echo "No index() or strchr() found!" >&4
12888                 val="$undef"
12889                 vali="$undef"
12890         fi
12891 fi
12892 set d_strchr; eval $setvar
12893 val="$vali"
12894 set d_index; eval $setvar
12895
12896 : check whether inet_aton exists
12897 set inet_aton d_inetaton
12898 eval $inlibc
12899
12900 : Look for isascii
12901 echo " "
12902 $cat >isascii.c <<'EOCP'
12903 #include <stdio.h>
12904 #include <ctype.h>
12905 int main() {
12906         int c = 'A';
12907         if (isascii(c))
12908                 exit(0);
12909         else
12910                 exit(1);
12911 }
12912 EOCP
12913 set isascii
12914 if eval $compile; then
12915         echo "isascii() found." >&4
12916         val="$define"
12917 else
12918         echo "isascii() NOT found." >&4
12919         val="$undef"
12920 fi
12921 set d_isascii
12922 eval $setvar
12923 $rm -f isascii*
12924
12925 : see if isfinite exists
12926 set isfinite d_isfinite
12927 eval $inlibc
12928
12929 : see if isinf exists
12930 set isinf d_isinf
12931 eval $inlibc
12932
12933 : see if isnan exists
12934 set isnan d_isnan
12935 eval $inlibc
12936
12937 : see if isnanl exists
12938 set isnanl d_isnanl
12939 eval $inlibc
12940
12941 : see if killpg exists
12942 set killpg d_killpg
12943 eval $inlibc
12944
12945 : see if lchown exists
12946 echo " "
12947 $cat > try.c <<'EOCP'
12948 /* System header to define __stub macros and hopefully few prototypes,
12949     which can conflict with char lchown(); below.  */
12950 #include <assert.h>
12951 /* Override any gcc2 internal prototype to avoid an error.  */
12952 /* We use char because int might match the return type of a gcc2
12953    builtin and then its argument prototype would still apply.  */
12954 char lchown();
12955 int main() {
12956     /*  The GNU C library defines this for functions which it implements
12957         to always fail with ENOSYS.  Some functions are actually named
12958         something starting with __ and the normal name is an alias.  */
12959 #if defined (__stub_lchown) || defined (__stub___lchown)
12960 choke me
12961 #else
12962 lchown();
12963 #endif
12964 ; return 0; }
12965 EOCP
12966 set try
12967 if eval $compile; then
12968     $echo "lchown() found." >&4
12969     val="$define"
12970 else
12971     $echo "lchown() NOT found." >&4
12972     val="$undef"
12973 fi
12974 set d_lchown
12975 eval $setvar
12976
12977 : See if number of significant digits in a double precision number is known
12978 echo " "
12979 $cat >ldbl_dig.c <<EOM
12980 #$i_limits I_LIMITS
12981 #$i_float I_FLOAT
12982 #ifdef I_LIMITS
12983 #include <limits.h>
12984 #endif
12985 #ifdef I_FLOAT
12986 #include <float.h>
12987 #endif
12988 #ifdef LDBL_DIG
12989 printf("Contains LDBL_DIG");
12990 #endif
12991 EOM
12992 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
12993 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
12994         echo "LDBL_DIG found." >&4
12995         val="$define"
12996 else
12997         echo "LDBL_DIG NOT found." >&4
12998         val="$undef"
12999 fi
13000 $rm -f ldbl_dig.?
13001 set d_ldbl_dig
13002 eval $setvar
13003
13004 : see if link exists
13005 set link d_link
13006 eval $inlibc
13007
13008 : see if localtime_r exists
13009 set localtime_r d_localtime_r
13010 eval $inlibc
13011 case "$d_localtime_r" in
13012 "$define")
13013         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
13014         case "$d_localtime_r_proto:$usethreads" in
13015         ":define")      d_localtime_r_proto=define
13016                 set d_localtime_r_proto localtime_r $hdrs
13017                 eval $hasproto ;;
13018         *)      ;;
13019         esac
13020         case "$d_localtime_r_proto" in
13021         define)
13022         case "$localtime_r_proto" in
13023         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13024         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13025         esac
13026         case "$localtime_r_proto" in
13027         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13028         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13029         esac
13030         case "$localtime_r_proto" in
13031         '')     d_localtime_r=undef
13032                 localtime_r_proto=0
13033                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13034         * )     case "$localtime_r_proto" in
13035                 REENTRANT_PROTO*) ;;
13036                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13037                 esac
13038                 echo "Prototype: $try" ;;
13039         esac
13040         ;;
13041         *)      case "$usethreads" in
13042                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13043                 esac
13044                 ;;
13045         esac
13046         ;;
13047 *)      localtime_r_proto=0
13048         ;;
13049 esac
13050
13051 : see if localeconv exists
13052 set localeconv d_locconv
13053 eval $inlibc
13054
13055 : see if lockf exists
13056 set lockf d_lockf
13057 eval $inlibc
13058
13059 : see if prototype for lseek is available
13060 echo " "
13061 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13062 eval $hasproto
13063
13064 : see if lstat exists
13065 set lstat d_lstat
13066 eval $inlibc
13067
13068 : see if madvise exists
13069 set madvise d_madvise
13070 eval $inlibc
13071
13072 : see if mblen exists
13073 set mblen d_mblen
13074 eval $inlibc
13075
13076 : see if mbstowcs exists
13077 set mbstowcs d_mbstowcs
13078 eval $inlibc
13079
13080 : see if mbtowc exists
13081 set mbtowc d_mbtowc
13082 eval $inlibc
13083
13084 : see if memchr exists
13085 set memchr d_memchr
13086 eval $inlibc
13087
13088 : see if memcmp exists
13089 set memcmp d_memcmp
13090 eval $inlibc
13091
13092 : see if memcpy exists
13093 set memcpy d_memcpy
13094 eval $inlibc
13095
13096 : see if memmove exists
13097 set memmove d_memmove
13098 eval $inlibc
13099
13100 : see if memset exists
13101 set memset d_memset
13102 eval $inlibc
13103
13104 : see if mkdir exists
13105 set mkdir d_mkdir
13106 eval $inlibc
13107
13108 : see if mkdtemp exists
13109 set mkdtemp d_mkdtemp
13110 eval $inlibc
13111
13112 : see if mkfifo exists
13113 set mkfifo d_mkfifo
13114 eval $inlibc
13115
13116 : see if mkstemp exists
13117 set mkstemp d_mkstemp
13118 eval $inlibc
13119
13120 : see if mkstemps exists
13121 set mkstemps d_mkstemps
13122 eval $inlibc
13123
13124 : see if mktime exists
13125 set mktime d_mktime
13126 eval $inlibc
13127
13128 : see if this is a sys/mman.h system
13129 set sys/mman.h i_sysmman
13130 eval $inhdr
13131
13132 : see if mmap exists
13133 set mmap d_mmap
13134 eval $inlibc
13135 : see what shmat returns
13136 : default to something harmless
13137 mmaptype='void *'
13138 case "$i_sysmman$d_mmap" in
13139 "$define$define")
13140         $cat >mmap.c <<'END'
13141 #include <sys/mman.h>
13142 void *mmap();
13143 END
13144         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13145                 mmaptype='void *'
13146         else
13147                 mmaptype='caddr_t'
13148         fi
13149         echo "and it returns ($mmaptype)." >&4
13150         ;;
13151 esac
13152
13153
13154
13155 : see if mprotect exists
13156 set mprotect d_mprotect
13157 eval $inlibc
13158
13159 : see if msgctl exists
13160 set msgctl d_msgctl
13161 eval $inlibc
13162
13163 : see if msgget exists
13164 set msgget d_msgget
13165 eval $inlibc
13166
13167 : see if msgsnd exists
13168 set msgsnd d_msgsnd
13169 eval $inlibc
13170
13171 : see if msgrcv exists
13172 set msgrcv d_msgrcv
13173 eval $inlibc
13174
13175 : see how much of the 'msg*(2)' library is present.
13176 h_msg=true
13177 echo " "
13178 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13179 *"$undef"*) h_msg=false;;
13180 esac
13181 case "$osname" in
13182 freebsd)
13183     case "`ipcs 2>&1`" in
13184     "SVID messages"*"not configured"*)
13185         echo "Your $osname does not have the msg*(2) configured." >&4
13186         h_msg=false
13187         val="$undef"
13188         set msgctl d_msgctl
13189         eval $setvar
13190         set msgget d_msgget
13191         eval $setvar
13192         set msgsnd d_msgsnd
13193         eval $setvar
13194         set msgrcv d_msgrcv
13195         eval $setvar
13196         ;;
13197     esac
13198     ;;
13199 esac
13200 : we could also check for sys/ipc.h ...
13201 if $h_msg && $test `./findhdr sys/msg.h`; then
13202         echo "You have the full msg*(2) library." >&4
13203         val="$define"
13204 else
13205         echo "You don't have the full msg*(2) library." >&4
13206         val="$undef"
13207 fi
13208 set d_msg
13209 eval $setvar
13210
13211
13212 echo " "
13213 echo "Checking to see if your system supports struct msghdr..." >&4
13214 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13215 eval $hasstruct
13216 case "$d_msghdr_s" in
13217 "$define")      echo "Yes, it does."   ;;
13218 *)              echo "No, it doesn't." ;;
13219 esac
13220
13221
13222 : see if msync exists
13223 set msync d_msync
13224 eval $inlibc
13225
13226 : see if munmap exists
13227 set munmap d_munmap
13228 eval $inlibc
13229
13230 : see if nice exists
13231 set nice d_nice
13232 eval $inlibc
13233
13234 : see if this is a langinfo.h system
13235 set langinfo.h i_langinfo
13236 eval $inhdr
13237
13238 : see if nl_langinfo exists
13239 set nl_langinfo d_nl_langinfo
13240 eval $inlibc
13241
13242 : check for length of character
13243 echo " "
13244 case "$charsize" in
13245 '')
13246         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13247         $cat >try.c <<'EOCP'
13248 #include <stdio.h>
13249 int main()
13250 {
13251     printf("%d\n", (int)sizeof(char));
13252     exit(0);
13253 }
13254 EOCP
13255         set try
13256         if eval $compile_ok; then
13257                 dflt=`$run ./try`
13258         else
13259                 dflt='1'
13260                 echo "(I can't seem to compile the test program.  Guessing...)"
13261         fi
13262         ;;
13263 *)
13264         dflt="$charsize"
13265         ;;
13266 esac
13267 rp="What is the size of a character (in bytes)?"
13268 . ./myread
13269 charsize="$ans"
13270 $rm -f try.c try
13271
13272 : check for volatile keyword
13273 echo " "
13274 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13275 $cat >try.c <<'EOCP'
13276 int main()
13277 {
13278         typedef struct _goo_struct goo_struct;
13279         goo_struct * volatile goo = ((goo_struct *)0);
13280         struct _goo_struct {
13281                 long long_int;
13282                 int reg_int;
13283                 char char_var;
13284         };
13285         typedef unsigned short foo_t;
13286         char *volatile foo;
13287         volatile int bar;
13288         volatile foo_t blech;
13289         foo = foo;
13290 }
13291 EOCP
13292 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13293         val="$define"
13294         echo "Yup, it does."
13295 else
13296         val="$undef"
13297         echo "Nope, it doesn't."
13298 fi
13299 set d_volatile
13300 eval $setvar
13301 $rm -f try.*
13302
13303
13304 echo " "
13305 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13306
13307 case "$use64bitint:$d_quad:$quadtype" in
13308 define:define:?*)
13309         ivtype="$quadtype"
13310         uvtype="$uquadtype"
13311         ivsize=8
13312         uvsize=8
13313         ;;
13314 *)      ivtype="long"
13315         uvtype="unsigned long"
13316         ivsize=$longsize
13317         uvsize=$longsize
13318         ;;
13319 esac
13320
13321 case "$uselongdouble:$d_longdbl" in
13322 define:define)
13323         nvtype="long double"
13324         nvsize=$longdblsize
13325         ;;
13326 *)      nvtype=double
13327         nvsize=$doublesize
13328         ;;
13329 esac
13330
13331 $echo "(IV will be "$ivtype", $ivsize bytes)"
13332 $echo "(UV will be "$uvtype", $uvsize bytes)"
13333 $echo "(NV will be "$nvtype", $nvsize bytes)"
13334
13335 $cat >try.c <<EOCP
13336 #$i_inttypes I_INTTYPES
13337 #ifdef I_INTTYPES
13338 #include <inttypes.h>
13339 #endif
13340 #include <stdio.h>
13341 int main() {
13342 #ifdef INT8
13343    int8_t i =  INT8_MAX;
13344   uint8_t u = UINT8_MAX;
13345   printf("int8_t\n");
13346 #endif
13347 #ifdef INT16
13348    int16_t i =  INT16_MAX;
13349   uint16_t i = UINT16_MAX;
13350   printf("int16_t\n");
13351 #endif
13352 #ifdef INT32
13353    int32_t i =  INT32_MAX;
13354   uint32_t u = UINT32_MAX;
13355   printf("int32_t\n");
13356 #endif
13357 }
13358 EOCP
13359
13360 case "$i8type" in
13361 '')     case "$charsize" in
13362         1)      i8type=char
13363                 u8type="unsigned char"
13364                 i8size=$charsize
13365                 u8size=$charsize
13366                 ;;
13367         esac
13368         ;;
13369 esac
13370 case "$i8type" in
13371 '')     set try -DINT8
13372         if eval $compile; then
13373                 case "`$run ./try`" in
13374                 int8_t) i8type=int8_t
13375                         u8type=uint8_t
13376                         i8size=1
13377                         u8size=1
13378                         ;;
13379                 esac
13380         fi
13381         ;;
13382 esac
13383 case "$i8type" in
13384 '')     if $test $charsize -ge 1; then
13385                 i8type=char
13386                 u8type="unsigned char"
13387                 i8size=$charsize
13388                 u8size=$charsize
13389         fi
13390         ;;
13391 esac
13392
13393 case "$i16type" in
13394 '')     case "$shortsize" in
13395         2)      i16type=short
13396                 u16type="unsigned short"
13397                 i16size=$shortsize
13398                 u16size=$shortsize
13399                 ;;
13400         esac
13401         ;;
13402 esac
13403 case "$i16type" in
13404 '')     set try -DINT16
13405         if eval $compile; then
13406                 case "`$run ./try`" in
13407                 int16_t)
13408                         i16type=int16_t
13409                         u16type=uint16_t
13410                         i16size=2
13411                         u16size=2
13412                         ;;
13413                 esac
13414         fi
13415         ;;
13416 esac
13417 case "$i16type" in
13418 '')     if $test $shortsize -ge 2; then
13419                 i16type=short
13420                 u16type="unsigned short"
13421                 i16size=$shortsize
13422                 u16size=$shortsize
13423         fi
13424         ;;
13425 esac
13426
13427 case "$i32type" in
13428 '')     case "$longsize" in
13429         4)      i32type=long
13430                 u32type="unsigned long"
13431                 i32size=$longsize
13432                 u32size=$longsize
13433                 ;;
13434         *)      case "$intsize" in
13435                 4)      i32type=int
13436                         u32type="unsigned int"
13437                         i32size=$intsize
13438                         u32size=$intsize
13439                         ;;
13440                 esac
13441                 ;;
13442         esac
13443         ;;
13444 esac
13445 case "$i32type" in
13446 '')     set try -DINT32
13447         if eval $compile; then
13448                 case "`$run ./try`" in
13449                 int32_t)
13450                         i32type=int32_t
13451                         u32type=uint32_t
13452                         i32size=4
13453                         u32size=4
13454                         ;;
13455                 esac
13456         fi
13457         ;;
13458 esac
13459 case "$i32type" in
13460 '')     if $test $intsize -ge 4; then
13461                 i32type=int
13462                 u32type="unsigned int"
13463                 i32size=$intsize
13464                 u32size=$intsize
13465         fi
13466         ;;
13467 esac
13468
13469 case "$i64type" in
13470 '')     case "$d_quad:$quadtype" in
13471         define:?*)
13472                 i64type="$quadtype"
13473                 u64type="$uquadtype"
13474                 i64size=8
13475                 u64size=8
13476                 ;;
13477         esac
13478         ;;
13479 esac
13480
13481 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13482 : volatile so that the compiler has to store it out to memory.
13483 if test X"$d_volatile" = X"$define"; then
13484         volatile=volatile
13485 fi
13486 $cat <<EOP >try.c
13487 #include <stdio.h>
13488 #include <sys/types.h>
13489 #include <signal.h>
13490 #ifdef SIGFPE
13491 $volatile int bletched = 0;
13492 $signal_t blech(s) int s; { bletched = 1; }
13493 #endif
13494 int main() {
13495     $uvtype u = 0;
13496     $nvtype d;
13497     int     n = 8 * $uvsize;
13498     int     i;
13499 #ifdef SIGFPE
13500     signal(SIGFPE, blech);
13501 #endif
13502
13503     for (i = 0; i < n; i++) {
13504       u = u << 1 | ($uvtype)1;
13505       d = ($nvtype)u;
13506       if (($uvtype)d != u)
13507         break;
13508       if (d <= 0)
13509         break;
13510       d = ($nvtype)(u - 1);
13511       if (($uvtype)d != (u - 1))
13512         break;
13513 #ifdef SIGFPE
13514       if (bletched) {
13515         break;
13516 #endif
13517       } 
13518     }
13519     printf("%d\n", ((i == n) ? -n : i));
13520     exit(0);
13521 }
13522 EOP
13523 set try
13524
13525 d_nv_preserves_uv="$undef"
13526 if eval $compile; then
13527         nv_preserves_uv_bits="`$run ./try`"
13528 fi
13529 case "$nv_preserves_uv_bits" in
13530 \-[1-9]*)       
13531         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13532         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13533         d_nv_preserves_uv="$define"
13534         ;;
13535 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13536         d_nv_preserves_uv="$undef" ;;
13537 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13538         nv_preserves_uv_bits="$undef" ;;
13539 esac
13540
13541 $rm -f try.* try
13542
13543
13544 : check for off64_t
13545 echo " "
13546 echo "Checking to see if you have off64_t..." >&4
13547 $cat >try.c <<EOCP
13548 #include <sys/types.h>
13549 #include <unistd.h>
13550 int main() { off64_t x = 7; }
13551 EOCP
13552 set try
13553 if eval $compile; then
13554         val="$define"
13555         echo "You have off64_t."
13556 else
13557         val="$undef"
13558         echo "You do not have off64_t."
13559         case "$lseeksize" in
13560         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13561         esac
13562 fi
13563 $rm -f try.* try
13564 set d_off64_t
13565 eval $setvar
13566
13567 : see if POSIX threads are available
13568 set pthread.h i_pthread
13569 eval $inhdr
13570
13571
13572
13573
13574 : how to create joinable pthreads
13575 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13576         echo " "
13577         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13578         $cat >try.c <<'EOCP'
13579 #include <pthread.h>
13580 int main() {
13581     int detachstate = JOINABLE;
13582 }
13583 EOCP
13584         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13585         if eval $compile; then
13586                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13587                 val="$undef" # Yes, undef.
13588                 set d_old_pthread_create_joinable
13589                 eval $setvar
13590                 val=""
13591                 set old_pthread_create_joinable
13592                 eval $setvar
13593         else
13594                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13595                 if eval $compile; then
13596                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13597                         val="$define"
13598                         set d_old_pthread_create_joinable
13599                         eval $setvar
13600                         val=PTHREAD_CREATE_UNDETACHED
13601                         set old_pthread_create_joinable
13602                         eval $setvar
13603                 else            
13604                         set try -DJOINABLE=__UNDETACHED
13605                         if eval $compile; then
13606                                 echo "You seem to use __UNDETACHED." >&4
13607                                 val="$define"
13608                                 set d_old_pthread_create_joinable
13609                                 eval $setvar
13610                                 val=__UNDETACHED
13611                                 set old_pthread_create_joinable
13612                                 eval $setvar
13613                         else
13614                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13615                                 val="$define"
13616                                 set d_old_pthread_create_joinable
13617                                 eval $setvar
13618                                 val=0
13619                                 set old_pthread_create_joinable
13620                                 eval $setvar
13621                         fi
13622                 fi
13623         fi
13624         $rm -f try try.*
13625 else
13626     d_old_pthread_create_joinable="$undef"
13627     old_pthread_create_joinable=""
13628 fi
13629
13630 : see if pause exists
13631 set pause d_pause
13632 eval $inlibc
13633
13634 : see if pipe exists
13635 set pipe d_pipe
13636 eval $inlibc
13637
13638 : see if poll exists
13639 set poll d_poll
13640 eval $inlibc
13641
13642 : see if readlink exists
13643 set readlink d_readlink
13644 eval $inlibc
13645
13646 echo " "
13647 procselfexe=''
13648 val="$undef"
13649 case "$d_readlink" in
13650 "$define")
13651         if $issymlink /proc/self/exe ; then
13652                 $ls -l /proc/self/exe > reflect
13653                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13654                         echo "You have Linux-like /proc/self/exe."
13655                         procselfexe='"/proc/self/exe"'
13656                         val="$define"
13657                 fi
13658         fi
13659         if $issymlink /proc/curproc/file ; then
13660                 $ls -l /proc/curproc/file > reflect
13661                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13662                         echo "You have BSD-like /proc/curproc/file."
13663                         procselfexe='"/proc/curproc/file"'
13664                         val="$define"
13665                 fi
13666         fi
13667         ;;
13668 esac
13669 $rm -f reflect
13670 set d_procselfexe
13671 eval $setvar
13672
13673 : see whether the pthread_atfork exists
13674 $cat >try.c <<EOP
13675 #include <pthread.h>
13676 #include <stdio.h>
13677 int main() {
13678 #ifdef  PTHREAD_ATFORK
13679         pthread_atfork(NULL,NULL,NULL);
13680 #endif
13681 }
13682 EOP
13683
13684 : see if pthread_atfork exists
13685 set try -DPTHREAD_ATFORK
13686 if eval $compile; then
13687     val="$define"
13688 else
13689     val="$undef"
13690 fi
13691 case "$usethreads" in
13692 $define)
13693         case "$val" in
13694         $define) echo 'pthread_atfork found.' >&4        ;;
13695         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13696         esac
13697 esac
13698 set d_pthread_atfork
13699 eval $setvar
13700
13701
13702 : see whether the various POSIXish _yields exist
13703 $cat >try.c <<EOP
13704 #include <pthread.h>
13705 #include <stdio.h>
13706 int main() {
13707 #ifdef SCHED_YIELD
13708         sched_yield();
13709 #else
13710 #ifdef PTHREAD_YIELD
13711         pthread_yield();
13712 #else
13713 #ifdef PTHREAD_YIELD_NULL
13714         pthread_yield(NULL);
13715 #endif
13716 #endif
13717 #endif
13718 }
13719 EOP
13720 : see if sched_yield exists
13721 set try -DSCHED_YIELD
13722 if eval $compile; then
13723     val="$define"
13724     sched_yield='sched_yield()'
13725 else
13726     val="$undef"
13727 fi
13728 case "$usethreads" in
13729 $define)
13730         case "$val" in
13731         $define) echo 'sched_yield() found.' >&4        ;;
13732         *)       echo 'sched_yield() NOT found.' >&4    ;;
13733         esac
13734 esac
13735 set d_sched_yield
13736 eval $setvar
13737
13738 : see if pthread_yield exists
13739 set try -DPTHREAD_YIELD
13740 if eval $compile; then
13741     val="$define"
13742     case "$sched_yield" in
13743     '') sched_yield='pthread_yield()' ;;
13744     esac
13745 else
13746     set try -DPTHREAD_YIELD_NULL
13747     if eval $compile; then
13748         val="$define"
13749         case "$sched_yield" in
13750         '') sched_yield='pthread_yield(NULL)' ;;
13751         esac
13752     else
13753         val="$undef"
13754     fi
13755 fi
13756 case "$usethreads" in
13757 $define)
13758         case "$val" in
13759         $define) echo 'pthread_yield() found.' >&4      ;;
13760         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13761         esac
13762         ;;
13763 esac
13764 set d_pthread_yield
13765 eval $setvar
13766
13767 case "$sched_yield" in
13768 '') sched_yield=undef ;;
13769 esac
13770
13771 $rm -f try try.*
13772
13773 : see if random_r exists
13774 set random_r d_random_r
13775 eval $inlibc
13776 case "$d_random_r" in
13777 "$define")
13778         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13779         case "$d_random_r_proto:$usethreads" in
13780         ":define")      d_random_r_proto=define
13781                 set d_random_r_proto random_r $hdrs
13782                 eval $hasproto ;;
13783         *)      ;;
13784         esac
13785         case "$d_random_r_proto" in
13786         define)
13787         case "$random_r_proto" in
13788         ''|0) try='int random_r(int*, struct random_data*);'
13789         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13790         esac
13791         case "$random_r_proto" in
13792         '')     d_random_r=undef
13793                 random_r_proto=0
13794                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13795         * )     case "$random_r_proto" in
13796                 REENTRANT_PROTO*) ;;
13797                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13798                 esac
13799                 echo "Prototype: $try" ;;
13800         esac
13801         ;;
13802         *)      case "$usethreads" in
13803                 define) echo "random_r has no prototype, not using it." >&4 ;;
13804                 esac
13805                 ;;
13806         esac
13807         ;;
13808 *)      random_r_proto=0
13809         ;;
13810 esac
13811
13812 : see if readdir and friends exist
13813 set readdir d_readdir
13814 eval $inlibc
13815 set seekdir d_seekdir
13816 eval $inlibc
13817 set telldir d_telldir
13818 eval $inlibc
13819 set rewinddir d_rewinddir
13820 eval $inlibc
13821
13822 : see if readdir64_r exists
13823 set readdir64_r d_readdir64_r
13824 eval $inlibc
13825 case "$d_readdir64_r" in
13826 "$define")
13827         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13828         case "$d_readdir64_r_proto:$usethreads" in
13829         ":define")      d_readdir64_r_proto=define
13830                 set d_readdir64_r_proto readdir64_r $hdrs
13831                 eval $hasproto ;;
13832         *)      ;;
13833         esac
13834         case "$d_readdir64_r_proto" in
13835         define)
13836         case "$readdir64_r_proto" in
13837         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13838         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13839         esac
13840         case "$readdir64_r_proto" in
13841         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13842         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13843         esac
13844         case "$readdir64_r_proto" in
13845         '')     d_readdir64_r=undef
13846                 readdir64_r_proto=0
13847                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13848         * )     case "$readdir64_r_proto" in
13849                 REENTRANT_PROTO*) ;;
13850                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13851                 esac
13852                 echo "Prototype: $try" ;;
13853         esac
13854         ;;
13855         *)      case "$usethreads" in
13856                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13857                 esac
13858                 ;;
13859         esac
13860         ;;
13861 *)      readdir64_r_proto=0
13862         ;;
13863 esac
13864
13865 : see if readdir_r exists
13866 set readdir_r d_readdir_r
13867 eval $inlibc
13868 case "$d_readdir_r" in
13869 "$define")
13870         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13871         case "$d_readdir_r_proto:$usethreads" in
13872         ":define")      d_readdir_r_proto=define
13873                 set d_readdir_r_proto readdir_r $hdrs
13874                 eval $hasproto ;;
13875         *)      ;;
13876         esac
13877         case "$d_readdir_r_proto" in
13878         define)
13879         case "$readdir_r_proto" in
13880         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13881         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13882         esac
13883         case "$readdir_r_proto" in
13884         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13885         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13886         esac
13887         case "$readdir_r_proto" in
13888         '')     d_readdir_r=undef
13889                 readdir_r_proto=0
13890                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13891         * )     case "$readdir_r_proto" in
13892                 REENTRANT_PROTO*) ;;
13893                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13894                 esac
13895                 echo "Prototype: $try" ;;
13896         esac
13897         ;;
13898         *)      case "$usethreads" in
13899                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13900                 esac
13901                 ;;
13902         esac
13903         ;;
13904 *)      readdir_r_proto=0
13905         ;;
13906 esac
13907
13908 : see if readv exists
13909 set readv d_readv
13910 eval $inlibc
13911
13912 : see if recvmsg exists
13913 set recvmsg d_recvmsg
13914 eval $inlibc
13915
13916 : see if rename exists
13917 set rename d_rename
13918 eval $inlibc
13919
13920 : see if rmdir exists
13921 set rmdir d_rmdir
13922 eval $inlibc
13923
13924 : see if memory.h is available.
13925 val=''
13926 set memory.h val
13927 eval $inhdr
13928
13929 : See if it conflicts with string.h
13930 case "$val" in
13931 $define)
13932         case "$strings" in
13933         '') ;;
13934         *)
13935                 $cppstdin $cppflags $cppminus < $strings > mem.h
13936                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13937                         echo " "
13938                         echo "We won't be including <memory.h>."
13939                         val="$undef"
13940                 fi
13941                 $rm -f mem.h
13942                 ;;
13943         esac
13944 esac
13945 set i_memory
13946 eval $setvar
13947
13948 : can bcopy handle overlapping blocks?
13949 echo " "
13950 val="$undef"
13951 case "$d_memmove" in
13952 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
13953 *)      case "$d_bcopy" in
13954         "$define")
13955                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
13956                 $cat >try.c <<EOCP
13957 #$i_memory I_MEMORY
13958 #$i_stdlib I_STDLIB
13959 #$i_string I_STRING
13960 #$i_unistd I_UNISTD
13961 EOCP
13962         $cat >>try.c <<'EOCP'
13963 #include <stdio.h>
13964 #ifdef I_MEMORY
13965 #  include <memory.h>
13966 #endif
13967 #ifdef I_STDLIB
13968 #  include <stdlib.h>
13969 #endif
13970 #ifdef I_STRING
13971 #  include <string.h>
13972 #else
13973 #  include <strings.h>
13974 #endif
13975 #ifdef I_UNISTD
13976 #  include <unistd.h>  /* Needed for NetBSD */
13977 #endif
13978 int main()
13979 {
13980 char buf[128], abc[128];
13981 char *b;
13982 int len;
13983 int off;
13984 int align;
13985
13986 /* Copy "abcde..." string to char abc[] so that gcc doesn't
13987    try to store the string in read-only memory. */
13988 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
13989
13990 for (align = 7; align >= 0; align--) {
13991         for (len = 36; len; len--) {
13992                 b = buf+align;
13993                 bcopy(abc, b, len);
13994                 for (off = 1; off <= len; off++) {
13995                         bcopy(b, b+off, len);
13996                         bcopy(b+off, b, len);
13997                         if (bcmp(b, abc, len))
13998                                 exit(1);
13999                 }
14000         }
14001 }
14002 exit(0);
14003 }
14004 EOCP
14005                 set try
14006                 if eval $compile_ok; then
14007                         if ./try 2>/dev/null; then
14008                                 echo "Yes, it can."
14009                                 val="$define"
14010                         else
14011                                 echo "It can't, sorry."
14012                         fi
14013                 else
14014                         echo "(I can't compile the test program, so we'll assume not...)"
14015                 fi
14016                 ;;
14017         esac
14018         $rm -f try.* try core
14019         ;;
14020 esac
14021 set d_safebcpy
14022 eval $setvar
14023
14024 : can memcpy handle overlapping blocks?
14025 echo " "
14026 val="$undef"
14027 case "$d_memmove" in
14028 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14029 *)      case "$d_memcpy" in
14030         "$define")
14031                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14032                 $cat >try.c <<EOCP
14033 #$i_memory I_MEMORY
14034 #$i_stdlib I_STDLIB
14035 #$i_string I_STRING
14036 #$i_unistd I_UNISTD
14037 EOCP
14038         $cat >>try.c <<'EOCP'
14039 #include <stdio.h>
14040 #ifdef I_MEMORY
14041 #  include <memory.h>
14042 #endif
14043 #ifdef I_STDLIB
14044 #  include <stdlib.h>
14045 #endif
14046 #ifdef I_STRING
14047 #  include <string.h>
14048 #else
14049 #  include <strings.h>
14050 #endif
14051 #ifdef I_UNISTD
14052 #  include <unistd.h>  /* Needed for NetBSD */
14053 #endif
14054 int main()
14055 {
14056 char buf[128], abc[128];
14057 char *b;
14058 int len;
14059 int off;
14060 int align;
14061
14062 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14063    try to store the string in read-only memory. */
14064 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14065
14066 for (align = 7; align >= 0; align--) {
14067         for (len = 36; len; len--) {
14068                 b = buf+align;
14069                 memcpy(b, abc, len);
14070                 for (off = 1; off <= len; off++) {
14071                         memcpy(b+off, b, len);
14072                         memcpy(b, b+off, len);
14073                         if (memcmp(b, abc, len))
14074                                 exit(1);
14075                 }
14076         }
14077 }
14078 exit(0);
14079 }
14080 EOCP
14081                 set try
14082                 if eval $compile_ok; then
14083                         if ./try 2>/dev/null; then
14084                                 echo "Yes, it can."
14085                                 val="$define"
14086                         else
14087                                 echo "It can't, sorry."
14088                         fi
14089                 else
14090                         echo "(I can't compile the test program, so we'll assume not...)"
14091                 fi
14092                 ;;
14093         esac
14094         $rm -f try.* try core
14095         ;;
14096 esac
14097 set d_safemcpy
14098 eval $setvar
14099
14100 : can memcmp be trusted to compare relative magnitude?
14101 val="$undef"
14102 case "$d_memcmp" in
14103 "$define")
14104         echo " "
14105         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14106         $cat >try.c <<EOCP
14107 #$i_memory I_MEMORY
14108 #$i_stdlib I_STDLIB
14109 #$i_string I_STRING
14110 #$i_unistd I_UNISTD
14111 EOCP
14112         $cat >>try.c <<'EOCP'
14113 #include <stdio.h>
14114 #ifdef I_MEMORY
14115 #  include <memory.h>
14116 #endif
14117 #ifdef I_STDLIB
14118 #  include <stdlib.h>
14119 #endif
14120 #ifdef I_STRING
14121 #  include <string.h>
14122 #else
14123 #  include <strings.h>
14124 #endif
14125 #ifdef I_UNISTD
14126 #  include <unistd.h>  /* Needed for NetBSD */
14127 #endif
14128 int main()
14129 {
14130 char a = -1;
14131 char b = 0;
14132 if ((a < b) && memcmp(&a, &b, 1) < 0)
14133         exit(1);
14134 exit(0);
14135 }
14136 EOCP
14137         set try
14138         if eval $compile_ok; then
14139                 if $run ./try 2>/dev/null; then
14140                         echo "Yes, it can."
14141                         val="$define"
14142                 else
14143                         echo "No, it can't (it uses signed chars)."
14144                 fi
14145         else
14146                 echo "(I can't compile the test program, so we'll assume not...)"
14147         fi
14148         ;;
14149 esac
14150 $rm -f try.* try core
14151 set d_sanemcmp
14152 eval $setvar
14153
14154 : see if prototype for sbrk is available
14155 echo " "
14156 set d_sbrkproto sbrk $i_unistd unistd.h
14157 eval $hasproto
14158
14159 : see if select exists
14160 set select d_select
14161 eval $inlibc
14162
14163 : see if semctl exists
14164 set semctl d_semctl
14165 eval $inlibc
14166
14167 : see if semget exists
14168 set semget d_semget
14169 eval $inlibc
14170
14171 : see if semop exists
14172 set semop d_semop
14173 eval $inlibc
14174
14175 : see how much of the 'sem*(2)' library is present.
14176 h_sem=true
14177 echo " "
14178 case "$d_semctl$d_semget$d_semop" in
14179 *"$undef"*) h_sem=false;;
14180 esac
14181 case "$osname" in
14182 freebsd)
14183     case "`ipcs 2>&1`" in
14184     "SVID messages"*"not configured"*)
14185         echo "Your $osname does not have the sem*(2) configured." >&4
14186         h_sem=false
14187         val="$undef"
14188         set semctl d_semctl
14189         eval $setvar
14190         set semget d_semget
14191         eval $setvar
14192         set semop d_semop
14193         eval $setvar
14194         ;;
14195     esac
14196     ;;
14197 esac
14198 : we could also check for sys/ipc.h ...
14199 if $h_sem && $test `./findhdr sys/sem.h`; then
14200         echo "You have the full sem*(2) library." >&4
14201         val="$define"
14202 else
14203         echo "You don't have the full sem*(2) library." >&4
14204         val="$undef"
14205 fi
14206 set d_sem
14207 eval $setvar
14208
14209 : see whether sys/sem.h defines union semun
14210 echo " "
14211 $cat > try.c <<'END'
14212 #include <sys/types.h>
14213 #include <sys/ipc.h>
14214 #include <sys/sem.h>
14215 int main () { union semun semun; semun.buf = 0; }
14216 END
14217 set try
14218 if eval $compile; then
14219     echo "You have union semun in <sys/sem.h>." >&4
14220     val="$define"
14221 else
14222     echo "You do not have union semun in <sys/sem.h>." >&4
14223     val="$undef"
14224 fi
14225 $rm -f try try.c try.h
14226 set d_union_semun
14227 eval $setvar
14228
14229 : see how to do semctl IPC_STAT
14230 case "$d_sem" in
14231 $define)
14232     : see whether semctl IPC_STAT can use union semun
14233     echo " "
14234     $cat > try.h <<END
14235 #ifndef S_IRUSR
14236 #   ifdef S_IREAD
14237 #       define S_IRUSR S_IREAD
14238 #       define S_IWUSR S_IWRITE
14239 #       define S_IXUSR S_IEXEC
14240 #   else
14241 #       define S_IRUSR 0400
14242 #       define S_IWUSR 0200
14243 #       define S_IXUSR 0100
14244 #   endif
14245 #   define S_IRGRP (S_IRUSR>>3)
14246 #   define S_IWGRP (S_IWUSR>>3)
14247 #   define S_IXGRP (S_IXUSR>>3)
14248 #   define S_IROTH (S_IRUSR>>6)
14249 #   define S_IWOTH (S_IWUSR>>6)
14250 #   define S_IXOTH (S_IXUSR>>6)
14251 #endif
14252 #ifndef S_IRWXU
14253 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14254 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14255 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14256 #endif
14257 END
14258
14259     $cat > try.c <<END
14260 #include <sys/types.h>
14261 #include <sys/ipc.h>
14262 #include <sys/sem.h>
14263 #include <sys/stat.h>
14264 #include <stdio.h>
14265 #include <errno.h>
14266 #include "try.h"
14267 #ifndef errno
14268 extern int errno;
14269 #endif
14270 #$d_union_semun HAS_UNION_SEMUN
14271 int main() {
14272     union semun
14273 #ifndef HAS_UNION_SEMUN
14274     {
14275         int val;
14276         struct semid_ds *buf;
14277         unsigned short *array;
14278     }
14279 #endif
14280     arg;
14281     int sem, st;
14282
14283 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14284     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14285     if (sem > -1) {
14286         struct semid_ds argbuf;
14287         arg.buf = &argbuf;
14288 #       ifdef IPC_STAT
14289         st = semctl(sem, 0, IPC_STAT, arg);
14290         if (st == 0)
14291             printf("semun\n");
14292         else
14293 #       endif /* IPC_STAT */
14294             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14295 #       ifdef IPC_RMID
14296         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14297 #       endif /* IPC_RMID */
14298             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14299     } else
14300 #endif /* IPC_PRIVATE && ... */
14301         printf("semget failed: errno = %d\n", errno);
14302   return 0;
14303 }
14304 END
14305     val="$undef"
14306     set try
14307     if eval $compile; then
14308         xxx=`$run ./try`
14309         case "$xxx" in
14310         semun) val="$define" ;;
14311         esac
14312     fi
14313     $rm -f try try.c
14314     set d_semctl_semun
14315     eval $setvar
14316     case "$d_semctl_semun" in
14317     $define)
14318         echo "You can use union semun for semctl IPC_STAT." >&4
14319         also='also'
14320         ;;
14321     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14322         also=''
14323         ;;
14324     esac
14325
14326     : see whether semctl IPC_STAT can use struct semid_ds pointer
14327     $cat > try.c <<'END'
14328 #include <sys/types.h>
14329 #include <sys/ipc.h>
14330 #include <sys/sem.h>
14331 #include <sys/stat.h>
14332 #include "try.h"
14333 #include <stdio.h>
14334 #include <errno.h>
14335 #ifndef errno
14336 extern int errno;
14337 #endif
14338 int main() {
14339     struct semid_ds arg;
14340     int sem, st;
14341
14342 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14343     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14344     if (sem > -1) {
14345 #       ifdef IPC_STAT
14346         st = semctl(sem, 0, IPC_STAT, &arg);
14347         if (st == 0)
14348             printf("semid_ds\n");
14349         else
14350 #       endif /* IPC_STAT */
14351             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14352 #       ifdef IPC_RMID
14353         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14354 #       endif /* IPC_RMID */
14355             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14356     } else
14357 #endif /* IPC_PRIVATE && ... */
14358         printf("semget failed: errno = %d\n", errno);
14359
14360     return 0;
14361 }
14362 END
14363     val="$undef"
14364     set try
14365     if eval $compile; then
14366         xxx=`$run ./try`
14367         case "$xxx" in
14368         semid_ds) val="$define" ;;
14369         esac
14370     fi
14371     $rm -f try try.c
14372     set d_semctl_semid_ds
14373     eval $setvar
14374     case "$d_semctl_semid_ds" in
14375     $define)
14376         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14377         ;;
14378     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14379         ;;
14380     esac
14381     $rm -f try.h
14382     ;;
14383 *)  val="$undef"
14384
14385     # We do not have the full sem*(2) library, so assume we can not
14386     # use either.
14387
14388     set d_semctl_semun
14389     eval $setvar
14390
14391     set d_semctl_semid_ds
14392     eval $setvar
14393     ;;
14394 esac
14395
14396 : see if sendmsg exists
14397 set sendmsg d_sendmsg
14398 eval $inlibc
14399
14400 : see if setegid exists
14401 set setegid d_setegid
14402 eval $inlibc
14403
14404 : see if seteuid exists
14405 set seteuid d_seteuid
14406 eval $inlibc
14407
14408 : see if setgrent exists
14409 set setgrent d_setgrent
14410 eval $inlibc
14411
14412 : see if setgrent_r exists
14413 set setgrent_r d_setgrent_r
14414 eval $inlibc
14415 case "$d_setgrent_r" in
14416 "$define")
14417         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14418         case "$d_setgrent_r_proto:$usethreads" in
14419         ":define")      d_setgrent_r_proto=define
14420                 set d_setgrent_r_proto setgrent_r $hdrs
14421                 eval $hasproto ;;
14422         *)      ;;
14423         esac
14424         case "$d_setgrent_r_proto" in
14425         define)
14426         case "$setgrent_r_proto" in
14427         ''|0) try='int setgrent_r(FILE**);'
14428         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14429         esac
14430         case "$setgrent_r_proto" in
14431         ''|0) try='void setgrent_r(FILE**);'
14432         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14433         esac
14434         case "$setgrent_r_proto" in
14435         '')     d_setgrent_r=undef
14436                 setgrent_r_proto=0
14437                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14438         * )     case "$setgrent_r_proto" in
14439                 REENTRANT_PROTO*) ;;
14440                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14441                 esac
14442                 echo "Prototype: $try" ;;
14443         esac
14444         ;;
14445         *)      case "$usethreads" in
14446                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14447                 esac
14448                 ;;
14449         esac
14450         ;;
14451 *)      setgrent_r_proto=0
14452         ;;
14453 esac
14454
14455 : see if sethostent exists
14456 set sethostent d_sethent
14457 eval $inlibc
14458
14459 : see if sethostent_r exists
14460 set sethostent_r d_sethostent_r
14461 eval $inlibc
14462 case "$d_sethostent_r" in
14463 "$define")
14464         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14465         case "$d_sethostent_r_proto:$usethreads" in
14466         ":define")      d_sethostent_r_proto=define
14467                 set d_sethostent_r_proto sethostent_r $hdrs
14468                 eval $hasproto ;;
14469         *)      ;;
14470         esac
14471         case "$d_sethostent_r_proto" in
14472         define)
14473         case "$sethostent_r_proto" in
14474         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14475         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14476         esac
14477         case "$sethostent_r_proto" in
14478         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14479         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14480         esac
14481         case "$sethostent_r_proto" in
14482         '')     d_sethostent_r=undef
14483                 sethostent_r_proto=0
14484                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14485         * )     case "$sethostent_r_proto" in
14486                 REENTRANT_PROTO*) ;;
14487                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14488                 esac
14489                 echo "Prototype: $try" ;;
14490         esac
14491         ;;
14492         *)      case "$usethreads" in
14493                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14494                 esac
14495                 ;;
14496         esac
14497         ;;
14498 *)      sethostent_r_proto=0
14499         ;;
14500 esac
14501
14502 : see if setitimer exists
14503 set setitimer d_setitimer
14504 eval $inlibc
14505
14506 : see if setlinebuf exists
14507 set setlinebuf d_setlinebuf
14508 eval $inlibc
14509
14510 : see if setlocale exists
14511 set setlocale d_setlocale
14512 eval $inlibc
14513
14514 : see if locale.h is available
14515 set locale.h i_locale
14516 eval $inhdr
14517
14518 : see if setlocale_r exists
14519 set setlocale_r d_setlocale_r
14520 eval $inlibc
14521 case "$d_setlocale_r" in
14522 "$define")
14523         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14524         case "$d_setlocale_r_proto:$usethreads" in
14525         ":define")      d_setlocale_r_proto=define
14526                 set d_setlocale_r_proto setlocale_r $hdrs
14527                 eval $hasproto ;;
14528         *)      ;;
14529         esac
14530         case "$d_setlocale_r_proto" in
14531         define)
14532         case "$setlocale_r_proto" in
14533         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14534         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14535         esac
14536         case "$setlocale_r_proto" in
14537         '')     d_setlocale_r=undef
14538                 setlocale_r_proto=0
14539                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14540         * )     case "$setlocale_r_proto" in
14541                 REENTRANT_PROTO*) ;;
14542                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14543                 esac
14544                 echo "Prototype: $try" ;;
14545         esac
14546         ;;
14547         *)      case "$usethreads" in
14548                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14549                 esac
14550                 ;;
14551         esac
14552         ;;
14553 *)      setlocale_r_proto=0
14554         ;;
14555 esac
14556
14557 : see if setnetent exists
14558 set setnetent d_setnent
14559 eval $inlibc
14560
14561 : see if setnetent_r exists
14562 set setnetent_r d_setnetent_r
14563 eval $inlibc
14564 case "$d_setnetent_r" in
14565 "$define")
14566         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14567         case "$d_setnetent_r_proto:$usethreads" in
14568         ":define")      d_setnetent_r_proto=define
14569                 set d_setnetent_r_proto setnetent_r $hdrs
14570                 eval $hasproto ;;
14571         *)      ;;
14572         esac
14573         case "$d_setnetent_r_proto" in
14574         define)
14575         case "$setnetent_r_proto" in
14576         ''|0) try='int setnetent_r(int, struct netent_data*);'
14577         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14578         esac
14579         case "$setnetent_r_proto" in
14580         ''|0) try='void setnetent_r(int, struct netent_data*);'
14581         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14582         esac
14583         case "$setnetent_r_proto" in
14584         '')     d_setnetent_r=undef
14585                 setnetent_r_proto=0
14586                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14587         * )     case "$setnetent_r_proto" in
14588                 REENTRANT_PROTO*) ;;
14589                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14590                 esac
14591                 echo "Prototype: $try" ;;
14592         esac
14593         ;;
14594         *)      case "$usethreads" in
14595                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14596                 esac
14597                 ;;
14598         esac
14599         ;;
14600 *)      setnetent_r_proto=0
14601         ;;
14602 esac
14603
14604 : see if setprotoent exists
14605 set setprotoent d_setpent
14606 eval $inlibc
14607
14608 : see if setpgid exists
14609 set setpgid d_setpgid
14610 eval $inlibc
14611
14612 : see if setpgrp2 exists
14613 set setpgrp2 d_setpgrp2
14614 eval $inlibc
14615
14616 : see if setpriority exists
14617 set setpriority d_setprior
14618 eval $inlibc
14619
14620 : see if setproctitle exists
14621 set setproctitle d_setproctitle
14622 eval $inlibc
14623
14624 : see if setprotoent_r exists
14625 set setprotoent_r d_setprotoent_r
14626 eval $inlibc
14627 case "$d_setprotoent_r" in
14628 "$define")
14629         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14630         case "$d_setprotoent_r_proto:$usethreads" in
14631         ":define")      d_setprotoent_r_proto=define
14632                 set d_setprotoent_r_proto setprotoent_r $hdrs
14633                 eval $hasproto ;;
14634         *)      ;;
14635         esac
14636         case "$d_setprotoent_r_proto" in
14637         define)
14638         case "$setprotoent_r_proto" in
14639         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14640         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14641         esac
14642         case "$setprotoent_r_proto" in
14643         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14644         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14645         esac
14646         case "$setprotoent_r_proto" in
14647         '')     d_setprotoent_r=undef
14648                 setprotoent_r_proto=0
14649                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14650         * )     case "$setprotoent_r_proto" in
14651                 REENTRANT_PROTO*) ;;
14652                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14653                 esac
14654                 echo "Prototype: $try" ;;
14655         esac
14656         ;;
14657         *)      case "$usethreads" in
14658                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14659                 esac
14660                 ;;
14661         esac
14662         ;;
14663 *)      setprotoent_r_proto=0
14664         ;;
14665 esac
14666
14667 : see if setpwent exists
14668 set setpwent d_setpwent
14669 eval $inlibc
14670
14671 : see if setpwent_r exists
14672 set setpwent_r d_setpwent_r
14673 eval $inlibc
14674 case "$d_setpwent_r" in
14675 "$define")
14676         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14677         case "$d_setpwent_r_proto:$usethreads" in
14678         ":define")      d_setpwent_r_proto=define
14679                 set d_setpwent_r_proto setpwent_r $hdrs
14680                 eval $hasproto ;;
14681         *)      ;;
14682         esac
14683         case "$d_setpwent_r_proto" in
14684         define)
14685         case "$setpwent_r_proto" in
14686         ''|0) try='int setpwent_r(FILE**);'
14687         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14688         esac
14689         case "$setpwent_r_proto" in
14690         ''|0) try='void setpwent_r(FILE**);'
14691         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14692         esac
14693         case "$setpwent_r_proto" in
14694         '')     d_setpwent_r=undef
14695                 setpwent_r_proto=0
14696                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14697         * )     case "$setpwent_r_proto" in
14698                 REENTRANT_PROTO*) ;;
14699                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14700                 esac
14701                 echo "Prototype: $try" ;;
14702         esac
14703         ;;
14704         *)      case "$usethreads" in
14705                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14706                 esac
14707                 ;;
14708         esac
14709         ;;
14710 *)      setpwent_r_proto=0
14711         ;;
14712 esac
14713
14714 : see if setregid exists
14715 set setregid d_setregid
14716 eval $inlibc
14717 set setresgid d_setresgid
14718 eval $inlibc
14719
14720 : see if setreuid exists
14721 set setreuid d_setreuid
14722 eval $inlibc
14723 set setresuid d_setresuid
14724 eval $inlibc
14725
14726 : see if setrgid exists
14727 set setrgid d_setrgid
14728 eval $inlibc
14729
14730 : see if setruid exists
14731 set setruid d_setruid
14732 eval $inlibc
14733
14734 : see if setservent exists
14735 set setservent d_setsent
14736 eval $inlibc
14737
14738 : see if setservent_r exists
14739 set setservent_r d_setservent_r
14740 eval $inlibc
14741 case "$d_setservent_r" in
14742 "$define")
14743         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14744         case "$d_setservent_r_proto:$usethreads" in
14745         ":define")      d_setservent_r_proto=define
14746                 set d_setservent_r_proto setservent_r $hdrs
14747                 eval $hasproto ;;
14748         *)      ;;
14749         esac
14750         case "$d_setservent_r_proto" in
14751         define)
14752         case "$setservent_r_proto" in
14753         ''|0) try='int setservent_r(int, struct servent_data*);'
14754         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14755         esac
14756         case "$setservent_r_proto" in
14757         ''|0) try='void setservent_r(int, struct servent_data*);'
14758         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14759         esac
14760         case "$setservent_r_proto" in
14761         '')     d_setservent_r=undef
14762                 setservent_r_proto=0
14763                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14764         * )     case "$setservent_r_proto" in
14765                 REENTRANT_PROTO*) ;;
14766                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14767                 esac
14768                 echo "Prototype: $try" ;;
14769         esac
14770         ;;
14771         *)      case "$usethreads" in
14772                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14773                 esac
14774                 ;;
14775         esac
14776         ;;
14777 *)      setservent_r_proto=0
14778         ;;
14779 esac
14780
14781 : see if setsid exists
14782 set setsid d_setsid
14783 eval $inlibc
14784
14785 : see if setvbuf exists
14786 set setvbuf d_setvbuf
14787 eval $inlibc
14788
14789 : see if sfio.h is available
14790 set sfio.h i_sfio
14791 eval $inhdr
14792
14793
14794 : see if sfio library is available
14795 case "$i_sfio" in
14796 $define)
14797         val=''
14798         set sfreserve val
14799         eval $inlibc
14800         ;;
14801 *)
14802         val="$undef"
14803         ;;
14804 esac
14805 : Ok, but do we want to use it.
14806 case "$val" in
14807 $define)
14808         case "$usesfio" in
14809         true|$define|[yY]*) dflt='y';;
14810         *) dflt='n';;
14811         esac
14812         echo "$package can use the sfio library, but it is experimental."
14813         case "$useperlio" in
14814         "$undef")
14815             echo "For sfio also the PerlIO abstraction layer is needed."
14816             echo "Earlier you said you wouldn't want that."
14817             ;;
14818         esac
14819         rp="You seem to have sfio available, do you want to try using it?"
14820         . ./myread
14821         case "$ans" in
14822         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14823                 useperlio="$define"
14824                 val="$define"
14825                 ;;
14826         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14827                 val="$undef"
14828                 ;;
14829         esac
14830         ;;
14831 *)      case "$usesfio" in
14832         true|$define|[yY]*)
14833                 echo "Sorry, cannot find sfio on this machine." >&4
14834                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14835                 val="$undef"
14836                 ;;
14837         esac
14838         ;;
14839 esac
14840 set d_sfio
14841 eval $setvar
14842 case "$d_sfio" in
14843 $define) usesfio='true';;
14844 *) usesfio='false';;
14845 esac
14846 case "$d_sfio" in
14847 $define) ;;
14848 *)      : Remove sfio from list of libraries to use
14849         case "$libs" in
14850         *-lsfio*)
14851                 echo "Removing unneeded -lsfio from library list" >&4
14852                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14853                 shift
14854                 libs="$*"
14855                 echo "libs = $libs" >&4
14856                 ;;
14857         esac
14858 ;;
14859 esac
14860
14861
14862 : see if shmctl exists
14863 set shmctl d_shmctl
14864 eval $inlibc
14865
14866 : see if shmget exists
14867 set shmget d_shmget
14868 eval $inlibc
14869
14870 : see if shmat exists
14871 set shmat d_shmat
14872 eval $inlibc
14873 : see what shmat returns
14874 case "$d_shmat" in
14875 "$define")
14876         $cat >shmat.c <<'END'
14877 #include <sys/shm.h>
14878 void *shmat();
14879 END
14880         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14881                 shmattype='void *'
14882         else
14883                 shmattype='char *'
14884         fi
14885         echo "and it returns ($shmattype)." >&4
14886         : see if a prototype for shmat is available
14887         xxx=`./findhdr sys/shm.h`
14888         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14889         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14890                 val="$define"
14891         else
14892                 val="$undef"
14893         fi
14894         $rm -f shmat.[co]
14895         ;;
14896 *)
14897         val="$undef"
14898         ;;
14899 esac
14900 set d_shmatprototype
14901 eval $setvar
14902
14903 : see if shmdt exists
14904 set shmdt d_shmdt
14905 eval $inlibc
14906
14907 : see how much of the 'shm*(2)' library is present.
14908 h_shm=true
14909 echo " "
14910 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14911 *"$undef"*) h_shm=false;;
14912 esac
14913 case "$osname" in
14914 freebsd)
14915     case "`ipcs 2>&1`" in
14916     "SVID shared memory"*"not configured"*)
14917         echo "Your $osname does not have the shm*(2) configured." >&4
14918         h_shm=false
14919         val="$undef"
14920         set shmctl d_shmctl
14921         evat $setvar
14922         set shmget d_shmget
14923         evat $setvar
14924         set shmat d_shmat
14925         evat $setvar
14926         set shmdt d_shmdt
14927         evat $setvar
14928         ;;
14929     esac
14930     ;;
14931 esac
14932 : we could also check for sys/ipc.h ...
14933 if $h_shm && $test `./findhdr sys/shm.h`; then
14934         echo "You have the full shm*(2) library." >&4
14935         val="$define"
14936 else
14937         echo "You don't have the full shm*(2) library." >&4
14938         val="$undef"
14939 fi
14940 set d_shm
14941 eval $setvar
14942
14943 echo " "
14944 : see if we have sigaction
14945 if set sigaction val -f d_sigaction; eval $csym; $val; then
14946         echo 'sigaction() found.' >&4
14947         $cat > try.c <<'EOP'
14948 #include <stdio.h>
14949 #include <sys/types.h>
14950 #include <signal.h>
14951 int main()
14952 {
14953     struct sigaction act, oact;
14954     act.sa_flags = 0;
14955     oact.sa_handler = 0;
14956     /* so that act and oact are used */
14957     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
14958 }
14959 EOP
14960         set try
14961         if eval $compile_ok; then
14962                 val="$define"
14963         else
14964                 echo "But you don't seem to have a useable struct sigaction." >&4
14965                 val="$undef"
14966         fi
14967 else
14968         echo 'sigaction NOT found.' >&4
14969         val="$undef"
14970 fi
14971 set d_sigaction; eval $setvar
14972 $rm -f try try$_o try.c
14973
14974 : see if sigprocmask exists
14975 set sigprocmask d_sigprocmask
14976 eval $inlibc
14977
14978 : see if sigsetjmp exists
14979 echo " "
14980 case "$d_sigsetjmp" in
14981 '')
14982         $cat >try.c <<'EOP'
14983 #include <setjmp.h>
14984 sigjmp_buf env;
14985 int set = 1;
14986 int main()
14987 {
14988         if (sigsetjmp(env,1))
14989                 exit(set);
14990         set = 0;
14991         siglongjmp(env, 1);
14992         exit(1);
14993 }
14994 EOP
14995         set try
14996         if eval $compile; then
14997                 if $run ./try >/dev/null 2>&1; then
14998                         echo "POSIX sigsetjmp found." >&4
14999                         val="$define"
15000                 else
15001                         $cat >&4 <<EOM
15002 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15003 I'll ignore them.
15004 EOM
15005                         val="$undef"
15006                 fi
15007         else
15008                 echo "sigsetjmp not found." >&4
15009                 val="$undef"
15010         fi
15011         ;;
15012 *) val="$d_sigsetjmp"
15013         case "$d_sigsetjmp" in
15014         $define) echo "POSIX sigsetjmp found." >&4;;
15015         $undef) echo "sigsetjmp not found." >&4;;
15016         esac
15017         ;;
15018 esac
15019 set d_sigsetjmp
15020 eval $setvar
15021 $rm -f try.c try
15022
15023 : see if sockatmark exists
15024 set sockatmark d_sockatmark
15025 eval $inlibc
15026
15027 : see if prototype for sockatmark is available
15028 echo " "
15029 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15030 eval $hasproto
15031
15032 : see if socks5_init exists
15033 set socks5_init d_socks5_init
15034 eval $inlibc
15035
15036 : see if srand48_r exists
15037 set srand48_r d_srand48_r
15038 eval $inlibc
15039 case "$d_srand48_r" in
15040 "$define")
15041         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15042         case "$d_srand48_r_proto:$usethreads" in
15043         ":define")      d_srand48_r_proto=define
15044                 set d_srand48_r_proto srand48_r $hdrs
15045                 eval $hasproto ;;
15046         *)      ;;
15047         esac
15048         case "$d_srand48_r_proto" in
15049         define)
15050         case "$srand48_r_proto" in
15051         ''|0) try='int srand48_r(long, struct drand48_data*);'
15052         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15053         esac
15054         case "$srand48_r_proto" in
15055         '')     d_srand48_r=undef
15056                 srand48_r_proto=0
15057                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15058         * )     case "$srand48_r_proto" in
15059                 REENTRANT_PROTO*) ;;
15060                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15061                 esac
15062                 echo "Prototype: $try" ;;
15063         esac
15064         ;;
15065         *)      case "$usethreads" in
15066                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15067                 esac
15068                 ;;
15069         esac
15070         ;;
15071 *)      srand48_r_proto=0
15072         ;;
15073 esac
15074
15075 : see if srandom_r exists
15076 set srandom_r d_srandom_r
15077 eval $inlibc
15078 case "$d_srandom_r" in
15079 "$define")
15080         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15081         case "$d_srandom_r_proto:$usethreads" in
15082         ":define")      d_srandom_r_proto=define
15083                 set d_srandom_r_proto srandom_r $hdrs
15084                 eval $hasproto ;;
15085         *)      ;;
15086         esac
15087         case "$d_srandom_r_proto" in
15088         define)
15089         case "$srandom_r_proto" in
15090         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15091         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15092         esac
15093         case "$srandom_r_proto" in
15094         '')     d_srandom_r=undef
15095                 srandom_r_proto=0
15096                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15097         * )     case "$srandom_r_proto" in
15098                 REENTRANT_PROTO*) ;;
15099                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15100                 esac
15101                 echo "Prototype: $try" ;;
15102         esac
15103         ;;
15104         *)      case "$usethreads" in
15105                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15106                 esac
15107                 ;;
15108         esac
15109         ;;
15110 *)      srandom_r_proto=0
15111         ;;
15112 esac
15113
15114 : see if prototype for setresgid is available
15115 echo " "
15116 set d_sresgproto setresgid $i_unistd unistd.h
15117 eval $hasproto
15118
15119 : see if prototype for setresuid is available
15120 echo " "
15121 set d_sresuproto setresuid $i_unistd unistd.h
15122 eval $hasproto
15123
15124 : see if sys/stat.h is available
15125 set sys/stat.h i_sysstat
15126 eval $inhdr
15127
15128
15129 : see if stat knows about block sizes
15130 echo " "
15131 echo "Checking to see if your struct stat has st_blocks field..." >&4
15132 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15133 eval $hasfield
15134
15135
15136 : see if this is a sys/vfs.h system
15137 set sys/vfs.h i_sysvfs
15138 eval $inhdr
15139
15140
15141 : see if this is a sys/statfs.h system
15142 set sys/statfs.h i_sysstatfs
15143 eval $inhdr
15144
15145
15146 echo " "
15147 echo "Checking to see if your system supports struct statfs..." >&4
15148 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
15149 eval $hasstruct
15150 case "$d_statfs_s" in
15151 "$define")      echo "Yes, it does."   ;;
15152 *)              echo "No, it doesn't." ;;
15153 esac
15154
15155
15156
15157 : see if struct statfs knows about f_flags
15158 case "$d_statfs_s" in
15159 define) 
15160         echo " "
15161         echo "Checking to see if your struct statfs has f_flags field..." >&4
15162         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
15163         eval $hasfield
15164         ;;
15165 *)      val="$undef"
15166         set d_statfs_f_flags
15167         eval $setvar
15168         ;;
15169 esac
15170 case "$d_statfs_f_flags" in
15171 "$define")      echo "Yes, it does."   ;;
15172 *)              echo "No, it doesn't." ;;
15173 esac
15174
15175 : see if _ptr and _cnt from stdio act std
15176 echo " "
15177
15178 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15179         echo "(Looks like you have stdio.h from BSD.)"
15180         case "$stdio_ptr" in
15181         '') stdio_ptr='((fp)->_p)'
15182                 ptr_lval=$define
15183                 ;;
15184         *)      ptr_lval=$d_stdio_ptr_lval;;
15185         esac
15186         case "$stdio_cnt" in
15187         '') stdio_cnt='((fp)->_r)'
15188                 cnt_lval=$define
15189                 ;;
15190         *)      cnt_lval=$d_stdio_cnt_lval;;
15191         esac
15192         case "$stdio_base" in
15193         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15194         esac
15195         case "$stdio_bufsiz" in
15196         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15197         esac
15198 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15199         echo "(Looks like you have stdio.h from Linux.)"
15200         case "$stdio_ptr" in
15201         '') stdio_ptr='((fp)->_IO_read_ptr)'
15202                 ptr_lval=$define
15203                 ;;
15204         *)      ptr_lval=$d_stdio_ptr_lval;;
15205         esac
15206         case "$stdio_cnt" in
15207         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15208                 cnt_lval=$undef
15209                 ;;
15210         *)      cnt_lval=$d_stdio_cnt_lval;;
15211         esac
15212         case "$stdio_base" in
15213         '') stdio_base='((fp)->_IO_read_base)';;
15214         esac
15215         case "$stdio_bufsiz" in
15216         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15217         esac
15218 else
15219         case "$stdio_ptr" in
15220         '') stdio_ptr='((fp)->_ptr)'
15221                 ptr_lval=$define
15222                 ;;
15223         *)      ptr_lval=$d_stdio_ptr_lval;;
15224         esac
15225         case "$stdio_cnt" in
15226         '') stdio_cnt='((fp)->_cnt)'
15227                 cnt_lval=$define
15228                 ;;
15229         *)      cnt_lval=$d_stdio_cnt_lval;;
15230         esac
15231         case "$stdio_base" in
15232         '') stdio_base='((fp)->_base)';;
15233         esac
15234         case "$stdio_bufsiz" in
15235         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15236         esac
15237 fi
15238
15239 : test whether _ptr and _cnt really work
15240 echo "Checking how std your stdio is..." >&4
15241 $cat >try.c <<EOP
15242 #include <stdio.h>
15243 #define FILE_ptr(fp)    $stdio_ptr
15244 #define FILE_cnt(fp)    $stdio_cnt
15245 int main() {
15246         FILE *fp = fopen("try.c", "r");
15247         char c = getc(fp);
15248         if (
15249                 18 <= FILE_cnt(fp) &&
15250                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15251         )
15252                 exit(0);
15253         exit(1);
15254 }
15255 EOP
15256 val="$undef"
15257 set try
15258 if eval $compile && $to try.c; then
15259         if $run ./try; then
15260                 echo "Your stdio acts pretty std."
15261                 val="$define"
15262         else
15263                 echo "Your stdio isn't very std."
15264         fi
15265 else
15266         echo "Your stdio doesn't appear very std."
15267 fi
15268 $rm -f try.c try
15269 set d_stdstdio
15270 eval $setvar
15271
15272 : Can _ptr be used as an lvalue?
15273 case "$d_stdstdio$ptr_lval" in
15274 $define$define) val=$define ;;
15275 *) val=$undef ;;
15276 esac
15277 set d_stdio_ptr_lval
15278 eval $setvar
15279
15280 : Can _cnt be used as an lvalue?
15281 case "$d_stdstdio$cnt_lval" in
15282 $define$define) val=$define ;;
15283 *) val=$undef ;;
15284 esac
15285 set d_stdio_cnt_lval
15286 eval $setvar
15287
15288
15289 : test whether setting _ptr sets _cnt as a side effect
15290 d_stdio_ptr_lval_sets_cnt="$undef"
15291 d_stdio_ptr_lval_nochange_cnt="$undef"
15292 case "$d_stdio_ptr_lval$d_stdstdio" in
15293 $define$define)
15294         echo "Checking to see what happens if we set the stdio ptr..." >&4
15295 $cat >try.c <<EOP
15296 #include <stdio.h>
15297 /* Can we scream? */
15298 /* Eat dust sed :-) */
15299 /* In the buffer space, no one can hear you scream. */
15300 #define FILE_ptr(fp)    $stdio_ptr
15301 #define FILE_cnt(fp)    $stdio_cnt
15302 #include <sys/types.h>
15303 int main() {
15304         FILE *fp = fopen("try.c", "r");
15305         int c;
15306         char *ptr;
15307         size_t cnt;
15308         if (!fp) {
15309             puts("Fail even to read");
15310             exit(1);
15311         }
15312         c = getc(fp); /* Read away the first # */
15313         if (c == EOF) {
15314             puts("Fail even to read");
15315             exit(1);
15316         }
15317         if (!(
15318                 18 <= FILE_cnt(fp) &&
15319                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15320         )) {
15321                 puts("Fail even to read");
15322                 exit (1);
15323         }
15324         ptr = (char*) FILE_ptr(fp);
15325         cnt = (size_t)FILE_cnt(fp);
15326
15327         FILE_ptr(fp) += 42;
15328
15329         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15330                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15331                 exit (1);
15332         }
15333         if (FILE_cnt(fp) <= 20) {
15334                 printf ("Fail (<20 chars to test)");
15335                 exit (1);
15336         }
15337         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15338                 puts("Fail compare");
15339                 exit (1);
15340         }
15341         if (cnt == FILE_cnt(fp)) {
15342                 puts("Pass_unchanged");
15343                 exit (0);
15344         }       
15345         if (FILE_cnt(fp) == (cnt - 42)) {
15346                 puts("Pass_changed");
15347                 exit (0);
15348         }
15349         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15350         return 1;
15351
15352 }
15353 EOP
15354         set try
15355         if eval $compile && $to try.c; then
15356                 case `$run ./try` in
15357                 Pass_changed)
15358                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15359                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15360                 Pass_unchanged)
15361                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15362                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15363                 Fail*)
15364                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15365                 *)
15366                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15367         esac
15368         else
15369                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15370         fi
15371         $rm -f try.c try
15372         ;;
15373 esac
15374
15375 : see if _base is also standard
15376 val="$undef"
15377 case "$d_stdstdio" in
15378 $define)
15379         $cat >try.c <<EOP
15380 #include <stdio.h>
15381 #define FILE_base(fp)   $stdio_base
15382 #define FILE_bufsiz(fp) $stdio_bufsiz
15383 int main() {
15384         FILE *fp = fopen("try.c", "r");
15385         char c = getc(fp);
15386         if (
15387                 19 <= FILE_bufsiz(fp) &&
15388                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15389         )
15390                 exit(0);
15391         exit(1);
15392 }
15393 EOP
15394         set try
15395         if eval $compile && $to try.c; then
15396                 if $run ./try; then
15397                         echo "And its _base field acts std."
15398                         val="$define"
15399                 else
15400                         echo "But its _base field isn't std."
15401                 fi
15402         else
15403                 echo "However, it seems to be lacking the _base field."
15404         fi
15405         $rm -f try.c try
15406         ;;
15407 esac
15408 set d_stdiobase
15409 eval $setvar
15410
15411 $cat >&4 <<EOM
15412 Checking how to access stdio streams by file descriptor number...
15413 EOM
15414 case "$stdio_stream_array" in
15415 '')     $cat >try.c <<EOCP
15416 #include <stdio.h>
15417 int main() {
15418   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15419     printf("yes\n");
15420 }
15421 EOCP
15422         for s in _iob __iob __sF
15423         do
15424                 set try -DSTDIO_STREAM_ARRAY=$s
15425                 if eval $compile; then
15426                         case "`$run ./try`" in
15427                         yes)    stdio_stream_array=$s; break ;;
15428                         esac
15429                 fi
15430         done
15431         $rm -f try.* try$exe_ext
15432 esac
15433 case "$stdio_stream_array" in
15434 '')     $cat >&4 <<EOM
15435 I can't figure out how to access stdio streams by file descriptor number.
15436 EOM
15437         d_stdio_stream_array="$undef"
15438         ;;
15439 *)      $cat >&4 <<EOM
15440 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15441 EOM
15442         d_stdio_stream_array="$define"
15443         ;;
15444 esac
15445
15446 : see if strcoll exists
15447 set strcoll d_strcoll
15448 eval $inlibc
15449
15450 : check for structure copying
15451 echo " "
15452 echo "Checking to see if your C compiler can copy structs..." >&4
15453 $cat >try.c <<'EOCP'
15454 int main()
15455 {
15456         struct blurfl {
15457                 int dyick;
15458         } foo, bar;
15459
15460         foo = bar;
15461 }
15462 EOCP
15463 if $cc -c try.c >/dev/null 2>&1 ; then
15464         val="$define"
15465         echo "Yup, it can."
15466 else
15467         val="$undef"
15468         echo "Nope, it can't."
15469 fi
15470 set d_strctcpy
15471 eval $setvar
15472 $rm -f try.*
15473
15474 : see if strerror and/or sys_errlist[] exist
15475 echo " "
15476 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15477     if set strerror val -f d_strerror; eval $csym; $val; then
15478                 echo 'strerror() found.' >&4
15479                 d_strerror="$define"
15480                 d_strerrm='strerror(e)'
15481                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15482                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15483                         d_syserrlst="$define"
15484                 else
15485                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15486                         d_syserrlst="$undef"
15487                 fi
15488     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15489                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15490                 echo 'strerror() found in string header.' >&4
15491                 d_strerror="$define"
15492                 d_strerrm='strerror(e)'
15493                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15494                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15495                                 d_syserrlst="$define"
15496                 else
15497                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15498                         d_syserrlst="$undef"
15499                 fi
15500     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15501                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15502                 d_strerror="$undef"
15503                 d_syserrlst="$define"
15504                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15505     else
15506                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15507                 d_strerror="$undef"
15508                 d_syserrlst="$undef"
15509                 d_strerrm='"unknown"'
15510     fi
15511 fi
15512
15513 : see if strerror_r exists
15514 set strerror_r d_strerror_r
15515 eval $inlibc
15516 case "$d_strerror_r" in
15517 "$define")
15518         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15519         case "$d_strerror_r_proto:$usethreads" in
15520         ":define")      d_strerror_r_proto=define
15521                 set d_strerror_r_proto strerror_r $hdrs
15522                 eval $hasproto ;;
15523         *)      ;;
15524         esac
15525         case "$d_strerror_r_proto" in
15526         define)
15527         case "$strerror_r_proto" in
15528         ''|0) try='int strerror_r(int, char*, size_t);'
15529         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15530         esac
15531         case "$strerror_r_proto" in
15532         ''|0) try='int strerror_r(int, char*, int);'
15533         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15534         esac
15535         case "$strerror_r_proto" in
15536         ''|0) try='char* strerror_r(int, char*, size_t);'
15537         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15538         esac
15539         case "$strerror_r_proto" in
15540         '')     d_strerror_r=undef
15541                 strerror_r_proto=0
15542                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15543         * )     case "$strerror_r_proto" in
15544                 REENTRANT_PROTO*) ;;
15545                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15546                 esac
15547                 echo "Prototype: $try" ;;
15548         esac
15549         ;;
15550         *)      case "$usethreads" in
15551                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15552                 esac
15553                 ;;
15554         esac
15555         ;;
15556 *)      strerror_r_proto=0
15557         ;;
15558 esac
15559
15560 : see if strftime exists
15561 set strftime d_strftime
15562 eval $inlibc
15563
15564 : see if strtod exists
15565 set strtod d_strtod
15566 eval $inlibc
15567
15568 : see if strtol exists
15569 set strtol d_strtol
15570 eval $inlibc
15571
15572 : see if strtold exists
15573 set strtold d_strtold
15574 eval $inlibc
15575
15576 : see if strtoll exists
15577 set strtoll d_strtoll
15578 eval $inlibc
15579
15580 case "$d_longlong-$d_strtoll" in
15581 "$define-$define")
15582         $cat <<EOM
15583 Checking whether your strtoll() works okay...
15584 EOM
15585         $cat >try.c <<'EOCP'
15586 #include <errno.h>
15587 #ifdef __hpux
15588 #define strtoll __strtoll
15589 #endif
15590 #ifdef __EMX__
15591 #define strtoll _strtoll
15592 #endif
15593 #include <stdio.h>
15594 extern long long int strtoll(char *s, char **, int); 
15595 static int bad = 0;
15596 int check(char *s, long long ell, int een) {
15597         long long gll;
15598         errno = 0;
15599         gll = strtoll(s, 0, 10);
15600         if (!((gll == ell) && (errno == een)))
15601                 bad++;
15602 }
15603 int main() {
15604         check(" 1",                                      1LL, 0);
15605         check(" 0",                                      0LL, 0);
15606         check("-1",                                     -1LL, 0);
15607         check("-9223372036854775808", -9223372036854775808LL, 0);
15608         check("-9223372036854775808", -9223372036854775808LL, 0);
15609         check(" 9223372036854775807",  9223372036854775807LL, 0);
15610         check("-9223372036854775808", -9223372036854775808LL, 0);
15611         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15612         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15613         if (!bad)
15614                 printf("ok\n");
15615 }
15616 EOCP
15617         set try
15618         if eval $compile; then
15619                 yyy=`$run ./try`
15620                 case "$yyy" in
15621                 ok) echo "Your strtoll() seems to be working okay." ;;
15622                 *) cat <<EOM >&4
15623 Your strtoll() doesn't seem to be working okay.
15624 EOM
15625                    d_strtoll="$undef"
15626                    ;;
15627                 esac
15628         else
15629                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15630                 d_strtoll="$undef"
15631         fi
15632         ;;
15633 esac
15634
15635 : see if strtoq exists
15636 set strtoq d_strtoq
15637 eval $inlibc
15638
15639 : see if strtoul exists
15640 set strtoul d_strtoul
15641 eval $inlibc
15642
15643 case "$d_strtoul" in
15644 "$define")
15645         $cat <<EOM
15646 Checking whether your strtoul() works okay...
15647 EOM
15648         $cat >try.c <<'EOCP'
15649 #include <errno.h>
15650 #include <stdio.h>
15651 extern unsigned long int strtoul(char *s, char **, int); 
15652 static int bad = 0;
15653 void check(char *s, unsigned long eul, int een) {
15654         unsigned long gul;
15655         errno = 0;
15656         gul = strtoul(s, 0, 10);
15657         if (!((gul == eul) && (errno == een)))
15658                 bad++;
15659 }
15660 int main() {
15661         check(" 1", 1L, 0);
15662         check(" 0", 0L, 0);
15663 EOCP
15664         case "$longsize" in
15665         8)
15666             $cat >>try.c <<'EOCP'
15667         check("18446744073709551615", 18446744073709551615UL, 0);
15668         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15669 #if 0 /* strtoul() for /^-/ strings is undefined. */
15670         check("-1", 18446744073709551615UL, 0);
15671         check("-18446744073709551614", 2, 0);
15672         check("-18446744073709551615", 1, 0);
15673         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15674         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15675 #endif
15676 EOCP
15677                 ;;
15678         4)
15679                     $cat >>try.c <<'EOCP'
15680         check("4294967295", 4294967295UL, 0);
15681         check("4294967296", 4294967295UL, ERANGE);
15682 #if 0 /* strtoul() for /^-/ strings is undefined. */
15683         check("-1", 4294967295UL, 0);
15684         check("-4294967294", 2, 0);
15685         check("-4294967295", 1, 0);
15686         check("-4294967296", 4294967295UL, ERANGE);
15687         check("-4294967297", 4294967295UL, ERANGE);
15688 #endif
15689 EOCP
15690                 ;;
15691         *)
15692 : Should we write these tests to be more portable by sprintf-ing
15693 : ~0 and then manipulating that char string as input for strtol?
15694                 ;;
15695         esac
15696         $cat >>try.c <<'EOCP'
15697         if (!bad)
15698                 printf("ok\n");
15699         return 0;
15700 }
15701 EOCP
15702         set try
15703         if eval $compile; then
15704                 case "`$run ./try`" in
15705                 ok) echo "Your strtoul() seems to be working okay." ;;
15706                 *) cat <<EOM >&4
15707 Your strtoul() doesn't seem to be working okay.
15708 EOM
15709                    d_strtoul="$undef"
15710                    ;;
15711                 esac
15712         fi
15713         ;;
15714 esac
15715
15716 : see if strtoull exists
15717 set strtoull d_strtoull
15718 eval $inlibc
15719
15720 case "$d_longlong-$d_strtoull" in
15721 "$define-$define")
15722         $cat <<EOM
15723 Checking whether your strtoull() works okay...
15724 EOM
15725         $cat >try.c <<'EOCP'
15726 #include <errno.h>
15727 #ifdef __hpux
15728 #define strtoull __strtoull
15729 #endif
15730 #include <stdio.h>
15731 extern unsigned long long int strtoull(char *s, char **, int); 
15732 static int bad = 0;
15733 int check(char *s, long long eull, int een) {
15734         long long gull;
15735         errno = 0;
15736         gull = strtoull(s, 0, 10);
15737         if (!((gull == eull) && (errno == een)))
15738                 bad++;
15739 }
15740 int main() {
15741         check(" 1",                                        1LL, 0);
15742         check(" 0",                                        0LL, 0);
15743         check("18446744073709551615",  18446744073709551615ULL, 0);
15744         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15745 #if 0 /* strtoull() for /^-/ strings is undefined. */
15746         check("-1",                    18446744073709551615ULL, 0);
15747         check("-18446744073709551614",                     2LL, 0);
15748         check("-18446744073709551615",                     1LL, 0);
15749         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15750         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15751 #endif
15752         if (!bad)
15753                 printf("ok\n");
15754 }
15755 EOCP
15756         set try
15757         if eval $compile; then
15758                 case "`$run ./try`" in
15759                 ok) echo "Your strtoull() seems to be working okay." ;;
15760                 *) cat <<EOM >&4
15761 Your strtoull() doesn't seem to be working okay.
15762 EOM
15763                    d_strtoull="$undef"
15764                    ;;
15765                 esac
15766         fi
15767         ;;
15768 esac
15769
15770 : see if strtouq exists
15771 set strtouq d_strtouq
15772 eval $inlibc
15773
15774 case "$d_strtouq" in
15775 "$define")
15776         $cat <<EOM
15777 Checking whether your strtouq() works okay...
15778 EOM
15779         $cat >try.c <<'EOCP'
15780 #include <errno.h>
15781 #include <stdio.h>
15782 extern unsigned long long int strtouq(char *s, char **, int); 
15783 static int bad = 0;
15784 void check(char *s, unsigned long long eull, int een) {
15785         unsigned long long gull;
15786         errno = 0;
15787         gull = strtouq(s, 0, 10);
15788         if (!((gull == eull) && (errno == een)))
15789                 bad++;
15790 }
15791 int main() {
15792         check(" 1",                                        1LL, 0);
15793         check(" 0",                                        0LL, 0);
15794         check("18446744073709551615",  18446744073709551615ULL, 0);
15795         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15796 #if 0 /* strtouq() for /^-/ strings is undefined. */
15797         check("-1",                    18446744073709551615ULL, 0);
15798         check("-18446744073709551614",                     2LL, 0);
15799         check("-18446744073709551615",                     1LL, 0);
15800         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15801         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15802 #endif
15803         if (!bad)
15804                 printf("ok\n");
15805         return 0;
15806 }
15807 EOCP
15808         set try
15809         if eval $compile; then
15810                 case "`$run ./try`" in
15811                 ok) echo "Your strtouq() seems to be working okay." ;;
15812                 *) cat <<EOM >&4
15813 Your strtouq() doesn't seem to be working okay.
15814 EOM
15815                    d_strtouq="$undef"
15816                    ;;
15817                 esac
15818         fi
15819         ;;
15820 esac
15821
15822 : see if strxfrm exists
15823 set strxfrm d_strxfrm
15824 eval $inlibc
15825
15826 : see if symlink exists
15827 set symlink d_symlink
15828 eval $inlibc
15829
15830 : see if syscall exists
15831 set syscall d_syscall
15832 eval $inlibc
15833
15834 : see if prototype for syscall is available
15835 echo " "
15836 set d_syscallproto syscall $i_unistd unistd.h
15837 eval $hasproto
15838
15839 : see if sysconf exists
15840 set sysconf d_sysconf
15841 eval $inlibc
15842
15843 : see if system exists
15844 set system d_system
15845 eval $inlibc
15846
15847 : see if tcgetpgrp exists
15848 set tcgetpgrp d_tcgetpgrp
15849 eval $inlibc
15850
15851 : see if tcsetpgrp exists
15852 set tcsetpgrp d_tcsetpgrp
15853 eval $inlibc
15854
15855 : see if prototype for telldir is available
15856 echo " "
15857 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15858 eval $hasproto
15859
15860 : see if this is a sys/times.h system
15861 set sys/times.h i_systimes
15862 eval $inhdr
15863
15864 : see if times exists
15865 echo " "
15866 if set times val -f d_times; eval $csym; $val; then
15867         echo 'times() found.' >&4
15868         d_times="$define"
15869         inc=''
15870         case "$i_systimes" in
15871         "$define") inc='sys/times.h';;
15872         esac
15873         rp="What is the type returned by times() on this system?"
15874         set clock_t clocktype long stdio.h sys/types.h $inc
15875         eval $typedef_ask
15876 else
15877         echo 'times() NOT found, hope that will do.' >&4
15878         d_times="$undef"
15879         clocktype='int'
15880 fi
15881
15882 : see if tmpnam_r exists
15883 set tmpnam_r d_tmpnam_r
15884 eval $inlibc
15885 case "$d_tmpnam_r" in
15886 "$define")
15887         hdrs="$i_systypes sys/types.h define stdio.h $i_stdio stdio.h"
15888         case "$d_tmpnam_r_proto:$usethreads" in
15889         ":define")      d_tmpnam_r_proto=define
15890                 set d_tmpnam_r_proto tmpnam_r $hdrs
15891                 eval $hasproto ;;
15892         *)      ;;
15893         esac
15894         case "$d_tmpnam_r_proto" in
15895         define)
15896         case "$tmpnam_r_proto" in
15897         ''|0) try='char* tmpnam_r(char*);'
15898         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15899         esac
15900         case "$tmpnam_r_proto" in
15901         '')     d_tmpnam_r=undef
15902                 tmpnam_r_proto=0
15903                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
15904         * )     case "$tmpnam_r_proto" in
15905                 REENTRANT_PROTO*) ;;
15906                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
15907                 esac
15908                 echo "Prototype: $try" ;;
15909         esac
15910         ;;
15911         *)      case "$usethreads" in
15912                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
15913                 esac
15914                 ;;
15915         esac
15916         ;;
15917 *)      tmpnam_r_proto=0
15918         ;;
15919 esac
15920
15921 : see if truncate exists
15922 set truncate d_truncate
15923 eval $inlibc
15924
15925 : see if ttyname_r exists
15926 set ttyname_r d_ttyname_r
15927 eval $inlibc
15928 case "$d_ttyname_r" in
15929 "$define")
15930         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
15931         case "$d_ttyname_r_proto:$usethreads" in
15932         ":define")      d_ttyname_r_proto=define
15933                 set d_ttyname_r_proto ttyname_r $hdrs
15934                 eval $hasproto ;;
15935         *)      ;;
15936         esac
15937         case "$d_ttyname_r_proto" in
15938         define)
15939         case "$ttyname_r_proto" in
15940         ''|0) try='int ttyname_r(int, char*, size_t);'
15941         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
15942         esac
15943         case "$ttyname_r_proto" in
15944         ''|0) try='int ttyname_r(int, char*, int);'
15945         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
15946         esac
15947         case "$ttyname_r_proto" in
15948         ''|0) try='char* ttyname_r(int, char*, int);'
15949         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
15950         esac
15951         case "$ttyname_r_proto" in
15952         '')     d_ttyname_r=undef
15953                 ttyname_r_proto=0
15954                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
15955         * )     case "$ttyname_r_proto" in
15956                 REENTRANT_PROTO*) ;;
15957                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
15958                 esac
15959                 echo "Prototype: $try" ;;
15960         esac
15961         ;;
15962         *)      case "$usethreads" in
15963                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
15964                 esac
15965                 ;;
15966         esac
15967         ;;
15968 *)      ttyname_r_proto=0
15969         ;;
15970 esac
15971
15972 : see if tzname[] exists
15973 echo " "
15974 if set tzname val -a d_tzname; eval $csym; $val; then
15975         val="$define"
15976         echo 'tzname[] found.' >&4
15977 else
15978         val="$undef"
15979         echo 'tzname[] NOT found.' >&4
15980 fi
15981 set d_tzname
15982 eval $setvar
15983
15984 case "$osname" in
15985 next|rhapsody|darwin) multiarch="$define" ;;
15986 esac
15987 case "$multiarch" in
15988 ''|[nN]*) multiarch="$undef" ;;
15989 esac
15990
15991 : check for ordering of bytes in a long
15992 echo " "
15993 case "$usecrosscompile$multiarch" in
15994 *$define*)
15995         $cat <<EOM
15996 You seem to be either cross-compiling or doing a multiarchitecture build,
15997 skipping the byteorder check.
15998
15999 EOM
16000         byteorder='ffff'
16001         ;;
16002 *)
16003         case "$byteorder" in
16004         '')
16005                 $cat <<'EOM'
16006 In the following, larger digits indicate more significance.  A big-endian
16007 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16008 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16009 machines may have weird orders like 3412.  A Cray will report 87654321,
16010 an Alpha will report 12345678. If the test program works the default is
16011 probably right.
16012 I'm now running the test program...
16013 EOM
16014                 $cat >try.c <<'EOCP'
16015 #include <stdio.h>
16016 int main()
16017 {
16018         int i;
16019         union {
16020                 unsigned long l;
16021                 char c[sizeof(long)];
16022         } u;
16023
16024         if (sizeof(long) > 4)
16025                 u.l = (0x08070605L << 32) | 0x04030201L;
16026         else
16027                 u.l = 0x04030201L;
16028         for (i = 0; i < sizeof(long); i++)
16029                 printf("%c", u.c[i]+'0');
16030         printf("\n");
16031         exit(0);
16032 }
16033 EOCP
16034                 xxx_prompt=y
16035                 set try
16036                 if eval $compile && ./try > /dev/null; then
16037                         dflt=`$run ./try`
16038                         case "$dflt" in
16039                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16040                                 echo "(The test program ran ok.)"
16041                                 echo "byteorder=$dflt"
16042                                 xxx_prompt=n
16043                         ;;
16044                         ????|????????) echo "(The test program ran ok.)" ;;
16045                         *) echo "(The test program didn't run right for some reason.)" ;;
16046                         esac
16047                 else
16048                         dflt='4321'
16049                         cat <<'EOM'
16050 (I can't seem to compile the test program.  Guessing big-endian...)
16051 EOM
16052                 fi
16053                 case "$xxx_prompt" in
16054                 y)
16055                         rp="What is the order of bytes in a long?"
16056                         . ./myread
16057                         byteorder="$ans"
16058                         ;;
16059                 *)      byteorder=$dflt
16060                         ;;
16061                 esac
16062                 ;;
16063         esac
16064         $rm -f try.c try
16065         ;;
16066 esac
16067
16068
16069 $cat <<EOM
16070
16071 Checking to see whether you can access character data unalignedly...
16072 EOM
16073 case "$d_u32align" in
16074 '')   $cat >try.c <<EOCP
16075 #include <stdio.h>
16076 #define U32 $u32type
16077 #define BYTEORDER 0x$byteorder
16078 #define U8 $u8type
16079 #include <signal.h>
16080 #ifdef SIGBUS
16081 $signal_t bletch(s) int s; { exit(4); }
16082 #endif
16083 int main() {
16084 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16085     U8 buf[8];
16086     U32 *up;
16087     int i;
16088
16089     if (sizeof(U32) != 4) {
16090         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16091         exit(1);
16092     }
16093
16094     fflush(stdout);
16095
16096 #ifdef SIGBUS
16097     signal(SIGBUS, bletch);
16098 #endif
16099
16100     buf[0] = 0;
16101     buf[1] = 0;
16102     buf[2] = 0;
16103     buf[3] = 1;
16104     buf[5] = 0;
16105     buf[6] = 0;
16106     buf[7] = 0;
16107     buf[8] = 1;
16108
16109     for (i = 0; i < 4; i++) {
16110         up = (U32*)(buf + i);
16111         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16112                (*up == 1 << (8*(3-i)))  /* little-endian */
16113               )
16114            )
16115         {
16116             printf("read failed (%x)\n", *up);
16117             exit(2);
16118         }
16119     }
16120
16121     /* write test */
16122     for (i = 0; i < 4; i++) {
16123         up = (U32*)(buf + i);
16124         *up = 0xBeef;
16125         if (*up != 0xBeef) {
16126             printf("write failed (%x)\n", *up);
16127             exit(3);
16128         }
16129     }
16130
16131     exit(0);
16132 #else
16133     printf("1\n");
16134     exit(1);
16135 #endif
16136     return 0;
16137 }
16138 EOCP
16139 set try
16140 if eval $compile_ok; then
16141         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16142         $run ./try 2>&1 >/dev/null
16143         case "$?" in
16144         0)      cat >&4 <<EOM
16145 You can access character data pretty unalignedly.
16146 EOM
16147                 d_u32align="$undef"
16148                 ;;
16149         *)      cat >&4 <<EOM
16150 It seems that you must access character data in an aligned manner.
16151 EOM
16152                 d_u32align="$define"
16153                 ;;
16154         esac
16155 else
16156         rp='Can you access character data at unaligned addresses?'
16157         dflt='n'
16158         . ./myread
16159         case "$ans" in
16160         [yY]*)  d_u32align="$undef"  ;;
16161         *)      d_u32align="$define" ;;
16162         esac
16163 fi
16164 $rm -f core core.try.* try.core
16165 ;;
16166 esac
16167
16168 : see if ualarm exists
16169 set ualarm d_ualarm
16170 eval $inlibc
16171
16172 : see if umask exists
16173 set umask d_umask
16174 eval $inlibc
16175
16176 : see if unordered exists
16177 set unordered d_unordered
16178 eval $inlibc
16179
16180 : see if usleep exists
16181 set usleep d_usleep
16182 eval $inlibc
16183
16184 : see if prototype for usleep is available
16185 echo " "
16186 set d_usleepproto usleep $i_unistd unistd.h
16187 eval $hasproto
16188
16189 : see if ustat exists
16190 set ustat d_ustat
16191 eval $inlibc
16192
16193 : backward compatibility for d_hvfork
16194 if test X$d_hvfork != X; then
16195         d_vfork="$d_hvfork"
16196         d_hvfork=''
16197 fi
16198 : see if there is a vfork
16199 val=''
16200 set vfork val
16201 eval $inlibc
16202
16203 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16204 : perl on Solaris 2.x, and probably elsewhere.
16205 case "$val" in
16206 $define)
16207         echo " "
16208         case "$usevfork" in
16209         false) dflt='n';;
16210         *) dflt='y';;
16211         esac
16212         cat <<'EOM'
16213  
16214 Perl can only use a vfork() that doesn't suffer from strict
16215 restrictions on calling functions or modifying global data in
16216 the child.  For example, glibc-2.1 contains such a vfork()
16217 that is unsuitable.  If your system provides a proper fork()
16218 call, chances are that you do NOT want perl to use vfork().
16219
16220 EOM
16221         rp="Do you still want to use vfork()?"
16222         . ./myread
16223         case "$ans" in
16224         y|Y) ;;
16225         *)
16226                 echo "Ok, we won't use vfork()."
16227                 val="$undef"
16228                 ;;
16229         esac
16230         ;;
16231 esac
16232 set d_vfork
16233 eval $setvar
16234 case "$d_vfork" in
16235 $define) usevfork='true';;
16236 *) usevfork='false';;
16237 esac
16238
16239 : see if closedir exists
16240 set closedir d_closedir
16241 eval $inlibc
16242
16243 case "$d_closedir" in
16244 "$define")
16245         echo " "
16246         echo "Checking whether closedir() returns a status..." >&4
16247         cat > try.c <<EOM
16248 #$i_dirent I_DIRENT             /**/
16249 #$i_sysdir I_SYS_DIR            /**/
16250 #$i_sysndir I_SYS_NDIR          /**/
16251 #$i_systypes I_SYS_TYPES        /**/
16252
16253 #if defined(I_SYS_TYPES)
16254 #include <sys/types.h>
16255 #endif
16256 #if defined(I_DIRENT)
16257 #include <dirent.h>
16258 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16259 #include <sys/dir.h>
16260 #endif
16261 #else
16262 #ifdef I_SYS_NDIR
16263 #include <sys/ndir.h>
16264 #else
16265 #ifdef I_SYS_DIR
16266 #ifdef hp9000s500
16267 #include <ndir.h>       /* may be wrong in the future */
16268 #else
16269 #include <sys/dir.h>
16270 #endif
16271 #endif
16272 #endif
16273 #endif 
16274 int main() { return closedir(opendir(".")); }
16275 EOM
16276         set try
16277         if eval $compile_ok; then
16278                 if $run ./try > /dev/null 2>&1 ; then
16279                         echo "Yes, it does."
16280                         val="$undef"
16281                 else
16282                         echo "No, it doesn't."
16283                         val="$define"
16284                 fi
16285         else
16286                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16287                 val="$define"
16288         fi
16289         ;;
16290 *)
16291         val="$undef";
16292         ;;
16293 esac
16294 set d_void_closedir
16295 eval $setvar
16296 $rm -f try try.*
16297 : see if there is a wait4
16298 set wait4 d_wait4
16299 eval $inlibc
16300
16301 : see if waitpid exists
16302 set waitpid d_waitpid
16303 eval $inlibc
16304
16305 : see if wcstombs exists
16306 set wcstombs d_wcstombs
16307 eval $inlibc
16308
16309 : see if wctomb exists
16310 set wctomb d_wctomb
16311 eval $inlibc
16312
16313 : see if writev exists
16314 set writev d_writev
16315 eval $inlibc
16316
16317 : preserve RCS keywords in files with variable substitution, grrr
16318 Date='$Date'
16319 Id='$Id'
16320 Log='$Log'
16321 RCSfile='$RCSfile'
16322 Revision='$Revision'
16323
16324 : check for alignment requirements
16325 echo " "
16326 case "$usecrosscompile$multiarch" in
16327 *$define*)
16328         $cat <<EOM
16329 You seem to be either cross-compiling or doing a multiarchitecture build,
16330 skipping the memory alignment check.
16331
16332 EOM
16333         case "$alignbytes" in
16334         '') alignbytes=8 ;;
16335         esac
16336         ;;
16337 *)
16338         case "$alignbytes" in
16339         '') echo "Checking alignment constraints..." >&4
16340                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16341                         $cat >try.c <<'EOCP'
16342 typedef long double NV;
16343 EOCP
16344                 else
16345                         $cat >try.c <<'EOCP'
16346 typedef double NV;
16347 EOCP
16348                 fi
16349                 $cat >>try.c <<'EOCP'
16350 #include <stdio.h>
16351 struct foobar {
16352         char foo;
16353         NV bar;
16354 } try_algn;
16355 int main()
16356 {
16357     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16358     return(0);
16359 }
16360 EOCP
16361                 set try
16362                 if eval $compile_ok; then
16363                         dflt=`$run ./try`
16364                 else
16365                         dflt='8'
16366                         echo "(I can't seem to compile the test program...)"
16367                 fi
16368                 ;;
16369         *) dflt="$alignbytes"
16370                 ;;
16371         esac
16372         rp="Doubles must be aligned on a how-many-byte boundary?"
16373         . ./myread
16374         alignbytes="$ans"
16375         $rm -f try.c try
16376         ;;
16377 esac
16378
16379
16380 : set the base revision
16381 baserev=5.0
16382
16383 : how do we catenate cpp tokens here?
16384 echo " "
16385 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16386 $cat >cpp_stuff.c <<'EOCP'
16387 #define RCAT(a,b)a/**/b
16388 #define ACAT(a,b)a ## b
16389 RCAT(Rei,ser)
16390 ACAT(Cir,cus)
16391 EOCP
16392 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16393 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16394         echo "Oh!  Smells like ANSI's been here." >&4
16395         echo "We can catify or stringify, separately or together!"
16396         cpp_stuff=42
16397 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16398         echo "Ah, yes!  The good old days!" >&4
16399         echo "However, in the good old days we don't know how to stringify and"
16400         echo "catify at the same time."
16401         cpp_stuff=1
16402 else
16403         $cat >&4 <<EOM
16404 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16405 to have to edit the values of CAT[2-5] in config.h...
16406 EOM
16407         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16408 fi
16409 $rm -f cpp_stuff.*
16410
16411 : see if this is a db.h system
16412 set db.h i_db
16413 eval $inhdr
16414
16415 case "$i_db" in
16416 $define)
16417         : Check db version.
16418         echo " "
16419         echo "Checking Berkeley DB version ..." >&4
16420         $cat >try.c <<EOCP
16421 #$d_const HASCONST
16422 #ifndef HASCONST
16423 #define const
16424 #endif
16425 #include <sys/types.h>
16426 #include <stdio.h>
16427 #include <db.h>
16428 int main(int argc, char *argv[])
16429 {
16430 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16431     int Major, Minor, Patch ;
16432     unsigned long Version ;
16433     (void)db_version(&Major, &Minor, &Patch) ;
16434     if (argc == 2) {
16435         printf("%d %d %d %d %d %d\n",
16436                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16437                Major, Minor, Patch);
16438         exit(0);
16439     }
16440     printf("You have Berkeley DB Version 2 or greater.\n");
16441
16442     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16443                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16444     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16445                 Major, Minor, Patch) ;
16446
16447     /* check that db.h & libdb are compatible */
16448     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16449         printf("db.h and libdb are incompatible.\n") ;
16450         exit(3);        
16451     }
16452
16453     printf("db.h and libdb are compatible.\n") ;
16454
16455     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16456                 + DB_VERSION_PATCH ;
16457
16458     /* needs to be >= 2.3.4 */
16459     if (Version < 2003004) {
16460     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16461         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16462         exit(2);        
16463     }
16464
16465     exit(0);
16466 #else
16467 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16468     if (argc == 2) {
16469         printf("1 0 0\n");
16470         exit(0);
16471     }
16472     printf("You have Berkeley DB Version 1.\n");
16473     exit(0);    /* DB version < 2: the coast is clear. */
16474 #else
16475     exit(1);    /* <db.h> not Berkeley DB? */
16476 #endif
16477 #endif
16478 }
16479 EOCP
16480         set try
16481         if eval $compile_ok && $run ./try; then
16482                 echo 'Looks OK.' >&4
16483                 set `$run ./try 1`
16484                 db_version_major=$1
16485                 db_version_minor=$2
16486                 db_version_patch=$3
16487         else
16488                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16489                 i_db=$undef
16490                 case " $libs " in
16491                 *"-ldb "*)
16492                         : Remove db from list of libraries to use
16493                         echo "Removing unusable -ldb from library list" >&4
16494                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16495                         shift
16496                         libs="$*"
16497                         echo "libs = $libs" >&4
16498                         ;;
16499                 esac
16500         fi
16501         $rm -f try.*
16502         ;;
16503 esac
16504
16505 case "$i_db" in
16506 define)
16507         : Check the return type needed for hash 
16508         echo " "
16509         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16510         $cat >try.c <<EOCP
16511 #$d_const HASCONST
16512 #ifndef HASCONST
16513 #define const
16514 #endif
16515 #include <sys/types.h>
16516 #include <db.h>
16517
16518 #ifndef DB_VERSION_MAJOR
16519 u_int32_t hash_cb (ptr, size)
16520 const void *ptr;
16521 size_t size;
16522 {
16523 }
16524 HASHINFO info;
16525 int main()
16526 {
16527         info.hash = hash_cb;
16528 }
16529 #endif
16530 EOCP
16531         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16532                 if $contains warning try.out >>/dev/null 2>&1 ; then
16533                         db_hashtype='int'
16534                 else
16535                         db_hashtype='u_int32_t'
16536                 fi
16537         else
16538                 : XXX Maybe we should just give up here.
16539                 db_hashtype=u_int32_t
16540                 $cat try.out >&4
16541                 echo "Help:  I can't seem to compile the db test program." >&4
16542                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16543         fi
16544         $rm -f try.*
16545         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16546         ;;
16547 *)      db_hashtype=u_int32_t
16548         ;;
16549 esac
16550 case "$i_db" in
16551 define)
16552         : Check the return type needed for prefix 
16553         echo " "
16554         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16555         cat >try.c <<EOCP
16556 #$d_const HASCONST
16557 #ifndef HASCONST
16558 #define const
16559 #endif
16560 #include <sys/types.h>
16561 #include <db.h>
16562
16563 #ifndef DB_VERSION_MAJOR
16564 size_t prefix_cb (key1, key2)
16565 const DBT *key1;
16566 const DBT *key2;
16567 {
16568 }
16569 BTREEINFO info;
16570 int main()
16571 {
16572         info.prefix = prefix_cb;
16573 }
16574 #endif
16575 EOCP
16576         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16577                 if $contains warning try.out >>/dev/null 2>&1 ; then
16578                         db_prefixtype='int'
16579                 else
16580                         db_prefixtype='size_t'
16581                 fi
16582         else
16583                 db_prefixtype='size_t'
16584                 : XXX Maybe we should just give up here.
16585                 $cat try.out >&4
16586                 echo "Help:  I can't seem to compile the db test program." >&4
16587                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16588         fi
16589         $rm -f try.*
16590         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16591         ;;
16592 *)      db_prefixtype='size_t'
16593         ;;
16594 esac
16595
16596
16597 : How can we generate normalized random numbers ?
16598 echo " "
16599 echo "Looking for a random number function..." >&4
16600 case "$randfunc" in
16601 '')
16602         if set drand48 val -f; eval $csym; $val; then
16603                 dflt="drand48"
16604                 echo "Good, found drand48()." >&4
16605         elif set random val -f; eval $csym; $val; then
16606                 dflt="random"
16607                 echo "OK, found random()." >&4
16608         else
16609                 dflt="rand"
16610                 echo "Yick, looks like I have to use rand()." >&4
16611         fi
16612         echo " "
16613         ;;
16614 *)
16615         dflt="$randfunc"
16616         ;;
16617 esac
16618 cont=true
16619
16620 case "$ccflags" in
16621 *-Dmy_rand=*|*-Dmy_srand=*)
16622         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16623         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16624         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16625         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16626         ;;
16627 esac
16628
16629 while $test "$cont"; do
16630         rp="Use which function to generate random numbers?"
16631         . ./myread
16632         if $test "$ans" = "$dflt"; then
16633                 : null
16634         else
16635                 randbits=''
16636         fi
16637         randfunc="$ans"
16638         if set $ans val -f; eval $csym; $val; then
16639                 cont=''
16640         else
16641                 dflt=y
16642                 rp="I cannot find function $ans. Use that name anyway?"
16643                 . ./myread
16644                 dflt=rand
16645                 case "$ans" in
16646                         [yY]*) cont='';;
16647                 esac
16648         fi
16649         case "$cont" in
16650         '')
16651                 case "$randfunc" in
16652                 drand48)
16653                         drand01="drand48()"
16654                         seedfunc="srand48"
16655                         randbits=48
16656                         randseedtype=long
16657                         ;;
16658                 rand|random)
16659                         case "$randbits" in
16660                         '')
16661 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16662                                 $cat >try.c <<EOCP
16663 #$i_unistd I_UNISTD
16664 #$i_stdlib I_STDLIB
16665 #include <stdio.h>
16666 #ifdef I_UNISTD
16667 #  include <unistd.h>
16668 #endif
16669 #ifdef I_STDLIB
16670 #  include <stdlib.h>
16671 #endif
16672 int main()
16673 {
16674         register int i;
16675         register unsigned long tmp;
16676         register unsigned long max = 0L;
16677
16678         for (i = 1000; i; i--) {
16679                 tmp = (unsigned long) $randfunc();
16680                 if (tmp > max) max = tmp;
16681         }
16682         for (i = 0; max; i++)
16683                 max /= 2;
16684         printf("%d\n",i);
16685 }
16686 EOCP
16687                                 set try
16688                                 if eval $compile_ok; then
16689                                         dflt=`try`
16690                                 else
16691                                         dflt='?'
16692                                         echo "(I can't seem to compile the test program...)"
16693                                 fi
16694                                 ;;
16695                         *)
16696                                 dflt="$randbits"
16697                                 ;;
16698                         esac
16699                         rp="How many bits does your $randfunc() function produce?"
16700                         . ./myread
16701                         randbits="$ans"
16702                         $rm -f try.c try
16703                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16704                         seedfunc="s$randfunc"
16705                         randseedtype=unsigned
16706                         ;;
16707                 *)
16708                         dflt="31"
16709                         rp="How many bits does your $randfunc() function produce?"
16710                         . ./myread
16711                         randbits="$ans"
16712                         seedfunc="s$randfunc"
16713                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16714                         if set $seedfunc val -f; eval $csym; $val; then
16715                                 echo "(Using $seedfunc() to seed random generator)"
16716                         else
16717                                 echo "(Warning: no $seedfunc() to seed random generator)"
16718                                 seedfunc=rand
16719                         fi
16720                         randseedtype=unsigned
16721                         ;;
16722                 esac
16723                 ;;
16724         esac
16725 done
16726
16727 echo " "
16728 echo "Determining whether or not we are on an EBCDIC system..." >&4
16729 $cat >try.c <<'EOM'
16730 int main()
16731 {
16732   if ('M'==0xd4) return 0;
16733   return 1;
16734 }
16735 EOM
16736
16737 val=$undef
16738 set try
16739 if eval $compile_ok; then
16740         if $run ./try; then
16741                 echo "You seem to speak EBCDIC." >&4
16742                 val="$define"
16743         else
16744                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16745         fi
16746 else
16747         echo "I'm unable to compile the test program." >&4
16748         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16749 fi
16750 $rm -f try try.*
16751 set ebcdic
16752 eval $setvar
16753
16754 echo " "
16755 $cat >&4 <<EOM
16756 Checking how to flush all pending stdio output...
16757 EOM
16758 # I only know how to find the first 32 possibly open files on SunOS.
16759 # See also hints/sunos_4_1.sh and util.c  --AD
16760 case "$osname" in
16761 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16762 esac
16763 $cat >>try.c <<EOCP
16764 #include <stdio.h>
16765 #$i_unistd I_UNISTD
16766 #ifdef I_UNISTD
16767 # include <unistd.h>
16768 #endif
16769 #$d_sysconf HAS_SYSCONF
16770 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16771 #ifdef HAS_STDIO_STREAM_ARRAY
16772 # define STDIO_STREAM_ARRAY $stdio_stream_array
16773 #endif
16774 int main() {
16775   FILE* p;
16776   unlink("try.out");
16777   p = fopen("try.out", "w");
16778 #ifdef TRY_FPUTC
16779   fputc('x', p);
16780 #else
16781 # ifdef TRY_FPRINTF
16782   fprintf(p, "x");
16783 # endif
16784 #endif
16785 #ifdef TRY_FFLUSH_NULL
16786   fflush(NULL);
16787 #endif
16788 #ifdef TRY_FFLUSH_ALL
16789   {
16790     long open_max = -1;
16791 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16792     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16793 # else
16794 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16795     open_max = sysconf(_SC_OPEN_MAX);
16796 #  else
16797 #   ifdef FOPEN_MAX
16798     open_max = FOPEN_MAX;
16799 #   else
16800 #    ifdef OPEN_MAX
16801     open_max = OPEN_MAX;
16802 #    else
16803 #     ifdef _NFILE
16804     open_max = _NFILE;
16805 #     endif
16806 #    endif
16807 #   endif
16808 #  endif
16809 # endif 
16810 # ifdef HAS_STDIO_STREAM_ARRAY
16811     if (open_max > 0) {
16812       long i;
16813       for (i = 0; i < open_max; i++)
16814             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16815                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16816                 STDIO_STREAM_ARRAY[i]._flag)
16817                 fflush(&STDIO_STREAM_ARRAY[i]);
16818     }   
16819   }
16820 # endif
16821 #endif
16822   _exit(42);
16823 }
16824 EOCP
16825 : first we have to find out how _not_ to flush
16826 $to try.c
16827 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16828     output=''
16829     set try -DTRY_FPUTC
16830     if eval $compile; then
16831             $run ./try 2>/dev/null
16832             code="$?"
16833             $from try.out
16834             if $test ! -s try.out -a "X$code" = X42; then
16835                 output=-DTRY_FPUTC
16836             fi
16837     fi
16838     case "$output" in
16839     '')
16840             set try -DTRY_FPRINTF
16841             if eval $compile; then
16842                     $run ./try 2>/dev/null
16843                     code="$?"
16844                     $from try.out
16845                     if $test ! -s try.out -a "X$code" = X42; then
16846                         output=-DTRY_FPRINTF
16847                     fi
16848             fi
16849         ;;
16850     esac
16851 fi
16852 : check for fflush NULL behaviour
16853 case "$fflushNULL" in
16854 '')     set try -DTRY_FFLUSH_NULL $output
16855         if eval $compile; then
16856                 $run ./try 2>/dev/null
16857                 code="$?"
16858                 $from try.out
16859                 if $test -s try.out -a "X$code" = X42; then
16860                         fflushNULL="`$cat try.out`"
16861                 else
16862                         if $test "X$code" != X42; then
16863                                 $cat >&4 <<EOM
16864 (If this test failed, don't worry, we'll try another method shortly.)
16865 EOM
16866                         fi
16867                 fi
16868         fi
16869         $rm -f core try.core core.try.*
16870         case "$fflushNULL" in
16871         x)      $cat >&4 <<EOM
16872 Your fflush(NULL) works okay for output streams.
16873 Let's see if it clobbers input pipes...
16874 EOM
16875 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16876 # bug that improperly flushes the input end of pipes.  So we avoid the
16877 # autoflush on fork/system/exec support for now. :-(
16878 $cat >tryp.c <<EOCP
16879 #include <stdio.h>
16880 int
16881 main(int argc, char **argv)
16882 {
16883     char buf[1024];
16884     int i;
16885     char *bp = buf;
16886     while (1) {
16887         while ((i = getc(stdin)) != -1
16888                && (*bp++ = i) != '\n'
16889                && bp < &buf[1024])
16890         /* DO NOTHING */ ;
16891         *bp = '\0';
16892         fprintf(stdout, "%s", buf);
16893         fflush(NULL);
16894         if (i == -1)
16895             return 0;
16896         bp = buf;
16897     }
16898 }
16899 EOCP
16900                 fflushNULL="$define"
16901                 set tryp
16902                 if eval $compile; then
16903                     $rm -f tryp.out
16904                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
16905                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
16906                        $cat >&4 <<EOM
16907 fflush(NULL) seems to behave okay with input streams.
16908 EOM
16909                         fflushNULL="$define"
16910                     else
16911                         $cat >&4 <<EOM
16912 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
16913 EOM
16914                         fflushNULL="$undef"
16915                     fi
16916                 fi
16917                 $rm -f core tryp.c tryp.core core.tryp.*
16918                 ;;
16919         '')     $cat >&4 <<EOM
16920 Your fflush(NULL) isn't working (contrary to ANSI C).
16921 EOM
16922                 fflushNULL="$undef"
16923                 ;;
16924         *)      $cat >&4 <<EOM
16925 Cannot figure out whether your fflush(NULL) works or not.
16926 I'm assuming it doesn't (contrary to ANSI C).
16927 EOM
16928                 fflushNULL="$undef"
16929                 ;;
16930         esac
16931         ;;
16932 $define|true|[yY]*)
16933         fflushNULL="$define"
16934         ;;
16935 *)
16936         fflushNULL="$undef"
16937         ;;
16938 esac
16939 : check explicit looping only if NULL did not work, and if the pipe
16940 : bug does not show up on an explicit flush too
16941 case "$fflushNULL" in
16942 "$undef")
16943         $cat >tryp.c <<EOCP
16944 #include <stdio.h>
16945 int
16946 main(int argc, char **argv)
16947 {
16948     char buf[1024];
16949     int i;
16950     char *bp = buf;
16951     while (1) {
16952         while ((i = getc(stdin)) != -1
16953                && (*bp++ = i) != '\n'
16954                && bp < &buf[1024])
16955         /* DO NOTHING */ ;
16956         *bp = '\0';
16957         fprintf(stdout, "%s", buf);
16958         fflush(stdin);
16959         if (i == -1)
16960             return 0;
16961         bp = buf;
16962     }
16963 }
16964 EOCP
16965         set tryp
16966         if eval $compile; then
16967             $rm -f tryp.out
16968             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
16969             if cmp tryp.c tryp.out >/dev/null 2>&1; then
16970                $cat >&4 <<EOM
16971 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
16972 EOM
16973                 : now check for fflushall behaviour
16974                 case "$fflushall" in
16975                 '')     set try -DTRY_FFLUSH_ALL $output
16976                         if eval $compile; then
16977                                 $cat >&4 <<EOM
16978 (Now testing the other method--but note that this also may fail.)
16979 EOM
16980                                 $run ./try 2>/dev/null
16981                                 code=$?
16982                                 $from try.out
16983                                 if $test -s try.out -a "X$code" = X42; then
16984                                         fflushall="`$cat try.out`"
16985                                 fi
16986                         fi
16987                         $rm -f core try.core core.try.*
16988                         case "$fflushall" in
16989                         x)      $cat >&4 <<EOM
16990 Whew. Flushing explicitly all the stdio streams works.
16991 EOM
16992                                 fflushall="$define"
16993                                 ;;
16994                         '')     $cat >&4 <<EOM
16995 Sigh. Flushing explicitly all the stdio streams doesn't work.
16996 EOM
16997                                 fflushall="$undef"
16998                                 ;;
16999                         *)      $cat >&4 <<EOM
17000 Cannot figure out whether flushing stdio streams explicitly works or not.
17001 I'm assuming it doesn't.
17002 EOM
17003                                 fflushall="$undef"
17004                                 ;;
17005                         esac
17006                         ;;
17007                 "$define"|true|[yY]*)
17008                         fflushall="$define"
17009                         ;;
17010                 *)
17011                         fflushall="$undef"
17012                         ;;
17013                 esac
17014             else
17015                 $cat >&4 <<EOM
17016 All is futile.  Even fflush(stdin) clobbers input pipes!
17017 EOM
17018                 fflushall="$undef"
17019             fi
17020         else
17021             fflushall="$undef"
17022         fi
17023         $rm -f core tryp.c tryp.core core.tryp.*
17024         ;;
17025 *)      fflushall="$undef"
17026         ;;
17027 esac
17028
17029 case "$fflushNULL$fflushall" in
17030 undefundef)
17031         $cat <<EOM
17032 OK, I give up.  I cannot figure out how to flush pending stdio output.
17033 We won't be flushing handles at all before fork/exec/popen.
17034 EOM
17035         ;;
17036 esac
17037 $rm -f try.* try$exe_ext
17038
17039 : Store the full pathname to the ar program for use in the C program
17040 : Respect a hint or command line value for full_ar.
17041 case "$full_ar" in
17042 '') full_ar=$ar ;;
17043 esac
17044
17045 : Store the full pathname to the sed program for use in the C program
17046 full_sed=$sed
17047
17048 : see what type gids are declared as in the kernel
17049 echo " "
17050 echo "Looking for the type for group ids returned by getgid()."
17051 set gid_t gidtype xxx stdio.h sys/types.h
17052 eval $typedef
17053 case "$gidtype" in
17054 xxx)
17055         xxx=`./findhdr sys/user.h`
17056         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17057         case $1 in
17058         unsigned) dflt="$1 $2" ;;
17059         *) dflt="$1" ;;
17060         esac
17061         ;;
17062 *) dflt="$gidtype";;
17063 esac
17064 case "$gidtype" in
17065 gid_t) echo "gid_t found." ;;
17066 *)      rp="What is the type for group ids returned by getgid()?"
17067         . ./myread
17068         gidtype="$ans"
17069         ;;
17070 esac
17071
17072 echo " "
17073 case "$gidtype" in
17074 *_t) zzz="$gidtype"     ;;
17075 *)   zzz="gid"          ;;
17076 esac
17077 echo "Checking the size of $zzz..." >&4 
17078 cat > try.c <<EOCP
17079 #include <sys/types.h>
17080 #include <stdio.h>
17081 int main() {
17082     printf("%d\n", (int)sizeof($gidtype));
17083     exit(0);
17084 }
17085 EOCP
17086 set try
17087 if eval $compile_ok; then
17088         yyy=`$run ./try`
17089         case "$yyy" in
17090         '')     gidsize=4
17091                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17092                 ;;
17093         *)      gidsize=$yyy
17094                 echo "Your $zzz is $gidsize bytes long."
17095                 ;;
17096         esac
17097 else
17098         gidsize=4
17099         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17100 fi
17101
17102
17103 echo " "
17104 case "$gidtype" in
17105 *_t) zzz="$gidtype"     ;;
17106 *)   zzz="gid"          ;;
17107 esac
17108 echo "Checking the sign of $zzz..." >&4 
17109 cat > try.c <<EOCP
17110 #include <sys/types.h>
17111 #include <stdio.h>
17112 int main() {
17113         $gidtype foo = -1;
17114         if (foo < 0)
17115                 printf("-1\n");
17116         else
17117                 printf("1\n");
17118 }
17119 EOCP
17120 set try
17121 if eval $compile; then
17122         yyy=`$run ./try`
17123         case "$yyy" in
17124         '')     gidsign=1
17125                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17126                 ;;
17127         *)      gidsign=$yyy
17128                 case "$gidsign" in
17129                  1) echo "Your $zzz is unsigned." ;;
17130                 -1) echo "Your $zzz is signed."   ;;
17131                 esac
17132                 ;;
17133         esac
17134 else
17135         gidsign=1
17136         echo "(I can't compile the test program--guessing unsigned.)" >&4
17137 fi
17138
17139
17140 echo " "
17141
17142 if $test X"$quadtype" != X; then
17143
17144 echo "Checking how to print 64-bit integers..." >&4
17145
17146 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17147         $cat >try.c <<'EOCP'
17148 #include <sys/types.h>
17149 #include <stdio.h>
17150 int main() {
17151   int q = 12345678901;
17152   printf("%ld\n", q);
17153 }
17154 EOCP
17155         set try
17156         if eval $compile; then
17157                 yyy=`$run ./try`
17158                 case "$yyy" in
17159                 12345678901)
17160                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17161                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17162                         echo "We will use %d."
17163                         ;;
17164                 esac
17165         fi
17166 fi
17167
17168 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17169         $cat >try.c <<'EOCP'
17170 #include <sys/types.h>
17171 #include <stdio.h>
17172 int main() {
17173   long q = 12345678901;
17174   printf("%ld\n", q);
17175 }
17176 EOCP
17177         set try
17178         if eval $compile; then
17179                 yyy=`$run ./try`
17180                 case "$yyy" in
17181                 12345678901)
17182                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17183                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17184                         echo "We will use %ld."
17185                         ;;
17186                 esac
17187         fi
17188 fi
17189
17190 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17191         $cat >try.c <<'EOCP'
17192 #include <sys/types.h>
17193 #include <inttypes.h>
17194 #include <stdio.h>
17195 int main() {
17196   int64_t q = 12345678901;
17197   printf("%" PRId64 "\n", q);
17198 }
17199 EOCP
17200         set try
17201         if eval $compile; then
17202                 yyy=`$run ./try`
17203                 case "$yyy" in
17204                 12345678901)
17205                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17206                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17207                         echo "We will use the C9X style."
17208                         ;;
17209                 esac
17210         fi
17211 fi
17212
17213 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17214         $cat >try.c <<EOCP
17215 #include <sys/types.h>
17216 #include <stdio.h>
17217 int main() {
17218   $quadtype q = 12345678901;
17219   printf("%Ld\n", q);
17220 }
17221 EOCP
17222         set try
17223         if eval $compile; then
17224                 yyy=`$run ./try`
17225                 case "$yyy" in
17226                 12345678901)
17227                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17228                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17229                         echo "We will use %Ld."
17230                         ;;
17231                 esac
17232         fi
17233 fi
17234
17235 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17236         $cat >try.c <<'EOCP'
17237 #include <sys/types.h>
17238 #include <stdio.h>
17239 int main() {
17240   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17241   printf("%lld\n", q);
17242 }
17243 EOCP
17244         set try
17245         if eval $compile; then
17246                 yyy=`$run ./try`
17247                 case "$yyy" in
17248                 12345678901)
17249                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17250                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17251                         echo "We will use the %lld style."
17252                         ;;
17253                 esac
17254         fi
17255 fi
17256
17257 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17258         $cat >try.c <<EOCP
17259 #include <sys/types.h>
17260 #include <stdio.h>
17261 int main() {
17262   $quadtype q = 12345678901;
17263   printf("%qd\n", q);
17264 }
17265 EOCP
17266         set try
17267         if eval $compile; then
17268                 yyy=`$run ./try`
17269                 case "$yyy" in
17270                 12345678901)
17271                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17272                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17273                         echo "We will use %qd."
17274                         ;;
17275                 esac
17276         fi
17277 fi
17278
17279 if $test X"$sPRId64" = X; then
17280         echo "Cannot figure out how to print 64-bit integers." >&4
17281 fi
17282
17283 $rm -f try try.*
17284
17285 fi
17286
17287 case "$sPRId64" in
17288 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17289         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17290         ;;
17291 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17292         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17293         ;;
17294 esac
17295
17296
17297 echo " "
17298 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17299
17300 if $test X"$ivsize" = X8; then
17301         ivdformat="$sPRId64"
17302         uvuformat="$sPRIu64"
17303         uvoformat="$sPRIo64"
17304         uvxformat="$sPRIx64"
17305         uvXUformat="$sPRIXU64"
17306 else
17307         if $test X"$ivsize" = X"$longsize"; then
17308                 ivdformat='"ld"'
17309                 uvuformat='"lu"'
17310                 uvoformat='"lo"'
17311                 uvxformat='"lx"'
17312                 uvXUformat='"lX"'
17313         else
17314                 if $test X"$ivsize" = X"$intsize"; then
17315                         ivdformat='"d"'
17316                         uvuformat='"u"'
17317                         uvoformat='"o"'
17318                         uvxformat='"x"'
17319                         uvXUformat='"X"'
17320                 else
17321                         : far out
17322                         if $test X"$ivsize" = X"$shortsize"; then
17323                                 ivdformat='"hd"'
17324                                 uvuformat='"hu"'
17325                                 uvoformat='"ho"'
17326                                 uvxformat='"hx"'
17327                                 uvXUformat='"hX"'
17328                         fi
17329                 fi
17330         fi
17331 fi
17332
17333 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17334         nveformat="$sPRIeldbl"
17335         nvfformat="$sPRIfldbl"
17336         nvgformat="$sPRIgldbl"
17337         nvEUformat="$sPRIEUldbl"
17338         nvFUformat="$sPRIFUldbl"
17339         nvGUformat="$sPRIGUldbl"
17340 else
17341         nveformat='"e"'
17342         nvfformat='"f"'
17343         nvgformat='"g"'
17344         nvEUformat='"E"'
17345         nvFUformat='"F"'
17346         nvGUformat='"G"'
17347 fi
17348
17349 case "$ivdformat" in
17350 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17351     exit 1
17352     ;;
17353 esac
17354
17355
17356 echo " "
17357 $echo "Checking the format string to be used for gids..." >&4
17358
17359 case "$gidsign" in
17360 -1)     if $test X"$gidsize" = X"$ivsize"; then
17361                 gidformat="$ivdformat"
17362         else
17363                 if $test X"$gidsize" = X"$longsize"; then
17364                         gidformat='"ld"'
17365                 else
17366                         if $test X"$gidsize" = X"$intsize"; then
17367                                 gidformat='"d"'
17368                         else
17369                                 if $test X"$gidsize" = X"$shortsize"; then
17370                                         gidformat='"hd"'
17371                                 fi
17372                         fi
17373                 fi
17374         fi
17375         ;;
17376 *)      if $test X"$gidsize" = X"$uvsize"; then
17377                 gidformat="$uvuformat"
17378         else
17379                 if $test X"$gidsize" = X"$longsize"; then
17380                         gidformat='"lu"'
17381                 else
17382                         if $test X"$gidsize" = X"$intsize"; then
17383                                 gidformat='"u"'
17384                         else
17385                                 if $test X"$gidsize" = X"$shortsize"; then
17386                                         gidformat='"hu"'
17387                                 fi
17388                         fi
17389                 fi
17390         fi
17391         ;;
17392 esac
17393
17394 : see if getgroups exists
17395 set getgroups d_getgrps
17396 eval $inlibc
17397
17398 : see if setgroups exists
17399 set setgroups d_setgrps
17400 eval $inlibc
17401
17402
17403 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17404 echo " "
17405 case "$d_getgrps$d_setgrps" in
17406 *define*)
17407         case "$groupstype" in
17408         '') dflt="$gidtype" ;;
17409         *)  dflt="$groupstype" ;;
17410         esac
17411         $cat <<EOM
17412 What type of pointer is the second argument to getgroups() and setgroups()?
17413 Usually this is the same as group ids, $gidtype, but not always.
17414
17415 EOM
17416         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17417         . ./myread
17418         groupstype="$ans"
17419         ;;
17420 *)  groupstype="$gidtype";;
17421 esac
17422
17423 echo " "
17424 echo "Checking if your $make program sets \$(MAKE)..." >&4
17425 case "$make_set_make" in
17426 '')
17427         $sed 's/^X //' > testmake.mak << 'EOF'
17428 Xall:
17429 X       @echo 'maketemp="$(MAKE)"'
17430 EOF
17431         case "`$make -f testmake.mak 2>/dev/null`" in
17432         *maketemp=*) make_set_make='#' ;;
17433         *)      make_set_make="MAKE=$make" ;;
17434         esac
17435         $rm -f testmake.mak
17436         ;;
17437 esac
17438 case "$make_set_make" in
17439 '#') echo "Yup, it does.";;
17440 *) echo "Nope, it doesn't.";;
17441 esac
17442
17443 : see what type is used for mode_t
17444 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17445 set mode_t modetype int stdio.h sys/types.h
17446 eval $typedef_ask
17447
17448 : see if stdarg is available
17449 echo " "
17450 if $test `./findhdr stdarg.h`; then
17451         echo "<stdarg.h> found." >&4
17452         valstd="$define"
17453 else
17454         echo "<stdarg.h> NOT found." >&4
17455         valstd="$undef"
17456 fi
17457
17458 : see if varags is available
17459 echo " "
17460 if $test `./findhdr varargs.h`; then
17461         echo "<varargs.h> found." >&4
17462 else
17463         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17464 fi
17465
17466 : set up the varargs testing programs
17467 $cat > varargs.c <<EOP
17468 #ifdef I_STDARG
17469 #include <stdarg.h>
17470 #endif
17471 #ifdef I_VARARGS
17472 #include <varargs.h>
17473 #endif
17474
17475 #ifdef I_STDARG
17476 int f(char *p, ...)
17477 #else
17478 int f(va_alist)
17479 va_dcl
17480 #endif
17481 {
17482         va_list ap;
17483 #ifndef I_STDARG
17484         char *p;
17485 #endif
17486 #ifdef I_STDARG
17487         va_start(ap,p);
17488 #else
17489         va_start(ap);
17490         p = va_arg(ap, char *);
17491 #endif
17492         va_end(ap);
17493 }
17494 EOP
17495 $cat > varargs <<EOP
17496 $startsh
17497 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17498         echo "true"
17499 else
17500         echo "false"
17501 fi
17502 $rm -f varargs$_o
17503 EOP
17504 chmod +x varargs
17505
17506 : now check which varargs header should be included
17507 echo " "
17508 i_varhdr=''
17509 case "$valstd" in
17510 "$define")
17511         if `./varargs I_STDARG`; then
17512                 val='stdarg.h'
17513         elif `./varargs I_VARARGS`; then
17514                 val='varargs.h'
17515         fi
17516         ;;
17517 *)
17518         if `./varargs I_VARARGS`; then
17519                 val='varargs.h'
17520         fi
17521         ;;
17522 esac
17523 case "$val" in
17524 '')
17525 echo "I could not find the definition for va_dcl... You have problems..." >&4
17526         val="$undef"; set i_stdarg; eval $setvar
17527         val="$undef"; set i_varargs; eval $setvar
17528         ;;
17529 *) 
17530         set i_varhdr
17531         eval $setvar
17532         case "$i_varhdr" in
17533         stdarg.h)
17534                 val="$define"; set i_stdarg; eval $setvar
17535                 val="$undef"; set i_varargs; eval $setvar
17536                 ;;
17537         varargs.h)
17538                 val="$undef"; set i_stdarg; eval $setvar
17539                 val="$define"; set i_varargs; eval $setvar
17540                 ;;
17541         esac
17542         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17543 esac
17544 $rm -f varargs*
17545
17546 : see if we need va_copy
17547 echo " "
17548 case "$i_stdarg" in
17549 "$define")
17550         $cat >try.c <<EOCP
17551 #include <stdarg.h>
17552 #include <stdio.h>
17553 #$i_stdlib I_STDLIB
17554 #ifdef I_STDLIB
17555 #include <stdlib.h>
17556 #endif
17557 #include <signal.h>
17558
17559 int
17560 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17561 {
17562   return vfprintf(f, fmt, *valp);
17563 }
17564  
17565 int    
17566 myvfprintf(FILE *f, const  char *fmt, va_list val)
17567 {
17568   return ivfprintf(f, fmt, &val);
17569 }
17570       
17571 int
17572 myprintf(char *fmt, ...) 
17573 {
17574   va_list val;
17575   va_start(val, fmt);
17576   return myvfprintf(stdout, fmt, val); 
17577 }         
17578
17579 int
17580 main(int ac, char **av)
17581 {
17582   signal(SIGSEGV, exit);
17583
17584   myprintf("%s%cs all right, then\n", "that", '\'');                            
17585   exit(0);      
17586 }
17587 EOCP
17588         set try
17589         if eval $compile && $run ./try 2>&1 >/dev/null; then
17590                 case "`$run ./try`" in
17591                 "that's all right, then")
17592                         okay=yes
17593                         ;;
17594                 esac
17595         fi
17596         case "$okay" in
17597         yes)    echo "It seems that you don't need va_copy()." >&4
17598                 need_va_copy="$undef"
17599                 ;;
17600         *)      echo "It seems that va_copy() or similar will be needed." >&4
17601                 need_va_copy="$define"
17602                 ;;
17603         esac
17604         $rm -f try.* core core.* *.core *.core.*
17605         ;;
17606 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17607         ;;
17608 esac
17609
17610 : see what type is used for size_t
17611 rp="What is the type used for the length parameter for string functions?"
17612 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17613 eval $typedef_ask
17614
17615 : check for type of arguments to gethostbyaddr. 
17616 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17617         case "$d_gethbyaddr" in
17618         $define)
17619                 $cat <<EOM
17620
17621 Checking to see what type of arguments are accepted by gethostbyaddr().
17622 EOM
17623                 hdrs="$define sys/types.h
17624                         $d_socket sys/socket.h 
17625                         $i_niin netinet/in.h 
17626                         $i_netdb netdb.h
17627                         $i_unistd unistd.h"
17628                 : The first arg can 'char *' or 'void *'
17629                 : The second arg is some of integral type
17630                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17631                         for yyy in size_t long int; do
17632                                 case "$netdb_host_type" in
17633                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17634                                         if ./protochk "$try" $hdrs; then
17635                                                 echo "Your system accepts $xxx for the first arg."
17636                                                 echo "...and $yyy for the second arg."
17637                                                 netdb_host_type="$xxx"
17638                                                 netdb_hlen_type="$yyy"
17639                                         fi
17640                                         ;;
17641                                 esac
17642                         done
17643                 done
17644                 : In case none of those worked, prompt the user.
17645                 case "$netdb_host_type" in
17646                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17647                         dflt='char *'
17648                         . ./myread
17649                         netdb_host_type=$ans
17650                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17651                         dflt="$sizetype"
17652                         . ./myread
17653                         netdb_hlen_type=$ans
17654                         ;;
17655                 esac
17656                 ;;
17657         *)      : no gethostbyaddr, so pick harmless defaults
17658                 netdb_host_type='char *'
17659                 netdb_hlen_type="$sizetype"
17660                 ;;
17661         esac
17662         # Remove the "const" if needed. -- but then we'll have a 
17663         # prototype clash!
17664         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17665 fi
17666
17667 : check for type of argument to gethostbyname. 
17668 if test "X$netdb_name_type" = X ; then
17669         case "$d_gethbyname" in
17670         $define)
17671                 $cat <<EOM
17672
17673 Checking to see what type of argument is accepted by gethostbyname().
17674 EOM
17675                 hdrs="$define sys/types.h
17676                         $d_socket sys/socket.h 
17677                         $i_niin netinet/in.h 
17678                         $i_netdb netdb.h
17679                         $i_unistd unistd.h"
17680                 for xxx in "const char *" "char *"; do
17681                         case "$netdb_name_type" in
17682                         '')     try="extern struct hostent *gethostbyname($xxx);"
17683                                 if ./protochk "$try" $hdrs; then
17684                                         echo "Your system accepts $xxx."
17685                                         netdb_name_type="$xxx"
17686                                 fi
17687                                 ;;
17688                         esac
17689                 done
17690                 : In case none of those worked, prompt the user.
17691                 case "$netdb_name_type" in
17692                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17693                         dflt='char *'
17694                         . ./myread
17695                         netdb_name_type=$ans
17696                         ;;
17697                 esac
17698                 ;;
17699         *)      : no gethostbyname, so pick harmless default
17700                 netdb_name_type='char *'
17701                 ;;
17702         esac
17703 fi
17704
17705 : check for type of 1st argument to getnetbyaddr. 
17706 if test "X$netdb_net_type" = X ; then
17707         case "$d_getnbyaddr" in
17708         $define)
17709                 $cat <<EOM
17710
17711 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17712 EOM
17713                 hdrs="$define sys/types.h
17714                         $d_socket sys/socket.h 
17715                         $i_niin netinet/in.h 
17716                         $i_netdb netdb.h
17717                         $i_unistd unistd.h"
17718                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17719                         case "$netdb_net_type" in
17720                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17721                                 if ./protochk "$try" $hdrs; then
17722                                         echo "Your system accepts $xxx."
17723                                         netdb_net_type="$xxx"
17724                                 fi
17725                                 ;;
17726                         esac
17727                 done
17728                 : In case none of those worked, prompt the user.
17729                 case "$netdb_net_type" in
17730                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17731                         dflt='long'
17732                         . ./myread
17733                         netdb_net_type=$ans
17734                         ;;
17735                 esac
17736                 ;;
17737         *)      : no getnetbyaddr, so pick harmless default
17738                 netdb_net_type='long'
17739                 ;;
17740         esac
17741 fi
17742 : locate the preferred pager for this system
17743 case "$pager" in
17744 '')
17745         dflt=''
17746         case "$pg" in
17747         /*) dflt=$pg;;
17748         [a-zA-Z]:/*) dflt=$pg;;
17749         esac
17750         case "$more" in
17751         /*) dflt=$more;;
17752         [a-zA-Z]:/*) dflt=$more;;
17753         esac
17754         case "$less" in
17755         /*) dflt=$less;;
17756         [a-zA-Z]:/*) dflt=$less;;
17757         esac
17758         case "$dflt" in
17759         '') dflt=/usr/ucb/more;;
17760         esac
17761         ;;
17762 *) dflt="$pager";;
17763 esac
17764 echo " "
17765 fn=f/
17766 rp='What pager is used on your system?'
17767 . ./getfile
17768 pager="$ans"
17769
17770 : see what type pids are declared as in the kernel
17771 rp="What is the type of process ids on this system?"
17772 set pid_t pidtype int stdio.h sys/types.h
17773 eval $typedef_ask
17774
17775 : Find earliest binary compatible site_perl subdirectory perl can use.
17776 case "$bincompat5005" in
17777 "$define") xs_apiversion='5.005' ;;
17778 *) xs_apiversion=$version ;;   # The current site_perl version.
17779 esac
17780 : Find earliest pure perl site_perl subdirectory perl can use.
17781 : The versioned directories started at 5.005.
17782 pm_apiversion='5.005'
17783
17784 : see if ar generates random libraries by itself
17785 echo " "
17786 echo "Checking how to generate random libraries on your machine..." >&4
17787 echo 'int bar1() { return bar2(); }' > bar1.c
17788 echo 'int bar2() { return 2; }' > bar2.c
17789 $cat > foo.c <<'EOP'
17790 int main() { printf("%d\n", bar1()); exit(0); }
17791 EOP
17792 $cc $ccflags -c bar1.c >/dev/null 2>&1
17793 $cc $ccflags -c bar2.c >/dev/null 2>&1
17794 $cc $ccflags -c foo.c >/dev/null 2>&1
17795 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17796 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17797         $run ./foobar >/dev/null 2>&1; then
17798         echo "$ar appears to generate random libraries itself."
17799         orderlib=false
17800         ranlib=":"
17801 elif $ar ts bar$_a >/dev/null 2>&1 &&
17802         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17803         $run ./foobar >/dev/null 2>&1; then
17804                 echo "a table of contents needs to be added with '$ar ts'."
17805                 orderlib=false
17806                 ranlib="$ar ts"
17807 else
17808         case "$ranlib" in
17809         :) ranlib='';;
17810         '')
17811                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17812                 $test -f $ranlib || ranlib=''
17813                 ;;
17814         esac
17815         if $test -n "$ranlib"; then
17816                 echo "your system has '$ranlib'; we'll use that."
17817                 orderlib=false
17818         else
17819                 echo "your system doesn't seem to support random libraries"
17820                 echo "so we'll use lorder and tsort to order the libraries."
17821                 orderlib=true
17822                 ranlib=":"
17823         fi
17824 fi
17825 $rm -f foo* bar* 
17826
17827 : check for type of arguments to select. 
17828 case "$selecttype" in
17829 '') case "$d_select" in
17830         $define)
17831                 echo " "
17832                 $cat <<EOM
17833 Checking to see what type of arguments are accepted by select().
17834 EOM
17835                 hdrs="$define sys/types.h
17836                         $i_systime sys/time.h 
17837                         $i_sysselct sys/select.h
17838                         $d_socket sys/socket.h"
17839                 : The first arg can be int, unsigned, or size_t
17840                 : The last arg may or may not be 'const'
17841                 val=''
17842                 : void pointer has been seen but using that
17843                 : breaks the selectminbits test
17844                 for xxx in 'fd_set *' 'int *'; do
17845                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17846                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17847                                         case "$val" in
17848                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17849                                                 if ./protochk "$try" $hdrs; then
17850                                                         echo "Your system accepts $xxx."
17851                                                         val="$xxx"
17852                                                 fi
17853                                                 ;;
17854                                         esac
17855                                 done
17856                         done
17857                 done
17858                 case "$val" in
17859                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17860                         case "$d_fd_set" in
17861                                 $define) dflt="fd_set *" ;;
17862                                 *)              dflt="int *" ;;
17863                         esac
17864                         . ./myread
17865                         val=$ans
17866                         ;;
17867                 esac
17868                 selecttype="$val"
17869                 ;;
17870         *)      : no select, so pick a harmless default
17871                 selecttype='int *'
17872                 ;;
17873         esac
17874         ;;
17875 esac
17876
17877 : check for the select 'width'
17878 case "$selectminbits" in
17879 '') case "$d_select" in
17880         $define)
17881                 $cat <<EOM
17882
17883 Checking to see on how many bits at a time your select() operates...
17884 EOM
17885                 $cat >try.c <<EOCP
17886 #include <sys/types.h>
17887 #$i_time I_TIME
17888 #$i_systime I_SYS_TIME
17889 #$i_systimek I_SYS_TIME_KERNEL
17890 #ifdef I_TIME
17891 #   include <time.h>
17892 #endif
17893 #ifdef I_SYS_TIME
17894 #   ifdef I_SYS_TIME_KERNEL
17895 #       define KERNEL
17896 #   endif
17897 #   include <sys/time.h>
17898 #   ifdef I_SYS_TIME_KERNEL
17899 #       undef KERNEL
17900 #   endif
17901 #endif
17902 #$i_sysselct I_SYS_SELECT
17903 #ifdef I_SYS_SELECT
17904 #include <sys/select.h>
17905 #endif
17906 #$d_socket HAS_SOCKET
17907 #ifdef HAS_SOCKET
17908 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
17909 #endif
17910 #include <stdio.h>
17911 $selecttype b;
17912 #define S sizeof(*(b))
17913 #define MINBITS 64
17914 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
17915 #define NBITS  (NBYTES * 8)
17916 int main() {
17917     char s[NBYTES];
17918     struct timeval t;
17919     int i;
17920     FILE* fp;
17921     int fd;
17922
17923     fclose(stdin);
17924     fp = fopen("try.c", "r");
17925     if (fp == 0)
17926       exit(1);
17927     fd = fileno(fp);
17928     if (fd < 0)
17929       exit(2);
17930     b = ($selecttype)s;
17931     for (i = 0; i < NBITS; i++)
17932         FD_SET(i, b);
17933     t.tv_sec  = 0;
17934     t.tv_usec = 0;
17935     select(fd + 1, b, 0, 0, &t);
17936     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
17937     printf("%d\n", i + 1);
17938     return 0;
17939 }
17940 EOCP
17941                 set try
17942                 if eval $compile_ok; then
17943                         selectminbits=`$run ./try`
17944                         case "$selectminbits" in
17945                         '')     cat >&4 <<EOM
17946 Cannot figure out on how many bits at a time your select() operates.
17947 I'll play safe and guess it is 32 bits.
17948 EOM
17949                                 selectminbits=32
17950                                 bits="32 bits"
17951                                 ;;
17952                         1)      bits="1 bit" ;;
17953                         *)      bits="$selectminbits bits" ;;
17954                         esac
17955                         echo "Your select() operates on $bits at a time." >&4
17956                 else
17957                         rp='What is the minimum number of bits your select() operates on?'
17958                         case "$byteorder" in
17959                         1234|12345678)  dflt=32 ;;
17960                         *)              dflt=1  ;;
17961                         esac
17962                         . ./myread
17963                         val=$ans
17964                         selectminbits="$val"
17965                 fi
17966                 $rm -f try.* try
17967                 ;;
17968         *)      : no select, so pick a harmless default
17969                 selectminbits='32'
17970                 ;;
17971         esac
17972         ;;
17973 esac
17974
17975 : Trace out the files included by signal.h, then look for SIGxxx names.
17976 : Remove SIGARRAYSIZE used by HPUX.
17977 : Remove SIGSTKSIZE used by Linux.
17978 : Remove SIGSTKSZ used by Posix.
17979 : Remove SIGTYP void lines used by OS2.
17980 : Some cpps, like os390, dont give the file name anywhere
17981 if [ "X$fieldn" = X ]; then
17982         : Just make some guesses.  We check them later.
17983         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
17984 else
17985         xxx=`echo '#include <signal.h>' |
17986         $cppstdin $cppminus $cppflags 2>/dev/null |
17987         $grep '^[       ]*#.*include' | 
17988         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
17989 fi
17990 : Check this list of files to be sure we have parsed the cpp output ok.
17991 : This will also avoid potentially non-existent files, such 
17992 : as ../foo/bar.h
17993 xxxfiles=''
17994 for xx in $xxx /dev/null ; do
17995         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
17996 done
17997 : If we have found no files, at least try signal.h
17998 case "$xxxfiles" in
17999 '')     xxxfiles=`./findhdr signal.h` ;;
18000 esac
18001 xxx=`awk '
18002 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18003         print substr($2, 4, 20)
18004 }
18005 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18006         print substr($3, 4, 20)
18007 }' $xxxfiles`
18008 : Append some common names just in case the awk scan failed.
18009 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18010 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18011 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18012 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18013 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18014
18015 : generate a few handy files for later
18016 $cat > signal.c <<'EOCP'
18017 #include <sys/types.h>
18018 #include <signal.h>
18019 #include <stdio.h>
18020 int main() {
18021
18022 /* Strange style to avoid deeply-nested #if/#else/#endif */
18023 #ifndef NSIG
18024 #  ifdef _NSIG
18025 #    define NSIG (_NSIG)
18026 #  endif
18027 #endif
18028
18029 #ifndef NSIG
18030 #  ifdef SIGMAX
18031 #    define NSIG (SIGMAX+1)
18032 #  endif
18033 #endif
18034
18035 #ifndef NSIG
18036 #  ifdef SIG_MAX
18037 #    define NSIG (SIG_MAX+1)
18038 #  endif
18039 #endif
18040
18041 #ifndef NSIG
18042 #  ifdef MAXSIG
18043 #    define NSIG (MAXSIG+1)
18044 #  endif
18045 #endif
18046
18047 #ifndef NSIG
18048 #  ifdef MAX_SIG
18049 #    define NSIG (MAX_SIG+1)
18050 #  endif
18051 #endif
18052
18053 #ifndef NSIG
18054 #  ifdef SIGARRAYSIZE
18055 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18056 #  endif
18057 #endif
18058
18059 #ifndef NSIG
18060 #  ifdef _sys_nsig
18061 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18062 #  endif
18063 #endif
18064
18065 /* Default to some arbitrary number that's big enough to get most
18066    of the common signals.
18067 */
18068 #ifndef NSIG
18069 #    define NSIG 50
18070 #endif
18071
18072 printf("NSIG %d\n", NSIG);
18073
18074 #ifndef JUST_NSIG
18075
18076 EOCP
18077
18078 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18079 {
18080         printf "#ifdef SIG"; printf $1; printf "\n"
18081         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18082         printf $1; printf ");\n"
18083         printf "#endif\n"
18084 }
18085 END {
18086         printf "#endif /* JUST_NSIG */\n";
18087         printf "exit(0);\n}\n";
18088 }
18089 ' >>signal.c
18090 $cat >signal.awk <<'EOP'
18091 BEGIN { ndups = 0 }
18092 $1 ~ /^NSIG$/ { nsig = $2 }
18093 ($1 !~ /^NSIG$/) && (NF == 2) {
18094     if ($2 > maxsig) { maxsig = $2 }
18095     if (sig_name[$2]) {
18096         dup_name[ndups] = $1
18097         dup_num[ndups] = $2
18098         ndups++ 
18099     }
18100     else {
18101         sig_name[$2] = $1
18102         sig_num[$2] = $2
18103     }
18104 }
18105 END { 
18106     if (nsig == 0) {
18107         nsig = maxsig + 1
18108     }
18109     printf("NSIG %d\n", nsig);
18110     for (n = 1; n < nsig; n++) {
18111         if (sig_name[n]) {
18112             printf("%s %d\n", sig_name[n], sig_num[n])
18113         }
18114         else {
18115             printf("NUM%d %d\n", n, n) 
18116         }
18117     }
18118     for (n = 0; n < ndups; n++) {
18119         printf("%s %d\n", dup_name[n], dup_num[n])
18120     }
18121 }
18122 EOP
18123 $cat >signal_cmd <<EOS
18124 $startsh
18125 if $test -s signal.lst; then
18126     echo "Using your existing signal.lst file"
18127         exit 0
18128 fi
18129 xxx="$xxx"
18130 EOS
18131 $cat >>signal_cmd <<'EOS'
18132
18133 set signal
18134 if eval $compile_ok; then
18135         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18136 else
18137         echo "(I can't seem be able to compile the whole test program)" >&4
18138         echo "(I'll try it in little pieces.)" >&4
18139         set signal -DJUST_NSIG
18140         if eval $compile_ok; then
18141                 $run ./signal$_exe > signal.nsg
18142                 $cat signal.nsg
18143         else
18144                 echo "I can't seem to figure out how many signals you have." >&4
18145                 echo "Guessing 50." >&4
18146                 echo 'NSIG 50' > signal.nsg
18147         fi
18148         : Now look at all the signal names, one at a time.
18149         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18150                 $cat > signal.c <<EOCP
18151 #include <sys/types.h>
18152 #include <signal.h>
18153 #include <stdio.h>
18154 int main() {
18155 printf("$xx %d\n", SIG${xx});
18156 return 0;
18157 }
18158 EOCP
18159                 set signal
18160                 if eval $compile; then
18161                         echo "SIG${xx} found."
18162                         $run ./signal$_exe  >> signal.ls1
18163                 else
18164                         echo "SIG${xx} NOT found."
18165                 fi
18166         done
18167         if $test -s signal.ls1; then
18168                 $cat signal.nsg signal.ls1 |
18169                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18170         fi
18171
18172 fi
18173 if $test -s signal.lst; then
18174         :
18175 else
18176         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18177         echo 'kill -l' >signal
18178         set X `csh -f <signal`
18179         $rm -f signal
18180         shift
18181         case $# in
18182         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18183         esac
18184         echo $@ | $tr ' ' $trnl | \
18185             $awk '{ printf "%s %d\n", $1, ++s; }
18186                   END { printf "NSIG %d\n", ++s }' >signal.lst
18187 fi
18188 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18189 EOS
18190 chmod a+x signal_cmd
18191 $eunicefix signal_cmd
18192
18193 : generate list of signal names
18194 echo " "
18195 case "$sig_name_init" in
18196 '') doinit=yes ;;
18197 *)  case "$sig_num_init" in
18198     ''|*,*) doinit=yes ;;
18199     esac ;;
18200 esac
18201 case "$doinit" in
18202 yes)
18203         echo "Generating a list of signal names and numbers..." >&4
18204         . ./signal_cmd
18205         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18206         sig_name=`$awk 'BEGIN { printf "ZERO " }
18207                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18208         sig_num=`$awk  'BEGIN { printf "0 " }
18209                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18210         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18211                              !/^NSIG/   { printf "\"%s\", ", $1 }
18212                              END        { printf "0\n" }' signal.lst`
18213         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18214                              !/^NSIG/   { printf "%d, ", $2}
18215                              END        { printf "0\n"}' signal.lst`
18216         ;;
18217 esac
18218 echo "The following $sig_count signals are available:"
18219 echo " "
18220 echo $sig_name | $awk \
18221 'BEGIN { linelen = 0 }
18222 {
18223         for (i = 1; i <= NF; i++) {
18224                 name = "SIG" $i " "
18225                 linelen = linelen + length(name)
18226                 if (linelen > 70) {
18227                         printf "\n"
18228                         linelen = length(name)
18229                 }
18230                 printf "%s", name
18231         }
18232         printf "\n"
18233 }'
18234 sig_size=`echo $sig_name | awk '{print NF}'`
18235 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18236
18237 echo " "
18238 case "$sizetype" in
18239 *_t) zzz="$sizetype"    ;;
18240 *)   zzz="filesize"     ;;
18241 esac
18242 echo "Checking the size of $zzz..." >&4 
18243 cat > try.c <<EOCP
18244 #include <sys/types.h>
18245 #include <stdio.h>
18246 int main() {
18247     printf("%d\n", (int)sizeof($sizetype));
18248     exit(0);
18249 }
18250 EOCP
18251 set try
18252 if eval $compile_ok; then
18253         yyy=`$run ./try`
18254         case "$yyy" in
18255         '')     sizesize=4
18256                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18257                 ;;
18258         *)      sizesize=$yyy
18259                 echo "Your $zzz size is $sizesize bytes."
18260                 ;;
18261         esac
18262 else
18263         sizesize=4
18264         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18265 fi
18266
18267
18268 : check for socklen_t
18269 echo " "
18270 echo "Checking to see if you have socklen_t..." >&4
18271 $cat >try.c <<EOCP
18272 #include <sys/types.h>
18273 #$d_socket HAS_SOCKET
18274 #ifdef HAS_SOCKET
18275 #include <sys/socket.h>
18276 #endif
18277 int main() { socklen_t x = 16; }
18278 EOCP
18279 set try
18280 if eval $compile; then
18281         val="$define"
18282         echo "You have socklen_t."
18283 else
18284         val="$undef"
18285         echo "You do not have socklen_t."
18286         case "$sizetype" in
18287         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18288         esac
18289 fi
18290 $rm -f try try.*
18291 set d_socklen_t
18292 eval $setvar
18293
18294 : see if this is a socks.h system
18295 set socks.h i_socks
18296 eval $inhdr
18297
18298 : check for type of the size argument to socket calls
18299 case "$d_socket" in
18300 "$define")
18301         $cat <<EOM
18302
18303 Checking to see what type is the last argument of accept().
18304 EOM
18305         yyy=''
18306         case "$d_socklen_t" in
18307         "$define") yyy="$yyy socklen_t"
18308         esac
18309         yyy="$yyy $sizetype int long unsigned"
18310         for xxx in $yyy; do
18311                 case "$socksizetype" in
18312                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18313                         case "$usesocks" in
18314                         "$define")
18315                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18316                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18317                                         socksizetype="$xxx"
18318                                 fi
18319                                 ;;
18320                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18321                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18322                                         socksizetype="$xxx"
18323                                 fi
18324                                 ;;
18325                         esac
18326                         ;;
18327                 esac
18328         done
18329 : In case none of those worked, prompt the user.
18330         case "$socksizetype" in
18331         '')     rp='What is the type for socket address structure sizes?'
18332                 dflt='int'
18333                 . ./myread
18334                 socksizetype=$ans
18335                 ;;
18336         esac
18337         ;;
18338 *)      : no sockets, so pick relatively harmless default
18339         socksizetype='int'
18340         ;;
18341 esac
18342
18343 : see what type is used for signed size_t
18344 set ssize_t ssizetype int stdio.h sys/types.h
18345 eval $typedef
18346 dflt="$ssizetype"
18347 $cat > try.c <<EOM
18348 #include <stdio.h>
18349 #include <sys/types.h>
18350 #define Size_t $sizetype
18351 #define SSize_t $dflt
18352 int main()
18353 {
18354         if (sizeof(Size_t) == sizeof(SSize_t))
18355                 printf("$dflt\n");
18356         else if (sizeof(Size_t) == sizeof(int))
18357                 printf("int\n");
18358         else 
18359                 printf("long\n");
18360         exit(0);
18361 }
18362 EOM
18363 echo " "
18364 set try
18365 if eval $compile_ok && $run ./try > /dev/null; then
18366         ssizetype=`$run ./try`
18367         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18368 else
18369         $cat >&4 <<EOM
18370 Help! I can't compile and run the ssize_t test program: please enlighten me!
18371 (This is probably a misconfiguration in your system or libraries, and
18372 you really ought to fix it.  Still, I'll try anyway.)
18373
18374 I need a type that is the same size as $sizetype, but is guaranteed to
18375 be signed.  Common values are ssize_t, int and long.
18376
18377 EOM
18378         rp="What signed type is the same size as $sizetype?"
18379         . ./myread
18380         ssizetype="$ans"
18381 fi
18382 $rm -f try try.*
18383
18384 : see what type of char stdio uses.
18385 echo " "
18386 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18387 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18388         echo "Your stdio uses unsigned chars." >&4
18389         stdchar="unsigned char"
18390 else
18391         echo "Your stdio uses signed chars." >&4
18392         stdchar="char"
18393 fi
18394 $rm -f stdioh
18395
18396
18397
18398 : see if time exists
18399 echo " "
18400 if test "X$d_time" = X -o X"$timetype" = X; then
18401     if set time val -f d_time; eval $csym; $val; then
18402                 echo 'time() found.' >&4
18403                 val="$define"
18404                 rp="What is the type returned by time() on this system?"
18405                 set time_t timetype long stdio.h sys/types.h
18406                 eval $typedef_ask
18407     else
18408                 echo 'time() not found, hope that will do.' >&4
18409                 val="$undef"
18410                 timetype='int';
18411     fi
18412     set d_time
18413     eval $setvar
18414 fi
18415
18416 : see what type uids are declared as in the kernel
18417 echo " "
18418 echo "Looking for the type for user ids returned by getuid()."
18419 set uid_t uidtype xxx stdio.h sys/types.h
18420 eval $typedef
18421 case "$uidtype" in
18422 xxx)
18423         xxx=`./findhdr sys/user.h`
18424         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18425         case $1 in
18426         unsigned) dflt="$1 $2" ;;
18427         *) dflt="$1" ;;
18428         esac
18429         ;;
18430 *) dflt="$uidtype";;
18431 esac
18432 case "$uidtype" in
18433 uid_t)  echo "uid_t found." ;;
18434 *)      rp="What is the type for user ids returned by getuid()?"
18435         . ./myread
18436         uidtype="$ans"
18437         ;;
18438 esac
18439
18440 echo " "
18441 case "$uidtype" in
18442 *_t) zzz="$uidtype"     ;;
18443 *)   zzz="uid"          ;;
18444 esac
18445 echo "Checking the size of $zzz..." >&4 
18446 cat > try.c <<EOCP
18447 #include <sys/types.h>
18448 #include <stdio.h>
18449 int main() {
18450     printf("%d\n", (int)sizeof($uidtype));
18451     exit(0);
18452 }
18453 EOCP
18454 set try
18455 if eval $compile_ok; then
18456         yyy=`$run ./try`
18457         case "$yyy" in
18458         '')     uidsize=4
18459                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18460                 ;;
18461         *)      uidsize=$yyy
18462                 echo "Your $zzz is $uidsize bytes long."
18463                 ;;
18464         esac
18465 else
18466         uidsize=4
18467         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18468 fi
18469
18470 echo " "
18471 case "$uidtype" in
18472 *_t) zzz="$uidtype"     ;;
18473 *)   zzz="uid"          ;;
18474 esac
18475 echo "Checking the sign of $zzz..." >&4
18476 cat > try.c <<EOCP
18477 #include <sys/types.h>
18478 #include <stdio.h>
18479 int main() {
18480         $uidtype foo = -1;
18481         if (foo < 0)
18482                 printf("-1\n");
18483         else
18484                 printf("1\n");
18485 }
18486 EOCP
18487 set try
18488 if eval $compile; then
18489         yyy=`$run ./try`
18490         case "$yyy" in
18491         '')     uidsign=1
18492                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18493                 ;;
18494         *)      uidsign=$yyy
18495                 case "$uidsign" in
18496                  1) echo "Your $zzz is unsigned." ;;
18497                 -1) echo "Your $zzz is signed."   ;;
18498                 esac
18499                 ;;
18500         esac
18501 else
18502         uidsign=1
18503         echo "(I can't compile the test program--guessing unsigned.)" >&4
18504 fi
18505
18506
18507
18508 echo " "
18509 $echo "Checking the format string to be used for uids..." >&4
18510
18511 case "$uidsign" in
18512 -1)     if $test X"$uidsize" = X"$ivsize"; then
18513                 uidformat="$ivdformat"
18514         else
18515                 if $test X"$uidsize" = X"$longsize"; then
18516                         uidformat='"ld"'
18517                 else
18518                         if $test X"$uidsize" = X"$intsize"; then
18519                                 uidformat='"d"'
18520                         else
18521                                 if $test X"$uidsize" = X"$shortsize"; then
18522                                         uidformat='"hd"'
18523                                 fi
18524                         fi
18525                 fi
18526         fi
18527         ;;
18528 *)      if $test X"$uidsize" = X"$uvsize"; then
18529                 uidformat="$uvuformat"
18530         else
18531                 if $test X"$uidsize" = X"$longsize"; then
18532                         uidformat='"lu"'
18533                 else
18534                         if $test X"$uidsize" = X"$intsize"; then
18535                                 uidformat='"u"'
18536                         else
18537                                 if $test X"$uidsize" = X"$shortsize"; then
18538                                         uidformat='"hu"'
18539                                 fi
18540                         fi
18541                 fi
18542         fi
18543         ;;
18544 esac
18545
18546 : determine compiler compiler
18547 case "$yacc" in
18548 '')
18549         dflt=yacc;;
18550 *)
18551         dflt="$yacc";;
18552 esac
18553 echo " "
18554 comp='yacc'
18555 if $test -f "$byacc$_exe"; then
18556         dflt="$byacc"
18557         comp="byacc or $comp"
18558 fi
18559 if $test -f "$bison$_exe"; then
18560         comp="$comp or bison -y"
18561 fi
18562 rp="Which compiler compiler ($comp) shall I use?"
18563 . ./myread
18564 yacc="$ans"
18565 case "$yacc" in
18566 *bis*)
18567         case "$yacc" in
18568         *-y*) ;;
18569         *)
18570                 yacc="$yacc -y"
18571                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18572                 ;;
18573         esac
18574         ;;
18575 esac
18576
18577 : see if this is a fp.h system
18578 set fp.h i_fp
18579 eval $inhdr
18580
18581 : see if this is a fp_class.h system
18582 set fp_class.h i_fp_class
18583 eval $inhdr
18584
18585 : see if this is a ieeefp.h system
18586 case "$i_ieeefp" in
18587 '' ) set ieeefp.h i_ieeefp
18588      eval $inhdr
18589      ;;
18590 esac
18591
18592 : see if this is a libutil.h system
18593 set libutil.h i_libutil
18594 eval $inhdr
18595
18596 : see if mach cthreads are available
18597 if test "X$usethreads" = "X$define"; then
18598         set mach/cthreads.h i_machcthr
18599         eval $inhdr
18600 else
18601         i_machcthr="$undef"
18602 fi
18603
18604
18605
18606 : see if this is a math.h system
18607 set math.h i_math
18608 eval $inhdr
18609
18610 : see if this is a mntent.h system
18611 set mntent.h i_mntent
18612 eval $inhdr
18613
18614 : see if ndbm.h is available
18615 set ndbm.h t_ndbm
18616 eval $inhdr
18617
18618 case "$t_ndbm" in
18619 $undef)
18620     # Some Linux distributions such as RedHat 7.1 put the
18621     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18622     if $test -f /usr/include/gdbm/ndbm.h; then
18623         echo '<gdbm/ndbm.h> found.'
18624         ccflags="$ccflags -I/usr/include/gdbm"
18625         cppflags="$cppflags -I/usr/include/gdbm"
18626         t_ndbm=$define
18627     fi
18628     ;;
18629 esac
18630
18631 case "$t_ndbm" in
18632 $define)
18633         : see if dbm_open exists
18634         set dbm_open d_dbm_open
18635         eval $inlibc
18636         case "$d_dbm_open" in
18637         $undef)
18638                 t_ndbm="$undef"
18639                 echo "We won't be including <ndbm.h>"
18640                 ;;
18641         esac
18642         ;;
18643 esac
18644 val="$t_ndbm"
18645 set i_ndbm
18646 eval $setvar
18647
18648 : see if net/errno.h is available
18649 val=''
18650 set net/errno.h val
18651 eval $inhdr
18652
18653 : Unfortunately, it causes problems on some systems.  Arrgh.
18654 case "$val" in
18655 $define)
18656         cat > try.c <<'EOM'
18657 #include <stdio.h>
18658 #include <errno.h>
18659 #include <net/errno.h>
18660 int func()
18661 {
18662         return ENOTSOCK;
18663 }
18664 EOM
18665         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18666                 echo "We'll be including <net/errno.h>." >&4
18667         else
18668                 echo "We won't be including <net/errno.h>." >&4
18669                 val="$undef"
18670         fi
18671         $rm -f try.* try
18672         ;;
18673 esac
18674 set i_neterrno
18675 eval $setvar
18676
18677 : see if netinet/tcp.h is available
18678 set netinet/tcp.h i_netinettcp
18679 eval $inhdr
18680
18681 : see if this is a poll.h system
18682 set poll.h i_poll
18683 eval $inhdr
18684
18685 : see if this is a prot.h system
18686 set prot.h i_prot
18687 eval $inhdr
18688
18689 echo " "
18690 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18691 $cat <<'EOSH' > Cppsym.know
18692 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18693 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18694 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18695 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18696 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18697 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18698 bull c cadmus clipper CMU COFF COMPILER_VERSION
18699 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18700 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18701 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18702 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18703 GLIBC GLIBC_MINOR
18704 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18705 H3050R H3050RX hbullx20 hcx host_mips
18706 hp200 hp300 hp700 HP700 hp800 hp9000
18707 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18708 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18709 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18710 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18711 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18712 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18713 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18714 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18715 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18716 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18717 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18718 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18719 MATH_HAS_NO_SIDE_EFFECTS
18720 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18721 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18722 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18723 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18724 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18725 NetBSD news1500 news1700 news1800 news1900 news3700
18726 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18727 ns32016 ns32332 ns32k nsc32000
18728 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18729 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18730 pc532 pdp11 PGC PIC plexus PORTAR posix
18731 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18732 POSIX_C_SOURCE POSIX_SOURCE POWER
18733 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18734 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18735 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18736 sony sony_news sonyrisc sparc sparclite spectrum
18737 stardent stdc STDC_EXT stratos sun sun3 sun386
18738 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18739 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18740 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18741 sysV68 sysV88 Tek4132 Tek4300 titan
18742 TM3200 TM5400 TM5600
18743 tower tower32 tower32_200 tower32_600 tower32_700
18744 tower32_800 tower32_850 tss
18745 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18746 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18747 unix UNIX95 UNIX99 unixpc unos
18748 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18749 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18750 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18751 USGr4 USGr4_2
18752 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18753 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18754 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18755 z8000
18756 EOSH
18757 # Maybe put other stuff here too.
18758 cat <<EOSH >>Cppsym.know
18759 $osname
18760 EOSH
18761 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18762 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18763 $cat Cppsym.know > Cppsym.c
18764 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18765 $rm -f Cppsym.a Cppsym.b Cppsym.c
18766 cat <<EOSH > Cppsym
18767 $startsh
18768 if $test \$# -gt 0; then
18769     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18770     if $test -s Cppsym.got; then
18771         $rm -f Cppsym.got
18772         exit 0
18773     fi
18774     $rm -f Cppsym.got
18775     exit 1
18776 else
18777     $tr " " "$trnl" | ./Cppsym.try
18778     exit 0
18779 fi
18780 EOSH
18781 chmod +x Cppsym
18782 $eunicefix Cppsym
18783 cat <<EOSH > Cppsym.try
18784 $startsh
18785 cat <<'EOCP' > try.c
18786 #include <stdio.h>
18787 int main() {
18788 EOCP
18789 $awk \\
18790 EOSH
18791 cat <<'EOSH' >> Cppsym.try
18792 'length($1) > 0 {
18793     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
18794     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
18795     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
18796     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
18797 }'       >> try.c
18798 echo 'return 0;}' >> try.c
18799 EOSH
18800 cat <<EOSH >> Cppsym.try
18801 ccflags="$ccflags"
18802 case "$osname-$gccversion" in
18803 irix-) ccflags="\$ccflags -woff 1178" ;;
18804 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18805 esac
18806 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18807 EOSH
18808 chmod +x Cppsym.try
18809 $eunicefix Cppsym.try
18810 ./Cppsym < Cppsym.know > Cppsym.true
18811 : now check the C compiler for additional symbols
18812 postprocess_cc_v=''
18813 case "$osname" in
18814 aix) postprocess_cc_v="|$tr , ' '" ;;
18815 esac
18816 $cat >ccsym <<EOS
18817 $startsh
18818 $cat >tmp.c <<EOF
18819 extern int foo;
18820 EOF
18821 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18822 do
18823         case "\$i" in
18824         -D*) echo "\$i" | $sed 's/^-D//';;
18825         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
18826         esac
18827 done
18828 $rm -f try.c
18829 EOS
18830 postprocess_cc_v=''
18831 chmod +x ccsym
18832 $eunicefix ccsym
18833 ./ccsym > ccsym1.raw
18834 if $test -s ccsym1.raw; then
18835        $sort ccsym1.raw | $uniq >ccsym.raw
18836 else
18837        mv ccsym1.raw ccsym.raw
18838 fi
18839
18840 $awk '/\=/ { print $0; next }
18841         { print $0"=1" }' ccsym.raw >ccsym.list
18842 $awk '/\=/ { print $0; next }
18843         { print $0"=1" }' Cppsym.true >ccsym.true
18844 $comm -13 ccsym.true ccsym.list >ccsym.own
18845 $comm -12 ccsym.true ccsym.list >ccsym.com
18846 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18847 also=''
18848 if $test -z ccsym.raw; then
18849         echo "Your C compiler doesn't seem to define any symbols!" >&4
18850         echo " "
18851         echo "However, your C preprocessor defines the following symbols:"
18852         $cat Cppsym.true
18853         ccsymbols=''
18854         cppsymbols=`$cat Cppsym.true`
18855         cppsymbols=`echo $cppsymbols`
18856         cppccsymbols="$cppsymbols"
18857 else
18858         if $test -s ccsym.com; then
18859                 echo "Your C compiler and pre-processor define these symbols:"
18860                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18861                 also='also '
18862                 symbols='ones'
18863                 cppccsymbols=`$cat ccsym.com`
18864                 cppccsymbols=`echo $cppccsymbols`
18865                 $test "$silent" || sleep 1
18866         fi
18867         if $test -s ccsym.cpp; then
18868                 $test "$also" && echo " "
18869                 echo "Your C pre-processor ${also}defines the following symbols:"
18870                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18871                 also='further '
18872                 cppsymbols=`$cat ccsym.cpp`
18873                 cppsymbols=`echo $cppsymbols`
18874                 $test "$silent" || sleep 1
18875         fi
18876         if $test -s ccsym.own; then
18877                 $test "$also" && echo " "
18878                 echo "Your C compiler ${also}defines the following cpp symbols:"
18879                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18880                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18881                 ccsymbols=`$cat ccsym.own`
18882                 ccsymbols=`echo $ccsymbols`
18883                 $test "$silent" || sleep 1
18884         fi
18885 fi
18886
18887 : see if this is a termio system
18888 val="$undef"
18889 val2="$undef"
18890 val3="$undef"
18891 if $test `./findhdr termios.h`; then
18892         set tcsetattr i_termios
18893         eval $inlibc
18894         val3="$i_termios"
18895 fi
18896 echo " "
18897 case "$val3" in
18898 "$define") echo "You have POSIX termios.h... good!" >&4;;
18899 *) if ./Cppsym pyr; then
18900                 case "`/bin/universe`" in
18901                 ucb) if $test `./findhdr sgtty.h`; then
18902                                 val2="$define"
18903                                 echo "<sgtty.h> found." >&4
18904                         else
18905                                 echo "System is pyramid with BSD universe."
18906                                 echo "<sgtty.h> not found--you could have problems." >&4
18907                         fi;;
18908                 *) if $test `./findhdr termio.h`; then
18909                                 val="$define"
18910                                 echo "<termio.h> found." >&4
18911                         else
18912                                 echo "System is pyramid with USG universe."
18913                                 echo "<termio.h> not found--you could have problems." >&4
18914                         fi;;
18915                 esac
18916         elif ./usg; then
18917                 if $test `./findhdr termio.h`; then
18918                         echo "<termio.h> found." >&4
18919                         val="$define"
18920                 elif $test `./findhdr sgtty.h`; then
18921                         echo "<sgtty.h> found." >&4
18922                         val2="$define"
18923                 else
18924 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
18925                 fi
18926         else
18927                 if $test `./findhdr sgtty.h`; then
18928                         echo "<sgtty.h> found." >&4
18929                         val2="$define"
18930                 elif $test `./findhdr termio.h`; then
18931                         echo "<termio.h> found." >&4
18932                         val="$define"
18933                 else
18934 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
18935                 fi
18936         fi;;
18937 esac
18938 set i_termio; eval $setvar
18939 val=$val2; set i_sgtty; eval $setvar
18940 val=$val3; set i_termios; eval $setvar
18941
18942 : see if stddef is available
18943 set stddef.h i_stddef
18944 eval $inhdr
18945
18946 : see if this is a sunmath.h system
18947 set sunmath.h i_sunmath
18948 eval $inhdr
18949
18950 : see if sys/access.h is available
18951 set sys/access.h i_sysaccess
18952 eval $inhdr
18953
18954 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
18955 set sys/filio.h i_sysfilio
18956 eval $inhdr
18957 echo " "
18958 if $test `./findhdr sys/ioctl.h`; then
18959         val="$define"
18960         echo '<sys/ioctl.h> found.' >&4
18961 else
18962         val="$undef"
18963         if $test $i_sysfilio = "$define"; then
18964             echo '<sys/ioctl.h> NOT found.' >&4
18965         else
18966                 $test $i_sgtty = "$define" && xxx="sgtty.h"
18967                 $test $i_termio = "$define" && xxx="termio.h"
18968                 $test $i_termios = "$define" && xxx="termios.h"
18969 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
18970         fi
18971 fi
18972 set i_sysioctl
18973 eval $setvar
18974
18975 : see if socket ioctl defs are in sys/sockio.h
18976 echo " "
18977 xxx=`./findhdr sys/sockio.h`
18978 if $test "$xxx"; then
18979         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
18980                 val="$define"
18981                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
18982         else
18983                 val="$undef"
18984                 echo "No socket ioctls found in <sys/sockio.h>." >&4
18985         fi
18986 else
18987         val="$undef"
18988         $cat <<EOM
18989 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
18990 EOM
18991 fi
18992 set i_syssockio
18993 eval $setvar
18994
18995
18996 : see if this is a syslog.h system
18997 set syslog.h i_syslog
18998 eval $inhdr
18999
19000
19001 : see if this is a sys/mode.h system
19002 set sys/mode.h i_sysmode
19003 eval $inhdr
19004
19005 : see if sys/resource.h has to be included
19006 set sys/resource.h i_sysresrc
19007 eval $inhdr
19008
19009 : see if sys/security.h is available
19010 set sys/security.h i_syssecrt
19011 eval $inhdr
19012
19013 : see if this is a sys/statvfs.h system
19014 set sys/statvfs.h i_sysstatvfs
19015 eval $inhdr
19016
19017 : see if this is a sys/un.h system
19018 set sys/un.h i_sysun
19019 eval $inhdr
19020
19021
19022 : see if this is a sys/utsname.h system
19023 set sys/utsname.h i_sysutsname
19024 eval $inhdr
19025
19026 : see if this is a syswait system
19027 set sys/wait.h i_syswait
19028 eval $inhdr
19029
19030 : see if this is a ustat.h system
19031 set ustat.h i_ustat
19032 eval $inhdr
19033
19034 : see if this is an utime system
19035 set utime.h i_utime
19036 eval $inhdr
19037
19038 : see if this is a values.h system
19039 set values.h i_values
19040 eval $inhdr
19041
19042 : see if this is a vfork system
19043 case "$d_vfork" in
19044 "$define")
19045         set vfork.h i_vfork
19046         eval $inhdr
19047         ;;
19048 *)
19049         i_vfork="$undef"
19050         ;;
19051 esac
19052
19053 : see if gdbm.h is available
19054 set gdbm.h t_gdbm
19055 eval $inhdr
19056 case "$t_gdbm" in
19057 $define)
19058         : see if gdbm_open exists
19059         set gdbm_open d_gdbm_open
19060         eval $inlibc
19061         case "$d_gdbm_open" in
19062         $undef)
19063                 t_gdbm="$undef"
19064                 echo "We won't be including <gdbm.h>"
19065                 ;;
19066         esac
19067         ;;
19068 esac
19069 val="$t_gdbm"
19070 set i_gdbm
19071 eval $setvar
19072
19073 echo " "
19074 echo "Looking for extensions..." >&4
19075 : If we are using the old config.sh, known_extensions may contain
19076 : old or inaccurate or duplicate values.
19077 known_extensions=''
19078 nonxs_extensions=''
19079 : We do not use find because it might not be available.
19080 : We do not just use MANIFEST because the user may have dropped
19081 : some additional extensions into the source tree and expect them
19082 : to be built.
19083
19084 : Function to recursively find available extensions, ignoring DynaLoader
19085 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19086 find_extensions='
19087     for xxx in *; do
19088        case "$xxx" in
19089            DynaLoader|dynaload) ;;
19090            *)
19091            if $test -f $xxx/$xxx.xs; then
19092                known_extensions="$known_extensions $1$xxx";
19093            elif $test -f $xxx/Makefile.PL; then
19094                nonxs_extensions="$nonxs_extensions $1$xxx";
19095            else
19096                if $test -d $xxx -a $# -lt 10; then
19097                    set $1$xxx/ $*;
19098                    cd "$xxx";
19099                    eval $find_extensions;
19100                    cd ..;
19101                    shift;
19102                fi;
19103            fi
19104            ;;
19105        esac;
19106     done'
19107 tdir=`pwd`
19108 cd "$rsrc/ext"
19109 set X
19110 shift
19111 eval $find_extensions
19112 # Special case:  Add in threads/shared since it is not picked up by the
19113 # recursive find above (and adding in general recursive finding breaks
19114 # SDBM_File/sdbm).  A.D.  10/25/2001.
19115 # Encode::XX need explicit mentions for the same reason.
19116 # --jhi 2002-03-04
19117 known_extensions="$known_extensions threads/shared Encode/CN Encode/JP Encode/KR Encode/TW"
19118 set X $nonxs_extensions
19119 shift
19120 nonxs_extensions="$*"
19121 set X $known_extensions
19122 shift
19123 known_extensions="$*"
19124 cd "$tdir"
19125
19126 : Now see which are supported on this system.
19127 avail_ext=''
19128 for xxx in $known_extensions ; do
19129         case "$xxx" in
19130         DB_File|db_file)
19131                 case "$i_db" in
19132                 $define) avail_ext="$avail_ext $xxx" ;;
19133                 esac
19134                 ;;
19135         GDBM_File|gdbm_fil)
19136                 case "$i_gdbm" in 
19137                 $define) avail_ext="$avail_ext $xxx" ;;
19138                 esac
19139                 ;;
19140         I18N/Langinfo|i18n_lan)
19141                 case "$i_langinfo$d_nl_langinfo" in 
19142                 $define$define) avail_ext="$avail_ext $xxx" ;;
19143                 esac
19144                 ;;
19145         NDBM_File|ndbm_fil)
19146                 case "$i_ndbm" in
19147                 $define)
19148                     case "$osname-$use64bitint" in
19149                     cygwin-*|hpux-define)
19150                         case "$libs" in
19151                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19152                         esac
19153                         ;;
19154                     *) avail_ext="$avail_ext $xxx" ;;
19155                     esac
19156                     ;;
19157                 esac
19158                 ;;
19159         ODBM_File|odbm_fil) 
19160                 case "${i_dbm}${i_rpcsvcdbm}" in
19161                 *"${define}"*)
19162                     case "$osname-$use64bitint" in
19163                     cygwin-*|hpux-define)
19164                         case "$libs" in
19165                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19166                         esac
19167                         ;;
19168                     *) avail_ext="$avail_ext $xxx" ;;
19169                     esac
19170                     ;;
19171                 esac
19172                 ;;
19173         POSIX|posix)
19174                 case "$useposix" in
19175                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19176                 esac
19177                 ;;
19178         Opcode|opcode)
19179                 case "$useopcode" in
19180                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19181                 esac
19182                 ;;
19183         Socket|socket)
19184                 case "$d_socket" in 
19185                 true|$define|y)
19186                     case "$osname" in
19187                     beos) ;; # not unless BONE
19188                     *) avail_ext="$avail_ext $xxx" ;;
19189                     esac
19190                     ;;
19191                 esac
19192                 ;;
19193         Sys/Syslog|sys/syslog)
19194                 : XXX syslog requires socket
19195                 case "$d_socket" in 
19196                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19197                 esac
19198                 ;;
19199         Thread|thread)
19200                 case "$usethreads" in
19201                 true|$define|y)
19202                         case "$useithreads" in
19203                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19204                         esac
19205                 esac
19206                 ;;
19207         threads|threads/shared)
19208                 case "$usethreads" in
19209                 true|$define|y)
19210                         case "$useithreads" in
19211                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
19212                         esac
19213                 esac
19214                 ;;
19215         IPC/SysV|ipc/sysv)
19216                 : XXX Do we need a useipcsysv variable here
19217                 case "${d_msg}${d_sem}${d_shm}" in 
19218                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19219                 esac
19220                 ;;
19221         *)      avail_ext="$avail_ext $xxx"
19222                 ;;
19223         esac
19224 done
19225
19226 set X $avail_ext
19227 shift
19228 avail_ext="$*"
19229
19230 : Now see which nonxs extensions are supported on this system.
19231 : For now assume all are.
19232 nonxs_ext=''
19233 for xxx in $nonxs_extensions ; do
19234         case "$xxx" in
19235         *)      nonxs_ext="$nonxs_ext $xxx"
19236                 ;;
19237         esac
19238 done
19239
19240 set X $nonxs_ext
19241 shift
19242 nonxs_ext="$*"
19243
19244 case $usedl in
19245 $define)
19246         $cat <<EOM
19247 A number of extensions are supplied with $package.  You may choose to
19248 compile these extensions for dynamic loading (the default), compile
19249 them into the $package executable (static loading), or not include
19250 them at all.  Answer "none" to include no extensions.
19251 Note that DynaLoader is always built and need not be mentioned here.
19252
19253 EOM
19254         case "$dynamic_ext" in
19255         '') dflt="$avail_ext" ;;
19256         *)      dflt="$dynamic_ext"
19257                 # Perhaps we are reusing an old out-of-date config.sh.
19258                 case "$hint" in
19259                 previous)
19260                         if test X"$dynamic_ext" != X"$avail_ext"; then
19261                                 $cat <<EOM
19262 NOTICE:  Your previous config.sh list may be incorrect. 
19263 The extensions now available to you are 
19264         ${avail_ext}
19265 but the default list from your previous config.sh is
19266         ${dynamic_ext} 
19267
19268 EOM
19269                         fi
19270                         ;;
19271                 esac
19272                 ;;
19273         esac
19274         case "$dflt" in
19275         '')     dflt=none;;
19276         esac
19277         rp="What extensions do you wish to load dynamically?"
19278         . ./myread
19279         case "$ans" in
19280         none) dynamic_ext=' ' ;;
19281         *) dynamic_ext="$ans" ;;
19282         esac
19283
19284         case "$static_ext" in
19285         '')
19286                 : Exclude those already listed in dynamic linking
19287                 dflt=''
19288                 for xxx in $avail_ext; do
19289                         case " $dynamic_ext " in
19290                         *" $xxx "*) ;;
19291                         *) dflt="$dflt $xxx" ;;
19292                         esac
19293                 done
19294                 set X $dflt
19295                 shift
19296                 dflt="$*"
19297                 ;;
19298         *)  dflt="$static_ext" 
19299                 ;;
19300         esac
19301
19302         case "$dflt" in
19303         '')     dflt=none;;
19304         esac
19305         rp="What extensions do you wish to load statically?"
19306         . ./myread
19307         case "$ans" in
19308         none) static_ext=' ' ;;
19309         *) static_ext="$ans" ;;
19310         esac
19311         ;;
19312 *)
19313         $cat <<EOM
19314 A number of extensions are supplied with $package.  Answer "none" 
19315 to include no extensions. 
19316 Note that DynaLoader is always built and need not be mentioned here.
19317
19318 EOM
19319         case "$static_ext" in
19320         '') dflt="$avail_ext" ;;
19321         *)      dflt="$static_ext"
19322                 # Perhaps we are reusing an old out-of-date config.sh.
19323                 case "$hint" in
19324                 previous)
19325                         if test X"$static_ext" != X"$avail_ext"; then
19326                                 $cat <<EOM
19327 NOTICE:  Your previous config.sh list may be incorrect. 
19328 The extensions now available to you are 
19329         ${avail_ext}
19330 but the default list from your previous config.sh is
19331         ${static_ext} 
19332
19333 EOM
19334                         fi
19335                         ;;
19336                 esac
19337                 ;;
19338         esac
19339         : Exclude those that are not xs extensions
19340         case "$dflt" in
19341         '')     dflt=none;;
19342         esac
19343         rp="What extensions do you wish to include?"
19344         . ./myread
19345         case "$ans" in
19346         none) static_ext=' ' ;;
19347         *) static_ext="$ans" ;;
19348         esac
19349         ;;
19350 esac
19351
19352 set X $dynamic_ext $static_ext $nonxs_ext
19353 shift
19354 extensions="$*"
19355
19356 : Remove libraries needed only for extensions
19357 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19358 : The exception is SunOS 4.x, which needs them.
19359 case "${osname}X${osvers}" in
19360 sunos*X4*)
19361     perllibs="$libs"
19362     ;;
19363 *) case "$usedl" in
19364     $define|true|[yY]*)
19365             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19366             shift
19367             perllibs="$*"
19368             ;;
19369     *)  perllibs="$libs"
19370             ;;
19371     esac
19372     ;;
19373 esac
19374
19375 : Remove build directory name from cppstdin so it can be used from
19376 : either the present location or the final installed location.
19377 echo " "
19378 : Get out of the UU directory to get correct path name.
19379 cd ..
19380 case "$cppstdin" in
19381 `pwd`/cppstdin)
19382         echo "Stripping down cppstdin path name"
19383         cppstdin=cppstdin
19384         ;;
19385 esac
19386 cd UU
19387
19388 : end of configuration questions
19389 echo " "
19390 echo "End of configuration questions."
19391 echo " "
19392
19393 : back to where it started
19394 if test -d ../UU; then
19395         cd ..
19396 fi
19397
19398 : configuration may be patched via a 'config.arch' file
19399 if $test -f config.arch; then
19400         echo "I see a config.arch file, loading it."
19401         . ./config.arch
19402 fi
19403
19404 : configuration may be patched via a 'config.over' file
19405 if $test -f config.over; then
19406         echo " "
19407         dflt=y
19408         rp='I see a config.over file.  Do you wish to load it?'
19409         . UU/myread
19410         case "$ans" in
19411         n*) echo "OK, I'll ignore it.";;
19412         *)      . ./config.over
19413                 echo "Configuration override changes have been loaded."
19414                 ;;
19415         esac
19416 fi
19417
19418 : in case they want portability, strip down executable paths
19419 case "$d_portable" in
19420 "$define")
19421         echo " "
19422         echo "Stripping down executable paths..." >&4
19423         for file in $loclist $trylist; do
19424                 eval temp=\$$file
19425                 eval $file=`basename $temp`
19426         done
19427         ;;
19428 esac
19429
19430 : create config.sh file
19431 echo " "
19432 echo "Creating config.sh..." >&4
19433 $spitshell <<EOT >config.sh
19434 $startsh
19435 #
19436 # This file was produced by running the Configure script. It holds all the
19437 # definitions figured out by Configure. Should you modify one of these values,
19438 # do not forget to propagate your changes by running "Configure -der". You may
19439 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19440 #
19441
19442 # Package name      : $package
19443 # Source directory  : $src
19444 # Configuration time: $cf_time
19445 # Configured by     : $cf_by
19446 # Target system     : $myuname
19447
19448 Author='$Author'
19449 Date='$Date'
19450 Header='$Header'
19451 Id='$Id'
19452 Locker='$Locker'
19453 Log='$Log'
19454 Mcc='$Mcc'
19455 RCSfile='$RCSfile'
19456 Revision='$Revision'
19457 Source='$Source'
19458 State='$State'
19459 _a='$_a'
19460 _exe='$_exe'
19461 _o='$_o'
19462 afs='$afs'
19463 afsroot='$afsroot'
19464 alignbytes='$alignbytes'
19465 ansi2knr='$ansi2knr'
19466 aphostname='$aphostname'
19467 api_revision='$api_revision'
19468 api_subversion='$api_subversion'
19469 api_version='$api_version'
19470 api_versionstring='$api_versionstring'
19471 ar='$ar'
19472 archlib='$archlib'
19473 archlibexp='$archlibexp'
19474 archname64='$archname64'
19475 archname='$archname'
19476 archobjs='$archobjs'
19477 asctime_r_proto='$asctime_r_proto'
19478 awk='$awk'
19479 baserev='$baserev'
19480 bash='$bash'
19481 bin='$bin'
19482 bincompat5005='$bincompat5005'
19483 binexp='$binexp'
19484 bison='$bison'
19485 byacc='$byacc'
19486 byteorder='$byteorder'
19487 c='$c'
19488 castflags='$castflags'
19489 cat='$cat'
19490 cc='$cc'
19491 cccdlflags='$cccdlflags'
19492 ccdlflags='$ccdlflags'
19493 ccflags='$ccflags'
19494 ccflags_uselargefiles='$ccflags_uselargefiles'
19495 ccname='$ccname'
19496 ccsymbols='$ccsymbols'
19497 ccversion='$ccversion'
19498 cf_by='$cf_by'
19499 cf_email='$cf_email'
19500 cf_time='$cf_time'
19501 charsize='$charsize'
19502 chgrp='$chgrp'
19503 chmod='$chmod'
19504 chown='$chown'
19505 clocktype='$clocktype'
19506 comm='$comm'
19507 compress='$compress'
19508 contains='$contains'
19509 cp='$cp'
19510 cpio='$cpio'
19511 cpp='$cpp'
19512 cpp_stuff='$cpp_stuff'
19513 cppccsymbols='$cppccsymbols'
19514 cppflags='$cppflags'
19515 cpplast='$cpplast'
19516 cppminus='$cppminus'
19517 cpprun='$cpprun'
19518 cppstdin='$cppstdin'
19519 cppsymbols='$cppsymbols'
19520 crypt_r_proto='$crypt_r_proto'
19521 cryptlib='$cryptlib'
19522 csh='$csh'
19523 ctermid_r_proto='$ctermid_r_proto'
19524 ctime_r_proto='$ctime_r_proto'
19525 d_Gconvert='$d_Gconvert'
19526 d_PRIEUldbl='$d_PRIEUldbl'
19527 d_PRIFUldbl='$d_PRIFUldbl'
19528 d_PRIGUldbl='$d_PRIGUldbl'
19529 d_PRIXU64='$d_PRIXU64'
19530 d_PRId64='$d_PRId64'
19531 d_PRIeldbl='$d_PRIeldbl'
19532 d_PRIfldbl='$d_PRIfldbl'
19533 d_PRIgldbl='$d_PRIgldbl'
19534 d_PRIi64='$d_PRIi64'
19535 d_PRIo64='$d_PRIo64'
19536 d_PRIu64='$d_PRIu64'
19537 d_PRIx64='$d_PRIx64'
19538 d_SCNfldbl='$d_SCNfldbl'
19539 d__fwalk='$d__fwalk'
19540 d_access='$d_access'
19541 d_accessx='$d_accessx'
19542 d_alarm='$d_alarm'
19543 d_archlib='$d_archlib'
19544 d_asctime_r='$d_asctime_r'
19545 d_atolf='$d_atolf'
19546 d_atoll='$d_atoll'
19547 d_attribut='$d_attribut'
19548 d_bcmp='$d_bcmp'
19549 d_bcopy='$d_bcopy'
19550 d_bincompat5005='$d_bincompat5005'
19551 d_bsd='$d_bsd'
19552 d_bsdgetpgrp='$d_bsdgetpgrp'
19553 d_bsdsetpgrp='$d_bsdsetpgrp'
19554 d_bzero='$d_bzero'
19555 d_casti32='$d_casti32'
19556 d_castneg='$d_castneg'
19557 d_charvspr='$d_charvspr'
19558 d_chown='$d_chown'
19559 d_chroot='$d_chroot'
19560 d_chsize='$d_chsize'
19561 d_class='$d_class'
19562 d_closedir='$d_closedir'
19563 d_cmsghdr_s='$d_cmsghdr_s'
19564 d_const='$d_const'
19565 d_crypt='$d_crypt'
19566 d_crypt_r='$d_crypt_r'
19567 d_csh='$d_csh'
19568 d_ctermid_r='$d_ctermid_r'
19569 d_ctime_r='$d_ctime_r'
19570 d_cuserid='$d_cuserid'
19571 d_dbl_dig='$d_dbl_dig'
19572 d_dbminitproto='$d_dbminitproto'
19573 d_difftime='$d_difftime'
19574 d_dirfd='$d_dirfd'
19575 d_dirnamlen='$d_dirnamlen'
19576 d_dlerror='$d_dlerror'
19577 d_dlopen='$d_dlopen'
19578 d_dlsymun='$d_dlsymun'
19579 d_dosuid='$d_dosuid'
19580 d_drand48_r='$d_drand48_r'
19581 d_drand48proto='$d_drand48proto'
19582 d_dup2='$d_dup2'
19583 d_eaccess='$d_eaccess'
19584 d_endgrent='$d_endgrent'
19585 d_endgrent_r='$d_endgrent_r'
19586 d_endhent='$d_endhent'
19587 d_endhostent_r='$d_endhostent_r'
19588 d_endnent='$d_endnent'
19589 d_endnetent_r='$d_endnetent_r'
19590 d_endpent='$d_endpent'
19591 d_endprotoent_r='$d_endprotoent_r'
19592 d_endpwent='$d_endpwent'
19593 d_endpwent_r='$d_endpwent_r'
19594 d_endsent='$d_endsent'
19595 d_endservent_r='$d_endservent_r'
19596 d_eofnblk='$d_eofnblk'
19597 d_eunice='$d_eunice'
19598 d_fchdir='$d_fchdir'
19599 d_fchmod='$d_fchmod'
19600 d_fchown='$d_fchown'
19601 d_fcntl='$d_fcntl'
19602 d_fcntl_can_lock='$d_fcntl_can_lock'
19603 d_fd_macros='$d_fd_macros'
19604 d_fd_set='$d_fd_set'
19605 d_fds_bits='$d_fds_bits'
19606 d_fgetpos='$d_fgetpos'
19607 d_finite='$d_finite'
19608 d_finitel='$d_finitel'
19609 d_flexfnam='$d_flexfnam'
19610 d_flock='$d_flock'
19611 d_flockproto='$d_flockproto'
19612 d_fork='$d_fork'
19613 d_fp_class='$d_fp_class'
19614 d_fpathconf='$d_fpathconf'
19615 d_fpclass='$d_fpclass'
19616 d_fpclassify='$d_fpclassify'
19617 d_fpclassl='$d_fpclassl'
19618 d_fpos64_t='$d_fpos64_t'
19619 d_frexpl='$d_frexpl'
19620 d_fs_data_s='$d_fs_data_s'
19621 d_fseeko='$d_fseeko'
19622 d_fsetpos='$d_fsetpos'
19623 d_fstatfs='$d_fstatfs'
19624 d_fstatvfs='$d_fstatvfs'
19625 d_fsync='$d_fsync'
19626 d_ftello='$d_ftello'
19627 d_ftime='$d_ftime'
19628 d_getcwd='$d_getcwd'
19629 d_getespwnam='$d_getespwnam'
19630 d_getfsstat='$d_getfsstat'
19631 d_getgrent='$d_getgrent'
19632 d_getgrent_r='$d_getgrent_r'
19633 d_getgrgid_r='$d_getgrgid_r'
19634 d_getgrnam_r='$d_getgrnam_r'
19635 d_getgrps='$d_getgrps'
19636 d_gethbyaddr='$d_gethbyaddr'
19637 d_gethbyname='$d_gethbyname'
19638 d_gethent='$d_gethent'
19639 d_gethname='$d_gethname'
19640 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19641 d_gethostbyname_r='$d_gethostbyname_r'
19642 d_gethostent_r='$d_gethostent_r'
19643 d_gethostprotos='$d_gethostprotos'
19644 d_getitimer='$d_getitimer'
19645 d_getlogin='$d_getlogin'
19646 d_getlogin_r='$d_getlogin_r'
19647 d_getmnt='$d_getmnt'
19648 d_getmntent='$d_getmntent'
19649 d_getnbyaddr='$d_getnbyaddr'
19650 d_getnbyname='$d_getnbyname'
19651 d_getnent='$d_getnent'
19652 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19653 d_getnetbyname_r='$d_getnetbyname_r'
19654 d_getnetent_r='$d_getnetent_r'
19655 d_getnetprotos='$d_getnetprotos'
19656 d_getpagsz='$d_getpagsz'
19657 d_getpbyname='$d_getpbyname'
19658 d_getpbynumber='$d_getpbynumber'
19659 d_getpent='$d_getpent'
19660 d_getpgid='$d_getpgid'
19661 d_getpgrp2='$d_getpgrp2'
19662 d_getpgrp='$d_getpgrp'
19663 d_getppid='$d_getppid'
19664 d_getprior='$d_getprior'
19665 d_getprotobyname_r='$d_getprotobyname_r'
19666 d_getprotobynumber_r='$d_getprotobynumber_r'
19667 d_getprotoent_r='$d_getprotoent_r'
19668 d_getprotoprotos='$d_getprotoprotos'
19669 d_getprpwnam='$d_getprpwnam'
19670 d_getpwent='$d_getpwent'
19671 d_getpwent_r='$d_getpwent_r'
19672 d_getpwnam_r='$d_getpwnam_r'
19673 d_getpwuid_r='$d_getpwuid_r'
19674 d_getsbyname='$d_getsbyname'
19675 d_getsbyport='$d_getsbyport'
19676 d_getsent='$d_getsent'
19677 d_getservbyname_r='$d_getservbyname_r'
19678 d_getservbyport_r='$d_getservbyport_r'
19679 d_getservent_r='$d_getservent_r'
19680 d_getservprotos='$d_getservprotos'
19681 d_getspnam='$d_getspnam'
19682 d_getspnam_r='$d_getspnam_r'
19683 d_gettimeod='$d_gettimeod'
19684 d_gmtime_r='$d_gmtime_r'
19685 d_gnulibc='$d_gnulibc'
19686 d_grpasswd='$d_grpasswd'
19687 d_hasmntopt='$d_hasmntopt'
19688 d_htonl='$d_htonl'
19689 d_index='$d_index'
19690 d_inetaton='$d_inetaton'
19691 d_int64_t='$d_int64_t'
19692 d_isascii='$d_isascii'
19693 d_isfinite='$d_isfinite'
19694 d_isinf='$d_isinf'
19695 d_isnan='$d_isnan'
19696 d_isnanl='$d_isnanl'
19697 d_killpg='$d_killpg'
19698 d_lchown='$d_lchown'
19699 d_ldbl_dig='$d_ldbl_dig'
19700 d_link='$d_link'
19701 d_localtime_r='$d_localtime_r'
19702 d_locconv='$d_locconv'
19703 d_lockf='$d_lockf'
19704 d_longdbl='$d_longdbl'
19705 d_longlong='$d_longlong'
19706 d_lseekproto='$d_lseekproto'
19707 d_lstat='$d_lstat'
19708 d_madvise='$d_madvise'
19709 d_mblen='$d_mblen'
19710 d_mbstowcs='$d_mbstowcs'
19711 d_mbtowc='$d_mbtowc'
19712 d_memchr='$d_memchr'
19713 d_memcmp='$d_memcmp'
19714 d_memcpy='$d_memcpy'
19715 d_memmove='$d_memmove'
19716 d_memset='$d_memset'
19717 d_mkdir='$d_mkdir'
19718 d_mkdtemp='$d_mkdtemp'
19719 d_mkfifo='$d_mkfifo'
19720 d_mkstemp='$d_mkstemp'
19721 d_mkstemps='$d_mkstemps'
19722 d_mktime='$d_mktime'
19723 d_mmap='$d_mmap'
19724 d_modfl='$d_modfl'
19725 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19726 d_mprotect='$d_mprotect'
19727 d_msg='$d_msg'
19728 d_msg_ctrunc='$d_msg_ctrunc'
19729 d_msg_dontroute='$d_msg_dontroute'
19730 d_msg_oob='$d_msg_oob'
19731 d_msg_peek='$d_msg_peek'
19732 d_msg_proxy='$d_msg_proxy'
19733 d_msgctl='$d_msgctl'
19734 d_msgget='$d_msgget'
19735 d_msghdr_s='$d_msghdr_s'
19736 d_msgrcv='$d_msgrcv'
19737 d_msgsnd='$d_msgsnd'
19738 d_msync='$d_msync'
19739 d_munmap='$d_munmap'
19740 d_mymalloc='$d_mymalloc'
19741 d_nice='$d_nice'
19742 d_nl_langinfo='$d_nl_langinfo'
19743 d_nv_preserves_uv='$d_nv_preserves_uv'
19744 d_off64_t='$d_off64_t'
19745 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19746 d_oldpthreads='$d_oldpthreads'
19747 d_oldsock='$d_oldsock'
19748 d_open3='$d_open3'
19749 d_pathconf='$d_pathconf'
19750 d_pause='$d_pause'
19751 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19752 d_phostname='$d_phostname'
19753 d_pipe='$d_pipe'
19754 d_poll='$d_poll'
19755 d_portable='$d_portable'
19756 d_procselfexe='$d_procselfexe'
19757 d_pthread_atfork='$d_pthread_atfork'
19758 d_pthread_yield='$d_pthread_yield'
19759 d_pwage='$d_pwage'
19760 d_pwchange='$d_pwchange'
19761 d_pwclass='$d_pwclass'
19762 d_pwcomment='$d_pwcomment'
19763 d_pwexpire='$d_pwexpire'
19764 d_pwgecos='$d_pwgecos'
19765 d_pwpasswd='$d_pwpasswd'
19766 d_pwquota='$d_pwquota'
19767 d_qgcvt='$d_qgcvt'
19768 d_quad='$d_quad'
19769 d_random_r='$d_random_r'
19770 d_readdir64_r='$d_readdir64_r'
19771 d_readdir='$d_readdir'
19772 d_readdir_r='$d_readdir_r'
19773 d_readlink='$d_readlink'
19774 d_readv='$d_readv'
19775 d_recvmsg='$d_recvmsg'
19776 d_rename='$d_rename'
19777 d_rewinddir='$d_rewinddir'
19778 d_rmdir='$d_rmdir'
19779 d_safebcpy='$d_safebcpy'
19780 d_safemcpy='$d_safemcpy'
19781 d_sanemcmp='$d_sanemcmp'
19782 d_sbrkproto='$d_sbrkproto'
19783 d_sched_yield='$d_sched_yield'
19784 d_scm_rights='$d_scm_rights'
19785 d_seekdir='$d_seekdir'
19786 d_select='$d_select'
19787 d_sem='$d_sem'
19788 d_semctl='$d_semctl'
19789 d_semctl_semid_ds='$d_semctl_semid_ds'
19790 d_semctl_semun='$d_semctl_semun'
19791 d_semget='$d_semget'
19792 d_semop='$d_semop'
19793 d_sendmsg='$d_sendmsg'
19794 d_setegid='$d_setegid'
19795 d_seteuid='$d_seteuid'
19796 d_setgrent='$d_setgrent'
19797 d_setgrent_r='$d_setgrent_r'
19798 d_setgrps='$d_setgrps'
19799 d_sethent='$d_sethent'
19800 d_sethostent_r='$d_sethostent_r'
19801 d_setitimer='$d_setitimer'
19802 d_setlinebuf='$d_setlinebuf'
19803 d_setlocale='$d_setlocale'
19804 d_setlocale_r='$d_setlocale_r'
19805 d_setnent='$d_setnent'
19806 d_setnetent_r='$d_setnetent_r'
19807 d_setpent='$d_setpent'
19808 d_setpgid='$d_setpgid'
19809 d_setpgrp2='$d_setpgrp2'
19810 d_setpgrp='$d_setpgrp'
19811 d_setprior='$d_setprior'
19812 d_setproctitle='$d_setproctitle'
19813 d_setprotoent_r='$d_setprotoent_r'
19814 d_setpwent='$d_setpwent'
19815 d_setpwent_r='$d_setpwent_r'
19816 d_setregid='$d_setregid'
19817 d_setresgid='$d_setresgid'
19818 d_setresuid='$d_setresuid'
19819 d_setreuid='$d_setreuid'
19820 d_setrgid='$d_setrgid'
19821 d_setruid='$d_setruid'
19822 d_setsent='$d_setsent'
19823 d_setservent_r='$d_setservent_r'
19824 d_setsid='$d_setsid'
19825 d_setvbuf='$d_setvbuf'
19826 d_sfio='$d_sfio'
19827 d_shm='$d_shm'
19828 d_shmat='$d_shmat'
19829 d_shmatprototype='$d_shmatprototype'
19830 d_shmctl='$d_shmctl'
19831 d_shmdt='$d_shmdt'
19832 d_shmget='$d_shmget'
19833 d_sigaction='$d_sigaction'
19834 d_sigprocmask='$d_sigprocmask'
19835 d_sigsetjmp='$d_sigsetjmp'
19836 d_sockatmark='$d_sockatmark'
19837 d_sockatmarkproto='$d_sockatmarkproto'
19838 d_socket='$d_socket'
19839 d_socklen_t='$d_socklen_t'
19840 d_sockpair='$d_sockpair'
19841 d_socks5_init='$d_socks5_init'
19842 d_sqrtl='$d_sqrtl'
19843 d_srand48_r='$d_srand48_r'
19844 d_srandom_r='$d_srandom_r'
19845 d_sresgproto='$d_sresgproto'
19846 d_sresuproto='$d_sresuproto'
19847 d_statblks='$d_statblks'
19848 d_statfs_f_flags='$d_statfs_f_flags'
19849 d_statfs_s='$d_statfs_s'
19850 d_statvfs='$d_statvfs'
19851 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19852 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19853 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19854 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19855 d_stdio_stream_array='$d_stdio_stream_array'
19856 d_stdiobase='$d_stdiobase'
19857 d_stdstdio='$d_stdstdio'
19858 d_strchr='$d_strchr'
19859 d_strcoll='$d_strcoll'
19860 d_strctcpy='$d_strctcpy'
19861 d_strerrm='$d_strerrm'
19862 d_strerror='$d_strerror'
19863 d_strerror_r='$d_strerror_r'
19864 d_strftime='$d_strftime'
19865 d_strtod='$d_strtod'
19866 d_strtol='$d_strtol'
19867 d_strtold='$d_strtold'
19868 d_strtoll='$d_strtoll'
19869 d_strtoq='$d_strtoq'
19870 d_strtoul='$d_strtoul'
19871 d_strtoull='$d_strtoull'
19872 d_strtouq='$d_strtouq'
19873 d_strxfrm='$d_strxfrm'
19874 d_suidsafe='$d_suidsafe'
19875 d_symlink='$d_symlink'
19876 d_syscall='$d_syscall'
19877 d_syscallproto='$d_syscallproto'
19878 d_sysconf='$d_sysconf'
19879 d_sysernlst='$d_sysernlst'
19880 d_syserrlst='$d_syserrlst'
19881 d_system='$d_system'
19882 d_tcgetpgrp='$d_tcgetpgrp'
19883 d_tcsetpgrp='$d_tcsetpgrp'
19884 d_telldir='$d_telldir'
19885 d_telldirproto='$d_telldirproto'
19886 d_time='$d_time'
19887 d_times='$d_times'
19888 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19889 d_tm_tm_zone='$d_tm_tm_zone'
19890 d_tmpnam_r='$d_tmpnam_r'
19891 d_truncate='$d_truncate'
19892 d_ttyname_r='$d_ttyname_r'
19893 d_tzname='$d_tzname'
19894 d_u32align='$d_u32align'
19895 d_ualarm='$d_ualarm'
19896 d_umask='$d_umask'
19897 d_uname='$d_uname'
19898 d_union_semun='$d_union_semun'
19899 d_unordered='$d_unordered'
19900 d_usleep='$d_usleep'
19901 d_usleepproto='$d_usleepproto'
19902 d_ustat='$d_ustat'
19903 d_vendorarch='$d_vendorarch'
19904 d_vendorbin='$d_vendorbin'
19905 d_vendorlib='$d_vendorlib'
19906 d_vfork='$d_vfork'
19907 d_void_closedir='$d_void_closedir'
19908 d_voidsig='$d_voidsig'
19909 d_voidtty='$d_voidtty'
19910 d_volatile='$d_volatile'
19911 d_vprintf='$d_vprintf'
19912 d_wait4='$d_wait4'
19913 d_waitpid='$d_waitpid'
19914 d_wcstombs='$d_wcstombs'
19915 d_wctomb='$d_wctomb'
19916 d_writev='$d_writev'
19917 d_xenix='$d_xenix'
19918 date='$date'
19919 db_hashtype='$db_hashtype'
19920 db_prefixtype='$db_prefixtype'
19921 db_version_major='$db_version_major'
19922 db_version_minor='$db_version_minor'
19923 db_version_patch='$db_version_patch'
19924 defvoidused='$defvoidused'
19925 direntrytype='$direntrytype'
19926 dlext='$dlext'
19927 dlsrc='$dlsrc'
19928 doublesize='$doublesize'
19929 drand01='$drand01'
19930 drand48_r_proto='$drand48_r_proto'
19931 dynamic_ext='$dynamic_ext'
19932 eagain='$eagain'
19933 ebcdic='$ebcdic'
19934 echo='$echo'
19935 egrep='$egrep'
19936 emacs='$emacs'
19937 endgrent_r_proto='$endgrent_r_proto'
19938 endhostent_r_proto='$endhostent_r_proto'
19939 endnetent_r_proto='$endnetent_r_proto'
19940 endprotoent_r_proto='$endprotoent_r_proto'
19941 endpwent_r_proto='$endpwent_r_proto'
19942 endservent_r_proto='$endservent_r_proto'
19943 eunicefix='$eunicefix'
19944 exe_ext='$exe_ext'
19945 expr='$expr'
19946 extensions='$extensions'
19947 extras='$extras'
19948 fflushNULL='$fflushNULL'
19949 fflushall='$fflushall'
19950 find='$find'
19951 firstmakefile='$firstmakefile'
19952 flex='$flex'
19953 fpossize='$fpossize'
19954 fpostype='$fpostype'
19955 freetype='$freetype'
19956 from='$from'
19957 full_ar='$full_ar'
19958 full_csh='$full_csh'
19959 full_sed='$full_sed'
19960 gccosandvers='$gccosandvers'
19961 gccversion='$gccversion'
19962 getgrent_r_proto='$getgrent_r_proto'
19963 getgrgid_r_proto='$getgrgid_r_proto'
19964 getgrnam_r_proto='$getgrnam_r_proto'
19965 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
19966 gethostbyname_r_proto='$gethostbyname_r_proto'
19967 gethostent_r_proto='$gethostent_r_proto'
19968 getlogin_r_proto='$getlogin_r_proto'
19969 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
19970 getnetbyname_r_proto='$getnetbyname_r_proto'
19971 getnetent_r_proto='$getnetent_r_proto'
19972 getprotobyname_r_proto='$getprotobyname_r_proto'
19973 getprotobynumber_r_proto='$getprotobynumber_r_proto'
19974 getprotoent_r_proto='$getprotoent_r_proto'
19975 getpwent_r_proto='$getpwent_r_proto'
19976 getpwnam_r_proto='$getpwnam_r_proto'
19977 getpwuid_r_proto='$getpwuid_r_proto'
19978 getservbyname_r_proto='$getservbyname_r_proto'
19979 getservbyport_r_proto='$getservbyport_r_proto'
19980 getservent_r_proto='$getservent_r_proto'
19981 getspnam_r_proto='$getspnam_r_proto'
19982 gidformat='$gidformat'
19983 gidsign='$gidsign'
19984 gidsize='$gidsize'
19985 gidtype='$gidtype'
19986 glibpth='$glibpth'
19987 gmake='$gmake'
19988 gmtime_r_proto='$gmtime_r_proto'
19989 grep='$grep'
19990 groupcat='$groupcat'
19991 groupstype='$groupstype'
19992 gzip='$gzip'
19993 h_fcntl='$h_fcntl'
19994 h_sysfile='$h_sysfile'
19995 hint='$hint'
19996 hostcat='$hostcat'
19997 i16size='$i16size'
19998 i16type='$i16type'
19999 i32size='$i32size'
20000 i32type='$i32type'
20001 i64size='$i64size'
20002 i64type='$i64type'
20003 i8size='$i8size'
20004 i8type='$i8type'
20005 i_arpainet='$i_arpainet'
20006 i_bsdioctl='$i_bsdioctl'
20007 i_crypt='$i_crypt'
20008 i_db='$i_db'
20009 i_dbm='$i_dbm'
20010 i_dirent='$i_dirent'
20011 i_dld='$i_dld'
20012 i_dlfcn='$i_dlfcn'
20013 i_fcntl='$i_fcntl'
20014 i_float='$i_float'
20015 i_fp='$i_fp'
20016 i_fp_class='$i_fp_class'
20017 i_gdbm='$i_gdbm'
20018 i_grp='$i_grp'
20019 i_ieeefp='$i_ieeefp'
20020 i_inttypes='$i_inttypes'
20021 i_langinfo='$i_langinfo'
20022 i_libutil='$i_libutil'
20023 i_limits='$i_limits'
20024 i_locale='$i_locale'
20025 i_machcthr='$i_machcthr'
20026 i_malloc='$i_malloc'
20027 i_math='$i_math'
20028 i_memory='$i_memory'
20029 i_mntent='$i_mntent'
20030 i_ndbm='$i_ndbm'
20031 i_netdb='$i_netdb'
20032 i_neterrno='$i_neterrno'
20033 i_netinettcp='$i_netinettcp'
20034 i_niin='$i_niin'
20035 i_poll='$i_poll'
20036 i_prot='$i_prot'
20037 i_pthread='$i_pthread'
20038 i_pwd='$i_pwd'
20039 i_rpcsvcdbm='$i_rpcsvcdbm'
20040 i_sfio='$i_sfio'
20041 i_sgtty='$i_sgtty'
20042 i_shadow='$i_shadow'
20043 i_socks='$i_socks'
20044 i_stdarg='$i_stdarg'
20045 i_stddef='$i_stddef'
20046 i_stdlib='$i_stdlib'
20047 i_string='$i_string'
20048 i_sunmath='$i_sunmath'
20049 i_sysaccess='$i_sysaccess'
20050 i_sysdir='$i_sysdir'
20051 i_sysfile='$i_sysfile'
20052 i_sysfilio='$i_sysfilio'
20053 i_sysin='$i_sysin'
20054 i_sysioctl='$i_sysioctl'
20055 i_syslog='$i_syslog'
20056 i_sysmman='$i_sysmman'
20057 i_sysmode='$i_sysmode'
20058 i_sysmount='$i_sysmount'
20059 i_sysndir='$i_sysndir'
20060 i_sysparam='$i_sysparam'
20061 i_sysresrc='$i_sysresrc'
20062 i_syssecrt='$i_syssecrt'
20063 i_sysselct='$i_sysselct'
20064 i_syssockio='$i_syssockio'
20065 i_sysstat='$i_sysstat'
20066 i_sysstatfs='$i_sysstatfs'
20067 i_sysstatvfs='$i_sysstatvfs'
20068 i_systime='$i_systime'
20069 i_systimek='$i_systimek'
20070 i_systimes='$i_systimes'
20071 i_systypes='$i_systypes'
20072 i_sysuio='$i_sysuio'
20073 i_sysun='$i_sysun'
20074 i_sysutsname='$i_sysutsname'
20075 i_sysvfs='$i_sysvfs'
20076 i_syswait='$i_syswait'
20077 i_termio='$i_termio'
20078 i_termios='$i_termios'
20079 i_time='$i_time'
20080 i_unistd='$i_unistd'
20081 i_ustat='$i_ustat'
20082 i_utime='$i_utime'
20083 i_values='$i_values'
20084 i_varargs='$i_varargs'
20085 i_varhdr='$i_varhdr'
20086 i_vfork='$i_vfork'
20087 ignore_versioned_solibs='$ignore_versioned_solibs'
20088 inc_version_list='$inc_version_list'
20089 inc_version_list_init='$inc_version_list_init'
20090 incpath='$incpath'
20091 inews='$inews'
20092 installarchlib='$installarchlib'
20093 installbin='$installbin'
20094 installman1dir='$installman1dir'
20095 installman3dir='$installman3dir'
20096 installprefix='$installprefix'
20097 installprefixexp='$installprefixexp'
20098 installprivlib='$installprivlib'
20099 installscript='$installscript'
20100 installsitearch='$installsitearch'
20101 installsitebin='$installsitebin'
20102 installsitelib='$installsitelib'
20103 installstyle='$installstyle'
20104 installusrbinperl='$installusrbinperl'
20105 installvendorarch='$installvendorarch'
20106 installvendorbin='$installvendorbin'
20107 installvendorlib='$installvendorlib'
20108 intsize='$intsize'
20109 issymlink='$issymlink'
20110 ivdformat='$ivdformat'
20111 ivsize='$ivsize'
20112 ivtype='$ivtype'
20113 known_extensions='$known_extensions'
20114 ksh='$ksh'
20115 ld='$ld'
20116 lddlflags='$lddlflags'
20117 ldflags='$ldflags'
20118 ldflags_uselargefiles='$ldflags_uselargefiles'
20119 ldlibpthname='$ldlibpthname'
20120 less='$less'
20121 lib_ext='$lib_ext'
20122 libc='$libc'
20123 libperl='$libperl'
20124 libpth='$libpth'
20125 libs='$libs'
20126 libsdirs='$libsdirs'
20127 libsfiles='$libsfiles'
20128 libsfound='$libsfound'
20129 libspath='$libspath'
20130 libswanted='$libswanted'
20131 libswanted_uselargefiles='$libswanted_uselargefiles'
20132 line='$line'
20133 lint='$lint'
20134 lkflags='$lkflags'
20135 ln='$ln'
20136 lns='$lns'
20137 localtime_r_proto='$localtime_r_proto'
20138 locincpth='$locincpth'
20139 loclibpth='$loclibpth'
20140 longdblsize='$longdblsize'
20141 longlongsize='$longlongsize'
20142 longsize='$longsize'
20143 lp='$lp'
20144 lpr='$lpr'
20145 ls='$ls'
20146 lseeksize='$lseeksize'
20147 lseektype='$lseektype'
20148 mail='$mail'
20149 mailx='$mailx'
20150 make='$make'
20151 make_set_make='$make_set_make'
20152 mallocobj='$mallocobj'
20153 mallocsrc='$mallocsrc'
20154 malloctype='$malloctype'
20155 man1dir='$man1dir'
20156 man1direxp='$man1direxp'
20157 man1ext='$man1ext'
20158 man3dir='$man3dir'
20159 man3direxp='$man3direxp'
20160 man3ext='$man3ext'
20161 mips_type='$mips_type'
20162 mkdir='$mkdir'
20163 mmaptype='$mmaptype'
20164 modetype='$modetype'
20165 more='$more'
20166 multiarch='$multiarch'
20167 mv='$mv'
20168 myarchname='$myarchname'
20169 mydomain='$mydomain'
20170 myhostname='$myhostname'
20171 myuname='$myuname'
20172 n='$n'
20173 need_va_copy='$need_va_copy'
20174 netdb_hlen_type='$netdb_hlen_type'
20175 netdb_host_type='$netdb_host_type'
20176 netdb_name_type='$netdb_name_type'
20177 netdb_net_type='$netdb_net_type'
20178 nm='$nm'
20179 nm_opt='$nm_opt'
20180 nm_so_opt='$nm_so_opt'
20181 nonxs_ext='$nonxs_ext'
20182 nroff='$nroff'
20183 nvEUformat='$nvEUformat'
20184 nvFUformat='$nvFUformat'
20185 nvGUformat='$nvGUformat'
20186 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20187 nveformat='$nveformat'
20188 nvfformat='$nvfformat'
20189 nvgformat='$nvgformat'
20190 nvsize='$nvsize'
20191 nvtype='$nvtype'
20192 o_nonblock='$o_nonblock'
20193 obj_ext='$obj_ext'
20194 old_pthread_create_joinable='$old_pthread_create_joinable'
20195 optimize='$optimize'
20196 orderlib='$orderlib'
20197 osname='$osname'
20198 osvers='$osvers'
20199 otherlibdirs='$otherlibdirs'
20200 package='$package'
20201 pager='$pager'
20202 passcat='$passcat'
20203 patchlevel='$patchlevel'
20204 path_sep='$path_sep'
20205 perl5='$perl5'
20206 perl='$perl'
20207 perl_patchlevel='$perl_patchlevel'
20208 perladmin='$perladmin'
20209 perllibs='$perllibs'
20210 perlpath='$perlpath'
20211 pg='$pg'
20212 phostname='$phostname'
20213 pidtype='$pidtype'
20214 plibpth='$plibpth'
20215 pm_apiversion='$pm_apiversion'
20216 pmake='$pmake'
20217 pr='$pr'
20218 prefix='$prefix'
20219 prefixexp='$prefixexp'
20220 privlib='$privlib'
20221 privlibexp='$privlibexp'
20222 procselfexe='$procselfexe'
20223 prototype='$prototype'
20224 ptrsize='$ptrsize'
20225 quadkind='$quadkind'
20226 quadtype='$quadtype'
20227 randbits='$randbits'
20228 randfunc='$randfunc'
20229 random_r_proto='$random_r_proto'
20230 randseedtype='$randseedtype'
20231 ranlib='$ranlib'
20232 rd_nodata='$rd_nodata'
20233 readdir64_r_proto='$readdir64_r_proto'
20234 readdir_r_proto='$readdir_r_proto'
20235 revision='$revision'
20236 rm='$rm'
20237 rmail='$rmail'
20238 run='$run'
20239 runnm='$runnm'
20240 sPRIEUldbl='$sPRIEUldbl'
20241 sPRIFUldbl='$sPRIFUldbl'
20242 sPRIGUldbl='$sPRIGUldbl'
20243 sPRIXU64='$sPRIXU64'
20244 sPRId64='$sPRId64'
20245 sPRIeldbl='$sPRIeldbl'
20246 sPRIfldbl='$sPRIfldbl'
20247 sPRIgldbl='$sPRIgldbl'
20248 sPRIi64='$sPRIi64'
20249 sPRIo64='$sPRIo64'
20250 sPRIu64='$sPRIu64'
20251 sPRIx64='$sPRIx64'
20252 sSCNfldbl='$sSCNfldbl'
20253 sched_yield='$sched_yield'
20254 scriptdir='$scriptdir'
20255 scriptdirexp='$scriptdirexp'
20256 sed='$sed'
20257 seedfunc='$seedfunc'
20258 selectminbits='$selectminbits'
20259 selecttype='$selecttype'
20260 sendmail='$sendmail'
20261 setgrent_r_proto='$setgrent_r_proto'
20262 sethostent_r_proto='$sethostent_r_proto'
20263 setlocale_r_proto='$setlocale_r_proto'
20264 setnetent_r_proto='$setnetent_r_proto'
20265 setprotoent_r_proto='$setprotoent_r_proto'
20266 setpwent_r_proto='$setpwent_r_proto'
20267 setservent_r_proto='$setservent_r_proto'
20268 sh='$sh'
20269 shar='$shar'
20270 sharpbang='$sharpbang'
20271 shmattype='$shmattype'
20272 shortsize='$shortsize'
20273 shrpenv='$shrpenv'
20274 shsharp='$shsharp'
20275 sig_count='$sig_count'
20276 sig_name='$sig_name'
20277 sig_name_init='$sig_name_init'
20278 sig_num='$sig_num'
20279 sig_num_init='$sig_num_init'
20280 sig_size='$sig_size'
20281 signal_t='$signal_t'
20282 sitearch='$sitearch'
20283 sitearchexp='$sitearchexp'
20284 sitebin='$sitebin'
20285 sitebinexp='$sitebinexp'
20286 sitelib='$sitelib'
20287 sitelib_stem='$sitelib_stem'
20288 sitelibexp='$sitelibexp'
20289 siteprefix='$siteprefix'
20290 siteprefixexp='$siteprefixexp'
20291 sizesize='$sizesize'
20292 sizetype='$sizetype'
20293 sleep='$sleep'
20294 smail='$smail'
20295 so='$so'
20296 sockethdr='$sockethdr'
20297 socketlib='$socketlib'
20298 socksizetype='$socksizetype'
20299 sort='$sort'
20300 spackage='$spackage'
20301 spitshell='$spitshell'
20302 srand48_r_proto='$srand48_r_proto'
20303 srandom_r_proto='$srandom_r_proto'
20304 src='$src'
20305 ssizetype='$ssizetype'
20306 startperl='$startperl'
20307 startsh='$startsh'
20308 static_ext='$static_ext'
20309 stdchar='$stdchar'
20310 stdio_base='$stdio_base'
20311 stdio_bufsiz='$stdio_bufsiz'
20312 stdio_cnt='$stdio_cnt'
20313 stdio_filbuf='$stdio_filbuf'
20314 stdio_ptr='$stdio_ptr'
20315 stdio_stream_array='$stdio_stream_array'
20316 strerror_r_proto='$strerror_r_proto'
20317 strings='$strings'
20318 submit='$submit'
20319 subversion='$subversion'
20320 sysman='$sysman'
20321 tail='$tail'
20322 tar='$tar'
20323 targetarch='$targetarch'
20324 tbl='$tbl'
20325 tee='$tee'
20326 test='$test'
20327 timeincl='$timeincl'
20328 timetype='$timetype'
20329 tmpnam_r_proto='$tmpnam_r_proto'
20330 to='$to'
20331 touch='$touch'
20332 tr='$tr'
20333 trnl='$trnl'
20334 troff='$troff'
20335 ttyname_r_proto='$ttyname_r_proto'
20336 u16size='$u16size'
20337 u16type='$u16type'
20338 u32size='$u32size'
20339 u32type='$u32type'
20340 u64size='$u64size'
20341 u64type='$u64type'
20342 u8size='$u8size'
20343 u8type='$u8type'
20344 uidformat='$uidformat'
20345 uidsign='$uidsign'
20346 uidsize='$uidsize'
20347 uidtype='$uidtype'
20348 uname='$uname'
20349 uniq='$uniq'
20350 uquadtype='$uquadtype'
20351 use5005threads='$use5005threads'
20352 use64bitall='$use64bitall'
20353 use64bitint='$use64bitint'
20354 usecrosscompile='$usecrosscompile'
20355 usedl='$usedl'
20356 useithreads='$useithreads'
20357 uselargefiles='$uselargefiles'
20358 uselongdouble='$uselongdouble'
20359 usemorebits='$usemorebits'
20360 usemultiplicity='$usemultiplicity'
20361 usemymalloc='$usemymalloc'
20362 usenm='$usenm'
20363 useopcode='$useopcode'
20364 useperlio='$useperlio'
20365 useposix='$useposix'
20366 usereentrant='$usereentrant'
20367 usesfio='$usesfio'
20368 useshrplib='$useshrplib'
20369 usesocks='$usesocks'
20370 usethreads='$usethreads'
20371 usevendorprefix='$usevendorprefix'
20372 usevfork='$usevfork'
20373 usrinc='$usrinc'
20374 uuname='$uuname'
20375 uvXUformat='$uvXUformat'
20376 uvoformat='$uvoformat'
20377 uvsize='$uvsize'
20378 uvtype='$uvtype'
20379 uvuformat='$uvuformat'
20380 uvxformat='$uvxformat'
20381 vendorarch='$vendorarch'
20382 vendorarchexp='$vendorarchexp'
20383 vendorbin='$vendorbin'
20384 vendorbinexp='$vendorbinexp'
20385 vendorlib='$vendorlib'
20386 vendorlib_stem='$vendorlib_stem'
20387 vendorlibexp='$vendorlibexp'
20388 vendorprefix='$vendorprefix'
20389 vendorprefixexp='$vendorprefixexp'
20390 version='$version'
20391 version_patchlevel_string='$version_patchlevel_string'
20392 versiononly='$versiononly'
20393 vi='$vi'
20394 voidflags='$voidflags'
20395 xlibpth='$xlibpth'
20396 xs_apiversion='$xs_apiversion'
20397 yacc='$yacc'
20398 yaccflags='$yaccflags'
20399 zcat='$zcat'
20400 zip='$zip'
20401 EOT
20402
20403 : Add in command line options if available
20404 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20405
20406 : add special variables
20407 $test -f $src/patchlevel.h && \
20408 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20409 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20410 echo "PERL_CONFIG_SH=true" >>config.sh
20411
20412 : propagate old symbols
20413 if $test -f UU/config.sh; then
20414         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20415         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20416         $sort | $uniq -u >UU/oldsyms
20417         set X `cat UU/oldsyms`
20418         shift
20419         case $# in
20420         0) ;;
20421         *)
20422                 cat <<EOM
20423 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20424 EOM
20425                 echo "# Variables propagated from previous config.sh file." >>config.sh
20426                 for sym in `cat UU/oldsyms`; do
20427                         echo "    Propagating $hint variable "'$'"$sym..."
20428                         eval 'tmp="$'"${sym}"'"'
20429                         echo "$tmp" | \
20430                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20431                 done
20432                 ;;
20433         esac
20434 fi
20435
20436 : Finish up by extracting the .SH files
20437 case "$alldone" in
20438 exit)
20439         $rm -rf UU
20440         echo "Extraction done."
20441         exit 0
20442         ;;
20443 cont)
20444         ;;
20445 '')
20446         dflt=''
20447         nostick=true
20448         $cat <<EOM
20449
20450 If you'd like to make any changes to the config.sh file before I begin
20451 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20452
20453 EOM
20454         rp="Press return or use a shell escape to edit config.sh:"
20455         . UU/myread
20456         nostick=''
20457         case "$ans" in
20458         '') ;;
20459         *) : in case they cannot read
20460                 sh 1>&4 -c "$ans";;
20461         esac
20462         ;;
20463 esac
20464
20465 : if this fails, just run all the .SH files by hand
20466 . ./config.sh
20467
20468 echo " "
20469 exec 1>&4
20470 pwd=`pwd`
20471 . ./UU/extract
20472 cd "$pwd"
20473
20474 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20475         dflt=y
20476         case "$silent" in
20477         true) ;;
20478         *)
20479                 $cat <<EOM
20480
20481 Now you need to generate make dependencies by running "$make depend".
20482 You might prefer to run it in background: "$make depend > makedepend.out &"
20483 It can take a while, so you might not want to run it right now.
20484
20485 EOM
20486                 ;;
20487         esac
20488         rp="Run $make depend now?"
20489         . UU/myread
20490         case "$ans" in
20491         y*)
20492                 $make depend && echo "Now you must run '$make'."
20493                 ;;
20494         *)
20495                 echo "You must run '$make depend' then '$make'."
20496                 ;;
20497         esac
20498 elif test -f [Mm]akefile; then
20499         echo " "
20500         echo "Now you must run a $make."
20501 else
20502         echo "Configure done."
20503 fi
20504
20505 if $test -f Policy.sh; then
20506     $cat <<EOM
20507
20508 If you compile $package on a different machine or from a different object
20509 directory, copy the Policy.sh file from this object directory to the
20510 new one before you run Configure -- this will help you with most of
20511 the policy defaults.
20512
20513 EOM
20514 fi
20515 if $test -f config.msg; then
20516     echo "Hmm.  I also noted the following information while running:"
20517     echo " "
20518     $cat config.msg >&4
20519     $rm -f config.msg
20520 fi
20521 $rm -f kit*isdone ark*isdone
20522 $rm -rf UU
20523
20524 : End of Configure
20525