patch for syslog
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Wed Mar 20 05:22:55 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 release 5.6, Perl has two different threading implementations,
3444 an interpreter-based version (ithreads) with one interpreter per
3445 thread, and the 5.005 version (5005threads).  Both implementations
3446 are considered experimental, but since 5.8 ithreads somewhat less so.
3447 The 5005threads is effectively unmaintained.
3448
3449 EOM
3450         : Default to ithreads unless overridden on command line or with
3451         : old config.sh
3452         dflt='y'
3453         case "$use5005threads" in
3454                 $define|true|[yY]*) dflt='n';;
3455         esac
3456         case "$useithreads" in
3457                 $undef|false|[nN]*) dflt='n';;
3458         esac
3459         rp='Use interpreter-based ithreads?'
3460         . ./myread
3461         case "$ans" in
3462         y|Y)    val="$define" ;;
3463         *)      val="$undef" ;;
3464         esac
3465         set useithreads
3466         eval $setvar
3467         : Now set use5005threads to the opposite value.
3468         case "$useithreads" in
3469         $define) val="$undef" ;;
3470         *) val="$define" ;;
3471         esac
3472         set use5005threads
3473         eval $setvar
3474         ;;
3475 *)
3476         useithreads="$undef"
3477         use5005threads="$undef"
3478         ;;
3479 esac
3480
3481 case "$useithreads$use5005threads" in
3482 "$define$define")
3483         $cat >&4 <<EOM
3484
3485 You cannot have both the ithreads and the 5.005 threads enabled
3486 at the same time.  Disabling the 5.005 threads since they are
3487 much less stable than the ithreads.
3488
3489 EOM
3490         use5005threads="$undef"
3491         ;;
3492 esac
3493
3494 case "$d_oldpthreads" in
3495 '')     : Configure tests would be welcome here.  For now, assume undef.
3496         val="$undef" ;;
3497 *)      val="$d_oldpthreads" ;;
3498 esac
3499 set d_oldpthreads
3500 eval $setvar
3501
3502
3503 case "$usethreads" in
3504 "$define"|true|[yY]*)
3505 : Look for a hint-file generated 'call-back-unit'.  If the
3506 : user has specified that a threading perl is to be built,
3507 : we may need to set or change some other defaults.
3508         if $test -f usethreads.cbu; then
3509                 echo "Your platform has some specific hints for threaded builds, using them..."
3510                 . ./usethreads.cbu
3511         else
3512                 $cat <<EOM
3513 (Your platform doesn't have any specific hints for threaded builds.
3514  Assuming POSIX threads, then.)
3515 EOM
3516         fi
3517         ;;
3518 esac
3519
3520 cat <<EOM
3521
3522 Perl can be built so that multiple Perl interpreters can coexist
3523 within the same Perl executable.
3524 EOM
3525
3526 case "$useithreads" in
3527 $define)
3528         cat <<EOM
3529 This multiple interpreter support is required for interpreter-based threads.
3530 EOM
3531         val="$define"
3532         ;;
3533 *)      case "$usemultiplicity" in
3534         $define|true|[yY]*)     dflt='y';;
3535         *) dflt='n';;
3536         esac
3537         echo " "
3538         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3539         rp='Build Perl for multiplicity?'
3540         . ./myread
3541         case "$ans" in
3542         y|Y)    val="$define" ;;
3543         *)      val="$undef" ;;
3544         esac
3545         ;;
3546 esac
3547 set usemultiplicity
3548 eval $setvar
3549
3550
3551 case "$usemorebits" in
3552 "$define"|true|[yY]*)
3553         use64bitint="$define"
3554         uselongdouble="$define"
3555         usemorebits="$define"
3556         ;;
3557 *)      usemorebits="$undef"
3558         ;;
3559 esac
3560
3561 : make some quick guesses about what we are up against
3562 echo " "
3563 $echo $n "Hmm...  $c"
3564 echo exit 1 >bsd
3565 echo exit 1 >usg
3566 echo exit 1 >v7
3567 echo exit 1 >osf1
3568 echo exit 1 >eunice
3569 echo exit 1 >xenix
3570 echo exit 1 >venix
3571 echo exit 1 >os2
3572 d_bsd="$undef"
3573 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3574 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3575 then
3576         echo "Looks kind of like an OSF/1 system, but we'll see..."
3577         echo exit 0 >osf1
3578 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3579         xxx=`./loc addbib blurfl $pth`
3580         if $test -f $xxx; then
3581         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3582                 echo exit 0 >bsd
3583                 echo exit 0 >usg
3584         else
3585                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3586                         echo "Looks kind of like an extended USG system, but we'll see..."
3587                 else
3588                         echo "Looks kind of like a USG system, but we'll see..."
3589                 fi
3590                 echo exit 0 >usg
3591         fi
3592 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3593         echo "Looks kind of like a BSD system, but we'll see..."
3594         d_bsd="$define"
3595         echo exit 0 >bsd
3596 else
3597         echo "Looks kind of like a Version 7 system, but we'll see..."
3598         echo exit 0 >v7
3599 fi
3600 case "$eunicefix" in
3601 *unixtovms*)
3602         $cat <<'EOI'
3603 There is, however, a strange, musty smell in the air that reminds me of
3604 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3605 EOI
3606         echo exit 0 >eunice
3607         d_eunice="$define"
3608 : it so happens the Eunice I know will not run shell scripts in Unix format
3609         ;;
3610 *)
3611         echo " "
3612         echo "Congratulations.  You aren't running Eunice."
3613         d_eunice="$undef"
3614         ;;
3615 esac
3616 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3617 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3618 : semicolon as a patch separator
3619 case "$p_" in
3620 :) ;;
3621 *)
3622         $cat <<'EOI'
3623 I have the feeling something is not exactly right, however...don't tell me...
3624 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3625 (Or you may be running DOS with DJGPP.)
3626 EOI
3627         echo exit 0 >os2
3628         ;;
3629 esac
3630 if test -f /xenix; then
3631         echo "Actually, this looks more like a XENIX system..."
3632         echo exit 0 >xenix
3633         d_xenix="$define"
3634 else
3635         echo " "
3636         echo "It's not Xenix..."
3637         d_xenix="$undef"
3638 fi
3639 chmod +x xenix
3640 $eunicefix xenix
3641 if test -f /venix; then
3642         echo "Actually, this looks more like a VENIX system..."
3643         echo exit 0 >venix
3644 else
3645         echo " "
3646         if ./xenix; then
3647                 : null
3648         else
3649                 echo "Nor is it Venix..."
3650         fi
3651 fi
3652 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3653 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3654 $rm -f foo
3655
3656 case "$cc" in
3657 '') dflt=cc;;
3658 *) dflt="$cc";;
3659 esac
3660 rp="Use which C compiler?"
3661 . ./myread
3662 cc="$ans"
3663
3664 : See if they have not cc but they do have gcc
3665 . ./trygcc
3666 : Look for a hint-file generated 'call-back-unit'.  Now that the
3667 : user has specified the compiler, we may need to set or change some
3668 : other defaults.
3669 if $test -f cc.cbu; then
3670     . ./cc.cbu
3671 fi
3672 . ./checkcc
3673
3674 echo " "
3675 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3676 $cat >try.c <<EOM
3677 #include <stdio.h>
3678 int main() {
3679 #ifdef __GNUC__
3680 #ifdef __VERSION__
3681         printf("%s\n", __VERSION__);
3682 #else
3683         printf("%s\n", "1");
3684 #endif
3685 #endif
3686         exit(0);
3687 }
3688 EOM
3689 if $cc -o try $ccflags $ldflags try.c; then
3690         gccversion=`$run ./try`
3691         case "$gccversion" in
3692         '') echo "You are not using GNU cc." ;;
3693         *)  echo "You are using GNU cc $gccversion."
3694             ccname=gcc  
3695             ;;
3696         esac
3697 else
3698         echo " "
3699         echo "*** WHOA THERE!!! ***" >&4
3700         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3701         case "$knowitall" in
3702         '')
3703         echo "    You'd better start hunting for one and let me know about it." >&4
3704                 exit 1
3705                 ;;
3706         esac
3707 fi
3708 $rm -f try try.*
3709 case "$gccversion" in
3710 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3711 esac
3712 case "$gccversion" in
3713 '') gccosandvers='' ;;
3714 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3715    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3716    gccshortvers=''
3717    case "$gccosandvers" in
3718    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3719    $osname$osvers) ;; # looking good
3720    $osname*) cat <<EOM >&4
3721
3722 *** WHOA THERE!!! ***
3723
3724     Your gcc has not been compiled for the exact release of
3725     your operating system ($gccosandvers versus $osname$osvers).
3726
3727     In general it is a good idea to keep gcc synchronized with
3728     the operating system because otherwise serious problems
3729     may ensue when trying to compile software, like Perl.
3730
3731     I'm trying to be optimistic here, though, and will continue.
3732     If later during the configuration and build icky compilation
3733     problems appear (headerfile conflicts being the most common
3734     manifestation), I suggest reinstalling the gcc to match
3735     your operating system release.
3736
3737 EOM
3738       ;;
3739    *) gccosandvers='' ;; # failed to parse, better be silent
3740    esac
3741    ;;
3742 esac
3743 case "$ccname" in
3744 '') ccname="$cc" ;;
3745 esac
3746
3747
3748 : decide how portable to be.  Allow command line overrides.
3749 case "$d_portable" in
3750 "$undef") ;;
3751 *)      d_portable="$define" ;;
3752 esac
3753
3754 : set up shell script to do ~ expansion
3755 cat >filexp <<EOSS
3756 $startsh
3757 : expand filename
3758 case "\$1" in
3759  ~/*|~)
3760         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3761         ;;
3762  ~*)
3763         if $test -f /bin/csh; then
3764                 /bin/csh -f -c "glob \$1"
3765                 failed=\$?
3766                 echo ""
3767                 exit \$failed
3768         else
3769                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3770                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3771                 if $test ! -d "\$dir"; then
3772                         me=\`basename \$0\`
3773                         echo "\$me: can't locate home directory for: \$name" >&2
3774                         exit 1
3775                 fi
3776                 case "\$1" in
3777                 */*)
3778                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3779                         ;;
3780                 *)
3781                         echo \$dir
3782                         ;;
3783                 esac
3784         fi
3785         ;;
3786 *)
3787         echo \$1
3788         ;;
3789 esac
3790 EOSS
3791 chmod +x filexp
3792 $eunicefix filexp
3793
3794 : now set up to get a file name
3795 cat <<EOS >getfile
3796 $startsh
3797 EOS
3798 cat <<'EOSC' >>getfile
3799 tilde=''
3800 fullpath=''
3801 already=''
3802 skip=''
3803 none_ok=''
3804 exp_file=''
3805 nopath_ok=''
3806 orig_rp="$rp"
3807 orig_dflt="$dflt"
3808 case "$gfpth" in
3809 '') gfpth='.' ;;
3810 esac
3811
3812 case "$fn" in
3813 *\(*)
3814         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3815         fn=`echo $fn | sed 's/(.*)//'`
3816         ;;
3817 esac
3818
3819 case "$fn" in
3820 *:*)
3821         loc_file=`expr $fn : '.*:\(.*\)'`
3822         fn=`expr $fn : '\(.*\):.*'`
3823         ;;
3824 esac
3825
3826 case "$fn" in
3827 *~*) tilde=true;;
3828 esac
3829 case "$fn" in
3830 */*) fullpath=true;;
3831 esac
3832 case "$fn" in
3833 *+*) skip=true;;
3834 esac
3835 case "$fn" in
3836 *n*) none_ok=true;;
3837 esac
3838 case "$fn" in
3839 *e*) exp_file=true;;
3840 esac
3841 case "$fn" in
3842 *p*) nopath_ok=true;;
3843 esac
3844
3845 case "$fn" in
3846 *f*) type='File';;
3847 *d*) type='Directory';;
3848 *l*) type='Locate';;
3849 esac
3850
3851 what="$type"
3852 case "$what" in
3853 Locate) what='File';;
3854 esac
3855
3856 case "$exp_file" in
3857 '')
3858         case "$d_portable" in
3859         "$define") ;;
3860         *) exp_file=true;;
3861         esac
3862         ;;
3863 esac
3864
3865 cd ..
3866 while test "$type"; do
3867         redo=''
3868         rp="$orig_rp"
3869         dflt="$orig_dflt"
3870         case "$tilde" in
3871         true) rp="$rp (~name ok)";;
3872         esac
3873         . UU/myread
3874         if test -f UU/getfile.ok && \
3875                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3876         then
3877                 value="$ans"
3878                 ansexp="$ans"
3879                 break
3880         fi
3881         case "$ans" in
3882         none)
3883                 value=''
3884                 ansexp=''
3885                 case "$none_ok" in
3886                 true) type='';;
3887                 esac
3888                 ;;
3889         *)
3890                 case "$tilde" in
3891                 '') value="$ans"
3892                         ansexp="$ans";;
3893                 *)
3894                         value=`UU/filexp $ans`
3895                         case $? in
3896                         0)
3897                                 if test "$ans" != "$value"; then
3898                                         echo "(That expands to $value on this system.)"
3899                                 fi
3900                                 ;;
3901                         *) value="$ans";;
3902                         esac
3903                         ansexp="$value"
3904                         case "$exp_file" in
3905                         '') value="$ans";;
3906                         esac
3907                         ;;
3908                 esac
3909                 case "$fullpath" in
3910                 true)
3911                         case "$ansexp" in
3912                         /*) value="$ansexp" ;;
3913                         [a-zA-Z]:/*) value="$ansexp" ;;
3914                         *)
3915                                 redo=true
3916                                 case "$already" in
3917                                 true)
3918                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3919                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3920                                         ;;
3921                                 *)
3922                                 echo "Please give a full path name, starting with slash." >&4
3923                                         case "$tilde" in
3924                                         true)
3925                                 echo "Note that using ~name is ok provided it expands well." >&4
3926                                                 already=true
3927                                                 ;;
3928                                         esac
3929                                 esac
3930                                 ;;
3931                         esac
3932                         ;;
3933                 esac
3934                 case "$redo" in
3935                 '')
3936                         case "$type" in
3937                         File)
3938                                 for fp in $gfpth; do
3939                                         if test "X$fp" = X.; then
3940                                             pf="$ansexp"
3941                                         else    
3942                                             pf="$fp/$ansexp"
3943                                         fi
3944                                         if test -f "$pf"; then
3945                                                 type=''
3946                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3947                                         then
3948                                                 echo "($value is not a plain file, but that's ok.)"
3949                                                 type=''
3950                                         fi
3951                                         if test X"$type" = X; then
3952                                             value="$pf"
3953                                             break
3954                                         fi
3955                                 done
3956                                 ;;
3957                         Directory)
3958                                 for fp in $gfpth; do
3959                                         if test "X$fp" = X.; then
3960                                             dir="$ans"
3961                                             direxp="$ansexp"
3962                                         else    
3963                                             dir="$fp/$ansexp"
3964                                             direxp="$fp/$ansexp"
3965                                         fi
3966                                         if test -d "$direxp"; then
3967                                                 type=''
3968                                                 value="$dir"
3969                                                 break
3970                                         fi
3971                                 done
3972                                 ;;
3973                         Locate)
3974                                 if test -d "$ansexp"; then
3975                                         echo "(Looking for $loc_file in directory $value.)"
3976                                         value="$value/$loc_file"
3977                                         ansexp="$ansexp/$loc_file"
3978                                 fi
3979                                 if test -f "$ansexp"; then
3980                                         type=''
3981                                 fi
3982                                 case "$nopath_ok" in
3983                                 true)   case "$value" in
3984                                         */*) ;;
3985                                         *)      echo "Assuming $value will be in people's path."
3986                                                 type=''
3987                                                 ;;
3988                                         esac
3989                                         ;;
3990                                 esac
3991                                 ;;
3992                         esac
3993
3994                         case "$skip" in
3995                         true) type='';
3996                         esac
3997
3998                         case "$type" in
3999                         '') ;;
4000                         *)
4001                                 if test "$fastread" = yes; then
4002                                         dflt=y
4003                                 else
4004                                         dflt=n
4005                                 fi
4006                                 rp="$what $value doesn't exist.  Use that name anyway?"
4007                                 . UU/myread
4008                                 dflt=''
4009                                 case "$ans" in
4010                                 y*) type='';;
4011                                 *) echo " ";;
4012                                 esac
4013                                 ;;
4014                         esac
4015                         ;;
4016                 esac
4017                 ;;
4018         esac
4019 done
4020 cd UU
4021 ans="$value"
4022 rp="$orig_rp"
4023 dflt="$orig_dflt"
4024 rm -f getfile.ok
4025 test "X$gfpthkeep" != Xy && gfpth=""
4026 EOSC
4027
4028 : What should the include directory be ?
4029 echo " "
4030 $echo $n "Hmm...  $c"
4031 dflt='/usr/include'
4032 incpath=''
4033 mips_type=''
4034 if $test -f /bin/mips && /bin/mips; then
4035         echo "Looks like a MIPS system..."
4036         $cat >usr.c <<'EOCP'
4037 #ifdef SYSTYPE_BSD43
4038 /bsd43
4039 #endif
4040 EOCP
4041         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4042                 dflt='/bsd43/usr/include'
4043                 incpath='/bsd43'
4044                 mips_type='BSD 4.3'
4045         else
4046                 mips_type='System V'
4047         fi
4048         $rm -f usr.c usr.out
4049         echo "and you're compiling with the $mips_type compiler and libraries."
4050         xxx_prompt=y
4051         echo "exit 0" >mips
4052 else
4053         echo "Doesn't look like a MIPS system."
4054         xxx_prompt=n
4055         echo "exit 1" >mips
4056 fi
4057 chmod +x mips
4058 $eunicefix mips
4059 case "$usrinc" in
4060 '') ;;
4061 *) dflt="$usrinc";;
4062 esac
4063 case "$xxx_prompt" in
4064 y)      fn=d/
4065         echo " "
4066         rp='Where are the include files you want to use?'
4067         . ./getfile
4068         usrinc="$ans"
4069         ;;
4070 *)      usrinc="$dflt"
4071         ;;
4072 esac
4073
4074 : see how we invoke the C preprocessor
4075 echo " "
4076 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4077 cat <<'EOT' >testcpp.c
4078 #define ABC abc
4079 #define XYZ xyz
4080 ABC.XYZ
4081 EOT
4082 cd ..
4083 if test ! -f cppstdin; then
4084         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4085                 # AIX cc -E doesn't show the absolute headerfile
4086                 # locations but we'll cheat by using the -M flag.
4087                 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
4088         else
4089                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4090         fi
4091 else
4092         echo "Keeping your $hint cppstdin wrapper."
4093 fi
4094 chmod 755 cppstdin
4095 wrapper=`pwd`/cppstdin
4096 ok='false'
4097 cd UU
4098
4099 if $test "X$cppstdin" != "X" && \
4100         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4101         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4102 then
4103         echo "You used to use $cppstdin $cppminus so we'll use that again."
4104         case "$cpprun" in
4105         '') echo "But let's see if we can live without a wrapper..." ;;
4106         *)
4107                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4108                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4109                 then
4110                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4111                         ok='true'
4112                 else
4113                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4114                 fi
4115                 ;;
4116         esac
4117 else
4118         case "$cppstdin" in
4119         '') ;;
4120         *)
4121                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4122                 ;;
4123         esac
4124 fi
4125
4126 if $ok; then
4127         : nothing
4128 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4129         $cc -E <testcpp.c >testcpp.out 2>&1; \
4130         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4131         echo "Yup, it does."
4132         x_cpp="$cc -E"
4133         x_minus='';
4134 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4135         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4136         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4137         echo "Yup, it does."
4138         x_cpp="$cc -E"
4139         x_minus='-';
4140 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4141         $cc -P <testcpp.c >testcpp.out 2>&1; \
4142         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4143         echo "Yipee, that works!"
4144         x_cpp="$cc -P"
4145         x_minus='';
4146 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4147         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4148         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4149         echo "At long last!"
4150         x_cpp="$cc -P"
4151         x_minus='-';
4152 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4153         $cpp <testcpp.c >testcpp.out 2>&1; \
4154         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4155         echo "It works!"
4156         x_cpp="$cpp"
4157         x_minus='';
4158 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4159         $cpp - <testcpp.c >testcpp.out 2>&1; \
4160         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4161         echo "Hooray, it works!  I was beginning to wonder."
4162         x_cpp="$cpp"
4163         x_minus='-';
4164 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4165         $wrapper <testcpp.c >testcpp.out 2>&1; \
4166         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4167         x_cpp="$wrapper"
4168         x_minus=''
4169         echo "Eureka!"
4170 else
4171         dflt=''
4172         rp="No dice.  I can't find a C preprocessor.  Name one:"
4173         . ./myread
4174         x_cpp="$ans"
4175         x_minus=''
4176         $x_cpp <testcpp.c >testcpp.out 2>&1
4177         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4178                 echo "OK, that will do." >&4
4179         else
4180 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4181                 exit 1
4182         fi
4183 fi
4184
4185 case "$ok" in
4186 false)
4187         cppstdin="$x_cpp"
4188         cppminus="$x_minus"
4189         cpprun="$x_cpp"
4190         cpplast="$x_minus"
4191         set X $x_cpp
4192         shift
4193         case "$1" in
4194         "$cpp")
4195                 echo "Perhaps can we force $cc -E using a wrapper..."
4196                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4197                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4198                 then
4199                         echo "Yup, we can."
4200                         cppstdin="$wrapper"
4201                         cppminus='';
4202                 else
4203                         echo "Nope, we'll have to live without it..."
4204                 fi
4205                 ;;
4206         esac
4207         case "$cpprun" in
4208         "$wrapper")
4209                 cpprun=''
4210                 cpplast=''
4211                 ;;
4212         esac
4213         ;;
4214 esac
4215
4216 case "$cppstdin" in
4217 "$wrapper"|'cppstdin') ;;
4218 *) $rm -f $wrapper;;
4219 esac
4220 $rm -f testcpp.c testcpp.out
4221
4222 : Set private lib path
4223 case "$plibpth" in
4224 '') if ./mips; then
4225                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4226         fi;;
4227 esac
4228 case "$libpth" in
4229 ' ') dlist='';;
4230 '') dlist="$loclibpth $plibpth $glibpth";;
4231 *) dlist="$libpth";;
4232 esac
4233
4234 : Now check and see which directories actually exist, avoiding duplicates
4235 libpth=''
4236 for xxx in $dlist
4237 do
4238     if $test -d $xxx; then
4239                 case " $libpth " in
4240                 *" $xxx "*) ;;
4241                 *) libpth="$libpth $xxx";;
4242                 esac
4243     fi
4244 done
4245 $cat <<'EOM'
4246
4247 Some systems have incompatible or broken versions of libraries.  Among
4248 the directories listed in the question below, please remove any you
4249 know not to be holding relevant libraries, and add any that are needed.
4250 Say "none" for none.
4251
4252 EOM
4253 case "$libpth" in
4254 '') dflt='none';;
4255 *)
4256         set X $libpth
4257         shift
4258         dflt=${1+"$@"}
4259         ;;
4260 esac
4261 rp="Directories to use for library searches?"
4262 . ./myread
4263 case "$ans" in
4264 none) libpth=' ';;
4265 *) libpth="$ans";;
4266 esac
4267
4268 : compute shared library extension
4269 case "$so" in
4270 '')
4271         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4272                 dflt='sl'
4273         else
4274                 dflt='so'
4275         fi
4276         ;;
4277 *) dflt="$so";;
4278 esac
4279 $cat <<EOM
4280
4281 On some systems, shared libraries may be available.  Answer 'none' if
4282 you want to suppress searching of shared libraries for the remainder
4283 of this configuration.
4284
4285 EOM
4286 rp='What is the file extension used for shared libraries?'
4287 . ./myread
4288 so="$ans"
4289
4290 : Define several unixisms.
4291 : Hints files or command line option can be used to override them.
4292 : The convoluted testing is in case hints files set either the old
4293 : or the new name.
4294 case "$_exe" in
4295 '')     case "$exe_ext" in
4296         '')     ;;
4297         *)      _exe="$exe_ext" ;;
4298         esac
4299         ;;
4300 esac
4301 case "$_a" in
4302 '')     case "$lib_ext" in
4303     '') _a='.a';;
4304         *)      _a="$lib_ext" ;;
4305         esac
4306         ;;
4307 esac
4308 case "$_o" in
4309 '') case "$obj_ext" in
4310         '')     _o='.o';;
4311         *)      _o="$obj_ext";;
4312         esac
4313         ;;
4314 esac
4315 case "$p_" in
4316 '') case "$path_sep" in
4317         '')     p_=':';;
4318         *)      p_="$path_sep";;
4319         esac
4320         ;;
4321 esac
4322 exe_ext=$_exe
4323 lib_ext=$_a
4324 obj_ext=$_o
4325 path_sep=$p_
4326
4327 : Which makefile gets called first.  This is used by make depend.
4328 case "$firstmakefile" in
4329 '') firstmakefile='makefile';;
4330 esac
4331
4332 case "$usesocks" in
4333 $define|true|[yY]*)     dflt='y';;
4334 *) dflt='n';;
4335 esac
4336 cat <<EOM
4337
4338 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4339 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4340 to use the PerlIO abstraction layer, this will be implicitly selected.
4341
4342 If this doesn't make any sense to you, just accept the default '$dflt'.
4343 EOM
4344 rp='Build Perl for SOCKS?'
4345 . ./myread
4346 case "$ans" in
4347 y|Y)    val="$define" ;;     
4348 *)      val="$undef" ;;
4349 esac
4350 set usesocks
4351 eval $setvar
4352
4353 case "$usesocks" in
4354 $define|true|[yY]*) useperlio="$define";;
4355 esac
4356
4357 : Looking for optional libraries
4358 echo " "
4359 echo "Checking for optional libraries..." >&4
4360 case "$libs" in
4361 ' '|'') dflt='';;
4362 *) dflt="$libs";;
4363 esac
4364 case "$libswanted" in
4365 '') libswanted='c_s';;
4366 esac
4367 case "$usesocks" in
4368 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4369 esac
4370 libsfound=''
4371 libsfiles=''
4372 libsdirs=''
4373 libspath=''
4374 for thisdir in $libpth $xlibpth; do
4375   test -d $thisdir && libspath="$libspath $thisdir"
4376 done
4377 for thislib in $libswanted; do
4378         for thisdir in $libspath; do
4379             xxx=''
4380             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4381                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4382                 $test -f "$xxx" && eval $libscheck
4383                 $test -f "$xxx" && libstyle=shared
4384             fi
4385             if test ! -f "$xxx"; then
4386                 xxx=$thisdir/lib$thislib.$so
4387                 $test -f "$xxx" && eval $libscheck
4388                 $test -f "$xxx" && libstyle=shared
4389             fi  
4390             if test ! -f "$xxx"; then
4391                 xxx=$thisdir/lib$thislib$_a
4392                 $test -f "$xxx" && eval $libscheck
4393                 $test -f "$xxx" && libstyle=static
4394             fi
4395             if test ! -f "$xxx"; then
4396                 xxx=$thisdir/$thislib$_a
4397                 $test -f "$xxx" && eval $libscheck
4398                 $test -f "$xxx" && libstyle=static
4399             fi
4400             if test ! -f "$xxx"; then
4401                 xxx=$thisdir/lib${thislib}_s$_a
4402                 $test -f "$xxx" && eval $libscheck
4403                 $test -f "$xxx" && libstyle=static
4404                 $test -f "$xxx" && thislib=${thislib}_s
4405             fi
4406             if test ! -f "$xxx"; then
4407                 xxx=$thisdir/Slib$thislib$_a
4408                 $test -f "$xxx" && eval $libscheck
4409                 $test -f "$xxx" && libstyle=static
4410             fi
4411             if $test -f "$xxx"; then
4412                 case "$libstyle" in
4413                 shared) echo "Found -l$thislib (shared)." ;;
4414                 static) echo "Found -l$thislib." ;;
4415                 *)      echo "Found -l$thislib ($libstyle)." ;;
4416                 esac
4417                 case " $dflt " in
4418                 *"-l$thislib "*);;
4419                 *) dflt="$dflt -l$thislib"
4420                    libsfound="$libsfound $xxx"
4421                    yyy=`basename $xxx`
4422                    libsfiles="$libsfiles $yyy"
4423                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4424                    case " $libsdirs " in
4425                    *" $yyy "*) ;;
4426                    *) libsdirs="$libsdirs $yyy" ;;
4427                    esac
4428                    ;;
4429                 esac
4430                 break
4431             fi  
4432         done
4433         if $test ! -f "$xxx"; then
4434             echo "No -l$thislib."
4435         fi
4436 done
4437 set X $dflt
4438 shift
4439 dflt="$*"
4440 case "$libs" in
4441 '') dflt="$dflt";;
4442 *) dflt="$libs";;
4443 esac
4444 case "$dflt" in
4445 ' '|'') dflt='none';;
4446 esac
4447
4448 $cat <<EOM
4449
4450 In order to compile $package on your machine, a number of libraries
4451 are usually needed.  Include any other special libraries here as well.
4452 Say "none" for none.  The default list is almost always right.
4453 EOM
4454
4455 echo " "
4456 rp="What libraries to use?"
4457 . ./myread
4458 case "$ans" in
4459 none) libs=' ';;
4460 *) libs="$ans";;
4461 esac
4462
4463 : determine optimization, if desired, or use for debug flag also
4464 case "$optimize" in
4465 ' '|$undef) dflt='none';;
4466 '') dflt='-O';;
4467 *) dflt="$optimize";;
4468 esac
4469 $cat <<EOH
4470
4471 By default, $package compiles with the -O flag to use the optimizer.
4472 Alternately, you might want to use the symbolic debugger, which uses
4473 the -g flag (on traditional Unix systems).  Either flag can be
4474 specified here.  To use neither flag, specify the word "none".
4475
4476 EOH
4477 rp="What optimizer/debugger flag should be used?"
4478 . ./myread
4479 optimize="$ans"
4480 case "$optimize" in
4481 'none') optimize=" ";;
4482 esac
4483
4484 dflt=''
4485 : We will not override a previous value, but we might want to
4486 : augment a hint file
4487 case "$hint" in
4488 default|recommended)
4489         case "$gccversion" in
4490         1*) dflt='-fpcc-struct-return' ;;
4491         esac
4492         case "$optimize" in
4493         *-g*) dflt="$dflt -DDEBUGGING";;
4494         esac
4495         case "$gccversion" in
4496         2*) if test -d /etc/conf/kconfig.d &&
4497                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4498                 then
4499                         dflt="$dflt -posix"
4500                 fi
4501                 ;;
4502         esac
4503         case "$gccversion" in
4504         1*) ;;
4505         2.[0-8]*) ;;
4506         ?*)     echo " "
4507                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4508                 echo 'int main(void) { return 0; }' > gcctest.c
4509                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4510                         echo "Yes, it does." 2>&1
4511                         case "$ccflags" in
4512                         *strict-aliasing*) 
4513                                 echo "Leaving current flags $ccflags alone." 2>&1
4514                                 ;;
4515                         *) dflt="$dflt -fno-strict-aliasing" ;;
4516                         esac
4517                 else
4518                         echo "Nope, it doesn't, but that's ok." 2>&1
4519                 fi
4520                 ;;
4521         esac
4522         ;;
4523 esac
4524
4525 case "$mips_type" in
4526 *BSD*|'') inclwanted="$locincpth $usrinc";;
4527 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4528 esac
4529 for thisincl in $inclwanted; do
4530         if $test -d $thisincl; then
4531                 if $test x$thisincl != x$usrinc; then
4532                         case "$dflt" in
4533                         *" -I$thisincl "*);;
4534                         *) dflt="$dflt -I$thisincl ";;
4535                         esac
4536                 fi
4537         fi
4538 done
4539
4540 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4541         xxx=true;
4542 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4543         xxx=true;
4544 else
4545         xxx=false;
4546 fi;
4547 if $xxx; then
4548         case "$dflt" in
4549         *$2*);;
4550         *) dflt="$dflt -D$2";;
4551         esac;
4552 fi'
4553
4554 set signal.h LANGUAGE_C; eval $inctest
4555
4556 case "$usesocks" in
4557 $define)
4558         ccflags="$ccflags -DSOCKS"
4559         ;;
4560 esac
4561
4562 case "$hint" in
4563 default|recommended) dflt="$ccflags $dflt" ;;
4564 *) dflt="$ccflags";;
4565 esac
4566
4567 case "$dflt" in
4568 ''|' ') dflt=none;;
4569 esac
4570
4571 $cat <<EOH
4572
4573 Your C compiler may want other flags.  For this question you should include
4574 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4575 but you should NOT include libraries or ld flags like -lwhatever.  If you
4576 want $package to honor its debug switch, you should include -DDEBUGGING here.
4577 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4578
4579 To use no flags, specify the word "none".
4580
4581 EOH
4582 set X $dflt
4583 shift
4584 dflt=${1+"$@"}
4585 rp="Any additional cc flags?"
4586 . ./myread
4587 case "$ans" in
4588 none) ccflags='';;
4589 *) ccflags="$ans";;
4590 esac
4591
4592 : the following weeds options from ccflags that are of no interest to cpp
4593 case "$cppflags" in
4594 '') cppflags="$ccflags" ;;
4595 *)  cppflags="$cppflags $ccflags" ;;
4596 esac
4597 case "$gccversion" in
4598 1*) cppflags="$cppflags -D__GNUC__"
4599 esac
4600 case "$mips_type" in
4601 '');;
4602 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4603 esac
4604 case "$cppflags" in
4605 '');;
4606 *)
4607         echo " "
4608         echo "Let me guess what the preprocessor flags are..." >&4
4609         set X $cppflags
4610         shift
4611         cppflags=''
4612         $cat >cpp.c <<'EOM'
4613 #define BLURFL foo
4614
4615 BLURFL xx LFRULB
4616 EOM
4617         previous=''
4618         for flag in $*
4619         do
4620                 case "$flag" in
4621                 -*) ftry="$flag";;
4622                 *) ftry="$previous $flag";;
4623                 esac
4624                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4625                         >cpp1.out 2>/dev/null && \
4626                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4627                         >cpp2.out 2>/dev/null && \
4628                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4629                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4630                 then
4631                         cppflags="$cppflags $ftry"
4632                         previous=''
4633                 else
4634                         previous="$flag"
4635                 fi
4636         done
4637         set X $cppflags
4638         shift
4639         cppflags=${1+"$@"}
4640         case "$cppflags" in
4641         *-*)  echo "They appear to be: $cppflags";;
4642         esac
4643         $rm -f cpp.c cpp?.out
4644         ;;
4645 esac
4646
4647 : flags used in final linking phase
4648 case "$ldflags" in
4649 '') if ./venix; then
4650                 dflt='-i -z'
4651         else
4652                 dflt=''
4653         fi
4654         case "$ccflags" in
4655         *-posix*) dflt="$dflt -posix" ;;
4656         esac
4657         ;;
4658 *) dflt="$ldflags";;
4659 esac
4660
4661 : Try to guess additional flags to pick up local libraries.
4662 for thislibdir in $libpth; do
4663         case " $loclibpth " in
4664         *" $thislibdir "*)
4665                 case "$dflt " in 
4666                 *"-L$thislibdir "*) ;;
4667                 *)  dflt="$dflt -L$thislibdir" ;;
4668                 esac
4669                 ;;
4670         esac
4671 done
4672
4673 case "$dflt" in
4674 '') dflt='none' ;;
4675 esac
4676
4677 $cat <<EOH
4678
4679 Your C linker may need flags.  For this question you should
4680 include -L/whatever and any other flags used by the C linker, but you
4681 should NOT include libraries like -lwhatever.
4682
4683 Make sure you include the appropriate -L/path flags if your C linker
4684 does not normally search all of the directories you specified above,
4685 namely
4686         $libpth
4687 To use no flags, specify the word "none".
4688
4689 EOH
4690
4691 rp="Any additional ld flags (NOT including libraries)?"
4692 . ./myread
4693 case "$ans" in
4694 none) ldflags='';;
4695 *) ldflags="$ans";;
4696 esac
4697 rmlist="$rmlist pdp11"
4698
4699 : coherency check
4700 echo " "
4701 echo "Checking your choice of C compiler and flags for coherency..." >&4
4702 $cat > try.c <<'EOF'
4703 #include <stdio.h>
4704 int main() { printf("Ok\n"); exit(0); }
4705 EOF
4706 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4707 shift
4708 $cat >try.msg <<'EOM'
4709 I've tried to compile and run the following simple program:
4710
4711 EOM
4712 $cat try.c >> try.msg
4713
4714 $cat >> try.msg <<EOM
4715
4716 I used the command:
4717
4718         $*
4719         $run ./try
4720
4721 and I got the following output:
4722
4723 EOM
4724 dflt=y
4725 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4726         if $sh -c "$run ./try" >>try.msg 2>&1; then
4727                 xxx=`$run ./try`
4728                 case "$xxx" in
4729                 "Ok") dflt=n ;;
4730                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4731                         case " $libs " in
4732                         *" -lsfio "*)
4733                                 cat >> try.msg <<'EOQS'
4734 If $libs contains -lsfio, and sfio is mis-configured, then it
4735 sometimes (apparently) runs and exits with a 0 status, but with no
4736 output!  It may have to do with sfio's use of _exit vs. exit.
4737
4738 EOQS
4739                                 rp="You have a big problem.  Shall I abort Configure"
4740                                 dflt=y
4741                                 ;;
4742                         esac
4743                         ;;
4744                 esac
4745         else
4746                 echo "The program compiled OK, but exited with status $?." >>try.msg
4747                 rp="You have a problem.  Shall I abort Configure"
4748                 dflt=y
4749         fi
4750 else
4751         echo "I can't compile the test program." >>try.msg
4752         rp="You have a BIG problem.  Shall I abort Configure"
4753         dflt=y
4754 fi
4755 case "$dflt" in
4756 y)
4757         $cat try.msg >&4
4758         case "$knowitall" in
4759         '')
4760                 echo "(The supplied flags or libraries might be incorrect.)"
4761                 ;;
4762         *) dflt=n;;
4763         esac
4764         echo " "
4765         . ./myread
4766         case "$ans" in
4767         n*|N*) ;;
4768         *)      echo "Ok.  Stopping Configure." >&4
4769                 exit 1
4770                 ;;
4771         esac
4772         ;;
4773 n) echo "OK, that should do.";;
4774 esac
4775 $rm -f try try.* core
4776
4777 : define a shorthand compile call
4778 compile='
4779 mc_file=$1;
4780 shift;
4781 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4782 : define a shorthand compile call for compilations that should be ok.
4783 compile_ok='
4784 mc_file=$1;
4785 shift;
4786 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4787
4788 : check for lengths of integral types
4789 echo " "
4790 case "$intsize" in
4791 '')
4792         echo "Checking to see how big your integers are..." >&4
4793         $cat >try.c <<'EOCP'
4794 #include <stdio.h>
4795 int main()
4796 {
4797         printf("intsize=%d;\n", (int)sizeof(int));
4798         printf("longsize=%d;\n", (int)sizeof(long));
4799         printf("shortsize=%d;\n", (int)sizeof(short));
4800         exit(0);
4801 }
4802 EOCP
4803         set try
4804         if eval $compile_ok && $run ./try > /dev/null; then
4805                 eval `$run ./try`
4806                 echo "Your integers are $intsize bytes long."
4807                 echo "Your long integers are $longsize bytes long."
4808                 echo "Your short integers are $shortsize bytes long."
4809         else
4810                 $cat >&4 <<EOM
4811 !
4812 Help! I can't compile and run the intsize test program: please enlighten me!
4813 (This is probably a misconfiguration in your system or libraries, and
4814 you really ought to fix it.  Still, I'll try anyway.)
4815 !
4816 EOM
4817                 dflt=4
4818                 rp="What is the size of an integer (in bytes)?"
4819                 . ./myread
4820                 intsize="$ans"
4821                 dflt=$intsize
4822                 rp="What is the size of a long integer (in bytes)?"
4823                 . ./myread
4824                 longsize="$ans"
4825                 dflt=2
4826                 rp="What is the size of a short integer (in bytes)?"
4827                 . ./myread
4828                 shortsize="$ans"
4829         fi
4830         ;;
4831 esac
4832 $rm -f try try.*
4833
4834 : check for void type
4835 echo " "
4836 echo "Checking to see how well your C compiler groks the void type..." >&4
4837 case "$voidflags" in
4838 '')
4839         $cat >try.c <<'EOCP'
4840 #if TRY & 1
4841 void sub() {
4842 #else
4843 sub() {
4844 #endif
4845         extern void moo();      /* function returning void */
4846         void (*goo)();          /* ptr to func returning void */
4847 #if TRY & 8
4848         void *hue;              /* generic ptr */
4849 #endif
4850 #if TRY & 2
4851         void (*foo[10])();
4852 #endif
4853
4854 #if TRY & 4
4855         if(goo == moo) {
4856                 exit(0);
4857         }
4858 #endif
4859         exit(0);
4860 }
4861 int main() { sub(); }
4862 EOCP
4863         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4864                 voidflags=$defvoidused
4865         echo "Good.  It appears to support void to the level $package wants.">&4
4866                 if $contains warning .out >/dev/null 2>&1; then
4867                         echo "However, you might get some warnings that look like this:"
4868                         $cat .out
4869                 fi
4870         else
4871 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4872                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4873                         echo "It supports 1..."
4874                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4875                                 echo "It also supports 2..."
4876                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4877                                         voidflags=7
4878                                         echo "And it supports 4 but not 8 definitely."
4879                                 else
4880                                         echo "It doesn't support 4..."
4881                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4882                                                 voidflags=11
4883                                                 echo "But it supports 8."
4884                                         else
4885                                                 voidflags=3
4886                                                 echo "Neither does it support 8."
4887                                         fi
4888                                 fi
4889                         else
4890                                 echo "It does not support 2..."
4891                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4892                                         voidflags=13
4893                                         echo "But it supports 4 and 8."
4894                                 else
4895                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4896                                                 voidflags=5
4897                                                 echo "And it supports 4 but has not heard about 8."
4898                                         else
4899                                                 echo "However it supports 8 but not 4."
4900                                         fi
4901                                 fi
4902                         fi
4903                 else
4904                         echo "There is no support at all for void."
4905                         voidflags=0
4906                 fi
4907         fi
4908 esac
4909 case "$voidflags" in
4910 "$defvoidused") ;;
4911 *)      $cat >&4 <<'EOM'
4912   Support flag bits are:
4913     1: basic void declarations.
4914     2: arrays of pointers to functions returning void.
4915     4: operations between pointers to and addresses of void functions.
4916     8: generic void pointers.
4917 EOM
4918         dflt="$voidflags";
4919         rp="Your void support flags add up to what?"
4920         . ./myread
4921         voidflags="$ans"
4922         ;;
4923 esac
4924 $rm -f try.* .out
4925
4926 : check for length of pointer
4927 echo " "
4928 case "$ptrsize" in
4929 '')
4930         echo "Checking to see how big your pointers are..." >&4
4931         if test "$voidflags" -gt 7; then
4932                 echo '#define VOID_PTR char *' > try.c
4933         else
4934                 echo '#define VOID_PTR void *' > try.c
4935         fi
4936         $cat >>try.c <<'EOCP'
4937 #include <stdio.h>
4938 int main()
4939 {
4940     printf("%d\n", (int)sizeof(VOID_PTR));
4941     exit(0);
4942 }
4943 EOCP
4944         set try
4945         if eval $compile_ok; then
4946                 ptrsize=`$run ./try`
4947                 echo "Your pointers are $ptrsize bytes long."
4948         else
4949                 dflt='4'
4950                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4951                 rp="What is the size of a pointer (in bytes)?"
4952                 . ./myread
4953                 ptrsize="$ans"
4954         fi
4955         ;;
4956 esac
4957 $rm -f try.c try
4958
4959 : check for long long
4960 echo " "
4961 echo "Checking to see if you have long long..." >&4
4962 echo 'int main() { long long x = 7; return 0; }' > try.c
4963 set try
4964 if eval $compile; then
4965         val="$define"
4966         echo "You have long long."
4967 else
4968         val="$undef"
4969         echo "You do not have long long."
4970 fi
4971 $rm try.*
4972 set d_longlong
4973 eval $setvar
4974
4975 : check for length of long long
4976 case "${d_longlong}${longlongsize}" in
4977 $define)
4978         echo " "
4979         echo "Checking to see how big your long longs are..." >&4
4980         $cat >try.c <<'EOCP'
4981 #include <stdio.h>
4982 int main()
4983 {
4984     printf("%d\n", (int)sizeof(long long));
4985     return(0);
4986 }
4987 EOCP
4988         set try
4989         if eval $compile_ok; then
4990                 longlongsize=`$run ./try`
4991                 echo "Your long longs are $longlongsize bytes long."
4992         else
4993                 dflt='8'
4994                 echo " "
4995                 echo "(I can't seem to compile the test program.  Guessing...)"
4996                 rp="What is the size of a long long (in bytes)?"
4997                 . ./myread
4998                 longlongsize="$ans"
4999         fi
5000         if $test "X$longsize" = "X$longlongsize"; then
5001                 echo "(That isn't any different from an ordinary long.)"
5002         fi      
5003         ;;
5004 esac
5005 $rm -f try.* try
5006
5007 : determine filename position in cpp output
5008 echo " "
5009 echo "Computing filename position in cpp output for #include directives..." >&4
5010 case "$osname" in
5011 vos) testaccess=-e ;;
5012 *)   testaccess=-r ;;
5013 esac
5014 echo '#include <stdio.h>' > foo.c
5015 $cat >fieldn <<EOF
5016 $startsh
5017 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5018 $grep '^[       ]*#.*stdio\.h' | \
5019 while read cline; do
5020         pos=1
5021         set \$cline
5022         while $test \$# -gt 0; do
5023                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5024                         echo "\$pos"
5025                         exit 0
5026                 fi
5027                 shift
5028                 pos=\`expr \$pos + 1\`
5029         done
5030 done
5031 EOF
5032 chmod +x fieldn
5033 fieldn=`./fieldn`
5034 $rm -f foo.c fieldn
5035 case $fieldn in
5036 '') pos='???';;
5037 1) pos=first;;
5038 2) pos=second;;
5039 3) pos=third;;
5040 *) pos="${fieldn}th";;
5041 esac
5042 echo "Your cpp writes the filename in the $pos field of the line."
5043
5044 case "$osname" in
5045 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5046 *)   cppfilter='' ;;
5047 esac
5048 : locate header file
5049 $cat >findhdr <<EOF
5050 $startsh
5051 wanted=\$1
5052 name=''
5053 for usrincdir in $usrinc
5054 do
5055         if test -f \$usrincdir/\$wanted; then
5056                 echo "\$usrincdir/\$wanted"
5057                 exit 0
5058         fi
5059 done
5060 awkprg='{ print \$$fieldn }'
5061 echo "#include <\$wanted>" > foo\$\$.c
5062 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5063 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5064 while read cline; do
5065         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5066         case "\$name" in
5067         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5068         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5069         *) exit 2;;
5070         esac;
5071 done;
5072 #
5073 # status = 0: grep returned 0 lines, case statement not executed
5074 # status = 1: headerfile found
5075 # status = 2: while loop executed, no headerfile found
5076 #
5077 status=\$?
5078 $rm -f foo\$\$.c;
5079 if test \$status -eq 1; then
5080         exit 0;
5081 fi
5082 exit 1
5083 EOF
5084 chmod +x findhdr
5085
5086 : define an alternate in-header-list? function
5087 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5088 cont=true; xxf="echo \"<\$1> found.\" >&4";
5089 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5090 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5091 esac;
5092 case $# in 4) instead=instead;; *) instead="at last";; esac;
5093 while $test "$cont"; do
5094         xxx=`./findhdr $1`
5095         var=$2; eval "was=\$$2";
5096         if $test "$xxx" && $test -r "$xxx";
5097         then eval $xxf;
5098         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5099                 cont="";
5100         else eval $xxnf;
5101         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5102         set $yyy; shift; shift; yyy=$@;
5103         case $# in 0) cont="";;
5104         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5105                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5106         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5107                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5108         esac;
5109 done;
5110 while $test "$yyy";
5111 do set $yyy; var=$2; eval "was=\$$2";
5112         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5113         set $yyy; shift; shift; yyy=$@;
5114 done'
5115
5116 : see if inttypes.h is available
5117 : we want a real compile instead of Inhdr because some systems
5118 : have an inttypes.h which includes non-existent headers
5119 echo " "
5120 $cat >try.c <<EOCP
5121 #include <inttypes.h>
5122 int main() {
5123         static int32_t foo32 = 0x12345678;
5124 }
5125 EOCP
5126 set try
5127 if eval $compile; then
5128         echo "<inttypes.h> found." >&4
5129         val="$define"
5130 else
5131         echo "<inttypes.h> NOT found." >&4
5132         val="$undef"
5133 fi
5134 $rm -f try.c try
5135 set i_inttypes
5136 eval $setvar
5137
5138 : check for int64_t
5139 echo " "
5140 echo "Checking to see if you have int64_t..." >&4
5141 $cat >try.c <<EOCP
5142 #include <sys/types.h>
5143 #$i_inttypes I_INTTYPES
5144 #ifdef I_INTTYPES
5145 #include <inttypes.h>
5146 #endif
5147 int main() { int64_t x = 7; }
5148 EOCP
5149 set try
5150 if eval $compile; then
5151         val="$define"
5152         echo "You have int64_t."
5153 else
5154         val="$undef"
5155         echo "You do not have int64_t."
5156 fi
5157 $rm -f try try.*
5158 set d_int64_t
5159 eval $setvar
5160
5161
5162 echo " "
5163 echo "Checking which 64-bit integer type we could use..." >&4
5164
5165 case "$intsize" in
5166 8) val=int
5167    set quadtype
5168    eval $setvar
5169    val='"unsigned int"'
5170    set uquadtype
5171    eval $setvar
5172    quadkind=1
5173    ;;
5174 *) case "$longsize" in
5175    8) val=long
5176       set quadtype
5177       eval $setvar
5178       val='"unsigned long"'
5179       set uquadtype
5180       eval $setvar
5181       quadkind=2
5182       ;;
5183    *) case "$d_longlong:$longlongsize" in
5184       define:8)
5185         val='"long long"'
5186         set quadtype
5187         eval $setvar
5188         val='"unsigned long long"'
5189         set uquadtype
5190         eval $setvar
5191         quadkind=3
5192         ;;
5193       *) case "$d_int64_t" in
5194          define)
5195            val=int64_t
5196            set quadtype
5197            eval $setvar
5198            val=uint64_t
5199            set uquadtype
5200            eval $setvar
5201            quadkind=4
5202            ;;
5203          esac
5204          ;;
5205       esac
5206       ;;
5207    esac
5208    ;;
5209 esac
5210
5211 case "$quadtype" in
5212 '')     echo "Alas, no 64-bit integer types in sight." >&4
5213         d_quad="$undef"
5214         ;;
5215 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5216         d_quad="$define"
5217         ;;
5218 esac
5219
5220
5221 case "$uselonglong" in
5222 "$define"|true|[yY]*)
5223         cat <<EOM >&4
5224
5225 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5226 EOM
5227         use64bitint="$define"
5228         ;;
5229 esac                          
5230 case "$use64bits" in
5231 "$define"|true|[yY]*)
5232         cat <<EOM >&4
5233
5234 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5235 EOM
5236         use64bitint="$define"
5237         ;;
5238 esac                          
5239 case "$use64bitints" in
5240 "$define"|true|[yY]*)
5241         cat <<EOM >&4
5242
5243 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5244 EOM
5245         use64bitint="$define"
5246         ;;
5247 esac                          
5248 case "$use64bitsint" in
5249 "$define"|true|[yY]*)
5250         cat <<EOM >&4
5251
5252 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5253 EOM
5254         use64bitint="$define"
5255         ;;
5256 esac                          
5257 case "$uselonglongs" in
5258 "$define"|true|[yY]*)
5259         cat <<EOM >&4
5260
5261 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5262 EOM
5263         use64bitint="$define"
5264         ;;
5265 esac                          
5266 case "$use64bitsall" in
5267 "$define"|true|[yY]*)
5268         cat <<EOM >&4
5269
5270 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5271 EOM
5272         use64bitall="$define"
5273         ;;
5274 esac                          
5275
5276 case "$ccflags" in
5277 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5278 esac
5279 case "$use64bitall" in
5280 "$define"|true|[yY]*) use64bitint="$define" ;;
5281 esac
5282
5283 case "$longsize" in
5284 8) cat <<EOM
5285
5286 You have natively 64-bit long integers.
5287 EOM
5288    val="$define"
5289    ;;
5290 *) case "$use64bitint" in
5291    "$define"|true|[yY]*) dflt='y';;
5292    *) dflt='n';;
5293    esac
5294    case "$d_quad" in
5295    "$define") ;;
5296    *) dflt='n' ;;
5297    esac
5298    cat <<EOM
5299
5300 Perl can be built to take advantage of 64-bit integer types
5301 on some systems.  To do so, Configure can be run with -Duse64bitint.
5302 Choosing this option will most probably introduce binary incompatibilities.
5303
5304 If this doesn't make any sense to you, just accept the default '$dflt'.
5305 (The default has been chosen based on your configuration.)
5306 EOM
5307    rp='Try to use 64-bit integers, if available?'
5308    . ./myread
5309    case "$ans" in
5310    [yY]*) val="$define" ;;
5311    *)     val="$undef"  ;;
5312    esac
5313    ;;
5314 esac
5315 set use64bitint
5316 eval $setvar
5317
5318 case "$use64bitall" in
5319 "$define"|true|[yY]*) dflt='y' ;;
5320 *) case "$longsize" in
5321    8) dflt='y' ;;
5322    *) dflt='n' ;;
5323    esac
5324    ;;
5325 esac    
5326 cat <<EOM
5327
5328 You may also choose to try maximal 64-bitness.  It means using as much
5329 64-bitness as possible on the platform.  This in turn means even more
5330 binary incompatibilities.  On the other hand, your platform may not
5331 have any more 64-bitness available than what you already have chosen.
5332
5333 If this doesn't make any sense to you, just accept the default '$dflt'.
5334 (The default has been chosen based on your configuration.)
5335 EOM
5336 rp='Try to use maximal 64-bit support, if available?'
5337 . ./myread
5338 case "$ans" in
5339 [yY]*) val="$define" ;;
5340 *)     val="$undef"  ;;
5341 esac
5342 set use64bitall
5343 eval $setvar
5344 case "$use64bitall" in
5345 "$define")
5346         case "$use64bitint" in
5347         "$undef")
5348                 cat <<EOM
5349
5350 Since you have chosen a maximally 64-bit build, I'm also turning on
5351 the use of 64-bit integers.
5352 EOM
5353                 use64bitint="$define" ;;
5354         esac
5355         ;;
5356 esac
5357
5358 case "$use64bitall" in
5359 "$define"|true|[yY]*)
5360         case "$ptrsize" in
5361         4)      cat <<EOM >&4
5362
5363 *** You have chosen a maximally 64-bit build, but your pointers
5364 *** are only 4 bytes wide, disabling maximal 64-bitness.
5365
5366 EOM
5367                 use64bitall="$undef"
5368                 case "$use64bitint" in
5369                 "$define"|true|[yY]*) ;;
5370                 *)      cat <<EOM >&4
5371
5372 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5373
5374 EOM
5375                         use64bitint="$define"
5376                         ;;
5377                 esac
5378                 ;;
5379         esac
5380         ;;
5381 esac
5382
5383 case "$use64bitint" in
5384 "$define"|true|[yY]*)
5385 : Look for a hint-file generated 'call-back-unit'.  If the
5386 : user has specified that a 64-bit perl is to be built,
5387 : we may need to set or change some other defaults.
5388         if $test -f use64bitint.cbu; then
5389                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5390                 . ./use64bitint.cbu
5391         fi
5392         case "$longsize" in
5393         4) case "$archname64" in
5394            '') archname64=64int ;;
5395            esac
5396            ;;
5397         esac
5398         ;;
5399 esac
5400
5401 case "$use64bitall" in
5402 "$define"|true|[yY]*)
5403 : Look for a hint-file generated 'call-back-unit'.  If the
5404 : user has specified that a maximally 64-bit perl is to be built,
5405 : we may need to set or change some other defaults.
5406         if $test -f use64bitall.cbu; then
5407                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5408                 . ./use64bitall.cbu
5409         fi
5410         case "$longsize" in
5411         4) case "$archname64" in
5412            ''|64int) archname64=64all ;;
5413            esac
5414            ;;
5415         esac
5416         ;;
5417 esac
5418
5419 echo " "
5420 echo "Checking for GNU C Library..." >&4
5421 cat >try.c <<EOM
5422 #include <stdio.h>
5423 int main()
5424 {
5425 #ifdef __GLIBC__
5426     exit(0);
5427 #else
5428     exit(1);
5429 #endif
5430 }
5431 EOM
5432 set try
5433 if eval $compile_ok && $run ./try; then
5434         val="$define"
5435         echo "You are using the GNU C Library"
5436 else
5437         val="$undef"
5438         echo "You are not using the GNU C Library"
5439 fi
5440 $rm -f try try.*
5441 set d_gnulibc
5442 eval $setvar
5443
5444 : see if nm is to be used to determine whether a symbol is defined or not
5445 case "$usenm" in
5446 '')
5447         dflt=''
5448         case "$d_gnulibc" in
5449         "$define")
5450                 echo " "
5451                 echo "nm probably won't work on the GNU C Library." >&4
5452                 dflt=n
5453                 ;;
5454         esac
5455         case "$dflt" in
5456         '') 
5457                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5458                         echo " "
5459                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5460                         echo "'nm' won't be sufficient on this sytem." >&4
5461                         dflt=n
5462                 fi
5463                 ;;
5464         esac
5465         case "$dflt" in
5466         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5467                 if $test $dflt -gt 20; then
5468                         dflt=y
5469                 else
5470                         dflt=n
5471                 fi
5472                 ;;
5473         esac
5474         ;;
5475 *)
5476         case "$usenm" in
5477         true|$define) dflt=y;;
5478         *) dflt=n;;
5479         esac
5480         ;;
5481 esac
5482 $cat <<EOM
5483
5484 I can use $nm to extract the symbols from your C libraries. This
5485 is a time consuming task which may generate huge output on the disk (up
5486 to 3 megabytes) but that should make the symbols extraction faster. The
5487 alternative is to skip the 'nm' extraction part and to compile a small
5488 test program instead to determine whether each symbol is present. If
5489 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5490 this may be the best solution.
5491
5492 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5493
5494 EOM
5495 rp="Shall I use $nm to extract C symbols from the libraries?"
5496 . ./myread
5497 case "$ans" in
5498 [Nn]*) usenm=false;;
5499 *) usenm=true;;
5500 esac
5501
5502 runnm=$usenm
5503 case "$reuseval" in
5504 true) runnm=false;;
5505 esac
5506
5507 : nm options which may be necessary
5508 case "$nm_opt" in
5509 '') if $test -f /mach_boot; then
5510                 nm_opt=''       # Mach
5511         elif $test -d /usr/ccs/lib; then
5512                 nm_opt='-p'     # Solaris (and SunOS?)
5513         elif $test -f /dgux; then
5514                 nm_opt='-p'     # DG-UX
5515         elif $test -f /lib64/rld; then
5516                 nm_opt='-p'     # 64-bit Irix
5517         else
5518                 nm_opt=''
5519         fi;;
5520 esac
5521
5522 : nm options which may be necessary for shared libraries but illegal
5523 : for archive libraries.  Thank you, Linux.
5524 case "$nm_so_opt" in
5525 '')     case "$myuname" in
5526         *linux*)
5527                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5528                         nm_so_opt='--dynamic'
5529                 fi
5530                 ;;
5531         esac
5532         ;;
5533 esac
5534
5535 case "$runnm" in
5536 true)
5537 : get list of predefined functions in a handy place
5538 echo " "
5539 case "$libc" in
5540 '') libc=unknown
5541         case "$libs" in
5542         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5543         esac
5544         ;;
5545 esac
5546 case "$libs" in
5547 '') ;;
5548 *)  for thislib in $libs; do
5549         case "$thislib" in
5550         -lc|-lc_s)
5551                 : Handle C library specially below.
5552                 ;;
5553         -l*)
5554                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5555                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5556                         :
5557                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5558                         :
5559                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5560                         :
5561                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5562                         :
5563                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5564                         :
5565                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5566                         :
5567                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5568                         :
5569                 else
5570                         try=''
5571                 fi
5572                 libnames="$libnames $try"
5573                 ;;
5574         *) libnames="$libnames $thislib" ;;
5575         esac
5576         done
5577         ;;
5578 esac
5579 xxx=normal
5580 case "$libc" in
5581 unknown)
5582         set /lib/libc.$so
5583         for xxx in $libpth; do
5584                 $test -r $1 || set $xxx/libc.$so
5585                 : The messy sed command sorts on library version numbers.
5586                 $test -r $1 || \
5587                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5588                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5589                                 h
5590                                 s/[0-9][0-9]*/0000&/g
5591                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5592                                 G
5593                                 s/\n/ /' | \
5594                          $sort | $sed -e 's/^.* //'`
5595                 eval set \$$#
5596         done
5597         $test -r $1 || set /usr/ccs/lib/libc.$so
5598         $test -r $1 || set /lib/libsys_s$_a
5599         ;;
5600 *)
5601         set blurfl
5602         ;;
5603 esac
5604 if $test -r "$1"; then
5605         echo "Your (shared) C library seems to be in $1."
5606         libc="$1"
5607 elif $test -r /lib/libc && $test -r /lib/clib; then
5608         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5609         xxx=apollo
5610         libc='/lib/clib /lib/libc'
5611         if $test -r /lib/syslib; then
5612                 echo "(Your math library is in /lib/syslib.)"
5613                 libc="$libc /lib/syslib"
5614         fi
5615 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5616         echo "Your C library seems to be in $libc, as you said before."
5617 elif $test -r $incpath/usr/lib/libc$_a; then
5618         libc=$incpath/usr/lib/libc$_a;
5619         echo "Your C library seems to be in $libc.  That's fine."
5620 elif $test -r /lib/libc$_a; then
5621         libc=/lib/libc$_a;
5622         echo "Your C library seems to be in $libc.  You're normal."
5623 else
5624         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5625                 :
5626         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5627                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5628         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5629                 :
5630         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5631                 :
5632         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5633                 :
5634         else
5635                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5636         fi
5637         if $test -r "$tans"; then
5638                 echo "Your C library seems to be in $tans, of all places."
5639                 libc=$tans
5640         else
5641                 libc='blurfl'
5642         fi
5643 fi
5644 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5645         dflt="$libc"
5646         cat <<EOM
5647
5648 If the guess above is wrong (which it might be if you're using a strange
5649 compiler, or your machine supports multiple models), you can override it here.
5650
5651 EOM
5652 else
5653         dflt=''
5654         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5655         cat >&4 <<EOM
5656 I can't seem to find your C library.  I've looked in the following places:
5657
5658 EOM
5659         $sed 's/^/      /' libpath
5660         cat <<EOM
5661
5662 None of these seems to contain your C library. I need to get its name...
5663
5664 EOM
5665 fi
5666 fn=f
5667 rp='Where is your C library?'
5668 . ./getfile
5669 libc="$ans"
5670
5671 echo " "
5672 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5673 set X `cat libnames`
5674 shift
5675 xxx=files
5676 case $# in 1) xxx=file; esac
5677 echo "Extracting names from the following $xxx for later perusal:" >&4
5678 echo " "
5679 $sed 's/^/      /' libnames >&4
5680 echo " "
5681 $echo $n "This may take a while...$c" >&4
5682
5683 for file in $*; do
5684         case $file in
5685         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5686         *) $nm $nm_opt $file 2>/dev/null;;
5687         esac
5688 done >libc.tmp
5689
5690 $echo $n ".$c"
5691 $grep fprintf libc.tmp > libc.ptf
5692 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5693 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5694 xxx='[ADTSIW]'
5695 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5696         eval $xscan;\
5697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5698                 eval $xrun
5699 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5700         eval $xscan;\
5701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5702                 eval $xrun
5703 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5704         eval $xscan;\
5705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706                 eval $xrun
5707 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5708         eval $xscan;\
5709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710                 eval $xrun
5711 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5720                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 else
5753         $nm -p $* 2>/dev/null >libc.tmp
5754         $grep fprintf libc.tmp > libc.ptf
5755         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5756                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5757         then
5758                 nm_opt='-p'
5759                 eval $xrun
5760         else
5761                 echo " "
5762                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5763                 com=''
5764                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5765                         for thisname in $libnames $libc; do
5766                                 $ar t $thisname >>libc.tmp
5767                         done
5768                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5769                         echo "Ok." >&4
5770                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5771                         # Repeat libc to extract forwarders to DLL entries too
5772                         for thisname in $libnames $libc; do
5773                                 $ar tv $thisname >>libc.tmp
5774                                 # Revision 50 of EMX has bug in $ar.
5775                                 # it will not extract forwarders to DLL entries
5776                                 # Use emximp which will extract exactly them.
5777                                 emximp -o tmp.imp $thisname \
5778                                     2>/dev/null && \
5779                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5780                                     < tmp.imp >>libc.tmp
5781                                 $rm tmp.imp
5782                         done
5783                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5784                         echo "Ok." >&4
5785                 else
5786                         echo "$ar didn't seem to work right." >&4
5787                         echo "Maybe this is a Cray...trying bld instead..." >&4
5788                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5789                         then
5790                                 for thisname in $libnames; do
5791                                         bld t $libnames | \
5792                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5793                                         $ar t $thisname >>libc.tmp
5794                                 done
5795                                 echo "Ok." >&4
5796                         else
5797                                 echo "That didn't work either.  Giving up." >&4
5798                                 exit 1
5799                         fi
5800                 fi
5801         fi
5802 fi
5803 nm_extract="$com"
5804 if $test -f /lib/syscalls.exp; then
5805         echo " "
5806         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5807         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5808 fi
5809 ;;
5810 esac
5811 $rm -f libnames libpath
5812
5813 : is a C symbol defined?
5814 csym='tlook=$1;
5815 case "$3" in
5816 -v) tf=libc.tmp; tc=""; tdc="";;
5817 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5818 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5819 esac;
5820 tx=yes;
5821 case "$reuseval-$4" in
5822 true-) ;;
5823 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5824 esac;
5825 case "$tx" in
5826 yes)
5827         case "$runnm" in
5828         true)
5829                 if $contains $tlook $tf >/dev/null 2>&1;
5830                 then tval=true;
5831                 else tval=false;
5832                 fi;;
5833         *)
5834                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5835                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5836                 then tval=true;
5837                 else tval=false;
5838                 fi;
5839                 $rm -f t t.c;;
5840         esac;;
5841 *)
5842         case "$tval" in
5843         $define) tval=true;;
5844         *) tval=false;;
5845         esac;;
5846 esac;
5847 eval "$2=$tval"'
5848
5849 : define an is-in-libc? function
5850 inlibc='echo " "; td=$define; tu=$undef;
5851 sym=$1; var=$2; eval "was=\$$2";
5852 tx=yes;
5853 case "$reuseval$was" in
5854 true) ;;
5855 true*) tx=no;;
5856 esac;
5857 case "$tx" in
5858 yes)
5859         set $sym tres -f;
5860         eval $csym;
5861         case "$tres" in
5862         true)
5863                 echo "$sym() found." >&4;
5864                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5865         *)
5866                 echo "$sym() NOT found." >&4;
5867                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5868         esac;;
5869 *)
5870         case "$was" in
5871         $define) echo "$sym() found." >&4;;
5872         *) echo "$sym() NOT found." >&4;;
5873         esac;;
5874 esac'
5875
5876 : see if sqrtl exists
5877 set sqrtl d_sqrtl
5878 eval $inlibc
5879
5880 : check for length of double
5881 echo " "
5882 case "$doublesize" in
5883 '')
5884         echo "Checking to see how big your double precision numbers are..." >&4
5885         $cat >try.c <<'EOCP'
5886 #include <stdio.h>
5887 int main()
5888 {
5889     printf("%d\n", (int)sizeof(double));
5890     exit(0);
5891 }
5892 EOCP
5893         set try
5894         if eval $compile_ok; then
5895                 doublesize=`$run ./try`
5896                 echo "Your double is $doublesize bytes long."
5897         else
5898                 dflt='8'
5899                 echo "(I can't seem to compile the test program.  Guessing...)"
5900                 rp="What is the size of a double precision number (in bytes)?"
5901                 . ./myread
5902                 doublesize="$ans"
5903         fi
5904         ;;
5905 esac
5906 $rm -f try.c try
5907
5908 : check for long doubles
5909 echo " "
5910 echo "Checking to see if you have long double..." >&4
5911 echo 'int main() { long double x = 7.0; }' > try.c
5912 set try
5913 if eval $compile; then
5914         val="$define"
5915         echo "You have long double."
5916 else
5917         val="$undef"
5918         echo "You do not have long double."
5919 fi
5920 $rm try.*
5921 set d_longdbl
5922 eval $setvar
5923
5924 : check for length of long double
5925 case "${d_longdbl}${longdblsize}" in
5926 $define)
5927         echo " "
5928         echo "Checking to see how big your long doubles are..." >&4
5929         $cat >try.c <<'EOCP'
5930 #include <stdio.h>
5931 int main()
5932 {
5933         printf("%d\n", sizeof(long double));
5934 }
5935 EOCP
5936         set try
5937         set try
5938         if eval $compile; then
5939                 longdblsize=`$run ./try`
5940                 echo "Your long doubles are $longdblsize bytes long."
5941         else
5942                 dflt='8'
5943                 echo " "
5944                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5945                 rp="What is the size of a long double (in bytes)?"
5946                 . ./myread
5947                 longdblsize="$ans"
5948         fi
5949         if $test "X$doublesize" = "X$longdblsize"; then
5950                 echo "(That isn't any different from an ordinary double.)"
5951         fi      
5952         ;;
5953 esac
5954 $rm -f try.* try
5955
5956 echo " "
5957
5958 if $test X"$d_longdbl" = X"$define"; then
5959
5960 echo "Checking how to print long doubles..." >&4
5961
5962 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5963         $cat >try.c <<'EOCP'
5964 #include <sys/types.h>
5965 #include <stdio.h>
5966 int main() {
5967   double d = 123.456;
5968   printf("%.3f\n", d);
5969 }
5970 EOCP
5971         set try
5972         if eval $compile; then
5973                 yyy=`$run ./try`
5974                 case "$yyy" in
5975                 123.456)
5976                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5977                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5978                         echo "We will use %f."
5979                         ;;
5980                 esac
5981         fi
5982 fi
5983
5984 if $test X"$sPRIfldbl" = X; then
5985         $cat >try.c <<'EOCP'
5986 #include <sys/types.h>
5987 #include <stdio.h>
5988 int main() {
5989   long double d = 123.456;
5990   printf("%.3Lf\n", d);
5991 }
5992 EOCP
5993         set try
5994         if eval $compile; then
5995                 yyy=`$run ./try`
5996                 case "$yyy" in
5997                 123.456)
5998                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5999                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6000                         echo "We will use %Lf."
6001                         ;;
6002                 esac
6003         fi
6004 fi
6005
6006 if $test X"$sPRIfldbl" = X; then
6007         $cat >try.c <<'EOCP'
6008 #include <sys/types.h>
6009 #include <stdio.h>
6010 int main() {
6011   long double d = 123.456;
6012   printf("%.3llf\n", d);
6013 }
6014 EOCP
6015         set try
6016         if eval $compile; then
6017                 yyy=`$run ./try`
6018                 case "$yyy" in
6019                 123.456)
6020                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6021                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6022                         echo "We will use %llf."
6023                         ;;
6024                 esac
6025         fi
6026 fi
6027
6028 if $test X"$sPRIfldbl" = X; then
6029         $cat >try.c <<'EOCP'
6030 #include <sys/types.h>
6031 #include <stdio.h>
6032 int main() {
6033   long double d = 123.456;
6034   printf("%.3lf\n", d);
6035 }
6036 EOCP
6037         set try
6038         if eval $compile; then
6039                 yyy=`$run ./try`
6040                 case "$yyy" in
6041                 123.456)
6042                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6043                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6044                         echo "We will use %lf."
6045                         ;;
6046                 esac
6047         fi
6048 fi
6049
6050 if $test X"$sPRIfldbl" = X; then
6051         echo "Cannot figure out how to print long doubles." >&4
6052 else
6053         sSCNfldbl=$sPRIfldbl    # expect consistency
6054 fi
6055
6056 $rm -f try try.*
6057
6058 fi # d_longdbl
6059
6060 case "$sPRIfldbl" in
6061 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6062         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6063         d_SCNfldbl="$undef";
6064         ;;
6065 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6066         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6067         d_SCNfldbl="$define";
6068         ;;
6069 esac
6070
6071 : see if modfl exists
6072 set modfl d_modfl
6073 eval $inlibc
6074
6075 d_modfl_pow32_bug="$undef"
6076
6077 case "$d_longdbl$d_modfl" in
6078 $define$define)
6079         $cat <<EOM
6080 Checking to see whether your modfl() is okay for large values...
6081 EOM
6082 $cat >try.c <<EOCP
6083 #include <math.h> 
6084 #include <stdio.h>
6085 int main() {
6086     long double nv = 4294967303.15;
6087     long double v, w;
6088     v = modfl(nv, &w);         
6089 #ifdef __GLIBC__
6090     printf("glibc");
6091 #endif
6092     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6093     return 0;
6094 }
6095 EOCP
6096         case "$osname:$gccversion" in
6097         aix:)   saveccflags="$ccflags"
6098                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6099         esac
6100         set try
6101         if eval $compile; then
6102                 foo=`$run ./try`
6103                 case "$foo" in
6104                 *" 4294967303.150000 1.150000 4294967302.000000")
6105                         echo >&4 "Your modfl() is broken for large values."
6106                         d_modfl_pow32_bug="$define"
6107                         case "$foo" in
6108                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6109                         ;;
6110                         esac
6111                         ;;
6112                 *" 4294967303.150000 0.150000 4294967303.000000")
6113                         echo >&4 "Your modfl() seems okay for large values."
6114                         ;;
6115                 *)      echo >&4 "I don't understand your modfl() at all."
6116                         d_modfl="$undef"
6117                         ;;
6118                 esac
6119                 $rm -f try.* try core core.try.*
6120         else
6121                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6122                 d_modfl="$undef"
6123         fi
6124         case "$osname:$gccversion" in
6125         aix:)   ccflags="$saveccflags" ;; # restore
6126         esac
6127         ;;
6128 esac
6129
6130 case "$ccflags" in
6131 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6132 esac
6133
6134 case "$uselongdouble" in
6135 $define|true|[yY]*)     dflt='y';;
6136 *) dflt='n';;
6137 esac
6138 cat <<EOM
6139
6140 Perl can be built to take advantage of long doubles which
6141 (if available) may give more accuracy and range for floating point numbers.
6142
6143 If this doesn't make any sense to you, just accept the default '$dflt'.
6144 EOM
6145 rp='Try to use long doubles if available?'
6146 . ./myread
6147 case "$ans" in
6148 y|Y)    val="$define"   ;;
6149 *)      val="$undef"    ;;
6150 esac
6151 set uselongdouble
6152 eval $setvar
6153
6154 case "$uselongdouble" in
6155 true|[yY]*) uselongdouble="$define" ;;
6156 esac
6157
6158 case "$uselongdouble" in
6159 $define)
6160 : Look for a hint-file generated 'call-back-unit'.  If the
6161 : user has specified that long doubles should be used,
6162 : we may need to set or change some other defaults.
6163         if $test -f uselongdouble.cbu; then
6164                 echo "Your platform has some specific hints for long doubles, using them..."
6165                 . ./uselongdouble.cbu
6166         else
6167                 $cat <<EOM
6168 (Your platform doesn't have any specific hints for long doubles.)
6169 EOM
6170         fi
6171         ;;
6172 esac
6173
6174 message=X
6175 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6176 $define:$define:$define)
6177         : You have both
6178         ;;
6179 $define:$define:$undef)
6180         message="I could not find modfl"
6181         ;;
6182 $define:$undef:$define)
6183         message="I could not find sqrtl"
6184         ;;
6185 $define:$undef:$undef)
6186         message="I found neither sqrtl nor modfl"
6187         ;;
6188 esac
6189
6190 if $test "$message" != X; then
6191         $cat <<EOM >&4
6192
6193 *** You requested the use of long doubles but you do not seem to have
6194 *** the mathematic functions for long doubles.
6195 *** ($message)
6196 *** I'm disabling the use of long doubles.
6197
6198 EOM
6199
6200         uselongdouble=$undef
6201 fi
6202
6203 case "$useperlio" in
6204 $define|true|[yY]*|'')  dflt='y';;
6205 *) dflt='n';;
6206 esac
6207 cat <<EOM
6208
6209 Previous version of $package used the standard IO mechanisms as
6210 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6211 alternate IO mechanisms via the PerlIO abstraction layer, but the
6212 stdio mechanism is still available if needed.  The abstraction layer
6213 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6214 Using PerlIO with sfio may cause problems with some extension modules.
6215
6216 If this doesn't make any sense to you, just accept the default '$dflt'.
6217 EOM
6218 rp='Use the PerlIO abstraction layer?'
6219 . ./myread
6220 case "$ans" in
6221 y|Y) 
6222         val="$define"
6223         ;;
6224 *)      
6225         echo "Ok, doing things the stdio way."
6226         val="$undef"
6227         ;;
6228 esac
6229 set useperlio
6230 eval $setvar 
6231
6232 case "$usesocks" in
6233 $define|true|[yY]*)
6234         case "$useperlio" in
6235         $define|true|[yY]*) ;;
6236         *)      cat >&4 <<EOM
6237
6238 You are using the SOCKS proxy protocol library which means that you
6239 should also use the PerlIO layer.  You may be headed for trouble.
6240
6241 EOM
6242                 ;;
6243         esac
6244         ;;
6245 esac
6246
6247         
6248 : determine the architecture name
6249 echo " "
6250 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6251         tarch=`arch`"-$osname"
6252 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6253         if uname -m > tmparch 2>&1 ; then
6254                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6255                         -e 's/$/'"-$osname/" tmparch`
6256         else
6257                 tarch="$osname"
6258         fi
6259         $rm -f tmparch
6260 else
6261         tarch="$osname"
6262 fi
6263 case "$myarchname" in
6264 ''|"$tarch") ;;
6265 *)
6266         echo "(Your architecture name used to be $myarchname.)"
6267         archname=''
6268         ;;
6269 esac
6270 case "$targetarch" in
6271 '') ;;
6272 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6273 esac
6274 myarchname="$tarch"
6275 case "$archname" in
6276 '') dflt="$tarch";;
6277 *) dflt="$archname";;
6278 esac
6279 rp='What is your architecture name'
6280 . ./myread
6281 archname="$ans"
6282 case "$usethreads" in
6283 $define)
6284         echo "Threads selected." >&4
6285         case "$archname" in
6286         *-thread*) echo "...and architecture name already has -thread." >&4
6287                 ;;
6288         *)      archname="$archname-thread"
6289                 echo "...setting architecture name to $archname." >&4
6290                 ;;
6291         esac
6292         ;;
6293 esac
6294 case "$usemultiplicity" in
6295 $define)
6296         echo "Multiplicity selected." >&4
6297         case "$archname" in
6298         *-multi*) echo "...and architecture name already has -multi." >&4
6299                 ;;
6300         *)      archname="$archname-multi"
6301                 echo "...setting architecture name to $archname." >&4
6302                 ;;
6303         esac
6304         ;;
6305 esac
6306 case "$use64bitint$use64bitall" in
6307 *"$define"*)
6308         case "$archname64" in
6309         '')
6310                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6311                 ;;
6312         *)
6313                 case "$use64bitint" in
6314                 "$define") echo "64 bit integers selected." >&4 ;;
6315                 esac
6316                 case "$use64bitall" in
6317                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6318                 esac
6319                 case "$archname" in
6320                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6321                         ;;
6322                 *)      archname="$archname-$archname64"
6323                         echo "...setting architecture name to $archname." >&4
6324                         ;;
6325                 esac
6326                 ;;
6327         esac
6328 esac
6329 case "$uselongdouble" in
6330 $define)
6331         echo "Long doubles selected." >&4
6332         case "$longdblsize" in
6333         $doublesize)
6334                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6335                 ;;
6336         *)
6337                 case "$archname" in
6338                 *-ld*) echo "...and architecture name already has -ld." >&4
6339                         ;;
6340                 *)      archname="$archname-ld"
6341                         echo "...setting architecture name to $archname." >&4
6342                         ;;
6343                 esac
6344                 ;;
6345         esac
6346         ;;
6347 esac
6348 case "$useperlio" in
6349 $define)
6350         echo "Perlio selected." >&4
6351         ;;
6352 *)
6353         echo "Perlio not selected, using stdio." >&4
6354         case "$archname" in
6355         *-stdio*) echo "...and architecture name already has -stdio." >&4
6356                 ;;
6357         *)      archname="$archname-stdio"
6358                 echo "...setting architecture name to $archname." >&4
6359                 ;;
6360         esac
6361         ;;
6362 esac
6363
6364 : determine root of directory hierarchy where package will be installed.
6365 case "$prefix" in
6366 '')
6367         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6368         ;;
6369 *)
6370         dflt="$prefix"
6371         ;;
6372 esac
6373 $cat <<EOM
6374
6375 By default, $package will be installed in $dflt/bin, manual pages
6376 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6377 installation directories. Typically this is something like /usr/local.
6378 If you wish to have binaries under /usr/bin but other parts of the
6379 installation under /usr/local, that's ok: you will be prompted
6380 separately for each of the installation directories, the prefix being
6381 only used to set the defaults.
6382
6383 EOM
6384 fn=d~
6385 rp='Installation prefix to use?'
6386 . ./getfile
6387 oldprefix=''
6388 case "$prefix" in
6389 '') ;;
6390 *)
6391         case "$ans" in
6392         "$prefix") ;;
6393         *) oldprefix="$prefix";;
6394         esac
6395         ;;
6396 esac
6397 prefix="$ans"
6398 prefixexp="$ansexp"
6399
6400 case "$afsroot" in
6401 '')     afsroot=/afs ;;
6402 *)      afsroot=$afsroot ;;
6403 esac
6404
6405 : is AFS running?
6406 echo " "
6407 case "$afs" in
6408 $define|true)   afs=true ;;
6409 $undef|false)   afs=false ;;
6410 *)      if test -d $afsroot; then
6411                 afs=true
6412         else
6413                 afs=false
6414         fi
6415         ;;
6416 esac
6417 if $afs; then
6418         echo "AFS may be running... I'll be extra cautious then..." >&4
6419 else
6420         echo "AFS does not seem to be running..." >&4
6421 fi
6422
6423 : determine installation prefix for where package is to be installed.
6424 if $afs; then 
6425 $cat <<EOM
6426
6427 Since you are running AFS, I need to distinguish the directory in which
6428 files will reside from the directory in which they are installed (and from
6429 which they are presumably copied to the former directory by occult means).
6430
6431 EOM
6432         case "$installprefix" in
6433         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6434         *) dflt="$installprefix";;
6435         esac
6436 else
6437 $cat <<EOM
6438
6439 In some special cases, particularly when building $package for distribution,
6440 it is convenient to distinguish between the directory in which files should 
6441 be installed from the directory ($prefix) in which they 
6442 will eventually reside.  For most users, these two directories are the same.
6443
6444 EOM
6445         case "$installprefix" in
6446         '') dflt=$prefix ;;
6447         *) dflt=$installprefix;;
6448         esac
6449 fi
6450 fn=d~
6451 rp='What installation prefix should I use for installing files?'
6452 . ./getfile
6453 installprefix="$ans"
6454 installprefixexp="$ansexp"
6455
6456 : set the prefixit variable, to compute a suitable default value
6457 prefixit='case "$3" in
6458 ""|none)
6459         case "$oldprefix" in
6460         "") eval "$1=\"\$$2\"";;
6461         *)
6462                 case "$3" in
6463                 "") eval "$1=";;
6464                 none)
6465                         eval "tp=\"\$$2\"";
6466                         case "$tp" in
6467                         ""|" ") eval "$1=\"\$$2\"";;
6468                         *) eval "$1=";;
6469                         esac;;
6470                 esac;;
6471         esac;;
6472 *)
6473         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6474         case "$tp" in
6475         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6476         /*-$oldprefix/*|\~*-$oldprefix/*)
6477                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6478         *) eval "$1=\"\$$2\"";;
6479         esac;;
6480 esac'
6481
6482 : get the patchlevel
6483 echo " "
6484 echo "Getting the current patchlevel..." >&4
6485 if $test -r $rsrc/patchlevel.h;then
6486         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6487         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6488         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6489         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6490         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6491         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6492        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6493 else
6494         revision=0
6495         patchlevel=0
6496         subversion=0
6497         api_revision=0
6498         api_version=0
6499         api_subversion=0
6500         perl_patchlevel=0
6501         $echo "(You do not have patchlevel.h.  Eek.)"
6502 fi
6503 if $test -r $rsrc/.patch ; then  
6504         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6505                 perl_patchlevel=`cat $rsrc/.patch`
6506         fi
6507 fi
6508 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6509 version_patchlevel_string="version $patchlevel subversion $subversion"
6510 case "$perl_patchlevel" in
6511 0|'') ;;
6512 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6513 esac
6514
6515 $echo "(You have $package $version_patchlevel_string.)"
6516
6517 case "$osname" in
6518 dos|vms)
6519         : XXX Should be a Configure test for double-dots in filenames.
6520         version=`echo $revision $patchlevel $subversion | \
6521                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6522         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6523                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6524         ;;
6525 *)
6526         version=`echo $revision $patchlevel $subversion | \
6527                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6528         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6529                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6530         ;;
6531 esac
6532 : Special case the 5.005_xx maintenance series, which used 5.005
6533 : without any subversion label as a subdirectory in $sitelib
6534 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6535         api_versionstring='5.005'
6536 fi
6537
6538 : determine installation style
6539 : For now, try to deduce it from prefix unless it is already set.
6540 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6541 case "$installstyle" in
6542 '')     case "$prefix" in
6543                 *perl*) dflt='lib';;
6544                 *) dflt='lib/perl5' ;;
6545         esac
6546         ;;
6547 *)      dflt="$installstyle" ;;
6548 esac
6549 : Probably not worth prompting for this since we prompt for all
6550 : the directories individually, and the prompt would be too long and
6551 : confusing anyway.
6552 installstyle=$dflt
6553
6554 : determine where private library files go
6555 : Usual default is /usr/local/lib/perl5/$version.
6556 : Also allow things like /opt/perl/lib/$version, since 
6557 : /opt/perl/lib/perl5... would be redundant.
6558 : The default "style" setting is made in installstyle.U
6559 case "$installstyle" in
6560 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6561 *)       set dflt privlib lib/$version ;;
6562 esac
6563 eval $prefixit
6564 $cat <<EOM
6565
6566 There are some auxiliary files for $package that need to be put into a
6567 private library directory that is accessible by everyone.
6568
6569 EOM
6570 fn=d~+
6571 rp='Pathname where the private library files will reside?'
6572 . ./getfile
6573 privlib="$ans"
6574 privlibexp="$ansexp"
6575 : Change installation prefix, if necessary.
6576 if $test X"$prefix" != X"$installprefix"; then
6577         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6578 else
6579         installprivlib="$privlibexp"
6580 fi
6581
6582 : set the prefixup variable, to restore leading tilda escape
6583 prefixup='case "$prefixexp" in
6584 "$prefix") ;;
6585 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6586 esac'
6587
6588 : determine where public architecture dependent libraries go
6589 set archlib archlib
6590 eval $prefixit
6591 : privlib default is /usr/local/lib/$package/$version
6592 : archlib default is /usr/local/lib/$package/$version/$archname
6593 : privlib may have an optional trailing /share.
6594 tdflt=`echo $privlib | $sed 's,/share$,,'`
6595 tdflt=$tdflt/$archname
6596 case "$archlib" in
6597 '')     dflt=$tdflt
6598         ;;
6599 *)      dflt="$archlib"
6600     ;;
6601 esac
6602 $cat <<EOM
6603
6604 $spackage contains architecture-dependent library files.  If you are
6605 sharing libraries in a heterogeneous environment, you might store
6606 these files in a separate location.  Otherwise, you can just include
6607 them with the rest of the public library files.
6608
6609 EOM
6610 fn=d+~
6611 rp='Where do you want to put the public architecture-dependent libraries?'
6612 . ./getfile
6613 archlib="$ans"
6614 archlibexp="$ansexp"
6615 if $test X"$archlib" = X"$privlib"; then
6616         d_archlib="$undef"
6617 else
6618         d_archlib="$define"
6619 fi
6620 : Change installation prefix, if necessary.
6621 if $test X"$prefix" != X"$installprefix"; then
6622         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6623 else
6624         installarchlib="$archlibexp"
6625 fi
6626
6627
6628 : Binary compatibility with 5.005 is not possible for builds
6629 : with advanced features
6630 case "$usethreads$usemultiplicity" in
6631 *define*)
6632         bincompat5005="$undef"
6633         d_bincompat5005="$undef"
6634         ;;
6635 *)      $cat <<EOM
6636
6637 This version of Perl can be compiled for binary compatibility with 5.005.
6638 If you decide to do so, you will be able to continue using most of the
6639 extensions that were compiled for Perl 5.005.
6640
6641 EOM
6642         case "$bincompat5005$d_bincompat5005" in
6643         *"$undef"*) dflt=n ;;
6644         *) dflt=y ;;
6645         esac
6646         rp='Binary compatibility with Perl 5.005?'
6647         . ./myread
6648         case "$ans" in
6649         y*) val="$define" ;;
6650         *)  val="$undef" ;;
6651         esac
6652         set d_bincompat5005
6653         eval $setvar
6654         case "$d_bincompat5005" in
6655         "$define")
6656                 bincompat5005="$define"
6657                 ;;
6658         *)      bincompat5005="$undef"
6659                 d_bincompat5005="$undef"
6660                 ;;
6661         esac
6662         ;;
6663 esac
6664
6665
6666 : see if setuid scripts can be secure
6667 $cat <<EOM
6668
6669 Some kernels have a bug that prevents setuid #! scripts from being
6670 secure.  Some sites have disabled setuid #! scripts because of this.
6671
6672 First let's decide if your kernel supports secure setuid #! scripts.
6673 (If setuid #! scripts would be secure but have been disabled anyway,
6674 don't say that they are secure if asked.)
6675
6676 EOM
6677
6678 val="$undef"
6679 if $test -d /dev/fd; then
6680         echo "#!$ls" >reflect
6681         chmod +x,u+s reflect
6682         ./reflect >flect 2>&1
6683         if $contains "/dev/fd" flect >/dev/null; then
6684                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6685                 val="$define"
6686         else
6687                 $cat <<EOM
6688 If you are not sure if they are secure, I can check but I'll need a
6689 username and password different from the one you are using right now.
6690 If you don't have such a username or don't want me to test, simply
6691 enter 'none'.
6692
6693 EOM
6694                 rp='Other username to test security of setuid scripts with?'
6695                 dflt='none'
6696                 . ./myread
6697                 case "$ans" in
6698                 n|none)
6699                         case "$d_suidsafe" in
6700                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6701                                 dflt=n;;
6702                         "$undef")
6703                                 echo "Well, the $hint value is *not* secure." >&4
6704                                 dflt=n;;
6705                         *)      echo "Well, the $hint value *is* secure." >&4
6706                                 dflt=y;;
6707                         esac
6708                         ;;
6709                 *)
6710                         $rm -f reflect flect
6711                         echo "#!$ls" >reflect
6712                         chmod +x,u+s reflect
6713                         echo >flect
6714                         chmod a+w flect
6715                         echo '"su" will (probably) prompt you for '"$ans's password."
6716                         su $ans -c './reflect >flect'
6717                         if $contains "/dev/fd" flect >/dev/null; then
6718                                 echo "Okay, it looks like setuid scripts are secure." >&4
6719                                 dflt=y
6720                         else
6721                                 echo "I don't think setuid scripts are secure." >&4
6722                                 dflt=n
6723                         fi
6724                         ;;
6725                 esac
6726                 rp='Does your kernel have *secure* setuid scripts?'
6727                 . ./myread
6728                 case "$ans" in
6729                 [yY]*)  val="$define";;
6730                 *)      val="$undef";;
6731                 esac
6732         fi
6733 else
6734         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6735         echo "(That's for file descriptors, not floppy disks.)"
6736         val="$undef"
6737 fi
6738 set d_suidsafe
6739 eval $setvar
6740
6741 $rm -f reflect flect
6742
6743 : now see if they want to do setuid emulation
6744 echo " "
6745 val="$undef"
6746 case "$d_suidsafe" in
6747 "$define")
6748         val="$undef"
6749         echo "No need to emulate SUID scripts since they are secure here." >&4
6750         ;;
6751 *)
6752         $cat <<EOM
6753 Some systems have disabled setuid scripts, especially systems where
6754 setuid scripts cannot be secure.  On systems where setuid scripts have
6755 been disabled, the setuid/setgid bits on scripts are currently
6756 useless.  It is possible for $package to detect those bits and emulate
6757 setuid/setgid in a secure fashion.  This emulation will only work if
6758 setuid scripts have been disabled in your kernel.
6759
6760 EOM
6761         case "$d_dosuid" in
6762         "$define") dflt=y ;;
6763         *) dflt=n ;;
6764         esac
6765         rp="Do you want to do setuid/setgid emulation?"
6766         . ./myread
6767         case "$ans" in
6768         [yY]*)  val="$define";;
6769         *)      val="$undef";;
6770         esac
6771         ;;
6772 esac
6773 set d_dosuid
6774 eval $setvar
6775
6776 : see if this is a malloc.h system
6777 set malloc.h i_malloc
6778 eval $inhdr
6779
6780 : see if stdlib is available
6781 set stdlib.h i_stdlib
6782 eval $inhdr
6783
6784 : determine which malloc to compile in
6785 echo " "
6786 case "$usemymalloc" in
6787 [yY]*|true|$define)     dflt='y' ;;
6788 [nN]*|false|$undef)     dflt='n' ;;
6789 *)      case "$ptrsize" in
6790         4) dflt='y' ;;
6791         *) dflt='n' ;;
6792         esac
6793         ;;
6794 esac
6795 rp="Do you wish to attempt to use the malloc that comes with $package?"
6796 . ./myread
6797 usemymalloc="$ans"
6798 case "$ans" in
6799 y*|true)
6800         usemymalloc='y'
6801         mallocsrc='malloc.c'
6802         mallocobj="malloc$_o"
6803         d_mymalloc="$define"
6804         case "$libs" in
6805         *-lmalloc*)
6806                 : Remove malloc from list of libraries to use
6807                 echo "Removing unneeded -lmalloc from library list" >&4
6808                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6809                 shift
6810                 libs="$*"
6811                 echo "libs = $libs" >&4
6812                 ;;
6813         esac
6814         ;;
6815 *)
6816         usemymalloc='n'
6817         mallocsrc=''
6818         mallocobj=''
6819         d_mymalloc="$undef"
6820         ;;
6821 esac
6822
6823 : compute the return types of malloc and free
6824 echo " "
6825 $cat >malloc.c <<END
6826 #$i_malloc I_MALLOC
6827 #$i_stdlib I_STDLIB
6828 #include <stdio.h>
6829 #include <sys/types.h>
6830 #ifdef I_MALLOC
6831 #include <malloc.h>
6832 #endif
6833 #ifdef I_STDLIB
6834 #include <stdlib.h>
6835 #endif
6836 #ifdef TRY_MALLOC
6837 void *malloc();
6838 #endif
6839 #ifdef TRY_FREE
6840 void free();
6841 #endif
6842 END
6843 case "$malloctype" in
6844 '')
6845         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6846                 malloctype='void *'
6847         else
6848                 malloctype='char *'
6849         fi
6850         ;;
6851 esac
6852 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6853
6854 case "$freetype" in
6855 '')
6856         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6857                 freetype='void'
6858         else
6859                 freetype='int'
6860         fi
6861         ;;
6862 esac
6863 echo "Your system uses $freetype free(), it would seem." >&4
6864 $rm -f malloc.[co]
6865 $cat <<EOM
6866
6867 After $package is installed, you may wish to install various
6868 add-on modules and utilities.  Typically, these add-ons will
6869 be installed under $prefix with the rest
6870 of this package.  However, you may wish to install such add-ons
6871 elsewhere under a different prefix.
6872
6873 If you do not wish to put everything under a single prefix, that's
6874 ok.  You will be prompted for the individual locations; this siteprefix
6875 is only used to suggest the defaults.
6876
6877 The default should be fine for most people.
6878
6879 EOM
6880 fn=d~+
6881 rp='Installation prefix to use for add-on modules and utilities?'
6882 : XXX Here might be another good place for an installstyle setting.
6883 case "$siteprefix" in
6884 '') dflt=$prefix ;;
6885 *)  dflt=$siteprefix ;;
6886 esac
6887 . ./getfile
6888 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6889 oldsiteprefix=''
6890 case "$siteprefix" in
6891 '') ;;
6892 *)      case "$ans" in
6893         "$prefix") ;;
6894         *) oldsiteprefix="$prefix";;
6895         esac
6896         ;;
6897 esac
6898 siteprefix="$ans"
6899 siteprefixexp="$ansexp"
6900
6901 : determine where site specific libraries go.
6902 : Usual default is /usr/local/lib/perl5/site_perl/$version
6903 : The default "style" setting is made in installstyle.U
6904 : XXX No longer works with Prefixit stuff.
6905 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6906 case "$sitelib" in
6907 '') case "$installstyle" in
6908         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6909         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6910         esac
6911         ;;
6912 *)      dflt="$sitelib"
6913         ;;
6914 esac
6915 $cat <<EOM
6916
6917 The installation process will create a directory for
6918 site-specific extensions and modules.  Most users find it convenient
6919 to place all site-specific files in this directory rather than in the
6920 main distribution directory.
6921
6922 EOM
6923 fn=d~+
6924 rp='Pathname for the site-specific library files?'
6925 . ./getfile
6926 sitelib="$ans"
6927 sitelibexp="$ansexp"
6928 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6929 : Change installation prefix, if necessary.
6930 if $test X"$prefix" != X"$installprefix"; then
6931         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6932 else
6933         installsitelib="$sitelibexp"
6934 fi
6935
6936 : determine where site specific architecture-dependent libraries go.
6937 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6938 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6939 : sitelib may have an optional trailing /share.
6940 case "$sitearch" in
6941 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6942         dflt="$dflt/$archname"
6943         ;;
6944 *)      dflt="$sitearch"
6945         ;;
6946 esac
6947 set sitearch sitearch none
6948 eval $prefixit
6949 $cat <<EOM
6950
6951 The installation process will also create a directory for
6952 architecture-dependent site-specific extensions and modules.
6953
6954 EOM
6955 fn=d~+
6956 rp='Pathname for the site-specific architecture-dependent library files?'
6957 . ./getfile
6958 sitearch="$ans"
6959 sitearchexp="$ansexp"
6960 : Change installation prefix, if necessary.
6961 if $test X"$prefix" != X"$installprefix"; then
6962         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6963 else
6964         installsitearch="$sitearchexp"
6965 fi
6966
6967 $cat <<EOM
6968
6969 The installation process will also create a directory for
6970 vendor-supplied add-ons.  Vendors who supply perl with their system
6971 may find it convenient to place all vendor-supplied files in this
6972 directory rather than in the main distribution directory.  This will
6973 ease upgrades between binary-compatible maintenance versions of perl.
6974
6975 Of course you may also use these directories in whatever way you see
6976 fit.  For example, you might use them to access modules shared over a
6977 company-wide network.
6978
6979 The default answer should be fine for most people.
6980 This causes further questions about vendor add-ons to be skipped
6981 and no vendor-specific directories will be configured for perl.
6982
6983 EOM
6984 rp='Do you want to configure vendor-specific add-on directories?'
6985 case "$usevendorprefix" in
6986 define|true|[yY]*) dflt=y ;;
6987 *)      : User may have set vendorprefix directly on Configure command line.
6988         case "$vendorprefix" in
6989         ''|' ') dflt=n ;;
6990         *)      dflt=y ;;
6991         esac
6992         ;;
6993 esac
6994 . ./myread
6995 case "$ans" in
6996 [yY]*)  fn=d~+
6997         rp='Installation prefix to use for vendor-supplied add-ons?'
6998         case "$vendorprefix" in
6999         '') dflt='' ;;
7000         *)  dflt=$vendorprefix ;;
7001         esac
7002         . ./getfile
7003         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7004         oldvendorprefix=''
7005         case "$vendorprefix" in
7006         '') ;;
7007         *)      case "$ans" in
7008                 "$prefix") ;;
7009                 *) oldvendorprefix="$prefix";;
7010                 esac
7011                 ;;
7012         esac
7013         usevendorprefix="$define"
7014         vendorprefix="$ans"
7015         vendorprefixexp="$ansexp"
7016         ;;
7017 *)      usevendorprefix="$undef"
7018         vendorprefix=''
7019         vendorprefixexp=''
7020         ;;
7021 esac
7022
7023 case "$vendorprefix" in
7024 '')     d_vendorlib="$undef"
7025         vendorlib=''
7026         vendorlibexp=''
7027         ;;
7028 *)      d_vendorlib="$define"
7029         : determine where vendor-supplied modules go.
7030         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7031         case "$vendorlib" in
7032         '')
7033                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7034                 case "$installstyle" in
7035                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7036                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7037                 esac
7038                 ;;
7039         *)      dflt="$vendorlib"
7040                 ;;
7041         esac
7042         fn=d~+
7043         rp='Pathname for the vendor-supplied library files?'
7044         . ./getfile
7045         vendorlib="$ans"
7046         vendorlibexp="$ansexp"
7047         ;;
7048 esac
7049 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7050 : Change installation prefix, if necessary.
7051 if $test X"$prefix" != X"$installprefix"; then
7052         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7053 else
7054         installvendorlib="$vendorlibexp"
7055 fi
7056
7057 case "$vendorprefix" in
7058 '')     d_vendorarch="$undef"
7059         vendorarch=''
7060         vendorarchexp=''
7061         ;;
7062 *)      d_vendorarch="$define"
7063         : determine where vendor-supplied architecture-dependent libraries go.
7064         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7065         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7066         : vendorlib may have an optional trailing /share.
7067         case "$vendorarch" in
7068         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7069                 dflt="$dflt/$archname"
7070                 ;;
7071         *)      dflt="$vendorarch" ;;
7072         esac
7073         fn=d~+
7074         rp='Pathname for vendor-supplied architecture-dependent files?'
7075         . ./getfile
7076         vendorarch="$ans"
7077         vendorarchexp="$ansexp"
7078         ;;
7079 esac
7080 : Change installation prefix, if necessary.
7081 if $test X"$prefix" != X"$installprefix"; then
7082         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7083 else
7084         installvendorarch="$vendorarchexp"
7085 fi
7086
7087 : Final catch-all directories to search
7088 $cat <<EOM
7089
7090 Lastly, you can have perl look in other directories for extensions and
7091 modules in addition to those already specified.
7092 These directories will be searched after 
7093         $sitearch 
7094         $sitelib 
7095 EOM
7096 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7097 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7098 echo ' '
7099 case "$otherlibdirs" in
7100 ''|' ') dflt='none' ;;
7101 *)      dflt="$otherlibdirs" ;;
7102 esac
7103 $cat <<EOM
7104 Enter a colon-separated set of extra paths to include in perl's @INC
7105 search path, or enter 'none' for no extra paths.
7106
7107 EOM
7108
7109 rp='Colon-separated list of additional directories for perl to search?'
7110 . ./myread
7111 case "$ans" in
7112 ' '|''|none)    otherlibdirs=' ' ;;     
7113 *)      otherlibdirs="$ans" ;;
7114 esac
7115 case "$otherlibdirs" in
7116 ' ') val=$undef ;;
7117 *)      val=$define ;;
7118 esac
7119 set d_perl_otherlibdirs
7120 eval $setvar
7121
7122 : Cruising for prototypes
7123 echo " "
7124 echo "Checking out function prototypes..." >&4
7125 $cat >prototype.c <<'EOCP'
7126 int main(int argc, char *argv[]) {
7127         exit(0);}
7128 EOCP
7129 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7130         echo "Your C compiler appears to support function prototypes."
7131         val="$define"
7132 else
7133         echo "Your C compiler doesn't seem to understand function prototypes."
7134         val="$undef"
7135 fi
7136 set prototype
7137 eval $setvar
7138 $rm -f prototype*
7139
7140 case "$prototype" in
7141 "$define") ;;
7142 *)      ansi2knr='ansi2knr'
7143         echo " "
7144         cat <<EOM >&4
7145
7146 $me:  FATAL ERROR:
7147 This version of $package can only be compiled by a compiler that 
7148 understands function prototypes.  Unfortunately, your C compiler 
7149         $cc $ccflags
7150 doesn't seem to understand them.  Sorry about that.
7151
7152 If GNU cc is available for your system, perhaps you could try that instead.  
7153
7154 Eventually, we hope to support building Perl with pre-ANSI compilers.
7155 If you would like to help in that effort, please contact <perlbug@perl.org>.
7156
7157 Aborting Configure now.
7158 EOM
7159         exit 2
7160         ;;
7161 esac
7162
7163 : determine where public executables go
7164 echo " "
7165 set dflt bin bin
7166 eval $prefixit
7167 fn=d~
7168 rp='Pathname where the public executables will reside?'
7169 . ./getfile
7170 if $test "X$ansexp" != "X$binexp"; then
7171         installbin=''
7172 fi
7173 bin="$ans"
7174 binexp="$ansexp"
7175 : Change installation prefix, if necessary.
7176 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7177 if $test X"$prefix" != X"$installprefix"; then
7178         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7179 else
7180         installbin="$binexp"
7181 fi
7182
7183 echo " "
7184 case "$extras" in
7185 '') dflt='n';;
7186 *) dflt='y';;
7187 esac
7188 cat <<EOM
7189 Perl can be built with extra modules or bundles of modules which
7190 will be fetched from the CPAN and installed alongside Perl.
7191
7192 Notice that you will need access to the CPAN; either via the Internet,
7193 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7194 be asked later to configure the CPAN.pm module which will in turn do
7195 the installation of the rest of the extra modules or bundles.)
7196
7197 Notice also that if the modules require any external software such as
7198 libraries and headers (the libz library and the zlib.h header for the
7199 Compress::Zlib module, for example) you MUST have any such software
7200 already installed, this configuration process will NOT install such
7201 things for you.
7202
7203 If this doesn't make any sense to you, just accept the default '$dflt'.
7204 EOM
7205 rp='Install any extra modules (y or n)?'
7206 . ./myread
7207 case "$ans" in
7208 y|Y)
7209         cat <<EOM
7210
7211 Please list any extra modules or bundles to be installed from CPAN,
7212 with spaces between the names.  The names can be in any format the
7213 'install' command of CPAN.pm will understand.  (Answer 'none',
7214 without the quotes, to install no extra modules or bundles.)
7215 EOM
7216         rp='Extras?'
7217         dflt="$extras"
7218         . ./myread
7219         extras="$ans"
7220 esac
7221 case "$extras" in
7222 ''|'none')
7223         val=''
7224         $rm -f ../extras.lst
7225         ;;
7226 *)      echo "(Saving the list of extras for later...)"
7227         echo "$extras" > ../extras.lst
7228         val="'$extras'"
7229         ;;
7230 esac
7231 set extras
7232 eval $setvar
7233 echo " "
7234
7235 : Find perl5.005 or later.
7236 echo "Looking for a previously installed perl5.005 or later... "
7237 case "$perl5" in
7238 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7239                 : Check if this perl is recent and can load a simple module
7240                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7241                         perl5=$tdir/perl
7242                         break;
7243                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7244                         perl5=$tdir/perl5
7245                         break;
7246                 fi
7247         done
7248         ;;
7249 *)      perl5="$perl5"
7250         ;;
7251 esac
7252 case "$perl5" in
7253 '')     echo "None found.  That's ok.";;
7254 *)      echo "Using $perl5." ;;
7255 esac
7256
7257 : Determine list of previous versions to include in @INC
7258 $cat > getverlist <<EOPL
7259 #!$perl5 -w
7260 use File::Basename;
7261 \$api_versionstring = "$api_versionstring";
7262 \$version = "$version";
7263 \$stem = "$sitelib_stem";
7264 \$archname = "$archname";
7265 EOPL
7266         $cat >> getverlist <<'EOPL'
7267 # Can't have leading @ because metaconfig interprets it as a command!
7268 ;@inc_version_list=();
7269 # XXX Redo to do opendir/readdir? 
7270 if (-d $stem) {
7271     chdir($stem);
7272     ;@candidates = glob("5.*");
7273 }
7274 else {
7275     ;@candidates = ();
7276 }
7277
7278 # XXX ToDo:  These comparisons must be reworked when two-digit
7279 # subversions come along, so that 5.7.10 compares as greater than
7280 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7281 # widespread that we can use the built-in version vectors rather
7282 # than reinventing them here.  For 5.6.0, however, we must
7283 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7284 foreach $d (@candidates) {
7285     if ($d lt $version) {
7286         if ($d ge $api_versionstring) {
7287             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7288         }
7289         elsif ($d ge "5.005") {
7290             unshift(@inc_version_list, grep { -d } $d);
7291         }
7292     }
7293     else {
7294         # Skip newer version.  I.e. don't look in
7295         # 5.7.0 if we're installing 5.6.1.
7296     }
7297 }
7298
7299 if (@inc_version_list) {
7300     print join(' ', @inc_version_list);
7301 }
7302 else {
7303     # Blank space to preserve value for next Configure run.
7304     print " ";
7305 }
7306 EOPL
7307 chmod +x getverlist
7308 case "$inc_version_list" in
7309 '')     if test -x "$perl5$exe_ext"; then
7310                 dflt=`$perl5 getverlist`
7311         else
7312                 dflt='none'
7313         fi
7314         ;;
7315 $undef) dflt='none' ;;
7316 *)  eval dflt=\"$inc_version_list\" ;;
7317 esac
7318 case "$dflt" in
7319 ''|' ') dflt=none ;;
7320 esac
7321 case "$dflt" in
7322 5.005) case "$bincompat5005" in
7323        $define|true|[yY]*) ;;
7324        *) dflt=none ;;
7325        esac
7326        ;;
7327 esac
7328 $cat <<'EOM'
7329
7330 In order to ease the process of upgrading, this version of perl 
7331 can be configured to use modules built and installed with earlier 
7332 versions of perl that were installed under $prefix.  Specify here
7333 the list of earlier versions that this version of perl should check.
7334 If Configure detected no earlier versions of perl installed under
7335 $prefix, then the list will be empty.  Answer 'none' to tell perl
7336 to not search earlier versions.
7337
7338 The default should almost always be sensible, so if you're not sure,
7339 just accept the default.
7340 EOM
7341
7342 rp='List of earlier versions to include in @INC?'
7343 . ./myread
7344 case "$ans" in
7345 [Nn]one|''|' ') inc_version_list=' ' ;;
7346 *) inc_version_list="$ans" ;;
7347 esac
7348 case "$inc_version_list" in
7349 ''|' ') 
7350         inc_version_list_init='0';;
7351 *)      inc_version_list_init=`echo $inc_version_list |
7352                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7353         ;;
7354 esac
7355 $rm -f getverlist
7356
7357 : determine whether to install perl also as /usr/bin/perl
7358
7359 echo " "
7360 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7361         $cat <<EOM
7362 Many scripts expect perl to be installed as /usr/bin/perl.
7363 I can install the perl you are about to compile also as /usr/bin/perl
7364 (in addition to $installbin/perl).
7365 EOM
7366         case "$installusrbinperl" in
7367         "$undef"|[nN]*) dflt='n';;
7368         *)              dflt='y';;
7369         esac
7370         rp="Do you want to install perl as /usr/bin/perl?"
7371         . ./myread
7372         case "$ans" in
7373         [yY]*)  val="$define";;
7374         *)      val="$undef" ;;
7375         esac
7376 else
7377         val="$undef"
7378 fi
7379 set installusrbinperl
7380 eval $setvar
7381
7382 : see if dld is available
7383 set dld.h i_dld
7384 eval $inhdr
7385
7386 : see if dlopen exists
7387 xxx_runnm="$runnm"
7388 runnm=false
7389 set dlopen d_dlopen
7390 eval $inlibc
7391 runnm="$xxx_runnm"
7392
7393 : determine which dynamic loading, if any, to compile in
7394 echo " "
7395 dldir="ext/DynaLoader"
7396 case "$usedl" in
7397 $define|y|true)
7398         dflt='y'
7399         usedl="$define"
7400         ;;
7401 $undef|n|false)
7402         dflt='n'
7403         usedl="$undef"
7404         ;;
7405 *) 
7406         dflt='n'
7407         case "$d_dlopen" in
7408             $define) dflt='y' ;;
7409         esac
7410         case "$i_dld" in
7411             $define) dflt='y' ;;
7412         esac
7413         : Does a dl_xxx.xs file exist for this operating system
7414         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7415         ;;
7416 esac
7417 rp="Do you wish to use dynamic loading?"
7418 . ./myread
7419 usedl="$ans"
7420 case "$ans" in
7421 y*) usedl="$define"
7422         case "$dlsrc" in
7423         '')
7424                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7425                         dflt="$dldir/dl_${osname}.xs"
7426                 elif $test "$d_dlopen" = "$define" ; then
7427                         dflt="$dldir/dl_dlopen.xs"
7428                 elif $test "$i_dld" = "$define" ; then
7429                         dflt="$dldir/dl_dld.xs"
7430                 else
7431                         dflt=''
7432                 fi
7433                 ;;
7434         *)      dflt="$dldir/$dlsrc"
7435                 ;;
7436         esac
7437     echo "The following dynamic loading files are available:"
7438         : Can not go over to $dldir because getfile has path hard-coded in.
7439         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7440         rp="Source file to use for dynamic loading"
7441         fn="fne"
7442         gfpth="$src"
7443         . ./getfile
7444         usedl="$define"
7445         : emulate basename
7446         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7447
7448         $cat << EOM
7449
7450 Some systems may require passing special flags to $cc -c to
7451 compile modules that will be used to create a shared library.
7452 To use no flags, say "none".
7453
7454 EOM
7455     case "$cccdlflags" in
7456     '') case "$gccversion" in
7457                 '') case "$osname" in
7458                         hpux)   dflt='+z' ;;
7459                         next)   dflt='none' ;;
7460                         irix*)  dflt='-KPIC' ;;
7461                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7462                         sunos)  dflt='-pic' ;;
7463                         *)      dflt='none' ;;
7464                     esac
7465                         ;;
7466                 *)  case "$osname" in
7467                         darwin) dflt='none' ;;
7468                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7469                         *)      dflt='-fpic' ;;
7470                     esac ;;
7471             esac ;;
7472         ' ') dflt='none' ;;
7473     *)  dflt="$cccdlflags" ;;
7474     esac
7475     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7476     . ./myread
7477     case "$ans" in
7478     none) cccdlflags=' ' ;;
7479     *) cccdlflags="$ans" ;;
7480     esac
7481
7482     cat << EOM
7483
7484 Some systems use ld to create libraries that can be dynamically loaded,
7485 while other systems (such as those using ELF) use $cc.
7486
7487 EOM
7488         case "$ld" in
7489         '')     $cat >try.c <<'EOM'
7490 /* Test for whether ELF binaries are produced */
7491 #include <fcntl.h>
7492 #include <stdlib.h>
7493 int main() {
7494         char b[4];
7495         int i = open("a.out",O_RDONLY);
7496         if(i == -1) 
7497                 exit(1); /* fail */
7498         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7499                 exit(0); /* succeed (yes, it's ELF) */
7500         else
7501                 exit(1); /* fail */
7502 }
7503 EOM
7504                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7505                         cat <<EOM
7506 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7507 EOM
7508                         dflt="$cc"
7509                 else
7510                         echo "I'll use ld to build dynamic libraries."
7511                         dflt='ld'
7512                 fi
7513                 rm -f try.c a.out
7514                 ;;
7515         *)      dflt="$ld"
7516                 ;;
7517         esac
7518
7519     rp="What command should be used to create dynamic libraries?"
7520     . ./myread
7521         ld="$ans"
7522
7523     cat << EOM
7524
7525 Some systems may require passing special flags to $ld to create a
7526 library that can be dynamically loaded.  If your ld flags include
7527 -L/other/path options to locate libraries outside your loader's normal
7528 search path, you may need to specify those -L options here as well.  To
7529 use no flags, say "none".
7530
7531 EOM
7532     case "$lddlflags" in
7533     '') case "$osname" in
7534                         beos) dflt='-nostart' ;;
7535                         hpux) dflt='-b';
7536                               case "$gccversion" in
7537                               '') dflt="$dflt +vnocompatwarnings" ;;
7538                               esac
7539                               ;;        
7540                         linux|irix*)    dflt='-shared' ;;
7541                         next)  dflt='none' ;;
7542                         solaris) dflt='-G' ;;
7543                         sunos) dflt='-assert nodefinitions' ;;
7544                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7545                 *)     dflt='none' ;;
7546                         esac
7547                         ;;
7548     *) dflt="$lddlflags" ;;
7549     esac
7550
7551         : Try to guess additional flags to pick up local libraries.
7552         : Be careful not to append to a plain 'none'
7553         case "$dflt" in
7554         none) dflt='' ;;
7555         esac
7556         for thisflag in $ldflags; do
7557                 case "$thisflag" in
7558                 -L*|-R*|-Wl,-R*)
7559                         case " $dflt " in
7560                         *" $thisflag "*) ;;
7561                         *) dflt="$dflt $thisflag" ;;
7562                         esac
7563                         ;;
7564                 esac
7565         done
7566
7567         case "$dflt" in
7568         ''|' ') dflt='none' ;;
7569         esac
7570
7571     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7572     . ./myread
7573     case "$ans" in
7574     none) lddlflags=' ' ;;
7575     *) lddlflags="$ans" ;;
7576     esac
7577
7578         cat <<EOM
7579
7580 Some systems may require passing special flags to $cc to indicate that
7581 the resulting executable will use dynamic linking.  To use no flags,
7582 say "none".
7583
7584 EOM
7585     case "$ccdlflags" in
7586     '') case "$osname" in
7587                 hpux)   dflt='-Wl,-E' ;;
7588                 linux)  dflt='-rdynamic' ;;
7589                 next)   dflt='none' ;;
7590                 sunos)  dflt='none' ;;
7591                 *)      dflt='none' ;;
7592             esac ;;
7593     ' ')  dflt='none' ;;
7594     *)  dflt="$ccdlflags" ;;
7595     esac
7596     rp="Any special flags to pass to $cc to use dynamic linking?"
7597     . ./myread
7598     case "$ans" in
7599     none) ccdlflags=' ' ;;
7600     *) ccdlflags="$ans" ;;
7601     esac
7602     ;;
7603 *)  usedl="$undef"
7604         ld='ld'
7605     dlsrc='dl_none.xs'
7606     lddlflags=''
7607     ccdlflags=''
7608     ;;
7609 esac
7610
7611 also=''
7612 case "$usedl" in
7613 $undef)
7614         # No dynamic loading being used, so don't bother even to prompt.
7615         useshrplib='false'
7616         ;;
7617 *)      case "$useshrplib" in
7618         '')     case "$osname" in
7619                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7620                         dflt=y
7621                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7622                         ;;
7623                 next*)
7624                         case "$osvers" in
7625                         4*)     dflt=y
7626                                 also='Building a shared libperl is needed for MAB support.'
7627                                 ;;
7628                         *)      dflt=n
7629                                 ;;
7630                         esac
7631                         ;;
7632                 *)      dflt=n
7633                         ;;
7634                 esac
7635                 ;;
7636         $define|true|[Yy]*)
7637                 dflt=y
7638                 ;;
7639         *)      dflt=n
7640                 ;;
7641         esac
7642         $cat << EOM
7643
7644 The perl executable is normally obtained by linking perlmain.c with
7645 libperl${_a}, any static extensions (usually just DynaLoader), and
7646 any other libraries needed on this system (such as -lm, etc.).  Since
7647 your system supports dynamic loading, it is probably possible to build
7648 a shared libperl.$so.  If you will have more than one executable linked
7649 to libperl.$so, this will significantly reduce the size of each
7650 executable, but it may have a noticeable affect on performance.  The
7651 default is probably sensible for your system.
7652 $also
7653
7654 EOM
7655         rp="Build a shared libperl.$so (y/n)"
7656         . ./myread
7657         case "$ans" in
7658         true|$define|[Yy]*)
7659                 useshrplib='true'  ;;
7660         *)      useshrplib='false' ;;
7661         esac
7662         ;;
7663 esac
7664
7665 case "$useshrplib" in
7666 true)
7667         case "$libperl" in
7668         '')
7669                 # Figure out a good name for libperl.so.  Since it gets stored in
7670                 # a version-specific architecture-dependent library, the version
7671                 # number isn't really that important, except for making cc/ld happy.
7672                 #
7673                 # A name such as libperl.so.3.1
7674                 majmin="libperl.$so.$patchlevel.$subversion"
7675                 # A name such as libperl.so.301
7676                 majonly=`echo $patchlevel $subversion |
7677                         $awk '{printf "%d%02d", $1, $2}'`
7678                 majonly=libperl.$so.$majonly
7679                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7680                 # rely on figuring it out from the naming of libc.
7681                 case "${osname}${osvers}" in
7682                 next4*)
7683                         dflt=libperl.5.$so
7684                         # XXX How handle the --version stuff for MAB?
7685                         ;;
7686                 linux*)  # ld won't link with a bare -lperl otherwise.
7687                         dflt=libperl.$so
7688                         ;;
7689                 cygwin*) # ld links against an importlib
7690                         dflt=libperl$lib_ext
7691                         ;;
7692                 *)      # Try to guess based on whether libc has major.minor.
7693                         case "$libc" in
7694                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7695                         *libc.$so.[0-9]*) dflt=$majonly ;;
7696                         *)      dflt=libperl.$so ;;
7697                         esac
7698                         ;;
7699                 esac
7700                 ;;
7701         *)      dflt=$libperl
7702                 ;;
7703         esac
7704         cat << EOM
7705
7706 I need to select a good name for the shared libperl.  If your system uses
7707 library names with major and minor numbers, then you might want something
7708 like $majmin.  Alternatively, if your system uses a single version
7709 number for shared libraries, then you might want to use $majonly.
7710 Or, your system might be quite happy with a simple libperl.$so.
7711
7712 Since the shared libperl will get installed into a version-specific
7713 architecture-dependent directory, the version number of the shared perl
7714 library probably isn't important, so the default should be o.k.
7715
7716 EOM
7717         rp='What name do you want to give to the shared libperl?'
7718         . ./myread
7719         libperl=$ans
7720         echo "Ok, I'll use $libperl"
7721         ;;
7722 *)
7723         libperl="libperl${_a}"
7724         ;;
7725 esac
7726
7727 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7728 case "$shrpdir" in
7729 '') ;;
7730 *)      $cat >&4 <<EOM
7731 WARNING:  Use of the shrpdir variable for the installation location of
7732 the shared $libperl is not supported.  It was never documented and
7733 will not work in this version.  Let me (perlbug@perl.org)
7734 know of any problems this may cause.
7735
7736 EOM
7737         case "$shrpdir" in
7738         "$archlibexp/CORE")
7739                 $cat >&4 <<EOM
7740 But your current setting of $shrpdir is
7741 the default anyway, so it's harmless.
7742 EOM
7743                 ;;
7744         *)
7745                 $cat >&4 <<EOM
7746 Further, your current attempted setting of $shrpdir
7747 conflicts with the value of $archlibexp/CORE
7748 that installperl will use.
7749 EOM
7750                 ;;
7751         esac
7752         ;;
7753 esac
7754
7755 # How will the perl executable find the installed shared $libperl?
7756 # Add $xxx to ccdlflags.
7757 # If we can't figure out a command-line option, use $shrpenv to
7758 # set env LD_RUN_PATH.  The main perl makefile uses this.
7759 shrpdir=$archlibexp/CORE
7760 xxx=''
7761 tmp_shrpenv=''
7762 if "$useshrplib"; then
7763     case "$osname" in 
7764         aix)
7765                 # We'll set it in Makefile.SH...
7766                 ;;
7767         solaris)
7768                 xxx="-R $shrpdir"
7769                 ;;
7770         freebsd|netbsd)
7771                 xxx="-Wl,-R$shrpdir"
7772                 ;;
7773         bsdos|linux|irix*|dec_osf)
7774                 xxx="-Wl,-rpath,$shrpdir"
7775                 ;;
7776         next)
7777                 # next doesn't like the default...
7778                 ;;
7779         beos)
7780                 # beos doesn't like the default, either.
7781                 ;;
7782         hpux*)
7783                 # hpux doesn't like the default, either.
7784                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7785                 ;;
7786         *)
7787                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7788                 ;;
7789         esac
7790         case "$xxx" in
7791         '') ;;
7792         *)      
7793                 # Only add $xxx if it isn't already in ccdlflags.
7794                 case " $ccdlflags " in
7795                 *" $xxx "*)     ;;
7796                 *)      ccdlflags="$ccdlflags $xxx"
7797                         cat <<EOM >&4
7798
7799 Adding $xxx to the flags
7800 passed to $ld so that the perl executable will find the 
7801 installed shared $libperl.
7802
7803 EOM
7804                         ;;
7805                 esac
7806                 ;;
7807         esac
7808 fi
7809 # Fix ccdlflags in AIX for building external extensions.
7810 # (For building Perl itself bare -bE:perl.exp is needed,
7811 #  Makefile.SH takes care of this.)
7812 case "$osname" in
7813 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7814 esac
7815 # Respect a hint or command-line value.
7816 case "$shrpenv" in
7817 '') shrpenv="$tmp_shrpenv" ;;
7818 esac
7819 case "$ldlibpthname" in
7820 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7821 none)   ldlibpthname='' ;;
7822 esac
7823
7824 : determine where manual pages are on this system
7825 echo " "
7826 case "$sysman" in
7827 '') 
7828         syspath='/usr/share/man/man1 /usr/man/man1'
7829         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7830         syspath="$syspath /usr/man/u_man/man1"
7831         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7832         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7833         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7834         sysman=`./loc . /usr/man/man1 $syspath`
7835         ;;
7836 esac
7837 if $test -d "$sysman"; then
7838         echo "System manual is in $sysman." >&4
7839 else
7840         echo "Could not find manual pages in source form." >&4
7841 fi
7842
7843 : determine where manual pages go
7844 set man1dir man1dir none
7845 eval $prefixit
7846 $cat <<EOM
7847
7848 $spackage has manual pages available in source form.
7849 EOM
7850 case "$nroff" in
7851 nroff)
7852         echo "However, you don't have nroff, so they're probably useless to you."
7853         case "$man1dir" in
7854         '') man1dir="none";;
7855         esac;;
7856 esac
7857 echo "If you don't want the manual sources installed, answer 'none'."
7858 case "$man1dir" in
7859 ' ') dflt=none
7860         ;;
7861 '')
7862         lookpath="$prefixexp/share/man/man1"
7863         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7864         lookpath="$lookpath $prefixexp/man/p_man/man1"
7865         lookpath="$lookpath $prefixexp/man/u_man/man1"
7866         lookpath="$lookpath $prefixexp/man/man.1"
7867         case "$sysman" in
7868         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7869         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7870         esac
7871         set dflt
7872         eval $prefixup
7873         ;;
7874 *)  dflt="$man1dir"
7875         ;;
7876 esac
7877 echo " "
7878 fn=dn+~
7879 rp="Where do the main $spackage manual pages (source) go?"
7880 . ./getfile
7881 if $test "X$man1direxp" != "X$ansexp"; then
7882         installman1dir=''
7883 fi
7884 man1dir="$ans"
7885 man1direxp="$ansexp"
7886 case "$man1dir" in
7887 '')     man1dir=' '
7888         installman1dir='';;
7889 esac
7890
7891 : Change installation prefix, if necessary.
7892 if $test X"$prefix" != X"$installprefix"; then
7893         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7894 else
7895         installman1dir="$man1direxp"
7896 fi
7897
7898 : What suffix to use on installed man pages
7899
7900 case "$man1dir" in
7901 ' ')
7902         man1ext='0'
7903         ;;
7904 *)
7905         rp="What suffix should be used for the main $spackage man pages?"
7906         case "$man1ext" in
7907         '')     case "$man1dir" in
7908                 *1)  dflt=1 ;;
7909                 *1p) dflt=1p ;;
7910                 *1pm) dflt=1pm ;;
7911                 *l) dflt=l;;
7912                 *n) dflt=n;;
7913                 *o) dflt=o;;
7914                 *p) dflt=p;;
7915                 *C) dflt=C;;
7916                 *L) dflt=L;;
7917                 *L1) dflt=L1;;
7918                 *) dflt=1;;
7919                 esac
7920                 ;;
7921         *)      dflt="$man1ext";;
7922         esac
7923         . ./myread
7924         man1ext="$ans"
7925         ;;
7926 esac
7927
7928 : see if we can have long filenames
7929 echo " "
7930 first=123456789abcdef
7931 $rm -f $first
7932 if (echo hi >$first) 2>/dev/null; then
7933         if $test -f 123456789abcde; then
7934                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7935                 val="$undef"
7936         else
7937                 echo 'You can have filenames longer than 14 characters.'>&4
7938                 val="$define"
7939         fi
7940 else
7941         $cat <<'EOM'
7942 You can't have filenames longer than 14 chars.
7943 You can't even think about them!
7944 EOM
7945         val="$undef"
7946 fi 
7947 set d_flexfnam
7948 eval $setvar
7949 $rm -rf 123456789abcde*
7950
7951 : determine where library module manual pages go
7952 set man3dir man3dir none
7953 eval $prefixit
7954 $cat <<EOM
7955
7956 $spackage has manual pages for many of the library modules.
7957 EOM
7958
7959 case "$nroff" in
7960 nroff)
7961         $cat <<'EOM'
7962 However, you don't have nroff, so they're probably useless to you.
7963 EOM
7964         case "$man3dir" in
7965         '') man3dir="none";;
7966         esac;;
7967 esac
7968
7969 case "$d_flexfnam" in
7970 undef)
7971         $cat <<'EOM'
7972 However, your system can't handle the long file names like File::Basename.3. 
7973 EOM
7974         case "$man3dir" in
7975         '') man3dir="none";;
7976         esac;;
7977 esac
7978
7979 echo "If you don't want the manual sources installed, answer 'none'."
7980 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7981 case "$man3dir" in
7982 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7983         if $test -d "$privlib/man/man3"; then
7984                 cat <<EOM >&4
7985
7986 WARNING:  Previous versions of perl installed man3 pages into
7987 $privlib/man/man3.  This version will suggest a 
7988 new default of $dflt.  
7989 EOM
7990                 tdflt=$dflt
7991                 dflt='n'
7992                 rp='Do you wish to preserve the old behavior?(y/n)'
7993                 . ./myread
7994                 case "$ans" in
7995                 y*) dflt="$privlib/man/man3" ;;
7996                 *)  dflt=$tdflt ;;
7997                 esac
7998     fi
7999         ;;
8000 *)      dflt="$man3dir" ;;
8001 esac
8002 case "$dflt" in
8003 ' ') dflt=none ;;
8004 esac
8005 echo " "
8006 fn=dn+~
8007 rp="Where do the $package library man pages (source) go?"
8008 . ./getfile
8009 man3dir="$ans"
8010 man3direxp="$ansexp"
8011 case "$man3dir" in
8012 '')     man3dir=' '
8013         installman3dir='';;
8014 esac
8015
8016 : Change installation prefix, if necessary.
8017 if $test X"$prefix" != X"$installprefix"; then
8018         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8019 else
8020         installman3dir="$man3direxp"
8021 fi
8022
8023 : What suffix to use on installed man pages
8024 case "$man3dir" in
8025 ' ')
8026         man3ext='0'
8027         ;;
8028 *)
8029         rp="What suffix should be used for the $package library man pages?"
8030         case "$man3ext" in
8031         '')     case "$man3dir" in
8032                 *3)  dflt=3 ;;
8033                 *3p) dflt=3p ;;
8034                 *3pm) dflt=3pm ;;
8035                 *l) dflt=l;;
8036                 *n) dflt=n;;
8037                 *o) dflt=o;;
8038                 *p) dflt=p;;
8039                 *C) dflt=C;;
8040                 *L) dflt=L;;
8041                 *L3) dflt=L3;;
8042                 *) dflt=3;;
8043                 esac
8044                 ;;
8045         *)      dflt="$man3ext";;
8046         esac
8047         . ./myread
8048         man3ext="$ans"
8049         ;;
8050 esac
8051
8052 : see if we have to deal with yellow pages, now NIS.
8053 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8054         if $test -f /usr/etc/nibindd; then
8055                 echo " "
8056                 echo "I'm fairly confident you're on a NeXT."
8057                 echo " "
8058                 rp='Do you get the hosts file via NetInfo?'
8059                 dflt=y
8060                 case "$hostcat" in
8061                 nidump*) ;;
8062                 '') ;;
8063                 *) dflt=n;;
8064                 esac
8065                 . ./myread
8066                 case "$ans" in
8067                 y*) hostcat='nidump hosts .';;
8068                 *)      case "$hostcat" in
8069                         nidump*) hostcat='';;
8070                         esac
8071                         ;;
8072                 esac
8073         fi
8074         case "$hostcat" in
8075         nidump*) ;;
8076         *)
8077                 case "$hostcat" in
8078                 *ypcat*) dflt=y;;
8079                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8080                                 dflt=y
8081                         else
8082                                 dflt=n
8083                         fi;;
8084                 *) dflt=n;;
8085                 esac
8086                 echo " "
8087                 rp='Are you getting the hosts file via yellow pages?'
8088                 . ./myread
8089                 case "$ans" in
8090                 y*) hostcat='ypcat hosts';;
8091                 *) hostcat='cat /etc/hosts';;
8092                 esac
8093                 ;;
8094         esac
8095 fi
8096 case "$hostcat" in
8097 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8098 esac
8099 case "$groupcat" in
8100 '') test -f /etc/group && groupcat='cat /etc/group';;
8101 esac
8102 case "$passcat" in
8103 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8104 esac
8105
8106 : now get the host name
8107 echo " "
8108 echo "Figuring out host name..." >&4
8109 case "$myhostname" in
8110 '') cont=true
8111         echo 'Maybe "hostname" will work...'
8112         if tans=`sh -c hostname 2>&1` ; then
8113                 myhostname=$tans
8114                 phostname=hostname
8115                 cont=''
8116         fi
8117         ;;
8118 *) cont='';;
8119 esac
8120 if $test "$cont"; then
8121         if ./xenix; then
8122                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8123                 if tans=`cat /etc/systemid 2>&1` ; then
8124                         myhostname=$tans
8125                         phostname='cat /etc/systemid'
8126                         echo "Whadyaknow.  Xenix always was a bit strange..."
8127                         cont=''
8128                 fi
8129         elif $test -r /etc/systemid; then
8130                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8131         fi
8132 fi
8133 if $test "$cont"; then
8134         echo 'No, maybe "uuname -l" will work...'
8135         if tans=`sh -c 'uuname -l' 2>&1` ; then
8136                 myhostname=$tans
8137                 phostname='uuname -l'
8138         else
8139                 echo 'Strange.  Maybe "uname -n" will work...'
8140                 if tans=`sh -c 'uname -n' 2>&1` ; then
8141                         myhostname=$tans
8142                         phostname='uname -n'
8143                 else
8144                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8145                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8146                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8147                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8148                         else
8149                                 case "$myhostname" in
8150                                 '') echo "Does this machine have an identity crisis or something?"
8151                                         phostname='';;
8152                                 *)
8153                                         echo "Well, you said $myhostname before..."
8154                                         phostname='echo $myhostname';;
8155                                 esac
8156                         fi
8157                 fi
8158         fi
8159 fi
8160 case "$myhostname" in
8161 '') myhostname=noname ;;
8162 esac
8163 : you do not want to know about this
8164 set $myhostname
8165 myhostname=$1
8166
8167 : verify guess
8168 if $test "$myhostname" ; then
8169         dflt=y
8170         rp='Your host name appears to be "'$myhostname'".'" Right?"
8171         . ./myread
8172         case "$ans" in
8173         y*) ;;
8174         *) myhostname='';;
8175         esac
8176 fi
8177
8178 : bad guess or no guess
8179 while $test "X$myhostname" = X ; do
8180         dflt=''
8181         rp="Please type the (one word) name of your host:"
8182         . ./myread
8183         myhostname="$ans"
8184 done
8185
8186 : translate upper to lower if necessary
8187 case "$myhostname" in
8188 *[A-Z]*)
8189         echo "(Normalizing case in your host name)"
8190         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8191         ;;
8192 esac
8193
8194 case "$myhostname" in
8195 *.*)
8196         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8197         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8198         echo "(Trimming domain name from host name--host name is now $myhostname)"
8199         ;;
8200 *) case "$mydomain" in
8201         '')
8202                 {
8203                         test "X$hostcat" = "Xypcat hosts" &&
8204                         ypmatch "$myhostname" hosts 2>/dev/null |\
8205                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8206                         $test -s hosts
8207                 } || {
8208                         test "X$hostcat" != "X" &&
8209                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8210                                         /[       ]$myhostname[  . ]/p" > hosts
8211                 }
8212                 tmp_re="[       . ]"
8213                 if $test -f hosts; then
8214                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8215                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8216                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8217                                 hosts | $sort | $uniq | \
8218                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8219                         case `$echo X$dflt` in
8220                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8221                                 dflt=.
8222                                 ;;
8223                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8224                                 ;;
8225                         esac
8226                 else
8227                         echo "(I cannot locate a hosts database anywhere)"
8228                         dflt=.
8229                 fi
8230                 case "$dflt" in
8231                 .)
8232                         tans=`./loc resolv.conf X /etc /usr/etc`
8233                         if $test -f "$tans"; then
8234                                 echo "(Attempting domain name extraction from $tans)"
8235                                 dflt=.`$sed -n -e 's/   / /g' \
8236                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8237                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8238                                 case "$dflt" in
8239                                 .) dflt=.`$sed -n -e 's/        / /g' \
8240                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8241                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8242                                         ;;
8243                                 esac
8244                         fi
8245                         ;;
8246                 esac
8247                 case "$dflt" in
8248                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8249                         dflt=.`sh -c domainname 2>/dev/null`
8250                         case "$dflt" in
8251                         '') dflt='.';;
8252                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8253                         esac
8254                         ;;
8255                 esac
8256                 case "$dflt$osname" in
8257                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8258                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8259                         ;;
8260                 esac
8261                 case "$dflt" in
8262                 .) echo "(Lost all hope -- silly guess then)"
8263                         dflt='.nonet'
8264                         ;;
8265                 esac
8266                 $rm -f hosts
8267                 ;;
8268         *) dflt="$mydomain";;
8269         esac;;
8270 esac
8271 echo " "
8272 rp="What is your domain name?"
8273 . ./myread
8274 tans="$ans"
8275 case "$ans" in
8276 '') ;;
8277 .*) ;;
8278 *) tans=".$tans";;
8279 esac
8280 mydomain="$tans"
8281
8282 : translate upper to lower if necessary
8283 case "$mydomain" in
8284 *[A-Z]*)
8285         echo "(Normalizing case in your domain name)"
8286         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8287         ;;
8288 esac
8289
8290 : a little sanity check here
8291 case "$phostname" in
8292 '') ;;
8293 *)
8294         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8295         $myhostname$mydomain|$myhostname) ;;
8296         *)
8297                 case "$phostname" in
8298                 sed*)
8299                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8300                         ;;
8301                 *)
8302                         echo "(That doesn't agree with your $phostname command, by the way.)"
8303                         ;;
8304                 esac
8305         ;;
8306         esac
8307         ;;
8308 esac
8309
8310 $cat <<EOM
8311
8312 I need to get your e-mail address in Internet format if possible, i.e.
8313 something like user@host.domain. Please answer accurately since I have
8314 no easy means to double check it. The default value provided below
8315 is most probably close to reality but may not be valid from outside
8316 your organization...
8317
8318 EOM
8319 cont=x
8320 while test "$cont"; do
8321         case "$cf_email" in
8322         '') dflt="$cf_by@$myhostname$mydomain";;
8323         *) dflt="$cf_email";;
8324         esac
8325         rp='What is your e-mail address?'
8326         . ./myread
8327         cf_email="$ans"
8328         case "$cf_email" in
8329         *@*.*) cont='' ;;
8330         *)
8331                 rp='Address does not look like an Internet one.  Use it anyway?'
8332                 case "$fastread" in
8333                 yes) dflt=y ;;
8334                 *) dflt=n ;;
8335                 esac
8336                 . ./myread
8337                 case "$ans" in
8338                 y*) cont='' ;;
8339                 *) echo " " ;;
8340                 esac
8341                 ;;
8342         esac
8343 done
8344
8345 $cat <<EOM
8346
8347 If you or somebody else will be maintaining perl at your site, please
8348 fill in the correct e-mail address here so that they may be contacted
8349 if necessary. Currently, the "perlbug" program included with perl
8350 will send mail to this address in addition to perlbug@perl.org. You may
8351 enter "none" for no administrator.
8352
8353 EOM
8354 case "$perladmin" in
8355 '') dflt="$cf_email";;
8356 *) dflt="$perladmin";;
8357 esac
8358 rp='Perl administrator e-mail address'
8359 . ./myread
8360 perladmin="$ans"
8361
8362 : determine whether to only install version-specific parts.
8363 echo " "
8364 $cat <<EOM
8365 Do you want to install only the version-specific parts of the perl
8366 distribution?  Usually you do *not* want to do this.
8367 EOM
8368 case "$versiononly" in
8369 "$define"|[Yy]*|true) dflt='y' ;;
8370 *) dflt='n';
8371 esac
8372 rp="Do you want to install only the version-specific parts of perl?"
8373 . ./myread
8374 case "$ans" in
8375 [yY]*)  val="$define";;
8376 *)      val="$undef" ;;
8377 esac
8378 set versiononly
8379 eval $setvar
8380
8381 : figure out how to guarantee perl startup
8382 case "$startperl" in
8383 '')
8384         case "$sharpbang" in
8385         *!)
8386                 $cat <<EOH
8387
8388 I can use the #! construct to start perl on your system. This will
8389 make startup of perl scripts faster, but may cause problems if you
8390 want to share those scripts and perl is not in a standard place
8391 ($binexp/perl) on all your platforms. The alternative is to force
8392 a shell by starting the script with a single ':' character.
8393
8394 EOH
8395                 case "$versiononly" in
8396                 "$define")      dflt="$binexp/perl$version";;  
8397                 *)              dflt="$binexp/perl";;
8398                 esac
8399                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8400                 . ./myread
8401                 case "$ans" in
8402                 none)   startperl=": # use perl";;
8403                 *)      startperl="#!$ans"
8404                         if $test 30 -lt `echo "$ans" | wc -c`; then
8405                                 $cat >&4 <<EOM
8406
8407 WARNING:  Some systems limit the #! command to 32 characters.
8408 If you experience difficulty running Perl scripts with #!, try
8409 installing Perl in a directory with a shorter pathname.
8410
8411 EOM
8412                         fi ;;
8413                 esac
8414                 ;;
8415         *) startperl=": # use perl"
8416                 ;;
8417         esac
8418         ;;
8419 esac
8420 echo "I'll use $startperl to start perl scripts."
8421
8422 : figure best path for perl in scripts
8423 case "$perlpath" in
8424 '')
8425         case "$versiononly" in
8426         "$define")      perlpath="$binexp/perl$version";;
8427         *)              perlpath="$binexp/perl";;
8428         esac
8429         case "$startperl" in
8430         *!*) ;;
8431         *)
8432                 $cat <<EOH
8433
8434 I will use the "eval 'exec'" idiom to start Perl on your system.
8435 I can use the full path of your Perl binary for this purpose, but
8436 doing so may cause problems if you want to share those scripts and
8437 Perl is not always in a standard place ($binexp/perl).
8438
8439 EOH
8440                 dflt="$binexp/perl"
8441                 rp="What path shall I use in \"eval 'exec'\"?"
8442                 . ./myread
8443                 perlpath="$ans"
8444                 ;;
8445         esac
8446         ;;
8447 esac
8448 case "$startperl" in
8449 *!*)    ;;
8450 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8451 esac
8452
8453 : determine where public executable scripts go
8454 set scriptdir scriptdir
8455 eval $prefixit
8456 case "$scriptdir" in
8457 '')
8458         dflt="$bin"
8459         : guess some guesses
8460         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8461         $test -d /usr/share/bin     && dflt=/usr/share/bin
8462         $test -d /usr/local/script  && dflt=/usr/local/script
8463         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8464         $test -d $prefixexp/script  && dflt=$prefixexp/script
8465         set dflt
8466         eval $prefixup
8467         ;;
8468 *)  dflt="$scriptdir"
8469         ;;
8470 esac
8471 $cat <<EOM
8472  
8473 Some installations have a separate directory just for executable scripts so
8474 that they can mount it across multiple architectures but keep the scripts in
8475 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8476 Or you might just lump your scripts in with all your other executables.
8477  
8478 EOM
8479 fn=d~
8480 rp='Where do you keep publicly executable scripts?'
8481 . ./getfile
8482 if $test "X$ansexp" != "X$scriptdirexp"; then
8483         installscript=''
8484 fi
8485 scriptdir="$ans"
8486 scriptdirexp="$ansexp"
8487 : Change installation prefix, if necessary.
8488 if $test X"$prefix" != X"$installprefix"; then
8489         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8490 else
8491         installscript="$scriptdirexp"
8492 fi
8493
8494 : determine where add-on public executables go
8495 case "$sitebin" in
8496 '')     dflt=$siteprefix/bin ;;
8497 *)      dflt=$sitebin ;;
8498 esac
8499 fn=d~
8500 rp='Pathname where the add-on public executables should be installed?'
8501 . ./getfile
8502 sitebin="$ans"
8503 sitebinexp="$ansexp"
8504 : Change installation prefix, if necessary.
8505 if $test X"$prefix" != X"$installprefix"; then
8506         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8507 else
8508         installsitebin="$sitebinexp"
8509 fi
8510
8511 : define an is-a-typedef? function
8512 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8513 case "$inclist" in
8514 "") inclist="sys/types.h";;
8515 esac;
8516 eval "varval=\$$var";
8517 case "$varval" in
8518 "")
8519         $rm -f temp.c;
8520         for inc in $inclist; do
8521                 echo "#include <$inc>" >>temp.c;
8522         done;
8523         echo "#ifdef $type" >> temp.c;
8524         echo "printf(\"We have $type\");" >> temp.c;
8525         echo "#endif" >> temp.c;
8526         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8527         if $contains $type temp.E >/dev/null 2>&1; then
8528                 eval "$var=\$type";
8529         else
8530                 eval "$var=\$def";
8531         fi;
8532         $rm -f temp.?;;
8533 *) eval "$var=\$varval";;
8534 esac'
8535
8536 : define an is-a-typedef? function that prompts if the type is not available.
8537 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8538 case "$inclist" in
8539 "") inclist="sys/types.h";;
8540 esac;
8541 eval "varval=\$$var";
8542 case "$varval" in
8543 "")
8544         $rm -f temp.c;
8545         for inc in $inclist; do
8546                 echo "#include <$inc>" >>temp.c;
8547         done;
8548         echo "#ifdef $type" >> temp.c;
8549         echo "printf(\"We have $type\");" >> temp.c;
8550         echo "#endif" >> temp.c;
8551         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8552         echo " " ;
8553         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8554         if $contains $type temp.E >/dev/null 2>&1; then
8555                 echo "$type found." >&4;
8556                 eval "$var=\$type";
8557         else
8558                 echo "$type NOT found." >&4;
8559                 dflt="$def";
8560                 . ./myread ;
8561                 eval "$var=\$ans";
8562         fi;
8563         $rm -f temp.?;;
8564 *) eval "$var=\$varval";;
8565 esac'
8566
8567 : see what type lseek is declared as in the kernel
8568 rp="What is the type used for lseek's offset on this system?"
8569 set off_t lseektype long stdio.h sys/types.h
8570 eval $typedef_ask
8571
8572 echo " "
8573 echo "Checking to see how big your file offsets are..." >&4
8574 $cat >try.c <<EOCP
8575 #include <sys/types.h>
8576 #include <stdio.h>
8577 int main()
8578 {
8579     printf("%d\n", (int)sizeof($lseektype));
8580     return(0); 
8581 }
8582 EOCP
8583 set try
8584 if eval $compile_ok; then
8585         lseeksize=`$run ./try`
8586         echo "Your file offsets are $lseeksize bytes long."
8587 else
8588         dflt=$longsize
8589         echo " "
8590         echo "(I can't seem to compile the test program.  Guessing...)"
8591         rp="What is the size of your file offsets (in bytes)?"
8592         . ./myread
8593         lseeksize="$ans"
8594 fi
8595 $rm -f try.c try
8596
8597 : see what type file positions are declared as in the library
8598 rp="What is the type for file position used by fsetpos()?"
8599 set fpos_t fpostype long stdio.h sys/types.h
8600 eval $typedef_ask
8601
8602 echo " "
8603 case "$fpostype" in
8604 *_t) zzz="$fpostype"    ;;
8605 *)   zzz="fpos_t"       ;;
8606 esac
8607 echo "Checking the size of $zzz..." >&4 
8608 cat > try.c <<EOCP
8609 #include <sys/types.h>
8610 #include <stdio.h>
8611 int main() {
8612     printf("%d\n", (int)sizeof($fpostype));
8613     exit(0);
8614 }
8615 EOCP
8616 set try
8617 if eval $compile_ok; then
8618         yyy=`$run ./try`
8619         case "$yyy" in
8620         '')     fpossize=4
8621                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8622                 ;;
8623         *)      fpossize=$yyy
8624                 echo "Your $zzz is $fpossize bytes long."
8625                 ;;
8626         esac
8627 else
8628         dflt="$longsize"
8629         echo " " >&4
8630         echo "(I can't compile the test program.  Guessing...)" >&4
8631         rp="What is the size of your file positions (in bytes)?"
8632         . ./myread
8633         fpossize="$ans"
8634 fi
8635
8636
8637
8638 # Backward compatibility (uselfs is deprecated).
8639 case "$uselfs" in
8640 "$define"|true|[yY]*)
8641         cat <<EOM >&4
8642
8643 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8644 EOM
8645         uselargefiles="$define"
8646         ;;
8647 esac                          
8648
8649 case "$lseeksize:$fpossize" in
8650 8:8) cat <<EOM
8651
8652 You can have files larger than 2 gigabytes.
8653 EOM
8654    val="$define" ;;
8655 *)    case "$uselargefiles" in
8656    "$undef"|false|[nN]*) dflt='n' ;;
8657    *)   dflt='y' ;;
8658    esac
8659    cat <<EOM
8660
8661 Perl can be built to understand large files (files larger than 2 gigabytes)
8662 on some systems.  To do so, Configure can be run with -Duselargefiles.
8663
8664 If this doesn't make any sense to you, just accept the default '$dflt'.
8665 EOM
8666    rp='Try to understand large files, if available?'
8667    . ./myread
8668    case "$ans" in
8669    y|Y)         val="$define" ;;
8670    *)           val="$undef"  ;;
8671    esac
8672    ;;
8673 esac
8674 set uselargefiles
8675 eval $setvar
8676 case "$uselargefiles" in
8677 "$define")
8678 : Look for a hint-file generated 'call-back-unit'.  If the
8679 : user has specified that a large files perl is to be built,
8680 : we may need to set or change some other defaults.
8681         if $test -f uselargefiles.cbu; then
8682                 echo "Your platform has some specific hints for large file builds, using them..."
8683                 . ./uselargefiles.cbu
8684                 echo " "
8685                 echo "Rechecking to see how big your file offsets are..." >&4
8686                 $cat >try.c <<EOCP
8687 #include <sys/types.h>
8688 #include <stdio.h>
8689 int main()
8690 {
8691     printf("%d\n", (int)sizeof($lseektype));
8692     return(0); 
8693 }
8694 EOCP
8695                 set try
8696                 if eval $compile_ok; then
8697                         lseeksize=`$run ./try`
8698                         $echo "Your file offsets are now $lseeksize bytes long."
8699                 else
8700                         dflt="$lseeksize"
8701                         echo " "
8702                         echo "(I can't seem to compile the test program.  Guessing...)"
8703                         rp="What is the size of your file offsets (in bytes)?"
8704                         . ./myread
8705                         lseeksize="$ans"
8706                 fi
8707                 case "$fpostype" in
8708                 *_t) zzz="$fpostype"    ;;
8709                 *)   zzz="fpos_t"       ;;
8710                 esac
8711                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8712                 $cat > try.c <<EOCP
8713 #include <sys/types.h>
8714 #include <stdio.h>
8715 int main() {
8716     printf("%d\n", (int)sizeof($fpostype));
8717     exit(0);
8718 }
8719 EOCP
8720                 set try
8721                 if eval $compile_ok; then
8722                         yyy=`$run ./try`
8723                         dflt="$lseeksize"
8724                         case "$yyy" in
8725                         '')     echo " "
8726                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8727                                 ;;
8728                         *)      fpossize=$yyy
8729                                 echo " $fpossize bytes." >&4
8730                                 ;;
8731                         esac
8732                 else
8733                         dflt="$fpossize"
8734                         echo " "
8735                         echo "(I can't compile the test program.  Guessing...)" >&4
8736                         rp="What is the size of your file positions (in bytes)?"
8737                         . ./myread
8738                         fpossize="$ans"
8739                 fi
8740                 $rm -f try.c try
8741         fi
8742         ;;
8743 esac
8744
8745 case "$vendorprefix" in
8746 '')     d_vendorbin="$undef"
8747         vendorbin=''
8748         vendorbinexp=''
8749         ;;
8750 *)      d_vendorbin="$define"
8751         : determine where vendor-supplied executables go.
8752         case "$vendorbin" in
8753         '') dflt=$vendorprefix/bin ;;
8754         *)      dflt="$vendorbin" ;;
8755         esac
8756         fn=d~+
8757         rp='Pathname for the vendor-supplied executables directory?'
8758         . ./getfile
8759         vendorbin="$ans"
8760         vendorbinexp="$ansexp"
8761         ;;
8762 esac
8763 : Change installation prefix, if necessary.
8764 if $test X"$prefix" != X"$installprefix"; then
8765         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8766 else
8767         installvendorbin="$vendorbinexp"
8768 fi
8769
8770 : see if qgcvt exists
8771 set qgcvt d_qgcvt
8772 eval $inlibc
8773
8774 : Check how to convert floats to strings.
8775
8776 if test "X$d_Gconvert" = X; then
8777
8778 echo " "
8779 echo "Checking for an efficient way to convert floats to strings."
8780 echo " " > try.c
8781 case "$uselongdouble" in
8782 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8783 esac
8784 case "$d_longdbl" in
8785 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8786 esac
8787 case "$d_PRIgldbl" in
8788 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8789 esac
8790 $cat >>try.c <<EOP
8791 #ifdef TRY_gconvert
8792 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8793 char *myname = "gconvert";
8794 #endif
8795 #ifdef TRY_gcvt
8796 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8797 char *myname = "gcvt";
8798 #endif
8799 #ifdef TRY_qgcvt
8800 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8801 char *myname = "qgcvt";
8802 #define DOUBLETYPE long double
8803 #endif
8804 #ifdef TRY_sprintf
8805 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8806 #ifdef HAS_PRIgldbl
8807 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8808 #else
8809 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8810 #endif
8811 #else
8812 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8813 #endif
8814 char *myname = "sprintf";
8815 #endif
8816
8817 #ifndef DOUBLETYPE
8818 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8819 #define DOUBLETYPE long double
8820 #else
8821 #define DOUBLETYPE double
8822 #endif
8823 #endif
8824
8825 #include <stdio.h>
8826
8827 #define I_STDLIB $i_stdlib
8828 #ifdef I_STDLIB
8829 #include <stdlib.h>
8830 #endif
8831
8832 int
8833 checkit(expect, got)
8834 char *expect;
8835 char *got;
8836 {
8837     if (strcmp(expect, got)) {
8838                 printf("%s oddity:  Expected %s, got %s\n",
8839                         myname, expect, got);
8840                 exit(1);
8841         }
8842 }
8843
8844 int main()
8845
8846         char buf[64]; 
8847         buf[63] = '\0';
8848
8849         /* This must be 1st test on (which?) platform */
8850         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8851         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8852         checkit("0.1", buf);
8853
8854         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8855         checkit("0.01", buf);
8856
8857         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8858         checkit("0.001", buf);
8859
8860         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8861         checkit("0.0001", buf);
8862
8863         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8864         if (strlen(buf) > 5)
8865             checkit("9e-005", buf); /* for Microsoft ?? */
8866         else
8867             checkit("9e-05", buf);
8868
8869         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8870         checkit("1", buf);
8871
8872         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8873         checkit("1.1", buf);
8874
8875         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8876         checkit("1.01", buf);
8877
8878         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8879         checkit("1.001", buf);
8880
8881         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8882         checkit("1.0001", buf);
8883
8884         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8885         checkit("1.00001", buf);
8886
8887         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8888         checkit("1.000001", buf);
8889
8890         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8891         checkit("0", buf);
8892
8893         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8894         checkit("-1", buf);
8895
8896         /* Some Linux gcvt's give 1.e+5 here. */
8897         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8898         checkit("100000", 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         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8905         checkit("123.456", buf);
8906
8907         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8908         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8909         /* 34 should be enough to scare even long double
8910          * places into using the e notation. */
8911         if (strlen(buf) > 5)
8912             checkit("1e+034", buf); /* for Microsoft */
8913         else
8914             checkit("1e+34", buf);
8915
8916         /* For Perl, if you add additional tests here, also add them to
8917          * t/base/num.t for benefit of platforms not using Configure or
8918          * overriding d_Gconvert */
8919
8920         exit(0);
8921 }
8922 EOP
8923 : first add preferred functions to our list
8924 xxx_list=""
8925 for xxx_convert in $gconvert_preference; do
8926     case $xxx_convert in
8927     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8928     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8929     esac 
8930 done
8931 : then add any others
8932 for xxx_convert in gconvert gcvt sprintf; do
8933     case "$xxx_list" in
8934     *$xxx_convert*) ;;
8935     *) xxx_list="$xxx_list $xxx_convert" ;;
8936     esac 
8937 done
8938
8939 case "$d_longdbl$uselongdouble" in
8940 "$define$define")
8941     : again, add prefered functions to our list first
8942     xxx_ld_list=""
8943     for xxx_convert in $gconvert_ld_preference; do
8944         case $xxx_convert in
8945         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8946         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8947         esac
8948     done
8949     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8950     for xxx_convert in qgcvt sprintf $xxx_list; do
8951         case "$xxx_ld_list" in
8952         $xxx_convert*|*" $xxx_convert"*) ;;
8953         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8954         esac
8955     done
8956     : if sprintf cannot do long doubles, move it to the end
8957     if test "$d_PRIgldbl" != "$define"; then
8958         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8959     fi
8960     : if no qgcvt, remove it
8961     if test "$d_qgcvt" != "$define"; then
8962         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8963     fi
8964     : use the ld_list
8965     xxx_list="$xxx_ld_list"
8966     ;;
8967 esac
8968
8969 for xxx_convert in $xxx_list; do
8970         echo "Trying $xxx_convert..."
8971         $rm -f try try$_o
8972         set try -DTRY_$xxx_convert
8973         if eval $compile; then
8974                 echo "$xxx_convert() found." >&4
8975                 if $run ./try; then
8976                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8977                         break;
8978                 else
8979                         echo "...But $xxx_convert didn't work as I expected."
8980                         xxx_convert=''
8981                 fi
8982         else
8983                 echo "$xxx_convert NOT found." >&4
8984         fi
8985 done
8986
8987 if test X$xxx_convert = X; then
8988     echo "*** WHOA THERE!!! ***" >&4
8989     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8990     xxx_convert=sprintf
8991 fi
8992
8993 case "$xxx_convert" in
8994 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8995 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8996 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8997 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8998    "$define$define$define")
8999       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9000    "$define$define$undef")
9001       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9002    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9003    esac
9004    ;;  
9005 esac
9006
9007 fi
9008
9009 : see if _fwalk exists
9010 set fwalk d__fwalk
9011 eval $inlibc
9012
9013 : Initialize h_fcntl
9014 h_fcntl=false
9015
9016 : Initialize h_sysfile
9017 h_sysfile=false
9018
9019 : access call always available on UNIX
9020 set access d_access
9021 eval $inlibc
9022
9023 : locate the flags for 'access()'
9024 case "$d_access" in
9025 "$define")
9026         echo " "
9027         $cat >access.c <<'EOCP'
9028 #include <sys/types.h>
9029 #ifdef I_FCNTL
9030 #include <fcntl.h>
9031 #endif
9032 #ifdef I_SYS_FILE
9033 #include <sys/file.h>
9034 #endif
9035 #ifdef I_UNISTD
9036 #include <unistd.h>
9037 #endif
9038 int main() {
9039         exit(R_OK);
9040 }
9041 EOCP
9042         : check sys/file.h first, no particular reason here
9043         if $test `./findhdr sys/file.h` && \
9044                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9045                 h_sysfile=true;
9046                 echo "<sys/file.h> defines the *_OK access constants." >&4
9047         elif $test `./findhdr fcntl.h` && \
9048                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9049                 h_fcntl=true;
9050                 echo "<fcntl.h> defines the *_OK access constants." >&4
9051         elif $test `./findhdr unistd.h` && \
9052                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9053                 echo "<unistd.h> defines the *_OK access constants." >&4
9054         else
9055                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9056         fi
9057         ;;
9058 esac
9059 $rm -f access*
9060
9061 : see if accessx exists
9062 set accessx d_accessx
9063 eval $inlibc
9064
9065 : see if alarm exists
9066 set alarm d_alarm
9067 eval $inlibc
9068
9069 : define a fucntion to check prototypes
9070 $cat > protochk <<EOSH
9071 $startsh
9072 cc="$cc"
9073 optimize="$optimize"
9074 ccflags="$ccflags"
9075 prototype="$prototype"
9076 define="$define"
9077 rm=$rm
9078 EOSH
9079
9080 $cat >> protochk <<'EOSH'
9081
9082 $rm -f try.c
9083 foo="$1"
9084 shift
9085 while test $# -ge 2; do
9086         case "$1" in
9087                 $define) echo "#include <$2>" >> try.c ;;
9088                 literal) echo "$2" >> try.c ;;
9089         esac
9090     shift 2
9091 done
9092 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9093 cat >> try.c <<'EOCP'
9094 #ifdef CAN_PROTOTYPE
9095 #define _(args) args
9096 #else
9097 #define _(args) ()
9098 #endif
9099 EOCP
9100 echo "$foo" >> try.c
9101 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9102 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9103 status=$?
9104 $rm -f try.[co]
9105 exit $status
9106 EOSH
9107 chmod +x protochk
9108 $eunicefix protochk
9109
9110 hasproto='varname=$1; func=$2; shift; shift;
9111 while $test $# -ge 2; do
9112         case "$1" in
9113         $define) echo "#include <$2>";;
9114         esac ;
9115     shift 2;
9116 done > try.c;
9117 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9118 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9119         echo "$func() prototype found.";
9120         val="$define";
9121 else
9122         echo "$func() prototype NOT found.";
9123         val="$undef";
9124 fi;
9125 set $varname;
9126 eval $setvar;
9127 $rm -f try.c tryout.c'
9128
9129 : see if sys/types.h has to be included
9130 set sys/types.h i_systypes
9131 eval $inhdr
9132
9133 : see if sys/select.h has to be included
9134 set sys/select.h i_sysselct
9135 eval $inhdr
9136
9137 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9138 while $test $# -ge 2; do
9139         case "$1" in
9140         $define) echo "#include <$2>";;
9141         esac ;
9142     shift 2;
9143 done > try.c;
9144 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9145 set try;
9146 if eval $compile; then
9147         val="$define";
9148 else
9149         val="$undef";
9150 fi;
9151 set $varname;
9152 eval $setvar;
9153 $rm -f try.c try.o'
9154
9155 : see if we should include time.h, sys/time.h, or both
9156 echo " "
9157 if test "X$timeincl" = X; then
9158         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9159         $echo $n "I'm now running the test program...$c"
9160         $cat >try.c <<'EOCP'
9161 #include <sys/types.h>
9162 #ifdef I_TIME
9163 #include <time.h>
9164 #endif
9165 #ifdef I_SYSTIME
9166 #ifdef SYSTIMEKERNEL
9167 #define KERNEL
9168 #endif
9169 #include <sys/time.h>
9170 #endif
9171 #ifdef I_SYSSELECT
9172 #include <sys/select.h>
9173 #endif
9174 int main()
9175 {
9176         struct tm foo;
9177 #ifdef S_TIMEVAL
9178         struct timeval bar;
9179 #endif
9180 #ifdef S_TIMEZONE
9181         struct timezone tzp;
9182 #endif
9183         if (foo.tm_sec == foo.tm_sec)
9184                 exit(0);
9185 #ifdef S_TIMEVAL
9186         if (bar.tv_sec == bar.tv_sec)
9187                 exit(0);
9188 #endif
9189         exit(1);
9190 }
9191 EOCP
9192         flags=''
9193         for s_timezone in '-DS_TIMEZONE' ''; do
9194         sysselect=''
9195         for s_timeval in '-DS_TIMEVAL' ''; do
9196         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9197         for i_time in '' '-DI_TIME'; do
9198         for i_systime in '-DI_SYSTIME' ''; do
9199                 case "$flags" in
9200                 '') $echo $n ".$c"
9201                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9202                         if eval $compile; then
9203                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9204                                 shift
9205                                 flags="$*"
9206                                 echo " "
9207                                 $echo $n "Succeeded with $flags$c"
9208                         fi
9209                         ;;
9210                 esac
9211         done
9212         done
9213         done
9214         done
9215         done
9216         timeincl=''
9217         echo " "
9218         case "$flags" in
9219         *SYSTIMEKERNEL*) i_systimek="$define"
9220                 timeincl=`./findhdr sys/time.h`
9221                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9222         *) i_systimek="$undef";;
9223         esac
9224         case "$flags" in
9225         *I_TIME*) i_time="$define"
9226                 timeincl=`./findhdr time.h`" $timeincl"
9227                 echo "We'll include <time.h>." >&4;;
9228         *) i_time="$undef";;
9229         esac
9230         case "$flags" in
9231         *I_SYSTIME*) i_systime="$define"
9232                 timeincl=`./findhdr sys/time.h`" $timeincl"
9233                 echo "We'll include <sys/time.h>." >&4;;
9234         *) i_systime="$undef";;
9235         esac
9236         $rm -f try.c try
9237 fi
9238 : see if struct tm knows about tm_zone
9239 case "$i_systime$i_time" in
9240 *$define*) 
9241         echo " "
9242         echo "Checking to see if your struct tm has tm_zone field..." >&4
9243         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9244         eval $hasfield
9245         ;;
9246 *)      val="$undef"
9247         set d_tm_tm_zone
9248         eval $setvar
9249         ;;
9250 esac
9251 case "$d_tm_tm_zone" in
9252 "$define")      echo "Yes, it does."   ;;
9253 *)              echo "No, it doesn't." ;;
9254 esac
9255 : see if struct tm knows about tm_gmtoff
9256 case "$i_systime$i_time" in
9257 *$define*) 
9258         echo " "
9259         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9260         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9261         eval $hasfield
9262         ;;
9263 *)      val="$undef"
9264         set d_tm_tm_gmtoff
9265         eval $setvar
9266         ;;
9267 esac
9268 case "$d_tm_tm_gmtoff" in
9269 "$define")      echo "Yes, it does."   ;;
9270 *)              echo "No, it doesn't." ;;
9271 esac
9272
9273 : see if asctime_r exists
9274 set asctime_r d_asctime_r
9275 eval $inlibc
9276 case "$d_asctime_r" in
9277 "$define")
9278         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
9279         case "$d_asctime_r_proto:$usethreads" in
9280         ":define")      d_asctime_r_proto=define
9281                 set d_asctime_r_proto asctime_r $hdrs
9282                 eval $hasproto ;;
9283         *)      ;;
9284         esac
9285         case "$d_asctime_r_proto" in
9286         define)
9287         case "$asctime_r_proto" in
9288         ''|0) try='char* asctime_r(const struct tm*, char*);'
9289         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9290         esac
9291         case "$asctime_r_proto" in
9292         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9293         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9294         esac
9295         case "$asctime_r_proto" in
9296         ''|0) try='int asctime_r(const struct tm*, char*);'
9297         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9298         esac
9299         case "$asctime_r_proto" in
9300         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9301         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9302         esac
9303         case "$asctime_r_proto" in
9304         '')     d_asctime_r=undef
9305                 asctime_r_proto=0
9306                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9307         * )     case "$asctime_r_proto" in
9308                 REENTRANT_PROTO*) ;;
9309                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9310                 esac
9311                 echo "Prototype: $try" ;;
9312         esac
9313         ;;
9314         *)      case "$usethreads" in
9315                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9316                 esac
9317                 ;;
9318         esac
9319         ;;
9320 *)      asctime_r_proto=0
9321         ;;
9322 esac
9323
9324 : see if atolf exists
9325 set atolf d_atolf
9326 eval $inlibc
9327
9328 : see if atoll exists
9329 set atoll d_atoll
9330 eval $inlibc
9331
9332 : Look for GNU-cc style attribute checking
9333 echo " "
9334 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9335 $cat >attrib.c <<'EOCP'
9336 #include <stdio.h>
9337 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9338 EOCP
9339 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9340         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9341                 echo "Your C compiler doesn't fully support __attribute__."
9342                 val="$undef"
9343         else
9344                 echo "Your C compiler supports __attribute__."
9345                 val="$define"
9346         fi
9347 else
9348         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9349         val="$undef"
9350 fi
9351 set d_attribut
9352 eval $setvar
9353 $rm -f attrib*
9354
9355 : see if bcmp exists
9356 set bcmp d_bcmp
9357 eval $inlibc
9358
9359 : see if bcopy exists
9360 set bcopy d_bcopy
9361 eval $inlibc
9362
9363 : see if this is a unistd.h system
9364 set unistd.h i_unistd
9365 eval $inhdr
9366
9367 : see if getpgrp exists
9368 set getpgrp d_getpgrp
9369 eval $inlibc
9370
9371 case "$d_getpgrp" in
9372 "$define")
9373         echo " "
9374         echo "Checking to see which flavor of getpgrp is in use..."
9375         $cat >try.c <<EOP
9376 #$i_unistd I_UNISTD
9377 #include <sys/types.h>
9378 #ifdef I_UNISTD
9379 #  include <unistd.h>
9380 #endif
9381 int main()
9382 {
9383         if (getuid() == 0) {
9384                 printf("(I see you are running Configure as super-user...)\n");
9385                 setuid(1);
9386         }
9387 #ifdef TRY_BSD_PGRP
9388         if (getpgrp(1) == 0)
9389                 exit(0);
9390 #else
9391         if (getpgrp() > 0)
9392                 exit(0);
9393 #endif
9394         exit(1);
9395 }
9396 EOP
9397         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9398                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9399                 val="$define"
9400         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9401                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9402                 val="$undef"
9403         else
9404                 echo "I can't seem to compile and run the test program."
9405                 if ./usg; then
9406                         xxx="a USG one, i.e. you use getpgrp()."
9407                 else
9408                         # SVR4 systems can appear rather BSD-ish.
9409                         case "$i_unistd" in
9410                         $undef)
9411                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9412                                 val="$define"
9413                                 ;;
9414                         $define)
9415                                 xxx="probably a USG one, i.e. you use getpgrp()."
9416                                 val="$undef"
9417                                 ;;
9418                         esac
9419                 fi
9420                 echo "Assuming your getpgrp is $xxx" >&4
9421         fi
9422         ;;
9423 *) val="$undef";;
9424 esac
9425 set d_bsdgetpgrp
9426 eval $setvar
9427 $rm -f try try.*
9428
9429 : see if setpgrp exists
9430 set setpgrp d_setpgrp
9431 eval $inlibc
9432
9433 case "$d_setpgrp" in
9434 "$define")
9435         echo " "
9436         echo "Checking to see which flavor of setpgrp is in use..."
9437         $cat >try.c <<EOP
9438 #$i_unistd I_UNISTD
9439 #include <sys/types.h>
9440 #ifdef I_UNISTD
9441 #  include <unistd.h>
9442 #endif
9443 int main()
9444 {
9445         if (getuid() == 0) {
9446                 printf("(I see you are running Configure as super-user...)\n");
9447                 setuid(1);
9448         }
9449 #ifdef TRY_BSD_PGRP
9450         if (-1 == setpgrp(1, 1))
9451                 exit(0);
9452 #else
9453         if (setpgrp() != -1)
9454                 exit(0);
9455 #endif
9456         exit(1);
9457 }
9458 EOP
9459         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9460                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9461                 val="$define"
9462         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9463                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9464                 val="$undef"
9465         else
9466                 echo "(I can't seem to compile and run the test program.)"
9467                 if ./usg; then
9468                         xxx="a USG one, i.e. you use setpgrp()."
9469                 else
9470                         # SVR4 systems can appear rather BSD-ish.
9471                         case "$i_unistd" in
9472                         $undef)
9473                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9474                                 val="$define"
9475                                 ;;
9476                         $define)
9477                                 xxx="probably a USG one, i.e. you use setpgrp()."
9478                                 val="$undef"
9479                                 ;;
9480                         esac
9481                 fi
9482                 echo "Assuming your setpgrp is $xxx" >&4
9483         fi
9484         ;;
9485 *) val="$undef";;
9486 esac
9487 set d_bsdsetpgrp
9488 eval $setvar
9489 $rm -f try try.*
9490 : see if bzero exists
9491 set bzero d_bzero
9492 eval $inlibc
9493
9494 : see if signal is declared as pointer to function returning int or void
9495 echo " "
9496 xxx=`./findhdr signal.h`
9497 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9498 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9499         echo "You have int (*signal())() instead of void." >&4
9500         val="$undef"
9501 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9502         echo "You have void (*signal())()." >&4
9503         val="$define"
9504 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9505         echo "You have int (*signal())() instead of void." >&4
9506         val="$undef"
9507 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9508         echo "You have void (*signal())()." >&4
9509         val="$define"
9510 else
9511         case "$d_voidsig" in
9512         '')
9513         echo "I can't determine whether signal handler returns void or int..." >&4
9514                 dflt=void
9515                 rp="What type does your signal handler return?"
9516                 . ./myread
9517                 case "$ans" in
9518                 v*) val="$define";;
9519                 *) val="$undef";;
9520                 esac;;
9521         "$define")
9522                 echo "As you already told me, signal handler returns void." >&4
9523                 val="$define"
9524                 ;;
9525         *)      echo "As you already told me, signal handler returns int." >&4
9526                 val="$undef"
9527                 ;;
9528         esac
9529 fi
9530 set d_voidsig
9531 eval $setvar
9532 case "$d_voidsig" in
9533 "$define") signal_t="void";;
9534 *) signal_t="int";;
9535 esac
9536 $rm -f $$.tmp
9537
9538 : check for ability to cast large floats to 32-bit ints.
9539 echo " "
9540 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9541 if $test "$intsize" -ge 4; then
9542         xxx=int
9543 else
9544         xxx=long
9545 fi
9546 $cat >try.c <<EOCP
9547 #include <stdio.h>
9548 #include <sys/types.h>
9549 #include <signal.h>
9550 $signal_t blech(s) int s; { exit(3); }
9551 int main()
9552 {
9553         $xxx i32;
9554         double f, g;
9555         int result = 0;
9556         char str[16];
9557         signal(SIGFPE, blech);
9558
9559         /* Don't let compiler optimize the test away.  Store the number 
9560            in a writable string for gcc to pass to sscanf under HP/UX.
9561         */
9562         sprintf(str, "2147483647");
9563         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9564         g = 10 * f;
9565         i32  = ($xxx) g;
9566
9567         /* x86 processors will probably give 0x8000 0000, which is a
9568        sign change.  We don't want that.  We want to mimic SPARC
9569            behavior here, which is to preserve the sign and give
9570            back 0x7fff ffff.
9571         */
9572         if (i32 != ($xxx) f)
9573                 result |= 1;
9574         exit(result);
9575 }
9576 EOCP
9577 set try
9578 if eval $compile_ok; then
9579         $run ./try
9580         yyy=$?
9581 else
9582         echo "(I can't seem to compile the test program--assuming it can't)"
9583         yyy=1
9584 fi
9585 case "$yyy" in
9586 0)      val="$define"
9587         echo "Yup, it can."
9588         ;;
9589 *)      val="$undef"
9590         echo "Nope, it can't."
9591         ;;
9592 esac
9593 set d_casti32
9594 eval $setvar
9595 $rm -f try try.*
9596
9597 : check for ability to cast negative floats to unsigned
9598 echo " "
9599 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9600 $cat >try.c <<EOCP
9601 #include <stdio.h>
9602 #include <sys/types.h>
9603 #include <signal.h>
9604 $signal_t blech(s) int s; { exit(7); }
9605 $signal_t blech_in_list(s) int s; { exit(4); }
9606 unsigned long dummy_long(p) unsigned long p; { return p; }
9607 unsigned int dummy_int(p) unsigned int p; { return p; }
9608 unsigned short dummy_short(p) unsigned short p; { return p; }
9609 int main()
9610 {
9611         double f;
9612         unsigned long along;
9613         unsigned int aint;
9614         unsigned short ashort;
9615         int result = 0;
9616         char str[16];
9617         
9618         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9619            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9620            optimized the whole file away
9621         */
9622         /* Store the number in a writable string for gcc to pass to 
9623            sscanf under HP/UX.
9624         */
9625         sprintf(str, "-123");
9626         sscanf(str, "%lf", &f);  /* f = -123.; */
9627
9628         signal(SIGFPE, blech);
9629         along = (unsigned long)f;
9630         aint = (unsigned int)f;
9631         ashort = (unsigned short)f;
9632         if (along != (unsigned long)-123)
9633                 result |= 1;
9634         if (aint != (unsigned int)-123)
9635                 result |= 1;
9636         if (ashort != (unsigned short)-123)
9637                 result |= 1;
9638         sprintf(str, "1073741824.");
9639         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9640         f = f + f;
9641         along = 0;
9642         along = (unsigned long)f;
9643         if (along != 0x80000000)
9644                 result |= 2;
9645         f -= 1.;
9646         along = 0;
9647         along = (unsigned long)f;
9648         if (along != 0x7fffffff)
9649                 result |= 1;
9650         f += 2.;
9651         along = 0;
9652         along = (unsigned long)f;
9653         if (along != 0x80000001)
9654                 result |= 2;
9655         if (result)
9656                 exit(result);
9657         signal(SIGFPE, blech_in_list);
9658         sprintf(str, "123.");
9659         sscanf(str, "%lf", &f);  /* f = 123.; */
9660         along = dummy_long((unsigned long)f);
9661         aint = dummy_int((unsigned int)f);
9662         ashort = dummy_short((unsigned short)f);
9663         if (along != (unsigned long)123)
9664                 result |= 4;
9665         if (aint != (unsigned int)123)
9666                 result |= 4;
9667         if (ashort != (unsigned short)123)
9668                 result |= 4;
9669         exit(result);
9670
9671 }
9672 EOCP
9673 set try
9674 if eval $compile_ok; then
9675         $run ./try
9676         castflags=$?
9677 else
9678         echo "(I can't seem to compile the test program--assuming it can't)"
9679         castflags=7
9680 fi
9681 case "$castflags" in
9682 0)      val="$define"
9683         echo "Yup, it can."
9684         ;;
9685 *)      val="$undef"
9686         echo "Nope, it can't."
9687         ;;
9688 esac
9689 set d_castneg
9690 eval $setvar
9691 $rm -f try.*
9692
9693 : see if vprintf exists
9694 echo " "
9695 if set vprintf val -f d_vprintf; eval $csym; $val; then
9696         echo 'vprintf() found.' >&4
9697         val="$define"
9698         $cat >try.c <<'EOF'
9699 #include <varargs.h>
9700
9701 int main() { xxx("foo"); }
9702
9703 xxx(va_alist)
9704 va_dcl
9705 {
9706         va_list args;
9707         char buf[10];
9708
9709         va_start(args);
9710         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9711 }
9712 EOF
9713         set try
9714         if eval $compile && $run ./try; then
9715                 echo "Your vsprintf() returns (int)." >&4
9716                 val2="$undef"
9717         else
9718                 echo "Your vsprintf() returns (char*)." >&4
9719                 val2="$define"
9720         fi
9721 else
9722         echo 'vprintf() NOT found.' >&4
9723                 val="$undef"
9724                 val2="$undef"
9725 fi
9726 $rm -f try try.*
9727 set d_vprintf
9728 eval $setvar
9729 val=$val2
9730 set d_charvspr
9731 eval $setvar
9732
9733 : see if chown exists
9734 set chown d_chown
9735 eval $inlibc
9736
9737 : see if chroot exists
9738 set chroot d_chroot
9739 eval $inlibc
9740
9741 : see if chsize exists
9742 set chsize d_chsize
9743 eval $inlibc
9744
9745 : see if class exists
9746 set class d_class
9747 eval $inlibc
9748
9749 hasstruct='varname=$1; struct=$2; shift; shift;
9750 while $test $# -ge 2; do
9751         case "$1" in
9752         $define) echo "#include <$2>";;
9753         esac ;
9754     shift 2;
9755 done > try.c;
9756 echo "int main () { struct $struct foo; }" >> try.c;
9757 set try;
9758 if eval $compile; then
9759         val="$define";
9760 else
9761         val="$undef";
9762 fi;
9763 set $varname;
9764 eval $setvar;
9765 $rm -f try.c try.o'
9766
9767 socketlib=''
9768 sockethdr=''
9769 : see whether socket exists
9770 echo " "
9771 $echo $n "Hmm... $c" >&4
9772 if set socket val -f d_socket; eval $csym; $val; then
9773         echo "Looks like you have Berkeley networking support." >&4
9774         d_socket="$define"
9775         if set setsockopt val -f; eval $csym; $val; then
9776                 d_oldsock="$undef"
9777         else
9778                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9779                 d_oldsock="$define"
9780         fi
9781 else
9782         if $contains socklib libc.list >/dev/null 2>&1; then
9783                 echo "Looks like you have Berkeley networking support." >&4
9784                 d_socket="$define"
9785                 : we will have to assume that it supports the 4.2 BSD interface
9786                 d_oldsock="$undef"
9787         else
9788                 echo "You don't have Berkeley networking in libc$_a..." >&4
9789                 if test "X$d_socket" = "X$define"; then
9790                    echo "...but you seem to believe that you have sockets." >&4
9791                 else
9792                         for net in net socket
9793                         do
9794                                 if test -f /usr/lib/lib$net$_a; then
9795                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9796                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9797                                         if $contains socket libc.list >/dev/null 2>&1; then
9798                                                 d_socket="$define"
9799                                                 socketlib="-l$net"
9800                                                 case "$net" in
9801                                                 net)
9802                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9803                                                         sockethdr="-I/usr/netinclude"
9804                                                         ;;
9805                                                 esac
9806                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9807                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9808                                                         d_oldsock="$undef"
9809                                                 else
9810                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9811                                                         d_oldsock="$define"
9812                                                 fi
9813                                                 break
9814                                         fi
9815                                 fi
9816                         done
9817                         if test "X$d_socket" != "X$define"; then
9818                            echo "or anywhere else I see." >&4
9819                            d_socket="$undef"
9820                            d_oldsock="$undef"
9821                         fi
9822                 fi
9823         fi
9824 fi
9825
9826 : see if socketpair exists
9827 set socketpair d_sockpair
9828 eval $inlibc
9829
9830
9831 echo " "
9832 echo "Checking the availability of certain socket constants..." >&4
9833 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9834         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9835         $cat >try.c <<EOF
9836 #include <sys/types.h>
9837 #include <sys/socket.h>
9838 int main() {
9839     int i = $ENUM;
9840 }
9841 EOF
9842         val="$undef"
9843         set try; if eval $compile; then
9844                 val="$define"
9845         fi
9846         set d_${enum}; eval $setvar
9847         $rm -f try.c try
9848 done
9849
9850 : see if this is a sys/uio.h system
9851 set sys/uio.h i_sysuio
9852 eval $inhdr
9853
9854
9855 echo " "
9856 echo "Checking to see if your system supports struct cmsghdr..." >&4
9857 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9858 eval $hasstruct
9859 case "$d_cmsghdr_s" in
9860 "$define")      echo "Yes, it does."   ;;
9861 *)              echo "No, it doesn't." ;;
9862 esac
9863
9864
9865 : check for const keyword
9866 echo " "
9867 echo 'Checking to see if your C compiler knows about "const"...' >&4
9868 $cat >const.c <<'EOCP'
9869 typedef struct spug { int drokk; } spug;
9870 int main()
9871 {
9872         const char *foo;
9873         const spug y;
9874 }
9875 EOCP
9876 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9877         val="$define"
9878         echo "Yup, it does."
9879 else
9880         val="$undef"
9881         echo "Nope, it doesn't."
9882 fi
9883 set d_const
9884 eval $setvar
9885
9886 : see if crypt exists
9887 echo " "
9888 set crypt d_crypt
9889 eval $inlibc
9890 case "$d_crypt" in
9891 $define) cryptlib='' ;;
9892 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9893                 echo 'crypt() found.' >&4
9894                 val="$define"
9895                 cryptlib=''
9896         else
9897                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9898                 if $test -z "$cryptlib"; then
9899                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9900                 else
9901                         cryptlib=-lcrypt
9902                 fi
9903                 if $test -z "$cryptlib"; then
9904                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9905                 else
9906                         cryptlib=-lcrypt
9907                 fi
9908                 if $test -z "$cryptlib"; then
9909                         cryptlib=`./loc libcrypt$_a "" $libpth`
9910                 else
9911                         cryptlib=-lcrypt
9912                 fi
9913                 if $test -z "$cryptlib"; then
9914                         echo 'crypt() NOT found.' >&4
9915                         val="$undef"
9916                 else
9917                         val="$define"
9918                 fi
9919         fi
9920         set d_crypt
9921         eval $setvar
9922         ;;
9923 esac
9924
9925 : see if this is a crypt.h system
9926 set crypt.h i_crypt
9927 eval $inhdr
9928
9929 : see if crypt_r exists
9930 set crypt_r d_crypt_r
9931 eval $inlibc
9932 case "$d_crypt_r" in
9933 "$define")
9934         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9935         case "$d_crypt_r_proto:$usethreads" in
9936         ":define")      d_crypt_r_proto=define
9937                 set d_crypt_r_proto crypt_r $hdrs
9938                 eval $hasproto ;;
9939         *)      ;;
9940         esac
9941         case "$d_crypt_r_proto" in
9942         define)
9943         case "$crypt_r_proto" in
9944         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9945         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9946         esac
9947         case "$crypt_r_proto" in
9948         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9949         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9950         esac
9951         case "$crypt_r_proto" in
9952         '')     d_crypt_r=undef
9953                 crypt_r_proto=0
9954                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9955         * )     case "$crypt_r_proto" in
9956                 REENTRANT_PROTO*) ;;
9957                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9958                 esac
9959                 echo "Prototype: $try" ;;
9960         esac
9961         ;;
9962         *)      case "$usethreads" in
9963                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9964                 esac
9965                 ;;
9966         esac
9967         ;;
9968 *)      crypt_r_proto=0
9969         ;;
9970 esac
9971
9972 : get csh whereabouts
9973 case "$csh" in
9974 'csh') val="$undef" ;;
9975 *) val="$define" ;;
9976 esac
9977 set d_csh
9978 eval $setvar
9979 : Respect a hint or command line value for full_csh.
9980 case "$full_csh" in
9981 '') full_csh=$csh ;;
9982 esac
9983
9984 : see if ctermid_r exists
9985 set ctermid_r d_ctermid_r
9986 eval $inlibc
9987 case "$d_ctermid_r" in
9988 "$define")
9989         hdrs="$i_systypes sys/types.h define stdio.h $i_stdio stdio.h"
9990         case "$d_ctermid_r_proto:$usethreads" in
9991         ":define")      d_ctermid_r_proto=define
9992                 set d_ctermid_r_proto ctermid_r $hdrs
9993                 eval $hasproto ;;
9994         *)      ;;
9995         esac
9996         case "$d_ctermid_r_proto" in
9997         define)
9998         case "$ctermid_r_proto" in
9999         ''|0) try='char* ctermid_r(char*);'
10000         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10001         esac
10002         case "$ctermid_r_proto" in
10003         '')     d_ctermid_r=undef
10004                 ctermid_r_proto=0
10005                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10006         * )     case "$ctermid_r_proto" in
10007                 REENTRANT_PROTO*) ;;
10008                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10009                 esac
10010                 echo "Prototype: $try" ;;
10011         esac
10012         ;;
10013         *)      case "$usethreads" in
10014                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10015                 esac
10016                 ;;
10017         esac
10018         ;;
10019 *)      ctermid_r_proto=0
10020         ;;
10021 esac
10022
10023 : see if ctime_r exists
10024 set ctime_r d_ctime_r
10025 eval $inlibc
10026 case "$d_ctime_r" in
10027 "$define")
10028         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
10029         case "$d_ctime_r_proto:$usethreads" in
10030         ":define")      d_ctime_r_proto=define
10031                 set d_ctime_r_proto ctime_r $hdrs
10032                 eval $hasproto ;;
10033         *)      ;;
10034         esac
10035         case "$d_ctime_r_proto" in
10036         define)
10037         case "$ctime_r_proto" in
10038         ''|0) try='char* ctime_r(const time_t*, char*);'
10039         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10040         esac
10041         case "$ctime_r_proto" in
10042         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10043         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10044         esac
10045         case "$ctime_r_proto" in
10046         ''|0) try='int ctime_r(const time_t*, char*);'
10047         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10048         esac
10049         case "$ctime_r_proto" in
10050         ''|0) try='int ctime_r(const time_t*, char*, int);'
10051         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10052         esac
10053         case "$ctime_r_proto" in
10054         '')     d_ctime_r=undef
10055                 ctime_r_proto=0
10056                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10057         * )     case "$ctime_r_proto" in
10058                 REENTRANT_PROTO*) ;;
10059                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10060                 esac
10061                 echo "Prototype: $try" ;;
10062         esac
10063         ;;
10064         *)      case "$usethreads" in
10065                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10066                 esac
10067                 ;;
10068         esac
10069         ;;
10070 *)      ctime_r_proto=0
10071         ;;
10072 esac
10073
10074 : see if cuserid exists
10075 set cuserid d_cuserid
10076 eval $inlibc
10077
10078 : see if this is a limits.h system
10079 set limits.h i_limits
10080 eval $inhdr
10081
10082 : see if this is a float.h system
10083 set float.h i_float
10084 eval $inhdr
10085
10086 : See if number of significant digits in a double precision number is known
10087 echo " "
10088 $cat >dbl_dig.c <<EOM
10089 #$i_limits I_LIMITS
10090 #$i_float I_FLOAT
10091 #ifdef I_LIMITS
10092 #include <limits.h>
10093 #endif
10094 #ifdef I_FLOAT
10095 #include <float.h>
10096 #endif
10097 #ifdef DBL_DIG
10098 printf("Contains DBL_DIG");
10099 #endif
10100 EOM
10101 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10102 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10103         echo "DBL_DIG found." >&4
10104         val="$define"
10105 else
10106         echo "DBL_DIG NOT found." >&4
10107         val="$undef"
10108 fi
10109 $rm -f dbl_dig.?
10110 set d_dbl_dig
10111 eval $setvar
10112
10113 : see if dbm.h is available
10114 : see if dbmclose exists
10115 set dbmclose d_dbmclose
10116 eval $inlibc
10117
10118 case "$d_dbmclose" in
10119 $define)
10120         set dbm.h i_dbm
10121         eval $inhdr
10122         case "$i_dbm" in
10123         $define)
10124                 val="$undef"
10125                 set i_rpcsvcdbm
10126                 eval $setvar
10127                 ;;
10128         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10129                 eval $inhdr
10130                 ;;
10131         esac
10132         ;;
10133 *)      echo "We won't be including <dbm.h>"
10134         val="$undef"
10135         set i_dbm
10136         eval $setvar
10137         val="$undef"
10138         set i_rpcsvcdbm
10139         eval $setvar
10140         ;;
10141 esac
10142
10143 : see if prototype for dbminit is available
10144 echo " "
10145 set d_dbminitproto dbminit $i_dbm dbm.h
10146 eval $hasproto
10147
10148 : see if difftime exists
10149 set difftime d_difftime
10150 eval $inlibc
10151
10152 : see if this is a dirent system
10153 echo " "
10154 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10155         val="$define"
10156         echo "<dirent.h> found." >&4
10157 else
10158         val="$undef"
10159         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10160                 echo "<sys/dir.h> found." >&4
10161                 echo " "
10162         else
10163                 xinc=`./findhdr sys/ndir.h`
10164         fi
10165         echo "<dirent.h> NOT found." >&4
10166 fi
10167 set i_dirent
10168 eval $setvar
10169
10170 : Look for type of directory structure.
10171 echo " "
10172 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10173
10174 case "$direntrytype" in
10175 ''|' ')
10176         case "$i_dirent" in
10177         $define) guess1='struct dirent' ;;
10178         *) guess1='struct direct'  ;;
10179         esac
10180         ;;
10181 *)      guess1="$direntrytype"
10182         ;;
10183 esac
10184
10185 case "$guess1" in
10186 'struct dirent') guess2='struct direct' ;;
10187 *) guess2='struct dirent' ;;
10188 esac
10189                 
10190 if $contains "$guess1" try.c >/dev/null 2>&1; then
10191         direntrytype="$guess1"
10192         echo "Your directory entries are $direntrytype." >&4
10193 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10194         direntrytype="$guess2"
10195         echo "Your directory entries seem to be $direntrytype." >&4
10196 else
10197         echo "I don't recognize your system's directory entries." >&4
10198         rp="What type is used for directory entries on this system?"
10199         dflt="$guess1"
10200         . ./myread
10201         direntrytype="$ans"
10202 fi
10203 $rm -f try.c
10204
10205
10206 : see if the directory entry stores field length
10207 echo " "
10208 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10209 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10210         echo "Good, your directory entry keeps length information in d_namlen." >&4
10211         val="$define"
10212 else
10213         echo "Your directory entry does not know about the d_namlen field." >&4
10214         val="$undef"
10215 fi
10216 set d_dirnamlen
10217 eval $setvar
10218 $rm -f try.c
10219
10220 : see if this is an sysdir system
10221 set sys/dir.h i_sysdir
10222 eval $inhdr
10223
10224 : see if this is an sysndir system
10225 set sys/ndir.h i_sysndir
10226 eval $inhdr
10227
10228 : Look for dirfd
10229 echo " "
10230 $cat >dirfd.c <<EOM
10231 #include <stdio.h>
10232 #$i_dirent I_DIRENT             /**/
10233 #$i_sysdir I_SYS_DIR            /**/
10234 #$i_sysndir I_SYS_NDIR          /**/
10235 #$i_systypes I_SYS_TYPES        /**/
10236 #if defined(I_SYS_TYPES)
10237 #include <sys/types.h>
10238 #endif
10239 #if defined(I_DIRENT)
10240 #include <dirent.h>
10241 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10242 #include <sys/dir.h>
10243 #endif
10244 #else
10245 #ifdef I_SYS_NDIR
10246 #include <sys/ndir.h>
10247 #else
10248 #ifdef I_SYS_DIR
10249 #ifdef hp9000s500
10250 #include <ndir.h>       /* may be wrong in the future */
10251 #else
10252 #include <sys/dir.h>
10253 #endif
10254 #endif
10255 #endif
10256 #endif 
10257 int main() {
10258         DIR *dirp = opendir(".");
10259         if (dirfd(dirp) >= 0)
10260                 exit(0);
10261         else
10262                 exit(1);
10263 }
10264 EOM
10265 set dirfd
10266 if eval $compile; then
10267         val="$define"
10268 fi
10269 case "$val" in
10270 $define)        echo "dirfd() found." >&4       ;;
10271 *)              echo "dirfd() NOT found." >&4   ;;
10272 esac
10273 set d_dirfd
10274 eval $setvar
10275 $rm -f dirfd*
10276
10277 : see if dlerror exists
10278 xxx_runnm="$runnm"
10279 runnm=false
10280 set dlerror d_dlerror
10281 eval $inlibc
10282 runnm="$xxx_runnm"
10283
10284 : see if dlfcn is available
10285 set dlfcn.h i_dlfcn
10286 eval $inhdr
10287
10288 case "$usedl" in
10289 $define|y|true)
10290         $cat << EOM
10291
10292 On a few systems, the dynamically loaded modules that perl generates and uses
10293 will need a different extension than shared libs. The default will probably
10294 be appropriate.
10295
10296 EOM
10297         case "$dlext" in
10298         '')     dflt="$so" ;;
10299         *)      dflt="$dlext" ;;
10300         esac
10301         rp='What is the extension of dynamically loaded modules'
10302         . ./myread
10303         dlext="$ans"
10304         ;;
10305 *)
10306         dlext="none"
10307         ;;
10308 esac
10309
10310 : Check if dlsym need a leading underscore
10311 echo " "
10312 val="$undef"
10313
10314 case "$dlsrc" in
10315 dl_dlopen.xs)
10316         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10317         $cat >dyna.c <<'EOM'
10318 fred () { }
10319 EOM
10320
10321 $cat >fred.c<<EOM
10322
10323 #include <stdio.h>
10324 #$i_dlfcn I_DLFCN
10325 #ifdef I_DLFCN
10326 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10327 #else
10328 #include <sys/types.h>
10329 #include <nlist.h>
10330 #include <link.h>
10331 #endif
10332
10333 extern int fred() ;
10334
10335 int main()
10336 {
10337     void * handle ;
10338     void * symbol ;
10339 #ifndef RTLD_LAZY
10340     int mode = 1 ;
10341 #else
10342     int mode = RTLD_LAZY ;
10343 #endif
10344     handle = dlopen("./dyna.$dlext", mode) ;
10345     if (handle == NULL) {
10346         printf ("1\n") ;
10347         fflush (stdout) ;
10348         exit(0);
10349     }
10350     symbol = dlsym(handle, "fred") ;
10351     if (symbol == NULL) {
10352         /* try putting a leading underscore */
10353         symbol = dlsym(handle, "_fred") ;
10354         if (symbol == NULL) {
10355             printf ("2\n") ;
10356             fflush (stdout) ;
10357             exit(0);
10358         }
10359         printf ("3\n") ;
10360     }
10361     else
10362         printf ("4\n") ;
10363     fflush (stdout) ;
10364     exit(0);
10365 }
10366 EOM
10367         : Call the object file tmp-dyna.o in case dlext=o.
10368         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10369                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10370                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10371                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10372                 xxx=`$run ./fred`
10373                 case $xxx in
10374                 1)      echo "Test program failed using dlopen." >&4
10375                         echo "Perhaps you should not use dynamic loading." >&4;;
10376                 2)      echo "Test program failed using dlsym." >&4
10377                         echo "Perhaps you should not use dynamic loading." >&4;;
10378                 3)      echo "dlsym needs a leading underscore" >&4
10379                         val="$define" ;;
10380                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10381                 esac
10382         else
10383                 echo "I can't compile and run the test program." >&4
10384                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10385         fi
10386         ;;
10387 esac
10388                 
10389 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10390
10391 set d_dlsymun
10392 eval $setvar
10393
10394 : see if drand48_r exists
10395 set drand48_r d_drand48_r
10396 eval $inlibc
10397 case "$d_drand48_r" in
10398 "$define")
10399         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10400         case "$d_drand48_r_proto:$usethreads" in
10401         ":define")      d_drand48_r_proto=define
10402                 set d_drand48_r_proto drand48_r $hdrs
10403                 eval $hasproto ;;
10404         *)      ;;
10405         esac
10406         case "$d_drand48_r_proto" in
10407         define)
10408         case "$drand48_r_proto" in
10409         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10410         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10411         esac
10412         case "$drand48_r_proto" in
10413         '')     d_drand48_r=undef
10414                 drand48_r_proto=0
10415                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10416         * )     case "$drand48_r_proto" in
10417                 REENTRANT_PROTO*) ;;
10418                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10419                 esac
10420                 echo "Prototype: $try" ;;
10421         esac
10422         ;;
10423         *)      case "$usethreads" in
10424                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10425                 esac
10426                 ;;
10427         esac
10428         ;;
10429 *)      drand48_r_proto=0
10430         ;;
10431 esac
10432
10433 : see if prototype for drand48 is available
10434 echo " "
10435 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10436 eval $hasproto
10437
10438 : see if dup2 exists
10439 set dup2 d_dup2
10440 eval $inlibc
10441
10442 : see if eaccess exists
10443 set eaccess d_eaccess
10444 eval $inlibc
10445
10446 : see if endgrent exists
10447 set endgrent d_endgrent
10448 eval $inlibc
10449
10450 : see if this is an grp system
10451 set grp.h i_grp
10452 eval $inhdr
10453
10454 case "$i_grp" in
10455 $define)
10456         xxx=`./findhdr grp.h`
10457         $cppstdin $cppflags $cppminus < $xxx >$$.h
10458
10459         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10460                 val="$define"
10461         else
10462                 val="$undef"
10463         fi
10464         set d_grpasswd
10465         eval $setvar
10466
10467         $rm -f $$.h
10468         ;;
10469 *)
10470         val="$undef";
10471         set d_grpasswd; eval $setvar
10472         ;;
10473 esac
10474
10475 : see if endgrent_r exists
10476 set endgrent_r d_endgrent_r
10477 eval $inlibc
10478 case "$d_endgrent_r" in
10479 "$define")
10480         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10481         case "$d_endgrent_r_proto:$usethreads" in
10482         ":define")      d_endgrent_r_proto=define
10483                 set d_endgrent_r_proto endgrent_r $hdrs
10484                 eval $hasproto ;;
10485         *)      ;;
10486         esac
10487         case "$d_endgrent_r_proto" in
10488         define)
10489         case "$endgrent_r_proto" in
10490         ''|0) try='int endgrent_r(FILE**);'
10491         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10492         esac
10493         case "$endgrent_r_proto" in
10494         ''|0) try='void endgrent_r(FILE**);'
10495         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10496         esac
10497         case "$endgrent_r_proto" in
10498         '')     d_endgrent_r=undef
10499                 endgrent_r_proto=0
10500                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10501         * )     case "$endgrent_r_proto" in
10502                 REENTRANT_PROTO*) ;;
10503                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10504                 esac
10505                 echo "Prototype: $try" ;;
10506         esac
10507         ;;
10508         *)      case "$usethreads" in
10509                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10510                 esac
10511                 ;;
10512         esac
10513         ;;
10514 *)      endgrent_r_proto=0
10515         ;;
10516 esac
10517
10518 : see if endhostent exists
10519 set endhostent d_endhent
10520 eval $inlibc
10521
10522 : see if this is a netdb.h system
10523 set netdb.h i_netdb
10524 eval $inhdr
10525
10526 : see if endhostent_r exists
10527 set endhostent_r d_endhostent_r
10528 eval $inlibc
10529 case "$d_endhostent_r" in
10530 "$define")
10531         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10532         case "$d_endhostent_r_proto:$usethreads" in
10533         ":define")      d_endhostent_r_proto=define
10534                 set d_endhostent_r_proto endhostent_r $hdrs
10535                 eval $hasproto ;;
10536         *)      ;;
10537         esac
10538         case "$d_endhostent_r_proto" in
10539         define)
10540         case "$endhostent_r_proto" in
10541         ''|0) try='int endhostent_r(struct hostent_data*);'
10542         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_S ;;
10543         esac
10544         case "$endhostent_r_proto" in
10545         ''|0) try='void endhostent_r(struct hostent_data*);'
10546         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_S ;;
10547         esac
10548         case "$endhostent_r_proto" in
10549         '')     d_endhostent_r=undef
10550                 endhostent_r_proto=0
10551                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10552         * )     case "$endhostent_r_proto" in
10553                 REENTRANT_PROTO*) ;;
10554                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10555                 esac
10556                 echo "Prototype: $try" ;;
10557         esac
10558         ;;
10559         *)      case "$usethreads" in
10560                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10561                 esac
10562                 ;;
10563         esac
10564         ;;
10565 *)      endhostent_r_proto=0
10566         ;;
10567 esac
10568
10569 : see if endnetent exists
10570 set endnetent d_endnent
10571 eval $inlibc
10572
10573 : see if endnetent_r exists
10574 set endnetent_r d_endnetent_r
10575 eval $inlibc
10576 case "$d_endnetent_r" in
10577 "$define")
10578         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10579         case "$d_endnetent_r_proto:$usethreads" in
10580         ":define")      d_endnetent_r_proto=define
10581                 set d_endnetent_r_proto endnetent_r $hdrs
10582                 eval $hasproto ;;
10583         *)      ;;
10584         esac
10585         case "$d_endnetent_r_proto" in
10586         define)
10587         case "$endnetent_r_proto" in
10588         ''|0) try='int endnetent_r(struct netent_data*);'
10589         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_S ;;
10590         esac
10591         case "$endnetent_r_proto" in
10592         ''|0) try='void endnetent_r(struct netent_data*);'
10593         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_S ;;
10594         esac
10595         case "$endnetent_r_proto" in
10596         '')     d_endnetent_r=undef
10597                 endnetent_r_proto=0
10598                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10599         * )     case "$endnetent_r_proto" in
10600                 REENTRANT_PROTO*) ;;
10601                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10602                 esac
10603                 echo "Prototype: $try" ;;
10604         esac
10605         ;;
10606         *)      case "$usethreads" in
10607                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10608                 esac
10609                 ;;
10610         esac
10611         ;;
10612 *)      endnetent_r_proto=0
10613         ;;
10614 esac
10615
10616 : see if endprotoent exists
10617 set endprotoent d_endpent
10618 eval $inlibc
10619
10620 : see if endprotoent_r exists
10621 set endprotoent_r d_endprotoent_r
10622 eval $inlibc
10623 case "$d_endprotoent_r" in
10624 "$define")
10625         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10626         case "$d_endprotoent_r_proto:$usethreads" in
10627         ":define")      d_endprotoent_r_proto=define
10628                 set d_endprotoent_r_proto endprotoent_r $hdrs
10629                 eval $hasproto ;;
10630         *)      ;;
10631         esac
10632         case "$d_endprotoent_r_proto" in
10633         define)
10634         case "$endprotoent_r_proto" in
10635         ''|0) try='int endprotoent_r(struct protoent_data*);'
10636         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_S ;;
10637         esac
10638         case "$endprotoent_r_proto" in
10639         ''|0) try='void endprotoent_r(struct protoent_data*);'
10640         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_S ;;
10641         esac
10642         case "$endprotoent_r_proto" in
10643         '')     d_endprotoent_r=undef
10644                 endprotoent_r_proto=0
10645                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10646         * )     case "$endprotoent_r_proto" in
10647                 REENTRANT_PROTO*) ;;
10648                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10649                 esac
10650                 echo "Prototype: $try" ;;
10651         esac
10652         ;;
10653         *)      case "$usethreads" in
10654                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10655                 esac
10656                 ;;
10657         esac
10658         ;;
10659 *)      endprotoent_r_proto=0
10660         ;;
10661 esac
10662
10663 : see if endpwent exists
10664 set endpwent d_endpwent
10665 eval $inlibc
10666
10667 : see if this is a pwd.h system
10668 set pwd.h i_pwd
10669 eval $inhdr
10670
10671 case "$i_pwd" in
10672 $define)
10673         xxx=`./findhdr pwd.h`
10674         $cppstdin $cppflags $cppminus < $xxx >$$.h
10675
10676         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10677                 val="$define"
10678         else
10679                 val="$undef"
10680         fi
10681         set d_pwquota
10682         eval $setvar
10683
10684         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10685                 val="$define"
10686         else
10687                 val="$undef"
10688         fi
10689         set d_pwage
10690         eval $setvar
10691
10692         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10693                 val="$define"
10694         else
10695                 val="$undef"
10696         fi
10697         set d_pwchange
10698         eval $setvar
10699
10700         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10701                 val="$define"
10702         else
10703                 val="$undef"
10704         fi
10705         set d_pwclass
10706         eval $setvar
10707
10708         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10709                 val="$define"
10710         else
10711                 val="$undef"
10712         fi
10713         set d_pwexpire
10714         eval $setvar
10715
10716         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10717                 val="$define"
10718         else
10719                 val="$undef"
10720         fi
10721         set d_pwcomment
10722         eval $setvar
10723
10724         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10725                 val="$define"
10726         else
10727                 val="$undef"
10728         fi
10729         set d_pwgecos
10730         eval $setvar
10731
10732         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10733                 val="$define"
10734         else
10735                 val="$undef"
10736         fi
10737         set d_pwpasswd
10738         eval $setvar
10739
10740         $rm -f $$.h
10741         ;;
10742 *)
10743         val="$undef"; 
10744         set d_pwquota; eval $setvar
10745         set d_pwage; eval $setvar
10746         set d_pwchange; eval $setvar
10747         set d_pwclass; eval $setvar
10748         set d_pwexpire; eval $setvar
10749         set d_pwcomment; eval $setvar
10750         set d_pwgecos; eval $setvar
10751         set d_pwpasswd; eval $setvar
10752         ;;
10753 esac
10754
10755 : see if endpwent_r exists
10756 set endpwent_r d_endpwent_r
10757 eval $inlibc
10758 case "$d_endpwent_r" in
10759 "$define")
10760         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10761         case "$d_endpwent_r_proto:$usethreads" in
10762         ":define")      d_endpwent_r_proto=define
10763                 set d_endpwent_r_proto endpwent_r $hdrs
10764                 eval $hasproto ;;
10765         *)      ;;
10766         esac
10767         case "$d_endpwent_r_proto" in
10768         define)
10769         case "$endpwent_r_proto" in
10770         ''|0) try='int endpwent_r(FILE**);'
10771         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10772         esac
10773         case "$endpwent_r_proto" in
10774         ''|0) try='void endpwent_r(FILE**);'
10775         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10776         esac
10777         case "$endpwent_r_proto" in
10778         '')     d_endpwent_r=undef
10779                 endpwent_r_proto=0
10780                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10781         * )     case "$endpwent_r_proto" in
10782                 REENTRANT_PROTO*) ;;
10783                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10784                 esac
10785                 echo "Prototype: $try" ;;
10786         esac
10787         ;;
10788         *)      case "$usethreads" in
10789                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10790                 esac
10791                 ;;
10792         esac
10793         ;;
10794 *)      endpwent_r_proto=0
10795         ;;
10796 esac
10797
10798 : see if endservent exists
10799 set endservent d_endsent
10800 eval $inlibc
10801
10802 : see if endservent_r exists
10803 set endservent_r d_endservent_r
10804 eval $inlibc
10805 case "$d_endservent_r" in
10806 "$define")
10807         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10808         case "$d_endservent_r_proto:$usethreads" in
10809         ":define")      d_endservent_r_proto=define
10810                 set d_endservent_r_proto endservent_r $hdrs
10811                 eval $hasproto ;;
10812         *)      ;;
10813         esac
10814         case "$d_endservent_r_proto" in
10815         define)
10816         case "$endservent_r_proto" in
10817         ''|0) try='int endservent_r(struct servent_data*);'
10818         ./protochk "extern $try" $hdrs && endservent_r_proto=I_S ;;
10819         esac
10820         case "$endservent_r_proto" in
10821         ''|0) try='void endservent_r(struct servent_data*);'
10822         ./protochk "extern $try" $hdrs && endservent_r_proto=V_S ;;
10823         esac
10824         case "$endservent_r_proto" in
10825         '')     d_endservent_r=undef
10826                 endservent_r_proto=0
10827                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10828         * )     case "$endservent_r_proto" in
10829                 REENTRANT_PROTO*) ;;
10830                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10831                 esac
10832                 echo "Prototype: $try" ;;
10833         esac
10834         ;;
10835         *)      case "$usethreads" in
10836                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10837                 esac
10838                 ;;
10839         esac
10840         ;;
10841 *)      endservent_r_proto=0
10842         ;;
10843 esac
10844
10845 : Locate the flags for 'open()'
10846 echo " "
10847 $cat >try.c <<'EOCP'
10848 #include <sys/types.h>
10849 #ifdef I_FCNTL
10850 #include <fcntl.h>
10851 #endif
10852 #ifdef I_SYS_FILE
10853 #include <sys/file.h>
10854 #endif
10855 int main() {
10856         if(O_RDONLY);
10857 #ifdef O_TRUNC
10858         exit(0);
10859 #else
10860         exit(1);
10861 #endif
10862 }
10863 EOCP
10864 : check sys/file.h first to get FREAD on Sun
10865 if $test `./findhdr sys/file.h` && \
10866                 set try -DI_SYS_FILE && eval $compile; then
10867         h_sysfile=true;
10868         echo "<sys/file.h> defines the O_* constants..." >&4
10869         if $run ./try; then
10870                 echo "and you have the 3 argument form of open()." >&4
10871                 val="$define"
10872         else
10873                 echo "but not the 3 argument form of open().  Oh, well." >&4
10874                 val="$undef"
10875         fi
10876 elif $test `./findhdr fcntl.h` && \
10877                 set try -DI_FCNTL && eval $compile; then
10878         h_fcntl=true;
10879         echo "<fcntl.h> defines the O_* constants..." >&4
10880         if $run ./try; then
10881                 echo "and you have the 3 argument form of open()." >&4
10882                 val="$define"
10883         else
10884                 echo "but not the 3 argument form of open().  Oh, well." >&4
10885                 val="$undef"
10886         fi
10887 else
10888         val="$undef"
10889         echo "I can't find the O_* constant definitions!  You got problems." >&4
10890 fi
10891 set d_open3
10892 eval $setvar
10893 $rm -f try try.*
10894
10895 : see which of string.h or strings.h is needed
10896 echo " "
10897 strings=`./findhdr string.h`
10898 if $test "$strings" && $test -r "$strings"; then
10899         echo "Using <string.h> instead of <strings.h>." >&4
10900         val="$define"
10901 else
10902         val="$undef"
10903         strings=`./findhdr strings.h`
10904         if $test "$strings" && $test -r "$strings"; then
10905                 echo "Using <strings.h> instead of <string.h>." >&4
10906         else
10907                 echo "No string header found -- You'll surely have problems." >&4
10908         fi
10909 fi
10910 set i_string
10911 eval $setvar
10912 case "$i_string" in
10913 "$undef") strings=`./findhdr strings.h`;;
10914 *)        strings=`./findhdr string.h`;;
10915 esac
10916
10917 : see if this is a sys/file.h system
10918 val=''
10919 set sys/file.h val
10920 eval $inhdr
10921
10922 : do we need to include sys/file.h ?
10923 case "$val" in
10924 "$define")
10925         echo " "
10926         if $h_sysfile; then
10927                 val="$define"
10928                 echo "We'll be including <sys/file.h>." >&4
10929         else
10930                 val="$undef"
10931                 echo "We won't be including <sys/file.h>." >&4
10932         fi
10933         ;;
10934 *)
10935         h_sysfile=false
10936         ;;
10937 esac
10938 set i_sysfile
10939 eval $setvar
10940
10941 : see if fcntl.h is there
10942 val=''
10943 set fcntl.h val
10944 eval $inhdr
10945
10946 : see if we can include fcntl.h
10947 case "$val" in
10948 "$define")
10949         echo " "
10950         if $h_fcntl; then
10951                 val="$define"
10952                 echo "We'll be including <fcntl.h>." >&4
10953         else
10954                 val="$undef"
10955                 if $h_sysfile; then
10956         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10957                 else
10958                         echo "We won't be including <fcntl.h>." >&4
10959                 fi
10960         fi
10961         ;;
10962 *)
10963         h_fcntl=false
10964         val="$undef"
10965         ;;
10966 esac
10967 set i_fcntl
10968 eval $setvar
10969
10970 : check for non-blocking I/O stuff
10971 case "$h_sysfile" in
10972 true) echo "#include <sys/file.h>" > head.c;;
10973 *)
10974        case "$h_fcntl" in
10975        true) echo "#include <fcntl.h>" > head.c;;
10976        *) echo "#include <sys/fcntl.h>" > head.c;;
10977        esac
10978        ;;
10979 esac
10980 echo " "
10981 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
10982 case "$o_nonblock" in
10983 '')
10984         $cat head.c > try.c
10985         $cat >>try.c <<EOCP
10986 #include <stdio.h>
10987 #include <stdlib.h>
10988 #$i_fcntl I_FCNTL
10989 #ifdef I_FCNTL
10990 #include <fcntl.h>
10991 #endif
10992 int main() {
10993 #ifdef O_NONBLOCK
10994         printf("O_NONBLOCK\n");
10995         exit(0);
10996 #endif
10997 #ifdef O_NDELAY
10998         printf("O_NDELAY\n");
10999         exit(0);
11000 #endif
11001 #ifdef FNDELAY
11002         printf("FNDELAY\n");
11003         exit(0);
11004 #endif
11005         exit(0);
11006 }
11007 EOCP
11008         set try
11009         if eval $compile_ok; then
11010                 o_nonblock=`$run ./try`
11011                 case "$o_nonblock" in
11012                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11013                 *) echo "Seems like we can use $o_nonblock.";;
11014                 esac
11015         else
11016                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11017         fi
11018         ;;
11019 *) echo "Using $hint value $o_nonblock.";;
11020 esac
11021 $rm -f try try.* .out core
11022
11023 echo " "
11024 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11025 case "$eagain" in
11026 '')
11027         $cat head.c > try.c
11028         $cat >>try.c <<EOCP
11029 #include <errno.h>
11030 #include <sys/types.h>
11031 #include <signal.h>
11032 #include <stdio.h> 
11033 #include <stdlib.h> 
11034 #$i_fcntl I_FCNTL
11035 #ifdef I_FCNTL
11036 #include <fcntl.h>
11037 #endif
11038 #define MY_O_NONBLOCK $o_nonblock
11039 #ifndef errno  /* XXX need better Configure test */
11040 extern int errno;
11041 #endif
11042 #$i_unistd I_UNISTD
11043 #ifdef I_UNISTD
11044 #include <unistd.h>
11045 #endif
11046 #$i_string I_STRING
11047 #ifdef I_STRING
11048 #include <string.h>
11049 #else
11050 #include <strings.h>
11051 #endif
11052 $signal_t blech(x) int x; { exit(3); }
11053 EOCP
11054         $cat >> try.c <<'EOCP'
11055 int main()
11056 {
11057         int pd[2];
11058         int pu[2];
11059         char buf[1];
11060         char string[100];
11061
11062         pipe(pd);       /* Down: child -> parent */
11063         pipe(pu);       /* Up: parent -> child */
11064         if (0 != fork()) {
11065                 int ret;
11066                 close(pd[1]);   /* Parent reads from pd[0] */
11067                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11068 #ifdef F_SETFL
11069                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11070                         exit(1);
11071 #else
11072                 exit(4);
11073 #endif
11074                 signal(SIGALRM, blech);
11075                 alarm(5);
11076                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11077                         exit(2);
11078                 sprintf(string, "%d\n", ret);
11079                 write(2, string, strlen(string));
11080                 alarm(0);
11081 #ifdef EAGAIN
11082                 if (errno == EAGAIN) {
11083                         printf("EAGAIN\n");
11084                         goto ok;
11085                 }
11086 #endif
11087 #ifdef EWOULDBLOCK
11088                 if (errno == EWOULDBLOCK)
11089                         printf("EWOULDBLOCK\n");
11090 #endif
11091         ok:
11092                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11093                 sleep(2);                               /* Give it time to close our pipe */
11094                 alarm(5);
11095                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11096                 alarm(0);
11097                 sprintf(string, "%d\n", ret);
11098                 write(4, string, strlen(string));
11099                 exit(0);
11100         }
11101
11102         close(pd[0]);                   /* We write to pd[1] */
11103         close(pu[1]);                   /* We read from pu[0] */
11104         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11105         close(pd[1]);                   /* Pipe pd is now fully closed! */
11106         exit(0);                                /* Bye bye, thank you for playing! */
11107 }
11108 EOCP
11109         set try
11110         if eval $compile_ok; then
11111                 echo "$startsh" >mtry
11112                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11113                 chmod +x mtry
11114                 ./mtry >/dev/null 2>&1
11115                 case $? in
11116                 0) eagain=`$cat try.out`;;
11117                 1) echo "Could not perform non-blocking setting!";;
11118                 2) echo "I did a successful read() for something that was not there!";;
11119                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11120                 4) echo "Could not find F_SETFL!";;
11121                 *) echo "Something terribly wrong happened during testing.";;
11122                 esac
11123                 rd_nodata=`$cat try.ret`
11124                 echo "A read() system call with no data present returns $rd_nodata."
11125                 case "$rd_nodata" in
11126                 0|-1) ;;
11127                 *)
11128                         echo "(That's peculiar, fixing that to be -1.)"
11129                         rd_nodata=-1
11130                         ;;
11131                 esac
11132                 case "$eagain" in
11133                 '')
11134                         echo "Forcing errno EAGAIN on read() with no data available."
11135                         eagain=EAGAIN
11136                         ;;
11137                 *)
11138                         echo "Your read() sets errno to $eagain when no data is available."
11139                         ;;
11140                 esac
11141                 status=`$cat try.err`
11142                 case "$status" in
11143                 0) echo "And it correctly returns 0 to signal EOF.";;
11144                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11145                 *) echo "However, your read() returns '$status' on EOF??";;
11146                 esac
11147                 val="$define"
11148                 if test "$status" = "$rd_nodata"; then
11149                         echo "WARNING: you can't distinguish between EOF and no data!"
11150                         val="$undef"
11151                 fi
11152         else
11153                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11154                 eagain=EAGAIN
11155         fi
11156         set d_eofnblk
11157         eval $setvar
11158         ;;
11159 *)
11160         echo "Using $hint value $eagain."
11161         echo "Your read() returns $rd_nodata when no data is present."
11162         case "$d_eofnblk" in
11163         "$define") echo "And you can see EOF because read() returns 0.";;
11164         "$undef") echo "But you can't see EOF status from read() returned value.";;
11165         *)
11166                 echo "(Assuming you can't see EOF status from read anyway.)"
11167                 d_eofnblk=$undef
11168                 ;;
11169         esac
11170         ;;
11171 esac
11172 $rm -f try try.* .out core head.c mtry
11173
11174 : see if fchdir exists
11175 set fchdir d_fchdir
11176 eval $inlibc
11177
11178 : see if fchmod exists
11179 set fchmod d_fchmod
11180 eval $inlibc
11181
11182 : see if fchown exists
11183 set fchown d_fchown
11184 eval $inlibc
11185
11186 : see if this is an fcntl system
11187 set fcntl d_fcntl
11188 eval $inlibc
11189
11190 echo " "
11191 : See if fcntl-based locking works.
11192 $cat >try.c <<EOCP
11193 #include <stdlib.h>
11194 #include <unistd.h>
11195 #include <fcntl.h>
11196 #include <signal.h>
11197 $signal_t blech(x) int x; { exit(3); }
11198 int main() {
11199 #if defined(F_SETLK) && defined(F_SETLKW)
11200      struct flock flock;
11201      int retval, fd;
11202      fd = open("try.c", O_RDONLY);
11203      flock.l_type = F_RDLCK;
11204      flock.l_whence = SEEK_SET;
11205      flock.l_start = flock.l_len = 0;
11206      signal(SIGALRM, blech);
11207      alarm(10);
11208      retval = fcntl(fd, F_SETLK, &flock);
11209      close(fd);
11210      (retval < 0 ? exit(2) : exit(0));
11211 #else
11212      exit(2);
11213 #endif
11214 }
11215 EOCP
11216 echo "Checking if fcntl-based file locking works... "
11217 case "$d_fcntl" in
11218 "$define")
11219         set try
11220         if eval $compile_ok; then
11221                 if $run ./try; then
11222                         echo "Yes, it seems to work."
11223                         val="$define"
11224                 else
11225                         echo "Nope, it didn't work."
11226                         val="$undef"
11227                         case "$?" in
11228                         3) $cat >&4 <<EOM
11229 ***
11230 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11231 *** This is (almost) impossible.
11232 *** If your NFS lock daemons are not feeling well, something like
11233 *** this may happen, please investigate.  Cannot continue, aborting.
11234 ***
11235 EOM
11236                                 exit 1
11237                                 ;;
11238                         esac
11239                 fi
11240         else
11241                 echo "I'm unable to compile the test program, so I'll assume not."
11242                 val="$undef"
11243         fi
11244         ;;
11245 *) val="$undef";
11246         echo "Nope, since you don't even have fcntl()."
11247         ;;
11248 esac
11249 set d_fcntl_can_lock
11250 eval $setvar
11251 $rm -f try*
11252
11253
11254 : check for fd_set items
11255 $cat <<EOM
11256
11257 Checking to see how well your C compiler handles fd_set and friends ...
11258 EOM
11259 $cat >try.c <<EOCP
11260 #$i_systime I_SYS_TIME
11261 #$i_sysselct I_SYS_SELECT
11262 #$d_socket HAS_SOCKET
11263 #include <sys/types.h>
11264 #ifdef HAS_SOCKET
11265 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11266 #endif
11267 #ifdef I_SYS_TIME
11268 #include <sys/time.h>
11269 #endif
11270 #ifdef I_SYS_SELECT
11271 #include <sys/select.h>
11272 #endif
11273 int main() {
11274         fd_set fds;
11275
11276 #ifdef TRYBITS
11277         if(fds.fds_bits);
11278 #endif
11279
11280 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11281         exit(0);
11282 #else
11283         exit(1);
11284 #endif
11285 }
11286 EOCP
11287 set try -DTRYBITS
11288 if eval $compile; then
11289         d_fds_bits="$define"
11290         d_fd_set="$define"
11291         echo "Well, your system knows about the normal fd_set typedef..." >&4
11292         if $run ./try; then
11293                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11294                 d_fd_macros="$define"
11295         else
11296                 $cat >&4 <<'EOM'
11297 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11298 EOM
11299                 d_fd_macros="$undef"
11300         fi
11301 else
11302         $cat <<'EOM'
11303 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11304 EOM
11305         set try
11306         if eval $compile; then
11307                 d_fds_bits="$undef"
11308                 d_fd_set="$define"
11309                 echo "Well, your system has some sort of fd_set available..." >&4
11310                 if $run ./try; then
11311                         echo "and you have the normal fd_set macros." >&4
11312                         d_fd_macros="$define"
11313                 else
11314                         $cat <<'EOM'
11315 but not the normal fd_set macros!  Gross!  More work for me...
11316 EOM
11317                         d_fd_macros="$undef"
11318                 fi
11319         else
11320         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11321                 d_fd_set="$undef"
11322                 d_fds_bits="$undef"
11323                 d_fd_macros="$undef"
11324         fi
11325 fi
11326 $rm -f try try.*
11327
11328 : see if fgetpos exists
11329 set fgetpos d_fgetpos
11330 eval $inlibc
11331
11332 : see if finite exists
11333 set finite d_finite
11334 eval $inlibc
11335
11336 : see if finitel exists
11337 set finitel d_finitel
11338 eval $inlibc
11339
11340 : see if flock exists
11341 set flock d_flock
11342 eval $inlibc
11343
11344 : see if prototype for flock is available
11345 echo " "
11346 set d_flockproto flock $i_sysfile sys/file.h
11347 eval $hasproto
11348
11349 : see if fork exists
11350 set fork d_fork
11351 eval $inlibc
11352
11353 : see if fp_class exists
11354 set fp_class d_fp_class
11355 eval $inlibc
11356
11357 : see if pathconf exists
11358 set pathconf d_pathconf
11359 eval $inlibc
11360
11361 : see if fpathconf exists
11362 set fpathconf d_fpathconf
11363 eval $inlibc
11364
11365 : see if fpclass exists
11366 set fpclass d_fpclass
11367 eval $inlibc
11368
11369 : see if fpclassify exists
11370 set fpclassify d_fpclassify
11371 eval $inlibc
11372
11373 : see if fpclassl exists
11374 set fpclassl d_fpclassl
11375 eval $inlibc
11376
11377
11378 : check for fpos64_t
11379 echo " "
11380 echo "Checking to see if you have fpos64_t..." >&4
11381 $cat >try.c <<EOCP
11382 #include <stdio.h>
11383 int main() { fpos64_t x = 7; }
11384 EOCP
11385 set try
11386 if eval $compile; then
11387         val="$define"
11388         echo "You have fpos64_t."
11389 else
11390         val="$undef"
11391         echo "You do not have fpos64_t."
11392         case "$fpossize" in
11393         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11394         esac
11395 fi
11396 $rm -f try.* try
11397 set d_fpos64_t
11398 eval $setvar
11399
11400 : see if frexpl exists
11401 set frexpl d_frexpl
11402 eval $inlibc
11403
11404 : see if this is a sys/param system
11405 set sys/param.h i_sysparam
11406 eval $inhdr
11407
11408 : see if this is a sys/mount.h system
11409 set sys/mount.h i_sysmount
11410 eval $inhdr
11411
11412
11413 echo " "
11414 echo "Checking to see if your system supports struct fs_data..." >&4
11415 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11416 eval $hasstruct
11417 case "$d_fs_data_s" in
11418 "$define")      echo "Yes, it does."   ;;
11419 *)              echo "No, it doesn't." ;;
11420 esac
11421
11422 : see if fseeko exists
11423 set fseeko d_fseeko
11424 eval $inlibc
11425 case "$longsize" in
11426 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11427 esac
11428
11429 : see if fsetpos exists
11430 set fsetpos d_fsetpos
11431 eval $inlibc
11432
11433
11434 : see if fstatfs exists
11435 set fstatfs d_fstatfs
11436 eval $inlibc
11437
11438
11439 : see if statvfs exists
11440 set statvfs d_statvfs
11441 eval $inlibc
11442
11443 : see if fstatvfs exists
11444 set fstatvfs d_fstatvfs
11445 eval $inlibc
11446
11447
11448 : see if fsync exists
11449 set fsync d_fsync
11450 eval $inlibc
11451
11452 : see if ftello exists
11453 set ftello d_ftello
11454 eval $inlibc
11455 case "$longsize" in
11456 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11457 esac
11458
11459 : see if getcwd exists
11460 set getcwd d_getcwd
11461 eval $inlibc
11462
11463 : see if getespwnam exists
11464 set getespwnam d_getespwnam
11465 eval $inlibc
11466
11467
11468 : see if getfsstat exists
11469 set getfsstat d_getfsstat
11470 eval $inlibc
11471
11472 : see if getgrent exists
11473 set getgrent d_getgrent
11474 eval $inlibc
11475
11476 : see if getgrent_r exists
11477 set getgrent_r d_getgrent_r
11478 eval $inlibc
11479 case "$d_getgrent_r" in
11480 "$define")
11481         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11482         case "$d_getgrent_r_proto:$usethreads" in
11483         ":define")      d_getgrent_r_proto=define
11484                 set d_getgrent_r_proto getgrent_r $hdrs
11485                 eval $hasproto ;;
11486         *)      ;;
11487         esac
11488         case "$d_getgrent_r_proto" in
11489         define)
11490         case "$getgrent_r_proto" in
11491         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11492         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11493         esac
11494         case "$getgrent_r_proto" in
11495         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11496         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11497         esac
11498         case "$getgrent_r_proto" in
11499         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11500         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11501         esac
11502         case "$getgrent_r_proto" in
11503         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11504         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11505         esac
11506         case "$getgrent_r_proto" in
11507         ''|0) try='int getgrent_r(struct group*, char*, int);'
11508         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11509         esac
11510         case "$getgrent_r_proto" in
11511         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11512         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11513         esac
11514         case "$getgrent_r_proto" in
11515         '')     d_getgrent_r=undef
11516                 getgrent_r_proto=0
11517                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11518         * )     case "$getgrent_r_proto" in
11519                 REENTRANT_PROTO*) ;;
11520                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11521                 esac
11522                 echo "Prototype: $try" ;;
11523         esac
11524         ;;
11525         *)      case "$usethreads" in
11526                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11527                 esac
11528                 ;;
11529         esac
11530         ;;
11531 *)      getgrent_r_proto=0
11532         ;;
11533 esac
11534
11535 : see if getgrgid_r exists
11536 set getgrgid_r d_getgrgid_r
11537 eval $inlibc
11538 case "$d_getgrgid_r" in
11539 "$define")
11540         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11541         case "$d_getgrgid_r_proto:$usethreads" in
11542         ":define")      d_getgrgid_r_proto=define
11543                 set d_getgrgid_r_proto getgrgid_r $hdrs
11544                 eval $hasproto ;;
11545         *)      ;;
11546         esac
11547         case "$d_getgrgid_r_proto" in
11548         define)
11549         case "$getgrgid_r_proto" in
11550         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11551         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11552         esac
11553         case "$getgrgid_r_proto" in
11554         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11555         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11556         esac
11557         case "$getgrgid_r_proto" in
11558         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11559         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11560         esac
11561         case "$getgrgid_r_proto" in
11562         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11563         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11564         esac
11565         case "$getgrgid_r_proto" in
11566         '')     d_getgrgid_r=undef
11567                 getgrgid_r_proto=0
11568                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11569         * )     case "$getgrgid_r_proto" in
11570                 REENTRANT_PROTO*) ;;
11571                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11572                 esac
11573                 echo "Prototype: $try" ;;
11574         esac
11575         ;;
11576         *)      case "$usethreads" in
11577                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11578                 esac
11579                 ;;
11580         esac
11581         ;;
11582 *)      getgrgid_r_proto=0
11583         ;;
11584 esac
11585
11586 : see if getgrnam_r exists
11587 set getgrnam_r d_getgrnam_r
11588 eval $inlibc
11589 case "$d_getgrnam_r" in
11590 "$define")
11591         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11592         case "$d_getgrnam_r_proto:$usethreads" in
11593         ":define")      d_getgrnam_r_proto=define
11594                 set d_getgrnam_r_proto getgrnam_r $hdrs
11595                 eval $hasproto ;;
11596         *)      ;;
11597         esac
11598         case "$d_getgrnam_r_proto" in
11599         define)
11600         case "$getgrnam_r_proto" in
11601         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11602         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11603         esac
11604         case "$getgrnam_r_proto" in
11605         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11606         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11607         esac
11608         case "$getgrnam_r_proto" in
11609         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11610         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11611         esac
11612         case "$getgrnam_r_proto" in
11613         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11614         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11615         esac
11616         case "$getgrnam_r_proto" in
11617         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11618         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11619         esac
11620         case "$getgrnam_r_proto" in
11621         '')     d_getgrnam_r=undef
11622                 getgrnam_r_proto=0
11623                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11624         * )     case "$getgrnam_r_proto" in
11625                 REENTRANT_PROTO*) ;;
11626                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11627                 esac
11628                 echo "Prototype: $try" ;;
11629         esac
11630         ;;
11631         *)      case "$usethreads" in
11632                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11633                 esac
11634                 ;;
11635         esac
11636         ;;
11637 *)      getgrnam_r_proto=0
11638         ;;
11639 esac
11640
11641 : see if gethostbyaddr exists
11642 set gethostbyaddr d_gethbyaddr
11643 eval $inlibc
11644
11645 : see if gethostbyname exists
11646 set gethostbyname d_gethbyname
11647 eval $inlibc
11648
11649 : see if gethostent exists
11650 set gethostent d_gethent
11651 eval $inlibc
11652
11653 : see how we will look up host name
11654 echo " "
11655 call=''
11656 if set gethostname val -f d_gethname; eval $csym; $val; then
11657         echo 'gethostname() found.' >&4
11658         d_gethname="$define"
11659         call=gethostname
11660 fi
11661 if set uname val -f d_uname; eval $csym; $val; then
11662         if ./xenix; then
11663                 $cat <<'EOM'
11664 uname() was found, but you're running xenix, and older versions of xenix
11665 have a broken uname(). If you don't really know whether your xenix is old
11666 enough to have a broken system call, use the default answer.
11667
11668 EOM
11669                 dflt=y
11670                 case "$d_uname" in
11671                 "$define") dflt=n;;
11672                 esac
11673                 rp='Is your uname() broken?'
11674                 . ./myread
11675                 case "$ans" in
11676                 n*) d_uname="$define"; call=uname;;
11677                 esac
11678         else
11679                 echo 'uname() found.' >&4
11680                 d_uname="$define"
11681                 case "$call" in
11682                 '') call=uname ;;
11683                 esac
11684         fi
11685 fi
11686 case "$d_gethname" in
11687 '') d_gethname="$undef";;
11688 esac
11689 case "$d_uname" in
11690 '') d_uname="$undef";;
11691 esac
11692 case "$d_uname$d_gethname" in
11693 *define*)
11694         dflt=n
11695         cat <<EOM
11696  
11697 Every now and then someone has a $call() that lies about the hostname
11698 but can't be fixed for political or economic reasons.  If you wish, I can
11699 pretend $call() isn't there and maybe compute hostname at run-time
11700 thanks to the '$phostname' command.
11701
11702 EOM
11703         rp="Shall I ignore $call() from now on?"
11704         . ./myread
11705         case "$ans" in
11706         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11707         esac;;
11708 esac
11709 case "$phostname" in
11710 '') aphostname='';;
11711 *) case "$aphostname" in
11712         /*) ;;
11713         *) set X $phostname
11714                 shift
11715                 file=$1
11716                 shift
11717                 file=`./loc $file $file $pth`
11718                 aphostname=`echo $file $*`
11719                 ;;
11720         esac
11721         ;;
11722 esac
11723 case "$d_uname$d_gethname" in
11724 *define*) ;;
11725 *)
11726         case "$phostname" in
11727         '')
11728                 echo "There will be no way for $package to get your hostname." >&4;;
11729         *)
11730         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11731                 ;;
11732         esac;;
11733 esac
11734 case "$d_phostname" in
11735 '') d_phostname="$undef";;
11736 esac
11737
11738 : see if gethostbyaddr_r exists
11739 set gethostbyaddr_r d_gethostbyaddr_r
11740 eval $inlibc
11741 case "$d_gethostbyaddr_r" in
11742 "$define")
11743         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11744         case "$d_gethostbyaddr_r_proto:$usethreads" in
11745         ":define")      d_gethostbyaddr_r_proto=define
11746                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11747                 eval $hasproto ;;
11748         *)      ;;
11749         esac
11750         case "$d_gethostbyaddr_r_proto" in
11751         define)
11752         case "$gethostbyaddr_r_proto" in
11753         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11754         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11755         esac
11756         case "$gethostbyaddr_r_proto" in
11757         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11758         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11759         esac
11760         case "$gethostbyaddr_r_proto" in
11761         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11762         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11763         esac
11764         case "$gethostbyaddr_r_proto" in
11765         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11766         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11767         esac
11768         case "$gethostbyaddr_r_proto" in
11769         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11770         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11771         esac
11772         case "$gethostbyaddr_r_proto" in
11773         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11774         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11775         esac
11776         case "$gethostbyaddr_r_proto" in
11777         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11778         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11779         esac
11780         case "$gethostbyaddr_r_proto" in
11781         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11782         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11783         esac
11784         case "$gethostbyaddr_r_proto" in
11785         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11786         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11787         esac
11788         case "$gethostbyaddr_r_proto" in
11789         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11790         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11791         esac
11792         case "$gethostbyaddr_r_proto" in
11793         '')     d_gethostbyaddr_r=undef
11794                 gethostbyaddr_r_proto=0
11795                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11796         * )     case "$gethostbyaddr_r_proto" in
11797                 REENTRANT_PROTO*) ;;
11798                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11799                 esac
11800                 echo "Prototype: $try" ;;
11801         esac
11802         ;;
11803         *)      case "$usethreads" in
11804                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11805                 esac
11806                 ;;
11807         esac
11808         ;;
11809 *)      gethostbyaddr_r_proto=0
11810         ;;
11811 esac
11812
11813 : see if gethostbyname_r exists
11814 set gethostbyname_r d_gethostbyname_r
11815 eval $inlibc
11816 case "$d_gethostbyname_r" in
11817 "$define")
11818         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11819         case "$d_gethostbyname_r_proto:$usethreads" in
11820         ":define")      d_gethostbyname_r_proto=define
11821                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11822                 eval $hasproto ;;
11823         *)      ;;
11824         esac
11825         case "$d_gethostbyname_r_proto" in
11826         define)
11827         case "$gethostbyname_r_proto" in
11828         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11829         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11830         esac
11831         case "$gethostbyname_r_proto" in
11832         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11833         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11834         esac
11835         case "$gethostbyname_r_proto" in
11836         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11837         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11838         esac
11839         case "$gethostbyname_r_proto" in
11840         '')     d_gethostbyname_r=undef
11841                 gethostbyname_r_proto=0
11842                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11843         * )     case "$gethostbyname_r_proto" in
11844                 REENTRANT_PROTO*) ;;
11845                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11846                 esac
11847                 echo "Prototype: $try" ;;
11848         esac
11849         ;;
11850         *)      case "$usethreads" in
11851                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11852                 esac
11853                 ;;
11854         esac
11855         ;;
11856 *)      gethostbyname_r_proto=0
11857         ;;
11858 esac
11859
11860 : see if gethostent_r exists
11861 set gethostent_r d_gethostent_r
11862 eval $inlibc
11863 case "$d_gethostent_r" in
11864 "$define")
11865         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11866         case "$d_gethostent_r_proto:$usethreads" in
11867         ":define")      d_gethostent_r_proto=define
11868                 set d_gethostent_r_proto gethostent_r $hdrs
11869                 eval $hasproto ;;
11870         *)      ;;
11871         esac
11872         case "$d_gethostent_r_proto" in
11873         define)
11874         case "$gethostent_r_proto" in
11875         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11876         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11877         esac
11878         case "$gethostent_r_proto" in
11879         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11880         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11881         esac
11882         case "$gethostent_r_proto" in
11883         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11884         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11885         esac
11886         case "$gethostent_r_proto" in
11887         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11888         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11889         esac
11890         case "$gethostent_r_proto" in
11891         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11892         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11893         esac
11894         case "$gethostent_r_proto" in
11895         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11896         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11897         esac
11898         case "$gethostent_r_proto" in
11899         '')     d_gethostent_r=undef
11900                 gethostent_r_proto=0
11901                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11902         * )     case "$gethostent_r_proto" in
11903                 REENTRANT_PROTO*) ;;
11904                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11905                 esac
11906                 echo "Prototype: $try" ;;
11907         esac
11908         ;;
11909         *)      case "$usethreads" in
11910                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11911                 esac
11912                 ;;
11913         esac
11914         ;;
11915 *)      gethostent_r_proto=0
11916         ;;
11917 esac
11918
11919 : see if prototypes for various gethostxxx netdb.h functions are available
11920 echo " "
11921 set d_gethostprotos gethostent $i_netdb netdb.h
11922 eval $hasproto
11923
11924 : see if getitimer exists
11925 set getitimer d_getitimer
11926 eval $inlibc
11927
11928 : see if getlogin exists
11929 set getlogin d_getlogin
11930 eval $inlibc
11931
11932 : see if getlogin_r exists
11933 set getlogin_r d_getlogin_r
11934 eval $inlibc
11935 case "$d_getlogin_r" in
11936 "$define")
11937         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11938         case "$d_getlogin_r_proto:$usethreads" in
11939         ":define")      d_getlogin_r_proto=define
11940                 set d_getlogin_r_proto getlogin_r $hdrs
11941                 eval $hasproto ;;
11942         *)      ;;
11943         esac
11944         case "$d_getlogin_r_proto" in
11945         define)
11946         case "$getlogin_r_proto" in
11947         ''|0) try='int getlogin_r(char*, size_t);'
11948         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11949         esac
11950         case "$getlogin_r_proto" in
11951         ''|0) try='int getlogin_r(char*, int);'
11952         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11953         esac
11954         case "$getlogin_r_proto" in
11955         ''|0) try='char* getlogin_r(char*, size_t);'
11956         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11957         esac
11958         case "$getlogin_r_proto" in
11959         ''|0) try='char* getlogin_r(char*, int);'
11960         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11961         esac
11962         case "$getlogin_r_proto" in
11963         '')     d_getlogin_r=undef
11964                 getlogin_r_proto=0
11965                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
11966         * )     case "$getlogin_r_proto" in
11967                 REENTRANT_PROTO*) ;;
11968                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
11969                 esac
11970                 echo "Prototype: $try" ;;
11971         esac
11972         ;;
11973         *)      case "$usethreads" in
11974                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
11975                 esac
11976                 ;;
11977         esac
11978         ;;
11979 *)      getlogin_r_proto=0
11980         ;;
11981 esac
11982
11983 : see if getmnt exists
11984 set getmnt d_getmnt
11985 eval $inlibc
11986
11987 : see if getmntent exists
11988 set getmntent d_getmntent
11989 eval $inlibc
11990
11991 : see if getnetbyaddr exists
11992 set getnetbyaddr d_getnbyaddr
11993 eval $inlibc
11994
11995 : see if getnetbyname exists
11996 set getnetbyname d_getnbyname
11997 eval $inlibc
11998
11999 : see if getnetent exists
12000 set getnetent d_getnent
12001 eval $inlibc
12002
12003 : see if getnetbyaddr_r exists
12004 set getnetbyaddr_r d_getnetbyaddr_r
12005 eval $inlibc
12006 case "$d_getnetbyaddr_r" in
12007 "$define")
12008         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12009         case "$d_getnetbyaddr_r_proto:$usethreads" in
12010         ":define")      d_getnetbyaddr_r_proto=define
12011                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12012                 eval $hasproto ;;
12013         *)      ;;
12014         esac
12015         case "$d_getnetbyaddr_r_proto" in
12016         define)
12017         case "$getnetbyaddr_r_proto" in
12018         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12019         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12020         esac
12021         case "$getnetbyaddr_r_proto" in
12022         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12023         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12024         esac
12025         case "$getnetbyaddr_r_proto" in
12026         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12027         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12028         esac
12029         case "$getnetbyaddr_r_proto" in
12030         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12031         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12032         esac
12033         case "$getnetbyaddr_r_proto" in
12034         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12035         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12036         esac
12037         case "$getnetbyaddr_r_proto" in
12038         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12039         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12040         esac
12041         case "$getnetbyaddr_r_proto" in
12042         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12043         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12044         esac
12045         case "$getnetbyaddr_r_proto" in
12046         '')     d_getnetbyaddr_r=undef
12047                 getnetbyaddr_r_proto=0
12048                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12049         * )     case "$getnetbyaddr_r_proto" in
12050                 REENTRANT_PROTO*) ;;
12051                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12052                 esac
12053                 echo "Prototype: $try" ;;
12054         esac
12055         ;;
12056         *)      case "$usethreads" in
12057                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12058                 esac
12059                 ;;
12060         esac
12061         ;;
12062 *)      getnetbyaddr_r_proto=0
12063         ;;
12064 esac
12065
12066 : see if getnetbyname_r exists
12067 set getnetbyname_r d_getnetbyname_r
12068 eval $inlibc
12069 case "$d_getnetbyname_r" in
12070 "$define")
12071         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12072         case "$d_getnetbyname_r_proto:$usethreads" in
12073         ":define")      d_getnetbyname_r_proto=define
12074                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12075                 eval $hasproto ;;
12076         *)      ;;
12077         esac
12078         case "$d_getnetbyname_r_proto" in
12079         define)
12080         case "$getnetbyname_r_proto" in
12081         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12082         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12083         esac
12084         case "$getnetbyname_r_proto" in
12085         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12086         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12087         esac
12088         case "$getnetbyname_r_proto" in
12089         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12090         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12091         esac
12092         case "$getnetbyname_r_proto" in
12093         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12094         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12095         esac
12096         case "$getnetbyname_r_proto" in
12097         '')     d_getnetbyname_r=undef
12098                 getnetbyname_r_proto=0
12099                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12100         * )     case "$getnetbyname_r_proto" in
12101                 REENTRANT_PROTO*) ;;
12102                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12103                 esac
12104                 echo "Prototype: $try" ;;
12105         esac
12106         ;;
12107         *)      case "$usethreads" in
12108                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12109                 esac
12110                 ;;
12111         esac
12112         ;;
12113 *)      getnetbyname_r_proto=0
12114         ;;
12115 esac
12116
12117 : see if getnetent_r exists
12118 set getnetent_r d_getnetent_r
12119 eval $inlibc
12120 case "$d_getnetent_r" in
12121 "$define")
12122         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12123         case "$d_getnetent_r_proto:$usethreads" in
12124         ":define")      d_getnetent_r_proto=define
12125                 set d_getnetent_r_proto getnetent_r $hdrs
12126                 eval $hasproto ;;
12127         *)      ;;
12128         esac
12129         case "$d_getnetent_r_proto" in
12130         define)
12131         case "$getnetent_r_proto" in
12132         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12133         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12134         esac
12135         case "$getnetent_r_proto" in
12136         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12137         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12138         esac
12139         case "$getnetent_r_proto" in
12140         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12141         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12142         esac
12143         case "$getnetent_r_proto" in
12144         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12145         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12146         esac
12147         case "$getnetent_r_proto" in
12148         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12149         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12150         esac
12151         case "$getnetent_r_proto" in
12152         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12153         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12154         esac
12155         case "$getnetent_r_proto" in
12156         '')     d_getnetent_r=undef
12157                 getnetent_r_proto=0
12158                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12159         * )     case "$getnetent_r_proto" in
12160                 REENTRANT_PROTO*) ;;
12161                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12162                 esac
12163                 echo "Prototype: $try" ;;
12164         esac
12165         ;;
12166         *)      case "$usethreads" in
12167                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12168                 esac
12169                 ;;
12170         esac
12171         ;;
12172 *)      getnetent_r_proto=0
12173         ;;
12174 esac
12175
12176 : see if prototypes for various getnetxxx netdb.h functions are available
12177 echo " "
12178 set d_getnetprotos getnetent $i_netdb netdb.h
12179 eval $hasproto
12180
12181 : see if getpagesize exists
12182 set getpagesize d_getpagsz
12183 eval $inlibc
12184
12185
12186 : see if getprotobyname exists
12187 set getprotobyname d_getpbyname
12188 eval $inlibc
12189
12190 : see if getprotobynumber exists
12191 set getprotobynumber d_getpbynumber
12192 eval $inlibc
12193
12194 : see if getprotoent exists
12195 set getprotoent d_getpent
12196 eval $inlibc
12197
12198 : see if getpgid exists
12199 set getpgid d_getpgid
12200 eval $inlibc
12201
12202 : see if getpgrp2 exists
12203 set getpgrp2 d_getpgrp2
12204 eval $inlibc
12205
12206 : see if getppid exists
12207 set getppid d_getppid
12208 eval $inlibc
12209
12210 : see if getpriority exists
12211 set getpriority d_getprior
12212 eval $inlibc
12213
12214 : see if getprotobyname_r exists
12215 set getprotobyname_r d_getprotobyname_r
12216 eval $inlibc
12217 case "$d_getprotobyname_r" in
12218 "$define")
12219         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12220         case "$d_getprotobyname_r_proto:$usethreads" in
12221         ":define")      d_getprotobyname_r_proto=define
12222                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12223                 eval $hasproto ;;
12224         *)      ;;
12225         esac
12226         case "$d_getprotobyname_r_proto" in
12227         define)
12228         case "$getprotobyname_r_proto" in
12229         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12230         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12231         esac
12232         case "$getprotobyname_r_proto" in
12233         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12234         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12235         esac
12236         case "$getprotobyname_r_proto" in
12237         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12238         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12239         esac
12240         case "$getprotobyname_r_proto" in
12241         '')     d_getprotobyname_r=undef
12242                 getprotobyname_r_proto=0
12243                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12244         * )     case "$getprotobyname_r_proto" in
12245                 REENTRANT_PROTO*) ;;
12246                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12247                 esac
12248                 echo "Prototype: $try" ;;
12249         esac
12250         ;;
12251         *)      case "$usethreads" in
12252                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12253                 esac
12254                 ;;
12255         esac
12256         ;;
12257 *)      getprotobyname_r_proto=0
12258         ;;
12259 esac
12260
12261 : see if getprotobynumber_r exists
12262 set getprotobynumber_r d_getprotobynumber_r
12263 eval $inlibc
12264 case "$d_getprotobynumber_r" in
12265 "$define")
12266         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12267         case "$d_getprotobynumber_r_proto:$usethreads" in
12268         ":define")      d_getprotobynumber_r_proto=define
12269                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12270                 eval $hasproto ;;
12271         *)      ;;
12272         esac
12273         case "$d_getprotobynumber_r_proto" in
12274         define)
12275         case "$getprotobynumber_r_proto" in
12276         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12277         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12278         esac
12279         case "$getprotobynumber_r_proto" in
12280         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12281         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12282         esac
12283         case "$getprotobynumber_r_proto" in
12284         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12285         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12286         esac
12287         case "$getprotobynumber_r_proto" in
12288         '')     d_getprotobynumber_r=undef
12289                 getprotobynumber_r_proto=0
12290                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12291         * )     case "$getprotobynumber_r_proto" in
12292                 REENTRANT_PROTO*) ;;
12293                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12294                 esac
12295                 echo "Prototype: $try" ;;
12296         esac
12297         ;;
12298         *)      case "$usethreads" in
12299                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12300                 esac
12301                 ;;
12302         esac
12303         ;;
12304 *)      getprotobynumber_r_proto=0
12305         ;;
12306 esac
12307
12308 : see if getprotoent_r exists
12309 set getprotoent_r d_getprotoent_r
12310 eval $inlibc
12311 case "$d_getprotoent_r" in
12312 "$define")
12313         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12314         case "$d_getprotoent_r_proto:$usethreads" in
12315         ":define")      d_getprotoent_r_proto=define
12316                 set d_getprotoent_r_proto getprotoent_r $hdrs
12317                 eval $hasproto ;;
12318         *)      ;;
12319         esac
12320         case "$d_getprotoent_r_proto" in
12321         define)
12322         case "$getprotoent_r_proto" in
12323         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12324         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12325         esac
12326         case "$getprotoent_r_proto" in
12327         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12328         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12329         esac
12330         case "$getprotoent_r_proto" in
12331         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12332         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12333         esac
12334         case "$getprotoent_r_proto" in
12335         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12336         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12337         esac
12338         case "$getprotoent_r_proto" in
12339         '')     d_getprotoent_r=undef
12340                 getprotoent_r_proto=0
12341                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12342         * )     case "$getprotoent_r_proto" in
12343                 REENTRANT_PROTO*) ;;
12344                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12345                 esac
12346                 echo "Prototype: $try" ;;
12347         esac
12348         ;;
12349         *)      case "$usethreads" in
12350                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12351                 esac
12352                 ;;
12353         esac
12354         ;;
12355 *)      getprotoent_r_proto=0
12356         ;;
12357 esac
12358
12359 : see if prototypes for various getprotoxxx netdb.h functions are available
12360 echo " "
12361 set d_getprotoprotos getprotoent $i_netdb netdb.h
12362 eval $hasproto
12363
12364 : see if getprpwnam exists
12365 set getprpwnam d_getprpwnam
12366 eval $inlibc
12367
12368 : see if getpwent exists
12369 set getpwent d_getpwent
12370 eval $inlibc
12371
12372 : see if getpwent_r exists
12373 set getpwent_r d_getpwent_r
12374 eval $inlibc
12375 case "$d_getpwent_r" in
12376 "$define")
12377         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12378         case "$d_getpwent_r_proto:$usethreads" in
12379         ":define")      d_getpwent_r_proto=define
12380                 set d_getpwent_r_proto getpwent_r $hdrs
12381                 eval $hasproto ;;
12382         *)      ;;
12383         esac
12384         case "$d_getpwent_r_proto" in
12385         define)
12386         case "$getpwent_r_proto" in
12387         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12388         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12389         esac
12390         case "$getpwent_r_proto" in
12391         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12392         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12393         esac
12394         case "$getpwent_r_proto" in
12395         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12396         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12397         esac
12398         case "$getpwent_r_proto" in
12399         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12400         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12401         esac
12402         case "$getpwent_r_proto" in
12403         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12404         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12405         esac
12406         case "$getpwent_r_proto" in
12407         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12408         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12409         esac
12410         case "$getpwent_r_proto" in
12411         '')     d_getpwent_r=undef
12412                 getpwent_r_proto=0
12413                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12414         * )     case "$getpwent_r_proto" in
12415                 REENTRANT_PROTO*) ;;
12416                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12417                 esac
12418                 echo "Prototype: $try" ;;
12419         esac
12420         ;;
12421         *)      case "$usethreads" in
12422                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12423                 esac
12424                 ;;
12425         esac
12426         ;;
12427 *)      getpwent_r_proto=0
12428         ;;
12429 esac
12430
12431 : see if getpwnam_r exists
12432 set getpwnam_r d_getpwnam_r
12433 eval $inlibc
12434 case "$d_getpwnam_r" in
12435 "$define")
12436         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12437         case "$d_getpwnam_r_proto:$usethreads" in
12438         ":define")      d_getpwnam_r_proto=define
12439                 set d_getpwnam_r_proto getpwnam_r $hdrs
12440                 eval $hasproto ;;
12441         *)      ;;
12442         esac
12443         case "$d_getpwnam_r_proto" in
12444         define)
12445         case "$getpwnam_r_proto" in
12446         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12447         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12448         esac
12449         case "$getpwnam_r_proto" in
12450         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12451         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12452         esac
12453         case "$getpwnam_r_proto" in
12454         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12455         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12456         esac
12457         case "$getpwnam_r_proto" in
12458         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12459         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12460         esac
12461         case "$getpwnam_r_proto" in
12462         '')     d_getpwnam_r=undef
12463                 getpwnam_r_proto=0
12464                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12465         * )     case "$getpwnam_r_proto" in
12466                 REENTRANT_PROTO*) ;;
12467                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12468                 esac
12469                 echo "Prototype: $try" ;;
12470         esac
12471         ;;
12472         *)      case "$usethreads" in
12473                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12474                 esac
12475                 ;;
12476         esac
12477         ;;
12478 *)      getpwnam_r_proto=0
12479         ;;
12480 esac
12481
12482 : see if getpwuid_r exists
12483 set getpwuid_r d_getpwuid_r
12484 eval $inlibc
12485 case "$d_getpwuid_r" in
12486 "$define")
12487         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12488         case "$d_getpwuid_r_proto:$usethreads" in
12489         ":define")      d_getpwuid_r_proto=define
12490                 set d_getpwuid_r_proto getpwuid_r $hdrs
12491                 eval $hasproto ;;
12492         *)      ;;
12493         esac
12494         case "$d_getpwuid_r_proto" in
12495         define)
12496         case "$getpwuid_r_proto" in
12497         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12498         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12499         esac
12500         case "$getpwuid_r_proto" in
12501         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12502         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12503         esac
12504         case "$getpwuid_r_proto" in
12505         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12506         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12507         esac
12508         case "$getpwuid_r_proto" in
12509         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12510         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12511         esac
12512         case "$getpwuid_r_proto" in
12513         '')     d_getpwuid_r=undef
12514                 getpwuid_r_proto=0
12515                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12516         * )     case "$getpwuid_r_proto" in
12517                 REENTRANT_PROTO*) ;;
12518                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12519                 esac
12520                 echo "Prototype: $try" ;;
12521         esac
12522         ;;
12523         *)      case "$usethreads" in
12524                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12525                 esac
12526                 ;;
12527         esac
12528         ;;
12529 *)      getpwuid_r_proto=0
12530         ;;
12531 esac
12532
12533
12534 : see if getservbyname exists
12535 set getservbyname d_getsbyname
12536 eval $inlibc
12537
12538 : see if getservbyport exists
12539 set getservbyport d_getsbyport
12540 eval $inlibc
12541
12542 : see if getservent exists
12543 set getservent d_getsent
12544 eval $inlibc
12545
12546 : see if getservbyname_r exists
12547 set getservbyname_r d_getservbyname_r
12548 eval $inlibc
12549 case "$d_getservbyname_r" in
12550 "$define")
12551         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12552         case "$d_getservbyname_r_proto:$usethreads" in
12553         ":define")      d_getservbyname_r_proto=define
12554                 set d_getservbyname_r_proto getservbyname_r $hdrs
12555                 eval $hasproto ;;
12556         *)      ;;
12557         esac
12558         case "$d_getservbyname_r_proto" in
12559         define)
12560         case "$getservbyname_r_proto" in
12561         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12562         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12563         esac
12564         case "$getservbyname_r_proto" in
12565         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12566         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12567         esac
12568         case "$getservbyname_r_proto" in
12569         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12570         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12571         esac
12572         case "$getservbyname_r_proto" in
12573         '')     d_getservbyname_r=undef
12574                 getservbyname_r_proto=0
12575                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12576         * )     case "$getservbyname_r_proto" in
12577                 REENTRANT_PROTO*) ;;
12578                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12579                 esac
12580                 echo "Prototype: $try" ;;
12581         esac
12582         ;;
12583         *)      case "$usethreads" in
12584                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12585                 esac
12586                 ;;
12587         esac
12588         ;;
12589 *)      getservbyname_r_proto=0
12590         ;;
12591 esac
12592
12593 : see if getservbyport_r exists
12594 set getservbyport_r d_getservbyport_r
12595 eval $inlibc
12596 case "$d_getservbyport_r" in
12597 "$define")
12598         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12599         case "$d_getservbyport_r_proto:$usethreads" in
12600         ":define")      d_getservbyport_r_proto=define
12601                 set d_getservbyport_r_proto getservbyport_r $hdrs
12602                 eval $hasproto ;;
12603         *)      ;;
12604         esac
12605         case "$d_getservbyport_r_proto" in
12606         define)
12607         case "$getservbyport_r_proto" in
12608         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12609         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12610         esac
12611         case "$getservbyport_r_proto" in
12612         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12613         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12614         esac
12615         case "$getservbyport_r_proto" in
12616         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12617         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12618         esac
12619         case "$getservbyport_r_proto" in
12620         '')     d_getservbyport_r=undef
12621                 getservbyport_r_proto=0
12622                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12623         * )     case "$getservbyport_r_proto" in
12624                 REENTRANT_PROTO*) ;;
12625                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12626                 esac
12627                 echo "Prototype: $try" ;;
12628         esac
12629         ;;
12630         *)      case "$usethreads" in
12631                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12632                 esac
12633                 ;;
12634         esac
12635         ;;
12636 *)      getservbyport_r_proto=0
12637         ;;
12638 esac
12639
12640 : see if getservent_r exists
12641 set getservent_r d_getservent_r
12642 eval $inlibc
12643 case "$d_getservent_r" in
12644 "$define")
12645         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12646         case "$d_getservent_r_proto:$usethreads" in
12647         ":define")      d_getservent_r_proto=define
12648                 set d_getservent_r_proto getservent_r $hdrs
12649                 eval $hasproto ;;
12650         *)      ;;
12651         esac
12652         case "$d_getservent_r_proto" in
12653         define)
12654         case "$getservent_r_proto" in
12655         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12656         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12657         esac
12658         case "$getservent_r_proto" in
12659         ''|0) try='int getservent_r(struct servent*, char*, int);'
12660         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12661         esac
12662         case "$getservent_r_proto" in
12663         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12664         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12665         esac
12666         case "$getservent_r_proto" in
12667         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12668         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12669         esac
12670         case "$getservent_r_proto" in
12671         '')     d_getservent_r=undef
12672                 getservent_r_proto=0
12673                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12674         * )     case "$getservent_r_proto" in
12675                 REENTRANT_PROTO*) ;;
12676                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12677                 esac
12678                 echo "Prototype: $try" ;;
12679         esac
12680         ;;
12681         *)      case "$usethreads" in
12682                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12683                 esac
12684                 ;;
12685         esac
12686         ;;
12687 *)      getservent_r_proto=0
12688         ;;
12689 esac
12690
12691 : see if prototypes for various getservxxx netdb.h functions are available
12692 echo " "
12693 set d_getservprotos getservent $i_netdb netdb.h
12694 eval $hasproto
12695
12696 : see if getspnam exists
12697 set getspnam d_getspnam
12698 eval $inlibc
12699
12700 : see if this is a shadow.h system
12701 set shadow.h i_shadow
12702 eval $inhdr
12703
12704 : see if getspnam_r exists
12705 set getspnam_r d_getspnam_r
12706 eval $inlibc
12707 case "$d_getspnam_r" in
12708 "$define")
12709         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12710         case "$d_getspnam_r_proto:$usethreads" in
12711         ":define")      d_getspnam_r_proto=define
12712                 set d_getspnam_r_proto getspnam_r $hdrs
12713                 eval $hasproto ;;
12714         *)      ;;
12715         esac
12716         case "$d_getspnam_r_proto" in
12717         define)
12718         case "$getspnam_r_proto" in
12719         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12720         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12721         esac
12722         case "$getspnam_r_proto" in
12723         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12724         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12725         esac
12726         case "$getspnam_r_proto" in
12727         '')     d_getspnam_r=undef
12728                 getspnam_r_proto=0
12729                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12730         * )     case "$getspnam_r_proto" in
12731                 REENTRANT_PROTO*) ;;
12732                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12733                 esac
12734                 echo "Prototype: $try" ;;
12735         esac
12736         ;;
12737         *)      case "$usethreads" in
12738                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12739                 esac
12740                 ;;
12741         esac
12742         ;;
12743 *)      getspnam_r_proto=0
12744         ;;
12745 esac
12746
12747 : see if gettimeofday or ftime exists
12748 set gettimeofday d_gettimeod
12749 eval $inlibc
12750 case "$d_gettimeod" in
12751 "$undef")
12752         set ftime d_ftime 
12753         eval $inlibc
12754         ;;
12755 *)
12756         val="$undef"; set d_ftime; eval $setvar
12757         ;;
12758 esac
12759 case "$d_gettimeod$d_ftime" in
12760 "$undef$undef")
12761         echo " "
12762         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12763         ;;
12764 esac
12765
12766 : see if gmtime_r exists
12767 set gmtime_r d_gmtime_r
12768 eval $inlibc
12769 case "$d_gmtime_r" in
12770 "$define")
12771         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
12772         case "$d_gmtime_r_proto:$usethreads" in
12773         ":define")      d_gmtime_r_proto=define
12774                 set d_gmtime_r_proto gmtime_r $hdrs
12775                 eval $hasproto ;;
12776         *)      ;;
12777         esac
12778         case "$d_gmtime_r_proto" in
12779         define)
12780         case "$gmtime_r_proto" in
12781         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12782         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12783         esac
12784         case "$gmtime_r_proto" in
12785         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12786         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12787         esac
12788         case "$gmtime_r_proto" in
12789         '')     d_gmtime_r=undef
12790                 gmtime_r_proto=0
12791                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12792         * )     case "$gmtime_r_proto" in
12793                 REENTRANT_PROTO*) ;;
12794                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12795                 esac
12796                 echo "Prototype: $try" ;;
12797         esac
12798         ;;
12799         *)      case "$usethreads" in
12800                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12801                 esac
12802                 ;;
12803         esac
12804         ;;
12805 *)      gmtime_r_proto=0
12806         ;;
12807 esac
12808
12809 : see if hasmntopt exists
12810 set hasmntopt d_hasmntopt
12811 eval $inlibc
12812
12813 : see if this is a netinet/in.h or sys/in.h system
12814 set netinet/in.h i_niin sys/in.h i_sysin
12815 eval $inhdr
12816
12817 : see if arpa/inet.h has to be included
12818 set arpa/inet.h i_arpainet
12819 eval $inhdr
12820
12821 : see if htonl --and friends-- exists
12822 val=''
12823 set htonl val
12824 eval $inlibc
12825
12826 : Maybe they are macros.
12827 case "$val" in
12828 $undef)
12829         $cat >htonl.c <<EOM
12830 #include <stdio.h>
12831 #include <sys/types.h>
12832 #$i_niin I_NETINET_IN
12833 #$i_sysin I_SYS_IN
12834 #$i_arpainet I_ARPA_INET
12835 #ifdef I_NETINET_IN
12836 #include <netinet/in.h>
12837 #endif
12838 #ifdef I_SYS_IN
12839 #include <sys/in.h>
12840 #endif
12841 #ifdef I_ARPA_INET
12842 #include <arpa/inet.h>
12843 #endif
12844 #ifdef htonl
12845 printf("Defined as a macro.");
12846 #endif
12847 EOM
12848         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12849         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12850                 val="$define"
12851                 echo "But it seems to be defined as a macro." >&4
12852         fi
12853         $rm -f htonl.?
12854         ;;
12855 esac
12856 set d_htonl
12857 eval $setvar
12858
12859 : index or strchr
12860 echo " "
12861 if set index val -f; eval $csym; $val; then
12862         if set strchr val -f d_strchr; eval $csym; $val; then
12863                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12864                         val="$define"
12865                         vali="$undef"
12866                         echo "strchr() found." >&4
12867                 else
12868                         val="$undef"
12869                         vali="$define"
12870                         echo "index() found." >&4
12871                 fi
12872         else
12873                 val="$undef"
12874                 vali="$define"
12875                 echo "index() found." >&4
12876         fi
12877 else
12878         if set strchr val -f d_strchr; eval $csym; $val; then
12879                 val="$define"
12880                 vali="$undef"
12881                 echo "strchr() found." >&4
12882         else
12883                 echo "No index() or strchr() found!" >&4
12884                 val="$undef"
12885                 vali="$undef"
12886         fi
12887 fi
12888 set d_strchr; eval $setvar
12889 val="$vali"
12890 set d_index; eval $setvar
12891
12892 : check whether inet_aton exists
12893 set inet_aton d_inetaton
12894 eval $inlibc
12895
12896 : Look for isascii
12897 echo " "
12898 $cat >isascii.c <<'EOCP'
12899 #include <stdio.h>
12900 #include <ctype.h>
12901 int main() {
12902         int c = 'A';
12903         if (isascii(c))
12904                 exit(0);
12905         else
12906                 exit(1);
12907 }
12908 EOCP
12909 set isascii
12910 if eval $compile; then
12911         echo "isascii() found." >&4
12912         val="$define"
12913 else
12914         echo "isascii() NOT found." >&4
12915         val="$undef"
12916 fi
12917 set d_isascii
12918 eval $setvar
12919 $rm -f isascii*
12920
12921 : see if isfinite exists
12922 set isfinite d_isfinite
12923 eval $inlibc
12924
12925 : see if isinf exists
12926 set isinf d_isinf
12927 eval $inlibc
12928
12929 : see if isnan exists
12930 set isnan d_isnan
12931 eval $inlibc
12932
12933 : see if isnanl exists
12934 set isnanl d_isnanl
12935 eval $inlibc
12936
12937 : see if killpg exists
12938 set killpg d_killpg
12939 eval $inlibc
12940
12941 : see if lchown exists
12942 echo " "
12943 $cat > try.c <<'EOCP'
12944 /* System header to define __stub macros and hopefully few prototypes,
12945     which can conflict with char lchown(); below.  */
12946 #include <assert.h>
12947 /* Override any gcc2 internal prototype to avoid an error.  */
12948 /* We use char because int might match the return type of a gcc2
12949    builtin and then its argument prototype would still apply.  */
12950 char lchown();
12951 int main() {
12952     /*  The GNU C library defines this for functions which it implements
12953         to always fail with ENOSYS.  Some functions are actually named
12954         something starting with __ and the normal name is an alias.  */
12955 #if defined (__stub_lchown) || defined (__stub___lchown)
12956 choke me
12957 #else
12958 lchown();
12959 #endif
12960 ; return 0; }
12961 EOCP
12962 set try
12963 if eval $compile; then
12964     $echo "lchown() found." >&4
12965     val="$define"
12966 else
12967     $echo "lchown() NOT found." >&4
12968     val="$undef"
12969 fi
12970 set d_lchown
12971 eval $setvar
12972
12973 : See if number of significant digits in a double precision number is known
12974 echo " "
12975 $cat >ldbl_dig.c <<EOM
12976 #$i_limits I_LIMITS
12977 #$i_float I_FLOAT
12978 #ifdef I_LIMITS
12979 #include <limits.h>
12980 #endif
12981 #ifdef I_FLOAT
12982 #include <float.h>
12983 #endif
12984 #ifdef LDBL_DIG
12985 printf("Contains LDBL_DIG");
12986 #endif
12987 EOM
12988 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
12989 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
12990         echo "LDBL_DIG found." >&4
12991         val="$define"
12992 else
12993         echo "LDBL_DIG NOT found." >&4
12994         val="$undef"
12995 fi
12996 $rm -f ldbl_dig.?
12997 set d_ldbl_dig
12998 eval $setvar
12999
13000 : see if link exists
13001 set link d_link
13002 eval $inlibc
13003
13004 : see if localtime_r exists
13005 set localtime_r d_localtime_r
13006 eval $inlibc
13007 case "$d_localtime_r" in
13008 "$define")
13009         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
13010         case "$d_localtime_r_proto:$usethreads" in
13011         ":define")      d_localtime_r_proto=define
13012                 set d_localtime_r_proto localtime_r $hdrs
13013                 eval $hasproto ;;
13014         *)      ;;
13015         esac
13016         case "$d_localtime_r_proto" in
13017         define)
13018         case "$localtime_r_proto" in
13019         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13020         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13021         esac
13022         case "$localtime_r_proto" in
13023         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13024         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13025         esac
13026         case "$localtime_r_proto" in
13027         '')     d_localtime_r=undef
13028                 localtime_r_proto=0
13029                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13030         * )     case "$localtime_r_proto" in
13031                 REENTRANT_PROTO*) ;;
13032                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13033                 esac
13034                 echo "Prototype: $try" ;;
13035         esac
13036         ;;
13037         *)      case "$usethreads" in
13038                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13039                 esac
13040                 ;;
13041         esac
13042         ;;
13043 *)      localtime_r_proto=0
13044         ;;
13045 esac
13046
13047 : see if localeconv exists
13048 set localeconv d_locconv
13049 eval $inlibc
13050
13051 : see if lockf exists
13052 set lockf d_lockf
13053 eval $inlibc
13054
13055 : see if prototype for lseek is available
13056 echo " "
13057 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13058 eval $hasproto
13059
13060 : see if lstat exists
13061 set lstat d_lstat
13062 eval $inlibc
13063
13064 : see if madvise exists
13065 set madvise d_madvise
13066 eval $inlibc
13067
13068 : see if mblen exists
13069 set mblen d_mblen
13070 eval $inlibc
13071
13072 : see if mbstowcs exists
13073 set mbstowcs d_mbstowcs
13074 eval $inlibc
13075
13076 : see if mbtowc exists
13077 set mbtowc d_mbtowc
13078 eval $inlibc
13079
13080 : see if memchr exists
13081 set memchr d_memchr
13082 eval $inlibc
13083
13084 : see if memcmp exists
13085 set memcmp d_memcmp
13086 eval $inlibc
13087
13088 : see if memcpy exists
13089 set memcpy d_memcpy
13090 eval $inlibc
13091
13092 : see if memmove exists
13093 set memmove d_memmove
13094 eval $inlibc
13095
13096 : see if memset exists
13097 set memset d_memset
13098 eval $inlibc
13099
13100 : see if mkdir exists
13101 set mkdir d_mkdir
13102 eval $inlibc
13103
13104 : see if mkdtemp exists
13105 set mkdtemp d_mkdtemp
13106 eval $inlibc
13107
13108 : see if mkfifo exists
13109 set mkfifo d_mkfifo
13110 eval $inlibc
13111
13112 : see if mkstemp exists
13113 set mkstemp d_mkstemp
13114 eval $inlibc
13115
13116 : see if mkstemps exists
13117 set mkstemps d_mkstemps
13118 eval $inlibc
13119
13120 : see if mktime exists
13121 set mktime d_mktime
13122 eval $inlibc
13123
13124 : see if this is a sys/mman.h system
13125 set sys/mman.h i_sysmman
13126 eval $inhdr
13127
13128 : see if mmap exists
13129 set mmap d_mmap
13130 eval $inlibc
13131 : see what shmat returns
13132 : default to something harmless
13133 mmaptype='void *'
13134 case "$i_sysmman$d_mmap" in
13135 "$define$define")
13136         $cat >mmap.c <<'END'
13137 #include <sys/mman.h>
13138 void *mmap();
13139 END
13140         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13141                 mmaptype='void *'
13142         else
13143                 mmaptype='caddr_t'
13144         fi
13145         echo "and it returns ($mmaptype)." >&4
13146         ;;
13147 esac
13148
13149
13150
13151 : see if mprotect exists
13152 set mprotect d_mprotect
13153 eval $inlibc
13154
13155 : see if msgctl exists
13156 set msgctl d_msgctl
13157 eval $inlibc
13158
13159 : see if msgget exists
13160 set msgget d_msgget
13161 eval $inlibc
13162
13163 : see if msgsnd exists
13164 set msgsnd d_msgsnd
13165 eval $inlibc
13166
13167 : see if msgrcv exists
13168 set msgrcv d_msgrcv
13169 eval $inlibc
13170
13171 : see how much of the 'msg*(2)' library is present.
13172 h_msg=true
13173 echo " "
13174 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13175 *"$undef"*) h_msg=false;;
13176 esac
13177 case "$osname" in
13178 freebsd)
13179     case "`ipcs 2>&1`" in
13180     "SVID messages"*"not configured"*)
13181         echo "Your $osname does not have the msg*(2) configured." >&4
13182         h_msg=false
13183         val="$undef"
13184         set msgctl d_msgctl
13185         eval $setvar
13186         set msgget d_msgget
13187         eval $setvar
13188         set msgsnd d_msgsnd
13189         eval $setvar
13190         set msgrcv d_msgrcv
13191         eval $setvar
13192         ;;
13193     esac
13194     ;;
13195 esac
13196 : we could also check for sys/ipc.h ...
13197 if $h_msg && $test `./findhdr sys/msg.h`; then
13198         echo "You have the full msg*(2) library." >&4
13199         val="$define"
13200 else
13201         echo "You don't have the full msg*(2) library." >&4
13202         val="$undef"
13203 fi
13204 set d_msg
13205 eval $setvar
13206
13207
13208 echo " "
13209 echo "Checking to see if your system supports struct msghdr..." >&4
13210 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13211 eval $hasstruct
13212 case "$d_msghdr_s" in
13213 "$define")      echo "Yes, it does."   ;;
13214 *)              echo "No, it doesn't." ;;
13215 esac
13216
13217
13218 : see if msync exists
13219 set msync d_msync
13220 eval $inlibc
13221
13222 : see if munmap exists
13223 set munmap d_munmap
13224 eval $inlibc
13225
13226 : see if nice exists
13227 set nice d_nice
13228 eval $inlibc
13229
13230 : see if this is a langinfo.h system
13231 set langinfo.h i_langinfo
13232 eval $inhdr
13233
13234 : see if nl_langinfo exists
13235 set nl_langinfo d_nl_langinfo
13236 eval $inlibc
13237
13238 : check for length of character
13239 echo " "
13240 case "$charsize" in
13241 '')
13242         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13243         $cat >try.c <<'EOCP'
13244 #include <stdio.h>
13245 int main()
13246 {
13247     printf("%d\n", (int)sizeof(char));
13248     exit(0);
13249 }
13250 EOCP
13251         set try
13252         if eval $compile_ok; then
13253                 dflt=`$run ./try`
13254         else
13255                 dflt='1'
13256                 echo "(I can't seem to compile the test program.  Guessing...)"
13257         fi
13258         ;;
13259 *)
13260         dflt="$charsize"
13261         ;;
13262 esac
13263 rp="What is the size of a character (in bytes)?"
13264 . ./myread
13265 charsize="$ans"
13266 $rm -f try.c try
13267
13268 : check for volatile keyword
13269 echo " "
13270 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13271 $cat >try.c <<'EOCP'
13272 int main()
13273 {
13274         typedef struct _goo_struct goo_struct;
13275         goo_struct * volatile goo = ((goo_struct *)0);
13276         struct _goo_struct {
13277                 long long_int;
13278                 int reg_int;
13279                 char char_var;
13280         };
13281         typedef unsigned short foo_t;
13282         char *volatile foo;
13283         volatile int bar;
13284         volatile foo_t blech;
13285         foo = foo;
13286 }
13287 EOCP
13288 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13289         val="$define"
13290         echo "Yup, it does."
13291 else
13292         val="$undef"
13293         echo "Nope, it doesn't."
13294 fi
13295 set d_volatile
13296 eval $setvar
13297 $rm -f try.*
13298
13299
13300 echo " "
13301 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13302
13303 case "$use64bitint:$d_quad:$quadtype" in
13304 define:define:?*)
13305         ivtype="$quadtype"
13306         uvtype="$uquadtype"
13307         ivsize=8
13308         uvsize=8
13309         ;;
13310 *)      ivtype="long"
13311         uvtype="unsigned long"
13312         ivsize=$longsize
13313         uvsize=$longsize
13314         ;;
13315 esac
13316
13317 case "$uselongdouble:$d_longdbl" in
13318 define:define)
13319         nvtype="long double"
13320         nvsize=$longdblsize
13321         ;;
13322 *)      nvtype=double
13323         nvsize=$doublesize
13324         ;;
13325 esac
13326
13327 $echo "(IV will be "$ivtype", $ivsize bytes)"
13328 $echo "(UV will be "$uvtype", $uvsize bytes)"
13329 $echo "(NV will be "$nvtype", $nvsize bytes)"
13330
13331 $cat >try.c <<EOCP
13332 #$i_inttypes I_INTTYPES
13333 #ifdef I_INTTYPES
13334 #include <inttypes.h>
13335 #endif
13336 #include <stdio.h>
13337 int main() {
13338 #ifdef INT8
13339    int8_t i =  INT8_MAX;
13340   uint8_t u = UINT8_MAX;
13341   printf("int8_t\n");
13342 #endif
13343 #ifdef INT16
13344    int16_t i =  INT16_MAX;
13345   uint16_t i = UINT16_MAX;
13346   printf("int16_t\n");
13347 #endif
13348 #ifdef INT32
13349    int32_t i =  INT32_MAX;
13350   uint32_t u = UINT32_MAX;
13351   printf("int32_t\n");
13352 #endif
13353 }
13354 EOCP
13355
13356 case "$i8type" in
13357 '')     case "$charsize" in
13358         1)      i8type=char
13359                 u8type="unsigned char"
13360                 i8size=$charsize
13361                 u8size=$charsize
13362                 ;;
13363         esac
13364         ;;
13365 esac
13366 case "$i8type" in
13367 '')     set try -DINT8
13368         if eval $compile; then
13369                 case "`$run ./try`" in
13370                 int8_t) i8type=int8_t
13371                         u8type=uint8_t
13372                         i8size=1
13373                         u8size=1
13374                         ;;
13375                 esac
13376         fi
13377         ;;
13378 esac
13379 case "$i8type" in
13380 '')     if $test $charsize -ge 1; then
13381                 i8type=char
13382                 u8type="unsigned char"
13383                 i8size=$charsize
13384                 u8size=$charsize
13385         fi
13386         ;;
13387 esac
13388
13389 case "$i16type" in
13390 '')     case "$shortsize" in
13391         2)      i16type=short
13392                 u16type="unsigned short"
13393                 i16size=$shortsize
13394                 u16size=$shortsize
13395                 ;;
13396         esac
13397         ;;
13398 esac
13399 case "$i16type" in
13400 '')     set try -DINT16
13401         if eval $compile; then
13402                 case "`$run ./try`" in
13403                 int16_t)
13404                         i16type=int16_t
13405                         u16type=uint16_t
13406                         i16size=2
13407                         u16size=2
13408                         ;;
13409                 esac
13410         fi
13411         ;;
13412 esac
13413 case "$i16type" in
13414 '')     if $test $shortsize -ge 2; then
13415                 i16type=short
13416                 u16type="unsigned short"
13417                 i16size=$shortsize
13418                 u16size=$shortsize
13419         fi
13420         ;;
13421 esac
13422
13423 case "$i32type" in
13424 '')     case "$longsize" in
13425         4)      i32type=long
13426                 u32type="unsigned long"
13427                 i32size=$longsize
13428                 u32size=$longsize
13429                 ;;
13430         *)      case "$intsize" in
13431                 4)      i32type=int
13432                         u32type="unsigned int"
13433                         i32size=$intsize
13434                         u32size=$intsize
13435                         ;;
13436                 esac
13437                 ;;
13438         esac
13439         ;;
13440 esac
13441 case "$i32type" in
13442 '')     set try -DINT32
13443         if eval $compile; then
13444                 case "`$run ./try`" in
13445                 int32_t)
13446                         i32type=int32_t
13447                         u32type=uint32_t
13448                         i32size=4
13449                         u32size=4
13450                         ;;
13451                 esac
13452         fi
13453         ;;
13454 esac
13455 case "$i32type" in
13456 '')     if $test $intsize -ge 4; then
13457                 i32type=int
13458                 u32type="unsigned int"
13459                 i32size=$intsize
13460                 u32size=$intsize
13461         fi
13462         ;;
13463 esac
13464
13465 case "$i64type" in
13466 '')     case "$d_quad:$quadtype" in
13467         define:?*)
13468                 i64type="$quadtype"
13469                 u64type="$uquadtype"
13470                 i64size=8
13471                 u64size=8
13472                 ;;
13473         esac
13474         ;;
13475 esac
13476
13477 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13478 : volatile so that the compiler has to store it out to memory.
13479 if test X"$d_volatile" = X"$define"; then
13480         volatile=volatile
13481 fi
13482 $cat <<EOP >try.c
13483 #include <stdio.h>
13484 #include <sys/types.h>
13485 #include <signal.h>
13486 #ifdef SIGFPE
13487 $volatile int bletched = 0;
13488 $signal_t blech(s) int s; { bletched = 1; }
13489 #endif
13490 int main() {
13491     $uvtype u = 0;
13492     $nvtype d;
13493     int     n = 8 * $uvsize;
13494     int     i;
13495 #ifdef SIGFPE
13496     signal(SIGFPE, blech);
13497 #endif
13498
13499     for (i = 0; i < n; i++) {
13500       u = u << 1 | ($uvtype)1;
13501       d = ($nvtype)u;
13502       if (($uvtype)d != u)
13503         break;
13504       if (d <= 0)
13505         break;
13506       d = ($nvtype)(u - 1);
13507       if (($uvtype)d != (u - 1))
13508         break;
13509 #ifdef SIGFPE
13510       if (bletched) {
13511         break;
13512 #endif
13513       } 
13514     }
13515     printf("%d\n", ((i == n) ? -n : i));
13516     exit(0);
13517 }
13518 EOP
13519 set try
13520
13521 d_nv_preserves_uv="$undef"
13522 if eval $compile; then
13523         nv_preserves_uv_bits="`$run ./try`"
13524 fi
13525 case "$nv_preserves_uv_bits" in
13526 \-[1-9]*)       
13527         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13528         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13529         d_nv_preserves_uv="$define"
13530         ;;
13531 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13532         d_nv_preserves_uv="$undef" ;;
13533 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13534         nv_preserves_uv_bits="$undef" ;;
13535 esac
13536
13537 $rm -f try.* try
13538
13539
13540 : check for off64_t
13541 echo " "
13542 echo "Checking to see if you have off64_t..." >&4
13543 $cat >try.c <<EOCP
13544 #include <sys/types.h>
13545 #include <unistd.h>
13546 int main() { off64_t x = 7; }
13547 EOCP
13548 set try
13549 if eval $compile; then
13550         val="$define"
13551         echo "You have off64_t."
13552 else
13553         val="$undef"
13554         echo "You do not have off64_t."
13555         case "$lseeksize" in
13556         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13557         esac
13558 fi
13559 $rm -f try.* try
13560 set d_off64_t
13561 eval $setvar
13562
13563 : see if POSIX threads are available
13564 set pthread.h i_pthread
13565 eval $inhdr
13566
13567
13568
13569
13570 : how to create joinable pthreads
13571 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13572         echo " "
13573         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13574         $cat >try.c <<'EOCP'
13575 #include <pthread.h>
13576 int main() {
13577     int detachstate = JOINABLE;
13578 }
13579 EOCP
13580         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13581         if eval $compile; then
13582                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13583                 val="$undef" # Yes, undef.
13584                 set d_old_pthread_create_joinable
13585                 eval $setvar
13586                 val=""
13587                 set old_pthread_create_joinable
13588                 eval $setvar
13589         else
13590                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13591                 if eval $compile; then
13592                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13593                         val="$define"
13594                         set d_old_pthread_create_joinable
13595                         eval $setvar
13596                         val=PTHREAD_CREATE_UNDETACHED
13597                         set old_pthread_create_joinable
13598                         eval $setvar
13599                 else            
13600                         set try -DJOINABLE=__UNDETACHED
13601                         if eval $compile; then
13602                                 echo "You seem to use __UNDETACHED." >&4
13603                                 val="$define"
13604                                 set d_old_pthread_create_joinable
13605                                 eval $setvar
13606                                 val=__UNDETACHED
13607                                 set old_pthread_create_joinable
13608                                 eval $setvar
13609                         else
13610                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13611                                 val="$define"
13612                                 set d_old_pthread_create_joinable
13613                                 eval $setvar
13614                                 val=0
13615                                 set old_pthread_create_joinable
13616                                 eval $setvar
13617                         fi
13618                 fi
13619         fi
13620         $rm -f try try.*
13621 else
13622     d_old_pthread_create_joinable="$undef"
13623     old_pthread_create_joinable=""
13624 fi
13625
13626 : see if pause exists
13627 set pause d_pause
13628 eval $inlibc
13629
13630 : see if pipe exists
13631 set pipe d_pipe
13632 eval $inlibc
13633
13634 : see if poll exists
13635 set poll d_poll
13636 eval $inlibc
13637
13638 : see if readlink exists
13639 set readlink d_readlink
13640 eval $inlibc
13641
13642 echo " "
13643 procselfexe=''
13644 val="$undef"
13645 case "$d_readlink" in
13646 "$define")
13647         if $issymlink /proc/self/exe ; then
13648                 $ls -l /proc/self/exe > reflect
13649                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13650                         echo "You have Linux-like /proc/self/exe."
13651                         procselfexe='"/proc/self/exe"'
13652                         val="$define"
13653                 fi
13654         fi
13655         if $issymlink /proc/curproc/file ; then
13656                 $ls -l /proc/curproc/file > reflect
13657                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13658                         echo "You have BSD-like /proc/curproc/file."
13659                         procselfexe='"/proc/curproc/file"'
13660                         val="$define"
13661                 fi
13662         fi
13663         ;;
13664 esac
13665 $rm -f reflect
13666 set d_procselfexe
13667 eval $setvar
13668
13669 : see whether the pthread_atfork exists
13670 $cat >try.c <<EOP
13671 #include <pthread.h>
13672 #include <stdio.h>
13673 int main() {
13674 #ifdef  PTHREAD_ATFORK
13675         pthread_atfork(NULL,NULL,NULL);
13676 #endif
13677 }
13678 EOP
13679
13680 : see if pthread_atfork exists
13681 set try -DPTHREAD_ATFORK
13682 if eval $compile; then
13683     val="$define"
13684 else
13685     val="$undef"
13686 fi
13687 case "$usethreads" in
13688 $define)
13689         case "$val" in
13690         $define) echo 'pthread_atfork found.' >&4        ;;
13691         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13692         esac
13693 esac
13694 set d_pthread_atfork
13695 eval $setvar
13696
13697
13698 : see whether the various POSIXish _yields exist
13699 $cat >try.c <<EOP
13700 #include <pthread.h>
13701 #include <stdio.h>
13702 int main() {
13703 #ifdef SCHED_YIELD
13704         sched_yield();
13705 #else
13706 #ifdef PTHREAD_YIELD
13707         pthread_yield();
13708 #else
13709 #ifdef PTHREAD_YIELD_NULL
13710         pthread_yield(NULL);
13711 #endif
13712 #endif
13713 #endif
13714 }
13715 EOP
13716 : see if sched_yield exists
13717 set try -DSCHED_YIELD
13718 if eval $compile; then
13719     val="$define"
13720     sched_yield='sched_yield()'
13721 else
13722     val="$undef"
13723 fi
13724 case "$usethreads" in
13725 $define)
13726         case "$val" in
13727         $define) echo 'sched_yield() found.' >&4        ;;
13728         *)       echo 'sched_yield() NOT found.' >&4    ;;
13729         esac
13730 esac
13731 set d_sched_yield
13732 eval $setvar
13733
13734 : see if pthread_yield exists
13735 set try -DPTHREAD_YIELD
13736 if eval $compile; then
13737     val="$define"
13738     case "$sched_yield" in
13739     '') sched_yield='pthread_yield()' ;;
13740     esac
13741 else
13742     set try -DPTHREAD_YIELD_NULL
13743     if eval $compile; then
13744         val="$define"
13745         case "$sched_yield" in
13746         '') sched_yield='pthread_yield(NULL)' ;;
13747         esac
13748     else
13749         val="$undef"
13750     fi
13751 fi
13752 case "$usethreads" in
13753 $define)
13754         case "$val" in
13755         $define) echo 'pthread_yield() found.' >&4      ;;
13756         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13757         esac
13758         ;;
13759 esac
13760 set d_pthread_yield
13761 eval $setvar
13762
13763 case "$sched_yield" in
13764 '') sched_yield=undef ;;
13765 esac
13766
13767 $rm -f try try.*
13768
13769 : see if random_r exists
13770 set random_r d_random_r
13771 eval $inlibc
13772 case "$d_random_r" in
13773 "$define")
13774         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13775         case "$d_random_r_proto:$usethreads" in
13776         ":define")      d_random_r_proto=define
13777                 set d_random_r_proto random_r $hdrs
13778                 eval $hasproto ;;
13779         *)      ;;
13780         esac
13781         case "$d_random_r_proto" in
13782         define)
13783         case "$random_r_proto" in
13784         ''|0) try='int random_r(int*, struct random_data*);'
13785         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13786         esac
13787         case "$random_r_proto" in
13788         '')     d_random_r=undef
13789                 random_r_proto=0
13790                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13791         * )     case "$random_r_proto" in
13792                 REENTRANT_PROTO*) ;;
13793                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13794                 esac
13795                 echo "Prototype: $try" ;;
13796         esac
13797         ;;
13798         *)      case "$usethreads" in
13799                 define) echo "random_r has no prototype, not using it." >&4 ;;
13800                 esac
13801                 ;;
13802         esac
13803         ;;
13804 *)      random_r_proto=0
13805         ;;
13806 esac
13807
13808 : see if readdir and friends exist
13809 set readdir d_readdir
13810 eval $inlibc
13811 set seekdir d_seekdir
13812 eval $inlibc
13813 set telldir d_telldir
13814 eval $inlibc
13815 set rewinddir d_rewinddir
13816 eval $inlibc
13817
13818 : see if readdir64_r exists
13819 set readdir64_r d_readdir64_r
13820 eval $inlibc
13821 case "$d_readdir64_r" in
13822 "$define")
13823         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13824         case "$d_readdir64_r_proto:$usethreads" in
13825         ":define")      d_readdir64_r_proto=define
13826                 set d_readdir64_r_proto readdir64_r $hdrs
13827                 eval $hasproto ;;
13828         *)      ;;
13829         esac
13830         case "$d_readdir64_r_proto" in
13831         define)
13832         case "$readdir64_r_proto" in
13833         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13834         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13835         esac
13836         case "$readdir64_r_proto" in
13837         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13838         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13839         esac
13840         case "$readdir64_r_proto" in
13841         '')     d_readdir64_r=undef
13842                 readdir64_r_proto=0
13843                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13844         * )     case "$readdir64_r_proto" in
13845                 REENTRANT_PROTO*) ;;
13846                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13847                 esac
13848                 echo "Prototype: $try" ;;
13849         esac
13850         ;;
13851         *)      case "$usethreads" in
13852                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13853                 esac
13854                 ;;
13855         esac
13856         ;;
13857 *)      readdir64_r_proto=0
13858         ;;
13859 esac
13860
13861 : see if readdir_r exists
13862 set readdir_r d_readdir_r
13863 eval $inlibc
13864 case "$d_readdir_r" in
13865 "$define")
13866         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13867         case "$d_readdir_r_proto:$usethreads" in
13868         ":define")      d_readdir_r_proto=define
13869                 set d_readdir_r_proto readdir_r $hdrs
13870                 eval $hasproto ;;
13871         *)      ;;
13872         esac
13873         case "$d_readdir_r_proto" in
13874         define)
13875         case "$readdir_r_proto" in
13876         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13877         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13878         esac
13879         case "$readdir_r_proto" in
13880         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13881         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13882         esac
13883         case "$readdir_r_proto" in
13884         '')     d_readdir_r=undef
13885                 readdir_r_proto=0
13886                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13887         * )     case "$readdir_r_proto" in
13888                 REENTRANT_PROTO*) ;;
13889                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13890                 esac
13891                 echo "Prototype: $try" ;;
13892         esac
13893         ;;
13894         *)      case "$usethreads" in
13895                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13896                 esac
13897                 ;;
13898         esac
13899         ;;
13900 *)      readdir_r_proto=0
13901         ;;
13902 esac
13903
13904 : see if readv exists
13905 set readv d_readv
13906 eval $inlibc
13907
13908 : see if recvmsg exists
13909 set recvmsg d_recvmsg
13910 eval $inlibc
13911
13912 : see if rename exists
13913 set rename d_rename
13914 eval $inlibc
13915
13916 : see if rmdir exists
13917 set rmdir d_rmdir
13918 eval $inlibc
13919
13920 : see if memory.h is available.
13921 val=''
13922 set memory.h val
13923 eval $inhdr
13924
13925 : See if it conflicts with string.h
13926 case "$val" in
13927 $define)
13928         case "$strings" in
13929         '') ;;
13930         *)
13931                 $cppstdin $cppflags $cppminus < $strings > mem.h
13932                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13933                         echo " "
13934                         echo "We won't be including <memory.h>."
13935                         val="$undef"
13936                 fi
13937                 $rm -f mem.h
13938                 ;;
13939         esac
13940 esac
13941 set i_memory
13942 eval $setvar
13943
13944 : can bcopy handle overlapping blocks?
13945 echo " "
13946 val="$undef"
13947 case "$d_memmove" in
13948 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
13949 *)      case "$d_bcopy" in
13950         "$define")
13951                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
13952                 $cat >try.c <<EOCP
13953 #$i_memory I_MEMORY
13954 #$i_stdlib I_STDLIB
13955 #$i_string I_STRING
13956 #$i_unistd I_UNISTD
13957 EOCP
13958         $cat >>try.c <<'EOCP'
13959 #include <stdio.h>
13960 #ifdef I_MEMORY
13961 #  include <memory.h>
13962 #endif
13963 #ifdef I_STDLIB
13964 #  include <stdlib.h>
13965 #endif
13966 #ifdef I_STRING
13967 #  include <string.h>
13968 #else
13969 #  include <strings.h>
13970 #endif
13971 #ifdef I_UNISTD
13972 #  include <unistd.h>  /* Needed for NetBSD */
13973 #endif
13974 int main()
13975 {
13976 char buf[128], abc[128];
13977 char *b;
13978 int len;
13979 int off;
13980 int align;
13981
13982 /* Copy "abcde..." string to char abc[] so that gcc doesn't
13983    try to store the string in read-only memory. */
13984 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
13985
13986 for (align = 7; align >= 0; align--) {
13987         for (len = 36; len; len--) {
13988                 b = buf+align;
13989                 bcopy(abc, b, len);
13990                 for (off = 1; off <= len; off++) {
13991                         bcopy(b, b+off, len);
13992                         bcopy(b+off, b, len);
13993                         if (bcmp(b, abc, len))
13994                                 exit(1);
13995                 }
13996         }
13997 }
13998 exit(0);
13999 }
14000 EOCP
14001                 set try
14002                 if eval $compile_ok; then
14003                         if ./try 2>/dev/null; then
14004                                 echo "Yes, it can."
14005                                 val="$define"
14006                         else
14007                                 echo "It can't, sorry."
14008                         fi
14009                 else
14010                         echo "(I can't compile the test program, so we'll assume not...)"
14011                 fi
14012                 ;;
14013         esac
14014         $rm -f try.* try core
14015         ;;
14016 esac
14017 set d_safebcpy
14018 eval $setvar
14019
14020 : can memcpy handle overlapping blocks?
14021 echo " "
14022 val="$undef"
14023 case "$d_memmove" in
14024 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14025 *)      case "$d_memcpy" in
14026         "$define")
14027                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14028                 $cat >try.c <<EOCP
14029 #$i_memory I_MEMORY
14030 #$i_stdlib I_STDLIB
14031 #$i_string I_STRING
14032 #$i_unistd I_UNISTD
14033 EOCP
14034         $cat >>try.c <<'EOCP'
14035 #include <stdio.h>
14036 #ifdef I_MEMORY
14037 #  include <memory.h>
14038 #endif
14039 #ifdef I_STDLIB
14040 #  include <stdlib.h>
14041 #endif
14042 #ifdef I_STRING
14043 #  include <string.h>
14044 #else
14045 #  include <strings.h>
14046 #endif
14047 #ifdef I_UNISTD
14048 #  include <unistd.h>  /* Needed for NetBSD */
14049 #endif
14050 int main()
14051 {
14052 char buf[128], abc[128];
14053 char *b;
14054 int len;
14055 int off;
14056 int align;
14057
14058 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14059    try to store the string in read-only memory. */
14060 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14061
14062 for (align = 7; align >= 0; align--) {
14063         for (len = 36; len; len--) {
14064                 b = buf+align;
14065                 memcpy(b, abc, len);
14066                 for (off = 1; off <= len; off++) {
14067                         memcpy(b+off, b, len);
14068                         memcpy(b, b+off, len);
14069                         if (memcmp(b, abc, len))
14070                                 exit(1);
14071                 }
14072         }
14073 }
14074 exit(0);
14075 }
14076 EOCP
14077                 set try
14078                 if eval $compile_ok; then
14079                         if ./try 2>/dev/null; then
14080                                 echo "Yes, it can."
14081                                 val="$define"
14082                         else
14083                                 echo "It can't, sorry."
14084                         fi
14085                 else
14086                         echo "(I can't compile the test program, so we'll assume not...)"
14087                 fi
14088                 ;;
14089         esac
14090         $rm -f try.* try core
14091         ;;
14092 esac
14093 set d_safemcpy
14094 eval $setvar
14095
14096 : can memcmp be trusted to compare relative magnitude?
14097 val="$undef"
14098 case "$d_memcmp" in
14099 "$define")
14100         echo " "
14101         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14102         $cat >try.c <<EOCP
14103 #$i_memory I_MEMORY
14104 #$i_stdlib I_STDLIB
14105 #$i_string I_STRING
14106 #$i_unistd I_UNISTD
14107 EOCP
14108         $cat >>try.c <<'EOCP'
14109 #include <stdio.h>
14110 #ifdef I_MEMORY
14111 #  include <memory.h>
14112 #endif
14113 #ifdef I_STDLIB
14114 #  include <stdlib.h>
14115 #endif
14116 #ifdef I_STRING
14117 #  include <string.h>
14118 #else
14119 #  include <strings.h>
14120 #endif
14121 #ifdef I_UNISTD
14122 #  include <unistd.h>  /* Needed for NetBSD */
14123 #endif
14124 int main()
14125 {
14126 char a = -1;
14127 char b = 0;
14128 if ((a < b) && memcmp(&a, &b, 1) < 0)
14129         exit(1);
14130 exit(0);
14131 }
14132 EOCP
14133         set try
14134         if eval $compile_ok; then
14135                 if $run ./try 2>/dev/null; then
14136                         echo "Yes, it can."
14137                         val="$define"
14138                 else
14139                         echo "No, it can't (it uses signed chars)."
14140                 fi
14141         else
14142                 echo "(I can't compile the test program, so we'll assume not...)"
14143         fi
14144         ;;
14145 esac
14146 $rm -f try.* try core
14147 set d_sanemcmp
14148 eval $setvar
14149
14150 : see if prototype for sbrk is available
14151 echo " "
14152 set d_sbrkproto sbrk $i_unistd unistd.h
14153 eval $hasproto
14154
14155 : see if select exists
14156 set select d_select
14157 eval $inlibc
14158
14159 : see if semctl exists
14160 set semctl d_semctl
14161 eval $inlibc
14162
14163 : see if semget exists
14164 set semget d_semget
14165 eval $inlibc
14166
14167 : see if semop exists
14168 set semop d_semop
14169 eval $inlibc
14170
14171 : see how much of the 'sem*(2)' library is present.
14172 h_sem=true
14173 echo " "
14174 case "$d_semctl$d_semget$d_semop" in
14175 *"$undef"*) h_sem=false;;
14176 esac
14177 case "$osname" in
14178 freebsd)
14179     case "`ipcs 2>&1`" in
14180     "SVID messages"*"not configured"*)
14181         echo "Your $osname does not have the sem*(2) configured." >&4
14182         h_sem=false
14183         val="$undef"
14184         set semctl d_semctl
14185         eval $setvar
14186         set semget d_semget
14187         eval $setvar
14188         set semop d_semop
14189         eval $setvar
14190         ;;
14191     esac
14192     ;;
14193 esac
14194 : we could also check for sys/ipc.h ...
14195 if $h_sem && $test `./findhdr sys/sem.h`; then
14196         echo "You have the full sem*(2) library." >&4
14197         val="$define"
14198 else
14199         echo "You don't have the full sem*(2) library." >&4
14200         val="$undef"
14201 fi
14202 set d_sem
14203 eval $setvar
14204
14205 : see whether sys/sem.h defines union semun
14206 echo " "
14207 $cat > try.c <<'END'
14208 #include <sys/types.h>
14209 #include <sys/ipc.h>
14210 #include <sys/sem.h>
14211 int main () { union semun semun; semun.buf = 0; }
14212 END
14213 set try
14214 if eval $compile; then
14215     echo "You have union semun in <sys/sem.h>." >&4
14216     val="$define"
14217 else
14218     echo "You do not have union semun in <sys/sem.h>." >&4
14219     val="$undef"
14220 fi
14221 $rm -f try try.c try.h
14222 set d_union_semun
14223 eval $setvar
14224
14225 : see how to do semctl IPC_STAT
14226 case "$d_sem" in
14227 $define)
14228     : see whether semctl IPC_STAT can use union semun
14229     echo " "
14230     $cat > try.h <<END
14231 #ifndef S_IRUSR
14232 #   ifdef S_IREAD
14233 #       define S_IRUSR S_IREAD
14234 #       define S_IWUSR S_IWRITE
14235 #       define S_IXUSR S_IEXEC
14236 #   else
14237 #       define S_IRUSR 0400
14238 #       define S_IWUSR 0200
14239 #       define S_IXUSR 0100
14240 #   endif
14241 #   define S_IRGRP (S_IRUSR>>3)
14242 #   define S_IWGRP (S_IWUSR>>3)
14243 #   define S_IXGRP (S_IXUSR>>3)
14244 #   define S_IROTH (S_IRUSR>>6)
14245 #   define S_IWOTH (S_IWUSR>>6)
14246 #   define S_IXOTH (S_IXUSR>>6)
14247 #endif
14248 #ifndef S_IRWXU
14249 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14250 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14251 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14252 #endif
14253 END
14254
14255     $cat > try.c <<END
14256 #include <sys/types.h>
14257 #include <sys/ipc.h>
14258 #include <sys/sem.h>
14259 #include <sys/stat.h>
14260 #include <stdio.h>
14261 #include <errno.h>
14262 #include "try.h"
14263 #ifndef errno
14264 extern int errno;
14265 #endif
14266 #$d_union_semun HAS_UNION_SEMUN
14267 int main() {
14268     union semun
14269 #ifndef HAS_UNION_SEMUN
14270     {
14271         int val;
14272         struct semid_ds *buf;
14273         unsigned short *array;
14274     }
14275 #endif
14276     arg;
14277     int sem, st;
14278
14279 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14280     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14281     if (sem > -1) {
14282         struct semid_ds argbuf;
14283         arg.buf = &argbuf;
14284 #       ifdef IPC_STAT
14285         st = semctl(sem, 0, IPC_STAT, arg);
14286         if (st == 0)
14287             printf("semun\n");
14288         else
14289 #       endif /* IPC_STAT */
14290             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14291 #       ifdef IPC_RMID
14292         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14293 #       endif /* IPC_RMID */
14294             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14295     } else
14296 #endif /* IPC_PRIVATE && ... */
14297         printf("semget failed: errno = %d\n", errno);
14298   return 0;
14299 }
14300 END
14301     val="$undef"
14302     set try
14303     if eval $compile; then
14304         xxx=`$run ./try`
14305         case "$xxx" in
14306         semun) val="$define" ;;
14307         esac
14308     fi
14309     $rm -f try try.c
14310     set d_semctl_semun
14311     eval $setvar
14312     case "$d_semctl_semun" in
14313     $define)
14314         echo "You can use union semun for semctl IPC_STAT." >&4
14315         also='also'
14316         ;;
14317     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14318         also=''
14319         ;;
14320     esac
14321
14322     : see whether semctl IPC_STAT can use struct semid_ds pointer
14323     $cat > try.c <<'END'
14324 #include <sys/types.h>
14325 #include <sys/ipc.h>
14326 #include <sys/sem.h>
14327 #include <sys/stat.h>
14328 #include "try.h"
14329 #include <stdio.h>
14330 #include <errno.h>
14331 #ifndef errno
14332 extern int errno;
14333 #endif
14334 int main() {
14335     struct semid_ds arg;
14336     int sem, st;
14337
14338 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14339     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14340     if (sem > -1) {
14341 #       ifdef IPC_STAT
14342         st = semctl(sem, 0, IPC_STAT, &arg);
14343         if (st == 0)
14344             printf("semid_ds\n");
14345         else
14346 #       endif /* IPC_STAT */
14347             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14348 #       ifdef IPC_RMID
14349         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14350 #       endif /* IPC_RMID */
14351             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14352     } else
14353 #endif /* IPC_PRIVATE && ... */
14354         printf("semget failed: errno = %d\n", errno);
14355
14356     return 0;
14357 }
14358 END
14359     val="$undef"
14360     set try
14361     if eval $compile; then
14362         xxx=`$run ./try`
14363         case "$xxx" in
14364         semid_ds) val="$define" ;;
14365         esac
14366     fi
14367     $rm -f try try.c
14368     set d_semctl_semid_ds
14369     eval $setvar
14370     case "$d_semctl_semid_ds" in
14371     $define)
14372         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14373         ;;
14374     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14375         ;;
14376     esac
14377     $rm -f try.h
14378     ;;
14379 *)  val="$undef"
14380
14381     # We do not have the full sem*(2) library, so assume we can not
14382     # use either.
14383
14384     set d_semctl_semun
14385     eval $setvar
14386
14387     set d_semctl_semid_ds
14388     eval $setvar
14389     ;;
14390 esac
14391
14392 : see if sendmsg exists
14393 set sendmsg d_sendmsg
14394 eval $inlibc
14395
14396 : see if setegid exists
14397 set setegid d_setegid
14398 eval $inlibc
14399
14400 : see if seteuid exists
14401 set seteuid d_seteuid
14402 eval $inlibc
14403
14404 : see if setgrent exists
14405 set setgrent d_setgrent
14406 eval $inlibc
14407
14408 : see if setgrent_r exists
14409 set setgrent_r d_setgrent_r
14410 eval $inlibc
14411 case "$d_setgrent_r" in
14412 "$define")
14413         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14414         case "$d_setgrent_r_proto:$usethreads" in
14415         ":define")      d_setgrent_r_proto=define
14416                 set d_setgrent_r_proto setgrent_r $hdrs
14417                 eval $hasproto ;;
14418         *)      ;;
14419         esac
14420         case "$d_setgrent_r_proto" in
14421         define)
14422         case "$setgrent_r_proto" in
14423         ''|0) try='int setgrent_r(FILE**);'
14424         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14425         esac
14426         case "$setgrent_r_proto" in
14427         ''|0) try='void setgrent_r(FILE**);'
14428         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14429         esac
14430         case "$setgrent_r_proto" in
14431         '')     d_setgrent_r=undef
14432                 setgrent_r_proto=0
14433                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14434         * )     case "$setgrent_r_proto" in
14435                 REENTRANT_PROTO*) ;;
14436                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14437                 esac
14438                 echo "Prototype: $try" ;;
14439         esac
14440         ;;
14441         *)      case "$usethreads" in
14442                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14443                 esac
14444                 ;;
14445         esac
14446         ;;
14447 *)      setgrent_r_proto=0
14448         ;;
14449 esac
14450
14451 : see if sethostent exists
14452 set sethostent d_sethent
14453 eval $inlibc
14454
14455 : see if sethostent_r exists
14456 set sethostent_r d_sethostent_r
14457 eval $inlibc
14458 case "$d_sethostent_r" in
14459 "$define")
14460         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14461         case "$d_sethostent_r_proto:$usethreads" in
14462         ":define")      d_sethostent_r_proto=define
14463                 set d_sethostent_r_proto sethostent_r $hdrs
14464                 eval $hasproto ;;
14465         *)      ;;
14466         esac
14467         case "$d_sethostent_r_proto" in
14468         define)
14469         case "$sethostent_r_proto" in
14470         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14471         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14472         esac
14473         case "$sethostent_r_proto" in
14474         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14475         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14476         esac
14477         case "$sethostent_r_proto" in
14478         '')     d_sethostent_r=undef
14479                 sethostent_r_proto=0
14480                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14481         * )     case "$sethostent_r_proto" in
14482                 REENTRANT_PROTO*) ;;
14483                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14484                 esac
14485                 echo "Prototype: $try" ;;
14486         esac
14487         ;;
14488         *)      case "$usethreads" in
14489                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14490                 esac
14491                 ;;
14492         esac
14493         ;;
14494 *)      sethostent_r_proto=0
14495         ;;
14496 esac
14497
14498 : see if setitimer exists
14499 set setitimer d_setitimer
14500 eval $inlibc
14501
14502 : see if setlinebuf exists
14503 set setlinebuf d_setlinebuf
14504 eval $inlibc
14505
14506 : see if setlocale exists
14507 set setlocale d_setlocale
14508 eval $inlibc
14509
14510 : see if locale.h is available
14511 set locale.h i_locale
14512 eval $inhdr
14513
14514 : see if setlocale_r exists
14515 set setlocale_r d_setlocale_r
14516 eval $inlibc
14517 case "$d_setlocale_r" in
14518 "$define")
14519         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14520         case "$d_setlocale_r_proto:$usethreads" in
14521         ":define")      d_setlocale_r_proto=define
14522                 set d_setlocale_r_proto setlocale_r $hdrs
14523                 eval $hasproto ;;
14524         *)      ;;
14525         esac
14526         case "$d_setlocale_r_proto" in
14527         define)
14528         case "$setlocale_r_proto" in
14529         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14530         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14531         esac
14532         case "$setlocale_r_proto" in
14533         '')     d_setlocale_r=undef
14534                 setlocale_r_proto=0
14535                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14536         * )     case "$setlocale_r_proto" in
14537                 REENTRANT_PROTO*) ;;
14538                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14539                 esac
14540                 echo "Prototype: $try" ;;
14541         esac
14542         ;;
14543         *)      case "$usethreads" in
14544                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14545                 esac
14546                 ;;
14547         esac
14548         ;;
14549 *)      setlocale_r_proto=0
14550         ;;
14551 esac
14552
14553 : see if setnetent exists
14554 set setnetent d_setnent
14555 eval $inlibc
14556
14557 : see if setnetent_r exists
14558 set setnetent_r d_setnetent_r
14559 eval $inlibc
14560 case "$d_setnetent_r" in
14561 "$define")
14562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14563         case "$d_setnetent_r_proto:$usethreads" in
14564         ":define")      d_setnetent_r_proto=define
14565                 set d_setnetent_r_proto setnetent_r $hdrs
14566                 eval $hasproto ;;
14567         *)      ;;
14568         esac
14569         case "$d_setnetent_r_proto" in
14570         define)
14571         case "$setnetent_r_proto" in
14572         ''|0) try='int setnetent_r(int, struct netent_data*);'
14573         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14574         esac
14575         case "$setnetent_r_proto" in
14576         ''|0) try='void setnetent_r(int, struct netent_data*);'
14577         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14578         esac
14579         case "$setnetent_r_proto" in
14580         '')     d_setnetent_r=undef
14581                 setnetent_r_proto=0
14582                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14583         * )     case "$setnetent_r_proto" in
14584                 REENTRANT_PROTO*) ;;
14585                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14586                 esac
14587                 echo "Prototype: $try" ;;
14588         esac
14589         ;;
14590         *)      case "$usethreads" in
14591                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14592                 esac
14593                 ;;
14594         esac
14595         ;;
14596 *)      setnetent_r_proto=0
14597         ;;
14598 esac
14599
14600 : see if setprotoent exists
14601 set setprotoent d_setpent
14602 eval $inlibc
14603
14604 : see if setpgid exists
14605 set setpgid d_setpgid
14606 eval $inlibc
14607
14608 : see if setpgrp2 exists
14609 set setpgrp2 d_setpgrp2
14610 eval $inlibc
14611
14612 : see if setpriority exists
14613 set setpriority d_setprior
14614 eval $inlibc
14615
14616 : see if setproctitle exists
14617 set setproctitle d_setproctitle
14618 eval $inlibc
14619
14620 : see if setprotoent_r exists
14621 set setprotoent_r d_setprotoent_r
14622 eval $inlibc
14623 case "$d_setprotoent_r" in
14624 "$define")
14625         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14626         case "$d_setprotoent_r_proto:$usethreads" in
14627         ":define")      d_setprotoent_r_proto=define
14628                 set d_setprotoent_r_proto setprotoent_r $hdrs
14629                 eval $hasproto ;;
14630         *)      ;;
14631         esac
14632         case "$d_setprotoent_r_proto" in
14633         define)
14634         case "$setprotoent_r_proto" in
14635         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14636         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14637         esac
14638         case "$setprotoent_r_proto" in
14639         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14640         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14641         esac
14642         case "$setprotoent_r_proto" in
14643         '')     d_setprotoent_r=undef
14644                 setprotoent_r_proto=0
14645                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14646         * )     case "$setprotoent_r_proto" in
14647                 REENTRANT_PROTO*) ;;
14648                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14649                 esac
14650                 echo "Prototype: $try" ;;
14651         esac
14652         ;;
14653         *)      case "$usethreads" in
14654                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14655                 esac
14656                 ;;
14657         esac
14658         ;;
14659 *)      setprotoent_r_proto=0
14660         ;;
14661 esac
14662
14663 : see if setpwent exists
14664 set setpwent d_setpwent
14665 eval $inlibc
14666
14667 : see if setpwent_r exists
14668 set setpwent_r d_setpwent_r
14669 eval $inlibc
14670 case "$d_setpwent_r" in
14671 "$define")
14672         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14673         case "$d_setpwent_r_proto:$usethreads" in
14674         ":define")      d_setpwent_r_proto=define
14675                 set d_setpwent_r_proto setpwent_r $hdrs
14676                 eval $hasproto ;;
14677         *)      ;;
14678         esac
14679         case "$d_setpwent_r_proto" in
14680         define)
14681         case "$setpwent_r_proto" in
14682         ''|0) try='int setpwent_r(FILE**);'
14683         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14684         esac
14685         case "$setpwent_r_proto" in
14686         ''|0) try='void setpwent_r(FILE**);'
14687         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14688         esac
14689         case "$setpwent_r_proto" in
14690         '')     d_setpwent_r=undef
14691                 setpwent_r_proto=0
14692                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14693         * )     case "$setpwent_r_proto" in
14694                 REENTRANT_PROTO*) ;;
14695                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14696                 esac
14697                 echo "Prototype: $try" ;;
14698         esac
14699         ;;
14700         *)      case "$usethreads" in
14701                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14702                 esac
14703                 ;;
14704         esac
14705         ;;
14706 *)      setpwent_r_proto=0
14707         ;;
14708 esac
14709
14710 : see if setregid exists
14711 set setregid d_setregid
14712 eval $inlibc
14713 set setresgid d_setresgid
14714 eval $inlibc
14715
14716 : see if setreuid exists
14717 set setreuid d_setreuid
14718 eval $inlibc
14719 set setresuid d_setresuid
14720 eval $inlibc
14721
14722 : see if setrgid exists
14723 set setrgid d_setrgid
14724 eval $inlibc
14725
14726 : see if setruid exists
14727 set setruid d_setruid
14728 eval $inlibc
14729
14730 : see if setservent exists
14731 set setservent d_setsent
14732 eval $inlibc
14733
14734 : see if setservent_r exists
14735 set setservent_r d_setservent_r
14736 eval $inlibc
14737 case "$d_setservent_r" in
14738 "$define")
14739         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14740         case "$d_setservent_r_proto:$usethreads" in
14741         ":define")      d_setservent_r_proto=define
14742                 set d_setservent_r_proto setservent_r $hdrs
14743                 eval $hasproto ;;
14744         *)      ;;
14745         esac
14746         case "$d_setservent_r_proto" in
14747         define)
14748         case "$setservent_r_proto" in
14749         ''|0) try='int setservent_r(int, struct servent_data*);'
14750         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14751         esac
14752         case "$setservent_r_proto" in
14753         ''|0) try='void setservent_r(int, struct servent_data*);'
14754         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14755         esac
14756         case "$setservent_r_proto" in
14757         '')     d_setservent_r=undef
14758                 setservent_r_proto=0
14759                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14760         * )     case "$setservent_r_proto" in
14761                 REENTRANT_PROTO*) ;;
14762                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14763                 esac
14764                 echo "Prototype: $try" ;;
14765         esac
14766         ;;
14767         *)      case "$usethreads" in
14768                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14769                 esac
14770                 ;;
14771         esac
14772         ;;
14773 *)      setservent_r_proto=0
14774         ;;
14775 esac
14776
14777 : see if setsid exists
14778 set setsid d_setsid
14779 eval $inlibc
14780
14781 : see if setvbuf exists
14782 set setvbuf d_setvbuf
14783 eval $inlibc
14784
14785 : see if sfio.h is available
14786 set sfio.h i_sfio
14787 eval $inhdr
14788
14789
14790 : see if sfio library is available
14791 case "$i_sfio" in
14792 $define)
14793         val=''
14794         set sfreserve val
14795         eval $inlibc
14796         ;;
14797 *)
14798         val="$undef"
14799         ;;
14800 esac
14801 : Ok, but do we want to use it.
14802 case "$val" in
14803 $define)
14804         case "$usesfio" in
14805         true|$define|[yY]*) dflt='y';;
14806         *) dflt='n';;
14807         esac
14808         echo "$package can use the sfio library, but it is experimental."
14809         case "$useperlio" in
14810         "$undef")
14811             echo "For sfio also the PerlIO abstraction layer is needed."
14812             echo "Earlier you said you wouldn't want that."
14813             ;;
14814         esac
14815         rp="You seem to have sfio available, do you want to try using it?"
14816         . ./myread
14817         case "$ans" in
14818         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14819                 useperlio="$define"
14820                 val="$define"
14821                 ;;
14822         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14823                 val="$undef"
14824                 ;;
14825         esac
14826         ;;
14827 *)      case "$usesfio" in
14828         true|$define|[yY]*)
14829                 echo "Sorry, cannot find sfio on this machine." >&4
14830                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14831                 val="$undef"
14832                 ;;
14833         esac
14834         ;;
14835 esac
14836 set d_sfio
14837 eval $setvar
14838 case "$d_sfio" in
14839 $define) usesfio='true';;
14840 *) usesfio='false';;
14841 esac
14842 case "$d_sfio" in
14843 $define) ;;
14844 *)      : Remove sfio from list of libraries to use
14845         case "$libs" in
14846         *-lsfio*)
14847                 echo "Removing unneeded -lsfio from library list" >&4
14848                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14849                 shift
14850                 libs="$*"
14851                 echo "libs = $libs" >&4
14852                 ;;
14853         esac
14854 ;;
14855 esac
14856
14857
14858 : see if shmctl exists
14859 set shmctl d_shmctl
14860 eval $inlibc
14861
14862 : see if shmget exists
14863 set shmget d_shmget
14864 eval $inlibc
14865
14866 : see if shmat exists
14867 set shmat d_shmat
14868 eval $inlibc
14869 : see what shmat returns
14870 case "$d_shmat" in
14871 "$define")
14872         $cat >shmat.c <<'END'
14873 #include <sys/shm.h>
14874 void *shmat();
14875 END
14876         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14877                 shmattype='void *'
14878         else
14879                 shmattype='char *'
14880         fi
14881         echo "and it returns ($shmattype)." >&4
14882         : see if a prototype for shmat is available
14883         xxx=`./findhdr sys/shm.h`
14884         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14885         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14886                 val="$define"
14887         else
14888                 val="$undef"
14889         fi
14890         $rm -f shmat.[co]
14891         ;;
14892 *)
14893         val="$undef"
14894         ;;
14895 esac
14896 set d_shmatprototype
14897 eval $setvar
14898
14899 : see if shmdt exists
14900 set shmdt d_shmdt
14901 eval $inlibc
14902
14903 : see how much of the 'shm*(2)' library is present.
14904 h_shm=true
14905 echo " "
14906 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14907 *"$undef"*) h_shm=false;;
14908 esac
14909 case "$osname" in
14910 freebsd)
14911     case "`ipcs 2>&1`" in
14912     "SVID shared memory"*"not configured"*)
14913         echo "Your $osname does not have the shm*(2) configured." >&4
14914         h_shm=false
14915         val="$undef"
14916         set shmctl d_shmctl
14917         evat $setvar
14918         set shmget d_shmget
14919         evat $setvar
14920         set shmat d_shmat
14921         evat $setvar
14922         set shmdt d_shmdt
14923         evat $setvar
14924         ;;
14925     esac
14926     ;;
14927 esac
14928 : we could also check for sys/ipc.h ...
14929 if $h_shm && $test `./findhdr sys/shm.h`; then
14930         echo "You have the full shm*(2) library." >&4
14931         val="$define"
14932 else
14933         echo "You don't have the full shm*(2) library." >&4
14934         val="$undef"
14935 fi
14936 set d_shm
14937 eval $setvar
14938
14939 echo " "
14940 : see if we have sigaction
14941 if set sigaction val -f d_sigaction; eval $csym; $val; then
14942         echo 'sigaction() found.' >&4
14943         $cat > try.c <<'EOP'
14944 #include <stdio.h>
14945 #include <sys/types.h>
14946 #include <signal.h>
14947 int main()
14948 {
14949     struct sigaction act, oact;
14950     act.sa_flags = 0;
14951     oact.sa_handler = 0;
14952     /* so that act and oact are used */
14953     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
14954 }
14955 EOP
14956         set try
14957         if eval $compile_ok; then
14958                 val="$define"
14959         else
14960                 echo "But you don't seem to have a useable struct sigaction." >&4
14961                 val="$undef"
14962         fi
14963 else
14964         echo 'sigaction NOT found.' >&4
14965         val="$undef"
14966 fi
14967 set d_sigaction; eval $setvar
14968 $rm -f try try$_o try.c
14969
14970 : see if sigprocmask exists
14971 set sigprocmask d_sigprocmask
14972 eval $inlibc
14973
14974 : see if sigsetjmp exists
14975 echo " "
14976 case "$d_sigsetjmp" in
14977 '')
14978         $cat >try.c <<'EOP'
14979 #include <setjmp.h>
14980 sigjmp_buf env;
14981 int set = 1;
14982 int main()
14983 {
14984         if (sigsetjmp(env,1))
14985                 exit(set);
14986         set = 0;
14987         siglongjmp(env, 1);
14988         exit(1);
14989 }
14990 EOP
14991         set try
14992         if eval $compile; then
14993                 if $run ./try >/dev/null 2>&1; then
14994                         echo "POSIX sigsetjmp found." >&4
14995                         val="$define"
14996                 else
14997                         $cat >&4 <<EOM
14998 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
14999 I'll ignore them.
15000 EOM
15001                         val="$undef"
15002                 fi
15003         else
15004                 echo "sigsetjmp not found." >&4
15005                 val="$undef"
15006         fi
15007         ;;
15008 *) val="$d_sigsetjmp"
15009         case "$d_sigsetjmp" in
15010         $define) echo "POSIX sigsetjmp found." >&4;;
15011         $undef) echo "sigsetjmp not found." >&4;;
15012         esac
15013         ;;
15014 esac
15015 set d_sigsetjmp
15016 eval $setvar
15017 $rm -f try.c try
15018
15019 : see if sockatmark exists
15020 set sockatmark d_sockatmark
15021 eval $inlibc
15022
15023 : see if prototype for sockatmark is available
15024 echo " "
15025 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15026 eval $hasproto
15027
15028 : see if socks5_init exists
15029 set socks5_init d_socks5_init
15030 eval $inlibc
15031
15032 : see if srand48_r exists
15033 set srand48_r d_srand48_r
15034 eval $inlibc
15035 case "$d_srand48_r" in
15036 "$define")
15037         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15038         case "$d_srand48_r_proto:$usethreads" in
15039         ":define")      d_srand48_r_proto=define
15040                 set d_srand48_r_proto srand48_r $hdrs
15041                 eval $hasproto ;;
15042         *)      ;;
15043         esac
15044         case "$d_srand48_r_proto" in
15045         define)
15046         case "$srand48_r_proto" in
15047         ''|0) try='int srand48_r(long, struct drand48_data*);'
15048         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15049         esac
15050         case "$srand48_r_proto" in
15051         '')     d_srand48_r=undef
15052                 srand48_r_proto=0
15053                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15054         * )     case "$srand48_r_proto" in
15055                 REENTRANT_PROTO*) ;;
15056                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15057                 esac
15058                 echo "Prototype: $try" ;;
15059         esac
15060         ;;
15061         *)      case "$usethreads" in
15062                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15063                 esac
15064                 ;;
15065         esac
15066         ;;
15067 *)      srand48_r_proto=0
15068         ;;
15069 esac
15070
15071 : see if srandom_r exists
15072 set srandom_r d_srandom_r
15073 eval $inlibc
15074 case "$d_srandom_r" in
15075 "$define")
15076         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15077         case "$d_srandom_r_proto:$usethreads" in
15078         ":define")      d_srandom_r_proto=define
15079                 set d_srandom_r_proto srandom_r $hdrs
15080                 eval $hasproto ;;
15081         *)      ;;
15082         esac
15083         case "$d_srandom_r_proto" in
15084         define)
15085         case "$srandom_r_proto" in
15086         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15087         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15088         esac
15089         case "$srandom_r_proto" in
15090         '')     d_srandom_r=undef
15091                 srandom_r_proto=0
15092                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15093         * )     case "$srandom_r_proto" in
15094                 REENTRANT_PROTO*) ;;
15095                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15096                 esac
15097                 echo "Prototype: $try" ;;
15098         esac
15099         ;;
15100         *)      case "$usethreads" in
15101                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15102                 esac
15103                 ;;
15104         esac
15105         ;;
15106 *)      srandom_r_proto=0
15107         ;;
15108 esac
15109
15110 : see if prototype for setresgid is available
15111 echo " "
15112 set d_sresgproto setresgid $i_unistd unistd.h
15113 eval $hasproto
15114
15115 : see if prototype for setresuid is available
15116 echo " "
15117 set d_sresuproto setresuid $i_unistd unistd.h
15118 eval $hasproto
15119
15120 : see if sys/stat.h is available
15121 set sys/stat.h i_sysstat
15122 eval $inhdr
15123
15124
15125 : see if stat knows about block sizes
15126 echo " "
15127 echo "Checking to see if your struct stat has st_blocks field..." >&4
15128 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15129 eval $hasfield
15130
15131
15132 : see if this is a sys/vfs.h system
15133 set sys/vfs.h i_sysvfs
15134 eval $inhdr
15135
15136
15137 : see if this is a sys/statfs.h system
15138 set sys/statfs.h i_sysstatfs
15139 eval $inhdr
15140
15141
15142 echo " "
15143 echo "Checking to see if your system supports struct statfs..." >&4
15144 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
15145 eval $hasstruct
15146 case "$d_statfs_s" in
15147 "$define")      echo "Yes, it does."   ;;
15148 *)              echo "No, it doesn't." ;;
15149 esac
15150
15151
15152
15153 : see if struct statfs knows about f_flags
15154 case "$d_statfs_s" in
15155 define) 
15156         echo " "
15157         echo "Checking to see if your struct statfs has f_flags field..." >&4
15158         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
15159         eval $hasfield
15160         ;;
15161 *)      val="$undef"
15162         set d_statfs_f_flags
15163         eval $setvar
15164         ;;
15165 esac
15166 case "$d_statfs_f_flags" in
15167 "$define")      echo "Yes, it does."   ;;
15168 *)              echo "No, it doesn't." ;;
15169 esac
15170
15171 : see if _ptr and _cnt from stdio act std
15172 echo " "
15173
15174 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15175         echo "(Looks like you have stdio.h from BSD.)"
15176         case "$stdio_ptr" in
15177         '') stdio_ptr='((fp)->_p)'
15178                 ptr_lval=$define
15179                 ;;
15180         *)      ptr_lval=$d_stdio_ptr_lval;;
15181         esac
15182         case "$stdio_cnt" in
15183         '') stdio_cnt='((fp)->_r)'
15184                 cnt_lval=$define
15185                 ;;
15186         *)      cnt_lval=$d_stdio_cnt_lval;;
15187         esac
15188         case "$stdio_base" in
15189         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15190         esac
15191         case "$stdio_bufsiz" in
15192         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15193         esac
15194 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15195         echo "(Looks like you have stdio.h from Linux.)"
15196         case "$stdio_ptr" in
15197         '') stdio_ptr='((fp)->_IO_read_ptr)'
15198                 ptr_lval=$define
15199                 ;;
15200         *)      ptr_lval=$d_stdio_ptr_lval;;
15201         esac
15202         case "$stdio_cnt" in
15203         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15204                 cnt_lval=$undef
15205                 ;;
15206         *)      cnt_lval=$d_stdio_cnt_lval;;
15207         esac
15208         case "$stdio_base" in
15209         '') stdio_base='((fp)->_IO_read_base)';;
15210         esac
15211         case "$stdio_bufsiz" in
15212         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15213         esac
15214 else
15215         case "$stdio_ptr" in
15216         '') stdio_ptr='((fp)->_ptr)'
15217                 ptr_lval=$define
15218                 ;;
15219         *)      ptr_lval=$d_stdio_ptr_lval;;
15220         esac
15221         case "$stdio_cnt" in
15222         '') stdio_cnt='((fp)->_cnt)'
15223                 cnt_lval=$define
15224                 ;;
15225         *)      cnt_lval=$d_stdio_cnt_lval;;
15226         esac
15227         case "$stdio_base" in
15228         '') stdio_base='((fp)->_base)';;
15229         esac
15230         case "$stdio_bufsiz" in
15231         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15232         esac
15233 fi
15234
15235 : test whether _ptr and _cnt really work
15236 echo "Checking how std your stdio is..." >&4
15237 $cat >try.c <<EOP
15238 #include <stdio.h>
15239 #define FILE_ptr(fp)    $stdio_ptr
15240 #define FILE_cnt(fp)    $stdio_cnt
15241 int main() {
15242         FILE *fp = fopen("try.c", "r");
15243         char c = getc(fp);
15244         if (
15245                 18 <= FILE_cnt(fp) &&
15246                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15247         )
15248                 exit(0);
15249         exit(1);
15250 }
15251 EOP
15252 val="$undef"
15253 set try
15254 if eval $compile && $to try.c; then
15255         if $run ./try; then
15256                 echo "Your stdio acts pretty std."
15257                 val="$define"
15258         else
15259                 echo "Your stdio isn't very std."
15260         fi
15261 else
15262         echo "Your stdio doesn't appear very std."
15263 fi
15264 $rm -f try.c try
15265 set d_stdstdio
15266 eval $setvar
15267
15268 : Can _ptr be used as an lvalue?
15269 case "$d_stdstdio$ptr_lval" in
15270 $define$define) val=$define ;;
15271 *) val=$undef ;;
15272 esac
15273 set d_stdio_ptr_lval
15274 eval $setvar
15275
15276 : Can _cnt be used as an lvalue?
15277 case "$d_stdstdio$cnt_lval" in
15278 $define$define) val=$define ;;
15279 *) val=$undef ;;
15280 esac
15281 set d_stdio_cnt_lval
15282 eval $setvar
15283
15284
15285 : test whether setting _ptr sets _cnt as a side effect
15286 d_stdio_ptr_lval_sets_cnt="$undef"
15287 d_stdio_ptr_lval_nochange_cnt="$undef"
15288 case "$d_stdio_ptr_lval$d_stdstdio" in
15289 $define$define)
15290         echo "Checking to see what happens if we set the stdio ptr..." >&4
15291 $cat >try.c <<EOP
15292 #include <stdio.h>
15293 /* Can we scream? */
15294 /* Eat dust sed :-) */
15295 /* In the buffer space, no one can hear you scream. */
15296 #define FILE_ptr(fp)    $stdio_ptr
15297 #define FILE_cnt(fp)    $stdio_cnt
15298 #include <sys/types.h>
15299 int main() {
15300         FILE *fp = fopen("try.c", "r");
15301         int c;
15302         char *ptr;
15303         size_t cnt;
15304         if (!fp) {
15305             puts("Fail even to read");
15306             exit(1);
15307         }
15308         c = getc(fp); /* Read away the first # */
15309         if (c == EOF) {
15310             puts("Fail even to read");
15311             exit(1);
15312         }
15313         if (!(
15314                 18 <= FILE_cnt(fp) &&
15315                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15316         )) {
15317                 puts("Fail even to read");
15318                 exit (1);
15319         }
15320         ptr = (char*) FILE_ptr(fp);
15321         cnt = (size_t)FILE_cnt(fp);
15322
15323         FILE_ptr(fp) += 42;
15324
15325         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15326                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15327                 exit (1);
15328         }
15329         if (FILE_cnt(fp) <= 20) {
15330                 printf ("Fail (<20 chars to test)");
15331                 exit (1);
15332         }
15333         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15334                 puts("Fail compare");
15335                 exit (1);
15336         }
15337         if (cnt == FILE_cnt(fp)) {
15338                 puts("Pass_unchanged");
15339                 exit (0);
15340         }       
15341         if (FILE_cnt(fp) == (cnt - 42)) {
15342                 puts("Pass_changed");
15343                 exit (0);
15344         }
15345         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15346         return 1;
15347
15348 }
15349 EOP
15350         set try
15351         if eval $compile && $to try.c; then
15352                 case `$run ./try` in
15353                 Pass_changed)
15354                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15355                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15356                 Pass_unchanged)
15357                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15358                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15359                 Fail*)
15360                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15361                 *)
15362                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15363         esac
15364         else
15365                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15366         fi
15367         $rm -f try.c try
15368         ;;
15369 esac
15370
15371 : see if _base is also standard
15372 val="$undef"
15373 case "$d_stdstdio" in
15374 $define)
15375         $cat >try.c <<EOP
15376 #include <stdio.h>
15377 #define FILE_base(fp)   $stdio_base
15378 #define FILE_bufsiz(fp) $stdio_bufsiz
15379 int main() {
15380         FILE *fp = fopen("try.c", "r");
15381         char c = getc(fp);
15382         if (
15383                 19 <= FILE_bufsiz(fp) &&
15384                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15385         )
15386                 exit(0);
15387         exit(1);
15388 }
15389 EOP
15390         set try
15391         if eval $compile && $to try.c; then
15392                 if $run ./try; then
15393                         echo "And its _base field acts std."
15394                         val="$define"
15395                 else
15396                         echo "But its _base field isn't std."
15397                 fi
15398         else
15399                 echo "However, it seems to be lacking the _base field."
15400         fi
15401         $rm -f try.c try
15402         ;;
15403 esac
15404 set d_stdiobase
15405 eval $setvar
15406
15407 $cat >&4 <<EOM
15408 Checking how to access stdio streams by file descriptor number...
15409 EOM
15410 case "$stdio_stream_array" in
15411 '')     $cat >try.c <<EOCP
15412 #include <stdio.h>
15413 int main() {
15414   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15415     printf("yes\n");
15416 }
15417 EOCP
15418         for s in _iob __iob __sF
15419         do
15420                 set try -DSTDIO_STREAM_ARRAY=$s
15421                 if eval $compile; then
15422                         case "`$run ./try`" in
15423                         yes)    stdio_stream_array=$s; break ;;
15424                         esac
15425                 fi
15426         done
15427         $rm -f try.* try$exe_ext
15428 esac
15429 case "$stdio_stream_array" in
15430 '')     $cat >&4 <<EOM
15431 I can't figure out how to access stdio streams by file descriptor number.
15432 EOM
15433         d_stdio_stream_array="$undef"
15434         ;;
15435 *)      $cat >&4 <<EOM
15436 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15437 EOM
15438         d_stdio_stream_array="$define"
15439         ;;
15440 esac
15441
15442 : see if strcoll exists
15443 set strcoll d_strcoll
15444 eval $inlibc
15445
15446 : check for structure copying
15447 echo " "
15448 echo "Checking to see if your C compiler can copy structs..." >&4
15449 $cat >try.c <<'EOCP'
15450 int main()
15451 {
15452         struct blurfl {
15453                 int dyick;
15454         } foo, bar;
15455
15456         foo = bar;
15457 }
15458 EOCP
15459 if $cc -c try.c >/dev/null 2>&1 ; then
15460         val="$define"
15461         echo "Yup, it can."
15462 else
15463         val="$undef"
15464         echo "Nope, it can't."
15465 fi
15466 set d_strctcpy
15467 eval $setvar
15468 $rm -f try.*
15469
15470 : see if strerror and/or sys_errlist[] exist
15471 echo " "
15472 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15473     if set strerror val -f d_strerror; eval $csym; $val; then
15474                 echo 'strerror() found.' >&4
15475                 d_strerror="$define"
15476                 d_strerrm='strerror(e)'
15477                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15478                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15479                         d_syserrlst="$define"
15480                 else
15481                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15482                         d_syserrlst="$undef"
15483                 fi
15484     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15485                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15486                 echo 'strerror() found in string header.' >&4
15487                 d_strerror="$define"
15488                 d_strerrm='strerror(e)'
15489                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15490                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15491                                 d_syserrlst="$define"
15492                 else
15493                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15494                         d_syserrlst="$undef"
15495                 fi
15496     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15497                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15498                 d_strerror="$undef"
15499                 d_syserrlst="$define"
15500                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15501     else
15502                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15503                 d_strerror="$undef"
15504                 d_syserrlst="$undef"
15505                 d_strerrm='"unknown"'
15506     fi
15507 fi
15508
15509 : see if strerror_r exists
15510 set strerror_r d_strerror_r
15511 eval $inlibc
15512 case "$d_strerror_r" in
15513 "$define")
15514         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15515         case "$d_strerror_r_proto:$usethreads" in
15516         ":define")      d_strerror_r_proto=define
15517                 set d_strerror_r_proto strerror_r $hdrs
15518                 eval $hasproto ;;
15519         *)      ;;
15520         esac
15521         case "$d_strerror_r_proto" in
15522         define)
15523         case "$strerror_r_proto" in
15524         ''|0) try='int strerror_r(int, char*, size_t);'
15525         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15526         esac
15527         case "$strerror_r_proto" in
15528         ''|0) try='int strerror_r(int, char*, int);'
15529         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15530         esac
15531         case "$strerror_r_proto" in
15532         ''|0) try='char* strerror_r(int, char*, size_t);'
15533         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15534         esac
15535         case "$strerror_r_proto" in
15536         '')     d_strerror_r=undef
15537                 strerror_r_proto=0
15538                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15539         * )     case "$strerror_r_proto" in
15540                 REENTRANT_PROTO*) ;;
15541                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15542                 esac
15543                 echo "Prototype: $try" ;;
15544         esac
15545         ;;
15546         *)      case "$usethreads" in
15547                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15548                 esac
15549                 ;;
15550         esac
15551         ;;
15552 *)      strerror_r_proto=0
15553         ;;
15554 esac
15555
15556 : see if strftime exists
15557 set strftime d_strftime
15558 eval $inlibc
15559
15560 : see if strtod exists
15561 set strtod d_strtod
15562 eval $inlibc
15563
15564 : see if strtol exists
15565 set strtol d_strtol
15566 eval $inlibc
15567
15568 : see if strtold exists
15569 set strtold d_strtold
15570 eval $inlibc
15571
15572 : see if strtoll exists
15573 set strtoll d_strtoll
15574 eval $inlibc
15575
15576 case "$d_longlong-$d_strtoll" in
15577 "$define-$define")
15578         $cat <<EOM
15579 Checking whether your strtoll() works okay...
15580 EOM
15581         $cat >try.c <<'EOCP'
15582 #include <errno.h>
15583 #ifdef __hpux
15584 #define strtoll __strtoll
15585 #endif
15586 #ifdef __EMX__
15587 #define strtoll _strtoll
15588 #endif
15589 #include <stdio.h>
15590 extern long long int strtoll(char *s, char **, int); 
15591 static int bad = 0;
15592 int check(char *s, long long ell, int een) {
15593         long long gll;
15594         errno = 0;
15595         gll = strtoll(s, 0, 10);
15596         if (!((gll == ell) && (errno == een)))
15597                 bad++;
15598 }
15599 int main() {
15600         check(" 1",                                      1LL, 0);
15601         check(" 0",                                      0LL, 0);
15602         check("-1",                                     -1LL, 0);
15603         check("-9223372036854775808", -9223372036854775808LL, 0);
15604         check("-9223372036854775808", -9223372036854775808LL, 0);
15605         check(" 9223372036854775807",  9223372036854775807LL, 0);
15606         check("-9223372036854775808", -9223372036854775808LL, 0);
15607         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15608         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15609         if (!bad)
15610                 printf("ok\n");
15611 }
15612 EOCP
15613         set try
15614         if eval $compile; then
15615                 yyy=`$run ./try`
15616                 case "$yyy" in
15617                 ok) echo "Your strtoll() seems to be working okay." ;;
15618                 *) cat <<EOM >&4
15619 Your strtoll() doesn't seem to be working okay.
15620 EOM
15621                    d_strtoll="$undef"
15622                    ;;
15623                 esac
15624         else
15625                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15626                 d_strtoll="$undef"
15627         fi
15628         ;;
15629 esac
15630
15631 : see if strtoq exists
15632 set strtoq d_strtoq
15633 eval $inlibc
15634
15635 : see if strtoul exists
15636 set strtoul d_strtoul
15637 eval $inlibc
15638
15639 case "$d_strtoul" in
15640 "$define")
15641         $cat <<EOM
15642 Checking whether your strtoul() works okay...
15643 EOM
15644         $cat >try.c <<'EOCP'
15645 #include <errno.h>
15646 #include <stdio.h>
15647 extern unsigned long int strtoul(char *s, char **, int); 
15648 static int bad = 0;
15649 void check(char *s, unsigned long eul, int een) {
15650         unsigned long gul;
15651         errno = 0;
15652         gul = strtoul(s, 0, 10);
15653         if (!((gul == eul) && (errno == een)))
15654                 bad++;
15655 }
15656 int main() {
15657         check(" 1", 1L, 0);
15658         check(" 0", 0L, 0);
15659 EOCP
15660         case "$longsize" in
15661         8)
15662             $cat >>try.c <<'EOCP'
15663         check("18446744073709551615", 18446744073709551615UL, 0);
15664         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15665 #if 0 /* strtoul() for /^-/ strings is undefined. */
15666         check("-1", 18446744073709551615UL, 0);
15667         check("-18446744073709551614", 2, 0);
15668         check("-18446744073709551615", 1, 0);
15669         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15670         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15671 #endif
15672 EOCP
15673                 ;;
15674         4)
15675                     $cat >>try.c <<'EOCP'
15676         check("4294967295", 4294967295UL, 0);
15677         check("4294967296", 4294967295UL, ERANGE);
15678 #if 0 /* strtoul() for /^-/ strings is undefined. */
15679         check("-1", 4294967295UL, 0);
15680         check("-4294967294", 2, 0);
15681         check("-4294967295", 1, 0);
15682         check("-4294967296", 4294967295UL, ERANGE);
15683         check("-4294967297", 4294967295UL, ERANGE);
15684 #endif
15685 EOCP
15686                 ;;
15687         *)
15688 : Should we write these tests to be more portable by sprintf-ing
15689 : ~0 and then manipulating that char string as input for strtol?
15690                 ;;
15691         esac
15692         $cat >>try.c <<'EOCP'
15693         if (!bad)
15694                 printf("ok\n");
15695         return 0;
15696 }
15697 EOCP
15698         set try
15699         if eval $compile; then
15700                 case "`$run ./try`" in
15701                 ok) echo "Your strtoul() seems to be working okay." ;;
15702                 *) cat <<EOM >&4
15703 Your strtoul() doesn't seem to be working okay.
15704 EOM
15705                    d_strtoul="$undef"
15706                    ;;
15707                 esac
15708         fi
15709         ;;
15710 esac
15711
15712 : see if strtoull exists
15713 set strtoull d_strtoull
15714 eval $inlibc
15715
15716 case "$d_longlong-$d_strtoull" in
15717 "$define-$define")
15718         $cat <<EOM
15719 Checking whether your strtoull() works okay...
15720 EOM
15721         $cat >try.c <<'EOCP'
15722 #include <errno.h>
15723 #ifdef __hpux
15724 #define strtoull __strtoull
15725 #endif
15726 #include <stdio.h>
15727 extern unsigned long long int strtoull(char *s, char **, int); 
15728 static int bad = 0;
15729 int check(char *s, long long eull, int een) {
15730         long long gull;
15731         errno = 0;
15732         gull = strtoull(s, 0, 10);
15733         if (!((gull == eull) && (errno == een)))
15734                 bad++;
15735 }
15736 int main() {
15737         check(" 1",                                        1LL, 0);
15738         check(" 0",                                        0LL, 0);
15739         check("18446744073709551615",  18446744073709551615ULL, 0);
15740         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15741 #if 0 /* strtoull() for /^-/ strings is undefined. */
15742         check("-1",                    18446744073709551615ULL, 0);
15743         check("-18446744073709551614",                     2LL, 0);
15744         check("-18446744073709551615",                     1LL, 0);
15745         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15746         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15747 #endif
15748         if (!bad)
15749                 printf("ok\n");
15750 }
15751 EOCP
15752         set try
15753         if eval $compile; then
15754                 case "`$run ./try`" in
15755                 ok) echo "Your strtoull() seems to be working okay." ;;
15756                 *) cat <<EOM >&4
15757 Your strtoull() doesn't seem to be working okay.
15758 EOM
15759                    d_strtoull="$undef"
15760                    ;;
15761                 esac
15762         fi
15763         ;;
15764 esac
15765
15766 : see if strtouq exists
15767 set strtouq d_strtouq
15768 eval $inlibc
15769
15770 case "$d_strtouq" in
15771 "$define")
15772         $cat <<EOM
15773 Checking whether your strtouq() works okay...
15774 EOM
15775         $cat >try.c <<'EOCP'
15776 #include <errno.h>
15777 #include <stdio.h>
15778 extern unsigned long long int strtouq(char *s, char **, int); 
15779 static int bad = 0;
15780 void check(char *s, unsigned long long eull, int een) {
15781         unsigned long long gull;
15782         errno = 0;
15783         gull = strtouq(s, 0, 10);
15784         if (!((gull == eull) && (errno == een)))
15785                 bad++;
15786 }
15787 int main() {
15788         check(" 1",                                        1LL, 0);
15789         check(" 0",                                        0LL, 0);
15790         check("18446744073709551615",  18446744073709551615ULL, 0);
15791         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15792 #if 0 /* strtouq() for /^-/ strings is undefined. */
15793         check("-1",                    18446744073709551615ULL, 0);
15794         check("-18446744073709551614",                     2LL, 0);
15795         check("-18446744073709551615",                     1LL, 0);
15796         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15797         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15798 #endif
15799         if (!bad)
15800                 printf("ok\n");
15801         return 0;
15802 }
15803 EOCP
15804         set try
15805         if eval $compile; then
15806                 case "`$run ./try`" in
15807                 ok) echo "Your strtouq() seems to be working okay." ;;
15808                 *) cat <<EOM >&4
15809 Your strtouq() doesn't seem to be working okay.
15810 EOM
15811                    d_strtouq="$undef"
15812                    ;;
15813                 esac
15814         fi
15815         ;;
15816 esac
15817
15818 : see if strxfrm exists
15819 set strxfrm d_strxfrm
15820 eval $inlibc
15821
15822 : see if symlink exists
15823 set symlink d_symlink
15824 eval $inlibc
15825
15826 : see if syscall exists
15827 set syscall d_syscall
15828 eval $inlibc
15829
15830 : see if prototype for syscall is available
15831 echo " "
15832 set d_syscallproto syscall $i_unistd unistd.h
15833 eval $hasproto
15834
15835 : see if sysconf exists
15836 set sysconf d_sysconf
15837 eval $inlibc
15838
15839 : see if system exists
15840 set system d_system
15841 eval $inlibc
15842
15843 : see if tcgetpgrp exists
15844 set tcgetpgrp d_tcgetpgrp
15845 eval $inlibc
15846
15847 : see if tcsetpgrp exists
15848 set tcsetpgrp d_tcsetpgrp
15849 eval $inlibc
15850
15851 : see if prototype for telldir is available
15852 echo " "
15853 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15854 eval $hasproto
15855
15856 : see if this is a sys/times.h system
15857 set sys/times.h i_systimes
15858 eval $inhdr
15859
15860 : see if times exists
15861 echo " "
15862 if set times val -f d_times; eval $csym; $val; then
15863         echo 'times() found.' >&4
15864         d_times="$define"
15865         inc=''
15866         case "$i_systimes" in
15867         "$define") inc='sys/times.h';;
15868         esac
15869         rp="What is the type returned by times() on this system?"
15870         set clock_t clocktype long stdio.h sys/types.h $inc
15871         eval $typedef_ask
15872 else
15873         echo 'times() NOT found, hope that will do.' >&4
15874         d_times="$undef"
15875         clocktype='int'
15876 fi
15877
15878 : see if tmpnam_r exists
15879 set tmpnam_r d_tmpnam_r
15880 eval $inlibc
15881 case "$d_tmpnam_r" in
15882 "$define")
15883         hdrs="$i_systypes sys/types.h define stdio.h $i_stdio stdio.h"
15884         case "$d_tmpnam_r_proto:$usethreads" in
15885         ":define")      d_tmpnam_r_proto=define
15886                 set d_tmpnam_r_proto tmpnam_r $hdrs
15887                 eval $hasproto ;;
15888         *)      ;;
15889         esac
15890         case "$d_tmpnam_r_proto" in
15891         define)
15892         case "$tmpnam_r_proto" in
15893         ''|0) try='char* tmpnam_r(char*);'
15894         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15895         esac
15896         case "$tmpnam_r_proto" in
15897         '')     d_tmpnam_r=undef
15898                 tmpnam_r_proto=0
15899                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
15900         * )     case "$tmpnam_r_proto" in
15901                 REENTRANT_PROTO*) ;;
15902                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
15903                 esac
15904                 echo "Prototype: $try" ;;
15905         esac
15906         ;;
15907         *)      case "$usethreads" in
15908                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
15909                 esac
15910                 ;;
15911         esac
15912         ;;
15913 *)      tmpnam_r_proto=0
15914         ;;
15915 esac
15916
15917 : see if truncate exists
15918 set truncate d_truncate
15919 eval $inlibc
15920
15921 : see if ttyname_r exists
15922 set ttyname_r d_ttyname_r
15923 eval $inlibc
15924 case "$d_ttyname_r" in
15925 "$define")
15926         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
15927         case "$d_ttyname_r_proto:$usethreads" in
15928         ":define")      d_ttyname_r_proto=define
15929                 set d_ttyname_r_proto ttyname_r $hdrs
15930                 eval $hasproto ;;
15931         *)      ;;
15932         esac
15933         case "$d_ttyname_r_proto" in
15934         define)
15935         case "$ttyname_r_proto" in
15936         ''|0) try='int ttyname_r(int, char*, size_t);'
15937         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
15938         esac
15939         case "$ttyname_r_proto" in
15940         ''|0) try='int ttyname_r(int, char*, int);'
15941         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
15942         esac
15943         case "$ttyname_r_proto" in
15944         ''|0) try='char* ttyname_r(int, char*, int);'
15945         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
15946         esac
15947         case "$ttyname_r_proto" in
15948         '')     d_ttyname_r=undef
15949                 ttyname_r_proto=0
15950                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
15951         * )     case "$ttyname_r_proto" in
15952                 REENTRANT_PROTO*) ;;
15953                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
15954                 esac
15955                 echo "Prototype: $try" ;;
15956         esac
15957         ;;
15958         *)      case "$usethreads" in
15959                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
15960                 esac
15961                 ;;
15962         esac
15963         ;;
15964 *)      ttyname_r_proto=0
15965         ;;
15966 esac
15967
15968 : see if tzname[] exists
15969 echo " "
15970 if set tzname val -a d_tzname; eval $csym; $val; then
15971         val="$define"
15972         echo 'tzname[] found.' >&4
15973 else
15974         val="$undef"
15975         echo 'tzname[] NOT found.' >&4
15976 fi
15977 set d_tzname
15978 eval $setvar
15979
15980 case "$osname" in
15981 next|rhapsody|darwin) multiarch="$define" ;;
15982 esac
15983 case "$multiarch" in
15984 ''|[nN]*) multiarch="$undef" ;;
15985 esac
15986
15987 : check for ordering of bytes in a long
15988 echo " "
15989 case "$usecrosscompile$multiarch" in
15990 *$define*)
15991         $cat <<EOM
15992 You seem to be either cross-compiling or doing a multiarchitecture build,
15993 skipping the byteorder check.
15994
15995 EOM
15996         byteorder='ffff'
15997         ;;
15998 *)
15999         case "$byteorder" in
16000         '')
16001                 $cat <<'EOM'
16002 In the following, larger digits indicate more significance.  A big-endian
16003 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16004 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16005 machines may have weird orders like 3412.  A Cray will report 87654321,
16006 an Alpha will report 12345678. If the test program works the default is
16007 probably right.
16008 I'm now running the test program...
16009 EOM
16010                 $cat >try.c <<'EOCP'
16011 #include <stdio.h>
16012 int main()
16013 {
16014         int i;
16015         union {
16016                 unsigned long l;
16017                 char c[sizeof(long)];
16018         } u;
16019
16020         if (sizeof(long) > 4)
16021                 u.l = (0x08070605L << 32) | 0x04030201L;
16022         else
16023                 u.l = 0x04030201L;
16024         for (i = 0; i < sizeof(long); i++)
16025                 printf("%c", u.c[i]+'0');
16026         printf("\n");
16027         exit(0);
16028 }
16029 EOCP
16030                 xxx_prompt=y
16031                 set try
16032                 if eval $compile && ./try > /dev/null; then
16033                         dflt=`$run ./try`
16034                         case "$dflt" in
16035                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16036                                 echo "(The test program ran ok.)"
16037                                 echo "byteorder=$dflt"
16038                                 xxx_prompt=n
16039                         ;;
16040                         ????|????????) echo "(The test program ran ok.)" ;;
16041                         *) echo "(The test program didn't run right for some reason.)" ;;
16042                         esac
16043                 else
16044                         dflt='4321'
16045                         cat <<'EOM'
16046 (I can't seem to compile the test program.  Guessing big-endian...)
16047 EOM
16048                 fi
16049                 case "$xxx_prompt" in
16050                 y)
16051                         rp="What is the order of bytes in a long?"
16052                         . ./myread
16053                         byteorder="$ans"
16054                         ;;
16055                 *)      byteorder=$dflt
16056                         ;;
16057                 esac
16058                 ;;
16059         esac
16060         $rm -f try.c try
16061         ;;
16062 esac
16063
16064
16065 $cat <<EOM
16066
16067 Checking to see whether you can access character data unalignedly...
16068 EOM
16069 case "$d_u32align" in
16070 '')   $cat >try.c <<EOCP
16071 #include <stdio.h>
16072 #define U32 $u32type
16073 #define BYTEORDER 0x$byteorder
16074 #define U8 $u8type
16075 #include <signal.h>
16076 #ifdef SIGBUS
16077 $signal_t bletch(s) int s; { exit(4); }
16078 #endif
16079 int main() {
16080 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16081     U8 buf[8];
16082     U32 *up;
16083     int i;
16084
16085     if (sizeof(U32) != 4) {
16086         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16087         exit(1);
16088     }
16089
16090     fflush(stdout);
16091
16092 #ifdef SIGBUS
16093     signal(SIGBUS, bletch);
16094 #endif
16095
16096     buf[0] = 0;
16097     buf[1] = 0;
16098     buf[2] = 0;
16099     buf[3] = 1;
16100     buf[5] = 0;
16101     buf[6] = 0;
16102     buf[7] = 0;
16103     buf[8] = 1;
16104
16105     for (i = 0; i < 4; i++) {
16106         up = (U32*)(buf + i);
16107         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16108                (*up == 1 << (8*(3-i)))  /* little-endian */
16109               )
16110            )
16111         {
16112             printf("read failed (%x)\n", *up);
16113             exit(2);
16114         }
16115     }
16116
16117     /* write test */
16118     for (i = 0; i < 4; i++) {
16119         up = (U32*)(buf + i);
16120         *up = 0xBeef;
16121         if (*up != 0xBeef) {
16122             printf("write failed (%x)\n", *up);
16123             exit(3);
16124         }
16125     }
16126
16127     exit(0);
16128 #else
16129     printf("1\n");
16130     exit(1);
16131 #endif
16132     return 0;
16133 }
16134 EOCP
16135 set try
16136 if eval $compile_ok; then
16137         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16138         $run ./try 2>&1 >/dev/null
16139         case "$?" in
16140         0)      cat >&4 <<EOM
16141 You can access character data pretty unalignedly.
16142 EOM
16143                 d_u32align="$undef"
16144                 ;;
16145         *)      cat >&4 <<EOM
16146 It seems that you must access character data in an aligned manner.
16147 EOM
16148                 d_u32align="$define"
16149                 ;;
16150         esac
16151 else
16152         rp='Can you access character data at unaligned addresses?'
16153         dflt='n'
16154         . ./myread
16155         case "$ans" in
16156         [yY]*)  d_u32align="$undef"  ;;
16157         *)      d_u32align="$define" ;;
16158         esac
16159 fi
16160 $rm -f core core.try.* try.core
16161 ;;
16162 esac
16163
16164 : see if ualarm exists
16165 set ualarm d_ualarm
16166 eval $inlibc
16167
16168 : see if umask exists
16169 set umask d_umask
16170 eval $inlibc
16171
16172 : see if unordered exists
16173 set unordered d_unordered
16174 eval $inlibc
16175
16176 : see if usleep exists
16177 set usleep d_usleep
16178 eval $inlibc
16179
16180 : see if prototype for usleep is available
16181 echo " "
16182 set d_usleepproto usleep $i_unistd unistd.h
16183 eval $hasproto
16184
16185 : see if ustat exists
16186 set ustat d_ustat
16187 eval $inlibc
16188
16189 : backward compatibility for d_hvfork
16190 if test X$d_hvfork != X; then
16191         d_vfork="$d_hvfork"
16192         d_hvfork=''
16193 fi
16194 : see if there is a vfork
16195 val=''
16196 set vfork val
16197 eval $inlibc
16198
16199 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16200 : perl on Solaris 2.x, and probably elsewhere.
16201 case "$val" in
16202 $define)
16203         echo " "
16204         case "$usevfork" in
16205         false) dflt='n';;
16206         *) dflt='y';;
16207         esac
16208         cat <<'EOM'
16209  
16210 Perl can only use a vfork() that doesn't suffer from strict
16211 restrictions on calling functions or modifying global data in
16212 the child.  For example, glibc-2.1 contains such a vfork()
16213 that is unsuitable.  If your system provides a proper fork()
16214 call, chances are that you do NOT want perl to use vfork().
16215
16216 EOM
16217         rp="Do you still want to use vfork()?"
16218         . ./myread
16219         case "$ans" in
16220         y|Y) ;;
16221         *)
16222                 echo "Ok, we won't use vfork()."
16223                 val="$undef"
16224                 ;;
16225         esac
16226         ;;
16227 esac
16228 set d_vfork
16229 eval $setvar
16230 case "$d_vfork" in
16231 $define) usevfork='true';;
16232 *) usevfork='false';;
16233 esac
16234
16235 : see if closedir exists
16236 set closedir d_closedir
16237 eval $inlibc
16238
16239 case "$d_closedir" in
16240 "$define")
16241         echo " "
16242         echo "Checking whether closedir() returns a status..." >&4
16243         cat > try.c <<EOM
16244 #$i_dirent I_DIRENT             /**/
16245 #$i_sysdir I_SYS_DIR            /**/
16246 #$i_sysndir I_SYS_NDIR          /**/
16247 #$i_systypes I_SYS_TYPES        /**/
16248
16249 #if defined(I_SYS_TYPES)
16250 #include <sys/types.h>
16251 #endif
16252 #if defined(I_DIRENT)
16253 #include <dirent.h>
16254 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16255 #include <sys/dir.h>
16256 #endif
16257 #else
16258 #ifdef I_SYS_NDIR
16259 #include <sys/ndir.h>
16260 #else
16261 #ifdef I_SYS_DIR
16262 #ifdef hp9000s500
16263 #include <ndir.h>       /* may be wrong in the future */
16264 #else
16265 #include <sys/dir.h>
16266 #endif
16267 #endif
16268 #endif
16269 #endif 
16270 int main() { return closedir(opendir(".")); }
16271 EOM
16272         set try
16273         if eval $compile_ok; then
16274                 if $run ./try > /dev/null 2>&1 ; then
16275                         echo "Yes, it does."
16276                         val="$undef"
16277                 else
16278                         echo "No, it doesn't."
16279                         val="$define"
16280                 fi
16281         else
16282                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16283                 val="$define"
16284         fi
16285         ;;
16286 *)
16287         val="$undef";
16288         ;;
16289 esac
16290 set d_void_closedir
16291 eval $setvar
16292 $rm -f try try.*
16293 : see if there is a wait4
16294 set wait4 d_wait4
16295 eval $inlibc
16296
16297 : see if waitpid exists
16298 set waitpid d_waitpid
16299 eval $inlibc
16300
16301 : see if wcstombs exists
16302 set wcstombs d_wcstombs
16303 eval $inlibc
16304
16305 : see if wctomb exists
16306 set wctomb d_wctomb
16307 eval $inlibc
16308
16309 : see if writev exists
16310 set writev d_writev
16311 eval $inlibc
16312
16313 : preserve RCS keywords in files with variable substitution, grrr
16314 Date='$Date'
16315 Id='$Id'
16316 Log='$Log'
16317 RCSfile='$RCSfile'
16318 Revision='$Revision'
16319
16320 : check for alignment requirements
16321 echo " "
16322 case "$usecrosscompile$multiarch" in
16323 *$define*)
16324         $cat <<EOM
16325 You seem to be either cross-compiling or doing a multiarchitecture build,
16326 skipping the memory alignment check.
16327
16328 EOM
16329         case "$alignbytes" in
16330         '') alignbytes=8 ;;
16331         esac
16332         ;;
16333 *)
16334         case "$alignbytes" in
16335         '') echo "Checking alignment constraints..." >&4
16336                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16337                         $cat >try.c <<'EOCP'
16338 typedef long double NV;
16339 EOCP
16340                 else
16341                         $cat >try.c <<'EOCP'
16342 typedef double NV;
16343 EOCP
16344                 fi
16345                 $cat >>try.c <<'EOCP'
16346 #include <stdio.h>
16347 struct foobar {
16348         char foo;
16349         NV bar;
16350 } try_algn;
16351 int main()
16352 {
16353     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16354     return(0);
16355 }
16356 EOCP
16357                 set try
16358                 if eval $compile_ok; then
16359                         dflt=`$run ./try`
16360                 else
16361                         dflt='8'
16362                         echo "(I can't seem to compile the test program...)"
16363                 fi
16364                 ;;
16365         *) dflt="$alignbytes"
16366                 ;;
16367         esac
16368         rp="Doubles must be aligned on a how-many-byte boundary?"
16369         . ./myread
16370         alignbytes="$ans"
16371         $rm -f try.c try
16372         ;;
16373 esac
16374
16375
16376 : set the base revision
16377 baserev=5.0
16378
16379 : how do we catenate cpp tokens here?
16380 echo " "
16381 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16382 $cat >cpp_stuff.c <<'EOCP'
16383 #define RCAT(a,b)a/**/b
16384 #define ACAT(a,b)a ## b
16385 RCAT(Rei,ser)
16386 ACAT(Cir,cus)
16387 EOCP
16388 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16389 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16390         echo "Oh!  Smells like ANSI's been here." >&4
16391         echo "We can catify or stringify, separately or together!"
16392         cpp_stuff=42
16393 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16394         echo "Ah, yes!  The good old days!" >&4
16395         echo "However, in the good old days we don't know how to stringify and"
16396         echo "catify at the same time."
16397         cpp_stuff=1
16398 else
16399         $cat >&4 <<EOM
16400 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16401 to have to edit the values of CAT[2-5] in config.h...
16402 EOM
16403         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16404 fi
16405 $rm -f cpp_stuff.*
16406
16407 : see if this is a db.h system
16408 set db.h i_db
16409 eval $inhdr
16410
16411 case "$i_db" in
16412 $define)
16413         : Check db version.
16414         echo " "
16415         echo "Checking Berkeley DB version ..." >&4
16416         $cat >try.c <<EOCP
16417 #$d_const HASCONST
16418 #ifndef HASCONST
16419 #define const
16420 #endif
16421 #include <sys/types.h>
16422 #include <stdio.h>
16423 #include <db.h>
16424 int main(int argc, char *argv[])
16425 {
16426 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16427     int Major, Minor, Patch ;
16428     unsigned long Version ;
16429     (void)db_version(&Major, &Minor, &Patch) ;
16430     if (argc == 2) {
16431         printf("%d %d %d %d %d %d\n",
16432                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16433                Major, Minor, Patch);
16434         exit(0);
16435     }
16436     printf("You have Berkeley DB Version 2 or greater.\n");
16437
16438     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16439                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16440     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16441                 Major, Minor, Patch) ;
16442
16443     /* check that db.h & libdb are compatible */
16444     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16445         printf("db.h and libdb are incompatible.\n") ;
16446         exit(3);        
16447     }
16448
16449     printf("db.h and libdb are compatible.\n") ;
16450
16451     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16452                 + DB_VERSION_PATCH ;
16453
16454     /* needs to be >= 2.3.4 */
16455     if (Version < 2003004) {
16456     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16457         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16458         exit(2);        
16459     }
16460
16461     exit(0);
16462 #else
16463 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16464     if (argc == 2) {
16465         printf("1 0 0\n");
16466         exit(0);
16467     }
16468     printf("You have Berkeley DB Version 1.\n");
16469     exit(0);    /* DB version < 2: the coast is clear. */
16470 #else
16471     exit(1);    /* <db.h> not Berkeley DB? */
16472 #endif
16473 #endif
16474 }
16475 EOCP
16476         set try
16477         if eval $compile_ok && $run ./try; then
16478                 echo 'Looks OK.' >&4
16479                 set `$run ./try 1`
16480                 db_version_major=$1
16481                 db_version_minor=$2
16482                 db_version_patch=$3
16483         else
16484                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16485                 i_db=$undef
16486                 case " $libs " in
16487                 *"-ldb "*)
16488                         : Remove db from list of libraries to use
16489                         echo "Removing unusable -ldb from library list" >&4
16490                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16491                         shift
16492                         libs="$*"
16493                         echo "libs = $libs" >&4
16494                         ;;
16495                 esac
16496         fi
16497         $rm -f try.*
16498         ;;
16499 esac
16500
16501 case "$i_db" in
16502 define)
16503         : Check the return type needed for hash 
16504         echo " "
16505         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16506         $cat >try.c <<EOCP
16507 #$d_const HASCONST
16508 #ifndef HASCONST
16509 #define const
16510 #endif
16511 #include <sys/types.h>
16512 #include <db.h>
16513
16514 #ifndef DB_VERSION_MAJOR
16515 u_int32_t hash_cb (ptr, size)
16516 const void *ptr;
16517 size_t size;
16518 {
16519 }
16520 HASHINFO info;
16521 int main()
16522 {
16523         info.hash = hash_cb;
16524 }
16525 #endif
16526 EOCP
16527         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16528                 if $contains warning try.out >>/dev/null 2>&1 ; then
16529                         db_hashtype='int'
16530                 else
16531                         db_hashtype='u_int32_t'
16532                 fi
16533         else
16534                 : XXX Maybe we should just give up here.
16535                 db_hashtype=u_int32_t
16536                 $cat try.out >&4
16537                 echo "Help:  I can't seem to compile the db test program." >&4
16538                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16539         fi
16540         $rm -f try.*
16541         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16542         ;;
16543 *)      db_hashtype=u_int32_t
16544         ;;
16545 esac
16546 case "$i_db" in
16547 define)
16548         : Check the return type needed for prefix 
16549         echo " "
16550         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16551         cat >try.c <<EOCP
16552 #$d_const HASCONST
16553 #ifndef HASCONST
16554 #define const
16555 #endif
16556 #include <sys/types.h>
16557 #include <db.h>
16558
16559 #ifndef DB_VERSION_MAJOR
16560 size_t prefix_cb (key1, key2)
16561 const DBT *key1;
16562 const DBT *key2;
16563 {
16564 }
16565 BTREEINFO info;
16566 int main()
16567 {
16568         info.prefix = prefix_cb;
16569 }
16570 #endif
16571 EOCP
16572         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16573                 if $contains warning try.out >>/dev/null 2>&1 ; then
16574                         db_prefixtype='int'
16575                 else
16576                         db_prefixtype='size_t'
16577                 fi
16578         else
16579                 db_prefixtype='size_t'
16580                 : XXX Maybe we should just give up here.
16581                 $cat try.out >&4
16582                 echo "Help:  I can't seem to compile the db test program." >&4
16583                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16584         fi
16585         $rm -f try.*
16586         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16587         ;;
16588 *)      db_prefixtype='size_t'
16589         ;;
16590 esac
16591
16592
16593 : How can we generate normalized random numbers ?
16594 echo " "
16595 echo "Looking for a random number function..." >&4
16596 case "$randfunc" in
16597 '')
16598         if set drand48 val -f; eval $csym; $val; then
16599                 dflt="drand48"
16600                 echo "Good, found drand48()." >&4
16601         elif set random val -f; eval $csym; $val; then
16602                 dflt="random"
16603                 echo "OK, found random()." >&4
16604         else
16605                 dflt="rand"
16606                 echo "Yick, looks like I have to use rand()." >&4
16607         fi
16608         echo " "
16609         ;;
16610 *)
16611         dflt="$randfunc"
16612         ;;
16613 esac
16614 cont=true
16615
16616 case "$ccflags" in
16617 *-Dmy_rand=*|*-Dmy_srand=*)
16618         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16619         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16620         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16621         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16622         ;;
16623 esac
16624
16625 while $test "$cont"; do
16626         rp="Use which function to generate random numbers?"
16627         . ./myread
16628         if $test "$ans" = "$dflt"; then
16629                 : null
16630         else
16631                 randbits=''
16632         fi
16633         randfunc="$ans"
16634         if set $ans val -f; eval $csym; $val; then
16635                 cont=''
16636         else
16637                 dflt=y
16638                 rp="I cannot find function $ans. Use that name anyway?"
16639                 . ./myread
16640                 dflt=rand
16641                 case "$ans" in
16642                         [yY]*) cont='';;
16643                 esac
16644         fi
16645         case "$cont" in
16646         '')
16647                 case "$randfunc" in
16648                 drand48)
16649                         drand01="drand48()"
16650                         seedfunc="srand48"
16651                         randbits=48
16652                         randseedtype=long
16653                         ;;
16654                 rand|random)
16655                         case "$randbits" in
16656                         '')
16657 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16658                                 $cat >try.c <<EOCP
16659 #$i_unistd I_UNISTD
16660 #$i_stdlib I_STDLIB
16661 #include <stdio.h>
16662 #ifdef I_UNISTD
16663 #  include <unistd.h>
16664 #endif
16665 #ifdef I_STDLIB
16666 #  include <stdlib.h>
16667 #endif
16668 int main()
16669 {
16670         register int i;
16671         register unsigned long tmp;
16672         register unsigned long max = 0L;
16673
16674         for (i = 1000; i; i--) {
16675                 tmp = (unsigned long) $randfunc();
16676                 if (tmp > max) max = tmp;
16677         }
16678         for (i = 0; max; i++)
16679                 max /= 2;
16680         printf("%d\n",i);
16681 }
16682 EOCP
16683                                 set try
16684                                 if eval $compile_ok; then
16685                                         dflt=`try`
16686                                 else
16687                                         dflt='?'
16688                                         echo "(I can't seem to compile the test program...)"
16689                                 fi
16690                                 ;;
16691                         *)
16692                                 dflt="$randbits"
16693                                 ;;
16694                         esac
16695                         rp="How many bits does your $randfunc() function produce?"
16696                         . ./myread
16697                         randbits="$ans"
16698                         $rm -f try.c try
16699                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16700                         seedfunc="s$randfunc"
16701                         randseedtype=unsigned
16702                         ;;
16703                 *)
16704                         dflt="31"
16705                         rp="How many bits does your $randfunc() function produce?"
16706                         . ./myread
16707                         randbits="$ans"
16708                         seedfunc="s$randfunc"
16709                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16710                         if set $seedfunc val -f; eval $csym; $val; then
16711                                 echo "(Using $seedfunc() to seed random generator)"
16712                         else
16713                                 echo "(Warning: no $seedfunc() to seed random generator)"
16714                                 seedfunc=rand
16715                         fi
16716                         randseedtype=unsigned
16717                         ;;
16718                 esac
16719                 ;;
16720         esac
16721 done
16722
16723 echo " "
16724 echo "Determining whether or not we are on an EBCDIC system..." >&4
16725 $cat >try.c <<'EOM'
16726 int main()
16727 {
16728   if ('M'==0xd4) return 0;
16729   return 1;
16730 }
16731 EOM
16732
16733 val=$undef
16734 set try
16735 if eval $compile_ok; then
16736         if $run ./try; then
16737                 echo "You seem to speak EBCDIC." >&4
16738                 val="$define"
16739         else
16740                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16741         fi
16742 else
16743         echo "I'm unable to compile the test program." >&4
16744         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16745 fi
16746 $rm -f try try.*
16747 set ebcdic
16748 eval $setvar
16749
16750 echo " "
16751 $cat >&4 <<EOM
16752 Checking how to flush all pending stdio output...
16753 EOM
16754 # I only know how to find the first 32 possibly open files on SunOS.
16755 # See also hints/sunos_4_1.sh and util.c  --AD
16756 case "$osname" in
16757 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16758 esac
16759 $cat >>try.c <<EOCP
16760 #include <stdio.h>
16761 #$i_unistd I_UNISTD
16762 #ifdef I_UNISTD
16763 # include <unistd.h>
16764 #endif
16765 #$d_sysconf HAS_SYSCONF
16766 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16767 #ifdef HAS_STDIO_STREAM_ARRAY
16768 # define STDIO_STREAM_ARRAY $stdio_stream_array
16769 #endif
16770 int main() {
16771   FILE* p;
16772   unlink("try.out");
16773   p = fopen("try.out", "w");
16774 #ifdef TRY_FPUTC
16775   fputc('x', p);
16776 #else
16777 # ifdef TRY_FPRINTF
16778   fprintf(p, "x");
16779 # endif
16780 #endif
16781 #ifdef TRY_FFLUSH_NULL
16782   fflush(NULL);
16783 #endif
16784 #ifdef TRY_FFLUSH_ALL
16785   {
16786     long open_max = -1;
16787 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16788     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16789 # else
16790 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16791     open_max = sysconf(_SC_OPEN_MAX);
16792 #  else
16793 #   ifdef FOPEN_MAX
16794     open_max = FOPEN_MAX;
16795 #   else
16796 #    ifdef OPEN_MAX
16797     open_max = OPEN_MAX;
16798 #    else
16799 #     ifdef _NFILE
16800     open_max = _NFILE;
16801 #     endif
16802 #    endif
16803 #   endif
16804 #  endif
16805 # endif 
16806 # ifdef HAS_STDIO_STREAM_ARRAY
16807     if (open_max > 0) {
16808       long i;
16809       for (i = 0; i < open_max; i++)
16810             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16811                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16812                 STDIO_STREAM_ARRAY[i]._flag)
16813                 fflush(&STDIO_STREAM_ARRAY[i]);
16814     }   
16815   }
16816 # endif
16817 #endif
16818   _exit(42);
16819 }
16820 EOCP
16821 : first we have to find out how _not_ to flush
16822 $to try.c
16823 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16824     output=''
16825     set try -DTRY_FPUTC
16826     if eval $compile; then
16827             $run ./try 2>/dev/null
16828             code="$?"
16829             $from try.out
16830             if $test ! -s try.out -a "X$code" = X42; then
16831                 output=-DTRY_FPUTC
16832             fi
16833     fi
16834     case "$output" in
16835     '')
16836             set try -DTRY_FPRINTF
16837             if eval $compile; then
16838                     $run ./try 2>/dev/null
16839                     code="$?"
16840                     $from try.out
16841                     if $test ! -s try.out -a "X$code" = X42; then
16842                         output=-DTRY_FPRINTF
16843                     fi
16844             fi
16845         ;;
16846     esac
16847 fi
16848 : check for fflush NULL behaviour
16849 case "$fflushNULL" in
16850 '')     set try -DTRY_FFLUSH_NULL $output
16851         if eval $compile; then
16852                 $run ./try 2>/dev/null
16853                 code="$?"
16854                 $from try.out
16855                 if $test -s try.out -a "X$code" = X42; then
16856                         fflushNULL="`$cat try.out`"
16857                 else
16858                         if $test "X$code" != X42; then
16859                                 $cat >&4 <<EOM
16860 (If this test failed, don't worry, we'll try another method shortly.)
16861 EOM
16862                         fi
16863                 fi
16864         fi
16865         $rm -f core try.core core.try.*
16866         case "$fflushNULL" in
16867         x)      $cat >&4 <<EOM
16868 Your fflush(NULL) works okay for output streams.
16869 Let's see if it clobbers input pipes...
16870 EOM
16871 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16872 # bug that improperly flushes the input end of pipes.  So we avoid the
16873 # autoflush on fork/system/exec support for now. :-(
16874 $cat >tryp.c <<EOCP
16875 #include <stdio.h>
16876 int
16877 main(int argc, char **argv)
16878 {
16879     char buf[1024];
16880     int i;
16881     char *bp = buf;
16882     while (1) {
16883         while ((i = getc(stdin)) != -1
16884                && (*bp++ = i) != '\n'
16885                && bp < &buf[1024])
16886         /* DO NOTHING */ ;
16887         *bp = '\0';
16888         fprintf(stdout, "%s", buf);
16889         fflush(NULL);
16890         if (i == -1)
16891             return 0;
16892         bp = buf;
16893     }
16894 }
16895 EOCP
16896                 fflushNULL="$define"
16897                 set tryp
16898                 if eval $compile; then
16899                     $rm -f tryp.out
16900                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
16901                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
16902                        $cat >&4 <<EOM
16903 fflush(NULL) seems to behave okay with input streams.
16904 EOM
16905                         fflushNULL="$define"
16906                     else
16907                         $cat >&4 <<EOM
16908 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
16909 EOM
16910                         fflushNULL="$undef"
16911                     fi
16912                 fi
16913                 $rm -f core tryp.c tryp.core core.tryp.*
16914                 ;;
16915         '')     $cat >&4 <<EOM
16916 Your fflush(NULL) isn't working (contrary to ANSI C).
16917 EOM
16918                 fflushNULL="$undef"
16919                 ;;
16920         *)      $cat >&4 <<EOM
16921 Cannot figure out whether your fflush(NULL) works or not.
16922 I'm assuming it doesn't (contrary to ANSI C).
16923 EOM
16924                 fflushNULL="$undef"
16925                 ;;
16926         esac
16927         ;;
16928 $define|true|[yY]*)
16929         fflushNULL="$define"
16930         ;;
16931 *)
16932         fflushNULL="$undef"
16933         ;;
16934 esac
16935 : check explicit looping only if NULL did not work, and if the pipe
16936 : bug does not show up on an explicit flush too
16937 case "$fflushNULL" in
16938 "$undef")
16939         $cat >tryp.c <<EOCP
16940 #include <stdio.h>
16941 int
16942 main(int argc, char **argv)
16943 {
16944     char buf[1024];
16945     int i;
16946     char *bp = buf;
16947     while (1) {
16948         while ((i = getc(stdin)) != -1
16949                && (*bp++ = i) != '\n'
16950                && bp < &buf[1024])
16951         /* DO NOTHING */ ;
16952         *bp = '\0';
16953         fprintf(stdout, "%s", buf);
16954         fflush(stdin);
16955         if (i == -1)
16956             return 0;
16957         bp = buf;
16958     }
16959 }
16960 EOCP
16961         set tryp
16962         if eval $compile; then
16963             $rm -f tryp.out
16964             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
16965             if cmp tryp.c tryp.out >/dev/null 2>&1; then
16966                $cat >&4 <<EOM
16967 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
16968 EOM
16969                 : now check for fflushall behaviour
16970                 case "$fflushall" in
16971                 '')     set try -DTRY_FFLUSH_ALL $output
16972                         if eval $compile; then
16973                                 $cat >&4 <<EOM
16974 (Now testing the other method--but note that this also may fail.)
16975 EOM
16976                                 $run ./try 2>/dev/null
16977                                 code=$?
16978                                 $from try.out
16979                                 if $test -s try.out -a "X$code" = X42; then
16980                                         fflushall="`$cat try.out`"
16981                                 fi
16982                         fi
16983                         $rm -f core try.core core.try.*
16984                         case "$fflushall" in
16985                         x)      $cat >&4 <<EOM
16986 Whew. Flushing explicitly all the stdio streams works.
16987 EOM
16988                                 fflushall="$define"
16989                                 ;;
16990                         '')     $cat >&4 <<EOM
16991 Sigh. Flushing explicitly all the stdio streams doesn't work.
16992 EOM
16993                                 fflushall="$undef"
16994                                 ;;
16995                         *)      $cat >&4 <<EOM
16996 Cannot figure out whether flushing stdio streams explicitly works or not.
16997 I'm assuming it doesn't.
16998 EOM
16999                                 fflushall="$undef"
17000                                 ;;
17001                         esac
17002                         ;;
17003                 "$define"|true|[yY]*)
17004                         fflushall="$define"
17005                         ;;
17006                 *)
17007                         fflushall="$undef"
17008                         ;;
17009                 esac
17010             else
17011                 $cat >&4 <<EOM
17012 All is futile.  Even fflush(stdin) clobbers input pipes!
17013 EOM
17014                 fflushall="$undef"
17015             fi
17016         else
17017             fflushall="$undef"
17018         fi
17019         $rm -f core tryp.c tryp.core core.tryp.*
17020         ;;
17021 *)      fflushall="$undef"
17022         ;;
17023 esac
17024
17025 case "$fflushNULL$fflushall" in
17026 undefundef)
17027         $cat <<EOM
17028 OK, I give up.  I cannot figure out how to flush pending stdio output.
17029 We won't be flushing handles at all before fork/exec/popen.
17030 EOM
17031         ;;
17032 esac
17033 $rm -f try.* try$exe_ext
17034
17035 : Store the full pathname to the ar program for use in the C program
17036 : Respect a hint or command line value for full_ar.
17037 case "$full_ar" in
17038 '') full_ar=$ar ;;
17039 esac
17040
17041 : Store the full pathname to the sed program for use in the C program
17042 full_sed=$sed
17043
17044 : see what type gids are declared as in the kernel
17045 echo " "
17046 echo "Looking for the type for group ids returned by getgid()."
17047 set gid_t gidtype xxx stdio.h sys/types.h
17048 eval $typedef
17049 case "$gidtype" in
17050 xxx)
17051         xxx=`./findhdr sys/user.h`
17052         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17053         case $1 in
17054         unsigned) dflt="$1 $2" ;;
17055         *) dflt="$1" ;;
17056         esac
17057         ;;
17058 *) dflt="$gidtype";;
17059 esac
17060 case "$gidtype" in
17061 gid_t) echo "gid_t found." ;;
17062 *)      rp="What is the type for group ids returned by getgid()?"
17063         . ./myread
17064         gidtype="$ans"
17065         ;;
17066 esac
17067
17068 echo " "
17069 case "$gidtype" in
17070 *_t) zzz="$gidtype"     ;;
17071 *)   zzz="gid"          ;;
17072 esac
17073 echo "Checking the size of $zzz..." >&4 
17074 cat > try.c <<EOCP
17075 #include <sys/types.h>
17076 #include <stdio.h>
17077 int main() {
17078     printf("%d\n", (int)sizeof($gidtype));
17079     exit(0);
17080 }
17081 EOCP
17082 set try
17083 if eval $compile_ok; then
17084         yyy=`$run ./try`
17085         case "$yyy" in
17086         '')     gidsize=4
17087                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17088                 ;;
17089         *)      gidsize=$yyy
17090                 echo "Your $zzz is $gidsize bytes long."
17091                 ;;
17092         esac
17093 else
17094         gidsize=4
17095         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17096 fi
17097
17098
17099 echo " "
17100 case "$gidtype" in
17101 *_t) zzz="$gidtype"     ;;
17102 *)   zzz="gid"          ;;
17103 esac
17104 echo "Checking the sign of $zzz..." >&4 
17105 cat > try.c <<EOCP
17106 #include <sys/types.h>
17107 #include <stdio.h>
17108 int main() {
17109         $gidtype foo = -1;
17110         if (foo < 0)
17111                 printf("-1\n");
17112         else
17113                 printf("1\n");
17114 }
17115 EOCP
17116 set try
17117 if eval $compile; then
17118         yyy=`$run ./try`
17119         case "$yyy" in
17120         '')     gidsign=1
17121                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17122                 ;;
17123         *)      gidsign=$yyy
17124                 case "$gidsign" in
17125                  1) echo "Your $zzz is unsigned." ;;
17126                 -1) echo "Your $zzz is signed."   ;;
17127                 esac
17128                 ;;
17129         esac
17130 else
17131         gidsign=1
17132         echo "(I can't compile the test program--guessing unsigned.)" >&4
17133 fi
17134
17135
17136 echo " "
17137
17138 if $test X"$quadtype" != X; then
17139
17140 echo "Checking how to print 64-bit integers..." >&4
17141
17142 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17143         $cat >try.c <<'EOCP'
17144 #include <sys/types.h>
17145 #include <stdio.h>
17146 int main() {
17147   int q = 12345678901;
17148   printf("%ld\n", q);
17149 }
17150 EOCP
17151         set try
17152         if eval $compile; then
17153                 yyy=`$run ./try`
17154                 case "$yyy" in
17155                 12345678901)
17156                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17157                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17158                         echo "We will use %d."
17159                         ;;
17160                 esac
17161         fi
17162 fi
17163
17164 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17165         $cat >try.c <<'EOCP'
17166 #include <sys/types.h>
17167 #include <stdio.h>
17168 int main() {
17169   long q = 12345678901;
17170   printf("%ld\n", q);
17171 }
17172 EOCP
17173         set try
17174         if eval $compile; then
17175                 yyy=`$run ./try`
17176                 case "$yyy" in
17177                 12345678901)
17178                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17179                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17180                         echo "We will use %ld."
17181                         ;;
17182                 esac
17183         fi
17184 fi
17185
17186 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17187         $cat >try.c <<'EOCP'
17188 #include <sys/types.h>
17189 #include <inttypes.h>
17190 #include <stdio.h>
17191 int main() {
17192   int64_t q = 12345678901;
17193   printf("%" PRId64 "\n", q);
17194 }
17195 EOCP
17196         set try
17197         if eval $compile; then
17198                 yyy=`$run ./try`
17199                 case "$yyy" in
17200                 12345678901)
17201                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17202                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17203                         echo "We will use the C9X style."
17204                         ;;
17205                 esac
17206         fi
17207 fi
17208
17209 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17210         $cat >try.c <<EOCP
17211 #include <sys/types.h>
17212 #include <stdio.h>
17213 int main() {
17214   $quadtype q = 12345678901;
17215   printf("%Ld\n", q);
17216 }
17217 EOCP
17218         set try
17219         if eval $compile; then
17220                 yyy=`$run ./try`
17221                 case "$yyy" in
17222                 12345678901)
17223                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17224                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17225                         echo "We will use %Ld."
17226                         ;;
17227                 esac
17228         fi
17229 fi
17230
17231 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17232         $cat >try.c <<'EOCP'
17233 #include <sys/types.h>
17234 #include <stdio.h>
17235 int main() {
17236   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17237   printf("%lld\n", q);
17238 }
17239 EOCP
17240         set try
17241         if eval $compile; then
17242                 yyy=`$run ./try`
17243                 case "$yyy" in
17244                 12345678901)
17245                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17246                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17247                         echo "We will use the %lld style."
17248                         ;;
17249                 esac
17250         fi
17251 fi
17252
17253 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17254         $cat >try.c <<EOCP
17255 #include <sys/types.h>
17256 #include <stdio.h>
17257 int main() {
17258   $quadtype q = 12345678901;
17259   printf("%qd\n", q);
17260 }
17261 EOCP
17262         set try
17263         if eval $compile; then
17264                 yyy=`$run ./try`
17265                 case "$yyy" in
17266                 12345678901)
17267                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17268                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17269                         echo "We will use %qd."
17270                         ;;
17271                 esac
17272         fi
17273 fi
17274
17275 if $test X"$sPRId64" = X; then
17276         echo "Cannot figure out how to print 64-bit integers." >&4
17277 fi
17278
17279 $rm -f try try.*
17280
17281 fi
17282
17283 case "$sPRId64" in
17284 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17285         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17286         ;;
17287 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17288         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17289         ;;
17290 esac
17291
17292
17293 echo " "
17294 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17295
17296 if $test X"$ivsize" = X8; then
17297         ivdformat="$sPRId64"
17298         uvuformat="$sPRIu64"
17299         uvoformat="$sPRIo64"
17300         uvxformat="$sPRIx64"
17301         uvXUformat="$sPRIXU64"
17302 else
17303         if $test X"$ivsize" = X"$longsize"; then
17304                 ivdformat='"ld"'
17305                 uvuformat='"lu"'
17306                 uvoformat='"lo"'
17307                 uvxformat='"lx"'
17308                 uvXUformat='"lX"'
17309         else
17310                 if $test X"$ivsize" = X"$intsize"; then
17311                         ivdformat='"d"'
17312                         uvuformat='"u"'
17313                         uvoformat='"o"'
17314                         uvxformat='"x"'
17315                         uvXUformat='"X"'
17316                 else
17317                         : far out
17318                         if $test X"$ivsize" = X"$shortsize"; then
17319                                 ivdformat='"hd"'
17320                                 uvuformat='"hu"'
17321                                 uvoformat='"ho"'
17322                                 uvxformat='"hx"'
17323                                 uvXUformat='"hX"'
17324                         fi
17325                 fi
17326         fi
17327 fi
17328
17329 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17330         nveformat="$sPRIeldbl"
17331         nvfformat="$sPRIfldbl"
17332         nvgformat="$sPRIgldbl"
17333         nvEUformat="$sPRIEUldbl"
17334         nvFUformat="$sPRIFUldbl"
17335         nvGUformat="$sPRIGUldbl"
17336 else
17337         nveformat='"e"'
17338         nvfformat='"f"'
17339         nvgformat='"g"'
17340         nvEUformat='"E"'
17341         nvFUformat='"F"'
17342         nvGUformat='"G"'
17343 fi
17344
17345 case "$ivdformat" in
17346 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17347     exit 1
17348     ;;
17349 esac
17350
17351
17352 echo " "
17353 $echo "Checking the format string to be used for gids..." >&4
17354
17355 case "$gidsign" in
17356 -1)     if $test X"$gidsize" = X"$ivsize"; then
17357                 gidformat="$ivdformat"
17358         else
17359                 if $test X"$gidsize" = X"$longsize"; then
17360                         gidformat='"ld"'
17361                 else
17362                         if $test X"$gidsize" = X"$intsize"; then
17363                                 gidformat='"d"'
17364                         else
17365                                 if $test X"$gidsize" = X"$shortsize"; then
17366                                         gidformat='"hd"'
17367                                 fi
17368                         fi
17369                 fi
17370         fi
17371         ;;
17372 *)      if $test X"$gidsize" = X"$uvsize"; then
17373                 gidformat="$uvuformat"
17374         else
17375                 if $test X"$gidsize" = X"$longsize"; then
17376                         gidformat='"lu"'
17377                 else
17378                         if $test X"$gidsize" = X"$intsize"; then
17379                                 gidformat='"u"'
17380                         else
17381                                 if $test X"$gidsize" = X"$shortsize"; then
17382                                         gidformat='"hu"'
17383                                 fi
17384                         fi
17385                 fi
17386         fi
17387         ;;
17388 esac
17389
17390 : see if getgroups exists
17391 set getgroups d_getgrps
17392 eval $inlibc
17393
17394 : see if setgroups exists
17395 set setgroups d_setgrps
17396 eval $inlibc
17397
17398
17399 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17400 echo " "
17401 case "$d_getgrps$d_setgrps" in
17402 *define*)
17403         case "$groupstype" in
17404         '') dflt="$gidtype" ;;
17405         *)  dflt="$groupstype" ;;
17406         esac
17407         $cat <<EOM
17408 What type of pointer is the second argument to getgroups() and setgroups()?
17409 Usually this is the same as group ids, $gidtype, but not always.
17410
17411 EOM
17412         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17413         . ./myread
17414         groupstype="$ans"
17415         ;;
17416 *)  groupstype="$gidtype";;
17417 esac
17418
17419 echo " "
17420 echo "Checking if your $make program sets \$(MAKE)..." >&4
17421 case "$make_set_make" in
17422 '')
17423         $sed 's/^X //' > testmake.mak << 'EOF'
17424 Xall:
17425 X       @echo 'maketemp="$(MAKE)"'
17426 EOF
17427         case "`$make -f testmake.mak 2>/dev/null`" in
17428         *maketemp=*) make_set_make='#' ;;
17429         *)      make_set_make="MAKE=$make" ;;
17430         esac
17431         $rm -f testmake.mak
17432         ;;
17433 esac
17434 case "$make_set_make" in
17435 '#') echo "Yup, it does.";;
17436 *) echo "Nope, it doesn't.";;
17437 esac
17438
17439 : see what type is used for mode_t
17440 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17441 set mode_t modetype int stdio.h sys/types.h
17442 eval $typedef_ask
17443
17444 : see if stdarg is available
17445 echo " "
17446 if $test `./findhdr stdarg.h`; then
17447         echo "<stdarg.h> found." >&4
17448         valstd="$define"
17449 else
17450         echo "<stdarg.h> NOT found." >&4
17451         valstd="$undef"
17452 fi
17453
17454 : see if varags is available
17455 echo " "
17456 if $test `./findhdr varargs.h`; then
17457         echo "<varargs.h> found." >&4
17458 else
17459         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17460 fi
17461
17462 : set up the varargs testing programs
17463 $cat > varargs.c <<EOP
17464 #ifdef I_STDARG
17465 #include <stdarg.h>
17466 #endif
17467 #ifdef I_VARARGS
17468 #include <varargs.h>
17469 #endif
17470
17471 #ifdef I_STDARG
17472 int f(char *p, ...)
17473 #else
17474 int f(va_alist)
17475 va_dcl
17476 #endif
17477 {
17478         va_list ap;
17479 #ifndef I_STDARG
17480         char *p;
17481 #endif
17482 #ifdef I_STDARG
17483         va_start(ap,p);
17484 #else
17485         va_start(ap);
17486         p = va_arg(ap, char *);
17487 #endif
17488         va_end(ap);
17489 }
17490 EOP
17491 $cat > varargs <<EOP
17492 $startsh
17493 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17494         echo "true"
17495 else
17496         echo "false"
17497 fi
17498 $rm -f varargs$_o
17499 EOP
17500 chmod +x varargs
17501
17502 : now check which varargs header should be included
17503 echo " "
17504 i_varhdr=''
17505 case "$valstd" in
17506 "$define")
17507         if `./varargs I_STDARG`; then
17508                 val='stdarg.h'
17509         elif `./varargs I_VARARGS`; then
17510                 val='varargs.h'
17511         fi
17512         ;;
17513 *)
17514         if `./varargs I_VARARGS`; then
17515                 val='varargs.h'
17516         fi
17517         ;;
17518 esac
17519 case "$val" in
17520 '')
17521 echo "I could not find the definition for va_dcl... You have problems..." >&4
17522         val="$undef"; set i_stdarg; eval $setvar
17523         val="$undef"; set i_varargs; eval $setvar
17524         ;;
17525 *) 
17526         set i_varhdr
17527         eval $setvar
17528         case "$i_varhdr" in
17529         stdarg.h)
17530                 val="$define"; set i_stdarg; eval $setvar
17531                 val="$undef"; set i_varargs; eval $setvar
17532                 ;;
17533         varargs.h)
17534                 val="$undef"; set i_stdarg; eval $setvar
17535                 val="$define"; set i_varargs; eval $setvar
17536                 ;;
17537         esac
17538         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17539 esac
17540 $rm -f varargs*
17541
17542 : see if we need va_copy
17543 echo " "
17544 case "$i_stdarg" in
17545 "$define")
17546         $cat >try.c <<EOCP
17547 #include <stdarg.h>
17548 #include <stdio.h>
17549 #$i_stdlib I_STDLIB
17550 #ifdef I_STDLIB
17551 #include <stdlib.h>
17552 #endif
17553 #include <signal.h>
17554
17555 int
17556 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17557 {
17558   return vfprintf(f, fmt, *valp);
17559 }
17560  
17561 int    
17562 myvfprintf(FILE *f, const  char *fmt, va_list val)
17563 {
17564   return ivfprintf(f, fmt, &val);
17565 }
17566       
17567 int
17568 myprintf(char *fmt, ...) 
17569 {
17570   va_list val;
17571   va_start(val, fmt);
17572   return myvfprintf(stdout, fmt, val); 
17573 }         
17574
17575 int
17576 main(int ac, char **av)
17577 {
17578   signal(SIGSEGV, exit);
17579
17580   myprintf("%s%cs all right, then\n", "that", '\'');                            
17581   exit(0);      
17582 }
17583 EOCP
17584         set try
17585         if eval $compile && $run ./try 2>&1 >/dev/null; then
17586                 case "`$run ./try`" in
17587                 "that's all right, then")
17588                         okay=yes
17589                         ;;
17590                 esac
17591         fi
17592         case "$okay" in
17593         yes)    echo "It seems that you don't need va_copy()." >&4
17594                 need_va_copy="$undef"
17595                 ;;
17596         *)      echo "It seems that va_copy() or similar will be needed." >&4
17597                 need_va_copy="$define"
17598                 ;;
17599         esac
17600         $rm -f try.* core core.* *.core *.core.*
17601         ;;
17602 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17603         ;;
17604 esac
17605
17606 : see what type is used for size_t
17607 rp="What is the type used for the length parameter for string functions?"
17608 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17609 eval $typedef_ask
17610
17611 : check for type of arguments to gethostbyaddr. 
17612 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17613         case "$d_gethbyaddr" in
17614         $define)
17615                 $cat <<EOM
17616
17617 Checking to see what type of arguments are accepted by gethostbyaddr().
17618 EOM
17619                 hdrs="$define sys/types.h
17620                         $d_socket sys/socket.h 
17621                         $i_niin netinet/in.h 
17622                         $i_netdb netdb.h
17623                         $i_unistd unistd.h"
17624                 : The first arg can 'char *' or 'void *'
17625                 : The second arg is some of integral type
17626                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17627                         for yyy in size_t long int; do
17628                                 case "$netdb_host_type" in
17629                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17630                                         if ./protochk "$try" $hdrs; then
17631                                                 echo "Your system accepts $xxx for the first arg."
17632                                                 echo "...and $yyy for the second arg."
17633                                                 netdb_host_type="$xxx"
17634                                                 netdb_hlen_type="$yyy"
17635                                         fi
17636                                         ;;
17637                                 esac
17638                         done
17639                 done
17640                 : In case none of those worked, prompt the user.
17641                 case "$netdb_host_type" in
17642                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17643                         dflt='char *'
17644                         . ./myread
17645                         netdb_host_type=$ans
17646                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17647                         dflt="$sizetype"
17648                         . ./myread
17649                         netdb_hlen_type=$ans
17650                         ;;
17651                 esac
17652                 ;;
17653         *)      : no gethostbyaddr, so pick harmless defaults
17654                 netdb_host_type='char *'
17655                 netdb_hlen_type="$sizetype"
17656                 ;;
17657         esac
17658         # Remove the "const" if needed. -- but then we'll have a 
17659         # prototype clash!
17660         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17661 fi
17662
17663 : check for type of argument to gethostbyname. 
17664 if test "X$netdb_name_type" = X ; then
17665         case "$d_gethbyname" in
17666         $define)
17667                 $cat <<EOM
17668
17669 Checking to see what type of argument is accepted by gethostbyname().
17670 EOM
17671                 hdrs="$define sys/types.h
17672                         $d_socket sys/socket.h 
17673                         $i_niin netinet/in.h 
17674                         $i_netdb netdb.h
17675                         $i_unistd unistd.h"
17676                 for xxx in "const char *" "char *"; do
17677                         case "$netdb_name_type" in
17678                         '')     try="extern struct hostent *gethostbyname($xxx);"
17679                                 if ./protochk "$try" $hdrs; then
17680                                         echo "Your system accepts $xxx."
17681                                         netdb_name_type="$xxx"
17682                                 fi
17683                                 ;;
17684                         esac
17685                 done
17686                 : In case none of those worked, prompt the user.
17687                 case "$netdb_name_type" in
17688                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17689                         dflt='char *'
17690                         . ./myread
17691                         netdb_name_type=$ans
17692                         ;;
17693                 esac
17694                 ;;
17695         *)      : no gethostbyname, so pick harmless default
17696                 netdb_name_type='char *'
17697                 ;;
17698         esac
17699 fi
17700
17701 : check for type of 1st argument to getnetbyaddr. 
17702 if test "X$netdb_net_type" = X ; then
17703         case "$d_getnbyaddr" in
17704         $define)
17705                 $cat <<EOM
17706
17707 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17708 EOM
17709                 hdrs="$define sys/types.h
17710                         $d_socket sys/socket.h 
17711                         $i_niin netinet/in.h 
17712                         $i_netdb netdb.h
17713                         $i_unistd unistd.h"
17714                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17715                         case "$netdb_net_type" in
17716                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17717                                 if ./protochk "$try" $hdrs; then
17718                                         echo "Your system accepts $xxx."
17719                                         netdb_net_type="$xxx"
17720                                 fi
17721                                 ;;
17722                         esac
17723                 done
17724                 : In case none of those worked, prompt the user.
17725                 case "$netdb_net_type" in
17726                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17727                         dflt='long'
17728                         . ./myread
17729                         netdb_net_type=$ans
17730                         ;;
17731                 esac
17732                 ;;
17733         *)      : no getnetbyaddr, so pick harmless default
17734                 netdb_net_type='long'
17735                 ;;
17736         esac
17737 fi
17738 : locate the preferred pager for this system
17739 case "$pager" in
17740 '')
17741         dflt=''
17742         case "$pg" in
17743         /*) dflt=$pg;;
17744         [a-zA-Z]:/*) dflt=$pg;;
17745         esac
17746         case "$more" in
17747         /*) dflt=$more;;
17748         [a-zA-Z]:/*) dflt=$more;;
17749         esac
17750         case "$less" in
17751         /*) dflt=$less;;
17752         [a-zA-Z]:/*) dflt=$less;;
17753         esac
17754         case "$dflt" in
17755         '') dflt=/usr/ucb/more;;
17756         esac
17757         ;;
17758 *) dflt="$pager";;
17759 esac
17760 echo " "
17761 fn=f/
17762 rp='What pager is used on your system?'
17763 . ./getfile
17764 pager="$ans"
17765
17766 : see what type pids are declared as in the kernel
17767 rp="What is the type of process ids on this system?"
17768 set pid_t pidtype int stdio.h sys/types.h
17769 eval $typedef_ask
17770
17771 : Find earliest binary compatible site_perl subdirectory perl can use.
17772 case "$bincompat5005" in
17773 "$define") xs_apiversion='5.005' ;;
17774 *) xs_apiversion=$version ;;   # The current site_perl version.
17775 esac
17776 : Find earliest pure perl site_perl subdirectory perl can use.
17777 : The versioned directories started at 5.005.
17778 pm_apiversion='5.005'
17779
17780 : see if ar generates random libraries by itself
17781 echo " "
17782 echo "Checking how to generate random libraries on your machine..." >&4
17783 echo 'int bar1() { return bar2(); }' > bar1.c
17784 echo 'int bar2() { return 2; }' > bar2.c
17785 $cat > foo.c <<'EOP'
17786 int main() { printf("%d\n", bar1()); exit(0); }
17787 EOP
17788 $cc $ccflags -c bar1.c >/dev/null 2>&1
17789 $cc $ccflags -c bar2.c >/dev/null 2>&1
17790 $cc $ccflags -c foo.c >/dev/null 2>&1
17791 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17792 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17793         $run ./foobar >/dev/null 2>&1; then
17794         echo "$ar appears to generate random libraries itself."
17795         orderlib=false
17796         ranlib=":"
17797 elif $ar ts bar$_a >/dev/null 2>&1 &&
17798         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17799         $run ./foobar >/dev/null 2>&1; then
17800                 echo "a table of contents needs to be added with '$ar ts'."
17801                 orderlib=false
17802                 ranlib="$ar ts"
17803 else
17804         case "$ranlib" in
17805         :) ranlib='';;
17806         '')
17807                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17808                 $test -f $ranlib || ranlib=''
17809                 ;;
17810         esac
17811         if $test -n "$ranlib"; then
17812                 echo "your system has '$ranlib'; we'll use that."
17813                 orderlib=false
17814         else
17815                 echo "your system doesn't seem to support random libraries"
17816                 echo "so we'll use lorder and tsort to order the libraries."
17817                 orderlib=true
17818                 ranlib=":"
17819         fi
17820 fi
17821 $rm -f foo* bar* 
17822
17823 : check for type of arguments to select. 
17824 case "$selecttype" in
17825 '') case "$d_select" in
17826         $define)
17827                 echo " "
17828                 $cat <<EOM
17829 Checking to see what type of arguments are accepted by select().
17830 EOM
17831                 hdrs="$define sys/types.h
17832                         $i_systime sys/time.h 
17833                         $i_sysselct sys/select.h
17834                         $d_socket sys/socket.h"
17835                 : The first arg can be int, unsigned, or size_t
17836                 : The last arg may or may not be 'const'
17837                 val=''
17838                 : void pointer has been seen but using that
17839                 : breaks the selectminbits test
17840                 for xxx in 'fd_set *' 'int *'; do
17841                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17842                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17843                                         case "$val" in
17844                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17845                                                 if ./protochk "$try" $hdrs; then
17846                                                         echo "Your system accepts $xxx."
17847                                                         val="$xxx"
17848                                                 fi
17849                                                 ;;
17850                                         esac
17851                                 done
17852                         done
17853                 done
17854                 case "$val" in
17855                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17856                         case "$d_fd_set" in
17857                                 $define) dflt="fd_set *" ;;
17858                                 *)              dflt="int *" ;;
17859                         esac
17860                         . ./myread
17861                         val=$ans
17862                         ;;
17863                 esac
17864                 selecttype="$val"
17865                 ;;
17866         *)      : no select, so pick a harmless default
17867                 selecttype='int *'
17868                 ;;
17869         esac
17870         ;;
17871 esac
17872
17873 : check for the select 'width'
17874 case "$selectminbits" in
17875 '') case "$d_select" in
17876         $define)
17877                 $cat <<EOM
17878
17879 Checking to see on how many bits at a time your select() operates...
17880 EOM
17881                 $cat >try.c <<EOCP
17882 #include <sys/types.h>
17883 #$i_time I_TIME
17884 #$i_systime I_SYS_TIME
17885 #$i_systimek I_SYS_TIME_KERNEL
17886 #ifdef I_TIME
17887 #   include <time.h>
17888 #endif
17889 #ifdef I_SYS_TIME
17890 #   ifdef I_SYS_TIME_KERNEL
17891 #       define KERNEL
17892 #   endif
17893 #   include <sys/time.h>
17894 #   ifdef I_SYS_TIME_KERNEL
17895 #       undef KERNEL
17896 #   endif
17897 #endif
17898 #$i_sysselct I_SYS_SELECT
17899 #ifdef I_SYS_SELECT
17900 #include <sys/select.h>
17901 #endif
17902 #$d_socket HAS_SOCKET
17903 #ifdef HAS_SOCKET
17904 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
17905 #endif
17906 #include <stdio.h>
17907 $selecttype b;
17908 #define S sizeof(*(b))
17909 #define MINBITS 64
17910 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
17911 #define NBITS  (NBYTES * 8)
17912 int main() {
17913     char s[NBYTES];
17914     struct timeval t;
17915     int i;
17916     FILE* fp;
17917     int fd;
17918
17919     fclose(stdin);
17920     fp = fopen("try.c", "r");
17921     if (fp == 0)
17922       exit(1);
17923     fd = fileno(fp);
17924     if (fd < 0)
17925       exit(2);
17926     b = ($selecttype)s;
17927     for (i = 0; i < NBITS; i++)
17928         FD_SET(i, b);
17929     t.tv_sec  = 0;
17930     t.tv_usec = 0;
17931     select(fd + 1, b, 0, 0, &t);
17932     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
17933     printf("%d\n", i + 1);
17934     return 0;
17935 }
17936 EOCP
17937                 set try
17938                 if eval $compile_ok; then
17939                         selectminbits=`$run ./try`
17940                         case "$selectminbits" in
17941                         '')     cat >&4 <<EOM
17942 Cannot figure out on how many bits at a time your select() operates.
17943 I'll play safe and guess it is 32 bits.
17944 EOM
17945                                 selectminbits=32
17946                                 bits="32 bits"
17947                                 ;;
17948                         1)      bits="1 bit" ;;
17949                         *)      bits="$selectminbits bits" ;;
17950                         esac
17951                         echo "Your select() operates on $bits at a time." >&4
17952                 else
17953                         rp='What is the minimum number of bits your select() operates on?'
17954                         case "$byteorder" in
17955                         1234|12345678)  dflt=32 ;;
17956                         *)              dflt=1  ;;
17957                         esac
17958                         . ./myread
17959                         val=$ans
17960                         selectminbits="$val"
17961                 fi
17962                 $rm -f try.* try
17963                 ;;
17964         *)      : no select, so pick a harmless default
17965                 selectminbits='32'
17966                 ;;
17967         esac
17968         ;;
17969 esac
17970
17971 : Trace out the files included by signal.h, then look for SIGxxx names.
17972 : Remove SIGARRAYSIZE used by HPUX.
17973 : Remove SIGSTKSIZE used by Linux.
17974 : Remove SIGSTKSZ used by Posix.
17975 : Remove SIGTYP void lines used by OS2.
17976 : Some cpps, like os390, dont give the file name anywhere
17977 if [ "X$fieldn" = X ]; then
17978         : Just make some guesses.  We check them later.
17979         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
17980 else
17981         xxx=`echo '#include <signal.h>' |
17982         $cppstdin $cppminus $cppflags 2>/dev/null |
17983         $grep '^[       ]*#.*include' | 
17984         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
17985 fi
17986 : Check this list of files to be sure we have parsed the cpp output ok.
17987 : This will also avoid potentially non-existent files, such 
17988 : as ../foo/bar.h
17989 xxxfiles=''
17990 for xx in $xxx /dev/null ; do
17991         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
17992 done
17993 : If we have found no files, at least try signal.h
17994 case "$xxxfiles" in
17995 '')     xxxfiles=`./findhdr signal.h` ;;
17996 esac
17997 xxx=`awk '
17998 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
17999         print substr($2, 4, 20)
18000 }
18001 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18002         print substr($3, 4, 20)
18003 }' $xxxfiles`
18004 : Append some common names just in case the awk scan failed.
18005 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18006 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18007 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18008 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18009 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18010
18011 : generate a few handy files for later
18012 $cat > signal.c <<'EOCP'
18013 #include <sys/types.h>
18014 #include <signal.h>
18015 #include <stdio.h>
18016 int main() {
18017
18018 /* Strange style to avoid deeply-nested #if/#else/#endif */
18019 #ifndef NSIG
18020 #  ifdef _NSIG
18021 #    define NSIG (_NSIG)
18022 #  endif
18023 #endif
18024
18025 #ifndef NSIG
18026 #  ifdef SIGMAX
18027 #    define NSIG (SIGMAX+1)
18028 #  endif
18029 #endif
18030
18031 #ifndef NSIG
18032 #  ifdef SIG_MAX
18033 #    define NSIG (SIG_MAX+1)
18034 #  endif
18035 #endif
18036
18037 #ifndef NSIG
18038 #  ifdef MAXSIG
18039 #    define NSIG (MAXSIG+1)
18040 #  endif
18041 #endif
18042
18043 #ifndef NSIG
18044 #  ifdef MAX_SIG
18045 #    define NSIG (MAX_SIG+1)
18046 #  endif
18047 #endif
18048
18049 #ifndef NSIG
18050 #  ifdef SIGARRAYSIZE
18051 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18052 #  endif
18053 #endif
18054
18055 #ifndef NSIG
18056 #  ifdef _sys_nsig
18057 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18058 #  endif
18059 #endif
18060
18061 /* Default to some arbitrary number that's big enough to get most
18062    of the common signals.
18063 */
18064 #ifndef NSIG
18065 #    define NSIG 50
18066 #endif
18067
18068 printf("NSIG %d\n", NSIG);
18069
18070 #ifndef JUST_NSIG
18071
18072 EOCP
18073
18074 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18075 {
18076         printf "#ifdef SIG"; printf $1; printf "\n"
18077         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18078         printf $1; printf ");\n"
18079         printf "#endif\n"
18080 }
18081 END {
18082         printf "#endif /* JUST_NSIG */\n";
18083         printf "exit(0);\n}\n";
18084 }
18085 ' >>signal.c
18086 $cat >signal.awk <<'EOP'
18087 BEGIN { ndups = 0 }
18088 $1 ~ /^NSIG$/ { nsig = $2 }
18089 ($1 !~ /^NSIG$/) && (NF == 2) {
18090     if ($2 > maxsig) { maxsig = $2 }
18091     if (sig_name[$2]) {
18092         dup_name[ndups] = $1
18093         dup_num[ndups] = $2
18094         ndups++ 
18095     }
18096     else {
18097         sig_name[$2] = $1
18098         sig_num[$2] = $2
18099     }
18100 }
18101 END { 
18102     if (nsig == 0) {
18103         nsig = maxsig + 1
18104     }
18105     printf("NSIG %d\n", nsig);
18106     for (n = 1; n < nsig; n++) {
18107         if (sig_name[n]) {
18108             printf("%s %d\n", sig_name[n], sig_num[n])
18109         }
18110         else {
18111             printf("NUM%d %d\n", n, n) 
18112         }
18113     }
18114     for (n = 0; n < ndups; n++) {
18115         printf("%s %d\n", dup_name[n], dup_num[n])
18116     }
18117 }
18118 EOP
18119 $cat >signal_cmd <<EOS
18120 $startsh
18121 if $test -s signal.lst; then
18122     echo "Using your existing signal.lst file"
18123         exit 0
18124 fi
18125 xxx="$xxx"
18126 EOS
18127 $cat >>signal_cmd <<'EOS'
18128
18129 set signal
18130 if eval $compile_ok; then
18131         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18132 else
18133         echo "(I can't seem be able to compile the whole test program)" >&4
18134         echo "(I'll try it in little pieces.)" >&4
18135         set signal -DJUST_NSIG
18136         if eval $compile_ok; then
18137                 $run ./signal$_exe > signal.nsg
18138                 $cat signal.nsg
18139         else
18140                 echo "I can't seem to figure out how many signals you have." >&4
18141                 echo "Guessing 50." >&4
18142                 echo 'NSIG 50' > signal.nsg
18143         fi
18144         : Now look at all the signal names, one at a time.
18145         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18146                 $cat > signal.c <<EOCP
18147 #include <sys/types.h>
18148 #include <signal.h>
18149 #include <stdio.h>
18150 int main() {
18151 printf("$xx %d\n", SIG${xx});
18152 return 0;
18153 }
18154 EOCP
18155                 set signal
18156                 if eval $compile; then
18157                         echo "SIG${xx} found."
18158                         $run ./signal$_exe  >> signal.ls1
18159                 else
18160                         echo "SIG${xx} NOT found."
18161                 fi
18162         done
18163         if $test -s signal.ls1; then
18164                 $cat signal.nsg signal.ls1 |
18165                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18166         fi
18167
18168 fi
18169 if $test -s signal.lst; then
18170         :
18171 else
18172         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18173         echo 'kill -l' >signal
18174         set X `csh -f <signal`
18175         $rm -f signal
18176         shift
18177         case $# in
18178         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18179         esac
18180         echo $@ | $tr ' ' $trnl | \
18181             $awk '{ printf "%s %d\n", $1, ++s; }
18182                   END { printf "NSIG %d\n", ++s }' >signal.lst
18183 fi
18184 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18185 EOS
18186 chmod a+x signal_cmd
18187 $eunicefix signal_cmd
18188
18189 : generate list of signal names
18190 echo " "
18191 case "$sig_name_init" in
18192 '') doinit=yes ;;
18193 *)  case "$sig_num_init" in
18194     ''|*,*) doinit=yes ;;
18195     esac ;;
18196 esac
18197 case "$doinit" in
18198 yes)
18199         echo "Generating a list of signal names and numbers..." >&4
18200         . ./signal_cmd
18201         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18202         sig_name=`$awk 'BEGIN { printf "ZERO " }
18203                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18204         sig_num=`$awk  'BEGIN { printf "0 " }
18205                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18206         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18207                              !/^NSIG/   { printf "\"%s\", ", $1 }
18208                              END        { printf "0\n" }' signal.lst`
18209         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18210                              !/^NSIG/   { printf "%d, ", $2}
18211                              END        { printf "0\n"}' signal.lst`
18212         ;;
18213 esac
18214 echo "The following $sig_count signals are available:"
18215 echo " "
18216 echo $sig_name | $awk \
18217 'BEGIN { linelen = 0 }
18218 {
18219         for (i = 1; i <= NF; i++) {
18220                 name = "SIG" $i " "
18221                 linelen = linelen + length(name)
18222                 if (linelen > 70) {
18223                         printf "\n"
18224                         linelen = length(name)
18225                 }
18226                 printf "%s", name
18227         }
18228         printf "\n"
18229 }'
18230 sig_size=`echo $sig_name | awk '{print NF}'`
18231 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18232
18233 echo " "
18234 case "$sizetype" in
18235 *_t) zzz="$sizetype"    ;;
18236 *)   zzz="filesize"     ;;
18237 esac
18238 echo "Checking the size of $zzz..." >&4 
18239 cat > try.c <<EOCP
18240 #include <sys/types.h>
18241 #include <stdio.h>
18242 int main() {
18243     printf("%d\n", (int)sizeof($sizetype));
18244     exit(0);
18245 }
18246 EOCP
18247 set try
18248 if eval $compile_ok; then
18249         yyy=`$run ./try`
18250         case "$yyy" in
18251         '')     sizesize=4
18252                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18253                 ;;
18254         *)      sizesize=$yyy
18255                 echo "Your $zzz size is $sizesize bytes."
18256                 ;;
18257         esac
18258 else
18259         sizesize=4
18260         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18261 fi
18262
18263
18264 : check for socklen_t
18265 echo " "
18266 echo "Checking to see if you have socklen_t..." >&4
18267 $cat >try.c <<EOCP
18268 #include <sys/types.h>
18269 #$d_socket HAS_SOCKET
18270 #ifdef HAS_SOCKET
18271 #include <sys/socket.h>
18272 #endif
18273 int main() { socklen_t x = 16; }
18274 EOCP
18275 set try
18276 if eval $compile; then
18277         val="$define"
18278         echo "You have socklen_t."
18279 else
18280         val="$undef"
18281         echo "You do not have socklen_t."
18282         case "$sizetype" in
18283         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18284         esac
18285 fi
18286 $rm -f try try.*
18287 set d_socklen_t
18288 eval $setvar
18289
18290 : see if this is a socks.h system
18291 set socks.h i_socks
18292 eval $inhdr
18293
18294 : check for type of the size argument to socket calls
18295 case "$d_socket" in
18296 "$define")
18297         $cat <<EOM
18298
18299 Checking to see what type is the last argument of accept().
18300 EOM
18301         yyy=''
18302         case "$d_socklen_t" in
18303         "$define") yyy="$yyy socklen_t"
18304         esac
18305         yyy="$yyy $sizetype int long unsigned"
18306         for xxx in $yyy; do
18307                 case "$socksizetype" in
18308                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18309                         case "$usesocks" in
18310                         "$define")
18311                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18312                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18313                                         socksizetype="$xxx"
18314                                 fi
18315                                 ;;
18316                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18317                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18318                                         socksizetype="$xxx"
18319                                 fi
18320                                 ;;
18321                         esac
18322                         ;;
18323                 esac
18324         done
18325 : In case none of those worked, prompt the user.
18326         case "$socksizetype" in
18327         '')     rp='What is the type for socket address structure sizes?'
18328                 dflt='int'
18329                 . ./myread
18330                 socksizetype=$ans
18331                 ;;
18332         esac
18333         ;;
18334 *)      : no sockets, so pick relatively harmless default
18335         socksizetype='int'
18336         ;;
18337 esac
18338
18339 : see what type is used for signed size_t
18340 set ssize_t ssizetype int stdio.h sys/types.h
18341 eval $typedef
18342 dflt="$ssizetype"
18343 $cat > try.c <<EOM
18344 #include <stdio.h>
18345 #include <sys/types.h>
18346 #define Size_t $sizetype
18347 #define SSize_t $dflt
18348 int main()
18349 {
18350         if (sizeof(Size_t) == sizeof(SSize_t))
18351                 printf("$dflt\n");
18352         else if (sizeof(Size_t) == sizeof(int))
18353                 printf("int\n");
18354         else 
18355                 printf("long\n");
18356         exit(0);
18357 }
18358 EOM
18359 echo " "
18360 set try
18361 if eval $compile_ok && $run ./try > /dev/null; then
18362         ssizetype=`$run ./try`
18363         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18364 else
18365         $cat >&4 <<EOM
18366 Help! I can't compile and run the ssize_t test program: please enlighten me!
18367 (This is probably a misconfiguration in your system or libraries, and
18368 you really ought to fix it.  Still, I'll try anyway.)
18369
18370 I need a type that is the same size as $sizetype, but is guaranteed to
18371 be signed.  Common values are ssize_t, int and long.
18372
18373 EOM
18374         rp="What signed type is the same size as $sizetype?"
18375         . ./myread
18376         ssizetype="$ans"
18377 fi
18378 $rm -f try try.*
18379
18380 : see what type of char stdio uses.
18381 echo " "
18382 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18383 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18384         echo "Your stdio uses unsigned chars." >&4
18385         stdchar="unsigned char"
18386 else
18387         echo "Your stdio uses signed chars." >&4
18388         stdchar="char"
18389 fi
18390 $rm -f stdioh
18391
18392
18393
18394 : see if time exists
18395 echo " "
18396 if test "X$d_time" = X -o X"$timetype" = X; then
18397     if set time val -f d_time; eval $csym; $val; then
18398                 echo 'time() found.' >&4
18399                 val="$define"
18400                 rp="What is the type returned by time() on this system?"
18401                 set time_t timetype long stdio.h sys/types.h
18402                 eval $typedef_ask
18403     else
18404                 echo 'time() not found, hope that will do.' >&4
18405                 val="$undef"
18406                 timetype='int';
18407     fi
18408     set d_time
18409     eval $setvar
18410 fi
18411
18412 : see what type uids are declared as in the kernel
18413 echo " "
18414 echo "Looking for the type for user ids returned by getuid()."
18415 set uid_t uidtype xxx stdio.h sys/types.h
18416 eval $typedef
18417 case "$uidtype" in
18418 xxx)
18419         xxx=`./findhdr sys/user.h`
18420         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18421         case $1 in
18422         unsigned) dflt="$1 $2" ;;
18423         *) dflt="$1" ;;
18424         esac
18425         ;;
18426 *) dflt="$uidtype";;
18427 esac
18428 case "$uidtype" in
18429 uid_t)  echo "uid_t found." ;;
18430 *)      rp="What is the type for user ids returned by getuid()?"
18431         . ./myread
18432         uidtype="$ans"
18433         ;;
18434 esac
18435
18436 echo " "
18437 case "$uidtype" in
18438 *_t) zzz="$uidtype"     ;;
18439 *)   zzz="uid"          ;;
18440 esac
18441 echo "Checking the size of $zzz..." >&4 
18442 cat > try.c <<EOCP
18443 #include <sys/types.h>
18444 #include <stdio.h>
18445 int main() {
18446     printf("%d\n", (int)sizeof($uidtype));
18447     exit(0);
18448 }
18449 EOCP
18450 set try
18451 if eval $compile_ok; then
18452         yyy=`$run ./try`
18453         case "$yyy" in
18454         '')     uidsize=4
18455                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18456                 ;;
18457         *)      uidsize=$yyy
18458                 echo "Your $zzz is $uidsize bytes long."
18459                 ;;
18460         esac
18461 else
18462         uidsize=4
18463         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18464 fi
18465
18466 echo " "
18467 case "$uidtype" in
18468 *_t) zzz="$uidtype"     ;;
18469 *)   zzz="uid"          ;;
18470 esac
18471 echo "Checking the sign of $zzz..." >&4
18472 cat > try.c <<EOCP
18473 #include <sys/types.h>
18474 #include <stdio.h>
18475 int main() {
18476         $uidtype foo = -1;
18477         if (foo < 0)
18478                 printf("-1\n");
18479         else
18480                 printf("1\n");
18481 }
18482 EOCP
18483 set try
18484 if eval $compile; then
18485         yyy=`$run ./try`
18486         case "$yyy" in
18487         '')     uidsign=1
18488                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18489                 ;;
18490         *)      uidsign=$yyy
18491                 case "$uidsign" in
18492                  1) echo "Your $zzz is unsigned." ;;
18493                 -1) echo "Your $zzz is signed."   ;;
18494                 esac
18495                 ;;
18496         esac
18497 else
18498         uidsign=1
18499         echo "(I can't compile the test program--guessing unsigned.)" >&4
18500 fi
18501
18502
18503
18504 echo " "
18505 $echo "Checking the format string to be used for uids..." >&4
18506
18507 case "$uidsign" in
18508 -1)     if $test X"$uidsize" = X"$ivsize"; then
18509                 uidformat="$ivdformat"
18510         else
18511                 if $test X"$uidsize" = X"$longsize"; then
18512                         uidformat='"ld"'
18513                 else
18514                         if $test X"$uidsize" = X"$intsize"; then
18515                                 uidformat='"d"'
18516                         else
18517                                 if $test X"$uidsize" = X"$shortsize"; then
18518                                         uidformat='"hd"'
18519                                 fi
18520                         fi
18521                 fi
18522         fi
18523         ;;
18524 *)      if $test X"$uidsize" = X"$uvsize"; then
18525                 uidformat="$uvuformat"
18526         else
18527                 if $test X"$uidsize" = X"$longsize"; then
18528                         uidformat='"lu"'
18529                 else
18530                         if $test X"$uidsize" = X"$intsize"; then
18531                                 uidformat='"u"'
18532                         else
18533                                 if $test X"$uidsize" = X"$shortsize"; then
18534                                         uidformat='"hu"'
18535                                 fi
18536                         fi
18537                 fi
18538         fi
18539         ;;
18540 esac
18541
18542 : determine compiler compiler
18543 case "$yacc" in
18544 '')
18545         dflt=yacc;;
18546 *)
18547         dflt="$yacc";;
18548 esac
18549 echo " "
18550 comp='yacc'
18551 if $test -f "$byacc$_exe"; then
18552         dflt="$byacc"
18553         comp="byacc or $comp"
18554 fi
18555 if $test -f "$bison$_exe"; then
18556         comp="$comp or bison -y"
18557 fi
18558 rp="Which compiler compiler ($comp) shall I use?"
18559 . ./myread
18560 yacc="$ans"
18561 case "$yacc" in
18562 *bis*)
18563         case "$yacc" in
18564         *-y*) ;;
18565         *)
18566                 yacc="$yacc -y"
18567                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18568                 ;;
18569         esac
18570         ;;
18571 esac
18572
18573 : see if this is a fp.h system
18574 set fp.h i_fp
18575 eval $inhdr
18576
18577 : see if this is a fp_class.h system
18578 set fp_class.h i_fp_class
18579 eval $inhdr
18580
18581 : see if this is a ieeefp.h system
18582 case "$i_ieeefp" in
18583 '' ) set ieeefp.h i_ieeefp
18584      eval $inhdr
18585      ;;
18586 esac
18587
18588 : see if this is a libutil.h system
18589 set libutil.h i_libutil
18590 eval $inhdr
18591
18592 : see if mach cthreads are available
18593 if test "X$usethreads" = "X$define"; then
18594         set mach/cthreads.h i_machcthr
18595         eval $inhdr
18596 else
18597         i_machcthr="$undef"
18598 fi
18599
18600
18601
18602 : see if this is a math.h system
18603 set math.h i_math
18604 eval $inhdr
18605
18606 : see if this is a mntent.h system
18607 set mntent.h i_mntent
18608 eval $inhdr
18609
18610 : see if ndbm.h is available
18611 set ndbm.h t_ndbm
18612 eval $inhdr
18613
18614 case "$t_ndbm" in
18615 $undef)
18616     # Some Linux distributions such as RedHat 7.1 put the
18617     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18618     if $test -f /usr/include/gdbm/ndbm.h; then
18619         echo '<gdbm/ndbm.h> found.'
18620         ccflags="$ccflags -I/usr/include/gdbm"
18621         cppflags="$cppflags -I/usr/include/gdbm"
18622         t_ndbm=$define
18623     fi
18624     ;;
18625 esac
18626
18627 case "$t_ndbm" in
18628 $define)
18629         : see if dbm_open exists
18630         set dbm_open d_dbm_open
18631         eval $inlibc
18632         case "$d_dbm_open" in
18633         $undef)
18634                 t_ndbm="$undef"
18635                 echo "We won't be including <ndbm.h>"
18636                 ;;
18637         esac
18638         ;;
18639 esac
18640 val="$t_ndbm"
18641 set i_ndbm
18642 eval $setvar
18643
18644 : see if net/errno.h is available
18645 val=''
18646 set net/errno.h val
18647 eval $inhdr
18648
18649 : Unfortunately, it causes problems on some systems.  Arrgh.
18650 case "$val" in
18651 $define)
18652         cat > try.c <<'EOM'
18653 #include <stdio.h>
18654 #include <errno.h>
18655 #include <net/errno.h>
18656 int func()
18657 {
18658         return ENOTSOCK;
18659 }
18660 EOM
18661         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18662                 echo "We'll be including <net/errno.h>." >&4
18663         else
18664                 echo "We won't be including <net/errno.h>." >&4
18665                 val="$undef"
18666         fi
18667         $rm -f try.* try
18668         ;;
18669 esac
18670 set i_neterrno
18671 eval $setvar
18672
18673 : see if netinet/tcp.h is available
18674 set netinet/tcp.h i_netinettcp
18675 eval $inhdr
18676
18677 : see if this is a poll.h system
18678 set poll.h i_poll
18679 eval $inhdr
18680
18681 : see if this is a prot.h system
18682 set prot.h i_prot
18683 eval $inhdr
18684
18685 echo " "
18686 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18687 $cat <<'EOSH' > Cppsym.know
18688 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18689 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18690 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18691 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18692 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18693 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18694 bull c cadmus clipper CMU COFF COMPILER_VERSION
18695 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18696 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18697 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18698 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18699 GLIBC GLIBC_MINOR
18700 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18701 H3050R H3050RX hbullx20 hcx host_mips
18702 hp200 hp300 hp700 HP700 hp800 hp9000
18703 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18704 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18705 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18706 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18707 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18708 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18709 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18710 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18711 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18712 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18713 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18714 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18715 MATH_HAS_NO_SIDE_EFFECTS
18716 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18717 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18718 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18719 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18720 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18721 NetBSD news1500 news1700 news1800 news1900 news3700
18722 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18723 ns32016 ns32332 ns32k nsc32000
18724 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18725 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18726 pc532 pdp11 PGC PIC plexus PORTAR posix
18727 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18728 POSIX_C_SOURCE POSIX_SOURCE POWER
18729 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18730 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18731 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18732 sony sony_news sonyrisc sparc sparclite spectrum
18733 stardent stdc STDC_EXT stratos sun sun3 sun386
18734 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18735 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18736 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18737 sysV68 sysV88 Tek4132 Tek4300 titan
18738 TM3200 TM5400 TM5600
18739 tower tower32 tower32_200 tower32_600 tower32_700
18740 tower32_800 tower32_850 tss
18741 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18742 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18743 unix UNIX95 UNIX99 unixpc unos
18744 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18745 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18746 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18747 USGr4 USGr4_2
18748 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18749 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18750 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18751 z8000
18752 EOSH
18753 # Maybe put other stuff here too.
18754 cat <<EOSH >>Cppsym.know
18755 $osname
18756 EOSH
18757 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18758 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18759 $cat Cppsym.know > Cppsym.c
18760 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18761 $rm -f Cppsym.a Cppsym.b Cppsym.c
18762 cat <<EOSH > Cppsym
18763 $startsh
18764 if $test \$# -gt 0; then
18765     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18766     if $test -s Cppsym.got; then
18767         $rm -f Cppsym.got
18768         exit 0
18769     fi
18770     $rm -f Cppsym.got
18771     exit 1
18772 else
18773     $tr " " "$trnl" | ./Cppsym.try
18774     exit 0
18775 fi
18776 EOSH
18777 chmod +x Cppsym
18778 $eunicefix Cppsym
18779 cat <<EOSH > Cppsym.try
18780 $startsh
18781 cat <<'EOCP' > try.c
18782 #include <stdio.h>
18783 int main() {
18784 EOCP
18785 $awk \\
18786 EOSH
18787 cat <<'EOSH' >> Cppsym.try
18788 'length($1) > 0 {
18789     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
18790     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
18791     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
18792     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
18793 }'       >> try.c
18794 echo 'return 0;}' >> try.c
18795 EOSH
18796 cat <<EOSH >> Cppsym.try
18797 ccflags="$ccflags"
18798 case "$osname-$gccversion" in
18799 irix-) ccflags="\$ccflags -woff 1178" ;;
18800 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18801 esac
18802 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18803 EOSH
18804 chmod +x Cppsym.try
18805 $eunicefix Cppsym.try
18806 ./Cppsym < Cppsym.know > Cppsym.true
18807 : now check the C compiler for additional symbols
18808 postprocess_cc_v=''
18809 case "$osname" in
18810 aix) postprocess_cc_v="|$tr , ' '" ;;
18811 esac
18812 $cat >ccsym <<EOS
18813 $startsh
18814 $cat >tmp.c <<EOF
18815 extern int foo;
18816 EOF
18817 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18818 do
18819         case "\$i" in
18820         -D*) echo "\$i" | $sed 's/^-D//';;
18821         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
18822         esac
18823 done
18824 $rm -f try.c
18825 EOS
18826 postprocess_cc_v=''
18827 chmod +x ccsym
18828 $eunicefix ccsym
18829 ./ccsym > ccsym1.raw
18830 if $test -s ccsym1.raw; then
18831        $sort ccsym1.raw | $uniq >ccsym.raw
18832 else
18833        mv ccsym1.raw ccsym.raw
18834 fi
18835
18836 $awk '/\=/ { print $0; next }
18837         { print $0"=1" }' ccsym.raw >ccsym.list
18838 $awk '/\=/ { print $0; next }
18839         { print $0"=1" }' Cppsym.true >ccsym.true
18840 $comm -13 ccsym.true ccsym.list >ccsym.own
18841 $comm -12 ccsym.true ccsym.list >ccsym.com
18842 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18843 also=''
18844 if $test -z ccsym.raw; then
18845         echo "Your C compiler doesn't seem to define any symbols!" >&4
18846         echo " "
18847         echo "However, your C preprocessor defines the following symbols:"
18848         $cat Cppsym.true
18849         ccsymbols=''
18850         cppsymbols=`$cat Cppsym.true`
18851         cppsymbols=`echo $cppsymbols`
18852         cppccsymbols="$cppsymbols"
18853 else
18854         if $test -s ccsym.com; then
18855                 echo "Your C compiler and pre-processor define these symbols:"
18856                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18857                 also='also '
18858                 symbols='ones'
18859                 cppccsymbols=`$cat ccsym.com`
18860                 cppccsymbols=`echo $cppccsymbols`
18861                 $test "$silent" || sleep 1
18862         fi
18863         if $test -s ccsym.cpp; then
18864                 $test "$also" && echo " "
18865                 echo "Your C pre-processor ${also}defines the following symbols:"
18866                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18867                 also='further '
18868                 cppsymbols=`$cat ccsym.cpp`
18869                 cppsymbols=`echo $cppsymbols`
18870                 $test "$silent" || sleep 1
18871         fi
18872         if $test -s ccsym.own; then
18873                 $test "$also" && echo " "
18874                 echo "Your C compiler ${also}defines the following cpp symbols:"
18875                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18876                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18877                 ccsymbols=`$cat ccsym.own`
18878                 ccsymbols=`echo $ccsymbols`
18879                 $test "$silent" || sleep 1
18880         fi
18881 fi
18882
18883 : see if this is a termio system
18884 val="$undef"
18885 val2="$undef"
18886 val3="$undef"
18887 if $test `./findhdr termios.h`; then
18888         set tcsetattr i_termios
18889         eval $inlibc
18890         val3="$i_termios"
18891 fi
18892 echo " "
18893 case "$val3" in
18894 "$define") echo "You have POSIX termios.h... good!" >&4;;
18895 *) if ./Cppsym pyr; then
18896                 case "`/bin/universe`" in
18897                 ucb) if $test `./findhdr sgtty.h`; then
18898                                 val2="$define"
18899                                 echo "<sgtty.h> found." >&4
18900                         else
18901                                 echo "System is pyramid with BSD universe."
18902                                 echo "<sgtty.h> not found--you could have problems." >&4
18903                         fi;;
18904                 *) if $test `./findhdr termio.h`; then
18905                                 val="$define"
18906                                 echo "<termio.h> found." >&4
18907                         else
18908                                 echo "System is pyramid with USG universe."
18909                                 echo "<termio.h> not found--you could have problems." >&4
18910                         fi;;
18911                 esac
18912         elif ./usg; then
18913                 if $test `./findhdr termio.h`; then
18914                         echo "<termio.h> found." >&4
18915                         val="$define"
18916                 elif $test `./findhdr sgtty.h`; then
18917                         echo "<sgtty.h> found." >&4
18918                         val2="$define"
18919                 else
18920 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
18921                 fi
18922         else
18923                 if $test `./findhdr sgtty.h`; then
18924                         echo "<sgtty.h> found." >&4
18925                         val2="$define"
18926                 elif $test `./findhdr termio.h`; then
18927                         echo "<termio.h> found." >&4
18928                         val="$define"
18929                 else
18930 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
18931                 fi
18932         fi;;
18933 esac
18934 set i_termio; eval $setvar
18935 val=$val2; set i_sgtty; eval $setvar
18936 val=$val3; set i_termios; eval $setvar
18937
18938 : see if stddef is available
18939 set stddef.h i_stddef
18940 eval $inhdr
18941
18942 : see if this is a sunmath.h system
18943 set sunmath.h i_sunmath
18944 eval $inhdr
18945
18946 : see if sys/access.h is available
18947 set sys/access.h i_sysaccess
18948 eval $inhdr
18949
18950 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
18951 set sys/filio.h i_sysfilio
18952 eval $inhdr
18953 echo " "
18954 if $test `./findhdr sys/ioctl.h`; then
18955         val="$define"
18956         echo '<sys/ioctl.h> found.' >&4
18957 else
18958         val="$undef"
18959         if $test $i_sysfilio = "$define"; then
18960             echo '<sys/ioctl.h> NOT found.' >&4
18961         else
18962                 $test $i_sgtty = "$define" && xxx="sgtty.h"
18963                 $test $i_termio = "$define" && xxx="termio.h"
18964                 $test $i_termios = "$define" && xxx="termios.h"
18965 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
18966         fi
18967 fi
18968 set i_sysioctl
18969 eval $setvar
18970
18971 : see if socket ioctl defs are in sys/sockio.h
18972 echo " "
18973 xxx=`./findhdr sys/sockio.h`
18974 if $test "$xxx"; then
18975         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
18976                 val="$define"
18977                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
18978         else
18979                 val="$undef"
18980                 echo "No socket ioctls found in <sys/sockio.h>." >&4
18981         fi
18982 else
18983         val="$undef"
18984         $cat <<EOM
18985 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
18986 EOM
18987 fi
18988 set i_syssockio
18989 eval $setvar
18990
18991
18992 : see if this is a syslog.h system
18993 set syslog.h i_syslog
18994 eval $inhdr
18995
18996
18997 : see if this is a sys/mode.h system
18998 set sys/mode.h i_sysmode
18999 eval $inhdr
19000
19001 : see if sys/resource.h has to be included
19002 set sys/resource.h i_sysresrc
19003 eval $inhdr
19004
19005 : see if sys/security.h is available
19006 set sys/security.h i_syssecrt
19007 eval $inhdr
19008
19009 : see if this is a sys/statvfs.h system
19010 set sys/statvfs.h i_sysstatvfs
19011 eval $inhdr
19012
19013 : see if this is a sys/un.h system
19014 set sys/un.h i_sysun
19015 eval $inhdr
19016
19017
19018 : see if this is a sys/utsname.h system
19019 set sys/utsname.h i_sysutsname
19020 eval $inhdr
19021
19022 : see if this is a syswait system
19023 set sys/wait.h i_syswait
19024 eval $inhdr
19025
19026 : see if this is a ustat.h system
19027 set ustat.h i_ustat
19028 eval $inhdr
19029
19030 : see if this is an utime system
19031 set utime.h i_utime
19032 eval $inhdr
19033
19034 : see if this is a values.h system
19035 set values.h i_values
19036 eval $inhdr
19037
19038 : see if this is a vfork system
19039 case "$d_vfork" in
19040 "$define")
19041         set vfork.h i_vfork
19042         eval $inhdr
19043         ;;
19044 *)
19045         i_vfork="$undef"
19046         ;;
19047 esac
19048
19049 : see if gdbm.h is available
19050 set gdbm.h t_gdbm
19051 eval $inhdr
19052 case "$t_gdbm" in
19053 $define)
19054         : see if gdbm_open exists
19055         set gdbm_open d_gdbm_open
19056         eval $inlibc
19057         case "$d_gdbm_open" in
19058         $undef)
19059                 t_gdbm="$undef"
19060                 echo "We won't be including <gdbm.h>"
19061                 ;;
19062         esac
19063         ;;
19064 esac
19065 val="$t_gdbm"
19066 set i_gdbm
19067 eval $setvar
19068
19069 echo " "
19070 echo "Looking for extensions..." >&4
19071 : If we are using the old config.sh, known_extensions may contain
19072 : old or inaccurate or duplicate values.
19073 known_extensions=''
19074 nonxs_extensions=''
19075 : We do not use find because it might not be available.
19076 : We do not just use MANIFEST because the user may have dropped
19077 : some additional extensions into the source tree and expect them
19078 : to be built.
19079
19080 : Function to recursively find available extensions, ignoring DynaLoader
19081 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19082 find_extensions='
19083     for xxx in *; do
19084        case "$xxx" in
19085            DynaLoader|dynaload) ;;
19086            *)
19087            if $test -f $xxx/$xxx.xs; then
19088                known_extensions="$known_extensions $1$xxx";
19089            elif $test -f $xxx/Makefile.PL; then
19090                nonxs_extensions="$nonxs_extensions $1$xxx";
19091            else
19092                if $test -d $xxx -a $# -lt 10; then
19093                    set $1$xxx/ $*;
19094                    cd "$xxx";
19095                    eval $find_extensions;
19096                    cd ..;
19097                    shift;
19098                fi;
19099            fi
19100            ;;
19101        esac;
19102     done'
19103 tdir=`pwd`
19104 cd "$rsrc/ext"
19105 set X
19106 shift
19107 eval $find_extensions
19108 # Special case:  Add in threads/shared since it is not picked up by the
19109 # recursive find above (and adding in general recursive finding breaks
19110 # SDBM_File/sdbm).  A.D.  10/25/2001.
19111 # Encode::XX need explicit mentions for the same reason.
19112 # --jhi 2002-03-04
19113 known_extensions="$known_extensions threads/shared Encode/CN Encode/JP Encode/KR Encode/TW"
19114 set X $nonxs_extensions
19115 shift
19116 nonxs_extensions="$*"
19117 set X $known_extensions
19118 shift
19119 known_extensions="$*"
19120 cd "$tdir"
19121
19122 : Now see which are supported on this system.
19123 avail_ext=''
19124 for xxx in $known_extensions ; do
19125         case "$xxx" in
19126         DB_File|db_file)
19127                 case "$i_db" in
19128                 $define) avail_ext="$avail_ext $xxx" ;;
19129                 esac
19130                 ;;
19131         GDBM_File|gdbm_fil)
19132                 case "$i_gdbm" in 
19133                 $define) avail_ext="$avail_ext $xxx" ;;
19134                 esac
19135                 ;;
19136         I18N/Langinfo|i18n_lan)
19137                 case "$i_langinfo$d_nl_langinfo" in 
19138                 $define$define) avail_ext="$avail_ext $xxx" ;;
19139                 esac
19140                 ;;
19141         NDBM_File|ndbm_fil)
19142                 case "$i_ndbm" in
19143                 $define)
19144                     case "$osname-$use64bitint" in
19145                     cygwin-*|hpux-define)
19146                         case "$libs" in
19147                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19148                         esac
19149                         ;;
19150                     *) avail_ext="$avail_ext $xxx" ;;
19151                     esac
19152                     ;;
19153                 esac
19154                 ;;
19155         ODBM_File|odbm_fil) 
19156                 case "${i_dbm}${i_rpcsvcdbm}" in
19157                 *"${define}"*)
19158                     case "$osname-$use64bitint" in
19159                     cygwin-*|hpux-define)
19160                         case "$libs" in
19161                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19162                         esac
19163                         ;;
19164                     *) avail_ext="$avail_ext $xxx" ;;
19165                     esac
19166                     ;;
19167                 esac
19168                 ;;
19169         POSIX|posix)
19170                 case "$useposix" in
19171                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19172                 esac
19173                 ;;
19174         Opcode|opcode)
19175                 case "$useopcode" in
19176                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19177                 esac
19178                 ;;
19179         Socket|socket)
19180                 case "$d_socket" in 
19181                 true|$define|y)
19182                     case "$osname" in
19183                     beos) ;; # not unless BONE
19184                     *) avail_ext="$avail_ext $xxx" ;;
19185                     esac
19186                     ;;
19187                 esac
19188                 ;;
19189         Sys/Syslog|sys/syslog)
19190                 : XXX syslog requires socket
19191                 case "$d_socket" in 
19192                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19193                 esac
19194                 ;;
19195         Thread|thread)
19196                 case "$usethreads" in
19197                 true|$define|y)
19198                         case "$useithreads" in
19199                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19200                         esac
19201                 esac
19202                 ;;
19203         threads|threads/shared)
19204                 case "$usethreads" in
19205                 true|$define|y)
19206                         case "$useithreads" in
19207                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
19208                         esac
19209                 esac
19210                 ;;
19211         IPC/SysV|ipc/sysv)
19212                 : XXX Do we need a useipcsysv variable here
19213                 case "${d_msg}${d_sem}${d_shm}" in 
19214                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19215                 esac
19216                 ;;
19217         *)      avail_ext="$avail_ext $xxx"
19218                 ;;
19219         esac
19220 done
19221
19222 set X $avail_ext
19223 shift
19224 avail_ext="$*"
19225
19226 : Now see which nonxs extensions are supported on this system.
19227 : For now assume all are.
19228 nonxs_ext=''
19229 for xxx in $nonxs_extensions ; do
19230         case "$xxx" in
19231         *)      nonxs_ext="$nonxs_ext $xxx"
19232                 ;;
19233         esac
19234 done
19235
19236 set X $nonxs_ext
19237 shift
19238 nonxs_ext="$*"
19239
19240 case $usedl in
19241 $define)
19242         $cat <<EOM
19243 A number of extensions are supplied with $package.  You may choose to
19244 compile these extensions for dynamic loading (the default), compile
19245 them into the $package executable (static loading), or not include
19246 them at all.  Answer "none" to include no extensions.
19247 Note that DynaLoader is always built and need not be mentioned here.
19248
19249 EOM
19250         case "$dynamic_ext" in
19251         '') dflt="$avail_ext" ;;
19252         *)      dflt="$dynamic_ext"
19253                 # Perhaps we are reusing an old out-of-date config.sh.
19254                 case "$hint" in
19255                 previous)
19256                         if test X"$dynamic_ext" != X"$avail_ext"; then
19257                                 $cat <<EOM
19258 NOTICE:  Your previous config.sh list may be incorrect. 
19259 The extensions now available to you are 
19260         ${avail_ext}
19261 but the default list from your previous config.sh is
19262         ${dynamic_ext} 
19263
19264 EOM
19265                         fi
19266                         ;;
19267                 esac
19268                 ;;
19269         esac
19270         case "$dflt" in
19271         '')     dflt=none;;
19272         esac
19273         rp="What extensions do you wish to load dynamically?"
19274         . ./myread
19275         case "$ans" in
19276         none) dynamic_ext=' ' ;;
19277         *) dynamic_ext="$ans" ;;
19278         esac
19279
19280         case "$static_ext" in
19281         '')
19282                 : Exclude those already listed in dynamic linking
19283                 dflt=''
19284                 for xxx in $avail_ext; do
19285                         case " $dynamic_ext " in
19286                         *" $xxx "*) ;;
19287                         *) dflt="$dflt $xxx" ;;
19288                         esac
19289                 done
19290                 set X $dflt
19291                 shift
19292                 dflt="$*"
19293                 ;;
19294         *)  dflt="$static_ext" 
19295                 ;;
19296         esac
19297
19298         case "$dflt" in
19299         '')     dflt=none;;
19300         esac
19301         rp="What extensions do you wish to load statically?"
19302         . ./myread
19303         case "$ans" in
19304         none) static_ext=' ' ;;
19305         *) static_ext="$ans" ;;
19306         esac
19307         ;;
19308 *)
19309         $cat <<EOM
19310 A number of extensions are supplied with $package.  Answer "none" 
19311 to include no extensions. 
19312 Note that DynaLoader is always built and need not be mentioned here.
19313
19314 EOM
19315         case "$static_ext" in
19316         '') dflt="$avail_ext" ;;
19317         *)      dflt="$static_ext"
19318                 # Perhaps we are reusing an old out-of-date config.sh.
19319                 case "$hint" in
19320                 previous)
19321                         if test X"$static_ext" != X"$avail_ext"; then
19322                                 $cat <<EOM
19323 NOTICE:  Your previous config.sh list may be incorrect. 
19324 The extensions now available to you are 
19325         ${avail_ext}
19326 but the default list from your previous config.sh is
19327         ${static_ext} 
19328
19329 EOM
19330                         fi
19331                         ;;
19332                 esac
19333                 ;;
19334         esac
19335         : Exclude those that are not xs extensions
19336         case "$dflt" in
19337         '')     dflt=none;;
19338         esac
19339         rp="What extensions do you wish to include?"
19340         . ./myread
19341         case "$ans" in
19342         none) static_ext=' ' ;;
19343         *) static_ext="$ans" ;;
19344         esac
19345         ;;
19346 esac
19347
19348 set X $dynamic_ext $static_ext $nonxs_ext
19349 shift
19350 extensions="$*"
19351
19352 : Remove libraries needed only for extensions
19353 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19354 : The exception is SunOS 4.x, which needs them.
19355 case "${osname}X${osvers}" in
19356 sunos*X4*)
19357     perllibs="$libs"
19358     ;;
19359 *) case "$usedl" in
19360     $define|true|[yY]*)
19361             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19362             shift
19363             perllibs="$*"
19364             ;;
19365     *)  perllibs="$libs"
19366             ;;
19367     esac
19368     ;;
19369 esac
19370
19371 : Remove build directory name from cppstdin so it can be used from
19372 : either the present location or the final installed location.
19373 echo " "
19374 : Get out of the UU directory to get correct path name.
19375 cd ..
19376 case "$cppstdin" in
19377 `pwd`/cppstdin)
19378         echo "Stripping down cppstdin path name"
19379         cppstdin=cppstdin
19380         ;;
19381 esac
19382 cd UU
19383
19384 : end of configuration questions
19385 echo " "
19386 echo "End of configuration questions."
19387 echo " "
19388
19389 : back to where it started
19390 if test -d ../UU; then
19391         cd ..
19392 fi
19393
19394 : configuration may be patched via a 'config.arch' file
19395 if $test -f config.arch; then
19396         echo "I see a config.arch file, loading it."
19397         . ./config.arch
19398 fi
19399
19400 : configuration may be patched via a 'config.over' file
19401 if $test -f config.over; then
19402         echo " "
19403         dflt=y
19404         rp='I see a config.over file.  Do you wish to load it?'
19405         . UU/myread
19406         case "$ans" in
19407         n*) echo "OK, I'll ignore it.";;
19408         *)      . ./config.over
19409                 echo "Configuration override changes have been loaded."
19410                 ;;
19411         esac
19412 fi
19413
19414 : in case they want portability, strip down executable paths
19415 case "$d_portable" in
19416 "$define")
19417         echo " "
19418         echo "Stripping down executable paths..." >&4
19419         for file in $loclist $trylist; do
19420                 eval temp=\$$file
19421                 eval $file=`basename $temp`
19422         done
19423         ;;
19424 esac
19425
19426 : create config.sh file
19427 echo " "
19428 echo "Creating config.sh..." >&4
19429 $spitshell <<EOT >config.sh
19430 $startsh
19431 #
19432 # This file was produced by running the Configure script. It holds all the
19433 # definitions figured out by Configure. Should you modify one of these values,
19434 # do not forget to propagate your changes by running "Configure -der". You may
19435 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19436 #
19437
19438 # Package name      : $package
19439 # Source directory  : $src
19440 # Configuration time: $cf_time
19441 # Configured by     : $cf_by
19442 # Target system     : $myuname
19443
19444 Author='$Author'
19445 Date='$Date'
19446 Header='$Header'
19447 Id='$Id'
19448 Locker='$Locker'
19449 Log='$Log'
19450 Mcc='$Mcc'
19451 RCSfile='$RCSfile'
19452 Revision='$Revision'
19453 Source='$Source'
19454 State='$State'
19455 _a='$_a'
19456 _exe='$_exe'
19457 _o='$_o'
19458 afs='$afs'
19459 afsroot='$afsroot'
19460 alignbytes='$alignbytes'
19461 ansi2knr='$ansi2knr'
19462 aphostname='$aphostname'
19463 api_revision='$api_revision'
19464 api_subversion='$api_subversion'
19465 api_version='$api_version'
19466 api_versionstring='$api_versionstring'
19467 ar='$ar'
19468 archlib='$archlib'
19469 archlibexp='$archlibexp'
19470 archname64='$archname64'
19471 archname='$archname'
19472 archobjs='$archobjs'
19473 asctime_r_proto='$asctime_r_proto'
19474 awk='$awk'
19475 baserev='$baserev'
19476 bash='$bash'
19477 bin='$bin'
19478 bincompat5005='$bincompat5005'
19479 binexp='$binexp'
19480 bison='$bison'
19481 byacc='$byacc'
19482 byteorder='$byteorder'
19483 c='$c'
19484 castflags='$castflags'
19485 cat='$cat'
19486 cc='$cc'
19487 cccdlflags='$cccdlflags'
19488 ccdlflags='$ccdlflags'
19489 ccflags='$ccflags'
19490 ccflags_uselargefiles='$ccflags_uselargefiles'
19491 ccname='$ccname'
19492 ccsymbols='$ccsymbols'
19493 ccversion='$ccversion'
19494 cf_by='$cf_by'
19495 cf_email='$cf_email'
19496 cf_time='$cf_time'
19497 charsize='$charsize'
19498 chgrp='$chgrp'
19499 chmod='$chmod'
19500 chown='$chown'
19501 clocktype='$clocktype'
19502 comm='$comm'
19503 compress='$compress'
19504 contains='$contains'
19505 cp='$cp'
19506 cpio='$cpio'
19507 cpp='$cpp'
19508 cpp_stuff='$cpp_stuff'
19509 cppccsymbols='$cppccsymbols'
19510 cppflags='$cppflags'
19511 cpplast='$cpplast'
19512 cppminus='$cppminus'
19513 cpprun='$cpprun'
19514 cppstdin='$cppstdin'
19515 cppsymbols='$cppsymbols'
19516 crypt_r_proto='$crypt_r_proto'
19517 cryptlib='$cryptlib'
19518 csh='$csh'
19519 ctermid_r_proto='$ctermid_r_proto'
19520 ctime_r_proto='$ctime_r_proto'
19521 d_Gconvert='$d_Gconvert'
19522 d_PRIEUldbl='$d_PRIEUldbl'
19523 d_PRIFUldbl='$d_PRIFUldbl'
19524 d_PRIGUldbl='$d_PRIGUldbl'
19525 d_PRIXU64='$d_PRIXU64'
19526 d_PRId64='$d_PRId64'
19527 d_PRIeldbl='$d_PRIeldbl'
19528 d_PRIfldbl='$d_PRIfldbl'
19529 d_PRIgldbl='$d_PRIgldbl'
19530 d_PRIi64='$d_PRIi64'
19531 d_PRIo64='$d_PRIo64'
19532 d_PRIu64='$d_PRIu64'
19533 d_PRIx64='$d_PRIx64'
19534 d_SCNfldbl='$d_SCNfldbl'
19535 d__fwalk='$d__fwalk'
19536 d_access='$d_access'
19537 d_accessx='$d_accessx'
19538 d_alarm='$d_alarm'
19539 d_archlib='$d_archlib'
19540 d_asctime_r='$d_asctime_r'
19541 d_atolf='$d_atolf'
19542 d_atoll='$d_atoll'
19543 d_attribut='$d_attribut'
19544 d_bcmp='$d_bcmp'
19545 d_bcopy='$d_bcopy'
19546 d_bincompat5005='$d_bincompat5005'
19547 d_bsd='$d_bsd'
19548 d_bsdgetpgrp='$d_bsdgetpgrp'
19549 d_bsdsetpgrp='$d_bsdsetpgrp'
19550 d_bzero='$d_bzero'
19551 d_casti32='$d_casti32'
19552 d_castneg='$d_castneg'
19553 d_charvspr='$d_charvspr'
19554 d_chown='$d_chown'
19555 d_chroot='$d_chroot'
19556 d_chsize='$d_chsize'
19557 d_class='$d_class'
19558 d_closedir='$d_closedir'
19559 d_cmsghdr_s='$d_cmsghdr_s'
19560 d_const='$d_const'
19561 d_crypt='$d_crypt'
19562 d_crypt_r='$d_crypt_r'
19563 d_csh='$d_csh'
19564 d_ctermid_r='$d_ctermid_r'
19565 d_ctime_r='$d_ctime_r'
19566 d_cuserid='$d_cuserid'
19567 d_dbl_dig='$d_dbl_dig'
19568 d_dbminitproto='$d_dbminitproto'
19569 d_difftime='$d_difftime'
19570 d_dirfd='$d_dirfd'
19571 d_dirnamlen='$d_dirnamlen'
19572 d_dlerror='$d_dlerror'
19573 d_dlopen='$d_dlopen'
19574 d_dlsymun='$d_dlsymun'
19575 d_dosuid='$d_dosuid'
19576 d_drand48_r='$d_drand48_r'
19577 d_drand48proto='$d_drand48proto'
19578 d_dup2='$d_dup2'
19579 d_eaccess='$d_eaccess'
19580 d_endgrent='$d_endgrent'
19581 d_endgrent_r='$d_endgrent_r'
19582 d_endhent='$d_endhent'
19583 d_endhostent_r='$d_endhostent_r'
19584 d_endnent='$d_endnent'
19585 d_endnetent_r='$d_endnetent_r'
19586 d_endpent='$d_endpent'
19587 d_endprotoent_r='$d_endprotoent_r'
19588 d_endpwent='$d_endpwent'
19589 d_endpwent_r='$d_endpwent_r'
19590 d_endsent='$d_endsent'
19591 d_endservent_r='$d_endservent_r'
19592 d_eofnblk='$d_eofnblk'
19593 d_eunice='$d_eunice'
19594 d_fchdir='$d_fchdir'
19595 d_fchmod='$d_fchmod'
19596 d_fchown='$d_fchown'
19597 d_fcntl='$d_fcntl'
19598 d_fcntl_can_lock='$d_fcntl_can_lock'
19599 d_fd_macros='$d_fd_macros'
19600 d_fd_set='$d_fd_set'
19601 d_fds_bits='$d_fds_bits'
19602 d_fgetpos='$d_fgetpos'
19603 d_finite='$d_finite'
19604 d_finitel='$d_finitel'
19605 d_flexfnam='$d_flexfnam'
19606 d_flock='$d_flock'
19607 d_flockproto='$d_flockproto'
19608 d_fork='$d_fork'
19609 d_fp_class='$d_fp_class'
19610 d_fpathconf='$d_fpathconf'
19611 d_fpclass='$d_fpclass'
19612 d_fpclassify='$d_fpclassify'
19613 d_fpclassl='$d_fpclassl'
19614 d_fpos64_t='$d_fpos64_t'
19615 d_frexpl='$d_frexpl'
19616 d_fs_data_s='$d_fs_data_s'
19617 d_fseeko='$d_fseeko'
19618 d_fsetpos='$d_fsetpos'
19619 d_fstatfs='$d_fstatfs'
19620 d_fstatvfs='$d_fstatvfs'
19621 d_fsync='$d_fsync'
19622 d_ftello='$d_ftello'
19623 d_ftime='$d_ftime'
19624 d_getcwd='$d_getcwd'
19625 d_getespwnam='$d_getespwnam'
19626 d_getfsstat='$d_getfsstat'
19627 d_getgrent='$d_getgrent'
19628 d_getgrent_r='$d_getgrent_r'
19629 d_getgrgid_r='$d_getgrgid_r'
19630 d_getgrnam_r='$d_getgrnam_r'
19631 d_getgrps='$d_getgrps'
19632 d_gethbyaddr='$d_gethbyaddr'
19633 d_gethbyname='$d_gethbyname'
19634 d_gethent='$d_gethent'
19635 d_gethname='$d_gethname'
19636 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19637 d_gethostbyname_r='$d_gethostbyname_r'
19638 d_gethostent_r='$d_gethostent_r'
19639 d_gethostprotos='$d_gethostprotos'
19640 d_getitimer='$d_getitimer'
19641 d_getlogin='$d_getlogin'
19642 d_getlogin_r='$d_getlogin_r'
19643 d_getmnt='$d_getmnt'
19644 d_getmntent='$d_getmntent'
19645 d_getnbyaddr='$d_getnbyaddr'
19646 d_getnbyname='$d_getnbyname'
19647 d_getnent='$d_getnent'
19648 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19649 d_getnetbyname_r='$d_getnetbyname_r'
19650 d_getnetent_r='$d_getnetent_r'
19651 d_getnetprotos='$d_getnetprotos'
19652 d_getpagsz='$d_getpagsz'
19653 d_getpbyname='$d_getpbyname'
19654 d_getpbynumber='$d_getpbynumber'
19655 d_getpent='$d_getpent'
19656 d_getpgid='$d_getpgid'
19657 d_getpgrp2='$d_getpgrp2'
19658 d_getpgrp='$d_getpgrp'
19659 d_getppid='$d_getppid'
19660 d_getprior='$d_getprior'
19661 d_getprotobyname_r='$d_getprotobyname_r'
19662 d_getprotobynumber_r='$d_getprotobynumber_r'
19663 d_getprotoent_r='$d_getprotoent_r'
19664 d_getprotoprotos='$d_getprotoprotos'
19665 d_getprpwnam='$d_getprpwnam'
19666 d_getpwent='$d_getpwent'
19667 d_getpwent_r='$d_getpwent_r'
19668 d_getpwnam_r='$d_getpwnam_r'
19669 d_getpwuid_r='$d_getpwuid_r'
19670 d_getsbyname='$d_getsbyname'
19671 d_getsbyport='$d_getsbyport'
19672 d_getsent='$d_getsent'
19673 d_getservbyname_r='$d_getservbyname_r'
19674 d_getservbyport_r='$d_getservbyport_r'
19675 d_getservent_r='$d_getservent_r'
19676 d_getservprotos='$d_getservprotos'
19677 d_getspnam='$d_getspnam'
19678 d_getspnam_r='$d_getspnam_r'
19679 d_gettimeod='$d_gettimeod'
19680 d_gmtime_r='$d_gmtime_r'
19681 d_gnulibc='$d_gnulibc'
19682 d_grpasswd='$d_grpasswd'
19683 d_hasmntopt='$d_hasmntopt'
19684 d_htonl='$d_htonl'
19685 d_index='$d_index'
19686 d_inetaton='$d_inetaton'
19687 d_int64_t='$d_int64_t'
19688 d_isascii='$d_isascii'
19689 d_isfinite='$d_isfinite'
19690 d_isinf='$d_isinf'
19691 d_isnan='$d_isnan'
19692 d_isnanl='$d_isnanl'
19693 d_killpg='$d_killpg'
19694 d_lchown='$d_lchown'
19695 d_ldbl_dig='$d_ldbl_dig'
19696 d_link='$d_link'
19697 d_localtime_r='$d_localtime_r'
19698 d_locconv='$d_locconv'
19699 d_lockf='$d_lockf'
19700 d_longdbl='$d_longdbl'
19701 d_longlong='$d_longlong'
19702 d_lseekproto='$d_lseekproto'
19703 d_lstat='$d_lstat'
19704 d_madvise='$d_madvise'
19705 d_mblen='$d_mblen'
19706 d_mbstowcs='$d_mbstowcs'
19707 d_mbtowc='$d_mbtowc'
19708 d_memchr='$d_memchr'
19709 d_memcmp='$d_memcmp'
19710 d_memcpy='$d_memcpy'
19711 d_memmove='$d_memmove'
19712 d_memset='$d_memset'
19713 d_mkdir='$d_mkdir'
19714 d_mkdtemp='$d_mkdtemp'
19715 d_mkfifo='$d_mkfifo'
19716 d_mkstemp='$d_mkstemp'
19717 d_mkstemps='$d_mkstemps'
19718 d_mktime='$d_mktime'
19719 d_mmap='$d_mmap'
19720 d_modfl='$d_modfl'
19721 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19722 d_mprotect='$d_mprotect'
19723 d_msg='$d_msg'
19724 d_msg_ctrunc='$d_msg_ctrunc'
19725 d_msg_dontroute='$d_msg_dontroute'
19726 d_msg_oob='$d_msg_oob'
19727 d_msg_peek='$d_msg_peek'
19728 d_msg_proxy='$d_msg_proxy'
19729 d_msgctl='$d_msgctl'
19730 d_msgget='$d_msgget'
19731 d_msghdr_s='$d_msghdr_s'
19732 d_msgrcv='$d_msgrcv'
19733 d_msgsnd='$d_msgsnd'
19734 d_msync='$d_msync'
19735 d_munmap='$d_munmap'
19736 d_mymalloc='$d_mymalloc'
19737 d_nice='$d_nice'
19738 d_nl_langinfo='$d_nl_langinfo'
19739 d_nv_preserves_uv='$d_nv_preserves_uv'
19740 d_off64_t='$d_off64_t'
19741 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19742 d_oldpthreads='$d_oldpthreads'
19743 d_oldsock='$d_oldsock'
19744 d_open3='$d_open3'
19745 d_pathconf='$d_pathconf'
19746 d_pause='$d_pause'
19747 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19748 d_phostname='$d_phostname'
19749 d_pipe='$d_pipe'
19750 d_poll='$d_poll'
19751 d_portable='$d_portable'
19752 d_procselfexe='$d_procselfexe'
19753 d_pthread_atfork='$d_pthread_atfork'
19754 d_pthread_yield='$d_pthread_yield'
19755 d_pwage='$d_pwage'
19756 d_pwchange='$d_pwchange'
19757 d_pwclass='$d_pwclass'
19758 d_pwcomment='$d_pwcomment'
19759 d_pwexpire='$d_pwexpire'
19760 d_pwgecos='$d_pwgecos'
19761 d_pwpasswd='$d_pwpasswd'
19762 d_pwquota='$d_pwquota'
19763 d_qgcvt='$d_qgcvt'
19764 d_quad='$d_quad'
19765 d_random_r='$d_random_r'
19766 d_readdir64_r='$d_readdir64_r'
19767 d_readdir='$d_readdir'
19768 d_readdir_r='$d_readdir_r'
19769 d_readlink='$d_readlink'
19770 d_readv='$d_readv'
19771 d_recvmsg='$d_recvmsg'
19772 d_rename='$d_rename'
19773 d_rewinddir='$d_rewinddir'
19774 d_rmdir='$d_rmdir'
19775 d_safebcpy='$d_safebcpy'
19776 d_safemcpy='$d_safemcpy'
19777 d_sanemcmp='$d_sanemcmp'
19778 d_sbrkproto='$d_sbrkproto'
19779 d_sched_yield='$d_sched_yield'
19780 d_scm_rights='$d_scm_rights'
19781 d_seekdir='$d_seekdir'
19782 d_select='$d_select'
19783 d_sem='$d_sem'
19784 d_semctl='$d_semctl'
19785 d_semctl_semid_ds='$d_semctl_semid_ds'
19786 d_semctl_semun='$d_semctl_semun'
19787 d_semget='$d_semget'
19788 d_semop='$d_semop'
19789 d_sendmsg='$d_sendmsg'
19790 d_setegid='$d_setegid'
19791 d_seteuid='$d_seteuid'
19792 d_setgrent='$d_setgrent'
19793 d_setgrent_r='$d_setgrent_r'
19794 d_setgrps='$d_setgrps'
19795 d_sethent='$d_sethent'
19796 d_sethostent_r='$d_sethostent_r'
19797 d_setitimer='$d_setitimer'
19798 d_setlinebuf='$d_setlinebuf'
19799 d_setlocale='$d_setlocale'
19800 d_setlocale_r='$d_setlocale_r'
19801 d_setnent='$d_setnent'
19802 d_setnetent_r='$d_setnetent_r'
19803 d_setpent='$d_setpent'
19804 d_setpgid='$d_setpgid'
19805 d_setpgrp2='$d_setpgrp2'
19806 d_setpgrp='$d_setpgrp'
19807 d_setprior='$d_setprior'
19808 d_setproctitle='$d_setproctitle'
19809 d_setprotoent_r='$d_setprotoent_r'
19810 d_setpwent='$d_setpwent'
19811 d_setpwent_r='$d_setpwent_r'
19812 d_setregid='$d_setregid'
19813 d_setresgid='$d_setresgid'
19814 d_setresuid='$d_setresuid'
19815 d_setreuid='$d_setreuid'
19816 d_setrgid='$d_setrgid'
19817 d_setruid='$d_setruid'
19818 d_setsent='$d_setsent'
19819 d_setservent_r='$d_setservent_r'
19820 d_setsid='$d_setsid'
19821 d_setvbuf='$d_setvbuf'
19822 d_sfio='$d_sfio'
19823 d_shm='$d_shm'
19824 d_shmat='$d_shmat'
19825 d_shmatprototype='$d_shmatprototype'
19826 d_shmctl='$d_shmctl'
19827 d_shmdt='$d_shmdt'
19828 d_shmget='$d_shmget'
19829 d_sigaction='$d_sigaction'
19830 d_sigprocmask='$d_sigprocmask'
19831 d_sigsetjmp='$d_sigsetjmp'
19832 d_sockatmark='$d_sockatmark'
19833 d_sockatmarkproto='$d_sockatmarkproto'
19834 d_socket='$d_socket'
19835 d_socklen_t='$d_socklen_t'
19836 d_sockpair='$d_sockpair'
19837 d_socks5_init='$d_socks5_init'
19838 d_sqrtl='$d_sqrtl'
19839 d_srand48_r='$d_srand48_r'
19840 d_srandom_r='$d_srandom_r'
19841 d_sresgproto='$d_sresgproto'
19842 d_sresuproto='$d_sresuproto'
19843 d_statblks='$d_statblks'
19844 d_statfs_f_flags='$d_statfs_f_flags'
19845 d_statfs_s='$d_statfs_s'
19846 d_statvfs='$d_statvfs'
19847 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19848 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19849 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19850 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19851 d_stdio_stream_array='$d_stdio_stream_array'
19852 d_stdiobase='$d_stdiobase'
19853 d_stdstdio='$d_stdstdio'
19854 d_strchr='$d_strchr'
19855 d_strcoll='$d_strcoll'
19856 d_strctcpy='$d_strctcpy'
19857 d_strerrm='$d_strerrm'
19858 d_strerror='$d_strerror'
19859 d_strerror_r='$d_strerror_r'
19860 d_strftime='$d_strftime'
19861 d_strtod='$d_strtod'
19862 d_strtol='$d_strtol'
19863 d_strtold='$d_strtold'
19864 d_strtoll='$d_strtoll'
19865 d_strtoq='$d_strtoq'
19866 d_strtoul='$d_strtoul'
19867 d_strtoull='$d_strtoull'
19868 d_strtouq='$d_strtouq'
19869 d_strxfrm='$d_strxfrm'
19870 d_suidsafe='$d_suidsafe'
19871 d_symlink='$d_symlink'
19872 d_syscall='$d_syscall'
19873 d_syscallproto='$d_syscallproto'
19874 d_sysconf='$d_sysconf'
19875 d_sysernlst='$d_sysernlst'
19876 d_syserrlst='$d_syserrlst'
19877 d_system='$d_system'
19878 d_tcgetpgrp='$d_tcgetpgrp'
19879 d_tcsetpgrp='$d_tcsetpgrp'
19880 d_telldir='$d_telldir'
19881 d_telldirproto='$d_telldirproto'
19882 d_time='$d_time'
19883 d_times='$d_times'
19884 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19885 d_tm_tm_zone='$d_tm_tm_zone'
19886 d_tmpnam_r='$d_tmpnam_r'
19887 d_truncate='$d_truncate'
19888 d_ttyname_r='$d_ttyname_r'
19889 d_tzname='$d_tzname'
19890 d_u32align='$d_u32align'
19891 d_ualarm='$d_ualarm'
19892 d_umask='$d_umask'
19893 d_uname='$d_uname'
19894 d_union_semun='$d_union_semun'
19895 d_unordered='$d_unordered'
19896 d_usleep='$d_usleep'
19897 d_usleepproto='$d_usleepproto'
19898 d_ustat='$d_ustat'
19899 d_vendorarch='$d_vendorarch'
19900 d_vendorbin='$d_vendorbin'
19901 d_vendorlib='$d_vendorlib'
19902 d_vfork='$d_vfork'
19903 d_void_closedir='$d_void_closedir'
19904 d_voidsig='$d_voidsig'
19905 d_voidtty='$d_voidtty'
19906 d_volatile='$d_volatile'
19907 d_vprintf='$d_vprintf'
19908 d_wait4='$d_wait4'
19909 d_waitpid='$d_waitpid'
19910 d_wcstombs='$d_wcstombs'
19911 d_wctomb='$d_wctomb'
19912 d_writev='$d_writev'
19913 d_xenix='$d_xenix'
19914 date='$date'
19915 db_hashtype='$db_hashtype'
19916 db_prefixtype='$db_prefixtype'
19917 db_version_major='$db_version_major'
19918 db_version_minor='$db_version_minor'
19919 db_version_patch='$db_version_patch'
19920 defvoidused='$defvoidused'
19921 direntrytype='$direntrytype'
19922 dlext='$dlext'
19923 dlsrc='$dlsrc'
19924 doublesize='$doublesize'
19925 drand01='$drand01'
19926 drand48_r_proto='$drand48_r_proto'
19927 dynamic_ext='$dynamic_ext'
19928 eagain='$eagain'
19929 ebcdic='$ebcdic'
19930 echo='$echo'
19931 egrep='$egrep'
19932 emacs='$emacs'
19933 endgrent_r_proto='$endgrent_r_proto'
19934 endhostent_r_proto='$endhostent_r_proto'
19935 endnetent_r_proto='$endnetent_r_proto'
19936 endprotoent_r_proto='$endprotoent_r_proto'
19937 endpwent_r_proto='$endpwent_r_proto'
19938 endservent_r_proto='$endservent_r_proto'
19939 eunicefix='$eunicefix'
19940 exe_ext='$exe_ext'
19941 expr='$expr'
19942 extensions='$extensions'
19943 extras='$extras'
19944 fflushNULL='$fflushNULL'
19945 fflushall='$fflushall'
19946 find='$find'
19947 firstmakefile='$firstmakefile'
19948 flex='$flex'
19949 fpossize='$fpossize'
19950 fpostype='$fpostype'
19951 freetype='$freetype'
19952 from='$from'
19953 full_ar='$full_ar'
19954 full_csh='$full_csh'
19955 full_sed='$full_sed'
19956 gccosandvers='$gccosandvers'
19957 gccversion='$gccversion'
19958 getgrent_r_proto='$getgrent_r_proto'
19959 getgrgid_r_proto='$getgrgid_r_proto'
19960 getgrnam_r_proto='$getgrnam_r_proto'
19961 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
19962 gethostbyname_r_proto='$gethostbyname_r_proto'
19963 gethostent_r_proto='$gethostent_r_proto'
19964 getlogin_r_proto='$getlogin_r_proto'
19965 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
19966 getnetbyname_r_proto='$getnetbyname_r_proto'
19967 getnetent_r_proto='$getnetent_r_proto'
19968 getprotobyname_r_proto='$getprotobyname_r_proto'
19969 getprotobynumber_r_proto='$getprotobynumber_r_proto'
19970 getprotoent_r_proto='$getprotoent_r_proto'
19971 getpwent_r_proto='$getpwent_r_proto'
19972 getpwnam_r_proto='$getpwnam_r_proto'
19973 getpwuid_r_proto='$getpwuid_r_proto'
19974 getservbyname_r_proto='$getservbyname_r_proto'
19975 getservbyport_r_proto='$getservbyport_r_proto'
19976 getservent_r_proto='$getservent_r_proto'
19977 getspnam_r_proto='$getspnam_r_proto'
19978 gidformat='$gidformat'
19979 gidsign='$gidsign'
19980 gidsize='$gidsize'
19981 gidtype='$gidtype'
19982 glibpth='$glibpth'
19983 gmake='$gmake'
19984 gmtime_r_proto='$gmtime_r_proto'
19985 grep='$grep'
19986 groupcat='$groupcat'
19987 groupstype='$groupstype'
19988 gzip='$gzip'
19989 h_fcntl='$h_fcntl'
19990 h_sysfile='$h_sysfile'
19991 hint='$hint'
19992 hostcat='$hostcat'
19993 i16size='$i16size'
19994 i16type='$i16type'
19995 i32size='$i32size'
19996 i32type='$i32type'
19997 i64size='$i64size'
19998 i64type='$i64type'
19999 i8size='$i8size'
20000 i8type='$i8type'
20001 i_arpainet='$i_arpainet'
20002 i_bsdioctl='$i_bsdioctl'
20003 i_crypt='$i_crypt'
20004 i_db='$i_db'
20005 i_dbm='$i_dbm'
20006 i_dirent='$i_dirent'
20007 i_dld='$i_dld'
20008 i_dlfcn='$i_dlfcn'
20009 i_fcntl='$i_fcntl'
20010 i_float='$i_float'
20011 i_fp='$i_fp'
20012 i_fp_class='$i_fp_class'
20013 i_gdbm='$i_gdbm'
20014 i_grp='$i_grp'
20015 i_ieeefp='$i_ieeefp'
20016 i_inttypes='$i_inttypes'
20017 i_langinfo='$i_langinfo'
20018 i_libutil='$i_libutil'
20019 i_limits='$i_limits'
20020 i_locale='$i_locale'
20021 i_machcthr='$i_machcthr'
20022 i_malloc='$i_malloc'
20023 i_math='$i_math'
20024 i_memory='$i_memory'
20025 i_mntent='$i_mntent'
20026 i_ndbm='$i_ndbm'
20027 i_netdb='$i_netdb'
20028 i_neterrno='$i_neterrno'
20029 i_netinettcp='$i_netinettcp'
20030 i_niin='$i_niin'
20031 i_poll='$i_poll'
20032 i_prot='$i_prot'
20033 i_pthread='$i_pthread'
20034 i_pwd='$i_pwd'
20035 i_rpcsvcdbm='$i_rpcsvcdbm'
20036 i_sfio='$i_sfio'
20037 i_sgtty='$i_sgtty'
20038 i_shadow='$i_shadow'
20039 i_socks='$i_socks'
20040 i_stdarg='$i_stdarg'
20041 i_stddef='$i_stddef'
20042 i_stdlib='$i_stdlib'
20043 i_string='$i_string'
20044 i_sunmath='$i_sunmath'
20045 i_sysaccess='$i_sysaccess'
20046 i_sysdir='$i_sysdir'
20047 i_sysfile='$i_sysfile'
20048 i_sysfilio='$i_sysfilio'
20049 i_sysin='$i_sysin'
20050 i_sysioctl='$i_sysioctl'
20051 i_syslog='$i_syslog'
20052 i_sysmman='$i_sysmman'
20053 i_sysmode='$i_sysmode'
20054 i_sysmount='$i_sysmount'
20055 i_sysndir='$i_sysndir'
20056 i_sysparam='$i_sysparam'
20057 i_sysresrc='$i_sysresrc'
20058 i_syssecrt='$i_syssecrt'
20059 i_sysselct='$i_sysselct'
20060 i_syssockio='$i_syssockio'
20061 i_sysstat='$i_sysstat'
20062 i_sysstatfs='$i_sysstatfs'
20063 i_sysstatvfs='$i_sysstatvfs'
20064 i_systime='$i_systime'
20065 i_systimek='$i_systimek'
20066 i_systimes='$i_systimes'
20067 i_systypes='$i_systypes'
20068 i_sysuio='$i_sysuio'
20069 i_sysun='$i_sysun'
20070 i_sysutsname='$i_sysutsname'
20071 i_sysvfs='$i_sysvfs'
20072 i_syswait='$i_syswait'
20073 i_termio='$i_termio'
20074 i_termios='$i_termios'
20075 i_time='$i_time'
20076 i_unistd='$i_unistd'
20077 i_ustat='$i_ustat'
20078 i_utime='$i_utime'
20079 i_values='$i_values'
20080 i_varargs='$i_varargs'
20081 i_varhdr='$i_varhdr'
20082 i_vfork='$i_vfork'
20083 ignore_versioned_solibs='$ignore_versioned_solibs'
20084 inc_version_list='$inc_version_list'
20085 inc_version_list_init='$inc_version_list_init'
20086 incpath='$incpath'
20087 inews='$inews'
20088 installarchlib='$installarchlib'
20089 installbin='$installbin'
20090 installman1dir='$installman1dir'
20091 installman3dir='$installman3dir'
20092 installprefix='$installprefix'
20093 installprefixexp='$installprefixexp'
20094 installprivlib='$installprivlib'
20095 installscript='$installscript'
20096 installsitearch='$installsitearch'
20097 installsitebin='$installsitebin'
20098 installsitelib='$installsitelib'
20099 installstyle='$installstyle'
20100 installusrbinperl='$installusrbinperl'
20101 installvendorarch='$installvendorarch'
20102 installvendorbin='$installvendorbin'
20103 installvendorlib='$installvendorlib'
20104 intsize='$intsize'
20105 issymlink='$issymlink'
20106 ivdformat='$ivdformat'
20107 ivsize='$ivsize'
20108 ivtype='$ivtype'
20109 known_extensions='$known_extensions'
20110 ksh='$ksh'
20111 ld='$ld'
20112 lddlflags='$lddlflags'
20113 ldflags='$ldflags'
20114 ldflags_uselargefiles='$ldflags_uselargefiles'
20115 ldlibpthname='$ldlibpthname'
20116 less='$less'
20117 lib_ext='$lib_ext'
20118 libc='$libc'
20119 libperl='$libperl'
20120 libpth='$libpth'
20121 libs='$libs'
20122 libsdirs='$libsdirs'
20123 libsfiles='$libsfiles'
20124 libsfound='$libsfound'
20125 libspath='$libspath'
20126 libswanted='$libswanted'
20127 libswanted_uselargefiles='$libswanted_uselargefiles'
20128 line='$line'
20129 lint='$lint'
20130 lkflags='$lkflags'
20131 ln='$ln'
20132 lns='$lns'
20133 localtime_r_proto='$localtime_r_proto'
20134 locincpth='$locincpth'
20135 loclibpth='$loclibpth'
20136 longdblsize='$longdblsize'
20137 longlongsize='$longlongsize'
20138 longsize='$longsize'
20139 lp='$lp'
20140 lpr='$lpr'
20141 ls='$ls'
20142 lseeksize='$lseeksize'
20143 lseektype='$lseektype'
20144 mail='$mail'
20145 mailx='$mailx'
20146 make='$make'
20147 make_set_make='$make_set_make'
20148 mallocobj='$mallocobj'
20149 mallocsrc='$mallocsrc'
20150 malloctype='$malloctype'
20151 man1dir='$man1dir'
20152 man1direxp='$man1direxp'
20153 man1ext='$man1ext'
20154 man3dir='$man3dir'
20155 man3direxp='$man3direxp'
20156 man3ext='$man3ext'
20157 mips_type='$mips_type'
20158 mkdir='$mkdir'
20159 mmaptype='$mmaptype'
20160 modetype='$modetype'
20161 more='$more'
20162 multiarch='$multiarch'
20163 mv='$mv'
20164 myarchname='$myarchname'
20165 mydomain='$mydomain'
20166 myhostname='$myhostname'
20167 myuname='$myuname'
20168 n='$n'
20169 need_va_copy='$need_va_copy'
20170 netdb_hlen_type='$netdb_hlen_type'
20171 netdb_host_type='$netdb_host_type'
20172 netdb_name_type='$netdb_name_type'
20173 netdb_net_type='$netdb_net_type'
20174 nm='$nm'
20175 nm_opt='$nm_opt'
20176 nm_so_opt='$nm_so_opt'
20177 nonxs_ext='$nonxs_ext'
20178 nroff='$nroff'
20179 nvEUformat='$nvEUformat'
20180 nvFUformat='$nvFUformat'
20181 nvGUformat='$nvGUformat'
20182 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20183 nveformat='$nveformat'
20184 nvfformat='$nvfformat'
20185 nvgformat='$nvgformat'
20186 nvsize='$nvsize'
20187 nvtype='$nvtype'
20188 o_nonblock='$o_nonblock'
20189 obj_ext='$obj_ext'
20190 old_pthread_create_joinable='$old_pthread_create_joinable'
20191 optimize='$optimize'
20192 orderlib='$orderlib'
20193 osname='$osname'
20194 osvers='$osvers'
20195 otherlibdirs='$otherlibdirs'
20196 package='$package'
20197 pager='$pager'
20198 passcat='$passcat'
20199 patchlevel='$patchlevel'
20200 path_sep='$path_sep'
20201 perl5='$perl5'
20202 perl='$perl'
20203 perl_patchlevel='$perl_patchlevel'
20204 perladmin='$perladmin'
20205 perllibs='$perllibs'
20206 perlpath='$perlpath'
20207 pg='$pg'
20208 phostname='$phostname'
20209 pidtype='$pidtype'
20210 plibpth='$plibpth'
20211 pm_apiversion='$pm_apiversion'
20212 pmake='$pmake'
20213 pr='$pr'
20214 prefix='$prefix'
20215 prefixexp='$prefixexp'
20216 privlib='$privlib'
20217 privlibexp='$privlibexp'
20218 procselfexe='$procselfexe'
20219 prototype='$prototype'
20220 ptrsize='$ptrsize'
20221 quadkind='$quadkind'
20222 quadtype='$quadtype'
20223 randbits='$randbits'
20224 randfunc='$randfunc'
20225 random_r_proto='$random_r_proto'
20226 randseedtype='$randseedtype'
20227 ranlib='$ranlib'
20228 rd_nodata='$rd_nodata'
20229 readdir64_r_proto='$readdir64_r_proto'
20230 readdir_r_proto='$readdir_r_proto'
20231 revision='$revision'
20232 rm='$rm'
20233 rmail='$rmail'
20234 run='$run'
20235 runnm='$runnm'
20236 sPRIEUldbl='$sPRIEUldbl'
20237 sPRIFUldbl='$sPRIFUldbl'
20238 sPRIGUldbl='$sPRIGUldbl'
20239 sPRIXU64='$sPRIXU64'
20240 sPRId64='$sPRId64'
20241 sPRIeldbl='$sPRIeldbl'
20242 sPRIfldbl='$sPRIfldbl'
20243 sPRIgldbl='$sPRIgldbl'
20244 sPRIi64='$sPRIi64'
20245 sPRIo64='$sPRIo64'
20246 sPRIu64='$sPRIu64'
20247 sPRIx64='$sPRIx64'
20248 sSCNfldbl='$sSCNfldbl'
20249 sched_yield='$sched_yield'
20250 scriptdir='$scriptdir'
20251 scriptdirexp='$scriptdirexp'
20252 sed='$sed'
20253 seedfunc='$seedfunc'
20254 selectminbits='$selectminbits'
20255 selecttype='$selecttype'
20256 sendmail='$sendmail'
20257 setgrent_r_proto='$setgrent_r_proto'
20258 sethostent_r_proto='$sethostent_r_proto'
20259 setlocale_r_proto='$setlocale_r_proto'
20260 setnetent_r_proto='$setnetent_r_proto'
20261 setprotoent_r_proto='$setprotoent_r_proto'
20262 setpwent_r_proto='$setpwent_r_proto'
20263 setservent_r_proto='$setservent_r_proto'
20264 sh='$sh'
20265 shar='$shar'
20266 sharpbang='$sharpbang'
20267 shmattype='$shmattype'
20268 shortsize='$shortsize'
20269 shrpenv='$shrpenv'
20270 shsharp='$shsharp'
20271 sig_count='$sig_count'
20272 sig_name='$sig_name'
20273 sig_name_init='$sig_name_init'
20274 sig_num='$sig_num'
20275 sig_num_init='$sig_num_init'
20276 sig_size='$sig_size'
20277 signal_t='$signal_t'
20278 sitearch='$sitearch'
20279 sitearchexp='$sitearchexp'
20280 sitebin='$sitebin'
20281 sitebinexp='$sitebinexp'
20282 sitelib='$sitelib'
20283 sitelib_stem='$sitelib_stem'
20284 sitelibexp='$sitelibexp'
20285 siteprefix='$siteprefix'
20286 siteprefixexp='$siteprefixexp'
20287 sizesize='$sizesize'
20288 sizetype='$sizetype'
20289 sleep='$sleep'
20290 smail='$smail'
20291 so='$so'
20292 sockethdr='$sockethdr'
20293 socketlib='$socketlib'
20294 socksizetype='$socksizetype'
20295 sort='$sort'
20296 spackage='$spackage'
20297 spitshell='$spitshell'
20298 srand48_r_proto='$srand48_r_proto'
20299 srandom_r_proto='$srandom_r_proto'
20300 src='$src'
20301 ssizetype='$ssizetype'
20302 startperl='$startperl'
20303 startsh='$startsh'
20304 static_ext='$static_ext'
20305 stdchar='$stdchar'
20306 stdio_base='$stdio_base'
20307 stdio_bufsiz='$stdio_bufsiz'
20308 stdio_cnt='$stdio_cnt'
20309 stdio_filbuf='$stdio_filbuf'
20310 stdio_ptr='$stdio_ptr'
20311 stdio_stream_array='$stdio_stream_array'
20312 strerror_r_proto='$strerror_r_proto'
20313 strings='$strings'
20314 submit='$submit'
20315 subversion='$subversion'
20316 sysman='$sysman'
20317 tail='$tail'
20318 tar='$tar'
20319 targetarch='$targetarch'
20320 tbl='$tbl'
20321 tee='$tee'
20322 test='$test'
20323 timeincl='$timeincl'
20324 timetype='$timetype'
20325 tmpnam_r_proto='$tmpnam_r_proto'
20326 to='$to'
20327 touch='$touch'
20328 tr='$tr'
20329 trnl='$trnl'
20330 troff='$troff'
20331 ttyname_r_proto='$ttyname_r_proto'
20332 u16size='$u16size'
20333 u16type='$u16type'
20334 u32size='$u32size'
20335 u32type='$u32type'
20336 u64size='$u64size'
20337 u64type='$u64type'
20338 u8size='$u8size'
20339 u8type='$u8type'
20340 uidformat='$uidformat'
20341 uidsign='$uidsign'
20342 uidsize='$uidsize'
20343 uidtype='$uidtype'
20344 uname='$uname'
20345 uniq='$uniq'
20346 uquadtype='$uquadtype'
20347 use5005threads='$use5005threads'
20348 use64bitall='$use64bitall'
20349 use64bitint='$use64bitint'
20350 usecrosscompile='$usecrosscompile'
20351 usedl='$usedl'
20352 useithreads='$useithreads'
20353 uselargefiles='$uselargefiles'
20354 uselongdouble='$uselongdouble'
20355 usemorebits='$usemorebits'
20356 usemultiplicity='$usemultiplicity'
20357 usemymalloc='$usemymalloc'
20358 usenm='$usenm'
20359 useopcode='$useopcode'
20360 useperlio='$useperlio'
20361 useposix='$useposix'
20362 usereentrant='$usereentrant'
20363 usesfio='$usesfio'
20364 useshrplib='$useshrplib'
20365 usesocks='$usesocks'
20366 usethreads='$usethreads'
20367 usevendorprefix='$usevendorprefix'
20368 usevfork='$usevfork'
20369 usrinc='$usrinc'
20370 uuname='$uuname'
20371 uvXUformat='$uvXUformat'
20372 uvoformat='$uvoformat'
20373 uvsize='$uvsize'
20374 uvtype='$uvtype'
20375 uvuformat='$uvuformat'
20376 uvxformat='$uvxformat'
20377 vendorarch='$vendorarch'
20378 vendorarchexp='$vendorarchexp'
20379 vendorbin='$vendorbin'
20380 vendorbinexp='$vendorbinexp'
20381 vendorlib='$vendorlib'
20382 vendorlib_stem='$vendorlib_stem'
20383 vendorlibexp='$vendorlibexp'
20384 vendorprefix='$vendorprefix'
20385 vendorprefixexp='$vendorprefixexp'
20386 version='$version'
20387 version_patchlevel_string='$version_patchlevel_string'
20388 versiononly='$versiononly'
20389 vi='$vi'
20390 voidflags='$voidflags'
20391 xlibpth='$xlibpth'
20392 xs_apiversion='$xs_apiversion'
20393 yacc='$yacc'
20394 yaccflags='$yaccflags'
20395 zcat='$zcat'
20396 zip='$zip'
20397 EOT
20398
20399 : Add in command line options if available
20400 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20401
20402 : add special variables
20403 $test -f $src/patchlevel.h && \
20404 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20405 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20406 echo "PERL_CONFIG_SH=true" >>config.sh
20407
20408 : propagate old symbols
20409 if $test -f UU/config.sh; then
20410         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20411         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20412         $sort | $uniq -u >UU/oldsyms
20413         set X `cat UU/oldsyms`
20414         shift
20415         case $# in
20416         0) ;;
20417         *)
20418                 cat <<EOM
20419 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20420 EOM
20421                 echo "# Variables propagated from previous config.sh file." >>config.sh
20422                 for sym in `cat UU/oldsyms`; do
20423                         echo "    Propagating $hint variable "'$'"$sym..."
20424                         eval 'tmp="$'"${sym}"'"'
20425                         echo "$tmp" | \
20426                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20427                 done
20428                 ;;
20429         esac
20430 fi
20431
20432 : Finish up by extracting the .SH files
20433 case "$alldone" in
20434 exit)
20435         $rm -rf UU
20436         echo "Extraction done."
20437         exit 0
20438         ;;
20439 cont)
20440         ;;
20441 '')
20442         dflt=''
20443         nostick=true
20444         $cat <<EOM
20445
20446 If you'd like to make any changes to the config.sh file before I begin
20447 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20448
20449 EOM
20450         rp="Press return or use a shell escape to edit config.sh:"
20451         . UU/myread
20452         nostick=''
20453         case "$ans" in
20454         '') ;;
20455         *) : in case they cannot read
20456                 sh 1>&4 -c "$ans";;
20457         esac
20458         ;;
20459 esac
20460
20461 : if this fails, just run all the .SH files by hand
20462 . ./config.sh
20463
20464 echo " "
20465 exec 1>&4
20466 pwd=`pwd`
20467 . ./UU/extract
20468 cd "$pwd"
20469
20470 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20471         dflt=y
20472         case "$silent" in
20473         true) ;;
20474         *)
20475                 $cat <<EOM
20476
20477 Now you need to generate make dependencies by running "$make depend".
20478 You might prefer to run it in background: "$make depend > makedepend.out &"
20479 It can take a while, so you might not want to run it right now.
20480
20481 EOM
20482                 ;;
20483         esac
20484         rp="Run $make depend now?"
20485         . UU/myread
20486         case "$ans" in
20487         y*)
20488                 $make depend && echo "Now you must run '$make'."
20489                 ;;
20490         *)
20491                 echo "You must run '$make depend' then '$make'."
20492                 ;;
20493         esac
20494 elif test -f [Mm]akefile; then
20495         echo " "
20496         echo "Now you must run a $make."
20497 else
20498         echo "Configure done."
20499 fi
20500
20501 if $test -f Policy.sh; then
20502     $cat <<EOM
20503
20504 If you compile $package on a different machine or from a different object
20505 directory, copy the Policy.sh file from this object directory to the
20506 new one before you run Configure -- this will help you with most of
20507 the policy defaults.
20508
20509 EOM
20510 fi
20511 if $test -f config.msg; then
20512     echo "Hmm.  I also noted the following information while running:"
20513     echo " "
20514     $cat config.msg >&4
20515     $rm -f config.msg
20516 fi
20517 $rm -f kit*isdone ark*isdone
20518 $rm -rf UU
20519
20520 : End of Configure
20521