Re: [PATCH] Quieten warnings in Deparse.pm
[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 Thu Aug  1 18:53:48 CEST 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 gnulibc_version=''
499 d_hasmntopt=''
500 d_htonl=''
501 d_inetaton=''
502 d_int64_t=''
503 d_isascii=''
504 d_isfinite=''
505 d_isinf=''
506 d_isnan=''
507 d_isnanl=''
508 d_killpg=''
509 d_lchown=''
510 d_ldbl_dig=''
511 d_link=''
512 d_localtime_r=''
513 localtime_r_proto=''
514 d_locconv=''
515 d_lockf=''
516 d_longdbl=''
517 longdblsize=''
518 d_longlong=''
519 longlongsize=''
520 d_lseekproto=''
521 d_lstat=''
522 d_madvise=''
523 d_mblen=''
524 d_mbstowcs=''
525 d_mbtowc=''
526 d_memchr=''
527 d_memcmp=''
528 d_memcpy=''
529 d_memmove=''
530 d_memset=''
531 d_mkdir=''
532 d_mkdtemp=''
533 d_mkfifo=''
534 d_mkstemp=''
535 d_mkstemps=''
536 d_mktime=''
537 d_mmap=''
538 mmaptype=''
539 d_modfl=''
540 d_modfl_pow32_bug=''
541 d_modflproto=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_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 : Possible local include directories to search.
1155 : Set locincpth to "" in a hint file to defeat local include searches.
1156 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1157 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1158 :
1159 : no include file wanted by default
1160 inclwanted=''
1161
1162 : Trailing extension.  Override this in a hint file, if needed.
1163 : Extra object files, if any, needed on this platform.
1164 archobjs=''
1165 groupstype=''
1166 libnames=''
1167 : change the next line if compiling for Xenix/286 on Xenix/386
1168 xlibpth='/usr/lib/386 /lib/386'
1169 : Possible local library directories to search.
1170 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1171 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1172
1173 : general looking path for locating libraries
1174 glibpth="/lib /usr/lib $xlibpth"
1175 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1176 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1177 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1178
1179 : Private path used by Configure to find libraries.  Its value
1180 : is prepended to libpth. This variable takes care of special
1181 : machines, like the mips.  Usually, it should be empty.
1182 plibpth=''
1183
1184 : default library list
1185 libswanted=''
1186 : some systems want to use only the non-versioned libso:s
1187 ignore_versioned_solibs=''
1188 : full support for void wanted by default
1189 defvoidused=15
1190
1191 ccname=''
1192 ccversion=''
1193 perllibs=''
1194 : set useposix=false in your hint file to disable the POSIX extension.
1195 useposix=true
1196 : set useopcode=false in your hint file to disable the Opcode extension.
1197 useopcode=true
1198 archname64=''
1199 ccflags_uselargefiles=''
1200 ldflags_uselargefiles=''
1201 libswanted_uselargefiles=''
1202 : set usemultiplicity on the Configure command line to enable multiplicity.
1203 : set usesocks on the Configure command line to enable socks.
1204 archname=''
1205 : set usethreads on the Configure command line to enable threads.
1206 usereentrant='undef'
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        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1864        fooxy) trnl='\n\r' ;;
1865        esac
1866 fi
1867 if test X"$trnl" = X; then
1868         cat <<EOM >&2
1869
1870 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1871
1872 EOM
1873         exit 1
1874 fi
1875
1876 : compute the number of columns on the terminal for proper question formatting
1877 case "$COLUMNS" in
1878 '') COLUMNS='80';;
1879 esac
1880
1881 : set up the echo used in my read
1882 myecho="case \"\$xxxm\" in
1883 '') echo $n \"\$rp $c\" >&4;;
1884 *) case \"\$rp\" in
1885         '') echo $n \"[\$xxxm] $c\";;
1886         *)
1887                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1888                         echo \"\$rp\" >&4
1889                         echo $n \"[\$xxxm] $c\" >&4
1890                 else
1891                         echo $n \"\$rp [\$xxxm] $c\" >&4
1892                 fi
1893                 ;;
1894         esac;;
1895 esac"
1896
1897 : now set up to do reads with possible shell escape and default assignment
1898 cat <<EOSC >myread
1899 $startsh
1900 xxxm=\$dflt
1901 $myecho
1902 ans='!'
1903 case "\$fastread" in
1904 yes) case "\$dflt" in
1905         '') ;;
1906         *) ans='';
1907                 case "\$silent-\$rp" in
1908                 true-) ;;
1909                 *) echo " " >&4;;
1910                 esac;;
1911         esac;;
1912 *) case "\$silent" in
1913         true) case "\$rp" in
1914                 '') ans='';;
1915                 esac;;
1916         esac;;
1917 esac
1918 while expr "X\$ans" : "X!" >/dev/null; do
1919         read answ
1920         set x \$xxxm
1921         shift
1922         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1923         case  "\$answ" in
1924         "!")
1925                 sh 1>&4
1926                 echo " "
1927                 $myecho
1928                 ;;
1929         !*)
1930                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1931                 shift
1932                 sh 1>&4 -c "\$*"
1933                 echo " "
1934                 $myecho
1935                 ;;
1936         "\$ans")
1937                 case "\$ans" in
1938                 \\&*)
1939                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1940                         shift
1941                         case "\$1" in
1942                         -d)
1943                                 fastread=yes
1944                                 echo "(OK, I'll run with -d after this question.)" >&4
1945                                 ;;
1946                         -*)
1947                                 echo "*** Sorry, \$1 not supported yet." >&4
1948                                 ;;
1949                         esac
1950                         $myecho
1951                         ans=!
1952                         ;;
1953                 esac;;
1954         *)
1955                 case "\$aok" in
1956                 y)
1957                         echo "*** Substitution done -- please confirm."
1958                         xxxm="\$ans"
1959                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1960                         xxxm="\$ans"
1961                         ans=!
1962                         ;;
1963                 *)
1964                         echo "*** Error -- try again."
1965                         ans=!
1966                         ;;
1967                 esac
1968                 $myecho
1969                 ;;
1970         esac
1971         case "\$ans\$xxxm\$nostick" in
1972         '')
1973                 ans=!
1974                 $myecho
1975                 ;;
1976         esac
1977 done
1978 case "\$ans" in
1979 '') ans="\$xxxm";;
1980 esac
1981 EOSC
1982
1983 : create .config dir to save info across Configure sessions
1984 test -d ../.config || mkdir ../.config
1985 cat >../.config/README <<EOF
1986 This directory created by Configure to save information that should
1987 persist across sessions for $package.
1988
1989 You may safely delete it if you wish.
1990 EOF
1991
1992 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1993 case "$usedevel" in
1994 $define|true|[yY]*) ;;
1995 *) case "$xversion" in
1996    *[13579])
1997         cat >&4 <<EOH
1998 *** WHOA THERE!!! ***
1999
2000     This is an UNSTABLE DEVELOPMENT release.
2001     The version of this $package distribution is $xversion, that is, odd,
2002     (as opposed to even) and that signifies a development release.
2003     If you want a maintenance release, you want an even-numbered version.
2004
2005     Do ***NOT*** install this into production use.
2006     Data corruption and crashes are possible.
2007
2008     It is most seriously suggested that you do not continue any further
2009     unless you want to help in developing and debugging Perl.
2010
2011     If you *still* want to build perl, you can answer 'y' now,
2012     or pass -Dusedevel to Configure.
2013
2014 EOH
2015         rp='Do you really want to continue?'
2016         dflt='n'
2017         . ./myread
2018         case "$ans" in
2019         [yY]) echo >&4 "Okay, continuing."
2020               usedevel="$define" ;;
2021         *) echo >&4 "Okay, bye."
2022            exit 1
2023            ;;
2024         esac
2025         ;;
2026     esac
2027     ;;
2028 esac
2029 case "$usedevel" in
2030 $define|true|[yY]*)
2031         case "$versiononly" in
2032         '') versiononly="$define" ;;
2033         esac
2034         case "$installusrbinperl" in
2035         '') installusrbinperl="$undef" ;;
2036         esac
2037         ;;
2038 esac
2039
2040 : general instructions
2041 needman=true
2042 firsttime=true
2043 user=`(logname) 2>/dev/null`
2044 case "$user" in
2045 '') user=`whoami 2>&1`;;
2046 esac
2047 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2048         firsttime=false
2049         echo " "
2050         rp='Would you like to see the instructions?'
2051         dflt=n
2052         . ./myread
2053         case "$ans" in
2054         [yY]*) ;;
2055         *) needman=false;;
2056         esac
2057 fi
2058 if $needman; then
2059         cat <<EOH
2060
2061 This installation shell script will examine your system and ask you questions
2062 to determine how the perl5 package should be installed. If you get
2063 stuck on a question, you may use a ! shell escape to start a subshell or
2064 execute a command.  Many of the questions will have default answers in square
2065 brackets; typing carriage return will give you the default.
2066
2067 On some of the questions which ask for file or directory names you are allowed
2068 to use the ~name construct to specify the login directory belonging to "name",
2069 even if you don't have a shell which knows about that.  Questions where this is
2070 allowed will be marked "(~name ok)".
2071
2072 EOH
2073         rp=''
2074         dflt='Type carriage return to continue'
2075         . ./myread
2076         cat <<'EOH'
2077
2078 The prompter used in this script allows you to use shell variables and
2079 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2080 in the default answer, as if the default line was a set of arguments given to a
2081 script shell.  This means you may also use $* to repeat the whole default line,
2082 so you do not have to re-type everything to add something to the default.
2083
2084 Everytime there is a substitution, you will have to confirm.  If there is an
2085 error (e.g. an unmatched backtick), the default answer will remain unchanged
2086 and you will be prompted again.
2087
2088 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2089 the questions and use the computed defaults (or the previous answers if there
2090 was already a config.sh file). Type 'Configure -h' for a list of options.
2091 You may also start interactively and then answer '& -d' at any prompt to turn
2092 on the non-interactive behaviour for the remainder of the execution.
2093
2094 EOH
2095         . ./myread
2096         cat <<EOH
2097
2098 Much effort has been expended to ensure that this shell script will run on any
2099 Unix system.  If despite that it blows up on yours, your best bet is to edit
2100 Configure and run it again.  If you can't run Configure for some reason,
2101 you'll have to generate a config.sh file by hand.  Whatever problems you
2102 have, let me (perlbug@perl.org) know how I blew it.
2103
2104 This installation script affects things in two ways:
2105
2106 1) it may do direct variable substitutions on some of the files included
2107    in this kit.
2108 2) it builds a config.h file for inclusion in C programs.  You may edit
2109    any of these files as the need arises after running this script.
2110
2111 If you make a mistake on a question, there is no easy way to back up to it
2112 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2113 files.  Configure will offer to let you do this before it runs the SH files.
2114
2115 EOH
2116         dflt='Type carriage return to continue'
2117         . ./myread
2118         case "$firsttime" in
2119         true) echo $user >>../.config/instruct;;
2120         esac
2121 fi
2122
2123 : find out where common programs are
2124 echo " "
2125 echo "Locating common programs..." >&4
2126 cat <<EOSC >loc
2127 $startsh
2128 case \$# in
2129 0) exit 1;;
2130 esac
2131 thing=\$1
2132 shift
2133 dflt=\$1
2134 shift
2135 for dir in \$*; do
2136         case "\$thing" in
2137         .)
2138         if test -d \$dir/\$thing; then
2139                 echo \$dir
2140                 exit 0
2141         fi
2142         ;;
2143         *)
2144         for thisthing in \$dir/\$thing; do
2145                 : just loop through to pick last item
2146         done
2147         if test -f \$thisthing; then
2148                 echo \$thisthing
2149                 exit 0
2150         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2151                 echo \$thisthing
2152                 exit 0
2153         elif test -f \$dir/\$thing.exe; then
2154                 if test -n "$DJGPP"; then
2155                         echo \$dir/\$thing.exe
2156                 else
2157                         : on Eunice apparently
2158                         echo \$dir/\$thing
2159                 fi
2160                 exit 0
2161         fi
2162         ;;
2163         esac
2164 done
2165 echo \$dflt
2166 exit 1
2167 EOSC
2168 chmod +x loc
2169 $eunicefix loc
2170 loclist="
2171 awk
2172 cat
2173 chmod
2174 comm
2175 cp
2176 echo
2177 expr
2178 grep
2179 ls
2180 mkdir
2181 rm
2182 sed
2183 sort
2184 touch
2185 tr
2186 uniq
2187 "
2188 trylist="
2189 Mcc
2190 ar
2191 bison
2192 byacc
2193 cpp
2194 csh
2195 date
2196 egrep
2197 gmake
2198 gzip
2199 less
2200 ln
2201 make
2202 more
2203 nm
2204 nroff
2205 pg
2206 test
2207 uname
2208 zip
2209 "
2210 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2211 pth="$pth /lib /usr/lib"
2212 for file in $loclist; do
2213         eval xxx=\$$file
2214         case "$xxx" in
2215         /*|?:[\\/]*)
2216                 if test -f "$xxx"; then
2217                         : ok
2218                 else
2219                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2220                         xxx=`./loc $file $file $pth`
2221                 fi
2222                 ;;
2223         '') xxx=`./loc $file $file $pth`;;
2224         *) xxx=`./loc $xxx $xxx $pth`;;
2225         esac
2226         eval $file=$xxx$_exe
2227         eval _$file=$xxx
2228         case "$xxx" in
2229         /*)
2230                 echo $file is in $xxx.
2231                 ;;
2232         ?:[\\/]*)
2233                 echo $file is in $xxx.
2234                 ;;
2235         *)
2236                 echo "I don't know where '$file' is, and my life depends on it." >&4
2237                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2238                 exit 1
2239                 ;;
2240         esac
2241 done
2242 echo " "
2243 echo "Don't worry if any of the following aren't found..."
2244 say=offhand
2245 for file in $trylist; do
2246         eval xxx=\$$file
2247         case "$xxx" in
2248         /*|?:[\\/]*)
2249                 if test -f "$xxx"; then
2250                         : ok
2251                 else
2252                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2253                         xxx=`./loc $file $file $pth`
2254                 fi
2255                 ;;
2256         '') xxx=`./loc $file $file $pth`;;
2257         *) xxx=`./loc $xxx $xxx $pth`;;
2258         esac
2259         eval $file=$xxx$_exe
2260         eval _$file=$xxx
2261         case "$xxx" in
2262         /*)
2263                 echo $file is in $xxx.
2264                 ;;
2265         ?:[\\/]*)
2266                 echo $file is in $xxx.
2267                 ;;
2268         *)
2269                 echo "I don't see $file out there, $say."
2270                 say=either
2271                 ;;
2272         esac
2273 done
2274 case "$egrep" in
2275 egrep)
2276         echo "Substituting grep for egrep."
2277         egrep=$grep
2278         _egrep=$grep
2279         ;;
2280 esac
2281 case "$ln" in
2282 ln)
2283         echo "Substituting cp for ln."
2284         ln=$cp
2285         _ln=$cp
2286         ;;
2287 esac
2288 case "$make" in
2289 make)   
2290         case "$gmake" in
2291         gmake)
2292         echo "I can't find make or gmake, and my life depends on it." >&4
2293         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2294         exit 1
2295         ;;
2296         esac
2297         ;;
2298 esac    
2299 case "$gmake" in
2300 gmake)  ;;
2301 *)      # We can't have osname yet.
2302         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2303                 # Assume that gmake, if found, is definitely GNU make
2304                 # and prefer it over the system make.
2305                 echo "Substituting gmake for make."
2306                 make=$gmake
2307                 _make=$gmake
2308         fi
2309         ;;
2310 esac
2311 case "$test" in
2312 test)
2313         echo "Hopefully test is built into your sh."
2314         ;;
2315 *)
2316         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2317                 echo "Using the test built into your sh."
2318                 test=test
2319                 _test=test
2320         fi
2321         ;;
2322 esac
2323 case "$echo" in
2324 echo)
2325         echo "Hopefully echo is built into your sh."
2326         ;;
2327 '') ;;
2328 *)
2329         echo " "
2330 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2331         $echo $n "hi there$c" >foo1
2332         echo $n "hi there$c" >foo2
2333         if cmp foo1 foo2 >/dev/null 2>&1; then
2334                 echo "They are compatible.  In fact, they may be identical."
2335         else
2336                 case "$n" in
2337                 '-n') n='' c='\c';;
2338                 *) n='-n' c='';;
2339                 esac
2340                 cat <<FOO
2341 They are not compatible!  You are probably running ksh on a non-USG system.
2342 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2343 have echo built in and we may have to run some Bourne shell scripts.  That
2344 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2345
2346 FOO
2347                 $echo $n "The star should be here-->$c"
2348                 $echo "*"
2349         fi
2350         $rm -f foo1 foo2
2351         ;;
2352 esac
2353
2354 cat <<EOS >trygcc
2355 $startsh
2356 EOS
2357 cat <<'EOSC' >>trygcc
2358 case "$cc" in
2359 '') ;;
2360 *)  $rm -f try try.*
2361     $cat >try.c <<EOM
2362 int main(int argc, char *argv[]) {
2363   return 0;
2364 }
2365 EOM
2366     if $cc -o try $ccflags $ldflags try.c; then
2367        :
2368     else
2369         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2370         despair=yes
2371         trygcc=yes
2372         case "$cc" in
2373         *gcc*) trygcc=no ;;
2374         esac
2375         case "`$cc -v -c try.c 2>&1`" in
2376         *gcc*) trygcc=no ;;
2377         esac
2378         if $test X"$trygcc" = Xyes; then
2379             if gcc -o try -c try.c; then
2380                 echo " "
2381                 echo "You seem to have a working gcc, though." >&4
2382                 rp="Would you like to use it?"
2383                 dflt=y
2384                 if $test -f myread; then
2385                     . ./myread
2386                 else
2387                     if $test -f UU/myread; then
2388                         . ./UU/myread
2389                     else
2390                         echo "Cannot find myread, sorry.  Aborting." >&2
2391                         exit 1
2392                     fi
2393                 fi  
2394                 case "$ans" in
2395                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2396                        if $test -f usethreads.cbu; then
2397                            $cat >&4 <<EOM 
2398
2399 *** However, any setting of the C compiler flags (e.g. for thread support)
2400 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2401 *** (together with e.g. -Dusethreads).
2402
2403 EOM
2404                        fi;;
2405                 esac
2406             fi
2407         fi
2408     fi
2409     $rm -f try try.*
2410     ;;
2411 esac
2412 EOSC
2413
2414 cat <<EOS >checkcc
2415 $startsh
2416 EOS
2417 cat <<'EOSC' >>checkcc
2418 case "$cc" in        
2419 '') ;;
2420 *)  $rm -f try try.*              
2421     $cat >try.c <<EOM
2422 int main(int argc, char *argv[]) {
2423   return 0;
2424 }
2425 EOM
2426     if $cc -o try $ccflags $ldflags try.c; then
2427        :
2428     else
2429         if $test X"$despair" = Xyes; then
2430            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2431         fi
2432         $cat >&4 <<EOM         
2433 You need to find a working C compiler.
2434 Either (purchase and) install the C compiler supplied by your OS vendor,
2435 or for a free C compiler try http://gcc.gnu.org/
2436 I cannot continue any further, aborting.
2437 EOM
2438         exit 1
2439     fi
2440     $rm -f try try.*
2441     ;;
2442 esac
2443 EOSC
2444
2445 : determine whether symbolic links are supported
2446 echo " "
2447 $touch blurfl
2448 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2449         echo "Symbolic links are supported." >&4
2450         lns="$ln -s"
2451 else
2452         echo "Symbolic links are NOT supported." >&4
2453         lns="$ln"
2454 fi
2455 $rm -f blurfl sym
2456
2457 : determine whether symbolic links are supported
2458 echo " "
2459 case "$lns" in
2460 *"ln"*" -s")
2461         echo "Checking how to test for symbolic links..." >&4
2462         $lns blurfl sym
2463         if $test "X$issymlink" = X; then
2464                 case "$newsh" in
2465                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2466                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2467                 esac
2468                 if test $? = 0; then
2469                         issymlink="test -h"
2470                 else
2471                         echo "Your builtin 'test -h' may be broken." >&4
2472                         case "$test" in
2473                         /*)     ;;
2474                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2475                                 for p in $pth
2476                                 do
2477                                         if test -f "$p/$test"; then
2478                                                 test="$p/$test"
2479                                                 break
2480                                         fi
2481                                 done
2482                                 ;;
2483                         esac
2484                         case "$test" in
2485                         /*)
2486                                 echo "Trying external '$test -h'." >&4
2487                                 issymlink="$test -h"
2488                                 if $test ! -h sym >/dev/null 2>&1; then
2489                                         echo "External '$test -h' is broken, too." >&4
2490                                         issymlink=''
2491                                 fi
2492                                 ;;
2493                         *)      issymlink='' ;;
2494                         esac
2495                 fi              
2496         fi
2497         if $test "X$issymlink" = X; then
2498                 if $test -L sym 2>/dev/null; then
2499                         issymlink="$test -L"
2500                         echo "The builtin '$test -L' worked." >&4
2501                 fi
2502         fi
2503         if $test "X$issymlink" != X; then
2504                 echo "You can test for symbolic links with '$issymlink'." >&4
2505         else
2506                 echo "I do not know how you can test for symbolic links." >&4
2507         fi
2508         $rm -f blurfl sym
2509         ;;
2510 *)      echo "No symbolic links, so not testing for their testing..." >&4
2511         ;;
2512 esac
2513 echo " "
2514
2515
2516 case "$mksymlinks" in
2517 $define|true|[yY]*)
2518         case "$src" in
2519         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2520                 exit 1
2521                 ;;
2522         *)      case "$lns:$issymlink" in
2523                 *"ln"*" -s:"*"test -"?)
2524                         echo "Creating the symbolic links..." >&4
2525                         echo "(First creating the subdirectories...)" >&4
2526                         cd ..
2527                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2528                                 read directory
2529                                 test -z "$directory" && break
2530                                 mkdir -p $directory
2531                         done
2532                         # Sanity check 1.
2533                         if test ! -d t/base; then
2534                                 echo "Failed to create the subdirectories.  Aborting." >&4
2535                                 exit 1
2536                         fi
2537                         echo "(Then creating the symlinks...)" >&4
2538                         awk '{print $1}' $src/MANIFEST | while true; do
2539                                 read filename
2540                                 test -z "$filename" && break
2541                                 if test -f $filename; then
2542                                         if $issymlink $filename; then
2543                                                 rm -f $filename
2544                                         fi
2545                                 fi
2546                                 if test -f $filename; then
2547                                         echo "$filename already exists, not symlinking."
2548                                 else
2549                                         ln -s $src/$filename $filename
2550                                 fi
2551                         done
2552                         # Sanity check 2.
2553                         if test ! -f t/base/lex.t; then
2554                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2555                                 exit 1
2556                         fi
2557                         cd UU
2558                         ;;
2559                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2560                         ;;
2561                 esac
2562                 ;;
2563         esac
2564         ;;
2565 esac
2566
2567
2568 case "$usecrosscompile" in
2569 $define|true|[yY]*)
2570         $echo "Cross-compiling..."
2571         croak=''
2572         case "$cc" in
2573         *-*-gcc) # A cross-compiling gcc, probably.
2574             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2575             ar=$targetarch-ar
2576             # leave out ld, choosing it is more complex
2577             nm=$targetarch-nm
2578             ranlib=$targetarch-ranlib
2579             $echo 'extern int foo;' > try.c
2580             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2581             shift
2582             if $test $# -gt 0; then
2583                 incpth="$incpth $*"
2584                 incpth="`$echo $incpth|$sed 's/^ //'`"
2585                 echo "Guessing incpth '$incpth'." >&4
2586                 for i in $*; do
2587                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2588                     if $test -d $j; then
2589                         libpth="$libpth $j"
2590                     fi
2591                 done   
2592                 libpth="`$echo $libpth|$sed 's/^ //'`"
2593                 echo "Guessing libpth '$libpth'." >&4
2594             fi
2595             $rm -f try.c
2596             ;;
2597         esac
2598         case "$targetarch" in
2599         '') echo "Targetarch not defined." >&4; croak=y ;;
2600         *)  echo "Using targetarch $targetarch." >&4 ;;
2601         esac
2602         case "$incpth" in
2603         '') echo "Incpth not defined." >&4; croak=y ;;
2604         *)  echo "Using incpth '$incpth'." >&4 ;;
2605         esac
2606         case "$libpth" in
2607         '') echo "Libpth not defined." >&4; croak=y ;;
2608         *)  echo "Using libpth '$libpth'." >&4 ;;
2609         esac
2610         case "$usrinc" in
2611         '') for i in $incpth; do
2612                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2613                     usrinc=$i
2614                     echo "Guessing usrinc $usrinc." >&4
2615                     break
2616                 fi
2617             done
2618             case "$usrinc" in
2619             '') echo "Usrinc not defined." >&4; croak=y ;;
2620             esac
2621             ;;
2622         *)  echo "Using usrinc $usrinc." >&4 ;;
2623         esac
2624         case "$targethost" in
2625         '') echo "Targethost not defined." >&4; croak=y ;;
2626         *)  echo "Using targethost $targethost." >&4
2627         esac
2628         locincpth=' '
2629         loclibpth=' '
2630         case "$croak" in
2631         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2632         esac
2633         case "$src" in
2634         /*) run=$src/Cross/run
2635             targetmkdir=$src/Cross/mkdir
2636             to=$src/Cross/to
2637             from=$src/Cross/from
2638             ;;
2639         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2640             run=$pwd/Cross/run
2641             targetmkdir=$pwd/Cross/mkdir
2642             to=$pwd/Cross/to
2643             from=$pwd/Cross/from
2644             ;;
2645         esac
2646         case "$targetrun" in
2647         '') targetrun=ssh ;;
2648         esac
2649         case "$targetto" in
2650         '') targetto=scp ;;
2651         esac
2652         case "$targetfrom" in
2653         '') targetfrom=scp ;;
2654         esac
2655         run=$run-$targetrun
2656         to=$to-$targetto
2657         from=$from-$targetfrom
2658         case "$targetdir" in
2659         '')  targetdir=/tmp
2660              echo "Guessing targetdir $targetdir." >&4
2661              ;;
2662         esac
2663         case "$targetuser" in
2664         '')  targetuser=root
2665              echo "Guessing targetuser $targetuser." >&4
2666              ;;
2667         esac
2668         case "$targetfrom" in
2669         scp)    q=-q ;;
2670         *)      q='' ;;
2671         esac
2672         case "$targetrun" in
2673         ssh|rsh)
2674             cat >$run <<EOF
2675 #!/bin/sh
2676 case "\$1" in
2677 -cwd)
2678   shift
2679   cwd=\$1
2680   shift
2681   ;;
2682 esac
2683 case "\$cwd" in
2684 '') cwd=$targetdir ;;
2685 esac
2686 exe=\$1
2687 shift
2688 if $test ! -f \$exe.xok; then
2689   $to \$exe
2690   $touch \$exe.xok
2691 fi
2692 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2693 EOF
2694             ;;
2695         *)  echo "Unknown targetrun '$targetrun'" >&4
2696             exit 1
2697             ;;
2698         esac
2699         case "$targetmkdir" in
2700         */Cross/mkdir)
2701             cat >$targetmkdir <<EOF
2702 #!/bin/sh
2703 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2704 EOF
2705             $chmod a+rx $targetmkdir
2706             ;;
2707         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2708             exit 1
2709             ;;
2710         esac
2711         case "$targetto" in
2712         scp|rcp)
2713             cat >$to <<EOF
2714 #!/bin/sh
2715 for f in \$@
2716 do
2717   case "\$f" in
2718   /*)
2719     $targetmkdir \`dirname \$f\`
2720     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2721     ;;
2722   *)
2723     $targetmkdir $targetdir/\`dirname \$f\`
2724     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2725     ;;
2726   esac
2727 done
2728 exit 0
2729 EOF
2730             ;;
2731         cp) cat >$to <<EOF
2732 #!/bin/sh
2733 for f in \$@
2734 do
2735   case "\$f" in
2736   /*)
2737     $mkdir -p $targetdir/\`dirname \$f\`
2738     $cp \$f $targetdir/\$f || exit 1
2739     ;;
2740   *)
2741     $targetmkdir $targetdir/\`dirname \$f\`
2742     $cp \$f $targetdir/\$f || exit 1
2743     ;;
2744   esac
2745 done
2746 exit 0
2747 EOF
2748             ;;
2749         *)  echo "Unknown targetto '$targetto'" >&4
2750             exit 1
2751             ;;
2752         esac
2753         case "$targetfrom" in
2754         scp|rcp)
2755           cat >$from <<EOF
2756 #!/bin/sh
2757 for f in \$@
2758 do
2759   $rm -f \$f
2760   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2761 done
2762 exit 0
2763 EOF
2764             ;;
2765         cp) cat >$from <<EOF
2766 #!/bin/sh
2767 for f in \$@
2768 do
2769   $rm -f \$f
2770   cp $targetdir/\$f . || exit 1
2771 done
2772 exit 0
2773 EOF
2774             ;;
2775         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2776             exit 1
2777             ;;
2778         esac
2779         if $test ! -f $run; then
2780             echo "Target 'run' script '$run' not found." >&4
2781         else
2782             $chmod a+rx $run
2783         fi
2784         if $test ! -f $to; then
2785             echo "Target 'to' script '$to' not found." >&4
2786         else
2787             $chmod a+rx $to
2788         fi
2789         if $test ! -f $from; then
2790             echo "Target 'from' script '$from' not found." >&4
2791         else
2792             $chmod a+rx $from
2793         fi
2794         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2795             exit 1
2796         fi
2797         cat >&4 <<EOF
2798 Using '$run' for remote execution,
2799 and '$from' and '$to'
2800 for remote file transfer.
2801 EOF
2802         ;;
2803 *)      run=''
2804         to=:
2805         from=:
2806         usecrosscompile='undef'
2807         targetarch=''
2808         ;;
2809 esac
2810
2811 : see whether [:lower:] and [:upper:] are supported character classes
2812 echo " "
2813 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2814 ABYZ)
2815         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2816         up='[:upper:]'
2817         low='[:lower:]'
2818         ;;
2819 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2820         # (0xc9 and 0xd1), therefore that is a nice testing point.
2821         if test "X$up" = X -o "X$low" = X; then
2822             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2823             ij) up='[A-Z]'
2824                 low='[a-z]'
2825                 ;;
2826             esac
2827         fi
2828         if test "X$up" = X -o "X$low" = X; then
2829             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2830             ij) up='A-Z'
2831                 low='a-z'
2832                 ;;
2833             esac
2834         fi
2835         if test "X$up" = X -o "X$low" = X; then
2836             case "`echo IJ | od -x 2>/dev/null`" in
2837             *C9D1*|*c9d1*)
2838                 echo "Hey, this might be EBCDIC." >&4
2839                 if test "X$up" = X -o "X$low" = X; then
2840                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2841                     ij) up='[A-IJ-RS-Z]'
2842                         low='[a-ij-rs-z]'
2843                         ;;
2844                     esac
2845                 fi
2846                 if test "X$up" = X -o "X$low" = X; then
2847                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2848                     ij) up='A-IJ-RS-Z'
2849                         low='a-ij-rs-z'
2850                         ;;
2851                     esac
2852                 fi
2853                 ;;
2854             esac
2855         fi
2856 esac
2857 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2858 ij)
2859     echo "Using $up and $low to convert case." >&4
2860     ;;
2861 *)
2862     echo "I don't know how to translate letters from upper to lower case." >&4
2863     echo "Your tr is not acting any way I know of." >&4
2864     exit 1
2865     ;;
2866 esac
2867 : set up the translation script tr, must be called with ./tr of course
2868 cat >tr <<EOSC
2869 $startsh
2870 case "\$1\$2" in
2871 '[A-Z][a-z]') exec $tr '$up' '$low';;
2872 '[a-z][A-Z]') exec $tr '$low' '$up';;
2873 esac
2874 exec $tr "\$@"
2875 EOSC
2876 chmod +x tr
2877 $eunicefix tr
2878
2879 : Try to determine whether config.sh was made on this system
2880 case "$config_sh" in
2881 '')
2882 myuname=`$uname -a 2>/dev/null`
2883 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2884 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2885 # because the A-Z/a-z are not consecutive.
2886 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2887         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2888 newmyuname="$myuname"
2889 dflt=n
2890 case "$knowitall" in
2891 '')
2892         if test -f ../config.sh; then
2893                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2894                         eval "`grep myuname= ../config.sh`"
2895                 fi
2896                 if test "X$myuname" = "X$newmyuname"; then
2897                         dflt=y
2898                 fi
2899         fi
2900         ;;
2901 *) dflt=y;;
2902 esac
2903
2904 : Get old answers from old config file if Configure was run on the
2905 : same system, otherwise use the hints.
2906 hint=default
2907 cd ..
2908 if test -f config.sh; then
2909         echo " "
2910         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2911         . UU/myread
2912         case "$ans" in
2913         n*|N*) echo "OK, I'll ignore it."
2914                 mv config.sh config.sh.old
2915                 myuname="$newmyuname"
2916                 ;;
2917         *)  echo "Fetching default answers from your old config.sh file..." >&4
2918                 tmp_n="$n"
2919                 tmp_c="$c"
2920                 tmp_sh="$sh"
2921                 . ./config.sh
2922                 cp config.sh UU
2923                 n="$tmp_n"
2924                 c="$tmp_c"
2925                 : Older versions did not always set $sh.  Catch re-use of such
2926                 : an old config.sh.
2927                 case "$sh" in
2928                 '') sh="$tmp_sh" ;;
2929                 esac
2930                 hint=previous
2931                 ;;
2932         esac
2933 fi
2934 . ./UU/checkcc
2935 if test ! -f config.sh; then
2936         $cat <<EOM
2937
2938 First time through, eh?  I have some defaults handy for some systems
2939 that need some extra help getting the Configure answers right:
2940
2941 EOM
2942         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2943         dflt=''
2944         : Half the following guesses are probably wrong... If you have better
2945         : tests or hints, please send them to perlbug@perl.org
2946         : The metaconfig authors would also appreciate a copy...
2947         $test -f /irix && osname=irix
2948         $test -f /xenix && osname=sco_xenix
2949         $test -f /dynix && osname=dynix
2950         $test -f /dnix && osname=dnix
2951         $test -f /lynx.os && osname=lynxos
2952         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2953         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2954         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2955         $test -f /bin/mips && /bin/mips && osname=mips
2956         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2957                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2958         $test -d /usr/apollo/bin && osname=apollo
2959         $test -f /etc/saf/_sactab && osname=svr4
2960         $test -d /usr/include/minix && osname=minix
2961         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2962         if $test -d /MachTen -o -d /MachTen_Folder; then
2963                 osname=machten
2964                 if $test -x /sbin/version; then
2965                         osvers=`/sbin/version | $awk '{print $2}' |
2966                         $sed -e 's/[A-Za-z]$//'`
2967                 elif $test -x /usr/etc/version; then
2968                         osvers=`/usr/etc/version | $awk '{print $2}' |
2969                         $sed -e 's/[A-Za-z]$//'`
2970                 else
2971                         osvers="$2.$3"
2972                 fi
2973         fi
2974
2975         $test -f /sys/posix.dll &&
2976                 $test -f /usr/bin/what &&
2977                 set X `/usr/bin/what /sys/posix.dll` &&
2978                 $test "$3" = UWIN &&
2979                 osname=uwin &&
2980                 osvers="$5"
2981
2982         if $test -f $uname; then
2983                 set X $myuname
2984                 shift
2985
2986                 case "$5" in
2987                 fps*) osname=fps ;;
2988                 mips*)
2989                         case "$4" in
2990                         umips) osname=umips ;;
2991                         *) osname=mips ;;
2992                         esac;;
2993                 [23]100) osname=mips ;;
2994                 next*) osname=next ;;
2995                 i386*)
2996                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2997                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2998                                 osname='sco'
2999                                 osvers=$tmp
3000                         elif $test -f /etc/kconfig; then
3001                                 osname=isc
3002                                 if test "$lns" = "$ln -s"; then
3003                                         osvers=4
3004                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3005                                         osvers=3
3006                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3007                                         osvers=2
3008                                 fi
3009                         fi
3010                         tmp=''
3011                         ;;
3012                 pc*)
3013                         if test -n "$DJGPP"; then
3014                                 osname=dos
3015                                 osvers=djgpp
3016                         fi
3017                         ;;
3018                 esac
3019
3020                 case "$1" in
3021                 aix) osname=aix
3022                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3023                         case "$tmp" in
3024                         'not found') osvers="$4"."$3" ;;
3025                         '<3240'|'<>3240') osvers=3.2.0 ;;
3026                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3027                         '=3250'|'>3250') osvers=3.2.5 ;;
3028                         *) osvers=$tmp;;
3029                         esac
3030                         ;;
3031                 bsd386) osname=bsd386
3032                         osvers=`$uname -r`
3033                         ;;
3034                 cygwin*) osname=cygwin
3035                         osvers="$3"
3036                         ;;
3037                 *dc.osx) osname=dcosx
3038                         osvers="$3"
3039                         ;;
3040                 dnix) osname=dnix
3041                         osvers="$3"
3042                         ;;
3043                 domainos) osname=apollo
3044                         osvers="$3"
3045                         ;;
3046                 dgux) osname=dgux 
3047                         osvers="$3"
3048                         ;;
3049                 dynixptx*) osname=dynixptx
3050                         osvers=`echo "$4"|sed 's/^v//'`
3051                         ;;
3052                 freebsd) osname=freebsd 
3053                         osvers="$3" ;;
3054                 genix) osname=genix ;;
3055                 hp*) osname=hpux 
3056                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3057                         ;;
3058                 irix*) osname=irix
3059                         case "$3" in
3060                         4*) osvers=4 ;;
3061                         5*) osvers=5 ;;
3062                         *)      osvers="$3" ;;
3063                         esac
3064                         ;;
3065                 linux) osname=linux
3066                         case "$3" in
3067                         *)      osvers="$3" ;;
3068                         esac
3069                         ;;
3070                 MiNT) osname=mint
3071                         ;;
3072                 netbsd*) osname=netbsd
3073                         osvers="$3"
3074                         ;;
3075                 news-os) osvers="$3"
3076                         case "$3" in
3077                         4*) osname=newsos4 ;;
3078                         *) osname=newsos ;;
3079                         esac
3080                         ;;
3081                 next*) osname=next ;;
3082                 nonstop-ux) osname=nonstopux ;;
3083                 openbsd) osname=openbsd
3084                         osvers="$3"
3085                         ;;
3086                 POSIX-BC | posix-bc ) osname=posix-bc
3087                         osvers="$3"
3088                         ;;
3089                 powerux | power_ux | powermax_os | powermaxos | \
3090                 powerunix | power_unix) osname=powerux
3091                         osvers="$3"
3092                         ;;
3093                 qnx) osname=qnx
3094                         osvers="$4"
3095                         ;;
3096                 solaris) osname=solaris
3097                         case "$3" in
3098                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3099                         *)      osvers="$3" ;;
3100                         esac
3101                         ;;
3102                 sunos) osname=sunos
3103                         case "$3" in
3104                         5*) osname=solaris
3105                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3106                         *)      osvers="$3" ;;
3107                         esac
3108                         ;;
3109                 titanos) osname=titanos
3110                         case "$3" in
3111                         1*) osvers=1 ;;
3112                         2*) osvers=2 ;;
3113                         3*) osvers=3 ;;
3114                         4*) osvers=4 ;;
3115                         *)      osvers="$3" ;;
3116                         esac
3117                         ;;
3118                 ultrix) osname=ultrix
3119                         osvers="$3"
3120                         ;;
3121                 osf1|mls+)      case "$5" in
3122                                 alpha)
3123                                         osname=dec_osf
3124                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3125                                         case "$osvers" in
3126                                         [1-9].[0-9]*) ;;
3127                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3128                                         esac
3129                                         ;;
3130                         hp*)    osname=hp_osf1  ;;
3131                         mips)   osname=mips_osf1 ;;
3132                         esac
3133                         ;;
3134                 unixware) osname=svr5
3135                         osvers="$4"
3136                         ;;
3137                 uts)    osname=uts
3138                         osvers="$3"
3139                         ;;
3140                 vos) osvers="$3"
3141                         ;;
3142                 $2) case "$osname" in
3143                         *isc*) ;;
3144                         *freebsd*) ;;
3145                         svr*)
3146                                 : svr4.x or possibly later
3147                                 case "svr$3" in 
3148                                 ${osname}*)
3149                                         osname=svr$3
3150                                         osvers=$4
3151                                         ;;
3152                                 esac
3153                                 case "$osname" in
3154                                 svr4.0)
3155                                         : Check for ESIX
3156                                         if test -f /stand/boot ; then
3157                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3158                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3159                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3160                                                         if test -n "$isesix"; then
3161                                                                 osname=esix4
3162                                                         fi
3163                                                 fi
3164                                         fi
3165                                         ;;
3166                                 esac
3167                                 ;;
3168                         *)      if test -f /etc/systemid; then
3169                                         osname=sco
3170                                         set `echo $3 | $sed 's/\./ /g'` $4
3171                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3172                                                 osvers=$1.$2.$3
3173                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3174                                                 osvers=$1.$2
3175                                         elif $test -f $src/hints/sco_$1.sh; then
3176                                                 osvers=$1
3177                                         fi
3178                                 else
3179                                         case "$osname" in
3180                                         '') : Still unknown.  Probably a generic Sys V.
3181                                                 osname="sysv"
3182                                                 osvers="$3"
3183                                                 ;;
3184                                         esac
3185                                 fi
3186                                 ;;
3187                         esac
3188                         ;;
3189                 *)      case "$osname" in
3190                         '') : Still unknown.  Probably a generic BSD.
3191                                 osname="$1"
3192                                 osvers="$3"
3193                                 ;;
3194                         esac
3195                         ;;
3196                 esac
3197         else
3198                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3199                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3200                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3201                                 osname=news_os
3202                         fi
3203                         $rm -f UU/kernel.what
3204                 elif test -d c:/.; then
3205                         set X $myuname
3206                         osname=os2
3207                         osvers="$5"
3208                 fi
3209         fi
3210         
3211         case "$targetarch" in
3212         '') ;;
3213         *)  hostarch=$osname
3214             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3215             osvers=''
3216             ;;
3217         esac
3218
3219         : Now look for a hint file osname_osvers, unless one has been
3220         : specified already.
3221         case "$hintfile" in
3222         ''|' ')
3223                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3224                 : Also try without trailing minor version numbers.
3225                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3226                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3227                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3228                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3229                 case "$file" in
3230                 '') dflt=none ;;
3231                 *)  case "$osvers" in
3232                         '') dflt=$file
3233                                 ;;
3234                         *)  if $test -f $src/hints/$file.sh ; then
3235                                         dflt=$file
3236                                 elif $test -f $src/hints/$xfile.sh ; then
3237                                         dflt=$xfile
3238                                 elif $test -f $src/hints/$xxfile.sh ; then
3239                                         dflt=$xxfile
3240                                 elif $test -f $src/hints/$xxxfile.sh ; then
3241                                         dflt=$xxxfile
3242                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3243                                         dflt=$xxxxfile
3244                                 elif $test -f "$src/hints/${osname}.sh" ; then
3245                                         dflt="${osname}"
3246                                 else
3247                                         dflt=none
3248                                 fi
3249                                 ;;
3250                         esac
3251                         ;;
3252                 esac
3253                 if $test -f Policy.sh ; then
3254                         case "$dflt" in
3255                         *Policy*) ;;
3256                         none) dflt="Policy" ;;
3257                         *) dflt="Policy $dflt" ;;
3258                         esac
3259                 fi
3260                 ;;
3261         *)
3262                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3263                 ;;
3264         esac
3265
3266         if $test -f Policy.sh ; then
3267                 $cat <<EOM
3268
3269 There's also a Policy hint file available, which should make the
3270 site-specific (policy) questions easier to answer.
3271 EOM
3272
3273         fi
3274
3275         $cat <<EOM
3276
3277 You may give one or more space-separated answers, or "none" if appropriate.
3278 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3279 is a good thing.  DO NOT give a wrong version or a wrong OS.
3280
3281 EOM
3282
3283         rp="Which of these apply, if any?"
3284         . UU/myread
3285         tans=$ans
3286         for file in $tans; do
3287                 if $test X$file = XPolicy -a -f Policy.sh; then
3288                         . Policy.sh
3289                         $cat Policy.sh >> UU/config.sh
3290                 elif $test -f $src/hints/$file.sh; then
3291                         . $src/hints/$file.sh
3292                         $cat $src/hints/$file.sh >> UU/config.sh
3293                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3294                         : nothing
3295                 else
3296                         : Give one chance to correct a possible typo.
3297                         echo "$file.sh does not exist"
3298                         dflt=$file
3299                         rp="hint to use instead?"
3300                         . UU/myread
3301                         for file in $ans; do
3302                                 if $test -f "$src/hints/$file.sh"; then
3303                                         . $src/hints/$file.sh
3304                                         $cat $src/hints/$file.sh >> UU/config.sh
3305                                 elif $test X$ans = X -o X$ans = Xnone ; then
3306                                         : nothing
3307                                 else
3308                                         echo "$file.sh does not exist -- ignored."
3309                                 fi
3310                         done
3311                 fi
3312         done
3313
3314         hint=recommended
3315         : Remember our hint file for later.
3316         if $test -f "$src/hints/$file.sh" ; then
3317                 hintfile="$file"
3318         else
3319                 hintfile=''
3320         fi
3321 fi
3322 cd UU
3323 ;;
3324 *)
3325         echo " "
3326         echo "Fetching default answers from $config_sh..." >&4
3327         tmp_n="$n"
3328         tmp_c="$c"
3329         cd ..
3330         cp $config_sh config.sh 2>/dev/null
3331         chmod +w config.sh
3332         . ./config.sh
3333         cd UU
3334         cp ../config.sh .
3335         n="$tmp_n"
3336         c="$tmp_c"
3337         hint=previous
3338         ;;
3339 esac
3340 test "$override" && . ./optdef.sh
3341
3342 : Restore computed paths
3343 for file in $loclist $trylist; do
3344         eval $file="\$_$file"
3345 done
3346
3347 cat << EOM
3348
3349 Configure uses the operating system name and version to set some defaults.
3350 The default value is probably right if the name rings a bell. Otherwise,
3351 since spelling matters for me, either accept the default or answer "none"
3352 to leave it blank.
3353
3354 EOM
3355 case "$osname" in
3356         ''|' ')
3357                 case "$hintfile" in
3358                 ''|' '|none) dflt=none ;;
3359                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3360                 esac
3361                 ;;
3362         *) dflt="$osname" ;;
3363 esac
3364 rp="Operating system name?"
3365 . ./myread
3366 case "$ans" in
3367 none)  osname='' ;;
3368 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3369 esac
3370 echo " "
3371 case "$osvers" in
3372         ''|' ')
3373                 case "$hintfile" in
3374                 ''|' '|none) dflt=none ;;
3375                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3376                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3377                         case "$dflt" in
3378                         ''|' ') dflt=none ;;
3379                         esac
3380                         ;;
3381                 esac
3382                 ;;
3383         *) dflt="$osvers" ;;
3384 esac
3385 rp="Operating system version?"
3386 . ./myread
3387 case "$ans" in
3388 none)  osvers='' ;;
3389 *) osvers="$ans" ;;
3390 esac
3391
3392
3393 . ./posthint.sh
3394
3395 : who configured the system
3396 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3397 cf_by=`(logname) 2>/dev/null`
3398 case "$cf_by" in
3399 "")
3400         cf_by=`(whoami) 2>/dev/null`
3401         case "$cf_by" in
3402         "") cf_by=unknown ;;
3403         esac ;;
3404 esac
3405
3406 : set up the script used to warn in case of inconsistency
3407 cat <<EOS >whoa
3408 $startsh
3409 EOS
3410 cat <<'EOSC' >>whoa
3411 dflt=y
3412 echo " "
3413 echo "*** WHOA THERE!!! ***" >&4
3414 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3415 rp="    Keep the $hint value?"
3416 . ./myread
3417 case "$ans" in
3418 y) td=$was; tu=$was;;
3419 esac
3420 EOSC
3421
3422 : function used to set $1 to $val
3423 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3424 case "$val$was" in
3425 $define$undef) . ./whoa; eval "$var=\$td";;
3426 $undef$define) . ./whoa; eval "$var=\$tu";;
3427 *) eval "$var=$val";;
3428 esac'
3429
3430 case "$usesocks" in
3431 $define|true|[yY]*)     dflt='y';;
3432 *) dflt='n';;
3433 esac
3434 cat <<EOM
3435
3436 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3437 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3438 to use the PerlIO abstraction layer, this will be implicitly selected.
3439
3440 If this doesn't make any sense to you, just accept the default '$dflt'.
3441 EOM
3442 rp='Build Perl for SOCKS?'
3443 . ./myread
3444 case "$ans" in
3445 y|Y)    val="$define" ;;     
3446 *)      val="$undef" ;;
3447 esac
3448 set usesocks
3449 eval $setvar
3450
3451 case "$usesocks" in
3452 $define|true|[yY]*) useperlio="$define";;
3453 esac
3454
3455 case "$useperlio" in
3456 $define|true|[yY]*|'')  dflt='y';;
3457 *) dflt='n';;
3458 esac
3459 cat <<EOM
3460
3461 Previous version of $package used the standard IO mechanisms as
3462 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3463 alternate IO mechanisms via the PerlIO abstraction layer, but the
3464 stdio mechanism is still available if needed.  The abstraction layer
3465 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3466 Using PerlIO with sfio may cause problems with some extension modules.
3467
3468 If this doesn't make any sense to you, just accept the default '$dflt'.
3469 EOM
3470 rp='Use the PerlIO abstraction layer?'
3471 . ./myread
3472 case "$ans" in
3473 y|Y) 
3474         val="$define"
3475         ;;
3476 *)      
3477         echo "Ok, doing things the stdio way."
3478         val="$undef"
3479         ;;
3480 esac
3481 set useperlio
3482 eval $setvar 
3483
3484 case "$usesocks" in
3485 $define|true|[yY]*)
3486         case "$useperlio" in
3487         $define|true|[yY]*) ;;
3488         *)      cat >&4 <<EOM
3489
3490 You are using the SOCKS proxy protocol library which means that you
3491 should also use the PerlIO layer.  You may be headed for trouble.
3492
3493 EOM
3494                 ;;
3495         esac
3496         ;;
3497 esac
3498
3499         
3500 case "$usethreads" in
3501 $define|true|[yY]*)     dflt='y';;
3502 *)     # Catch case where user specified ithreads or 5005threads but
3503        # forgot -Dusethreads (A.D. 4/2002)
3504        case "$useithreads$use5005threads" in
3505        *$define*)      
3506                 case "$useperlio" in
3507                 "$define")      dflt='y' ;;
3508                 *)              dflt='n' ;;
3509                 esac
3510                 ;;
3511        *)       dflt='n';;
3512        esac
3513        ;;
3514 esac
3515 cat <<EOM
3516
3517 Perl can be built to take advantage of threads on some systems.
3518 To do so, Configure can be run with -Dusethreads.
3519
3520 Note that Perl built with threading support runs slightly slower
3521 and uses more memory than plain Perl. The current implementation
3522 is believed to be stable, but it is fairly new, and so should be
3523 treated with caution.
3524
3525 If this doesn't make any sense to you, just accept the default '$dflt'.
3526 EOM
3527 rp='Build a threading Perl?'
3528 . ./myread
3529 case "$ans" in
3530 y|Y)    val="$define" ;;
3531 *)      val="$undef" ;;
3532 esac
3533 set usethreads
3534 eval $setvar
3535
3536 case "$usethreads" in
3537 $define)
3538         $cat <<EOM
3539
3540 Since release 5.6, Perl has had two different threading implementations,
3541 the newer interpreter-based version (ithreads) with one interpreter per
3542 thread, and the older 5.005 version (5005threads).
3543 The 5005threads version is effectively unmaintained and will probably be
3544 removed in Perl 5.10, so there should be no need to build a Perl using it
3545 unless needed for backwards compatibility with some existing 5.005threads
3546 code.
3547
3548 EOM
3549         : Default to ithreads unless overridden on command line or with
3550         : old config.sh
3551         dflt='y'
3552         case "$use5005threads" in
3553                 $define|true|[yY]*) dflt='n';;
3554         esac
3555         case "$useithreads" in
3556                 $undef|false|[nN]*) dflt='n';;
3557         esac
3558         rp='Use the newer interpreter-based ithreads?'
3559         . ./myread
3560         case "$ans" in
3561         y|Y)    val="$define" ;;
3562         *)      val="$undef" ;;
3563         esac
3564         set useithreads
3565         eval $setvar
3566         : Now set use5005threads to the opposite value.
3567         case "$useithreads" in
3568         $define) val="$undef" ;;
3569         *) val="$define" ;;
3570         esac
3571         set use5005threads
3572         eval $setvar
3573         ;;
3574 *)
3575         useithreads="$undef"
3576         use5005threads="$undef"
3577         ;;
3578 esac
3579
3580 case "$useithreads$use5005threads" in
3581 "$define$define")
3582         $cat >&4 <<EOM
3583
3584 You cannot have both the ithreads and the 5.005 threads enabled
3585 at the same time.  Disabling the 5.005 threads since they are
3586 much less stable than the ithreads.
3587
3588 EOM
3589         use5005threads="$undef"
3590         ;;
3591 esac
3592
3593 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3594         cat >&4 <<EOF
3595 ***
3596 *** To build with ithreads you must also use the PerlIO layer.
3597 *** Cannot continue, aborting.
3598 ***
3599 EOF
3600         exit 1
3601 fi
3602
3603 case "$d_oldpthreads" in
3604 '')     : Configure tests would be welcome here.  For now, assume undef.
3605         val="$undef" ;;
3606 *)      val="$d_oldpthreads" ;;
3607 esac
3608 set d_oldpthreads
3609 eval $setvar
3610
3611
3612 case "$usethreads" in
3613 "$define"|true|[yY]*)
3614 : Look for a hint-file generated 'call-back-unit'.  If the
3615 : user has specified that a threading perl is to be built,
3616 : we may need to set or change some other defaults.
3617         if $test -f usethreads.cbu; then
3618                 echo "Your platform has some specific hints for threaded builds, using them..."
3619                 . ./usethreads.cbu
3620         else
3621                 $cat <<EOM
3622 (Your platform doesn't have any specific hints for threaded builds.
3623  Assuming POSIX threads, then.)
3624 EOM
3625         fi
3626         ;;
3627 esac
3628
3629 cat <<EOM
3630
3631 Perl can be built so that multiple Perl interpreters can coexist
3632 within the same Perl executable.
3633 EOM
3634
3635 case "$useithreads" in
3636 $define)
3637         cat <<EOM
3638 This multiple interpreter support is required for interpreter-based threads.
3639 EOM
3640         val="$define"
3641         ;;
3642 *)      case "$usemultiplicity" in
3643         $define|true|[yY]*)     dflt='y';;
3644         *) dflt='n';;
3645         esac
3646         echo " "
3647         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3648         rp='Build Perl for multiplicity?'
3649         . ./myread
3650         case "$ans" in
3651         y|Y)    val="$define" ;;
3652         *)      val="$undef" ;;
3653         esac
3654         ;;
3655 esac
3656 set usemultiplicity
3657 eval $setvar
3658
3659
3660 case "$usemorebits" in
3661 "$define"|true|[yY]*)
3662         use64bitint="$define"
3663         uselongdouble="$define"
3664         usemorebits="$define"
3665         ;;
3666 *)      usemorebits="$undef"
3667         ;;
3668 esac
3669
3670 : make some quick guesses about what we are up against
3671 echo " "
3672 $echo $n "Hmm...  $c"
3673 echo exit 1 >bsd
3674 echo exit 1 >usg
3675 echo exit 1 >v7
3676 echo exit 1 >osf1
3677 echo exit 1 >eunice
3678 echo exit 1 >xenix
3679 echo exit 1 >venix
3680 echo exit 1 >os2
3681 d_bsd="$undef"
3682 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3683 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3684 then
3685         echo "Looks kind of like an OSF/1 system, but we'll see..."
3686         echo exit 0 >osf1
3687 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3688         xxx=`./loc addbib blurfl $pth`
3689         if $test -f $xxx; then
3690         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3691                 echo exit 0 >bsd
3692                 echo exit 0 >usg
3693         else
3694                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3695                         echo "Looks kind of like an extended USG system, but we'll see..."
3696                 else
3697                         echo "Looks kind of like a USG system, but we'll see..."
3698                 fi
3699                 echo exit 0 >usg
3700         fi
3701 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3702         echo "Looks kind of like a BSD system, but we'll see..."
3703         d_bsd="$define"
3704         echo exit 0 >bsd
3705 else
3706         echo "Looks kind of like a Version 7 system, but we'll see..."
3707         echo exit 0 >v7
3708 fi
3709 case "$eunicefix" in
3710 *unixtovms*)
3711         $cat <<'EOI'
3712 There is, however, a strange, musty smell in the air that reminds me of
3713 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3714 EOI
3715         echo exit 0 >eunice
3716         d_eunice="$define"
3717 : it so happens the Eunice I know will not run shell scripts in Unix format
3718         ;;
3719 *)
3720         echo " "
3721         echo "Congratulations.  You aren't running Eunice."
3722         d_eunice="$undef"
3723         ;;
3724 esac
3725 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3726 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3727 : semicolon as a patch separator
3728 case "$p_" in
3729 :) ;;
3730 *)
3731         $cat <<'EOI'
3732 I have the feeling something is not exactly right, however...don't tell me...
3733 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3734 (Or you may be running DOS with DJGPP.)
3735 EOI
3736         echo exit 0 >os2
3737         ;;
3738 esac
3739 if test -f /xenix; then
3740         echo "Actually, this looks more like a XENIX system..."
3741         echo exit 0 >xenix
3742         d_xenix="$define"
3743 else
3744         echo " "
3745         echo "It's not Xenix..."
3746         d_xenix="$undef"
3747 fi
3748 chmod +x xenix
3749 $eunicefix xenix
3750 if test -f /venix; then
3751         echo "Actually, this looks more like a VENIX system..."
3752         echo exit 0 >venix
3753 else
3754         echo " "
3755         if ./xenix; then
3756                 : null
3757         else
3758                 echo "Nor is it Venix..."
3759         fi
3760 fi
3761 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3762 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3763 $rm -f foo
3764
3765 case "$cc" in
3766 '') dflt=cc;;
3767 *) dflt="$cc";;
3768 esac
3769 rp="Use which C compiler?"
3770 . ./myread
3771 cc="$ans"
3772
3773 : See if they have not cc but they do have gcc
3774 . ./trygcc
3775 : Look for a hint-file generated 'call-back-unit'.  Now that the
3776 : user has specified the compiler, we may need to set or change some
3777 : other defaults.
3778 if $test -f cc.cbu; then
3779     . ./cc.cbu
3780 fi
3781 . ./checkcc
3782
3783 echo " "
3784 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3785 $cat >try.c <<EOM
3786 #include <stdio.h>
3787 int main() {
3788 #ifdef __GNUC__
3789 #ifdef __VERSION__
3790         printf("%s\n", __VERSION__);
3791 #else
3792         printf("%s\n", "1");
3793 #endif
3794 #endif
3795         exit(0);
3796 }
3797 EOM
3798 if $cc -o try $ccflags $ldflags try.c; then
3799         gccversion=`$run ./try`
3800         case "$gccversion" in
3801         '') echo "You are not using GNU cc." ;;
3802         *)  echo "You are using GNU cc $gccversion."
3803             ccname=gcc  
3804             ;;
3805         esac
3806 else
3807         echo " "
3808         echo "*** WHOA THERE!!! ***" >&4
3809         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3810         case "$knowitall" in
3811         '')
3812         echo "    You'd better start hunting for one and let me know about it." >&4
3813                 exit 1
3814                 ;;
3815         esac
3816 fi
3817 $rm -f try try.*
3818 case "$gccversion" in
3819 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3820 esac
3821 case "$gccversion" in
3822 '') gccosandvers='' ;;
3823 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3824    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3825    gccshortvers=''
3826    case "$gccosandvers" in
3827    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3828    $osname$osvers) ;; # looking good
3829    $osname*) cat <<EOM >&4
3830
3831 *** WHOA THERE!!! ***
3832
3833     Your gcc has not been compiled for the exact release of
3834     your operating system ($gccosandvers versus $osname$osvers).
3835
3836     In general it is a good idea to keep gcc synchronized with
3837     the operating system because otherwise serious problems
3838     may ensue when trying to compile software, like Perl.
3839
3840     I'm trying to be optimistic here, though, and will continue.
3841     If later during the configuration and build icky compilation
3842     problems appear (headerfile conflicts being the most common
3843     manifestation), I suggest reinstalling the gcc to match
3844     your operating system release.
3845
3846 EOM
3847       ;;
3848    *) gccosandvers='' ;; # failed to parse, better be silent
3849    esac
3850    ;;
3851 esac
3852 case "$ccname" in
3853 '') ccname="$cc" ;;
3854 esac
3855
3856 # gcc 3.* complain about adding -Idirectories that they already know about,
3857 # so we will take those off from locincpth.
3858 case "$gccversion" in
3859 3*)
3860     echo "main(){}">try.c
3861     for incdir in $locincpth; do
3862        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3863              grep '^cc1: warning: changing search order '`
3864        if test "X$warn" != X; then
3865            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3866        fi
3867     done
3868     $rm -f try try.*
3869 esac
3870
3871 : decide how portable to be.  Allow command line overrides.
3872 case "$d_portable" in
3873 "$undef") ;;
3874 *)      d_portable="$define" ;;
3875 esac
3876
3877 : set up shell script to do ~ expansion
3878 cat >filexp <<EOSS
3879 $startsh
3880 : expand filename
3881 case "\$1" in
3882  ~/*|~)
3883         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3884         ;;
3885  ~*)
3886         if $test -f /bin/csh; then
3887                 /bin/csh -f -c "glob \$1"
3888                 failed=\$?
3889                 echo ""
3890                 exit \$failed
3891         else
3892                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3893                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3894                 if $test ! -d "\$dir"; then
3895                         me=\`basename \$0\`
3896                         echo "\$me: can't locate home directory for: \$name" >&2
3897                         exit 1
3898                 fi
3899                 case "\$1" in
3900                 */*)
3901                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3902                         ;;
3903                 *)
3904                         echo \$dir
3905                         ;;
3906                 esac
3907         fi
3908         ;;
3909 *)
3910         echo \$1
3911         ;;
3912 esac
3913 EOSS
3914 chmod +x filexp
3915 $eunicefix filexp
3916
3917 : now set up to get a file name
3918 cat <<EOS >getfile
3919 $startsh
3920 EOS
3921 cat <<'EOSC' >>getfile
3922 tilde=''
3923 fullpath=''
3924 already=''
3925 skip=''
3926 none_ok=''
3927 exp_file=''
3928 nopath_ok=''
3929 orig_rp="$rp"
3930 orig_dflt="$dflt"
3931 case "$gfpth" in
3932 '') gfpth='.' ;;
3933 esac
3934
3935 case "$fn" in
3936 *\(*)
3937         : getfile will accept an answer from the comma-separated list
3938         : enclosed in parentheses even if it does not meet other criteria.
3939         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3940         fn=`echo $fn | sed 's/(.*)//'`
3941         ;;
3942 esac
3943
3944 case "$fn" in
3945 *:*)
3946         loc_file=`expr $fn : '.*:\(.*\)'`
3947         fn=`expr $fn : '\(.*\):.*'`
3948         ;;
3949 esac
3950
3951 case "$fn" in
3952 *~*) tilde=true;;
3953 esac
3954 case "$fn" in
3955 */*) fullpath=true;;
3956 esac
3957 case "$fn" in
3958 *+*) skip=true;;
3959 esac
3960 case "$fn" in
3961 *n*) none_ok=true;;
3962 esac
3963 case "$fn" in
3964 *e*) exp_file=true;;
3965 esac
3966 case "$fn" in
3967 *p*) nopath_ok=true;;
3968 esac
3969
3970 case "$fn" in
3971 *f*) type='File';;
3972 *d*) type='Directory';;
3973 *l*) type='Locate';;
3974 esac
3975
3976 what="$type"
3977 case "$what" in
3978 Locate) what='File';;
3979 esac
3980
3981 case "$exp_file" in
3982 '')
3983         case "$d_portable" in
3984         "$define") ;;
3985         *) exp_file=true;;
3986         esac
3987         ;;
3988 esac
3989
3990 cd ..
3991 while test "$type"; do
3992         redo=''
3993         rp="$orig_rp"
3994         dflt="$orig_dflt"
3995         case "$tilde" in
3996         true) rp="$rp (~name ok)";;
3997         esac
3998         . UU/myread
3999         if test -f UU/getfile.ok && \
4000                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4001         then
4002                 value="$ans"
4003                 ansexp="$ans"
4004                 break
4005         fi
4006         case "$ans" in
4007         none)
4008                 value=''
4009                 ansexp=''
4010                 case "$none_ok" in
4011                 true) type='';;
4012                 esac
4013                 ;;
4014         *)
4015                 case "$tilde" in
4016                 '') value="$ans"
4017                         ansexp="$ans";;
4018                 *)
4019                         value=`UU/filexp $ans`
4020                         case $? in
4021                         0)
4022                                 if test "$ans" != "$value"; then
4023                                         echo "(That expands to $value on this system.)"
4024                                 fi
4025                                 ;;
4026                         *) value="$ans";;
4027                         esac
4028                         ansexp="$value"
4029                         case "$exp_file" in
4030                         '') value="$ans";;
4031                         esac
4032                         ;;
4033                 esac
4034                 case "$fullpath" in
4035                 true)
4036                         case "$ansexp" in
4037                         /*) value="$ansexp" ;;
4038                         [a-zA-Z]:/*) value="$ansexp" ;;
4039                         *)
4040                                 redo=true
4041                                 case "$already" in
4042                                 true)
4043                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4044                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4045                                         ;;
4046                                 *)
4047                                 echo "Please give a full path name, starting with slash." >&4
4048                                         case "$tilde" in
4049                                         true)
4050                                 echo "Note that using ~name is ok provided it expands well." >&4
4051                                                 already=true
4052                                                 ;;
4053                                         esac
4054                                 esac
4055                                 ;;
4056                         esac
4057                         ;;
4058                 esac
4059                 case "$redo" in
4060                 '')
4061                         case "$type" in
4062                         File)
4063                                 for fp in $gfpth; do
4064                                         if test "X$fp" = X.; then
4065                                             pf="$ansexp"
4066                                         else    
4067                                             pf="$fp/$ansexp"
4068                                         fi
4069                                         if test -f "$pf"; then
4070                                                 type=''
4071                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4072                                         then
4073                                                 echo "($value is not a plain file, but that's ok.)"
4074                                                 type=''
4075                                         fi
4076                                         if test X"$type" = X; then
4077                                             value="$pf"
4078                                             break
4079                                         fi
4080                                 done
4081                                 ;;
4082                         Directory)
4083                                 for fp in $gfpth; do
4084                                         if test "X$fp" = X.; then
4085                                             dir="$ans"
4086                                             direxp="$ansexp"
4087                                         else    
4088                                             dir="$fp/$ansexp"
4089                                             direxp="$fp/$ansexp"
4090                                         fi
4091                                         if test -d "$direxp"; then
4092                                                 type=''
4093                                                 value="$dir"
4094                                                 break
4095                                         fi
4096                                 done
4097                                 ;;
4098                         Locate)
4099                                 if test -d "$ansexp"; then
4100                                         echo "(Looking for $loc_file in directory $value.)"
4101                                         value="$value/$loc_file"
4102                                         ansexp="$ansexp/$loc_file"
4103                                 fi
4104                                 if test -f "$ansexp"; then
4105                                         type=''
4106                                 fi
4107                                 case "$nopath_ok" in
4108                                 true)   case "$value" in
4109                                         */*) ;;
4110                                         *)      echo "Assuming $value will be in people's path."
4111                                                 type=''
4112                                                 ;;
4113                                         esac
4114                                         ;;
4115                                 esac
4116                                 ;;
4117                         esac
4118
4119                         case "$skip" in
4120                         true) type='';
4121                         esac
4122
4123                         case "$type" in
4124                         '') ;;
4125                         *)
4126                                 if test "$fastread" = yes; then
4127                                         dflt=y
4128                                 else
4129                                         dflt=n
4130                                 fi
4131                                 rp="$what $value doesn't exist.  Use that name anyway?"
4132                                 . UU/myread
4133                                 dflt=''
4134                                 case "$ans" in
4135                                 y*) type='';;
4136                                 *) echo " ";;
4137                                 esac
4138                                 ;;
4139                         esac
4140                         ;;
4141                 esac
4142                 ;;
4143         esac
4144 done
4145 cd UU
4146 ans="$value"
4147 rp="$orig_rp"
4148 dflt="$orig_dflt"
4149 rm -f getfile.ok
4150 test "X$gfpthkeep" != Xy && gfpth=""
4151 EOSC
4152
4153 : What should the include directory be ?
4154 echo " "
4155 $echo $n "Hmm...  $c"
4156 dflt='/usr/include'
4157 incpath=''
4158 mips_type=''
4159 if $test -f /bin/mips && /bin/mips; then
4160         echo "Looks like a MIPS system..."
4161         $cat >usr.c <<'EOCP'
4162 #ifdef SYSTYPE_BSD43
4163 /bsd43
4164 #endif
4165 EOCP
4166         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4167                 dflt='/bsd43/usr/include'
4168                 incpath='/bsd43'
4169                 mips_type='BSD 4.3'
4170         else
4171                 mips_type='System V'
4172         fi
4173         $rm -f usr.c usr.out
4174         echo "and you're compiling with the $mips_type compiler and libraries."
4175         xxx_prompt=y
4176         echo "exit 0" >mips
4177 else
4178         echo "Doesn't look like a MIPS system."
4179         xxx_prompt=n
4180         echo "exit 1" >mips
4181 fi
4182 chmod +x mips
4183 $eunicefix mips
4184 case "$usrinc" in
4185 '') ;;
4186 *) dflt="$usrinc";;
4187 esac
4188 case "$xxx_prompt" in
4189 y)      fn=d/
4190         echo " "
4191         rp='Where are the include files you want to use?'
4192         . ./getfile
4193         usrinc="$ans"
4194         ;;
4195 *)      usrinc="$dflt"
4196         ;;
4197 esac
4198
4199 : see how we invoke the C preprocessor
4200 echo " "
4201 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4202 cat <<'EOT' >testcpp.c
4203 #define ABC abc
4204 #define XYZ xyz
4205 ABC.XYZ
4206 EOT
4207 cd ..
4208 if test ! -f cppstdin; then
4209         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4210                 # AIX cc -E doesn't show the absolute headerfile
4211                 # locations but we'll cheat by using the -M flag.
4212                 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
4213         else
4214                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4215         fi
4216 else
4217         echo "Keeping your $hint cppstdin wrapper."
4218 fi
4219 chmod 755 cppstdin
4220 wrapper=`pwd`/cppstdin
4221 ok='false'
4222 cd UU
4223
4224 if $test "X$cppstdin" != "X" && \
4225         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4226         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4227 then
4228         echo "You used to use $cppstdin $cppminus so we'll use that again."
4229         case "$cpprun" in
4230         '') echo "But let's see if we can live without a wrapper..." ;;
4231         *)
4232                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4233                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4234                 then
4235                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4236                         ok='true'
4237                 else
4238                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4239                 fi
4240                 ;;
4241         esac
4242 else
4243         case "$cppstdin" in
4244         '') ;;
4245         *)
4246                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4247                 ;;
4248         esac
4249 fi
4250
4251 if $ok; then
4252         : nothing
4253 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4254         $cc -E <testcpp.c >testcpp.out 2>&1; \
4255         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4256         echo "Yup, it does."
4257         x_cpp="$cc -E"
4258         x_minus='';
4259 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4260         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4261         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4262         echo "Yup, it does."
4263         x_cpp="$cc -E"
4264         x_minus='-';
4265 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4266         $cc -P <testcpp.c >testcpp.out 2>&1; \
4267         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4268         echo "Yipee, that works!"
4269         x_cpp="$cc -P"
4270         x_minus='';
4271 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4272         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4273         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4274         echo "At long last!"
4275         x_cpp="$cc -P"
4276         x_minus='-';
4277 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4278         $cpp <testcpp.c >testcpp.out 2>&1; \
4279         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4280         echo "It works!"
4281         x_cpp="$cpp"
4282         x_minus='';
4283 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4284         $cpp - <testcpp.c >testcpp.out 2>&1; \
4285         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4286         echo "Hooray, it works!  I was beginning to wonder."
4287         x_cpp="$cpp"
4288         x_minus='-';
4289 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4290         $wrapper <testcpp.c >testcpp.out 2>&1; \
4291         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4292         x_cpp="$wrapper"
4293         x_minus=''
4294         echo "Eureka!"
4295 else
4296         dflt=''
4297         rp="No dice.  I can't find a C preprocessor.  Name one:"
4298         . ./myread
4299         x_cpp="$ans"
4300         x_minus=''
4301         $x_cpp <testcpp.c >testcpp.out 2>&1
4302         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4303                 echo "OK, that will do." >&4
4304         else
4305 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4306                 exit 1
4307         fi
4308 fi
4309
4310 case "$ok" in
4311 false)
4312         cppstdin="$x_cpp"
4313         cppminus="$x_minus"
4314         cpprun="$x_cpp"
4315         cpplast="$x_minus"
4316         set X $x_cpp
4317         shift
4318         case "$1" in
4319         "$cpp")
4320                 echo "Perhaps can we force $cc -E using a wrapper..."
4321                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4322                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4323                 then
4324                         echo "Yup, we can."
4325                         cppstdin="$wrapper"
4326                         cppminus='';
4327                 else
4328                         echo "Nope, we'll have to live without it..."
4329                 fi
4330                 ;;
4331         esac
4332         case "$cpprun" in
4333         "$wrapper")
4334                 cpprun=''
4335                 cpplast=''
4336                 ;;
4337         esac
4338         ;;
4339 esac
4340
4341 case "$cppstdin" in
4342 "$wrapper"|'cppstdin') ;;
4343 *) $rm -f $wrapper;;
4344 esac
4345 $rm -f testcpp.c testcpp.out
4346
4347 : Set private lib path
4348 case "$plibpth" in
4349 '') if ./mips; then
4350                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4351         fi;;
4352 esac
4353 case "$libpth" in
4354 ' ') dlist='';;
4355 '') dlist="$loclibpth $plibpth $glibpth";;
4356 *) dlist="$libpth";;
4357 esac
4358
4359 : Now check and see which directories actually exist, avoiding duplicates
4360 libpth=''
4361 for xxx in $dlist
4362 do
4363     if $test -d $xxx; then
4364                 case " $libpth " in
4365                 *" $xxx "*) ;;
4366                 *) libpth="$libpth $xxx";;
4367                 esac
4368     fi
4369 done
4370 $cat <<'EOM'
4371
4372 Some systems have incompatible or broken versions of libraries.  Among
4373 the directories listed in the question below, please remove any you
4374 know not to be holding relevant libraries, and add any that are needed.
4375 Say "none" for none.
4376
4377 EOM
4378 case "$libpth" in
4379 '') dflt='none';;
4380 *)
4381         set X $libpth
4382         shift
4383         dflt=${1+"$@"}
4384         ;;
4385 esac
4386 rp="Directories to use for library searches?"
4387 . ./myread
4388 case "$ans" in
4389 none) libpth=' ';;
4390 *) libpth="$ans";;
4391 esac
4392
4393 : compute shared library extension
4394 case "$so" in
4395 '')
4396         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4397                 dflt='sl'
4398         else
4399                 dflt='so'
4400         fi
4401         ;;
4402 *) dflt="$so";;
4403 esac
4404 $cat <<EOM
4405
4406 On some systems, shared libraries may be available.  Answer 'none' if
4407 you want to suppress searching of shared libraries for the remainder
4408 of this configuration.
4409
4410 EOM
4411 rp='What is the file extension used for shared libraries?'
4412 . ./myread
4413 so="$ans"
4414
4415 : Define several unixisms.
4416 : Hints files or command line option can be used to override them.
4417 : The convoluted testing is in case hints files set either the old
4418 : or the new name.
4419 case "$_exe" in
4420 '')     case "$exe_ext" in
4421         '')     ;;
4422         *)      _exe="$exe_ext" ;;
4423         esac
4424         ;;
4425 esac
4426 case "$_a" in
4427 '')     case "$lib_ext" in
4428     '') _a='.a';;
4429         *)      _a="$lib_ext" ;;
4430         esac
4431         ;;
4432 esac
4433 case "$_o" in
4434 '') case "$obj_ext" in
4435         '')     _o='.o';;
4436         *)      _o="$obj_ext";;
4437         esac
4438         ;;
4439 esac
4440 case "$p_" in
4441 '') case "$path_sep" in
4442         '')     p_=':';;
4443         *)      p_="$path_sep";;
4444         esac
4445         ;;
4446 esac
4447 exe_ext=$_exe
4448 lib_ext=$_a
4449 obj_ext=$_o
4450 path_sep=$p_
4451
4452 : Which makefile gets called first.  This is used by make depend.
4453 case "$firstmakefile" in
4454 '') firstmakefile='makefile';;
4455 esac
4456
4457 : Looking for optional libraries
4458 echo " "
4459 echo "Checking for optional libraries..." >&4
4460 case "$libs" in
4461 ' '|'') dflt='';;
4462 *) dflt="$libs";;
4463 esac
4464 case "$libswanted" in
4465 '') libswanted='c_s';;
4466 esac
4467 case "$usesocks" in
4468 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4469 esac
4470 libsfound=''
4471 libsfiles=''
4472 libsdirs=''
4473 libspath=''
4474 for thisdir in $libpth $xlibpth; do
4475   test -d $thisdir && libspath="$libspath $thisdir"
4476 done
4477 for thislib in $libswanted; do
4478         for thisdir in $libspath; do
4479             xxx=''
4480             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4481                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4482                 $test -f "$xxx" && eval $libscheck
4483                 $test -f "$xxx" && libstyle=shared
4484             fi
4485             if test ! -f "$xxx"; then
4486                 xxx=$thisdir/lib$thislib.$so
4487                 $test -f "$xxx" && eval $libscheck
4488                 $test -f "$xxx" && libstyle=shared
4489             fi  
4490             if test ! -f "$xxx"; then
4491                 xxx=$thisdir/lib$thislib$_a
4492                 $test -f "$xxx" && eval $libscheck
4493                 $test -f "$xxx" && libstyle=static
4494             fi
4495             if test ! -f "$xxx"; then
4496                 xxx=$thisdir/$thislib$_a
4497                 $test -f "$xxx" && eval $libscheck
4498                 $test -f "$xxx" && libstyle=static
4499             fi
4500             if test ! -f "$xxx"; then
4501                 xxx=$thisdir/lib${thislib}_s$_a
4502                 $test -f "$xxx" && eval $libscheck
4503                 $test -f "$xxx" && libstyle=static
4504                 $test -f "$xxx" && thislib=${thislib}_s
4505             fi
4506             if test ! -f "$xxx"; then
4507                 xxx=$thisdir/Slib$thislib$_a
4508                 $test -f "$xxx" && eval $libscheck
4509                 $test -f "$xxx" && libstyle=static
4510             fi
4511             if $test -f "$xxx"; then
4512                 case "$libstyle" in
4513                 shared) echo "Found -l$thislib (shared)." ;;
4514                 static) echo "Found -l$thislib." ;;
4515                 *)      echo "Found -l$thislib ($libstyle)." ;;
4516                 esac
4517                 case " $dflt " in
4518                 *"-l$thislib "*);;
4519                 *) dflt="$dflt -l$thislib"
4520                    libsfound="$libsfound $xxx"
4521                    yyy=`basename $xxx`
4522                    libsfiles="$libsfiles $yyy"
4523                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4524                    case " $libsdirs " in
4525                    *" $yyy "*) ;;
4526                    *) libsdirs="$libsdirs $yyy" ;;
4527                    esac
4528                    ;;
4529                 esac
4530                 break
4531             fi  
4532         done
4533         if $test ! -f "$xxx"; then
4534             echo "No -l$thislib."
4535         fi
4536 done
4537 set X $dflt
4538 shift
4539 dflt="$*"
4540 case "$libs" in
4541 '') dflt="$dflt";;
4542 *) dflt="$libs";;
4543 esac
4544 case "$dflt" in
4545 ' '|'') dflt='none';;
4546 esac
4547
4548 $cat <<EOM
4549
4550 In order to compile $package on your machine, a number of libraries
4551 are usually needed.  Include any other special libraries here as well.
4552 Say "none" for none.  The default list is almost always right.
4553 EOM
4554
4555 echo " "
4556 rp="What libraries to use?"
4557 . ./myread
4558 case "$ans" in
4559 none) libs=' ';;
4560 *) libs="$ans";;
4561 esac
4562
4563 : determine optimization, if desired, or use for debug flag also
4564 case "$optimize" in
4565 ' '|$undef) dflt='none';;
4566 '') dflt='-O';;
4567 *) dflt="$optimize";;
4568 esac
4569 $cat <<EOH
4570
4571 By default, $package compiles with the -O flag to use the optimizer.
4572 Alternately, you might want to use the symbolic debugger, which uses
4573 the -g flag (on traditional Unix systems).  Either flag can be
4574 specified here.  To use neither flag, specify the word "none".
4575
4576 EOH
4577 rp="What optimizer/debugger flag should be used?"
4578 . ./myread
4579 optimize="$ans"
4580 case "$optimize" in
4581 'none') optimize=" ";;
4582 esac
4583
4584 dflt=''
4585 : We will not override a previous value, but we might want to
4586 : augment a hint file
4587 case "$hint" in
4588 default|recommended)
4589         case "$gccversion" in
4590         1*) dflt='-fpcc-struct-return' ;;
4591         esac
4592         case "$optimize" in
4593         *-g*) dflt="$dflt -DDEBUGGING";;
4594         esac
4595         case "$gccversion" in
4596         2*) if test -d /etc/conf/kconfig.d &&
4597                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4598                 then
4599                         dflt="$dflt -posix"
4600                 fi
4601                 ;;
4602         esac
4603         case "$gccversion" in
4604         1*) ;;
4605         2.[0-8]*) ;;
4606         ?*)     echo " "
4607                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4608                 echo 'int main(void) { return 0; }' > gcctest.c
4609                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4610                         echo "Yes, it does." 2>&1
4611                         case "$ccflags" in
4612                         *strict-aliasing*) 
4613                                 echo "Leaving current flags $ccflags alone." 2>&1
4614                                 ;;
4615                         *) dflt="$dflt -fno-strict-aliasing" ;;
4616                         esac
4617                 else
4618                         echo "Nope, it doesn't, but that's ok." 2>&1
4619                 fi
4620                 ;;
4621         esac
4622         ;;
4623 esac
4624
4625 case "$mips_type" in
4626 *BSD*|'') inclwanted="$locincpth $usrinc";;
4627 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4628 esac
4629 for thisincl in $inclwanted; do
4630         if $test -d $thisincl; then
4631                 if $test x$thisincl != x$usrinc; then
4632                         case "$dflt" in
4633                         *" -I$thisincl "*);;
4634                         *) dflt="$dflt -I$thisincl ";;
4635                         esac
4636                 fi
4637         fi
4638 done
4639
4640 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4641         xxx=true;
4642 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4643         xxx=true;
4644 else
4645         xxx=false;
4646 fi;
4647 if $xxx; then
4648         case "$dflt" in
4649         *$2*);;
4650         *) dflt="$dflt -D$2";;
4651         esac;
4652 fi'
4653
4654 set signal.h LANGUAGE_C; eval $inctest
4655
4656 case "$usesocks" in
4657 $define)
4658         ccflags="$ccflags -DSOCKS"
4659         ;;
4660 esac
4661
4662 case "$hint" in
4663 default|recommended) dflt="$ccflags $dflt" ;;
4664 *) dflt="$ccflags";;
4665 esac
4666
4667 case "$dflt" in
4668 ''|' ') dflt=none;;
4669 esac
4670
4671 $cat <<EOH
4672
4673 Your C compiler may want other flags.  For this question you should include
4674 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4675 but you should NOT include libraries or ld flags like -lwhatever.  If you
4676 want $package to honor its debug switch, you should include -DDEBUGGING here.
4677 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4678
4679 To use no flags, specify the word "none".
4680
4681 EOH
4682 set X $dflt
4683 shift
4684 dflt=${1+"$@"}
4685 rp="Any additional cc flags?"
4686 . ./myread
4687 case "$ans" in
4688 none) ccflags='';;
4689 *) ccflags="$ans";;
4690 esac
4691
4692 : the following weeds options from ccflags that are of no interest to cpp
4693 case "$cppflags" in
4694 '') cppflags="$ccflags" ;;
4695 *)  cppflags="$cppflags $ccflags" ;;
4696 esac
4697 case "$gccversion" in
4698 1*) cppflags="$cppflags -D__GNUC__"
4699 esac
4700 case "$mips_type" in
4701 '');;
4702 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4703 esac
4704 case "$cppflags" in
4705 '');;
4706 *)
4707         echo " "
4708         echo "Let me guess what the preprocessor flags are..." >&4
4709         set X $cppflags
4710         shift
4711         cppflags=''
4712         $cat >cpp.c <<'EOM'
4713 #define BLURFL foo
4714
4715 BLURFL xx LFRULB
4716 EOM
4717         previous=''
4718         for flag in $*
4719         do
4720                 case "$flag" in
4721                 -*) ftry="$flag";;
4722                 *) ftry="$previous $flag";;
4723                 esac
4724                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4725                         >cpp1.out 2>/dev/null && \
4726                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4727                         >cpp2.out 2>/dev/null && \
4728                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4729                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4730                 then
4731                         cppflags="$cppflags $ftry"
4732                         previous=''
4733                 else
4734                         previous="$flag"
4735                 fi
4736         done
4737         set X $cppflags
4738         shift
4739         cppflags=${1+"$@"}
4740         case "$cppflags" in
4741         *-*)  echo "They appear to be: $cppflags";;
4742         esac
4743         $rm -f cpp.c cpp?.out
4744         ;;
4745 esac
4746
4747 : flags used in final linking phase
4748 case "$ldflags" in
4749 '') if ./venix; then
4750                 dflt='-i -z'
4751         else
4752                 dflt=''
4753         fi
4754         case "$ccflags" in
4755         *-posix*) dflt="$dflt -posix" ;;
4756         esac
4757         ;;
4758 *) dflt="$ldflags";;
4759 esac
4760
4761 : Try to guess additional flags to pick up local libraries.
4762 for thislibdir in $libpth; do
4763         case " $loclibpth " in
4764         *" $thislibdir "*)
4765                 case "$dflt " in 
4766                 *"-L$thislibdir "*) ;;
4767                 *)  dflt="$dflt -L$thislibdir" ;;
4768                 esac
4769                 ;;
4770         esac
4771 done
4772
4773 case "$dflt" in
4774 '') dflt='none' ;;
4775 esac
4776
4777 $cat <<EOH
4778
4779 Your C linker may need flags.  For this question you should
4780 include -L/whatever and any other flags used by the C linker, but you
4781 should NOT include libraries like -lwhatever.
4782
4783 Make sure you include the appropriate -L/path flags if your C linker
4784 does not normally search all of the directories you specified above,
4785 namely
4786         $libpth
4787 To use no flags, specify the word "none".
4788
4789 EOH
4790
4791 rp="Any additional ld flags (NOT including libraries)?"
4792 . ./myread
4793 case "$ans" in
4794 none) ldflags='';;
4795 *) ldflags="$ans";;
4796 esac
4797 rmlist="$rmlist pdp11"
4798
4799 : coherency check
4800 echo " "
4801 echo "Checking your choice of C compiler and flags for coherency..." >&4
4802 $cat > try.c <<'EOF'
4803 #include <stdio.h>
4804 int main() { printf("Ok\n"); exit(0); }
4805 EOF
4806 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4807 shift
4808 $cat >try.msg <<'EOM'
4809 I've tried to compile and run the following simple program:
4810
4811 EOM
4812 $cat try.c >> try.msg
4813
4814 $cat >> try.msg <<EOM
4815
4816 I used the command:
4817
4818         $*
4819         $run ./try
4820
4821 and I got the following output:
4822
4823 EOM
4824 dflt=y
4825 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4826         if $sh -c "$run ./try" >>try.msg 2>&1; then
4827                 xxx=`$run ./try`
4828                 case "$xxx" in
4829                 "Ok") dflt=n ;;
4830                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4831                         case " $libs " in
4832                         *" -lsfio "*)
4833                                 cat >> try.msg <<'EOQS'
4834 If $libs contains -lsfio, and sfio is mis-configured, then it
4835 sometimes (apparently) runs and exits with a 0 status, but with no
4836 output!  It may have to do with sfio's use of _exit vs. exit.
4837
4838 EOQS
4839                                 rp="You have a big problem.  Shall I abort Configure"
4840                                 dflt=y
4841                                 ;;
4842                         esac
4843                         ;;
4844                 esac
4845         else
4846                 echo "The program compiled OK, but exited with status $?." >>try.msg
4847                 rp="You have a problem.  Shall I abort Configure"
4848                 dflt=y
4849         fi
4850 else
4851         echo "I can't compile the test program." >>try.msg
4852         rp="You have a BIG problem.  Shall I abort Configure"
4853         dflt=y
4854 fi
4855 case "$dflt" in
4856 y)
4857         $cat try.msg >&4
4858         case "$knowitall" in
4859         '')
4860                 echo "(The supplied flags or libraries might be incorrect.)"
4861                 ;;
4862         *) dflt=n;;
4863         esac
4864         echo " "
4865         . ./myread
4866         case "$ans" in
4867         n*|N*) ;;
4868         *)      echo "Ok.  Stopping Configure." >&4
4869                 exit 1
4870                 ;;
4871         esac
4872         ;;
4873 n) echo "OK, that should do.";;
4874 esac
4875 $rm -f try try.* core
4876
4877 : define a shorthand compile call
4878 compile='
4879 mc_file=$1;
4880 shift;
4881 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4882 : define a shorthand compile call for compilations that should be ok.
4883 compile_ok='
4884 mc_file=$1;
4885 shift;
4886 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4887
4888 : check for lengths of integral types
4889 echo " "
4890 case "$intsize" in
4891 '')
4892         echo "Checking to see how big your integers are..." >&4
4893         $cat >try.c <<'EOCP'
4894 #include <stdio.h>
4895 int main()
4896 {
4897         printf("intsize=%d;\n", (int)sizeof(int));
4898         printf("longsize=%d;\n", (int)sizeof(long));
4899         printf("shortsize=%d;\n", (int)sizeof(short));
4900         exit(0);
4901 }
4902 EOCP
4903         set try
4904         if eval $compile_ok && $run ./try > /dev/null; then
4905                 eval `$run ./try`
4906                 echo "Your integers are $intsize bytes long."
4907                 echo "Your long integers are $longsize bytes long."
4908                 echo "Your short integers are $shortsize bytes long."
4909         else
4910                 $cat >&4 <<EOM
4911 !
4912 Help! I can't compile and run the intsize test program: please enlighten me!
4913 (This is probably a misconfiguration in your system or libraries, and
4914 you really ought to fix it.  Still, I'll try anyway.)
4915 !
4916 EOM
4917                 dflt=4
4918                 rp="What is the size of an integer (in bytes)?"
4919                 . ./myread
4920                 intsize="$ans"
4921                 dflt=$intsize
4922                 rp="What is the size of a long integer (in bytes)?"
4923                 . ./myread
4924                 longsize="$ans"
4925                 dflt=2
4926                 rp="What is the size of a short integer (in bytes)?"
4927                 . ./myread
4928                 shortsize="$ans"
4929         fi
4930         ;;
4931 esac
4932 $rm -f try try.*
4933
4934 : check for long long
4935 echo " "
4936 echo "Checking to see if you have long long..." >&4
4937 echo 'int main() { long long x = 7; return 0; }' > try.c
4938 set try
4939 if eval $compile; then
4940         val="$define"
4941         echo "You have long long."
4942 else
4943         val="$undef"
4944         echo "You do not have long long."
4945 fi
4946 $rm try.*
4947 set d_longlong
4948 eval $setvar
4949
4950 : check for length of long long
4951 case "${d_longlong}${longlongsize}" in
4952 $define)
4953         echo " "
4954         echo "Checking to see how big your long longs are..." >&4
4955         $cat >try.c <<'EOCP'
4956 #include <stdio.h>
4957 int main()
4958 {
4959     printf("%d\n", (int)sizeof(long long));
4960     return(0);
4961 }
4962 EOCP
4963         set try
4964         if eval $compile_ok; then
4965                 longlongsize=`$run ./try`
4966                 echo "Your long longs are $longlongsize bytes long."
4967         else
4968                 dflt='8'
4969                 echo " "
4970                 echo "(I can't seem to compile the test program.  Guessing...)"
4971                 rp="What is the size of a long long (in bytes)?"
4972                 . ./myread
4973                 longlongsize="$ans"
4974         fi
4975         if $test "X$longsize" = "X$longlongsize"; then
4976                 echo "(That isn't any different from an ordinary long.)"
4977         fi      
4978         ;;
4979 esac
4980 $rm -f try.* try
4981
4982 : determine filename position in cpp output
4983 echo " "
4984 echo "Computing filename position in cpp output for #include directives..." >&4
4985 case "$osname" in
4986 vos) testaccess=-e ;;
4987 *)   testaccess=-r ;;
4988 esac
4989 echo '#include <stdio.h>' > foo.c
4990 $cat >fieldn <<EOF
4991 $startsh
4992 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4993 $grep '^[       ]*#.*stdio\.h' | \
4994 while read cline; do
4995         pos=1
4996         set \$cline
4997         while $test \$# -gt 0; do
4998                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4999                         echo "\$pos"
5000                         exit 0
5001                 fi
5002                 shift
5003                 pos=\`expr \$pos + 1\`
5004         done
5005 done
5006 EOF
5007 chmod +x fieldn
5008 fieldn=`./fieldn`
5009 $rm -f foo.c fieldn
5010 case $fieldn in
5011 '') pos='???';;
5012 1) pos=first;;
5013 2) pos=second;;
5014 3) pos=third;;
5015 *) pos="${fieldn}th";;
5016 esac
5017 echo "Your cpp writes the filename in the $pos field of the line."
5018
5019 case "$osname" in
5020 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5021 *)   cppfilter='' ;;
5022 esac
5023 : locate header file
5024 $cat >findhdr <<EOF
5025 $startsh
5026 wanted=\$1
5027 name=''
5028 for usrincdir in $usrinc
5029 do
5030         if test -f \$usrincdir/\$wanted; then
5031                 echo "\$usrincdir/\$wanted"
5032                 exit 0
5033         fi
5034 done
5035 awkprg='{ print \$$fieldn }'
5036 echo "#include <\$wanted>" > foo\$\$.c
5037 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5038 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5039 while read cline; do
5040         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5041         case "\$name" in
5042         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5043         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5044         *) exit 2;;
5045         esac;
5046 done;
5047 #
5048 # status = 0: grep returned 0 lines, case statement not executed
5049 # status = 1: headerfile found
5050 # status = 2: while loop executed, no headerfile found
5051 #
5052 status=\$?
5053 $rm -f foo\$\$.c;
5054 if test \$status -eq 1; then
5055         exit 0;
5056 fi
5057 exit 1
5058 EOF
5059 chmod +x findhdr
5060
5061 : define an alternate in-header-list? function
5062 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5063 cont=true; xxf="echo \"<\$1> found.\" >&4";
5064 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5065 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5066 esac;
5067 case $# in 4) instead=instead;; *) instead="at last";; esac;
5068 while $test "$cont"; do
5069         xxx=`./findhdr $1`
5070         var=$2; eval "was=\$$2";
5071         if $test "$xxx" && $test -r "$xxx";
5072         then eval $xxf;
5073         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5074                 cont="";
5075         else eval $xxnf;
5076         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5077         set $yyy; shift; shift; yyy=$@;
5078         case $# in 0) cont="";;
5079         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5080                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5081         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5082                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5083         esac;
5084 done;
5085 while $test "$yyy";
5086 do set $yyy; var=$2; eval "was=\$$2";
5087         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5088         set $yyy; shift; shift; yyy=$@;
5089 done'
5090
5091 : see if inttypes.h is available
5092 : we want a real compile instead of Inhdr because some systems
5093 : have an inttypes.h which includes non-existent headers
5094 echo " "
5095 $cat >try.c <<EOCP
5096 #include <inttypes.h>
5097 int main() {
5098         static int32_t foo32 = 0x12345678;
5099 }
5100 EOCP
5101 set try
5102 if eval $compile; then
5103         echo "<inttypes.h> found." >&4
5104         val="$define"
5105 else
5106         echo "<inttypes.h> NOT found." >&4
5107         val="$undef"
5108 fi
5109 $rm -f try.c try
5110 set i_inttypes
5111 eval $setvar
5112
5113 : check for int64_t
5114 echo " "
5115 echo "Checking to see if you have int64_t..." >&4
5116 $cat >try.c <<EOCP
5117 #include <sys/types.h>
5118 #$i_inttypes I_INTTYPES
5119 #ifdef I_INTTYPES
5120 #include <inttypes.h>
5121 #endif
5122 int main() { int64_t x = 7; }
5123 EOCP
5124 set try
5125 if eval $compile; then
5126         val="$define"
5127         echo "You have int64_t."
5128 else
5129         val="$undef"
5130         echo "You do not have int64_t."
5131 fi
5132 $rm -f try try.*
5133 set d_int64_t
5134 eval $setvar
5135
5136
5137 echo " "
5138 echo "Checking which 64-bit integer type we could use..." >&4
5139
5140 case "$intsize" in
5141 8) val=int
5142    set quadtype
5143    eval $setvar
5144    val='"unsigned int"'
5145    set uquadtype
5146    eval $setvar
5147    quadkind=1
5148    ;;
5149 *) case "$longsize" in
5150    8) val=long
5151       set quadtype
5152       eval $setvar
5153       val='"unsigned long"'
5154       set uquadtype
5155       eval $setvar
5156       quadkind=2
5157       ;;
5158    *) case "$d_longlong:$longlongsize" in
5159       define:8)
5160         val='"long long"'
5161         set quadtype
5162         eval $setvar
5163         val='"unsigned long long"'
5164         set uquadtype
5165         eval $setvar
5166         quadkind=3
5167         ;;
5168       *) case "$d_int64_t" in
5169          define)
5170            val=int64_t
5171            set quadtype
5172            eval $setvar
5173            val=uint64_t
5174            set uquadtype
5175            eval $setvar
5176            quadkind=4
5177            ;;
5178          esac
5179          ;;
5180       esac
5181       ;;
5182    esac
5183    ;;
5184 esac
5185
5186 case "$quadtype" in
5187 '')     echo "Alas, no 64-bit integer types in sight." >&4
5188         d_quad="$undef"
5189         ;;
5190 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5191         d_quad="$define"
5192         ;;
5193 esac
5194
5195
5196 case "$uselonglong" in
5197 "$define"|true|[yY]*)
5198         cat <<EOM >&4
5199
5200 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5201 EOM
5202         use64bitint="$define"
5203         ;;
5204 esac                          
5205 case "$use64bits" in
5206 "$define"|true|[yY]*)
5207         cat <<EOM >&4
5208
5209 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5210 EOM
5211         use64bitint="$define"
5212         ;;
5213 esac                          
5214 case "$use64bitints" in
5215 "$define"|true|[yY]*)
5216         cat <<EOM >&4
5217
5218 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5219 EOM
5220         use64bitint="$define"
5221         ;;
5222 esac                          
5223 case "$use64bitsint" in
5224 "$define"|true|[yY]*)
5225         cat <<EOM >&4
5226
5227 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5228 EOM
5229         use64bitint="$define"
5230         ;;
5231 esac                          
5232 case "$uselonglongs" in
5233 "$define"|true|[yY]*)
5234         cat <<EOM >&4
5235
5236 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5237 EOM
5238         use64bitint="$define"
5239         ;;
5240 esac                          
5241 case "$use64bitsall" in
5242 "$define"|true|[yY]*)
5243         cat <<EOM >&4
5244
5245 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5246 EOM
5247         use64bitall="$define"
5248         ;;
5249 esac                          
5250
5251 case "$ccflags" in
5252 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5253 esac
5254 case "$use64bitall" in
5255 "$define"|true|[yY]*) use64bitint="$define" ;;
5256 esac
5257
5258 case "$longsize" in
5259 8) cat <<EOM
5260
5261 You have natively 64-bit long integers.
5262 EOM
5263    val="$define"
5264    ;;
5265 *) case "$use64bitint" in
5266    "$define"|true|[yY]*) dflt='y';;
5267    *) dflt='n';;
5268    esac
5269    case "$d_quad" in
5270    "$define") ;;
5271    *) dflt='n' ;;
5272    esac
5273    cat <<EOM
5274
5275 Perl can be built to take advantage of 64-bit integer types
5276 on some systems.  To do so, Configure can be run with -Duse64bitint.
5277 Choosing this option will most probably introduce binary incompatibilities.
5278
5279 If this doesn't make any sense to you, just accept the default '$dflt'.
5280 (The default has been chosen based on your configuration.)
5281 EOM
5282    rp='Try to use 64-bit integers, if available?'
5283    . ./myread
5284    case "$ans" in
5285    [yY]*) val="$define" ;;
5286    *)     val="$undef"  ;;
5287    esac
5288    ;;
5289 esac
5290 set use64bitint
5291 eval $setvar
5292
5293 case "$use64bitall" in
5294 "$define"|true|[yY]*) dflt='y' ;;
5295 *) case "$longsize" in
5296    8) dflt='y' ;;
5297    *) dflt='n' ;;
5298    esac
5299    ;;
5300 esac    
5301 cat <<EOM
5302
5303 You may also choose to try maximal 64-bitness.  It means using as much
5304 64-bitness as possible on the platform.  This in turn means even more
5305 binary incompatibilities.  On the other hand, your platform may not
5306 have any more 64-bitness available than what you already have chosen.
5307
5308 If this doesn't make any sense to you, just accept the default '$dflt'.
5309 (The default has been chosen based on your configuration.)
5310 EOM
5311 rp='Try to use maximal 64-bit support, if available?'
5312 . ./myread
5313 case "$ans" in
5314 [yY]*) val="$define" ;;
5315 *)     val="$undef"  ;;
5316 esac
5317 set use64bitall
5318 eval $setvar
5319 case "$use64bitall" in
5320 "$define")
5321         case "$use64bitint" in
5322         "$undef")
5323                 cat <<EOM
5324
5325 Since you have chosen a maximally 64-bit build, I'm also turning on
5326 the use of 64-bit integers.
5327 EOM
5328                 use64bitint="$define" ;;
5329         esac
5330         ;;
5331 esac
5332
5333 case "$use64bitint" in
5334 "$define"|true|[yY]*)
5335 : Look for a hint-file generated 'call-back-unit'.  If the
5336 : user has specified that a 64-bit perl is to be built,
5337 : we may need to set or change some other defaults.
5338         if $test -f use64bitint.cbu; then
5339                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5340                 . ./use64bitint.cbu
5341         fi
5342         case "$longsize" in
5343         4) case "$archname64" in
5344            '') archname64=64int ;;
5345            esac
5346            ;;
5347         esac
5348         ;;
5349 esac
5350
5351 case "$use64bitall" in
5352 "$define"|true|[yY]*)
5353 : Look for a hint-file generated 'call-back-unit'.  If the
5354 : user has specified that a maximally 64-bit perl is to be built,
5355 : we may need to set or change some other defaults.
5356         if $test -f use64bitall.cbu; then
5357                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5358                 . ./use64bitall.cbu
5359         fi
5360         case "$longsize" in
5361         4) case "$archname64" in
5362            ''|64int) archname64=64all ;;
5363            esac
5364            ;;
5365         esac
5366         ;;
5367 esac
5368
5369 echo " "
5370 echo "Checking for GNU C Library..." >&4
5371 cat >try.c <<'EOCP'
5372 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5373    alone are insufficient to distinguish different versions, such as
5374    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5375    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5376 */
5377 #include <stdio.h>
5378 int main(void)
5379 {
5380 #ifdef __GLIBC__
5381 #   ifdef __GLIBC_MINOR__
5382 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5383 #           include <gnu/libc-version.h>
5384             printf("%s\n",  gnu_get_libc_version());
5385 #       else
5386             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5387 #       endif
5388 #   else
5389         printf("%d\n",  __GLIBC__);
5390 #   endif
5391     return 0;
5392 #else
5393     return 1;
5394 #endif
5395 }
5396 EOCP
5397 set try
5398 if eval $compile_ok && $run ./try > glibc.ver; then
5399         val="$define"
5400         gnulibc_version=`$cat glibc.ver`
5401         echo "You are using the GNU C Library version $gnulibc_version"
5402 else
5403         val="$undef"
5404         gnulibc_version=''
5405         echo "You are not using the GNU C Library"
5406 fi
5407 $rm -f try try.* glibc.ver
5408 set d_gnulibc
5409 eval $setvar
5410
5411 : see if nm is to be used to determine whether a symbol is defined or not
5412 case "$usenm" in
5413 '')
5414         dflt=''
5415         case "$d_gnulibc" in
5416         "$define")
5417                 echo " "
5418                 echo "nm probably won't work on the GNU C Library." >&4
5419                 dflt=n
5420                 ;;
5421         esac
5422         case "$dflt" in
5423         '') 
5424                 if $test "$osname" = aix -a "X$PASE" != "$Xdefine" -a ! -f /lib/syscalls.exp; then
5425                         echo " "
5426                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5427                         echo "'nm' won't be sufficient on this sytem." >&4
5428                         dflt=n
5429                 fi
5430                 ;;
5431         esac
5432         case "$dflt" in
5433         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5434                 if $test $dflt -gt 20; then
5435                         dflt=y
5436                 else
5437                         dflt=n
5438                 fi
5439                 ;;
5440         esac
5441         ;;
5442 *)
5443         case "$usenm" in
5444         true|$define) dflt=y;;
5445         *) dflt=n;;
5446         esac
5447         ;;
5448 esac
5449 $cat <<EOM
5450
5451 I can use $nm to extract the symbols from your C libraries. This
5452 is a time consuming task which may generate huge output on the disk (up
5453 to 3 megabytes) but that should make the symbols extraction faster. The
5454 alternative is to skip the 'nm' extraction part and to compile a small
5455 test program instead to determine whether each symbol is present. If
5456 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5457 this may be the best solution.
5458
5459 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5460
5461 EOM
5462 rp="Shall I use $nm to extract C symbols from the libraries?"
5463 . ./myread
5464 case "$ans" in
5465 [Nn]*) usenm=false;;
5466 *) usenm=true;;
5467 esac
5468
5469 runnm=$usenm
5470 case "$reuseval" in
5471 true) runnm=false;;
5472 esac
5473
5474 : nm options which may be necessary
5475 case "$nm_opt" in
5476 '') if $test -f /mach_boot; then
5477                 nm_opt=''       # Mach
5478         elif $test -d /usr/ccs/lib; then
5479                 nm_opt='-p'     # Solaris (and SunOS?)
5480         elif $test -f /dgux; then
5481                 nm_opt='-p'     # DG-UX
5482         elif $test -f /lib64/rld; then
5483                 nm_opt='-p'     # 64-bit Irix
5484         else
5485                 nm_opt=''
5486         fi;;
5487 esac
5488
5489 : nm options which may be necessary for shared libraries but illegal
5490 : for archive libraries.  Thank you, Linux.
5491 case "$nm_so_opt" in
5492 '')     case "$myuname" in
5493         *linux*)
5494                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5495                         nm_so_opt='--dynamic'
5496                 fi
5497                 ;;
5498         esac
5499         ;;
5500 esac
5501
5502 case "$runnm" in
5503 true)
5504 : get list of predefined functions in a handy place
5505 echo " "
5506 case "$libc" in
5507 '') libc=unknown
5508         case "$libs" in
5509         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5510         esac
5511         ;;
5512 esac
5513 case "$libs" in
5514 '') ;;
5515 *)  for thislib in $libs; do
5516         case "$thislib" in
5517         -lc|-lc_s)
5518                 : Handle C library specially below.
5519                 ;;
5520         -l*)
5521                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5522                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5523                         :
5524                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5525                         :
5526                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5527                         :
5528                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5529                         :
5530                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5531                         :
5532                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5533                         :
5534                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5535                         :
5536                 else
5537                         try=''
5538                 fi
5539                 libnames="$libnames $try"
5540                 ;;
5541         *) libnames="$libnames $thislib" ;;
5542         esac
5543         done
5544         ;;
5545 esac
5546 xxx=normal
5547 case "$libc" in
5548 unknown)
5549         set /lib/libc.$so
5550         for xxx in $libpth; do
5551                 $test -r $1 || set $xxx/libc.$so
5552                 : The messy sed command sorts on library version numbers.
5553                 $test -r $1 || \
5554                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5555                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5556                                 h
5557                                 s/[0-9][0-9]*/0000&/g
5558                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5559                                 G
5560                                 s/\n/ /' | \
5561                          $sort | $sed -e 's/^.* //'`
5562                 eval set \$$#
5563         done
5564         $test -r $1 || set /usr/ccs/lib/libc.$so
5565         $test -r $1 || set /lib/libsys_s$_a
5566         ;;
5567 *)
5568         set blurfl
5569         ;;
5570 esac
5571 if $test -r "$1"; then
5572         echo "Your (shared) C library seems to be in $1."
5573         libc="$1"
5574 elif $test -r /lib/libc && $test -r /lib/clib; then
5575         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5576         xxx=apollo
5577         libc='/lib/clib /lib/libc'
5578         if $test -r /lib/syslib; then
5579                 echo "(Your math library is in /lib/syslib.)"
5580                 libc="$libc /lib/syslib"
5581         fi
5582 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5583         echo "Your C library seems to be in $libc, as you said before."
5584 elif $test -r $incpath/usr/lib/libc$_a; then
5585         libc=$incpath/usr/lib/libc$_a;
5586         echo "Your C library seems to be in $libc.  That's fine."
5587 elif $test -r /lib/libc$_a; then
5588         libc=/lib/libc$_a;
5589         echo "Your C library seems to be in $libc.  You're normal."
5590 else
5591         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5592                 :
5593         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5594                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5595         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5596                 :
5597         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5598                 :
5599         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5600                 :
5601         else
5602                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5603         fi
5604         if $test -r "$tans"; then
5605                 echo "Your C library seems to be in $tans, of all places."
5606                 libc=$tans
5607         else
5608                 libc='blurfl'
5609         fi
5610 fi
5611 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5612         dflt="$libc"
5613         cat <<EOM
5614
5615 If the guess above is wrong (which it might be if you're using a strange
5616 compiler, or your machine supports multiple models), you can override it here.
5617
5618 EOM
5619 else
5620         dflt=''
5621         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5622         cat >&4 <<EOM
5623 I can't seem to find your C library.  I've looked in the following places:
5624
5625 EOM
5626         $sed 's/^/      /' libpath
5627         cat <<EOM
5628
5629 None of these seems to contain your C library. I need to get its name...
5630
5631 EOM
5632 fi
5633 fn=f
5634 rp='Where is your C library?'
5635 . ./getfile
5636 libc="$ans"
5637
5638 echo " "
5639 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5640 set X `cat libnames`
5641 shift
5642 xxx=files
5643 case $# in 1) xxx=file; esac
5644 echo "Extracting names from the following $xxx for later perusal:" >&4
5645 echo " "
5646 $sed 's/^/      /' libnames >&4
5647 echo " "
5648 $echo $n "This may take a while...$c" >&4
5649
5650 for file in $*; do
5651         case $file in
5652         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5653         *) $nm $nm_opt $file 2>/dev/null;;
5654         esac
5655 done >libc.tmp
5656
5657 $echo $n ".$c"
5658 $grep fprintf libc.tmp > libc.ptf
5659 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5660 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5661 xxx='[ADTSIW]'
5662 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5663         eval $xscan;\
5664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5665                 eval $xrun
5666 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5667         eval $xscan;\
5668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5669                 eval $xrun
5670 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5671         eval $xscan;\
5672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5673                 eval $xrun
5674 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5675         eval $xscan;\
5676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5677                 eval $xrun
5678 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5679         eval $xscan;\
5680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5681                 eval $xrun
5682 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5683         eval $xscan;\
5684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5685                 eval $xrun
5686 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5687                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5688         eval $xscan;\
5689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5690                 eval $xrun
5691 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5692         eval $xscan;\
5693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5694                 eval $xrun
5695 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5696         eval $xscan;\
5697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5698                 eval $xrun
5699 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5700         eval $xscan;\
5701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5702                 eval $xrun
5703 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5704         eval $xscan;\
5705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706                 eval $xrun
5707 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5708         eval $xscan;\
5709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710                 eval $xrun
5711 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 else
5720         $nm -p $* 2>/dev/null >libc.tmp
5721         $grep fprintf libc.tmp > libc.ptf
5722         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5723                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5724         then
5725                 nm_opt='-p'
5726                 eval $xrun
5727         else
5728                 echo " "
5729                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5730                 com=''
5731                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5732                         for thisname in $libnames $libc; do
5733                                 $ar t $thisname >>libc.tmp
5734                         done
5735                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5736                         echo "Ok." >&4
5737                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5738                         # Repeat libc to extract forwarders to DLL entries too
5739                         for thisname in $libnames $libc; do
5740                                 $ar tv $thisname >>libc.tmp
5741                                 # Revision 50 of EMX has bug in $ar.
5742                                 # it will not extract forwarders to DLL entries
5743                                 # Use emximp which will extract exactly them.
5744                                 emximp -o tmp.imp $thisname \
5745                                     2>/dev/null && \
5746                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5747                                     < tmp.imp >>libc.tmp
5748                                 $rm tmp.imp
5749                         done
5750                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5751                         echo "Ok." >&4
5752                 else
5753                         echo "$ar didn't seem to work right." >&4
5754                         echo "Maybe this is a Cray...trying bld instead..." >&4
5755                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5756                         then
5757                                 for thisname in $libnames; do
5758                                         bld t $libnames | \
5759                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5760                                         $ar t $thisname >>libc.tmp
5761                                 done
5762                                 echo "Ok." >&4
5763                         else
5764                                 echo "That didn't work either.  Giving up." >&4
5765                                 exit 1
5766                         fi
5767                 fi
5768         fi
5769 fi
5770 nm_extract="$com"
5771 case "$PASE" in
5772 define)
5773     echo " "
5774     echo "Since you are compiling for PASE, extracting more symbols from libc.a...">&4
5775     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5776     ;;
5777 *)  if $test -f /lib/syscalls.exp; then
5778         echo " "
5779         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5780         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5781     fi
5782     ;;
5783 esac
5784 ;;
5785 esac
5786 $rm -f libnames libpath
5787
5788 : is a C symbol defined?
5789 csym='tlook=$1;
5790 case "$3" in
5791 -v) tf=libc.tmp; tc=""; tdc="";;
5792 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5793 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5794 esac;
5795 tx=yes;
5796 case "$reuseval-$4" in
5797 true-) ;;
5798 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5799 esac;
5800 case "$tx" in
5801 yes)
5802         case "$runnm" in
5803         true)
5804                 if $contains $tlook $tf >/dev/null 2>&1;
5805                 then tval=true;
5806                 else tval=false;
5807                 fi;;
5808         *)
5809                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5810                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5811                 then tval=true;
5812                 else tval=false;
5813                 fi;
5814                 $rm -f t t.c;;
5815         esac;;
5816 *)
5817         case "$tval" in
5818         $define) tval=true;;
5819         *) tval=false;;
5820         esac;;
5821 esac;
5822 eval "$2=$tval"'
5823
5824 : define an is-in-libc? function
5825 inlibc='echo " "; td=$define; tu=$undef;
5826 sym=$1; var=$2; eval "was=\$$2";
5827 tx=yes;
5828 case "$reuseval$was" in
5829 true) ;;
5830 true*) tx=no;;
5831 esac;
5832 case "$tx" in
5833 yes)
5834         set $sym tres -f;
5835         eval $csym;
5836         case "$tres" in
5837         true)
5838                 echo "$sym() found." >&4;
5839                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5840         *)
5841                 echo "$sym() NOT found." >&4;
5842                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5843         esac;;
5844 *)
5845         case "$was" in
5846         $define) echo "$sym() found." >&4;;
5847         *) echo "$sym() NOT found." >&4;;
5848         esac;;
5849 esac'
5850
5851 : see if sqrtl exists
5852 set sqrtl d_sqrtl
5853 eval $inlibc
5854
5855 : check for length of double
5856 echo " "
5857 case "$doublesize" in
5858 '')
5859         echo "Checking to see how big your double precision numbers are..." >&4
5860         $cat >try.c <<'EOCP'
5861 #include <stdio.h>
5862 int main()
5863 {
5864     printf("%d\n", (int)sizeof(double));
5865     exit(0);
5866 }
5867 EOCP
5868         set try
5869         if eval $compile_ok; then
5870                 doublesize=`$run ./try`
5871                 echo "Your double is $doublesize bytes long."
5872         else
5873                 dflt='8'
5874                 echo "(I can't seem to compile the test program.  Guessing...)"
5875                 rp="What is the size of a double precision number (in bytes)?"
5876                 . ./myread
5877                 doublesize="$ans"
5878         fi
5879         ;;
5880 esac
5881 $rm -f try.c try
5882
5883 : check for long doubles
5884 echo " "
5885 echo "Checking to see if you have long double..." >&4
5886 echo 'int main() { long double x = 7.0; }' > try.c
5887 set try
5888 if eval $compile; then
5889         val="$define"
5890         echo "You have long double."
5891 else
5892         val="$undef"
5893         echo "You do not have long double."
5894 fi
5895 $rm try.*
5896 set d_longdbl
5897 eval $setvar
5898
5899 : check for length of long double
5900 case "${d_longdbl}${longdblsize}" in
5901 $define)
5902         echo " "
5903         echo "Checking to see how big your long doubles are..." >&4
5904         $cat >try.c <<'EOCP'
5905 #include <stdio.h>
5906 int main()
5907 {
5908         printf("%d\n", sizeof(long double));
5909 }
5910 EOCP
5911         set try
5912         set try
5913         if eval $compile; then
5914                 longdblsize=`$run ./try`
5915                 echo "Your long doubles are $longdblsize bytes long."
5916         else
5917                 dflt='8'
5918                 echo " "
5919                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5920                 rp="What is the size of a long double (in bytes)?"
5921                 . ./myread
5922                 longdblsize="$ans"
5923         fi
5924         if $test "X$doublesize" = "X$longdblsize"; then
5925                 echo "(That isn't any different from an ordinary double.)"
5926         fi      
5927         ;;
5928 esac
5929 $rm -f try.* try
5930
5931 echo " "
5932
5933 if $test X"$d_longdbl" = X"$define"; then
5934
5935 echo "Checking how to print long doubles..." >&4
5936
5937 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5938         $cat >try.c <<'EOCP'
5939 #include <sys/types.h>
5940 #include <stdio.h>
5941 int main() {
5942   double d = 123.456;
5943   printf("%.3f\n", d);
5944 }
5945 EOCP
5946         set try
5947         if eval $compile; then
5948                 yyy=`$run ./try`
5949                 case "$yyy" in
5950                 123.456)
5951                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5952                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5953                         echo "We will use %f."
5954                         ;;
5955                 esac
5956         fi
5957 fi
5958
5959 if $test X"$sPRIfldbl" = X; then
5960         $cat >try.c <<'EOCP'
5961 #include <sys/types.h>
5962 #include <stdio.h>
5963 int main() {
5964   long double d = 123.456;
5965   printf("%.3Lf\n", d);
5966 }
5967 EOCP
5968         set try
5969         if eval $compile; then
5970                 yyy=`$run ./try`
5971                 case "$yyy" in
5972                 123.456)
5973                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5974                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5975                         echo "We will use %Lf."
5976                         ;;
5977                 esac
5978         fi
5979 fi
5980
5981 if $test X"$sPRIfldbl" = X; then
5982         $cat >try.c <<'EOCP'
5983 #include <sys/types.h>
5984 #include <stdio.h>
5985 int main() {
5986   long double d = 123.456;
5987   printf("%.3llf\n", d);
5988 }
5989 EOCP
5990         set try
5991         if eval $compile; then
5992                 yyy=`$run ./try`
5993                 case "$yyy" in
5994                 123.456)
5995                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5996                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5997                         echo "We will use %llf."
5998                         ;;
5999                 esac
6000         fi
6001 fi
6002
6003 if $test X"$sPRIfldbl" = X; then
6004         $cat >try.c <<'EOCP'
6005 #include <sys/types.h>
6006 #include <stdio.h>
6007 int main() {
6008   long double d = 123.456;
6009   printf("%.3lf\n", d);
6010 }
6011 EOCP
6012         set try
6013         if eval $compile; then
6014                 yyy=`$run ./try`
6015                 case "$yyy" in
6016                 123.456)
6017                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6018                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6019                         echo "We will use %lf."
6020                         ;;
6021                 esac
6022         fi
6023 fi
6024
6025 if $test X"$sPRIfldbl" = X; then
6026         echo "Cannot figure out how to print long doubles." >&4
6027 else
6028         sSCNfldbl=$sPRIfldbl    # expect consistency
6029 fi
6030
6031 $rm -f try try.*
6032
6033 fi # d_longdbl
6034
6035 case "$sPRIfldbl" in
6036 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6037         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6038         d_SCNfldbl="$undef";
6039         ;;
6040 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6041         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6042         d_SCNfldbl="$define";
6043         ;;
6044 esac
6045
6046 : see if modfl exists
6047 set modfl d_modfl
6048 eval $inlibc
6049
6050
6051 hasproto='varname=$1; func=$2; shift; shift;
6052 while $test $# -ge 2; do
6053         case "$1" in
6054         $define) echo "#include <$2>";;
6055         esac ;
6056     shift 2;
6057 done > try.c;
6058 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
6059 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
6060         echo "$func() prototype found.";
6061         val="$define";
6062 else
6063         echo "$func() prototype NOT found.";
6064         val="$undef";
6065 fi;
6066 set $varname;
6067 eval $setvar;
6068 $rm -f try.c tryout.c'
6069
6070 : see if prototype for modfl is available
6071 echo " "
6072 set d_modflproto modfl math.h
6073 eval $hasproto
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 EOCP
6086 if $test "X$d_modflproto" != "X$define"; then
6087         $cat >>try.c <<EOCP
6088 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6089 long double modfl (long double, long double *);
6090 EOCP
6091 fi
6092 $cat >>try.c <<EOCP
6093 int main() {
6094     long double nv = 4294967303.15;
6095     long double v, w;
6096     v = modfl(nv, &w);         
6097 #ifdef __GLIBC__
6098     printf("glibc");
6099 #endif
6100     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6101     return 0;
6102 }
6103 EOCP
6104         case "$osname:$gccversion" in
6105         aix:)   saveccflags="$ccflags"
6106                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6107         esac
6108         set try
6109         if eval $compile; then
6110                 foo=`$run ./try`
6111                 case "$foo" in
6112                 *" 4294967303.150000 1.150000 4294967302.000000")
6113                         echo >&4 "Your modfl() is broken for large values."
6114                         d_modfl_pow32_bug="$define"
6115                         case "$foo" in
6116                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6117                         ;;
6118                         esac
6119                         ;;
6120                 *" 4294967303.150000 0.150000 4294967303.000000")
6121                         echo >&4 "Your modfl() seems okay for large values."
6122                         ;;
6123                 *)      echo >&4 "I don't understand your modfl() at all."
6124                         d_modfl="$undef"
6125                         ;;
6126                 esac
6127                 $rm -f try.* try core core.try.*
6128         else
6129                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6130                 d_modfl="$undef"
6131         fi
6132         case "$osname:$gccversion" in
6133         aix:)   ccflags="$saveccflags" ;; # restore
6134         esac
6135         ;;
6136 esac
6137
6138 case "$ccflags" in
6139 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6140 esac
6141
6142 case "$uselongdouble" in
6143 $define|true|[yY]*)     dflt='y';;
6144 *) dflt='n';;
6145 esac
6146 cat <<EOM
6147
6148 Perl can be built to take advantage of long doubles which
6149 (if available) may give more accuracy and range for floating point numbers.
6150
6151 If this doesn't make any sense to you, just accept the default '$dflt'.
6152 EOM
6153 rp='Try to use long doubles if available?'
6154 . ./myread
6155 case "$ans" in
6156 y|Y)    val="$define"   ;;
6157 *)      val="$undef"    ;;
6158 esac
6159 set uselongdouble
6160 eval $setvar
6161
6162 case "$uselongdouble" in
6163 true|[yY]*) uselongdouble="$define" ;;
6164 esac
6165
6166 case "$uselongdouble" in
6167 $define)
6168 : Look for a hint-file generated 'call-back-unit'.  If the
6169 : user has specified that long doubles should be used,
6170 : we may need to set or change some other defaults.
6171         if $test -f uselongdouble.cbu; then
6172                 echo "Your platform has some specific hints for long doubles, using them..."
6173                 . ./uselongdouble.cbu
6174         else
6175                 $cat <<EOM
6176 (Your platform doesn't have any specific hints for long doubles.)
6177 EOM
6178         fi
6179         ;;
6180 esac
6181
6182 message=X
6183 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6184 $define:$define:$define)
6185         : You have both
6186         ;;
6187 $define:$define:$undef)
6188         message="I could not find modfl"
6189         ;;
6190 $define:$undef:$define)
6191         message="I could not find sqrtl"
6192         ;;
6193 $define:$undef:$undef)
6194         message="I found neither sqrtl nor modfl"
6195         ;;
6196 esac
6197
6198 if $test "$message" != X; then
6199         $cat <<EOM >&4
6200
6201 *** You requested the use of long doubles but you do not seem to have
6202 *** the mathematic functions for long doubles.
6203 *** ($message)
6204 *** I'm disabling the use of long doubles.
6205
6206 EOM
6207
6208         uselongdouble=$undef
6209 fi
6210
6211 : determine the architecture name
6212 echo " "
6213 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6214         tarch=`arch`"-$osname"
6215 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6216         if uname -m > tmparch 2>&1 ; then
6217                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6218                         -e 's/$/'"-$osname/" tmparch`
6219         else
6220                 tarch="$osname"
6221         fi
6222         $rm -f tmparch
6223 else
6224         tarch="$osname"
6225 fi
6226 case "$myarchname" in
6227 ''|"$tarch") ;;
6228 *)
6229         echo "(Your architecture name used to be $myarchname.)"
6230         archname=''
6231         ;;
6232 esac
6233 case "$targetarch" in
6234 '') ;;
6235 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6236 esac
6237 myarchname="$tarch"
6238 case "$archname" in
6239 '') dflt="$tarch";;
6240 *) dflt="$archname";;
6241 esac
6242 rp='What is your architecture name'
6243 . ./myread
6244 archname="$ans"
6245 case "$usethreads" in
6246 $define)
6247         echo "Threads selected." >&4
6248         case "$archname" in
6249         *-thread*) echo "...and architecture name already has -thread." >&4
6250                 ;;
6251         *)      archname="$archname-thread"
6252                 echo "...setting architecture name to $archname." >&4
6253                 ;;
6254         esac
6255         ;;
6256 esac
6257 case "$usemultiplicity" in
6258 $define)
6259         echo "Multiplicity selected." >&4
6260         case "$archname" in
6261         *-multi*) echo "...and architecture name already has -multi." >&4
6262                 ;;
6263         *)      archname="$archname-multi"
6264                 echo "...setting architecture name to $archname." >&4
6265                 ;;
6266         esac
6267         ;;
6268 esac
6269 case "$use64bitint$use64bitall" in
6270 *"$define"*)
6271         case "$archname64" in
6272         '')
6273                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6274                 ;;
6275         *)
6276                 case "$use64bitint" in
6277                 "$define") echo "64 bit integers selected." >&4 ;;
6278                 esac
6279                 case "$use64bitall" in
6280                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6281                 esac
6282                 case "$archname" in
6283                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6284                         ;;
6285                 *)      archname="$archname-$archname64"
6286                         echo "...setting architecture name to $archname." >&4
6287                         ;;
6288                 esac
6289                 ;;
6290         esac
6291 esac
6292 case "$uselongdouble" in
6293 $define)
6294         echo "Long doubles selected." >&4
6295         case "$longdblsize" in
6296         $doublesize)
6297                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6298                 ;;
6299         *)
6300                 case "$archname" in
6301                 *-ld*) echo "...and architecture name already has -ld." >&4
6302                         ;;
6303                 *)      archname="$archname-ld"
6304                         echo "...setting architecture name to $archname." >&4
6305                         ;;
6306                 esac
6307                 ;;
6308         esac
6309         ;;
6310 esac
6311 case "$useperlio" in
6312 $define)
6313         echo "Perlio selected." >&4
6314         ;;
6315 *)
6316         echo "Perlio not selected, using stdio." >&4
6317         case "$archname" in
6318         *-stdio*) echo "...and architecture name already has -stdio." >&4
6319                 ;;
6320         *)      archname="$archname-stdio"
6321                 echo "...setting architecture name to $archname." >&4
6322                 ;;
6323         esac
6324         ;;
6325 esac
6326
6327 : determine root of directory hierarchy where package will be installed.
6328 case "$prefix" in
6329 '')
6330         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6331         ;;
6332 *?/)
6333         dflt=`echo "$prefix" | sed 's/.$//'`
6334         ;;
6335 *)
6336         dflt="$prefix"
6337         ;;
6338 esac
6339 $cat <<EOM
6340
6341 By default, $package will be installed in $dflt/bin, manual pages
6342 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6343 installation directories. Typically this is something like /usr/local.
6344 If you wish to have binaries under /usr/bin but other parts of the
6345 installation under /usr/local, that's ok: you will be prompted
6346 separately for each of the installation directories, the prefix being
6347 only used to set the defaults.
6348
6349 EOM
6350 fn=d~
6351 rp='Installation prefix to use?'
6352 . ./getfile
6353 oldprefix=''
6354 case "$prefix" in
6355 '') ;;
6356 *)
6357         case "$ans" in
6358         "$prefix") ;;
6359         *) oldprefix="$prefix";;
6360         esac
6361         ;;
6362 esac
6363 prefix="$ans"
6364 prefixexp="$ansexp"
6365
6366 case "$afsroot" in
6367 '')     afsroot=/afs ;;
6368 *)      afsroot=$afsroot ;;
6369 esac
6370
6371 : is AFS running?
6372 echo " "
6373 case "$afs" in
6374 $define|true)   afs=true ;;
6375 $undef|false)   afs=false ;;
6376 *)      if test -d $afsroot; then
6377                 afs=true
6378         else
6379                 afs=false
6380         fi
6381         ;;
6382 esac
6383 if $afs; then
6384         echo "AFS may be running... I'll be extra cautious then..." >&4
6385 else
6386         echo "AFS does not seem to be running..." >&4
6387 fi
6388
6389 : determine installation prefix for where package is to be installed.
6390 if $afs; then 
6391 $cat <<EOM
6392
6393 Since you are running AFS, I need to distinguish the directory in which
6394 files will reside from the directory in which they are installed (and from
6395 which they are presumably copied to the former directory by occult means).
6396
6397 EOM
6398         case "$installprefix" in
6399         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6400         *) dflt="$installprefix";;
6401         esac
6402 else
6403 $cat <<EOM
6404
6405 In some special cases, particularly when building $package for distribution,
6406 it is convenient to distinguish between the directory in which files should 
6407 be installed from the directory ($prefix) in which they 
6408 will eventually reside.  For most users, these two directories are the same.
6409
6410 EOM
6411         case "$installprefix" in
6412         '') dflt=$prefix ;;
6413         *) dflt=$installprefix;;
6414         esac
6415 fi
6416 fn=d~
6417 rp='What installation prefix should I use for installing files?'
6418 . ./getfile
6419 installprefix="$ans"
6420 installprefixexp="$ansexp"
6421
6422 : set the prefixit variable, to compute a suitable default value
6423 prefixit='case "$3" in
6424 ""|none)
6425         case "$oldprefix" in
6426         "") eval "$1=\"\$$2\"";;
6427         *)
6428                 case "$3" in
6429                 "") eval "$1=";;
6430                 none)
6431                         eval "tp=\"\$$2\"";
6432                         case "$tp" in
6433                         ""|" ") eval "$1=\"\$$2\"";;
6434                         *) eval "$1=";;
6435                         esac;;
6436                 esac;;
6437         esac;;
6438 *)
6439         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6440         case "$tp" in
6441         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6442         /*-$oldprefix/*|\~*-$oldprefix/*)
6443                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6444         *) eval "$1=\"\$$2\"";;
6445         esac;;
6446 esac'
6447
6448 : get the patchlevel
6449 echo " "
6450 echo "Getting the current patchlevel..." >&4
6451 if $test -r $rsrc/patchlevel.h;then
6452         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6453         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6454         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6455         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6456         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6457         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6458        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6459 else
6460         revision=0
6461         patchlevel=0
6462         subversion=0
6463         api_revision=0
6464         api_version=0
6465         api_subversion=0
6466         perl_patchlevel=0
6467         $echo "(You do not have patchlevel.h.  Eek.)"
6468 fi
6469 if $test -r $rsrc/.patch ; then  
6470         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6471                 perl_patchlevel=`cat $rsrc/.patch`
6472         fi
6473 fi
6474 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6475 version_patchlevel_string="version $patchlevel subversion $subversion"
6476 case "$perl_patchlevel" in
6477 0|'') ;;
6478 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6479 esac
6480
6481 $echo "(You have $package $version_patchlevel_string.)"
6482
6483 case "$osname" in
6484 dos|vms)
6485         : XXX Should be a Configure test for double-dots in filenames.
6486         version=`echo $revision $patchlevel $subversion | \
6487                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6488         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6489                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6490         ;;
6491 *)
6492         version=`echo $revision $patchlevel $subversion | \
6493                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6494         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6495                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6496         ;;
6497 esac
6498 : Special case the 5.005_xx maintenance series, which used 5.005
6499 : without any subversion label as a subdirectory in $sitelib
6500 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6501         api_versionstring='5.005'
6502 fi
6503
6504 : determine installation style
6505 : For now, try to deduce it from prefix unless it is already set.
6506 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6507 case "$installstyle" in
6508 '')     case "$prefix" in
6509                 *perl*) dflt='lib';;
6510                 *) dflt='lib/perl5' ;;
6511         esac
6512         ;;
6513 *)      dflt="$installstyle" ;;
6514 esac
6515 : Probably not worth prompting for this since we prompt for all
6516 : the directories individually, and the prompt would be too long and
6517 : confusing anyway.
6518 installstyle=$dflt
6519
6520 : determine where private library files go
6521 : Usual default is /usr/local/lib/perl5/$version.
6522 : Also allow things like /opt/perl/lib/$version, since 
6523 : /opt/perl/lib/perl5... would be redundant.
6524 : The default "style" setting is made in installstyle.U
6525 case "$installstyle" in
6526 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6527 *)       set dflt privlib lib/$version ;;
6528 esac
6529 eval $prefixit
6530 $cat <<EOM
6531
6532 There are some auxiliary files for $package that need to be put into a
6533 private library directory that is accessible by everyone.
6534
6535 EOM
6536 fn=d~+
6537 rp='Pathname where the private library files will reside?'
6538 . ./getfile
6539 privlib="$ans"
6540 privlibexp="$ansexp"
6541 : Change installation prefix, if necessary.
6542 if $test X"$prefix" != X"$installprefix"; then
6543         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6544 else
6545         installprivlib="$privlibexp"
6546 fi
6547
6548 : set the prefixup variable, to restore leading tilda escape
6549 prefixup='case "$prefixexp" in
6550 "$prefix") ;;
6551 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6552 esac'
6553
6554 : determine where public architecture dependent libraries go
6555 set archlib archlib
6556 eval $prefixit
6557 : privlib default is /usr/local/lib/$package/$version
6558 : archlib default is /usr/local/lib/$package/$version/$archname
6559 : privlib may have an optional trailing /share.
6560 tdflt=`echo $privlib | $sed 's,/share$,,'`
6561 tdflt=$tdflt/$archname
6562 case "$archlib" in
6563 '')     dflt=$tdflt
6564         ;;
6565 *)      dflt="$archlib"
6566     ;;
6567 esac
6568 $cat <<EOM
6569
6570 $spackage contains architecture-dependent library files.  If you are
6571 sharing libraries in a heterogeneous environment, you might store
6572 these files in a separate location.  Otherwise, you can just include
6573 them with the rest of the public library files.
6574
6575 EOM
6576 fn=d+~
6577 rp='Where do you want to put the public architecture-dependent libraries?'
6578 . ./getfile
6579 archlib="$ans"
6580 archlibexp="$ansexp"
6581 if $test X"$archlib" = X"$privlib"; then
6582         d_archlib="$undef"
6583 else
6584         d_archlib="$define"
6585 fi
6586 : Change installation prefix, if necessary.
6587 if $test X"$prefix" != X"$installprefix"; then
6588         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6589 else
6590         installarchlib="$archlibexp"
6591 fi
6592
6593 : see if setuid scripts can be secure
6594 $cat <<EOM
6595
6596 Some kernels have a bug that prevents setuid #! scripts from being
6597 secure.  Some sites have disabled setuid #! scripts because of this.
6598
6599 First let's decide if your kernel supports secure setuid #! scripts.
6600 (If setuid #! scripts would be secure but have been disabled anyway,
6601 don't say that they are secure if asked.)
6602
6603 EOM
6604
6605 val="$undef"
6606 if $test -d /dev/fd; then
6607         echo "#!$ls" >reflect
6608         chmod +x,u+s reflect
6609         ./reflect >flect 2>&1
6610         if $contains "/dev/fd" flect >/dev/null; then
6611                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6612                 val="$define"
6613         else
6614                 $cat <<EOM
6615 If you are not sure if they are secure, I can check but I'll need a
6616 username and password different from the one you are using right now.
6617 If you don't have such a username or don't want me to test, simply
6618 enter 'none'.
6619
6620 EOM
6621                 rp='Other username to test security of setuid scripts with?'
6622                 dflt='none'
6623                 . ./myread
6624                 case "$ans" in
6625                 n|none)
6626                         case "$d_suidsafe" in
6627                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6628                                 dflt=n;;
6629                         "$undef")
6630                                 echo "Well, the $hint value is *not* secure." >&4
6631                                 dflt=n;;
6632                         *)      echo "Well, the $hint value *is* secure." >&4
6633                                 dflt=y;;
6634                         esac
6635                         ;;
6636                 *)
6637                         $rm -f reflect flect
6638                         echo "#!$ls" >reflect
6639                         chmod +x,u+s reflect
6640                         echo >flect
6641                         chmod a+w flect
6642                         echo '"su" will (probably) prompt you for '"$ans's password."
6643                         su $ans -c './reflect >flect'
6644                         if $contains "/dev/fd" flect >/dev/null; then
6645                                 echo "Okay, it looks like setuid scripts are secure." >&4
6646                                 dflt=y
6647                         else
6648                                 echo "I don't think setuid scripts are secure." >&4
6649                                 dflt=n
6650                         fi
6651                         ;;
6652                 esac
6653                 rp='Does your kernel have *secure* setuid scripts?'
6654                 . ./myread
6655                 case "$ans" in
6656                 [yY]*)  val="$define";;
6657                 *)      val="$undef";;
6658                 esac
6659         fi
6660 else
6661         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6662         echo "(That's for file descriptors, not floppy disks.)"
6663         val="$undef"
6664 fi
6665 set d_suidsafe
6666 eval $setvar
6667
6668 $rm -f reflect flect
6669
6670 : now see if they want to do setuid emulation
6671 echo " "
6672 val="$undef"
6673 case "$d_suidsafe" in
6674 "$define")
6675         val="$undef"
6676         echo "No need to emulate SUID scripts since they are secure here." >&4
6677         ;;
6678 *)
6679         $cat <<EOM
6680 Some systems have disabled setuid scripts, especially systems where
6681 setuid scripts cannot be secure.  On systems where setuid scripts have
6682 been disabled, the setuid/setgid bits on scripts are currently
6683 useless.  It is possible for $package to detect those bits and emulate
6684 setuid/setgid in a secure fashion.  This emulation will only work if
6685 setuid scripts have been disabled in your kernel.
6686
6687 EOM
6688         case "$d_dosuid" in
6689         "$define") dflt=y ;;
6690         *) dflt=n ;;
6691         esac
6692         rp="Do you want to do setuid/setgid emulation?"
6693         . ./myread
6694         case "$ans" in
6695         [yY]*)  val="$define";;
6696         *)      val="$undef";;
6697         esac
6698         ;;
6699 esac
6700 set d_dosuid
6701 eval $setvar
6702
6703 : see if this is a malloc.h system
6704 set malloc.h i_malloc
6705 eval $inhdr
6706
6707 : see if stdlib is available
6708 set stdlib.h i_stdlib
6709 eval $inhdr
6710
6711 : check for void type
6712 echo " "
6713 echo "Checking to see how well your C compiler groks the void type..." >&4
6714 case "$voidflags" in
6715 '')
6716         $cat >try.c <<'EOCP'
6717 #if TRY & 1
6718 void sub() {
6719 #else
6720 sub() {
6721 #endif
6722         extern void moo();      /* function returning void */
6723         void (*goo)();          /* ptr to func returning void */
6724 #if TRY & 8
6725         void *hue;              /* generic ptr */
6726 #endif
6727 #if TRY & 2
6728         void (*foo[10])();
6729 #endif
6730
6731 #if TRY & 4
6732         if(goo == moo) {
6733                 exit(0);
6734         }
6735 #endif
6736         exit(0);
6737 }
6738 int main() { sub(); }
6739 EOCP
6740         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6741                 voidflags=$defvoidused
6742         echo "Good.  It appears to support void to the level $package wants.">&4
6743                 if $contains warning .out >/dev/null 2>&1; then
6744                         echo "However, you might get some warnings that look like this:"
6745                         $cat .out
6746                 fi
6747         else
6748 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6749                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6750                         echo "It supports 1..."
6751                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6752                                 echo "It also supports 2..."
6753                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6754                                         voidflags=7
6755                                         echo "And it supports 4 but not 8 definitely."
6756                                 else
6757                                         echo "It doesn't support 4..."
6758                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6759                                                 voidflags=11
6760                                                 echo "But it supports 8."
6761                                         else
6762                                                 voidflags=3
6763                                                 echo "Neither does it support 8."
6764                                         fi
6765                                 fi
6766                         else
6767                                 echo "It does not support 2..."
6768                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6769                                         voidflags=13
6770                                         echo "But it supports 4 and 8."
6771                                 else
6772                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6773                                                 voidflags=5
6774                                                 echo "And it supports 4 but has not heard about 8."
6775                                         else
6776                                                 echo "However it supports 8 but not 4."
6777                                         fi
6778                                 fi
6779                         fi
6780                 else
6781                         echo "There is no support at all for void."
6782                         voidflags=0
6783                 fi
6784         fi
6785 esac
6786 case "$voidflags" in
6787 "$defvoidused") ;;
6788 *)      $cat >&4 <<'EOM'
6789   Support flag bits are:
6790     1: basic void declarations.
6791     2: arrays of pointers to functions returning void.
6792     4: operations between pointers to and addresses of void functions.
6793     8: generic void pointers.
6794 EOM
6795         dflt="$voidflags";
6796         rp="Your void support flags add up to what?"
6797         . ./myread
6798         voidflags="$ans"
6799         ;;
6800 esac
6801 $rm -f try.* .out
6802
6803 : check for length of pointer
6804 echo " "
6805 case "$ptrsize" in
6806 '')
6807         echo "Checking to see how big your pointers are..." >&4
6808         if test "$voidflags" -gt 7; then
6809                 echo '#define VOID_PTR char *' > try.c
6810         else
6811                 echo '#define VOID_PTR void *' > try.c
6812         fi
6813         $cat >>try.c <<'EOCP'
6814 #include <stdio.h>
6815 int main()
6816 {
6817     printf("%d\n", (int)sizeof(VOID_PTR));
6818     exit(0);
6819 }
6820 EOCP
6821         set try
6822         if eval $compile_ok; then
6823                 ptrsize=`$run ./try`
6824                 echo "Your pointers are $ptrsize bytes long."
6825         else
6826                 dflt='4'
6827                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6828                 rp="What is the size of a pointer (in bytes)?"
6829                 . ./myread
6830                 ptrsize="$ans"
6831         fi
6832         ;;
6833 esac
6834 $rm -f try.c try
6835 case "$use64bitall" in
6836 "$define"|true|[yY]*)
6837         case "$ptrsize" in
6838         4)      cat <<EOM >&4
6839
6840 *** You have chosen a maximally 64-bit build, but your pointers
6841 *** are only 4 bytes wide, disabling maximal 64-bitness.
6842
6843 EOM
6844                 use64bitall="$undef"
6845                 case "$use64bitint" in
6846                 "$define"|true|[yY]*) ;;
6847                 *)      cat <<EOM >&4
6848
6849 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6850
6851 EOM
6852                         use64bitint="$define"
6853                         ;;
6854                 esac
6855                 ;;
6856         esac
6857         ;;
6858 esac
6859
6860
6861 : determine which malloc to compile in
6862 echo " "
6863 case "$usemymalloc" in
6864 [yY]*|true|$define)     dflt='y' ;;
6865 [nN]*|false|$undef)     dflt='n' ;;
6866 *)      case "$ptrsize" in
6867         4) dflt='y' ;;
6868         *) dflt='n' ;;
6869         esac
6870         ;;
6871 esac
6872 rp="Do you wish to attempt to use the malloc that comes with $package?"
6873 . ./myread
6874 usemymalloc="$ans"
6875 case "$ans" in
6876 y*|true)
6877         usemymalloc='y'
6878         mallocsrc='malloc.c'
6879         mallocobj="malloc$_o"
6880         d_mymalloc="$define"
6881         case "$libs" in
6882         *-lmalloc*)
6883                 : Remove malloc from list of libraries to use
6884                 echo "Removing unneeded -lmalloc from library list" >&4
6885                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6886                 shift
6887                 libs="$*"
6888                 echo "libs = $libs" >&4
6889                 ;;
6890         esac
6891         ;;
6892 *)
6893         usemymalloc='n'
6894         mallocsrc=''
6895         mallocobj=''
6896         d_mymalloc="$undef"
6897         ;;
6898 esac
6899
6900 : compute the return types of malloc and free
6901 echo " "
6902 $cat >malloc.c <<END
6903 #$i_malloc I_MALLOC
6904 #$i_stdlib I_STDLIB
6905 #include <stdio.h>
6906 #include <sys/types.h>
6907 #ifdef I_MALLOC
6908 #include <malloc.h>
6909 #endif
6910 #ifdef I_STDLIB
6911 #include <stdlib.h>
6912 #endif
6913 #ifdef TRY_MALLOC
6914 void *malloc();
6915 #endif
6916 #ifdef TRY_FREE
6917 void free();
6918 #endif
6919 END
6920 case "$malloctype" in
6921 '')
6922         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6923                 malloctype='void *'
6924         else
6925                 malloctype='char *'
6926         fi
6927         ;;
6928 esac
6929 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6930
6931 case "$freetype" in
6932 '')
6933         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6934                 freetype='void'
6935         else
6936                 freetype='int'
6937         fi
6938         ;;
6939 esac
6940 echo "Your system uses $freetype free(), it would seem." >&4
6941 $rm -f malloc.[co]
6942 $cat <<EOM
6943
6944 After $package is installed, you may wish to install various
6945 add-on modules and utilities.  Typically, these add-ons will
6946 be installed under $prefix with the rest
6947 of this package.  However, you may wish to install such add-ons
6948 elsewhere under a different prefix.
6949
6950 If you do not wish to put everything under a single prefix, that's
6951 ok.  You will be prompted for the individual locations; this siteprefix
6952 is only used to suggest the defaults.
6953
6954 The default should be fine for most people.
6955
6956 EOM
6957 fn=d~+
6958 rp='Installation prefix to use for add-on modules and utilities?'
6959 : XXX Here might be another good place for an installstyle setting.
6960 case "$siteprefix" in
6961 '') dflt=$prefix ;;
6962 *)  dflt=$siteprefix ;;
6963 esac
6964 . ./getfile
6965 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6966 oldsiteprefix=''
6967 case "$siteprefix" in
6968 '') ;;
6969 *)      case "$ans" in
6970         "$prefix") ;;
6971         *) oldsiteprefix="$prefix";;
6972         esac
6973         ;;
6974 esac
6975 siteprefix="$ans"
6976 siteprefixexp="$ansexp"
6977
6978 : determine where site specific libraries go.
6979 : Usual default is /usr/local/lib/perl5/site_perl/$version
6980 : The default "style" setting is made in installstyle.U
6981 : XXX No longer works with Prefixit stuff.
6982 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6983 case "$sitelib" in
6984 '') case "$installstyle" in
6985         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6986         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6987         esac
6988         ;;
6989 *)      dflt="$sitelib"
6990         ;;
6991 esac
6992 $cat <<EOM
6993
6994 The installation process will create a directory for
6995 site-specific extensions and modules.  Most users find it convenient
6996 to place all site-specific files in this directory rather than in the
6997 main distribution directory.
6998
6999 EOM
7000 fn=d~+
7001 rp='Pathname for the site-specific library files?'
7002 . ./getfile
7003 sitelib="$ans"
7004 sitelibexp="$ansexp"
7005 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7006 : Change installation prefix, if necessary.
7007 if $test X"$prefix" != X"$installprefix"; then
7008         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7009 else
7010         installsitelib="$sitelibexp"
7011 fi
7012
7013 : determine where site specific architecture-dependent libraries go.
7014 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7015 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7016 : sitelib may have an optional trailing /share.
7017 case "$sitearch" in
7018 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7019         dflt="$dflt/$archname"
7020         ;;
7021 *)      dflt="$sitearch"
7022         ;;
7023 esac
7024 set sitearch sitearch none
7025 eval $prefixit
7026 $cat <<EOM
7027
7028 The installation process will also create a directory for
7029 architecture-dependent site-specific extensions and modules.
7030
7031 EOM
7032 fn=d~+
7033 rp='Pathname for the site-specific architecture-dependent library files?'
7034 . ./getfile
7035 sitearch="$ans"
7036 sitearchexp="$ansexp"
7037 : Change installation prefix, if necessary.
7038 if $test X"$prefix" != X"$installprefix"; then
7039         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7040 else
7041         installsitearch="$sitearchexp"
7042 fi
7043
7044 $cat <<EOM
7045
7046 The installation process will also create a directory for
7047 vendor-supplied add-ons.  Vendors who supply perl with their system
7048 may find it convenient to place all vendor-supplied files in this
7049 directory rather than in the main distribution directory.  This will
7050 ease upgrades between binary-compatible maintenance versions of perl.
7051
7052 Of course you may also use these directories in whatever way you see
7053 fit.  For example, you might use them to access modules shared over a
7054 company-wide network.
7055
7056 The default answer should be fine for most people.
7057 This causes further questions about vendor add-ons to be skipped
7058 and no vendor-specific directories will be configured for perl.
7059
7060 EOM
7061 rp='Do you want to configure vendor-specific add-on directories?'
7062 case "$usevendorprefix" in
7063 define|true|[yY]*) dflt=y ;;
7064 *)      : User may have set vendorprefix directly on Configure command line.
7065         case "$vendorprefix" in
7066         ''|' ') dflt=n ;;
7067         *)      dflt=y ;;
7068         esac
7069         ;;
7070 esac
7071 . ./myread
7072 case "$ans" in
7073 [yY]*)  fn=d~+
7074         rp='Installation prefix to use for vendor-supplied add-ons?'
7075         case "$vendorprefix" in
7076         '') dflt='' ;;
7077         *)  dflt=$vendorprefix ;;
7078         esac
7079         . ./getfile
7080         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7081         oldvendorprefix=''
7082         case "$vendorprefix" in
7083         '') ;;
7084         *)      case "$ans" in
7085                 "$prefix") ;;
7086                 *) oldvendorprefix="$prefix";;
7087                 esac
7088                 ;;
7089         esac
7090         usevendorprefix="$define"
7091         vendorprefix="$ans"
7092         vendorprefixexp="$ansexp"
7093         ;;
7094 *)      usevendorprefix="$undef"
7095         vendorprefix=''
7096         vendorprefixexp=''
7097         ;;
7098 esac
7099
7100 case "$vendorprefix" in
7101 '')     d_vendorlib="$undef"
7102         vendorlib=''
7103         vendorlibexp=''
7104         ;;
7105 *)      d_vendorlib="$define"
7106         : determine where vendor-supplied modules go.
7107         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7108         case "$vendorlib" in
7109         '')
7110                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7111                 case "$installstyle" in
7112                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7113                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7114                 esac
7115                 ;;
7116         *)      dflt="$vendorlib"
7117                 ;;
7118         esac
7119         fn=d~+
7120         rp='Pathname for the vendor-supplied library files?'
7121         . ./getfile
7122         vendorlib="$ans"
7123         vendorlibexp="$ansexp"
7124         ;;
7125 esac
7126 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7127 : Change installation prefix, if necessary.
7128 if $test X"$prefix" != X"$installprefix"; then
7129         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7130 else
7131         installvendorlib="$vendorlibexp"
7132 fi
7133
7134 case "$vendorprefix" in
7135 '')     d_vendorarch="$undef"
7136         vendorarch=''
7137         vendorarchexp=''
7138         ;;
7139 *)      d_vendorarch="$define"
7140         : determine where vendor-supplied architecture-dependent libraries go.
7141         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7142         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7143         : vendorlib may have an optional trailing /share.
7144         case "$vendorarch" in
7145         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7146                 dflt="$dflt/$archname"
7147                 ;;
7148         *)      dflt="$vendorarch" ;;
7149         esac
7150         fn=d~+
7151         rp='Pathname for vendor-supplied architecture-dependent files?'
7152         . ./getfile
7153         vendorarch="$ans"
7154         vendorarchexp="$ansexp"
7155         ;;
7156 esac
7157 : Change installation prefix, if necessary.
7158 if $test X"$prefix" != X"$installprefix"; then
7159         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7160 else
7161         installvendorarch="$vendorarchexp"
7162 fi
7163
7164 : Final catch-all directories to search
7165 $cat <<EOM
7166
7167 Lastly, you can have perl look in other directories for extensions and
7168 modules in addition to those already specified.
7169 These directories will be searched after 
7170         $sitearch 
7171         $sitelib 
7172 EOM
7173 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7174 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7175 echo ' '
7176 case "$otherlibdirs" in
7177 ''|' ') dflt='none' ;;
7178 *)      dflt="$otherlibdirs" ;;
7179 esac
7180 $cat <<EOM
7181 Enter a colon-separated set of extra paths to include in perl's @INC
7182 search path, or enter 'none' for no extra paths.
7183
7184 EOM
7185
7186 rp='Colon-separated list of additional directories for perl to search?'
7187 . ./myread
7188 case "$ans" in
7189 ' '|''|none)    otherlibdirs=' ' ;;     
7190 *)      otherlibdirs="$ans" ;;
7191 esac
7192 case "$otherlibdirs" in
7193 ' ') val=$undef ;;
7194 *)      val=$define ;;
7195 esac
7196 set d_perl_otherlibdirs
7197 eval $setvar
7198
7199 : Cruising for prototypes
7200 echo " "
7201 echo "Checking out function prototypes..." >&4
7202 $cat >prototype.c <<'EOCP'
7203 int main(int argc, char *argv[]) {
7204         exit(0);}
7205 EOCP
7206 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7207         echo "Your C compiler appears to support function prototypes."
7208         val="$define"
7209 else
7210         echo "Your C compiler doesn't seem to understand function prototypes."
7211         val="$undef"
7212 fi
7213 set prototype
7214 eval $setvar
7215 $rm -f prototype*
7216
7217 case "$prototype" in
7218 "$define") ;;
7219 *)      ansi2knr='ansi2knr'
7220         echo " "
7221         cat <<EOM >&4
7222
7223 $me:  FATAL ERROR:
7224 This version of $package can only be compiled by a compiler that 
7225 understands function prototypes.  Unfortunately, your C compiler 
7226         $cc $ccflags
7227 doesn't seem to understand them.  Sorry about that.
7228
7229 If GNU cc is available for your system, perhaps you could try that instead.  
7230
7231 Eventually, we hope to support building Perl with pre-ANSI compilers.
7232 If you would like to help in that effort, please contact <perlbug@perl.org>.
7233
7234 Aborting Configure now.
7235 EOM
7236         exit 2
7237         ;;
7238 esac
7239
7240 : determine where public executables go
7241 echo " "
7242 set dflt bin bin
7243 eval $prefixit
7244 fn=d~
7245 rp='Pathname where the public executables will reside?'
7246 . ./getfile
7247 if $test "X$ansexp" != "X$binexp"; then
7248         installbin=''
7249 fi
7250 bin="$ans"
7251 binexp="$ansexp"
7252 : Change installation prefix, if necessary.
7253 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7254 if $test X"$prefix" != X"$installprefix"; then
7255         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7256 else
7257         installbin="$binexp"
7258 fi
7259
7260 echo " "
7261 case "$extras" in
7262 '') dflt='n';;
7263 *) dflt='y';;
7264 esac
7265 cat <<EOM
7266 Perl can be built with extra modules or bundles of modules which
7267 will be fetched from the CPAN and installed alongside Perl.
7268
7269 Notice that you will need access to the CPAN; either via the Internet,
7270 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7271 be asked later to configure the CPAN.pm module which will in turn do
7272 the installation of the rest of the extra modules or bundles.)
7273
7274 Notice also that if the modules require any external software such as
7275 libraries and headers (the libz library and the zlib.h header for the
7276 Compress::Zlib module, for example) you MUST have any such software
7277 already installed, this configuration process will NOT install such
7278 things for you.
7279
7280 If this doesn't make any sense to you, just accept the default '$dflt'.
7281 EOM
7282 rp='Install any extra modules (y or n)?'
7283 . ./myread
7284 case "$ans" in
7285 y|Y)
7286         cat <<EOM
7287
7288 Please list any extra modules or bundles to be installed from CPAN,
7289 with spaces between the names.  The names can be in any format the
7290 'install' command of CPAN.pm will understand.  (Answer 'none',
7291 without the quotes, to install no extra modules or bundles.)
7292 EOM
7293         rp='Extras?'
7294         dflt="$extras"
7295         . ./myread
7296         extras="$ans"
7297 esac
7298 case "$extras" in
7299 ''|'none')
7300         val=''
7301         $rm -f ../extras.lst
7302         ;;
7303 *)      echo "(Saving the list of extras for later...)"
7304         echo "$extras" > ../extras.lst
7305         val="'$extras'"
7306         ;;
7307 esac
7308 set extras
7309 eval $setvar
7310 echo " "
7311
7312 : Find perl5.005 or later.
7313 echo "Looking for a previously installed perl5.005 or later... "
7314 case "$perl5" in
7315 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7316                 : Check if this perl is recent and can load a simple module
7317                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7318                         perl5=$tdir/perl
7319                         break;
7320                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7321                         perl5=$tdir/perl5
7322                         break;
7323                 fi
7324         done
7325         ;;
7326 *)      perl5="$perl5"
7327         ;;
7328 esac
7329 case "$perl5" in
7330 '')     echo "None found.  That's ok.";;
7331 *)      echo "Using $perl5." ;;
7332 esac
7333
7334 : Determine list of previous versions to include in @INC
7335 $cat > getverlist <<EOPL
7336 #!$perl5 -w
7337 use File::Basename;
7338 \$api_versionstring = "$api_versionstring";
7339 \$version = "$version";
7340 \$stem = "$sitelib_stem";
7341 \$archname = "$archname";
7342 EOPL
7343         $cat >> getverlist <<'EOPL'
7344 # Can't have leading @ because metaconfig interprets it as a command!
7345 ;@inc_version_list=();
7346 # XXX Redo to do opendir/readdir? 
7347 if (-d $stem) {
7348     chdir($stem);
7349     ;@candidates = glob("5.*");
7350 }
7351 else {
7352     ;@candidates = ();
7353 }
7354
7355 # XXX ToDo:  These comparisons must be reworked when two-digit
7356 # subversions come along, so that 5.7.10 compares as greater than
7357 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7358 # widespread that we can use the built-in version vectors rather
7359 # than reinventing them here.  For 5.6.0, however, we must
7360 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7361 foreach $d (@candidates) {
7362     if ($d lt $version) {
7363         if ($d ge $api_versionstring) {
7364             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7365         }
7366         elsif ($d ge "5.005") {
7367             unshift(@inc_version_list, grep { -d } $d);
7368         }
7369     }
7370     else {
7371         # Skip newer version.  I.e. don't look in
7372         # 5.7.0 if we're installing 5.6.1.
7373     }
7374 }
7375
7376 if (@inc_version_list) {
7377     print join(' ', @inc_version_list);
7378 }
7379 else {
7380     # Blank space to preserve value for next Configure run.
7381     print " ";
7382 }
7383 EOPL
7384 chmod +x getverlist
7385 case "$inc_version_list" in
7386 '')     if test -x "$perl5$exe_ext"; then
7387                 dflt=`$perl5 getverlist`
7388         else
7389                 dflt='none'
7390         fi
7391         ;;
7392 $undef) dflt='none' ;;
7393 *)  eval dflt=\"$inc_version_list\" ;;
7394 esac
7395 case "$dflt" in
7396 ''|' ') dflt=none ;;
7397 esac
7398 case "$dflt" in
7399 5.005) dflt=none ;;
7400 esac
7401 $cat <<EOM
7402
7403 In order to ease the process of upgrading, this version of perl 
7404 can be configured to use modules built and installed with earlier 
7405 versions of perl that were installed under $prefix.  Specify here
7406 the list of earlier versions that this version of perl should check.
7407 If Configure detected no earlier versions of perl installed under
7408 $prefix, then the list will be empty.  Answer 'none' to tell perl
7409 to not search earlier versions.
7410
7411 The default should almost always be sensible, so if you're not sure,
7412 just accept the default.
7413 EOM
7414
7415 rp='List of earlier versions to include in @INC?'
7416 . ./myread
7417 case "$ans" in
7418 [Nn]one|''|' ') inc_version_list=' ' ;;
7419 *) inc_version_list="$ans" ;;
7420 esac
7421 case "$inc_version_list" in
7422 ''|' ') 
7423         inc_version_list_init='0';;
7424 *)      inc_version_list_init=`echo $inc_version_list |
7425                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7426         ;;
7427 esac
7428 $rm -f getverlist
7429
7430 : determine whether to install perl also as /usr/bin/perl
7431
7432 echo " "
7433 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7434         $cat <<EOM
7435 Many scripts expect perl to be installed as /usr/bin/perl.
7436 I can install the perl you are about to compile also as /usr/bin/perl
7437 (in addition to $installbin/perl).
7438 EOM
7439         case "$installusrbinperl" in
7440         "$undef"|[nN]*) dflt='n';;
7441         *)              dflt='y';;
7442         esac
7443         rp="Do you want to install perl as /usr/bin/perl?"
7444         . ./myread
7445         case "$ans" in
7446         [yY]*)  val="$define";;
7447         *)      val="$undef" ;;
7448         esac
7449 else
7450         val="$undef"
7451 fi
7452 set installusrbinperl
7453 eval $setvar
7454
7455 : see if dld is available
7456 set dld.h i_dld
7457 eval $inhdr
7458
7459 : see if dlopen exists
7460 xxx_runnm="$runnm"
7461 runnm=false
7462 set dlopen d_dlopen
7463 eval $inlibc
7464 runnm="$xxx_runnm"
7465
7466 : determine which dynamic loading, if any, to compile in
7467 echo " "
7468 dldir="ext/DynaLoader"
7469 case "$usedl" in
7470 $define|y|true)
7471         dflt='y'
7472         usedl="$define"
7473         ;;
7474 $undef|n|false)
7475         dflt='n'
7476         usedl="$undef"
7477         ;;
7478 *) 
7479         dflt='n'
7480         case "$d_dlopen" in
7481             $define) dflt='y' ;;
7482         esac
7483         case "$i_dld" in
7484             $define) dflt='y' ;;
7485         esac
7486         : Does a dl_xxx.xs file exist for this operating system
7487         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7488         ;;
7489 esac
7490 rp="Do you wish to use dynamic loading?"
7491 . ./myread
7492 usedl="$ans"
7493 case "$ans" in
7494 y*) usedl="$define"
7495         case "$dlsrc" in
7496         '')
7497                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7498                         dflt="$dldir/dl_${osname}.xs"
7499                 elif $test "$d_dlopen" = "$define" ; then
7500                         dflt="$dldir/dl_dlopen.xs"
7501                 elif $test "$i_dld" = "$define" ; then
7502                         dflt="$dldir/dl_dld.xs"
7503                 else
7504                         dflt=''
7505                 fi
7506                 ;;
7507         *)      dflt="$dldir/$dlsrc"
7508                 ;;
7509         esac
7510     echo "The following dynamic loading files are available:"
7511         : Can not go over to $dldir because getfile has path hard-coded in.
7512         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7513         rp="Source file to use for dynamic loading"
7514         fn="fne"
7515         gfpth="$src"
7516         . ./getfile
7517         usedl="$define"
7518         : emulate basename
7519         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7520
7521         $cat << EOM
7522
7523 Some systems may require passing special flags to $cc -c to
7524 compile modules that will be used to create a shared library.
7525 To use no flags, say "none".
7526
7527 EOM
7528     case "$cccdlflags" in
7529     '') case "$gccversion" in
7530                 '') case "$osname" in
7531                         hpux)   dflt='+z' ;;
7532                         next)   dflt='none' ;;
7533                         irix*)  dflt='-KPIC' ;;
7534                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7535                         sunos)  dflt='-pic' ;;
7536                         *)      dflt='none' ;;
7537                     esac
7538                         ;;
7539                 *)  case "$osname" in
7540                         darwin) dflt='none' ;;
7541                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7542                         *)      dflt='-fpic' ;;
7543                     esac ;;
7544             esac ;;
7545         ' ') dflt='none' ;;
7546     *)  dflt="$cccdlflags" ;;
7547     esac
7548     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7549     . ./myread
7550     case "$ans" in
7551     none) cccdlflags=' ' ;;
7552     *) cccdlflags="$ans" ;;
7553     esac
7554
7555     cat << EOM
7556
7557 Some systems use ld to create libraries that can be dynamically loaded,
7558 while other systems (such as those using ELF) use $cc.
7559
7560 EOM
7561         case "$ld" in
7562         '')     $cat >try.c <<'EOM'
7563 /* Test for whether ELF binaries are produced */
7564 #include <fcntl.h>
7565 #include <stdlib.h>
7566 int main() {
7567         char b[4];
7568         int i = open("a.out",O_RDONLY);
7569         if(i == -1) 
7570                 exit(1); /* fail */
7571         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7572                 exit(0); /* succeed (yes, it's ELF) */
7573         else
7574                 exit(1); /* fail */
7575 }
7576 EOM
7577                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7578                         cat <<EOM
7579 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7580 EOM
7581                         dflt="$cc"
7582                 else
7583                         echo "I'll use ld to build dynamic libraries."
7584                         dflt='ld'
7585                 fi
7586                 rm -f try.c a.out
7587                 ;;
7588         *)      dflt="$ld"
7589                 ;;
7590         esac
7591
7592     rp="What command should be used to create dynamic libraries?"
7593     . ./myread
7594         ld="$ans"
7595
7596     cat << EOM
7597
7598 Some systems may require passing special flags to $ld to create a
7599 library that can be dynamically loaded.  If your ld flags include
7600 -L/other/path options to locate libraries outside your loader's normal
7601 search path, you may need to specify those -L options here as well.  To
7602 use no flags, say "none".
7603
7604 EOM
7605     case "$lddlflags" in
7606     '') case "$osname" in
7607                         beos) dflt='-nostart' ;;
7608                         hpux) dflt='-b';
7609                               case "$gccversion" in
7610                               '') dflt="$dflt +vnocompatwarnings" ;;
7611                               esac
7612                               ;;        
7613                         linux|irix*)    dflt='-shared' ;;
7614                         next)  dflt='none' ;;
7615                         solaris) dflt='-G' ;;
7616                         sunos) dflt='-assert nodefinitions' ;;
7617                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7618                 *)     dflt='none' ;;
7619                         esac
7620                         ;;
7621     *) dflt="$lddlflags" ;;
7622     esac
7623
7624         : Try to guess additional flags to pick up local libraries.
7625         : Be careful not to append to a plain 'none'
7626         case "$dflt" in
7627         none) dflt='' ;;
7628         esac
7629         for thisflag in $ldflags; do
7630                 case "$thisflag" in
7631                 -L*|-R*|-Wl,-R*)
7632                         case " $dflt " in
7633                         *" $thisflag "*) ;;
7634                         *) dflt="$dflt $thisflag" ;;
7635                         esac
7636                         ;;
7637                 esac
7638         done
7639
7640         case "$dflt" in
7641         ''|' ') dflt='none' ;;
7642         esac
7643
7644     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7645     . ./myread
7646     case "$ans" in
7647     none) lddlflags=' ' ;;
7648     *) lddlflags="$ans" ;;
7649     esac
7650
7651         cat <<EOM
7652
7653 Some systems may require passing special flags to $cc to indicate that
7654 the resulting executable will use dynamic linking.  To use no flags,
7655 say "none".
7656
7657 EOM
7658     case "$ccdlflags" in
7659     '') case "$osname" in
7660                 hpux)   dflt='-Wl,-E' ;;
7661                 linux)  dflt='-rdynamic' ;;
7662                 next)   dflt='none' ;;
7663                 sunos)  dflt='none' ;;
7664                 *)      dflt='none' ;;
7665             esac ;;
7666     ' ')  dflt='none' ;;
7667     *)  dflt="$ccdlflags" ;;
7668     esac
7669     rp="Any special flags to pass to $cc to use dynamic linking?"
7670     . ./myread
7671     case "$ans" in
7672     none) ccdlflags=' ' ;;
7673     *) ccdlflags="$ans" ;;
7674     esac
7675     ;;
7676 *)  usedl="$undef"
7677         ld='ld'
7678     dlsrc='dl_none.xs'
7679     lddlflags=''
7680     ccdlflags=''
7681     ;;
7682 esac
7683
7684 also=''
7685 case "$usedl" in
7686 $undef)
7687         # No dynamic loading being used, so don't bother even to prompt.
7688         useshrplib='false'
7689         ;;
7690 *)      case "$useshrplib" in
7691         '')     case "$osname" in
7692                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7693                         dflt=y
7694                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7695                         ;;
7696                 next*)
7697                         case "$osvers" in
7698                         4*)     dflt=y
7699                                 also='Building a shared libperl is needed for MAB support.'
7700                                 ;;
7701                         *)      dflt=n
7702                                 ;;
7703                         esac
7704                         ;;
7705                 *)      dflt=n
7706                         ;;
7707                 esac
7708                 ;;
7709         $define|true|[Yy]*)
7710                 dflt=y
7711                 ;;
7712         *)      dflt=n
7713                 ;;
7714         esac
7715         $cat << EOM
7716
7717 The perl executable is normally obtained by linking perlmain.c with
7718 libperl${_a}, any static extensions (usually just DynaLoader), and
7719 any other libraries needed on this system (such as -lm, etc.).  Since
7720 your system supports dynamic loading, it is probably possible to build
7721 a shared libperl.$so.  If you will have more than one executable linked
7722 to libperl.$so, this will significantly reduce the size of each
7723 executable, but it may have a noticeable affect on performance.  The
7724 default is probably sensible for your system.
7725 $also
7726
7727 EOM
7728         rp="Build a shared libperl.$so (y/n)"
7729         . ./myread
7730         case "$ans" in
7731         true|$define|[Yy]*)
7732                 useshrplib='true'  ;;
7733         *)      useshrplib='false' ;;
7734         esac
7735         ;;
7736 esac
7737
7738 case "$useshrplib" in
7739 true)
7740         case "$libperl" in
7741         '')
7742                 # Figure out a good name for libperl.so.  Since it gets stored in
7743                 # a version-specific architecture-dependent library, the version
7744                 # number isn't really that important, except for making cc/ld happy.
7745                 #
7746                 # A name such as libperl.so.3.1
7747                 majmin="libperl.$so.$patchlevel.$subversion"
7748                 # A name such as libperl.so.301
7749                 majonly=`echo $patchlevel $subversion |
7750                         $awk '{printf "%d%02d", $1, $2}'`
7751                 majonly=libperl.$so.$majonly
7752                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7753                 # rely on figuring it out from the naming of libc.
7754                 case "${osname}${osvers}" in
7755                 next4*)
7756                         dflt=libperl.5.$so
7757                         # XXX How handle the --version stuff for MAB?
7758                         ;;
7759                 linux*)  # ld won't link with a bare -lperl otherwise.
7760                         dflt=libperl.$so
7761                         ;;
7762                 cygwin*) # ld links against an importlib
7763                         dflt=libperl$lib_ext
7764                         ;;
7765                 *)      # Try to guess based on whether libc has major.minor.
7766                         case "$libc" in
7767                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7768                         *libc.$so.[0-9]*) dflt=$majonly ;;
7769                         *)      dflt=libperl.$so ;;
7770                         esac
7771                         ;;
7772                 esac
7773                 ;;
7774         *)      dflt=$libperl
7775                 ;;
7776         esac
7777         cat << EOM
7778
7779 I need to select a good name for the shared libperl.  If your system uses
7780 library names with major and minor numbers, then you might want something
7781 like $majmin.  Alternatively, if your system uses a single version
7782 number for shared libraries, then you might want to use $majonly.
7783 Or, your system might be quite happy with a simple libperl.$so.
7784
7785 Since the shared libperl will get installed into a version-specific
7786 architecture-dependent directory, the version number of the shared perl
7787 library probably isn't important, so the default should be o.k.
7788
7789 EOM
7790         rp='What name do you want to give to the shared libperl?'
7791         . ./myread
7792         libperl=$ans
7793         echo "Ok, I'll use $libperl"
7794         ;;
7795 *)
7796         libperl="libperl${_a}"
7797         ;;
7798 esac
7799
7800 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7801 case "$shrpdir" in
7802 '') ;;
7803 *)      $cat >&4 <<EOM
7804 WARNING:  Use of the shrpdir variable for the installation location of
7805 the shared $libperl is not supported.  It was never documented and
7806 will not work in this version.  Let me (perlbug@perl.org)
7807 know of any problems this may cause.
7808
7809 EOM
7810         case "$shrpdir" in
7811         "$archlibexp/CORE")
7812                 $cat >&4 <<EOM
7813 But your current setting of $shrpdir is
7814 the default anyway, so it's harmless.
7815 EOM
7816                 ;;
7817         *)
7818                 $cat >&4 <<EOM
7819 Further, your current attempted setting of $shrpdir
7820 conflicts with the value of $archlibexp/CORE
7821 that installperl will use.
7822 EOM
7823                 ;;
7824         esac
7825         ;;
7826 esac
7827
7828 # How will the perl executable find the installed shared $libperl?
7829 # Add $xxx to ccdlflags.
7830 # If we can't figure out a command-line option, use $shrpenv to
7831 # set env LD_RUN_PATH.  The main perl makefile uses this.
7832 shrpdir=$archlibexp/CORE
7833 xxx=''
7834 tmp_shrpenv=''
7835 if "$useshrplib"; then
7836     case "$osname" in 
7837         aix)
7838                 # We'll set it in Makefile.SH...
7839                 ;;
7840         solaris)
7841                 xxx="-R $shrpdir"
7842                 ;;
7843         freebsd|netbsd)
7844                 xxx="-Wl,-R$shrpdir"
7845                 ;;
7846         bsdos|linux|irix*|dec_osf)
7847                 xxx="-Wl,-rpath,$shrpdir"
7848                 ;;
7849         next)
7850                 # next doesn't like the default...
7851                 ;;
7852         beos)
7853                 # beos doesn't like the default, either.
7854                 ;;
7855         hpux*)
7856                 # hpux doesn't like the default, either.
7857                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7858                 ;;
7859         *)
7860                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7861                 ;;
7862         esac
7863         case "$xxx" in
7864         '') ;;
7865         *)      
7866                 # Only add $xxx if it isn't already in ccdlflags.
7867                 case " $ccdlflags " in
7868                 *" $xxx "*)     ;;
7869                 *)      ccdlflags="$ccdlflags $xxx"
7870                         cat <<EOM >&4
7871
7872 Adding $xxx to the flags
7873 passed to $ld so that the perl executable will find the 
7874 installed shared $libperl.
7875
7876 EOM
7877                         ;;
7878                 esac
7879                 ;;
7880         esac
7881 fi
7882 # Fix ccdlflags in AIX for building external extensions.
7883 # (For building Perl itself bare -bE:perl.exp is needed,
7884 #  Makefile.SH takes care of this.)
7885 case "$osname" in
7886 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7887 esac
7888 # Respect a hint or command-line value.
7889 case "$shrpenv" in
7890 '') shrpenv="$tmp_shrpenv" ;;
7891 esac
7892 case "$ldlibpthname" in
7893 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7894 none)   ldlibpthname='' ;;
7895 esac
7896
7897 : determine where manual pages are on this system
7898 echo " "
7899 case "$sysman" in
7900 '') 
7901         syspath='/usr/share/man/man1 /usr/man/man1'
7902         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7903         syspath="$syspath /usr/man/u_man/man1"
7904         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7905         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7906         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7907         sysman=`./loc . /usr/man/man1 $syspath`
7908         ;;
7909 esac
7910 if $test -d "$sysman"; then
7911         echo "System manual is in $sysman." >&4
7912 else
7913         echo "Could not find manual pages in source form." >&4
7914 fi
7915
7916 : determine where manual pages go
7917 set man1dir man1dir none
7918 eval $prefixit
7919 $cat <<EOM
7920
7921 $spackage has manual pages available in source form.
7922 EOM
7923 case "$nroff" in
7924 nroff)
7925         echo "However, you don't have nroff, so they're probably useless to you."
7926         case "$man1dir" in
7927         '') man1dir="none";;
7928         esac;;
7929 esac
7930 echo "If you don't want the manual sources installed, answer 'none'."
7931 case "$man1dir" in
7932 ' ') dflt=none
7933         ;;
7934 '')
7935         lookpath="$prefixexp/share/man/man1"
7936         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7937         lookpath="$lookpath $prefixexp/man/p_man/man1"
7938         lookpath="$lookpath $prefixexp/man/u_man/man1"
7939         lookpath="$lookpath $prefixexp/man/man.1"
7940         case "$sysman" in
7941         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7942         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7943         esac
7944         set dflt
7945         eval $prefixup
7946         ;;
7947 *)  dflt="$man1dir"
7948         ;;
7949 esac
7950 echo " "
7951 fn=dn+~
7952 rp="Where do the main $spackage manual pages (source) go?"
7953 . ./getfile
7954 if $test "X$man1direxp" != "X$ansexp"; then
7955         installman1dir=''
7956 fi
7957 man1dir="$ans"
7958 man1direxp="$ansexp"
7959 case "$man1dir" in
7960 '')     man1dir=' '
7961         installman1dir='';;
7962 esac
7963
7964 : Change installation prefix, if necessary.
7965 if $test X"$prefix" != X"$installprefix"; then
7966         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7967 else
7968         installman1dir="$man1direxp"
7969 fi
7970
7971 : What suffix to use on installed man pages
7972
7973 case "$man1dir" in
7974 ' ')
7975         man1ext='0'
7976         ;;
7977 *)
7978         rp="What suffix should be used for the main $spackage man pages?"
7979         case "$man1ext" in
7980         '')     case "$man1dir" in
7981                 *1)  dflt=1 ;;
7982                 *1p) dflt=1p ;;
7983                 *1pm) dflt=1pm ;;
7984                 *l) dflt=l;;
7985                 *n) dflt=n;;
7986                 *o) dflt=o;;
7987                 *p) dflt=p;;
7988                 *C) dflt=C;;
7989                 *L) dflt=L;;
7990                 *L1) dflt=L1;;
7991                 *) dflt=1;;
7992                 esac
7993                 ;;
7994         *)      dflt="$man1ext";;
7995         esac
7996         . ./myread
7997         man1ext="$ans"
7998         ;;
7999 esac
8000
8001 : see if we can have long filenames
8002 echo " "
8003 first=123456789abcdef
8004 $rm -f $first
8005 if (echo hi >$first) 2>/dev/null; then
8006         if $test -f 123456789abcde; then
8007                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8008                 val="$undef"
8009         else
8010                 echo 'You can have filenames longer than 14 characters.'>&4
8011                 val="$define"
8012         fi
8013 else
8014         $cat <<'EOM'
8015 You can't have filenames longer than 14 chars.
8016 You can't even think about them!
8017 EOM
8018         val="$undef"
8019 fi 
8020 set d_flexfnam
8021 eval $setvar
8022 $rm -rf 123456789abcde*
8023
8024 : determine where library module manual pages go
8025 set man3dir man3dir none
8026 eval $prefixit
8027 $cat <<EOM
8028
8029 $spackage has manual pages for many of the library modules.
8030 EOM
8031
8032 case "$nroff" in
8033 nroff)
8034         $cat <<'EOM'
8035 However, you don't have nroff, so they're probably useless to you.
8036 EOM
8037         case "$man3dir" in
8038         '') man3dir="none";;
8039         esac;;
8040 esac
8041
8042 case "$d_flexfnam" in
8043 undef)
8044         $cat <<'EOM'
8045 However, your system can't handle the long file names like File::Basename.3. 
8046 EOM
8047         case "$man3dir" in
8048         '') man3dir="none";;
8049         esac;;
8050 esac
8051
8052 echo "If you don't want the manual sources installed, answer 'none'."
8053 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8054 case "$man3dir" in
8055 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8056         if $test -d "$privlib/man/man3"; then
8057                 cat <<EOM >&4
8058
8059 WARNING:  Previous versions of perl installed man3 pages into
8060 $privlib/man/man3.  This version will suggest a 
8061 new default of $dflt.  
8062 EOM
8063                 tdflt=$dflt
8064                 dflt='n'
8065                 rp='Do you wish to preserve the old behavior?(y/n)'
8066                 . ./myread
8067                 case "$ans" in
8068                 y*) dflt="$privlib/man/man3" ;;
8069                 *)  dflt=$tdflt ;;
8070                 esac
8071     fi
8072         ;;
8073 *)      dflt="$man3dir" ;;
8074 esac
8075 case "$dflt" in
8076 ' ') dflt=none ;;
8077 esac
8078 echo " "
8079 fn=dn+~
8080 rp="Where do the $package library man pages (source) go?"
8081 . ./getfile
8082 man3dir="$ans"
8083 man3direxp="$ansexp"
8084 case "$man3dir" in
8085 '')     man3dir=' '
8086         installman3dir='';;
8087 esac
8088
8089 : Change installation prefix, if necessary.
8090 if $test X"$prefix" != X"$installprefix"; then
8091         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8092 else
8093         installman3dir="$man3direxp"
8094 fi
8095
8096 : What suffix to use on installed man pages
8097 case "$man3dir" in
8098 ' ')
8099         man3ext='0'
8100         ;;
8101 *)
8102         rp="What suffix should be used for the $package library man pages?"
8103         case "$man3ext" in
8104         '')     case "$man3dir" in
8105                 *3)  dflt=3 ;;
8106                 *3p) dflt=3p ;;
8107                 *3pm) dflt=3pm ;;
8108                 *l) dflt=l;;
8109                 *n) dflt=n;;
8110                 *o) dflt=o;;
8111                 *p) dflt=p;;
8112                 *C) dflt=C;;
8113                 *L) dflt=L;;
8114                 *L3) dflt=L3;;
8115                 *) dflt=3;;
8116                 esac
8117                 ;;
8118         *)      dflt="$man3ext";;
8119         esac
8120         . ./myread
8121         man3ext="$ans"
8122         ;;
8123 esac
8124
8125 : see if we have to deal with yellow pages, now NIS.
8126 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8127         if $test -f /usr/etc/nibindd; then
8128                 echo " "
8129                 echo "I'm fairly confident you're on a NeXT."
8130                 echo " "
8131                 rp='Do you get the hosts file via NetInfo?'
8132                 dflt=y
8133                 case "$hostcat" in
8134                 nidump*) ;;
8135                 '') ;;
8136                 *) dflt=n;;
8137                 esac
8138                 . ./myread
8139                 case "$ans" in
8140                 y*) hostcat='nidump hosts .';;
8141                 *)      case "$hostcat" in
8142                         nidump*) hostcat='';;
8143                         esac
8144                         ;;
8145                 esac
8146         fi
8147         case "$hostcat" in
8148         nidump*) ;;
8149         *)
8150                 case "$hostcat" in
8151                 *ypcat*) dflt=y;;
8152                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8153                                 dflt=y
8154                         else
8155                                 dflt=n
8156                         fi;;
8157                 *) dflt=n;;
8158                 esac
8159                 echo " "
8160                 rp='Are you getting the hosts file via yellow pages?'
8161                 . ./myread
8162                 case "$ans" in
8163                 y*) hostcat='ypcat hosts';;
8164                 *) hostcat='cat /etc/hosts';;
8165                 esac
8166                 ;;
8167         esac
8168 fi
8169 case "$hostcat" in
8170 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8171 esac
8172 case "$groupcat" in
8173 '') test -f /etc/group && groupcat='cat /etc/group';;
8174 esac
8175 case "$passcat" in
8176 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8177 esac
8178
8179 : now get the host name
8180 echo " "
8181 echo "Figuring out host name..." >&4
8182 case "$myhostname" in
8183 '') cont=true
8184         echo 'Maybe "hostname" will work...'
8185         if tans=`sh -c hostname 2>&1` ; then
8186                 myhostname=$tans
8187                 phostname=hostname
8188                 cont=''
8189         fi
8190         ;;
8191 *) cont='';;
8192 esac
8193 if $test "$cont"; then
8194         if ./xenix; then
8195                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8196                 if tans=`cat /etc/systemid 2>&1` ; then
8197                         myhostname=$tans
8198                         phostname='cat /etc/systemid'
8199                         echo "Whadyaknow.  Xenix always was a bit strange..."
8200                         cont=''
8201                 fi
8202         elif $test -r /etc/systemid; then
8203                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8204         fi
8205 fi
8206 if $test "$cont"; then
8207         echo 'No, maybe "uuname -l" will work...'
8208         if tans=`sh -c 'uuname -l' 2>&1` ; then
8209                 myhostname=$tans
8210                 phostname='uuname -l'
8211         else
8212                 echo 'Strange.  Maybe "uname -n" will work...'
8213                 if tans=`sh -c 'uname -n' 2>&1` ; then
8214                         myhostname=$tans
8215                         phostname='uname -n'
8216                 else
8217                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8218                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8219                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8220                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8221                         else
8222                                 case "$myhostname" in
8223                                 '') echo "Does this machine have an identity crisis or something?"
8224                                         phostname='';;
8225                                 *)
8226                                         echo "Well, you said $myhostname before..."
8227                                         phostname='echo $myhostname';;
8228                                 esac
8229                         fi
8230                 fi
8231         fi
8232 fi
8233 case "$myhostname" in
8234 '') myhostname=noname ;;
8235 esac
8236 : you do not want to know about this
8237 set $myhostname
8238 myhostname=$1
8239
8240 : verify guess
8241 if $test "$myhostname" ; then
8242         dflt=y
8243         rp='Your host name appears to be "'$myhostname'".'" Right?"
8244         . ./myread
8245         case "$ans" in
8246         y*) ;;
8247         *) myhostname='';;
8248         esac
8249 fi
8250
8251 : bad guess or no guess
8252 while $test "X$myhostname" = X ; do
8253         dflt=''
8254         rp="Please type the (one word) name of your host:"
8255         . ./myread
8256         myhostname="$ans"
8257 done
8258
8259 : translate upper to lower if necessary
8260 case "$myhostname" in
8261 *[A-Z]*)
8262         echo "(Normalizing case in your host name)"
8263         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8264         ;;
8265 esac
8266
8267 case "$myhostname" in
8268 *.*)
8269         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8270         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8271         echo "(Trimming domain name from host name--host name is now $myhostname)"
8272         ;;
8273 *) case "$mydomain" in
8274         '')
8275                 {
8276                         test "X$hostcat" = "Xypcat hosts" &&
8277                         ypmatch "$myhostname" hosts 2>/dev/null |\
8278                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8279                         $test -s hosts
8280                 } || {
8281                         test "X$hostcat" != "X" &&
8282                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8283                                         /[       ]$myhostname[  . ]/p" > hosts
8284                 }
8285                 tmp_re="[       . ]"
8286                 if $test -f hosts; then
8287                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8288                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8289                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8290                                 hosts | $sort | $uniq | \
8291                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8292                         case `$echo X$dflt` in
8293                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8294                                 dflt=.
8295                                 ;;
8296                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8297                                 ;;
8298                         esac
8299                 else
8300                         echo "(I cannot locate a hosts database anywhere)"
8301                         dflt=.
8302                 fi
8303                 case "$dflt" in
8304                 .)
8305                         tans=`./loc resolv.conf X /etc /usr/etc`
8306                         if $test -f "$tans"; then
8307                                 echo "(Attempting domain name extraction from $tans)"
8308                                 dflt=.`$sed -n -e 's/   / /g' \
8309                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8310                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8311                                 case "$dflt" in
8312                                 .) dflt=.`$sed -n -e 's/        / /g' \
8313                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8314                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8315                                         ;;
8316                                 esac
8317                         fi
8318                         ;;
8319                 esac
8320                 case "$dflt" in
8321                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8322                         dflt=.`sh -c domainname 2>/dev/null`
8323                         case "$dflt" in
8324                         '') dflt='.';;
8325                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8326                         esac
8327                         ;;
8328                 esac
8329                 case "$dflt$osname" in
8330                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8331                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8332                         ;;
8333                 esac
8334                 case "$dflt" in
8335                 .) echo "(Lost all hope -- silly guess then)"
8336                         dflt='.nonet'
8337                         ;;
8338                 esac
8339                 $rm -f hosts
8340                 ;;
8341         *) dflt="$mydomain";;
8342         esac;;
8343 esac
8344 echo " "
8345 rp="What is your domain name?"
8346 . ./myread
8347 tans="$ans"
8348 case "$ans" in
8349 '') ;;
8350 .*) ;;
8351 *) tans=".$tans";;
8352 esac
8353 mydomain="$tans"
8354
8355 : translate upper to lower if necessary
8356 case "$mydomain" in
8357 *[A-Z]*)
8358         echo "(Normalizing case in your domain name)"
8359         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8360         ;;
8361 esac
8362
8363 : a little sanity check here
8364 case "$phostname" in
8365 '') ;;
8366 *)
8367         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8368         $myhostname$mydomain|$myhostname) ;;
8369         *)
8370                 case "$phostname" in
8371                 sed*)
8372                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8373                         ;;
8374                 *)
8375                         echo "(That doesn't agree with your $phostname command, by the way.)"
8376                         ;;
8377                 esac
8378         ;;
8379         esac
8380         ;;
8381 esac
8382
8383 $cat <<EOM
8384
8385 I need to get your e-mail address in Internet format if possible, i.e.
8386 something like user@host.domain. Please answer accurately since I have
8387 no easy means to double check it. The default value provided below
8388 is most probably close to reality but may not be valid from outside
8389 your organization...
8390
8391 EOM
8392 cont=x
8393 while test "$cont"; do
8394         case "$cf_email" in
8395         '') dflt="$cf_by@$myhostname$mydomain";;
8396         *) dflt="$cf_email";;
8397         esac
8398         rp='What is your e-mail address?'
8399         . ./myread
8400         cf_email="$ans"
8401         case "$cf_email" in
8402         *@*.*) cont='' ;;
8403         *)
8404                 rp='Address does not look like an Internet one.  Use it anyway?'
8405                 case "$fastread" in
8406                 yes) dflt=y ;;
8407                 *) dflt=n ;;
8408                 esac
8409                 . ./myread
8410                 case "$ans" in
8411                 y*) cont='' ;;
8412                 *) echo " " ;;
8413                 esac
8414                 ;;
8415         esac
8416 done
8417
8418 $cat <<EOM
8419
8420 If you or somebody else will be maintaining perl at your site, please
8421 fill in the correct e-mail address here so that they may be contacted
8422 if necessary. Currently, the "perlbug" program included with perl
8423 will send mail to this address in addition to perlbug@perl.org. You may
8424 enter "none" for no administrator.
8425
8426 EOM
8427 case "$perladmin" in
8428 '') dflt="$cf_email";;
8429 *) dflt="$perladmin";;
8430 esac
8431 rp='Perl administrator e-mail address'
8432 . ./myread
8433 perladmin="$ans"
8434
8435 : determine whether to only install version-specific parts.
8436 echo " "
8437 $cat <<EOM
8438 Do you want to install only the version-specific parts of the perl
8439 distribution?  Usually you do *not* want to do this.
8440 EOM
8441 case "$versiononly" in
8442 "$define"|[Yy]*|true) dflt='y' ;;
8443 *) dflt='n';
8444 esac
8445 rp="Do you want to install only the version-specific parts of perl?"
8446 . ./myread
8447 case "$ans" in
8448 [yY]*)  val="$define";;
8449 *)      val="$undef" ;;
8450 esac
8451 set versiononly
8452 eval $setvar
8453
8454 case "$versiononly" in
8455 "$define") inc_version_list=''
8456            inc_version_list_init=0
8457            ;;
8458 esac
8459
8460 : figure out how to guarantee perl startup
8461 case "$startperl" in
8462 '')
8463         case "$sharpbang" in
8464         *!)
8465                 $cat <<EOH
8466
8467 I can use the #! construct to start perl on your system. This will
8468 make startup of perl scripts faster, but may cause problems if you
8469 want to share those scripts and perl is not in a standard place
8470 ($binexp/perl) on all your platforms. The alternative is to force
8471 a shell by starting the script with a single ':' character.
8472
8473 EOH
8474                 case "$versiononly" in
8475                 "$define")      dflt="$binexp/perl$version";;  
8476                 *)              dflt="$binexp/perl";;
8477                 esac
8478                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8479                 . ./myread
8480                 case "$ans" in
8481                 none)   startperl=": # use perl";;
8482                 *)      startperl="#!$ans"
8483                         if $test 30 -lt `echo "$ans" | wc -c`; then
8484                                 $cat >&4 <<EOM
8485
8486 WARNING:  Some systems limit the #! command to 32 characters.
8487 If you experience difficulty running Perl scripts with #!, try
8488 installing Perl in a directory with a shorter pathname.
8489
8490 EOM
8491                         fi ;;
8492                 esac
8493                 ;;
8494         *) startperl=": # use perl"
8495                 ;;
8496         esac
8497         ;;
8498 esac
8499 echo "I'll use $startperl to start perl scripts."
8500
8501 : figure best path for perl in scripts
8502 case "$perlpath" in
8503 '')
8504         case "$versiononly" in
8505         "$define")      perlpath="$binexp/perl$version";;
8506         *)              perlpath="$binexp/perl";;
8507         esac
8508         case "$startperl" in
8509         *!*) ;;
8510         *)
8511                 $cat <<EOH
8512
8513 I will use the "eval 'exec'" idiom to start Perl on your system.
8514 I can use the full path of your Perl binary for this purpose, but
8515 doing so may cause problems if you want to share those scripts and
8516 Perl is not always in a standard place ($binexp/perl).
8517
8518 EOH
8519                 dflt="$binexp/perl"
8520                 rp="What path shall I use in \"eval 'exec'\"?"
8521                 . ./myread
8522                 perlpath="$ans"
8523                 ;;
8524         esac
8525         ;;
8526 esac
8527 case "$startperl" in
8528 *!*)    ;;
8529 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8530 esac
8531
8532 : determine where public executable scripts go
8533 set scriptdir scriptdir
8534 eval $prefixit
8535 case "$scriptdir" in
8536 '')
8537         dflt="$bin"
8538         : guess some guesses
8539         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8540         $test -d /usr/share/bin     && dflt=/usr/share/bin
8541         $test -d /usr/local/script  && dflt=/usr/local/script
8542         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8543         $test -d $prefixexp/script  && dflt=$prefixexp/script
8544         set dflt
8545         eval $prefixup
8546         ;;
8547 *)  dflt="$scriptdir"
8548         ;;
8549 esac
8550 $cat <<EOM
8551  
8552 Some installations have a separate directory just for executable scripts so
8553 that they can mount it across multiple architectures but keep the scripts in
8554 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8555 Or you might just lump your scripts in with all your other executables.
8556  
8557 EOM
8558 fn=d~
8559 rp='Where do you keep publicly executable scripts?'
8560 . ./getfile
8561 if $test "X$ansexp" != "X$scriptdirexp"; then
8562         installscript=''
8563 fi
8564 scriptdir="$ans"
8565 scriptdirexp="$ansexp"
8566 : Change installation prefix, if necessary.
8567 if $test X"$prefix" != X"$installprefix"; then
8568         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8569 else
8570         installscript="$scriptdirexp"
8571 fi
8572
8573 : determine where add-on public executables go
8574 case "$sitebin" in
8575 '')     dflt=$siteprefix/bin ;;
8576 *)      dflt=$sitebin ;;
8577 esac
8578 fn=d~
8579 rp='Pathname where the add-on public executables should be installed?'
8580 . ./getfile
8581 sitebin="$ans"
8582 sitebinexp="$ansexp"
8583 : Change installation prefix, if necessary.
8584 if $test X"$prefix" != X"$installprefix"; then
8585         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8586 else
8587         installsitebin="$sitebinexp"
8588 fi
8589
8590 : define an is-a-typedef? function
8591 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8592 case "$inclist" in
8593 "") inclist="sys/types.h";;
8594 esac;
8595 eval "varval=\$$var";
8596 case "$varval" in
8597 "")
8598         $rm -f temp.c;
8599         for inc in $inclist; do
8600                 echo "#include <$inc>" >>temp.c;
8601         done;
8602         echo "#ifdef $type" >> temp.c;
8603         echo "printf(\"We have $type\");" >> temp.c;
8604         echo "#endif" >> temp.c;
8605         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8606         if $contains $type temp.E >/dev/null 2>&1; then
8607                 eval "$var=\$type";
8608         else
8609                 eval "$var=\$def";
8610         fi;
8611         $rm -f temp.?;;
8612 *) eval "$var=\$varval";;
8613 esac'
8614
8615 : define an is-a-typedef? function that prompts if the type is not available.
8616 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8617 case "$inclist" in
8618 "") inclist="sys/types.h";;
8619 esac;
8620 eval "varval=\$$var";
8621 case "$varval" in
8622 "")
8623         $rm -f temp.c;
8624         for inc in $inclist; do
8625                 echo "#include <$inc>" >>temp.c;
8626         done;
8627         echo "#ifdef $type" >> temp.c;
8628         echo "printf(\"We have $type\");" >> temp.c;
8629         echo "#endif" >> temp.c;
8630         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8631         echo " " ;
8632         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8633         if $contains $type temp.E >/dev/null 2>&1; then
8634                 echo "$type found." >&4;
8635                 eval "$var=\$type";
8636         else
8637                 echo "$type NOT found." >&4;
8638                 dflt="$def";
8639                 . ./myread ;
8640                 eval "$var=\$ans";
8641         fi;
8642         $rm -f temp.?;;
8643 *) eval "$var=\$varval";;
8644 esac'
8645
8646 : see what type lseek is declared as in the kernel
8647 rp="What is the type used for lseek's offset on this system?"
8648 set off_t lseektype long stdio.h sys/types.h
8649 eval $typedef_ask
8650
8651 echo " "
8652 echo "Checking to see how big your file offsets are..." >&4
8653 $cat >try.c <<EOCP
8654 #include <sys/types.h>
8655 #include <stdio.h>
8656 int main()
8657 {
8658     printf("%d\n", (int)sizeof($lseektype));
8659     return(0); 
8660 }
8661 EOCP
8662 set try
8663 if eval $compile_ok; then
8664         lseeksize=`$run ./try`
8665         echo "Your file offsets are $lseeksize bytes long."
8666 else
8667         dflt=$longsize
8668         echo " "
8669         echo "(I can't seem to compile the test program.  Guessing...)"
8670         rp="What is the size of your file offsets (in bytes)?"
8671         . ./myread
8672         lseeksize="$ans"
8673 fi
8674 $rm -f try.c try
8675
8676 : see what type file positions are declared as in the library
8677 rp="What is the type for file position used by fsetpos()?"
8678 set fpos_t fpostype long stdio.h sys/types.h
8679 eval $typedef_ask
8680
8681 echo " "
8682 case "$fpostype" in
8683 *_t) zzz="$fpostype"    ;;
8684 *)   zzz="fpos_t"       ;;
8685 esac
8686 echo "Checking the size of $zzz..." >&4 
8687 cat > try.c <<EOCP
8688 #include <sys/types.h>
8689 #include <stdio.h>
8690 int main() {
8691     printf("%d\n", (int)sizeof($fpostype));
8692     exit(0);
8693 }
8694 EOCP
8695 set try
8696 if eval $compile_ok; then
8697         yyy=`$run ./try`
8698         case "$yyy" in
8699         '')     fpossize=4
8700                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8701                 ;;
8702         *)      fpossize=$yyy
8703                 echo "Your $zzz is $fpossize bytes long."
8704                 ;;
8705         esac
8706 else
8707         dflt="$longsize"
8708         echo " " >&4
8709         echo "(I can't compile the test program.  Guessing...)" >&4
8710         rp="What is the size of your file positions (in bytes)?"
8711         . ./myread
8712         fpossize="$ans"
8713 fi
8714
8715
8716
8717 # Backward compatibility (uselfs is deprecated).
8718 case "$uselfs" in
8719 "$define"|true|[yY]*)
8720         cat <<EOM >&4
8721
8722 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8723 EOM
8724         uselargefiles="$define"
8725         ;;
8726 esac                          
8727
8728 case "$lseeksize:$fpossize" in
8729 8:8) cat <<EOM
8730
8731 You can have files larger than 2 gigabytes.
8732 EOM
8733    val="$define" ;;
8734 *)    case "$uselargefiles" in
8735    "$undef"|false|[nN]*) dflt='n' ;;
8736    *)   dflt='y' ;;
8737    esac
8738    cat <<EOM
8739
8740 Perl can be built to understand large files (files larger than 2 gigabytes)
8741 on some systems.  To do so, Configure can be run with -Duselargefiles.
8742
8743 If this doesn't make any sense to you, just accept the default '$dflt'.
8744 EOM
8745    rp='Try to understand large files, if available?'
8746    . ./myread
8747    case "$ans" in
8748    y|Y)         val="$define" ;;
8749    *)           val="$undef"  ;;
8750    esac
8751    ;;
8752 esac
8753 set uselargefiles
8754 eval $setvar
8755 case "$uselargefiles" in
8756 "$define")
8757 : Look for a hint-file generated 'call-back-unit'.  If the
8758 : user has specified that a large files perl is to be built,
8759 : we may need to set or change some other defaults.
8760         if $test -f uselargefiles.cbu; then
8761                 echo "Your platform has some specific hints for large file builds, using them..."
8762                 . ./uselargefiles.cbu
8763                 echo " "
8764                 echo "Rechecking to see how big your file offsets are..." >&4
8765                 $cat >try.c <<EOCP
8766 #include <sys/types.h>
8767 #include <stdio.h>
8768 int main()
8769 {
8770     printf("%d\n", (int)sizeof($lseektype));
8771     return(0); 
8772 }
8773 EOCP
8774                 set try
8775                 if eval $compile_ok; then
8776                         lseeksize=`$run ./try`
8777                         $echo "Your file offsets are now $lseeksize bytes long."
8778                 else
8779                         dflt="$lseeksize"
8780                         echo " "
8781                         echo "(I can't seem to compile the test program.  Guessing...)"
8782                         rp="What is the size of your file offsets (in bytes)?"
8783                         . ./myread
8784                         lseeksize="$ans"
8785                 fi
8786                 case "$fpostype" in
8787                 *_t) zzz="$fpostype"    ;;
8788                 *)   zzz="fpos_t"       ;;
8789                 esac
8790                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8791                 $cat > try.c <<EOCP
8792 #include <sys/types.h>
8793 #include <stdio.h>
8794 int main() {
8795     printf("%d\n", (int)sizeof($fpostype));
8796     exit(0);
8797 }
8798 EOCP
8799                 set try
8800                 if eval $compile_ok; then
8801                         yyy=`$run ./try`
8802                         dflt="$lseeksize"
8803                         case "$yyy" in
8804                         '')     echo " "
8805                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8806                                 ;;
8807                         *)      fpossize=$yyy
8808                                 echo " $fpossize bytes." >&4
8809                                 ;;
8810                         esac
8811                 else
8812                         dflt="$fpossize"
8813                         echo " "
8814                         echo "(I can't compile the test program.  Guessing...)" >&4
8815                         rp="What is the size of your file positions (in bytes)?"
8816                         . ./myread
8817                         fpossize="$ans"
8818                 fi
8819                 $rm -f try.c try
8820         fi
8821         ;;
8822 esac
8823
8824 case "$vendorprefix" in
8825 '')     d_vendorbin="$undef"
8826         vendorbin=''
8827         vendorbinexp=''
8828         ;;
8829 *)      d_vendorbin="$define"
8830         : determine where vendor-supplied executables go.
8831         case "$vendorbin" in
8832         '') dflt=$vendorprefix/bin ;;
8833         *)      dflt="$vendorbin" ;;
8834         esac
8835         fn=d~+
8836         rp='Pathname for the vendor-supplied executables directory?'
8837         . ./getfile
8838         vendorbin="$ans"
8839         vendorbinexp="$ansexp"
8840         ;;
8841 esac
8842 : Change installation prefix, if necessary.
8843 if $test X"$prefix" != X"$installprefix"; then
8844         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8845 else
8846         installvendorbin="$vendorbinexp"
8847 fi
8848
8849 : see if qgcvt exists
8850 set qgcvt d_qgcvt
8851 eval $inlibc
8852
8853 : Check how to convert floats to strings.
8854
8855 if test "X$d_Gconvert" = X; then
8856
8857 echo " "
8858 echo "Checking for an efficient way to convert floats to strings."
8859 echo " " > try.c
8860 case "$uselongdouble" in
8861 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8862 esac
8863 case "$d_longdbl" in
8864 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8865 esac
8866 case "$d_PRIgldbl" in
8867 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8868 esac
8869 $cat >>try.c <<EOP
8870 #ifdef TRY_gconvert
8871 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8872 char *myname = "gconvert";
8873 #endif
8874 #ifdef TRY_gcvt
8875 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8876 char *myname = "gcvt";
8877 #endif
8878 #ifdef TRY_qgcvt
8879 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8880 char *myname = "qgcvt";
8881 #define DOUBLETYPE long double
8882 #endif
8883 #ifdef TRY_sprintf
8884 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8885 #ifdef HAS_PRIgldbl
8886 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8887 #else
8888 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8889 #endif
8890 #else
8891 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8892 #endif
8893 char *myname = "sprintf";
8894 #endif
8895
8896 #ifndef DOUBLETYPE
8897 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8898 #define DOUBLETYPE long double
8899 #else
8900 #define DOUBLETYPE double
8901 #endif
8902 #endif
8903
8904 #include <stdio.h>
8905
8906 #define I_STDLIB $i_stdlib
8907 #ifdef I_STDLIB
8908 #include <stdlib.h>
8909 #endif
8910
8911 int
8912 checkit(expect, got)
8913 char *expect;
8914 char *got;
8915 {
8916     if (strcmp(expect, got)) {
8917                 printf("%s oddity:  Expected %s, got %s\n",
8918                         myname, expect, got);
8919                 exit(1);
8920         }
8921 }
8922
8923 int main()
8924
8925         char buf[64]; 
8926         buf[63] = '\0';
8927
8928         /* This must be 1st test on (which?) platform */
8929         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8930         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8931         checkit("0.1", buf);
8932
8933         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8934         checkit("0.01", buf);
8935
8936         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8937         checkit("0.001", buf);
8938
8939         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8940         checkit("0.0001", buf);
8941
8942         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8943         if (strlen(buf) > 5)
8944             checkit("9e-005", buf); /* for Microsoft ?? */
8945         else
8946             checkit("9e-05", buf);
8947
8948         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8949         checkit("1", buf);
8950
8951         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8952         checkit("1.1", buf);
8953
8954         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8955         checkit("1.01", buf);
8956
8957         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8958         checkit("1.001", buf);
8959
8960         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8961         checkit("1.0001", buf);
8962
8963         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8964         checkit("1.00001", buf);
8965
8966         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8967         checkit("1.000001", buf);
8968
8969         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8970         checkit("0", buf);
8971
8972         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8973         checkit("-1", buf);
8974
8975         /* Some Linux gcvt's give 1.e+5 here. */
8976         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8977         checkit("100000", buf);
8978         
8979         /* Some Linux gcvt's give -1.e+5 here. */
8980         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8981         checkit("-100000", buf);
8982
8983         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8984         checkit("123.456", buf);
8985
8986         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8987         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8988         /* 34 should be enough to scare even long double
8989          * places into using the e notation. */
8990         if (strlen(buf) > 5)
8991             checkit("1e+034", buf); /* for Microsoft */
8992         else
8993             checkit("1e+34", buf);
8994
8995         /* For Perl, if you add additional tests here, also add them to
8996          * t/base/num.t for benefit of platforms not using Configure or
8997          * overriding d_Gconvert */
8998
8999         exit(0);
9000 }
9001 EOP
9002 : first add preferred functions to our list
9003 xxx_list=""
9004 for xxx_convert in $gconvert_preference; do
9005     case $xxx_convert in
9006     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9007     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9008     esac 
9009 done
9010 : then add any others
9011 for xxx_convert in gconvert gcvt sprintf; do
9012     case "$xxx_list" in
9013     *$xxx_convert*) ;;
9014     *) xxx_list="$xxx_list $xxx_convert" ;;
9015     esac 
9016 done
9017
9018 case "$d_longdbl$uselongdouble" in
9019 "$define$define")
9020     : again, add prefered functions to our list first
9021     xxx_ld_list=""
9022     for xxx_convert in $gconvert_ld_preference; do
9023         case $xxx_convert in
9024         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9025         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9026         esac
9027     done
9028     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9029     for xxx_convert in qgcvt sprintf $xxx_list; do
9030         case "$xxx_ld_list" in
9031         $xxx_convert*|*" $xxx_convert"*) ;;
9032         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9033         esac
9034     done
9035     : if sprintf cannot do long doubles, move it to the end
9036     if test "$d_PRIgldbl" != "$define"; then
9037         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9038     fi
9039     : if no qgcvt, remove it
9040     if test "$d_qgcvt" != "$define"; then
9041         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9042     fi
9043     : use the ld_list
9044     xxx_list="$xxx_ld_list"
9045     ;;
9046 esac
9047
9048 for xxx_convert in $xxx_list; do
9049         echo "Trying $xxx_convert..."
9050         $rm -f try try$_o
9051         set try -DTRY_$xxx_convert
9052         if eval $compile; then
9053                 echo "$xxx_convert() found." >&4
9054                 if $run ./try; then
9055                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9056                         break;
9057                 else
9058                         echo "...But $xxx_convert didn't work as I expected."
9059                         xxx_convert=''
9060                 fi
9061         else
9062                 echo "$xxx_convert NOT found." >&4
9063         fi
9064 done
9065
9066 if test X$xxx_convert = X; then
9067     echo "*** WHOA THERE!!! ***" >&4
9068     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9069     xxx_convert=sprintf
9070 fi
9071
9072 case "$xxx_convert" in
9073 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9074 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9075 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9076 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9077    "$define$define$define")
9078       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9079    "$define$define$undef")
9080       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9081    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9082    esac
9083    ;;  
9084 esac
9085
9086 fi
9087
9088 : see if _fwalk exists
9089 set fwalk d__fwalk
9090 eval $inlibc
9091
9092 : Initialize h_fcntl
9093 h_fcntl=false
9094
9095 : Initialize h_sysfile
9096 h_sysfile=false
9097
9098 : access call always available on UNIX
9099 set access d_access
9100 eval $inlibc
9101
9102 : locate the flags for 'access()'
9103 case "$d_access" in
9104 "$define")
9105         echo " "
9106         $cat >access.c <<'EOCP'
9107 #include <sys/types.h>
9108 #ifdef I_FCNTL
9109 #include <fcntl.h>
9110 #endif
9111 #ifdef I_SYS_FILE
9112 #include <sys/file.h>
9113 #endif
9114 #ifdef I_UNISTD
9115 #include <unistd.h>
9116 #endif
9117 int main() {
9118         exit(R_OK);
9119 }
9120 EOCP
9121         : check sys/file.h first, no particular reason here
9122         if $test `./findhdr sys/file.h` && \
9123                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9124                 h_sysfile=true;
9125                 echo "<sys/file.h> defines the *_OK access constants." >&4
9126         elif $test `./findhdr fcntl.h` && \
9127                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9128                 h_fcntl=true;
9129                 echo "<fcntl.h> defines the *_OK access constants." >&4
9130         elif $test `./findhdr unistd.h` && \
9131                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9132                 echo "<unistd.h> defines the *_OK access constants." >&4
9133         else
9134                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9135         fi
9136         ;;
9137 esac
9138 $rm -f access*
9139
9140 : see if accessx exists
9141 set accessx d_accessx
9142 eval $inlibc
9143
9144 : see if alarm exists
9145 set alarm d_alarm
9146 eval $inlibc
9147
9148 : see if POSIX threads are available
9149 set pthread.h i_pthread
9150 eval $inhdr
9151
9152 : define a fucntion to check prototypes
9153 $cat > protochk <<EOSH
9154 $startsh
9155 cc="$cc"
9156 optimize="$optimize"
9157 ccflags="$ccflags"
9158 prototype="$prototype"
9159 define="$define"
9160 rm=$rm
9161 usethreads=$usethreads
9162 i_pthread=$i_pthread
9163 pthread_h_first=$pthread_h_first
9164 EOSH
9165
9166 $cat >> protochk <<'EOSH'
9167
9168 $rm -f try.c
9169 foo="$1"
9170 shift
9171 while test $# -ge 2; do
9172         case "$1" in
9173                 $define) echo "#include <$2>" >> try.c ;;
9174                 literal) echo "$2" >> try.c ;;
9175         esac
9176     # Extra magic for the benefit of systems that need pthread.h
9177     # to be included early to correctly detect threadsafe functions.
9178     # Such functions must guarantee themselves, though, that the usethreads
9179     # and i_pthread have been defined, before calling protochk.
9180     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9181         echo "#include <pthread.h>" >> try.c
9182         pthread_h_done=yes
9183     fi
9184     shift 2
9185 done
9186 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9187 cat >> try.c <<'EOCP'
9188 #ifdef CAN_PROTOTYPE
9189 #define _(args) args
9190 #else
9191 #define _(args) ()
9192 #endif
9193 EOCP
9194 echo "$foo" >> try.c
9195 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9196 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9197 status=$?
9198 $rm -f try.[co]
9199 exit $status
9200 EOSH
9201 chmod +x protochk
9202 $eunicefix protochk
9203
9204 : see if sys/types.h has to be included
9205 set sys/types.h i_systypes
9206 eval $inhdr
9207
9208 : see if sys/select.h has to be included
9209 set sys/select.h i_sysselct
9210 eval $inhdr
9211
9212 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9213 while $test $# -ge 2; do
9214         case "$1" in
9215         $define) echo "#include <$2>";;
9216         esac ;
9217     shift 2;
9218 done > try.c;
9219 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9220 set try;
9221 if eval $compile; then
9222         val="$define";
9223 else
9224         val="$undef";
9225 fi;
9226 set $varname;
9227 eval $setvar;
9228 $rm -f try.c try.o'
9229
9230 : see if we should include time.h, sys/time.h, or both
9231 echo " "
9232 if test "X$timeincl" = X; then
9233         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9234         $echo $n "I'm now running the test program...$c"
9235         $cat >try.c <<'EOCP'
9236 #include <sys/types.h>
9237 #ifdef I_TIME
9238 #include <time.h>
9239 #endif
9240 #ifdef I_SYSTIME
9241 #ifdef SYSTIMEKERNEL
9242 #define KERNEL
9243 #endif
9244 #include <sys/time.h>
9245 #endif
9246 #ifdef I_SYSSELECT
9247 #include <sys/select.h>
9248 #endif
9249 int main()
9250 {
9251         struct tm foo;
9252 #ifdef S_TIMEVAL
9253         struct timeval bar;
9254 #endif
9255 #ifdef S_TIMEZONE
9256         struct timezone tzp;
9257 #endif
9258         if (foo.tm_sec == foo.tm_sec)
9259                 exit(0);
9260 #ifdef S_TIMEVAL
9261         if (bar.tv_sec == bar.tv_sec)
9262                 exit(0);
9263 #endif
9264         exit(1);
9265 }
9266 EOCP
9267         flags=''
9268         for s_timezone in '-DS_TIMEZONE' ''; do
9269         sysselect=''
9270         for s_timeval in '-DS_TIMEVAL' ''; do
9271         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9272         for i_time in '' '-DI_TIME'; do
9273         for i_systime in '-DI_SYSTIME' ''; do
9274                 case "$flags" in
9275                 '') $echo $n ".$c"
9276                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9277                         if eval $compile; then
9278                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9279                                 shift
9280                                 flags="$*"
9281                                 echo " "
9282                                 $echo $n "Succeeded with $flags$c"
9283                         fi
9284                         ;;
9285                 esac
9286         done
9287         done
9288         done
9289         done
9290         done
9291         timeincl=''
9292         echo " "
9293         case "$flags" in
9294         *SYSTIMEKERNEL*) i_systimek="$define"
9295                 timeincl=`./findhdr sys/time.h`
9296                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9297         *) i_systimek="$undef";;
9298         esac
9299         case "$flags" in
9300         *I_TIME*) i_time="$define"
9301                 timeincl=`./findhdr time.h`" $timeincl"
9302                 echo "We'll include <time.h>." >&4;;
9303         *) i_time="$undef";;
9304         esac
9305         case "$flags" in
9306         *I_SYSTIME*) i_systime="$define"
9307                 timeincl=`./findhdr sys/time.h`" $timeincl"
9308                 echo "We'll include <sys/time.h>." >&4;;
9309         *) i_systime="$undef";;
9310         esac
9311         $rm -f try.c try
9312 fi
9313 : see if struct tm knows about tm_zone
9314 case "$i_systime$i_time" in
9315 *$define*) 
9316         echo " "
9317         echo "Checking to see if your struct tm has tm_zone field..." >&4
9318         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9319         eval $hasfield
9320         ;;
9321 *)      val="$undef"
9322         set d_tm_tm_zone
9323         eval $setvar
9324         ;;
9325 esac
9326 case "$d_tm_tm_zone" in
9327 "$define")      echo "Yes, it does."   ;;
9328 *)              echo "No, it doesn't." ;;
9329 esac
9330 : see if struct tm knows about tm_gmtoff
9331 case "$i_systime$i_time" in
9332 *$define*) 
9333         echo " "
9334         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9335         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9336         eval $hasfield
9337         ;;
9338 *)      val="$undef"
9339         set d_tm_tm_gmtoff
9340         eval $setvar
9341         ;;
9342 esac
9343 case "$d_tm_tm_gmtoff" in
9344 "$define")      echo "Yes, it does."   ;;
9345 *)              echo "No, it doesn't." ;;
9346 esac
9347
9348 : see if asctime_r exists
9349 set asctime_r d_asctime_r
9350 eval $inlibc
9351 case "$d_asctime_r" in
9352 "$define")
9353         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9354         case "$d_asctime_r_proto:$usethreads" in
9355         ":define")      d_asctime_r_proto=define
9356                 set d_asctime_r_proto asctime_r $hdrs
9357                 eval $hasproto ;;
9358         *)      ;;
9359         esac
9360         case "$d_asctime_r_proto" in
9361         define)
9362         case "$asctime_r_proto" in
9363         ''|0) try='char* asctime_r(const struct tm*, char*);'
9364         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9365         esac
9366         case "$asctime_r_proto" in
9367         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9368         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9369         esac
9370         case "$asctime_r_proto" in
9371         ''|0) try='int asctime_r(const struct tm*, char*);'
9372         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9373         esac
9374         case "$asctime_r_proto" in
9375         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9376         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9377         esac
9378         case "$asctime_r_proto" in
9379         ''|0)   d_asctime_r=undef
9380                 asctime_r_proto=0
9381                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9382         * )     case "$asctime_r_proto" in
9383                 REENTRANT_PROTO*) ;;
9384                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9385                 esac
9386                 echo "Prototype: $try" ;;
9387         esac
9388         ;;
9389         *)      case "$usethreads" in
9390                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9391                 esac
9392                 d_asctime_r=undef
9393                 asctime_r_proto=0
9394                 ;;
9395         esac
9396         ;;
9397 *)      asctime_r_proto=0
9398         ;;
9399 esac
9400
9401 : see if atolf exists
9402 set atolf d_atolf
9403 eval $inlibc
9404
9405 : see if atoll exists
9406 set atoll d_atoll
9407 eval $inlibc
9408
9409 : Look for GNU-cc style attribute checking
9410 echo " "
9411 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9412 $cat >attrib.c <<'EOCP'
9413 #include <stdio.h>
9414 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9415 EOCP
9416 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9417         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9418                 echo "Your C compiler doesn't fully support __attribute__."
9419                 val="$undef"
9420         else
9421                 echo "Your C compiler supports __attribute__."
9422                 val="$define"
9423         fi
9424 else
9425         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9426         val="$undef"
9427 fi
9428 set d_attribut
9429 eval $setvar
9430 $rm -f attrib*
9431
9432 : see if bcmp exists
9433 set bcmp d_bcmp
9434 eval $inlibc
9435
9436 : see if bcopy exists
9437 set bcopy d_bcopy
9438 eval $inlibc
9439
9440 : see if this is a unistd.h system
9441 set unistd.h i_unistd
9442 eval $inhdr
9443
9444 : see if getpgrp exists
9445 set getpgrp d_getpgrp
9446 eval $inlibc
9447
9448 case "$d_getpgrp" in
9449 "$define")
9450         echo " "
9451         echo "Checking to see which flavor of getpgrp is in use..."
9452         $cat >try.c <<EOP
9453 #$i_unistd I_UNISTD
9454 #include <sys/types.h>
9455 #ifdef I_UNISTD
9456 #  include <unistd.h>
9457 #endif
9458 int main()
9459 {
9460         if (getuid() == 0) {
9461                 printf("(I see you are running Configure as super-user...)\n");
9462                 setuid(1);
9463         }
9464 #ifdef TRY_BSD_PGRP
9465         if (getpgrp(1) == 0)
9466                 exit(0);
9467 #else
9468         if (getpgrp() > 0)
9469                 exit(0);
9470 #endif
9471         exit(1);
9472 }
9473 EOP
9474         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9475                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9476                 val="$define"
9477         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9478                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9479                 val="$undef"
9480         else
9481                 echo "I can't seem to compile and run the test program."
9482                 if ./usg; then
9483                         xxx="a USG one, i.e. you use getpgrp()."
9484                 else
9485                         # SVR4 systems can appear rather BSD-ish.
9486                         case "$i_unistd" in
9487                         $undef)
9488                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9489                                 val="$define"
9490                                 ;;
9491                         $define)
9492                                 xxx="probably a USG one, i.e. you use getpgrp()."
9493                                 val="$undef"
9494                                 ;;
9495                         esac
9496                 fi
9497                 echo "Assuming your getpgrp is $xxx" >&4
9498         fi
9499         ;;
9500 *) val="$undef";;
9501 esac
9502 set d_bsdgetpgrp
9503 eval $setvar
9504 $rm -f try try.*
9505
9506 : see if setpgrp exists
9507 set setpgrp d_setpgrp
9508 eval $inlibc
9509
9510 case "$d_setpgrp" in
9511 "$define")
9512         echo " "
9513         echo "Checking to see which flavor of setpgrp is in use..."
9514         $cat >try.c <<EOP
9515 #$i_unistd I_UNISTD
9516 #include <sys/types.h>
9517 #ifdef I_UNISTD
9518 #  include <unistd.h>
9519 #endif
9520 int main()
9521 {
9522         if (getuid() == 0) {
9523                 printf("(I see you are running Configure as super-user...)\n");
9524                 setuid(1);
9525         }
9526 #ifdef TRY_BSD_PGRP
9527         if (-1 == setpgrp(1, 1))
9528                 exit(0);
9529 #else
9530         if (setpgrp() != -1)
9531                 exit(0);
9532 #endif
9533         exit(1);
9534 }
9535 EOP
9536         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9537                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9538                 val="$define"
9539         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9540                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9541                 val="$undef"
9542         else
9543                 echo "(I can't seem to compile and run the test program.)"
9544                 if ./usg; then
9545                         xxx="a USG one, i.e. you use setpgrp()."
9546                 else
9547                         # SVR4 systems can appear rather BSD-ish.
9548                         case "$i_unistd" in
9549                         $undef)
9550                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9551                                 val="$define"
9552                                 ;;
9553                         $define)
9554                                 xxx="probably a USG one, i.e. you use setpgrp()."
9555                                 val="$undef"
9556                                 ;;
9557                         esac
9558                 fi
9559                 echo "Assuming your setpgrp is $xxx" >&4
9560         fi
9561         ;;
9562 *) val="$undef";;
9563 esac
9564 set d_bsdsetpgrp
9565 eval $setvar
9566 $rm -f try try.*
9567 : see if bzero exists
9568 set bzero d_bzero
9569 eval $inlibc
9570
9571 : see if signal is declared as pointer to function returning int or void
9572 echo " "
9573 xxx=`./findhdr signal.h`
9574 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9575 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9576         echo "You have int (*signal())() instead of void." >&4
9577         val="$undef"
9578 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9579         echo "You have void (*signal())()." >&4
9580         val="$define"
9581 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9582         echo "You have int (*signal())() instead of void." >&4
9583         val="$undef"
9584 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9585         echo "You have void (*signal())()." >&4
9586         val="$define"
9587 else
9588         case "$d_voidsig" in
9589         '')
9590         echo "I can't determine whether signal handler returns void or int..." >&4
9591                 dflt=void
9592                 rp="What type does your signal handler return?"
9593                 . ./myread
9594                 case "$ans" in
9595                 v*) val="$define";;
9596                 *) val="$undef";;
9597                 esac;;
9598         "$define")
9599                 echo "As you already told me, signal handler returns void." >&4
9600                 val="$define"
9601                 ;;
9602         *)      echo "As you already told me, signal handler returns int." >&4
9603                 val="$undef"
9604                 ;;
9605         esac
9606 fi
9607 set d_voidsig
9608 eval $setvar
9609 case "$d_voidsig" in
9610 "$define") signal_t="void";;
9611 *) signal_t="int";;
9612 esac
9613 $rm -f $$.tmp
9614
9615 : check for ability to cast large floats to 32-bit ints.
9616 echo " "
9617 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9618 if $test "$intsize" -ge 4; then
9619         xxx=int
9620 else
9621         xxx=long
9622 fi
9623 $cat >try.c <<EOCP
9624 #include <stdio.h>
9625 #include <sys/types.h>
9626 #include <signal.h>
9627 $signal_t blech(s) int s; { exit(3); }
9628 int main()
9629 {
9630         $xxx i32;
9631         double f, g;
9632         int result = 0;
9633         char str[16];
9634         signal(SIGFPE, blech);
9635
9636         /* Don't let compiler optimize the test away.  Store the number 
9637            in a writable string for gcc to pass to sscanf under HP/UX.
9638         */
9639         sprintf(str, "2147483647");
9640         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9641         g = 10 * f;
9642         i32  = ($xxx) g;
9643
9644         /* x86 processors will probably give 0x8000 0000, which is a
9645        sign change.  We don't want that.  We want to mimic SPARC
9646            behavior here, which is to preserve the sign and give
9647            back 0x7fff ffff.
9648         */
9649         if (i32 != ($xxx) f)
9650                 result |= 1;
9651         exit(result);
9652 }
9653 EOCP
9654 set try
9655 if eval $compile_ok; then
9656         $run ./try
9657         yyy=$?
9658 else
9659         echo "(I can't seem to compile the test program--assuming it can't)"
9660         yyy=1
9661 fi
9662 case "$yyy" in
9663 0)      val="$define"
9664         echo "Yup, it can."
9665         ;;
9666 *)      val="$undef"
9667         echo "Nope, it can't."
9668         ;;
9669 esac
9670 set d_casti32
9671 eval $setvar
9672 $rm -f try try.*
9673
9674 : check for ability to cast negative floats to unsigned
9675 echo " "
9676 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9677 $cat >try.c <<EOCP
9678 #include <stdio.h>
9679 #include <sys/types.h>
9680 #include <signal.h>
9681 $signal_t blech(s) int s; { exit(7); }
9682 $signal_t blech_in_list(s) int s; { exit(4); }
9683 unsigned long dummy_long(p) unsigned long p; { return p; }
9684 unsigned int dummy_int(p) unsigned int p; { return p; }
9685 unsigned short dummy_short(p) unsigned short p; { return p; }
9686 int main()
9687 {
9688         double f;
9689         unsigned long along;
9690         unsigned int aint;
9691         unsigned short ashort;
9692         int result = 0;
9693         char str[16];
9694         
9695         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9696            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9697            optimized the whole file away
9698         */
9699         /* Store the number in a writable string for gcc to pass to 
9700            sscanf under HP/UX.
9701         */
9702         sprintf(str, "-123");
9703         sscanf(str, "%lf", &f);  /* f = -123.; */
9704
9705         signal(SIGFPE, blech);
9706         along = (unsigned long)f;
9707         aint = (unsigned int)f;
9708         ashort = (unsigned short)f;
9709         if (along != (unsigned long)-123)
9710                 result |= 1;
9711         if (aint != (unsigned int)-123)
9712                 result |= 1;
9713         if (ashort != (unsigned short)-123)
9714                 result |= 1;
9715         sprintf(str, "1073741824.");
9716         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9717         f = f + f;
9718         along = 0;
9719         along = (unsigned long)f;
9720         if (along != 0x80000000)
9721                 result |= 2;
9722         f -= 1.;
9723         along = 0;
9724         along = (unsigned long)f;
9725         if (along != 0x7fffffff)
9726                 result |= 1;
9727         f += 2.;
9728         along = 0;
9729         along = (unsigned long)f;
9730         if (along != 0x80000001)
9731                 result |= 2;
9732         if (result)
9733                 exit(result);
9734         signal(SIGFPE, blech_in_list);
9735         sprintf(str, "123.");
9736         sscanf(str, "%lf", &f);  /* f = 123.; */
9737         along = dummy_long((unsigned long)f);
9738         aint = dummy_int((unsigned int)f);
9739         ashort = dummy_short((unsigned short)f);
9740         if (along != (unsigned long)123)
9741                 result |= 4;
9742         if (aint != (unsigned int)123)
9743                 result |= 4;
9744         if (ashort != (unsigned short)123)
9745                 result |= 4;
9746         exit(result);
9747
9748 }
9749 EOCP
9750 set try
9751 if eval $compile_ok; then
9752         $run ./try
9753         castflags=$?
9754 else
9755         echo "(I can't seem to compile the test program--assuming it can't)"
9756         castflags=7
9757 fi
9758 case "$castflags" in
9759 0)      val="$define"
9760         echo "Yup, it can."
9761         ;;
9762 *)      val="$undef"
9763         echo "Nope, it can't."
9764         ;;
9765 esac
9766 set d_castneg
9767 eval $setvar
9768 $rm -f try.*
9769
9770 : see if vprintf exists
9771 echo " "
9772 if set vprintf val -f d_vprintf; eval $csym; $val; then
9773         echo 'vprintf() found.' >&4
9774         val="$define"
9775         $cat >try.c <<'EOF'
9776 #include <varargs.h>
9777
9778 int main() { xxx("foo"); }
9779
9780 xxx(va_alist)
9781 va_dcl
9782 {
9783         va_list args;
9784         char buf[10];
9785
9786         va_start(args);
9787         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9788 }
9789 EOF
9790         set try
9791         if eval $compile && $run ./try; then
9792                 echo "Your vsprintf() returns (int)." >&4
9793                 val2="$undef"
9794         else
9795                 echo "Your vsprintf() returns (char*)." >&4
9796                 val2="$define"
9797         fi
9798 else
9799         echo 'vprintf() NOT found.' >&4
9800                 val="$undef"
9801                 val2="$undef"
9802 fi
9803 $rm -f try try.*
9804 set d_vprintf
9805 eval $setvar
9806 val=$val2
9807 set d_charvspr
9808 eval $setvar
9809
9810 : see if chown exists
9811 set chown d_chown
9812 eval $inlibc
9813
9814 : see if chroot exists
9815 set chroot d_chroot
9816 eval $inlibc
9817
9818 : see if chsize exists
9819 set chsize d_chsize
9820 eval $inlibc
9821
9822 : see if class exists
9823 set class d_class
9824 eval $inlibc
9825
9826 hasstruct='varname=$1; struct=$2; shift; shift;
9827 while $test $# -ge 2; do
9828         case "$1" in
9829         $define) echo "#include <$2>";;
9830         esac ;
9831     shift 2;
9832 done > try.c;
9833 echo "int main () { struct $struct foo; }" >> try.c;
9834 set try;
9835 if eval $compile; then
9836         val="$define";
9837 else
9838         val="$undef";
9839 fi;
9840 set $varname;
9841 eval $setvar;
9842 $rm -f try.c try.o'
9843
9844 socketlib=''
9845 sockethdr=''
9846 : see whether socket exists
9847 echo " "
9848 $echo $n "Hmm... $c" >&4
9849 if set socket val -f d_socket; eval $csym; $val; then
9850         echo "Looks like you have Berkeley networking support." >&4
9851         d_socket="$define"
9852         if set setsockopt val -f; eval $csym; $val; then
9853                 d_oldsock="$undef"
9854         else
9855                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9856                 d_oldsock="$define"
9857         fi
9858 else
9859         if $contains socklib libc.list >/dev/null 2>&1; then
9860                 echo "Looks like you have Berkeley networking support." >&4
9861                 d_socket="$define"
9862                 : we will have to assume that it supports the 4.2 BSD interface
9863                 d_oldsock="$undef"
9864         else
9865                 echo "You don't have Berkeley networking in libc$_a..." >&4
9866                 if test "X$d_socket" = "X$define"; then
9867                    echo "...but you seem to believe that you have sockets." >&4
9868                 else
9869                         for net in net socket
9870                         do
9871                                 if test -f /usr/lib/lib$net$_a; then
9872                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9873                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9874                                         if $contains socket libc.list >/dev/null 2>&1; then
9875                                                 d_socket="$define"
9876                                                 socketlib="-l$net"
9877                                                 case "$net" in
9878                                                 net)
9879                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9880                                                         sockethdr="-I/usr/netinclude"
9881                                                         ;;
9882                                                 esac
9883                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9884                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9885                                                         d_oldsock="$undef"
9886                                                 else
9887                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9888                                                         d_oldsock="$define"
9889                                                 fi
9890                                                 break
9891                                         fi
9892                                 fi
9893                         done
9894                         if test "X$d_socket" != "X$define"; then
9895                            echo "or anywhere else I see." >&4
9896                            d_socket="$undef"
9897                            d_oldsock="$undef"
9898                         fi
9899                 fi
9900         fi
9901 fi
9902
9903 : see if socketpair exists
9904 set socketpair d_sockpair
9905 eval $inlibc
9906
9907
9908 echo " "
9909 echo "Checking the availability of certain socket constants..." >&4
9910 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9911         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9912         $cat >try.c <<EOF
9913 #include <sys/types.h>
9914 #include <sys/socket.h>
9915 int main() {
9916     int i = $ENUM;
9917 }
9918 EOF
9919         val="$undef"
9920         set try; if eval $compile; then
9921                 val="$define"
9922         fi
9923         set d_${enum}; eval $setvar
9924         $rm -f try.c try
9925 done
9926
9927 : see if this is a sys/uio.h system
9928 set sys/uio.h i_sysuio
9929 eval $inhdr
9930
9931
9932 echo " "
9933 echo "Checking to see if your system supports struct cmsghdr..." >&4
9934 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9935 eval $hasstruct
9936 case "$d_cmsghdr_s" in
9937 "$define")      echo "Yes, it does."   ;;
9938 *)              echo "No, it doesn't." ;;
9939 esac
9940
9941
9942 : check for const keyword
9943 echo " "
9944 echo 'Checking to see if your C compiler knows about "const"...' >&4
9945 $cat >const.c <<'EOCP'
9946 typedef struct spug { int drokk; } spug;
9947 main()
9948 {
9949         const char *foo;
9950         const spug y;
9951 }
9952 EOCP
9953 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9954         val="$define"
9955         echo "Yup, it does."
9956 else
9957         val="$undef"
9958         echo "Nope, it doesn't."
9959 fi
9960 set d_const
9961 eval $setvar
9962
9963 : see if crypt exists
9964 echo " "
9965 set crypt d_crypt
9966 eval $inlibc
9967 case "$d_crypt" in
9968 $define) cryptlib='' ;;
9969 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9970                 echo 'crypt() found.' >&4
9971                 val="$define"
9972                 cryptlib=''
9973         else
9974                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9975                 if $test -z "$cryptlib"; then
9976                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9977                 else
9978                         cryptlib=-lcrypt
9979                 fi
9980                 if $test -z "$cryptlib"; then
9981                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9982                 else
9983                         cryptlib=-lcrypt
9984                 fi
9985                 if $test -z "$cryptlib"; then
9986                         cryptlib=`./loc libcrypt$_a "" $libpth`
9987                 else
9988                         cryptlib=-lcrypt
9989                 fi
9990                 if $test -z "$cryptlib"; then
9991                         echo 'crypt() NOT found.' >&4
9992                         val="$undef"
9993                 else
9994                         val="$define"
9995                 fi
9996         fi
9997         set d_crypt
9998         eval $setvar
9999         ;;
10000 esac
10001
10002 : see if this is a crypt.h system
10003 set crypt.h i_crypt
10004 eval $inhdr
10005
10006 : see if crypt_r exists
10007 set crypt_r d_crypt_r
10008 eval $inlibc
10009 case "$d_crypt_r" in
10010 "$define")
10011         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10012         case "$d_crypt_r_proto:$usethreads" in
10013         ":define")      d_crypt_r_proto=define
10014                 set d_crypt_r_proto crypt_r $hdrs
10015                 eval $hasproto ;;
10016         *)      ;;
10017         esac
10018         case "$d_crypt_r_proto" in
10019         define)
10020         case "$crypt_r_proto" in
10021         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10022         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10023         esac
10024         case "$crypt_r_proto" in
10025         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10026         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10027         esac
10028         case "$crypt_r_proto" in
10029         ''|0)   d_crypt_r=undef
10030                 crypt_r_proto=0
10031                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10032         * )     case "$crypt_r_proto" in
10033                 REENTRANT_PROTO*) ;;
10034                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10035                 esac
10036                 echo "Prototype: $try" ;;
10037         esac
10038         ;;
10039         *)      case "$usethreads" in
10040                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10041                 esac
10042                 d_crypt_r=undef
10043                 crypt_r_proto=0
10044                 ;;
10045         esac
10046         ;;
10047 *)      crypt_r_proto=0
10048         ;;
10049 esac
10050
10051 : get csh whereabouts
10052 case "$csh" in
10053 'csh') val="$undef" ;;
10054 *) val="$define" ;;
10055 esac
10056 set d_csh
10057 eval $setvar
10058 : Respect a hint or command line value for full_csh.
10059 case "$full_csh" in
10060 '') full_csh=$csh ;;
10061 esac
10062
10063 : see if ctermid_r exists
10064 set ctermid_r d_ctermid_r
10065 eval $inlibc
10066 case "$d_ctermid_r" in
10067 "$define")
10068         hdrs="$i_systypes sys/types.h define stdio.h "
10069         case "$d_ctermid_r_proto:$usethreads" in
10070         ":define")      d_ctermid_r_proto=define
10071                 set d_ctermid_r_proto ctermid_r $hdrs
10072                 eval $hasproto ;;
10073         *)      ;;
10074         esac
10075         case "$d_ctermid_r_proto" in
10076         define)
10077         case "$ctermid_r_proto" in
10078         ''|0) try='char* ctermid_r(char*);'
10079         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10080         esac
10081         case "$ctermid_r_proto" in
10082         ''|0)   d_ctermid_r=undef
10083                 ctermid_r_proto=0
10084                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10085         * )     case "$ctermid_r_proto" in
10086                 REENTRANT_PROTO*) ;;
10087                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10088                 esac
10089                 echo "Prototype: $try" ;;
10090         esac
10091         ;;
10092         *)      case "$usethreads" in
10093                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10094                 esac
10095                 d_ctermid_r=undef
10096                 ctermid_r_proto=0
10097                 ;;
10098         esac
10099         ;;
10100 *)      ctermid_r_proto=0
10101         ;;
10102 esac
10103
10104 : see if ctime_r exists
10105 set ctime_r d_ctime_r
10106 eval $inlibc
10107 case "$d_ctime_r" in
10108 "$define")
10109         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10110         case "$d_ctime_r_proto:$usethreads" in
10111         ":define")      d_ctime_r_proto=define
10112                 set d_ctime_r_proto ctime_r $hdrs
10113                 eval $hasproto ;;
10114         *)      ;;
10115         esac
10116         case "$d_ctime_r_proto" in
10117         define)
10118         case "$ctime_r_proto" in
10119         ''|0) try='char* ctime_r(const time_t*, char*);'
10120         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10121         esac
10122         case "$ctime_r_proto" in
10123         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10124         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10125         esac
10126         case "$ctime_r_proto" in
10127         ''|0) try='int ctime_r(const time_t*, char*);'
10128         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10129         esac
10130         case "$ctime_r_proto" in
10131         ''|0) try='int ctime_r(const time_t*, char*, int);'
10132         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10133         esac
10134         case "$ctime_r_proto" in
10135         ''|0)   d_ctime_r=undef
10136                 ctime_r_proto=0
10137                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10138         * )     case "$ctime_r_proto" in
10139                 REENTRANT_PROTO*) ;;
10140                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10141                 esac
10142                 echo "Prototype: $try" ;;
10143         esac
10144         ;;
10145         *)      case "$usethreads" in
10146                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10147                 esac
10148                 d_ctime_r=undef
10149                 ctime_r_proto=0
10150                 ;;
10151         esac
10152         ;;
10153 *)      ctime_r_proto=0
10154         ;;
10155 esac
10156
10157 : see if cuserid exists
10158 set cuserid d_cuserid
10159 eval $inlibc
10160
10161 : see if this is a limits.h system
10162 set limits.h i_limits
10163 eval $inhdr
10164
10165 : see if this is a float.h system
10166 set float.h i_float
10167 eval $inhdr
10168
10169 : See if number of significant digits in a double precision number is known
10170 echo " "
10171 $cat >dbl_dig.c <<EOM
10172 #$i_limits I_LIMITS
10173 #$i_float I_FLOAT
10174 #ifdef I_LIMITS
10175 #include <limits.h>
10176 #endif
10177 #ifdef I_FLOAT
10178 #include <float.h>
10179 #endif
10180 #ifdef DBL_DIG
10181 printf("Contains DBL_DIG");
10182 #endif
10183 EOM
10184 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10185 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10186         echo "DBL_DIG found." >&4
10187         val="$define"
10188 else
10189         echo "DBL_DIG NOT found." >&4
10190         val="$undef"
10191 fi
10192 $rm -f dbl_dig.?
10193 set d_dbl_dig
10194 eval $setvar
10195
10196 : see if dbm.h is available
10197 : see if dbmclose exists
10198 set dbmclose d_dbmclose
10199 eval $inlibc
10200
10201 case "$d_dbmclose" in
10202 $define)
10203         set dbm.h i_dbm
10204         eval $inhdr
10205         case "$i_dbm" in
10206         $define)
10207                 val="$undef"
10208                 set i_rpcsvcdbm
10209                 eval $setvar
10210                 ;;
10211         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10212                 eval $inhdr
10213                 ;;
10214         esac
10215         ;;
10216 *)      echo "We won't be including <dbm.h>"
10217         val="$undef"
10218         set i_dbm
10219         eval $setvar
10220         val="$undef"
10221         set i_rpcsvcdbm
10222         eval $setvar
10223         ;;
10224 esac
10225
10226 : see if prototype for dbminit is available
10227 echo " "
10228 set d_dbminitproto dbminit $i_dbm dbm.h
10229 eval $hasproto
10230
10231 : see if difftime exists
10232 set difftime d_difftime
10233 eval $inlibc
10234
10235 : see if this is a dirent system
10236 echo " "
10237 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10238         val="$define"
10239         echo "<dirent.h> found." >&4
10240 else
10241         val="$undef"
10242         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10243                 echo "<sys/dir.h> found." >&4
10244                 echo " "
10245         else
10246                 xinc=`./findhdr sys/ndir.h`
10247         fi
10248         echo "<dirent.h> NOT found." >&4
10249 fi
10250 set i_dirent
10251 eval $setvar
10252
10253 : Look for type of directory structure.
10254 echo " "
10255 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10256
10257 case "$direntrytype" in
10258 ''|' ')
10259         case "$i_dirent" in
10260         $define) guess1='struct dirent' ;;
10261         *) guess1='struct direct'  ;;
10262         esac
10263         ;;
10264 *)      guess1="$direntrytype"
10265         ;;
10266 esac
10267
10268 case "$guess1" in
10269 'struct dirent') guess2='struct direct' ;;
10270 *) guess2='struct dirent' ;;
10271 esac
10272                 
10273 if $contains "$guess1" try.c >/dev/null 2>&1; then
10274         direntrytype="$guess1"
10275         echo "Your directory entries are $direntrytype." >&4
10276 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10277         direntrytype="$guess2"
10278         echo "Your directory entries seem to be $direntrytype." >&4
10279 else
10280         echo "I don't recognize your system's directory entries." >&4
10281         rp="What type is used for directory entries on this system?"
10282         dflt="$guess1"
10283         . ./myread
10284         direntrytype="$ans"
10285 fi
10286 $rm -f try.c
10287
10288
10289 : see if the directory entry stores field length
10290 echo " "
10291 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10292 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10293         echo "Good, your directory entry keeps length information in d_namlen." >&4
10294         val="$define"
10295 else
10296         echo "Your directory entry does not know about the d_namlen field." >&4
10297         val="$undef"
10298 fi
10299 set d_dirnamlen
10300 eval $setvar
10301 $rm -f try.c
10302
10303 : see if this is an sysdir system
10304 set sys/dir.h i_sysdir
10305 eval $inhdr
10306
10307 : see if this is an sysndir system
10308 set sys/ndir.h i_sysndir
10309 eval $inhdr
10310
10311 : Look for dirfd
10312 echo " "
10313 $cat >dirfd.c <<EOM
10314 #include <stdio.h>
10315 #$i_dirent I_DIRENT             /**/
10316 #$i_sysdir I_SYS_DIR            /**/
10317 #$i_sysndir I_SYS_NDIR          /**/
10318 #$i_systypes I_SYS_TYPES        /**/
10319 #if defined(I_SYS_TYPES)
10320 #include <sys/types.h>
10321 #endif
10322 #if defined(I_DIRENT)
10323 #include <dirent.h>
10324 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10325 #include <sys/dir.h>
10326 #endif
10327 #else
10328 #ifdef I_SYS_NDIR
10329 #include <sys/ndir.h>
10330 #else
10331 #ifdef I_SYS_DIR
10332 #ifdef hp9000s500
10333 #include <ndir.h>       /* may be wrong in the future */
10334 #else
10335 #include <sys/dir.h>
10336 #endif
10337 #endif
10338 #endif
10339 #endif 
10340 int main() {
10341         DIR *dirp = opendir(".");
10342         if (dirfd(dirp) >= 0)
10343                 exit(0);
10344         else
10345                 exit(1);
10346 }
10347 EOM
10348 set dirfd
10349 if eval $compile; then
10350         val="$define"
10351 fi
10352 case "$val" in
10353 $define)        echo "dirfd() found." >&4       ;;
10354 *)              echo "dirfd() NOT found." >&4   ;;
10355 esac
10356 set d_dirfd
10357 eval $setvar
10358 $rm -f dirfd*
10359
10360 : see if dlerror exists
10361 xxx_runnm="$runnm"
10362 runnm=false
10363 set dlerror d_dlerror
10364 eval $inlibc
10365 runnm="$xxx_runnm"
10366
10367 : see if dlfcn is available
10368 set dlfcn.h i_dlfcn
10369 eval $inhdr
10370
10371 case "$usedl" in
10372 $define|y|true)
10373         $cat << EOM
10374
10375 On a few systems, the dynamically loaded modules that perl generates and uses
10376 will need a different extension than shared libs. The default will probably
10377 be appropriate.
10378
10379 EOM
10380         case "$dlext" in
10381         '')     dflt="$so" ;;
10382         *)      dflt="$dlext" ;;
10383         esac
10384         rp='What is the extension of dynamically loaded modules'
10385         . ./myread
10386         dlext="$ans"
10387         ;;
10388 *)
10389         dlext="none"
10390         ;;
10391 esac
10392
10393 : Check if dlsym need a leading underscore
10394 echo " "
10395 val="$undef"
10396
10397 case "$dlsrc" in
10398 dl_dlopen.xs)
10399         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10400         $cat >dyna.c <<'EOM'
10401 fred () { }
10402 EOM
10403
10404 $cat >fred.c<<EOM
10405
10406 #include <stdio.h>
10407 #$i_dlfcn I_DLFCN
10408 #ifdef I_DLFCN
10409 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10410 #else
10411 #include <sys/types.h>
10412 #include <nlist.h>
10413 #include <link.h>
10414 #endif
10415
10416 extern int fred() ;
10417
10418 int main()
10419 {
10420     void * handle ;
10421     void * symbol ;
10422 #ifndef RTLD_LAZY
10423     int mode = 1 ;
10424 #else
10425     int mode = RTLD_LAZY ;
10426 #endif
10427     handle = dlopen("./dyna.$dlext", mode) ;
10428     if (handle == NULL) {
10429         printf ("1\n") ;
10430         fflush (stdout) ;
10431         exit(0);
10432     }
10433     symbol = dlsym(handle, "fred") ;
10434     if (symbol == NULL) {
10435         /* try putting a leading underscore */
10436         symbol = dlsym(handle, "_fred") ;
10437         if (symbol == NULL) {
10438             printf ("2\n") ;
10439             fflush (stdout) ;
10440             exit(0);
10441         }
10442         printf ("3\n") ;
10443     }
10444     else
10445         printf ("4\n") ;
10446     fflush (stdout) ;
10447     exit(0);
10448 }
10449 EOM
10450         : Call the object file tmp-dyna.o in case dlext=o.
10451         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10452                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10453                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10454                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10455                 xxx=`$run ./fred`
10456                 case $xxx in
10457                 1)      echo "Test program failed using dlopen." >&4
10458                         echo "Perhaps you should not use dynamic loading." >&4;;
10459                 2)      echo "Test program failed using dlsym." >&4
10460                         echo "Perhaps you should not use dynamic loading." >&4;;
10461                 3)      echo "dlsym needs a leading underscore" >&4
10462                         val="$define" ;;
10463                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10464                 esac
10465         else
10466                 echo "I can't compile and run the test program." >&4
10467                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10468         fi
10469         ;;
10470 esac
10471                 
10472 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10473
10474 set d_dlsymun
10475 eval $setvar
10476
10477 : see if drand48_r exists
10478 set drand48_r d_drand48_r
10479 eval $inlibc
10480 case "$d_drand48_r" in
10481 "$define")
10482         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10483         case "$d_drand48_r_proto:$usethreads" in
10484         ":define")      d_drand48_r_proto=define
10485                 set d_drand48_r_proto drand48_r $hdrs
10486                 eval $hasproto ;;
10487         *)      ;;
10488         esac
10489         case "$d_drand48_r_proto" in
10490         define)
10491         case "$drand48_r_proto" in
10492         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10493         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10494         esac
10495         case "$drand48_r_proto" in
10496         ''|0)   d_drand48_r=undef
10497                 drand48_r_proto=0
10498                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10499         * )     case "$drand48_r_proto" in
10500                 REENTRANT_PROTO*) ;;
10501                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10502                 esac
10503                 echo "Prototype: $try" ;;
10504         esac
10505         ;;
10506         *)      case "$usethreads" in
10507                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10508                 esac
10509                 d_drand48_r=undef
10510                 drand48_r_proto=0
10511                 ;;
10512         esac
10513         ;;
10514 *)      drand48_r_proto=0
10515         ;;
10516 esac
10517
10518 : see if prototype for drand48 is available
10519 echo " "
10520 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10521 eval $hasproto
10522
10523 : see if dup2 exists
10524 set dup2 d_dup2
10525 eval $inlibc
10526
10527 : see if eaccess exists
10528 set eaccess d_eaccess
10529 eval $inlibc
10530
10531 : see if endgrent exists
10532 set endgrent d_endgrent
10533 eval $inlibc
10534
10535 : see if this is an grp system
10536 set grp.h i_grp
10537 eval $inhdr
10538
10539 case "$i_grp" in
10540 $define)
10541         xxx=`./findhdr grp.h`
10542         $cppstdin $cppflags $cppminus < $xxx >$$.h
10543
10544         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10545                 val="$define"
10546         else
10547                 val="$undef"
10548         fi
10549         set d_grpasswd
10550         eval $setvar
10551
10552         $rm -f $$.h
10553         ;;
10554 *)
10555         val="$undef";
10556         set d_grpasswd; eval $setvar
10557         ;;
10558 esac
10559
10560 : see if endgrent_r exists
10561 set endgrent_r d_endgrent_r
10562 eval $inlibc
10563 case "$d_endgrent_r" in
10564 "$define")
10565         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10566         case "$d_endgrent_r_proto:$usethreads" in
10567         ":define")      d_endgrent_r_proto=define
10568                 set d_endgrent_r_proto endgrent_r $hdrs
10569                 eval $hasproto ;;
10570         *)      ;;
10571         esac
10572         case "$d_endgrent_r_proto" in
10573         define)
10574         case "$endgrent_r_proto" in
10575         ''|0) try='int endgrent_r(FILE**);'
10576         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10577         esac
10578         case "$endgrent_r_proto" in
10579         ''|0) try='void endgrent_r(FILE**);'
10580         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10581         esac
10582         case "$endgrent_r_proto" in
10583         ''|0)   d_endgrent_r=undef
10584                 endgrent_r_proto=0
10585                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10586         * )     case "$endgrent_r_proto" in
10587                 REENTRANT_PROTO*) ;;
10588                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10589                 esac
10590                 echo "Prototype: $try" ;;
10591         esac
10592         ;;
10593         *)      case "$usethreads" in
10594                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10595                 esac
10596                 d_endgrent_r=undef
10597                 endgrent_r_proto=0
10598                 ;;
10599         esac
10600         ;;
10601 *)      endgrent_r_proto=0
10602         ;;
10603 esac
10604
10605 : see if endhostent exists
10606 set endhostent d_endhent
10607 eval $inlibc
10608
10609 : see if this is a netdb.h system
10610 set netdb.h i_netdb
10611 eval $inhdr
10612
10613 : see if endhostent_r exists
10614 set endhostent_r d_endhostent_r
10615 eval $inlibc
10616 case "$d_endhostent_r" in
10617 "$define")
10618         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10619         case "$d_endhostent_r_proto:$usethreads" in
10620         ":define")      d_endhostent_r_proto=define
10621                 set d_endhostent_r_proto endhostent_r $hdrs
10622                 eval $hasproto ;;
10623         *)      ;;
10624         esac
10625         case "$d_endhostent_r_proto" in
10626         define)
10627         case "$endhostent_r_proto" in
10628         ''|0) try='int endhostent_r(struct hostent_data*);'
10629         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10630         esac
10631         case "$endhostent_r_proto" in
10632         ''|0) try='void endhostent_r(struct hostent_data*);'
10633         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10634         esac
10635         case "$endhostent_r_proto" in
10636         ''|0)   d_endhostent_r=undef
10637                 endhostent_r_proto=0
10638                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10639         * )     case "$endhostent_r_proto" in
10640                 REENTRANT_PROTO*) ;;
10641                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10642                 esac
10643                 echo "Prototype: $try" ;;
10644         esac
10645         ;;
10646         *)      case "$usethreads" in
10647                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10648                 esac
10649                 d_endhostent_r=undef
10650                 endhostent_r_proto=0
10651                 ;;
10652         esac
10653         ;;
10654 *)      endhostent_r_proto=0
10655         ;;
10656 esac
10657
10658 : see if endnetent exists
10659 set endnetent d_endnent
10660 eval $inlibc
10661
10662 : see if endnetent_r exists
10663 set endnetent_r d_endnetent_r
10664 eval $inlibc
10665 case "$d_endnetent_r" in
10666 "$define")
10667         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10668         case "$d_endnetent_r_proto:$usethreads" in
10669         ":define")      d_endnetent_r_proto=define
10670                 set d_endnetent_r_proto endnetent_r $hdrs
10671                 eval $hasproto ;;
10672         *)      ;;
10673         esac
10674         case "$d_endnetent_r_proto" in
10675         define)
10676         case "$endnetent_r_proto" in
10677         ''|0) try='int endnetent_r(struct netent_data*);'
10678         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10679         esac
10680         case "$endnetent_r_proto" in
10681         ''|0) try='void endnetent_r(struct netent_data*);'
10682         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10683         esac
10684         case "$endnetent_r_proto" in
10685         ''|0)   d_endnetent_r=undef
10686                 endnetent_r_proto=0
10687                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10688         * )     case "$endnetent_r_proto" in
10689                 REENTRANT_PROTO*) ;;
10690                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10691                 esac
10692                 echo "Prototype: $try" ;;
10693         esac
10694         ;;
10695         *)      case "$usethreads" in
10696                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10697                 esac
10698                 d_endnetent_r=undef
10699                 endnetent_r_proto=0
10700                 ;;
10701         esac
10702         ;;
10703 *)      endnetent_r_proto=0
10704         ;;
10705 esac
10706
10707 : see if endprotoent exists
10708 set endprotoent d_endpent
10709 eval $inlibc
10710
10711 : see if endprotoent_r exists
10712 set endprotoent_r d_endprotoent_r
10713 eval $inlibc
10714 case "$d_endprotoent_r" in
10715 "$define")
10716         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10717         case "$d_endprotoent_r_proto:$usethreads" in
10718         ":define")      d_endprotoent_r_proto=define
10719                 set d_endprotoent_r_proto endprotoent_r $hdrs
10720                 eval $hasproto ;;
10721         *)      ;;
10722         esac
10723         case "$d_endprotoent_r_proto" in
10724         define)
10725         case "$endprotoent_r_proto" in
10726         ''|0) try='int endprotoent_r(struct protoent_data*);'
10727         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10728         esac
10729         case "$endprotoent_r_proto" in
10730         ''|0) try='void endprotoent_r(struct protoent_data*);'
10731         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10732         esac
10733         case "$endprotoent_r_proto" in
10734         ''|0)   d_endprotoent_r=undef
10735                 endprotoent_r_proto=0
10736                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10737         * )     case "$endprotoent_r_proto" in
10738                 REENTRANT_PROTO*) ;;
10739                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10740                 esac
10741                 echo "Prototype: $try" ;;
10742         esac
10743         ;;
10744         *)      case "$usethreads" in
10745                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10746                 esac
10747                 d_endprotoent_r=undef
10748                 endprotoent_r_proto=0
10749                 ;;
10750         esac
10751         ;;
10752 *)      endprotoent_r_proto=0
10753         ;;
10754 esac
10755
10756 : see if endpwent exists
10757 set endpwent d_endpwent
10758 eval $inlibc
10759
10760 : see if this is a pwd.h system
10761 set pwd.h i_pwd
10762 eval $inhdr
10763
10764 case "$i_pwd" in
10765 $define)
10766         xxx=`./findhdr pwd.h`
10767         $cppstdin $cppflags $cppminus < $xxx >$$.h
10768
10769         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10770                 val="$define"
10771         else
10772                 val="$undef"
10773         fi
10774         set d_pwquota
10775         eval $setvar
10776
10777         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10778                 val="$define"
10779         else
10780                 val="$undef"
10781         fi
10782         set d_pwage
10783         eval $setvar
10784
10785         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10786                 val="$define"
10787         else
10788                 val="$undef"
10789         fi
10790         set d_pwchange
10791         eval $setvar
10792
10793         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10794                 val="$define"
10795         else
10796                 val="$undef"
10797         fi
10798         set d_pwclass
10799         eval $setvar
10800
10801         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10802                 val="$define"
10803         else
10804                 val="$undef"
10805         fi
10806         set d_pwexpire
10807         eval $setvar
10808
10809         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10810                 val="$define"
10811         else
10812                 val="$undef"
10813         fi
10814         set d_pwcomment
10815         eval $setvar
10816
10817         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10818                 val="$define"
10819         else
10820                 val="$undef"
10821         fi
10822         set d_pwgecos
10823         eval $setvar
10824
10825         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10826                 val="$define"
10827         else
10828                 val="$undef"
10829         fi
10830         set d_pwpasswd
10831         eval $setvar
10832
10833         $rm -f $$.h
10834         ;;
10835 *)
10836         val="$undef"; 
10837         set d_pwquota; eval $setvar
10838         set d_pwage; eval $setvar
10839         set d_pwchange; eval $setvar
10840         set d_pwclass; eval $setvar
10841         set d_pwexpire; eval $setvar
10842         set d_pwcomment; eval $setvar
10843         set d_pwgecos; eval $setvar
10844         set d_pwpasswd; eval $setvar
10845         ;;
10846 esac
10847
10848 : see if endpwent_r exists
10849 set endpwent_r d_endpwent_r
10850 eval $inlibc
10851 case "$d_endpwent_r" in
10852 "$define")
10853         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10854         case "$d_endpwent_r_proto:$usethreads" in
10855         ":define")      d_endpwent_r_proto=define
10856                 set d_endpwent_r_proto endpwent_r $hdrs
10857                 eval $hasproto ;;
10858         *)      ;;
10859         esac
10860         case "$d_endpwent_r_proto" in
10861         define)
10862         case "$endpwent_r_proto" in
10863         ''|0) try='int endpwent_r(FILE**);'
10864         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10865         esac
10866         case "$endpwent_r_proto" in
10867         ''|0) try='void endpwent_r(FILE**);'
10868         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10869         esac
10870         case "$endpwent_r_proto" in
10871         ''|0)   d_endpwent_r=undef
10872                 endpwent_r_proto=0
10873                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10874         * )     case "$endpwent_r_proto" in
10875                 REENTRANT_PROTO*) ;;
10876                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10877                 esac
10878                 echo "Prototype: $try" ;;
10879         esac
10880         ;;
10881         *)      case "$usethreads" in
10882                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10883                 esac
10884                 d_endpwent_r=undef
10885                 endpwent_r_proto=0
10886                 ;;
10887         esac
10888         ;;
10889 *)      endpwent_r_proto=0
10890         ;;
10891 esac
10892
10893 : see if endservent exists
10894 set endservent d_endsent
10895 eval $inlibc
10896
10897 : see if endservent_r exists
10898 set endservent_r d_endservent_r
10899 eval $inlibc
10900 case "$d_endservent_r" in
10901 "$define")
10902         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10903         case "$d_endservent_r_proto:$usethreads" in
10904         ":define")      d_endservent_r_proto=define
10905                 set d_endservent_r_proto endservent_r $hdrs
10906                 eval $hasproto ;;
10907         *)      ;;
10908         esac
10909         case "$d_endservent_r_proto" in
10910         define)
10911         case "$endservent_r_proto" in
10912         ''|0) try='int endservent_r(struct servent_data*);'
10913         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10914         esac
10915         case "$endservent_r_proto" in
10916         ''|0) try='void endservent_r(struct servent_data*);'
10917         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10918         esac
10919         case "$endservent_r_proto" in
10920         ''|0)   d_endservent_r=undef
10921                 endservent_r_proto=0
10922                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10923         * )     case "$endservent_r_proto" in
10924                 REENTRANT_PROTO*) ;;
10925                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10926                 esac
10927                 echo "Prototype: $try" ;;
10928         esac
10929         ;;
10930         *)      case "$usethreads" in
10931                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10932                 esac
10933                 d_endservent_r=undef
10934                 endservent_r_proto=0
10935                 ;;
10936         esac
10937         ;;
10938 *)      endservent_r_proto=0
10939         ;;
10940 esac
10941
10942 : Locate the flags for 'open()'
10943 echo " "
10944 $cat >try.c <<'EOCP'
10945 #include <sys/types.h>
10946 #ifdef I_FCNTL
10947 #include <fcntl.h>
10948 #endif
10949 #ifdef I_SYS_FILE
10950 #include <sys/file.h>
10951 #endif
10952 int main() {
10953         if(O_RDONLY);
10954 #ifdef O_TRUNC
10955         exit(0);
10956 #else
10957         exit(1);
10958 #endif
10959 }
10960 EOCP
10961 : check sys/file.h first to get FREAD on Sun
10962 if $test `./findhdr sys/file.h` && \
10963                 set try -DI_SYS_FILE && eval $compile; then
10964         h_sysfile=true;
10965         echo "<sys/file.h> defines the O_* constants..." >&4
10966         if $run ./try; then
10967                 echo "and you have the 3 argument form of open()." >&4
10968                 val="$define"
10969         else
10970                 echo "but not the 3 argument form of open().  Oh, well." >&4
10971                 val="$undef"
10972         fi
10973 elif $test `./findhdr fcntl.h` && \
10974                 set try -DI_FCNTL && eval $compile; then
10975         h_fcntl=true;
10976         echo "<fcntl.h> defines the O_* constants..." >&4
10977         if $run ./try; then
10978                 echo "and you have the 3 argument form of open()." >&4
10979                 val="$define"
10980         else
10981                 echo "but not the 3 argument form of open().  Oh, well." >&4
10982                 val="$undef"
10983         fi
10984 else
10985         val="$undef"
10986         echo "I can't find the O_* constant definitions!  You got problems." >&4
10987 fi
10988 set d_open3
10989 eval $setvar
10990 $rm -f try try.*
10991
10992 : see which of string.h or strings.h is needed
10993 echo " "
10994 strings=`./findhdr string.h`
10995 if $test "$strings" && $test -r "$strings"; then
10996         echo "Using <string.h> instead of <strings.h>." >&4
10997         val="$define"
10998 else
10999         val="$undef"
11000         strings=`./findhdr strings.h`
11001         if $test "$strings" && $test -r "$strings"; then
11002                 echo "Using <strings.h> instead of <string.h>." >&4
11003         else
11004                 echo "No string header found -- You'll surely have problems." >&4
11005         fi
11006 fi
11007 set i_string
11008 eval $setvar
11009 case "$i_string" in
11010 "$undef") strings=`./findhdr strings.h`;;
11011 *)        strings=`./findhdr string.h`;;
11012 esac
11013
11014 : see if this is a sys/file.h system
11015 val=''
11016 set sys/file.h val
11017 eval $inhdr
11018
11019 : do we need to include sys/file.h ?
11020 case "$val" in
11021 "$define")
11022         echo " "
11023         if $h_sysfile; then
11024                 val="$define"
11025                 echo "We'll be including <sys/file.h>." >&4
11026         else
11027                 val="$undef"
11028                 echo "We won't be including <sys/file.h>." >&4
11029         fi
11030         ;;
11031 *)
11032         h_sysfile=false
11033         ;;
11034 esac
11035 set i_sysfile
11036 eval $setvar
11037
11038 : see if fcntl.h is there
11039 val=''
11040 set fcntl.h val
11041 eval $inhdr
11042
11043 : see if we can include fcntl.h
11044 case "$val" in
11045 "$define")
11046         echo " "
11047         if $h_fcntl; then
11048                 val="$define"
11049                 echo "We'll be including <fcntl.h>." >&4
11050         else
11051                 val="$undef"
11052                 if $h_sysfile; then
11053         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11054                 else
11055                         echo "We won't be including <fcntl.h>." >&4
11056                 fi
11057         fi
11058         ;;
11059 *)
11060         h_fcntl=false
11061         val="$undef"
11062         ;;
11063 esac
11064 set i_fcntl
11065 eval $setvar
11066
11067 : check for non-blocking I/O stuff
11068 case "$h_sysfile" in
11069 true) echo "#include <sys/file.h>" > head.c;;
11070 *)
11071        case "$h_fcntl" in
11072        true) echo "#include <fcntl.h>" > head.c;;
11073        *) echo "#include <sys/fcntl.h>" > head.c;;
11074        esac
11075        ;;
11076 esac
11077 echo " "
11078 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11079 case "$o_nonblock" in
11080 '')
11081         $cat head.c > try.c
11082         $cat >>try.c <<EOCP
11083 #include <stdio.h>
11084 #include <stdlib.h>
11085 #$i_fcntl I_FCNTL
11086 #ifdef I_FCNTL
11087 #include <fcntl.h>
11088 #endif
11089 int main() {
11090 #ifdef O_NONBLOCK
11091         printf("O_NONBLOCK\n");
11092         exit(0);
11093 #endif
11094 #ifdef O_NDELAY
11095         printf("O_NDELAY\n");
11096         exit(0);
11097 #endif
11098 #ifdef FNDELAY
11099         printf("FNDELAY\n");
11100         exit(0);
11101 #endif
11102         exit(0);
11103 }
11104 EOCP
11105         set try
11106         if eval $compile_ok; then
11107                 o_nonblock=`$run ./try`
11108                 case "$o_nonblock" in
11109                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11110                 *) echo "Seems like we can use $o_nonblock.";;
11111                 esac
11112         else
11113                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11114         fi
11115         ;;
11116 *) echo "Using $hint value $o_nonblock.";;
11117 esac
11118 $rm -f try try.* .out core
11119
11120 echo " "
11121 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11122 case "$eagain" in
11123 '')
11124         $cat head.c > try.c
11125         $cat >>try.c <<EOCP
11126 #include <errno.h>
11127 #include <sys/types.h>
11128 #include <signal.h>
11129 #include <stdio.h> 
11130 #include <stdlib.h> 
11131 #$i_fcntl I_FCNTL
11132 #ifdef I_FCNTL
11133 #include <fcntl.h>
11134 #endif
11135 #define MY_O_NONBLOCK $o_nonblock
11136 #ifndef errno  /* XXX need better Configure test */
11137 extern int errno;
11138 #endif
11139 #$i_unistd I_UNISTD
11140 #ifdef I_UNISTD
11141 #include <unistd.h>
11142 #endif
11143 #$i_string I_STRING
11144 #ifdef I_STRING
11145 #include <string.h>
11146 #else
11147 #include <strings.h>
11148 #endif
11149 $signal_t blech(x) int x; { exit(3); }
11150 EOCP
11151         $cat >> try.c <<'EOCP'
11152 int main()
11153 {
11154         int pd[2];
11155         int pu[2];
11156         char buf[1];
11157         char string[100];
11158
11159         pipe(pd);       /* Down: child -> parent */
11160         pipe(pu);       /* Up: parent -> child */
11161         if (0 != fork()) {
11162                 int ret;
11163                 close(pd[1]);   /* Parent reads from pd[0] */
11164                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11165 #ifdef F_SETFL
11166                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11167                         exit(1);
11168 #else
11169                 exit(4);
11170 #endif
11171                 signal(SIGALRM, blech);
11172                 alarm(5);
11173                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11174                         exit(2);
11175                 sprintf(string, "%d\n", ret);
11176                 write(2, string, strlen(string));
11177                 alarm(0);
11178 #ifdef EAGAIN
11179                 if (errno == EAGAIN) {
11180                         printf("EAGAIN\n");
11181                         goto ok;
11182                 }
11183 #endif
11184 #ifdef EWOULDBLOCK
11185                 if (errno == EWOULDBLOCK)
11186                         printf("EWOULDBLOCK\n");
11187 #endif
11188         ok:
11189                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11190                 sleep(2);                               /* Give it time to close our pipe */
11191                 alarm(5);
11192                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11193                 alarm(0);
11194                 sprintf(string, "%d\n", ret);
11195                 write(4, string, strlen(string));
11196                 exit(0);
11197         }
11198
11199         close(pd[0]);                   /* We write to pd[1] */
11200         close(pu[1]);                   /* We read from pu[0] */
11201         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11202         close(pd[1]);                   /* Pipe pd is now fully closed! */
11203         exit(0);                                /* Bye bye, thank you for playing! */
11204 }
11205 EOCP
11206         set try
11207         if eval $compile_ok; then
11208                 echo "$startsh" >mtry
11209                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11210                 chmod +x mtry
11211                 ./mtry >/dev/null 2>&1
11212                 case $? in
11213                 0) eagain=`$cat try.out`;;
11214                 1) echo "Could not perform non-blocking setting!";;
11215                 2) echo "I did a successful read() for something that was not there!";;
11216                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11217                 4) echo "Could not find F_SETFL!";;
11218                 *) echo "Something terribly wrong happened during testing.";;
11219                 esac
11220                 rd_nodata=`$cat try.ret`
11221                 echo "A read() system call with no data present returns $rd_nodata."
11222                 case "$rd_nodata" in
11223                 0|-1) ;;
11224                 *)
11225                         echo "(That's peculiar, fixing that to be -1.)"
11226                         rd_nodata=-1
11227                         ;;
11228                 esac
11229                 case "$eagain" in
11230                 '')
11231                         echo "Forcing errno EAGAIN on read() with no data available."
11232                         eagain=EAGAIN
11233                         ;;
11234                 *)
11235                         echo "Your read() sets errno to $eagain when no data is available."
11236                         ;;
11237                 esac
11238                 status=`$cat try.err`
11239                 case "$status" in
11240                 0) echo "And it correctly returns 0 to signal EOF.";;
11241                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11242                 *) echo "However, your read() returns '$status' on EOF??";;
11243                 esac
11244                 val="$define"
11245                 if test "$status" = "$rd_nodata"; then
11246                         echo "WARNING: you can't distinguish between EOF and no data!"
11247                         val="$undef"
11248                 fi
11249         else
11250                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11251                 eagain=EAGAIN
11252         fi
11253         set d_eofnblk
11254         eval $setvar
11255         ;;
11256 *)
11257         echo "Using $hint value $eagain."
11258         echo "Your read() returns $rd_nodata when no data is present."
11259         case "$d_eofnblk" in
11260         "$define") echo "And you can see EOF because read() returns 0.";;
11261         "$undef") echo "But you can't see EOF status from read() returned value.";;
11262         *)
11263                 echo "(Assuming you can't see EOF status from read anyway.)"
11264                 d_eofnblk=$undef
11265                 ;;
11266         esac
11267         ;;
11268 esac
11269 $rm -f try try.* .out core head.c mtry
11270
11271 : see if fchdir exists
11272 set fchdir d_fchdir
11273 eval $inlibc
11274
11275 : see if fchmod exists
11276 set fchmod d_fchmod
11277 eval $inlibc
11278
11279 : see if fchown exists
11280 set fchown d_fchown
11281 eval $inlibc
11282
11283 : see if this is an fcntl system
11284 set fcntl d_fcntl
11285 eval $inlibc
11286
11287 echo " "
11288 : See if fcntl-based locking works.
11289 $cat >try.c <<EOCP
11290 #include <stdlib.h>
11291 #include <unistd.h>
11292 #include <fcntl.h>
11293 #include <signal.h>
11294 $signal_t blech(x) int x; { exit(3); }
11295 int main() {
11296 #if defined(F_SETLK) && defined(F_SETLKW)
11297      struct flock flock;
11298      int retval, fd;
11299      fd = open("try.c", O_RDONLY);
11300      flock.l_type = F_RDLCK;
11301      flock.l_whence = SEEK_SET;
11302      flock.l_start = flock.l_len = 0;
11303      signal(SIGALRM, blech);
11304      alarm(10);
11305      retval = fcntl(fd, F_SETLK, &flock);
11306      close(fd);
11307      (retval < 0 ? exit(2) : exit(0));
11308 #else
11309      exit(2);
11310 #endif
11311 }
11312 EOCP
11313 echo "Checking if fcntl-based file locking works... "
11314 case "$d_fcntl" in
11315 "$define")
11316         set try
11317         if eval $compile_ok; then
11318                 if $run ./try; then
11319                         echo "Yes, it seems to work."
11320                         val="$define"
11321                 else
11322                         echo "Nope, it didn't work."
11323                         val="$undef"
11324                         case "$?" in
11325                         3) $cat >&4 <<EOM
11326 ***
11327 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11328 *** This is (almost) impossible.
11329 *** If your NFS lock daemons are not feeling well, something like
11330 *** this may happen, please investigate.  Cannot continue, aborting.
11331 ***
11332 EOM
11333                                 exit 1
11334                                 ;;
11335                         esac
11336                 fi
11337         else
11338                 echo "I'm unable to compile the test program, so I'll assume not."
11339                 val="$undef"
11340         fi
11341         ;;
11342 *) val="$undef";
11343         echo "Nope, since you don't even have fcntl()."
11344         ;;
11345 esac
11346 set d_fcntl_can_lock
11347 eval $setvar
11348 $rm -f try*
11349
11350
11351 : check for fd_set items
11352 $cat <<EOM
11353
11354 Checking to see how well your C compiler handles fd_set and friends ...
11355 EOM
11356 $cat >try.c <<EOCP
11357 #$i_systime I_SYS_TIME
11358 #$i_sysselct I_SYS_SELECT
11359 #$d_socket HAS_SOCKET
11360 #include <sys/types.h>
11361 #ifdef HAS_SOCKET
11362 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11363 #endif
11364 #ifdef I_SYS_TIME
11365 #include <sys/time.h>
11366 #endif
11367 #ifdef I_SYS_SELECT
11368 #include <sys/select.h>
11369 #endif
11370 int main() {
11371         fd_set fds;
11372
11373 #ifdef TRYBITS
11374         if(fds.fds_bits);
11375 #endif
11376
11377 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11378         exit(0);
11379 #else
11380         exit(1);
11381 #endif
11382 }
11383 EOCP
11384 set try -DTRYBITS
11385 if eval $compile; then
11386         d_fds_bits="$define"
11387         d_fd_set="$define"
11388         echo "Well, your system knows about the normal fd_set typedef..." >&4
11389         if $run ./try; then
11390                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11391                 d_fd_macros="$define"
11392         else
11393                 $cat >&4 <<'EOM'
11394 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11395 EOM
11396                 d_fd_macros="$undef"
11397         fi
11398 else
11399         $cat <<'EOM'
11400 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11401 EOM
11402         set try
11403         if eval $compile; then
11404                 d_fds_bits="$undef"
11405                 d_fd_set="$define"
11406                 echo "Well, your system has some sort of fd_set available..." >&4
11407                 if $run ./try; then
11408                         echo "and you have the normal fd_set macros." >&4
11409                         d_fd_macros="$define"
11410                 else
11411                         $cat <<'EOM'
11412 but not the normal fd_set macros!  Gross!  More work for me...
11413 EOM
11414                         d_fd_macros="$undef"
11415                 fi
11416         else
11417         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11418                 d_fd_set="$undef"
11419                 d_fds_bits="$undef"
11420                 d_fd_macros="$undef"
11421         fi
11422 fi
11423 $rm -f try try.*
11424
11425 : see if fgetpos exists
11426 set fgetpos d_fgetpos
11427 eval $inlibc
11428
11429 : see if finite exists
11430 set finite d_finite
11431 eval $inlibc
11432
11433 : see if finitel exists
11434 set finitel d_finitel
11435 eval $inlibc
11436
11437 : see if flock exists
11438 set flock d_flock
11439 eval $inlibc
11440
11441 : see if prototype for flock is available
11442 echo " "
11443 set d_flockproto flock $i_sysfile sys/file.h
11444 eval $hasproto
11445
11446 : see if fork exists
11447 set fork d_fork
11448 eval $inlibc
11449
11450 : see if fp_class exists
11451 set fp_class d_fp_class
11452 eval $inlibc
11453
11454 : see if pathconf exists
11455 set pathconf d_pathconf
11456 eval $inlibc
11457
11458 : see if fpathconf exists
11459 set fpathconf d_fpathconf
11460 eval $inlibc
11461
11462 : see if fpclass exists
11463 set fpclass d_fpclass
11464 eval $inlibc
11465
11466 : see if fpclassify exists
11467 set fpclassify d_fpclassify
11468 eval $inlibc
11469
11470 : see if fpclassl exists
11471 set fpclassl d_fpclassl
11472 eval $inlibc
11473
11474
11475 : check for fpos64_t
11476 echo " "
11477 echo "Checking to see if you have fpos64_t..." >&4
11478 $cat >try.c <<EOCP
11479 #include <stdio.h>
11480 int main() { fpos64_t x = 7; }
11481 EOCP
11482 set try
11483 if eval $compile; then
11484         val="$define"
11485         echo "You have fpos64_t."
11486 else
11487         val="$undef"
11488         echo "You do not have fpos64_t."
11489         case "$fpossize" in
11490         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11491         esac
11492 fi
11493 $rm -f try.* try
11494 set d_fpos64_t
11495 eval $setvar
11496
11497 : see if frexpl exists
11498 set frexpl d_frexpl
11499 eval $inlibc
11500
11501 : see if this is a sys/param system
11502 set sys/param.h i_sysparam
11503 eval $inhdr
11504
11505 : see if this is a sys/mount.h system
11506 set sys/mount.h i_sysmount
11507 eval $inhdr
11508
11509
11510 echo " "
11511 echo "Checking to see if your system supports struct fs_data..." >&4
11512 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11513 eval $hasstruct
11514 case "$d_fs_data_s" in
11515 "$define")      echo "Yes, it does."   ;;
11516 *)              echo "No, it doesn't." ;;
11517 esac
11518
11519 : see if fseeko exists
11520 set fseeko d_fseeko
11521 eval $inlibc
11522 case "$longsize" in
11523 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11524 esac
11525
11526 : see if fsetpos exists
11527 set fsetpos d_fsetpos
11528 eval $inlibc
11529
11530
11531 : see if fstatfs exists
11532 set fstatfs d_fstatfs
11533 eval $inlibc
11534
11535
11536 : see if statvfs exists
11537 set statvfs d_statvfs
11538 eval $inlibc
11539
11540 : see if fstatvfs exists
11541 set fstatvfs d_fstatvfs
11542 eval $inlibc
11543
11544
11545 : see if fsync exists
11546 set fsync d_fsync
11547 eval $inlibc
11548
11549 : see if ftello exists
11550 set ftello d_ftello
11551 eval $inlibc
11552 case "$longsize" in
11553 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11554 esac
11555
11556 : see if getcwd exists
11557 set getcwd d_getcwd
11558 eval $inlibc
11559
11560 : see if getespwnam exists
11561 set getespwnam d_getespwnam
11562 eval $inlibc
11563
11564
11565 : see if getfsstat exists
11566 set getfsstat d_getfsstat
11567 eval $inlibc
11568
11569 : see if getgrent exists
11570 set getgrent d_getgrent
11571 eval $inlibc
11572
11573 : see if getgrent_r exists
11574 set getgrent_r d_getgrent_r
11575 eval $inlibc
11576 case "$d_getgrent_r" in
11577 "$define")
11578         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11579         case "$d_getgrent_r_proto:$usethreads" in
11580         ":define")      d_getgrent_r_proto=define
11581                 set d_getgrent_r_proto getgrent_r $hdrs
11582                 eval $hasproto ;;
11583         *)      ;;
11584         esac
11585         case "$d_getgrent_r_proto" in
11586         define)
11587         case "$getgrent_r_proto" in
11588         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11589         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11590         esac
11591         case "$getgrent_r_proto" in
11592         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11593         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11594         esac
11595         case "$getgrent_r_proto" in
11596         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11597         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11598         esac
11599         case "$getgrent_r_proto" in
11600         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11601         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11602         esac
11603         case "$getgrent_r_proto" in
11604         ''|0) try='int getgrent_r(struct group*, char*, int);'
11605         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11606         esac
11607         case "$getgrent_r_proto" in
11608         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11609         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11610         esac
11611         case "$getgrent_r_proto" in
11612         ''|0)   d_getgrent_r=undef
11613                 getgrent_r_proto=0
11614                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11615         * )     case "$getgrent_r_proto" in
11616                 REENTRANT_PROTO*) ;;
11617                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11618                 esac
11619                 echo "Prototype: $try" ;;
11620         esac
11621         ;;
11622         *)      case "$usethreads" in
11623                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11624                 esac
11625                 d_getgrent_r=undef
11626                 getgrent_r_proto=0
11627                 ;;
11628         esac
11629         ;;
11630 *)      getgrent_r_proto=0
11631         ;;
11632 esac
11633
11634 : see if getgrgid_r exists
11635 set getgrgid_r d_getgrgid_r
11636 eval $inlibc
11637 case "$d_getgrgid_r" in
11638 "$define")
11639         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11640         case "$d_getgrgid_r_proto:$usethreads" in
11641         ":define")      d_getgrgid_r_proto=define
11642                 set d_getgrgid_r_proto getgrgid_r $hdrs
11643                 eval $hasproto ;;
11644         *)      ;;
11645         esac
11646         case "$d_getgrgid_r_proto" in
11647         define)
11648         case "$getgrgid_r_proto" in
11649         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11650         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11651         esac
11652         case "$getgrgid_r_proto" in
11653         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11654         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11655         esac
11656         case "$getgrgid_r_proto" in
11657         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11658         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11659         esac
11660         case "$getgrgid_r_proto" in
11661         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11662         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11663         esac
11664         case "$getgrgid_r_proto" in
11665         ''|0)   d_getgrgid_r=undef
11666                 getgrgid_r_proto=0
11667                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11668         * )     case "$getgrgid_r_proto" in
11669                 REENTRANT_PROTO*) ;;
11670                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11671                 esac
11672                 echo "Prototype: $try" ;;
11673         esac
11674         ;;
11675         *)      case "$usethreads" in
11676                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11677                 esac
11678                 d_getgrgid_r=undef
11679                 getgrgid_r_proto=0
11680                 ;;
11681         esac
11682         ;;
11683 *)      getgrgid_r_proto=0
11684         ;;
11685 esac
11686
11687 : see if getgrnam_r exists
11688 set getgrnam_r d_getgrnam_r
11689 eval $inlibc
11690 case "$d_getgrnam_r" in
11691 "$define")
11692         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11693         case "$d_getgrnam_r_proto:$usethreads" in
11694         ":define")      d_getgrnam_r_proto=define
11695                 set d_getgrnam_r_proto getgrnam_r $hdrs
11696                 eval $hasproto ;;
11697         *)      ;;
11698         esac
11699         case "$d_getgrnam_r_proto" in
11700         define)
11701         case "$getgrnam_r_proto" in
11702         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11703         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11704         esac
11705         case "$getgrnam_r_proto" in
11706         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11707         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11708         esac
11709         case "$getgrnam_r_proto" in
11710         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11711         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11712         esac
11713         case "$getgrnam_r_proto" in
11714         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11715         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11716         esac
11717         case "$getgrnam_r_proto" in
11718         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11719         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11720         esac
11721         case "$getgrnam_r_proto" in
11722         ''|0)   d_getgrnam_r=undef
11723                 getgrnam_r_proto=0
11724                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11725         * )     case "$getgrnam_r_proto" in
11726                 REENTRANT_PROTO*) ;;
11727                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11728                 esac
11729                 echo "Prototype: $try" ;;
11730         esac
11731         ;;
11732         *)      case "$usethreads" in
11733                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11734                 esac
11735                 d_getgrnam_r=undef
11736                 getgrnam_r_proto=0
11737                 ;;
11738         esac
11739         ;;
11740 *)      getgrnam_r_proto=0
11741         ;;
11742 esac
11743
11744 : see if gethostbyaddr exists
11745 set gethostbyaddr d_gethbyaddr
11746 eval $inlibc
11747
11748 : see if gethostbyname exists
11749 set gethostbyname d_gethbyname
11750 eval $inlibc
11751
11752 : see if gethostent exists
11753 set gethostent d_gethent
11754 eval $inlibc
11755
11756 : see how we will look up host name
11757 echo " "
11758 call=''
11759 if set gethostname val -f d_gethname; eval $csym; $val; then
11760         echo 'gethostname() found.' >&4
11761         d_gethname="$define"
11762         call=gethostname
11763 fi
11764 if set uname val -f d_uname; eval $csym; $val; then
11765         if ./xenix; then
11766                 $cat <<'EOM'
11767 uname() was found, but you're running xenix, and older versions of xenix
11768 have a broken uname(). If you don't really know whether your xenix is old
11769 enough to have a broken system call, use the default answer.
11770
11771 EOM
11772                 dflt=y
11773                 case "$d_uname" in
11774                 "$define") dflt=n;;
11775                 esac
11776                 rp='Is your uname() broken?'
11777                 . ./myread
11778                 case "$ans" in
11779                 n*) d_uname="$define"; call=uname;;
11780                 esac
11781         else
11782                 echo 'uname() found.' >&4
11783                 d_uname="$define"
11784                 case "$call" in
11785                 '') call=uname ;;
11786                 esac
11787         fi
11788 fi
11789 case "$d_gethname" in
11790 '') d_gethname="$undef";;
11791 esac
11792 case "$d_uname" in
11793 '') d_uname="$undef";;
11794 esac
11795 case "$d_uname$d_gethname" in
11796 *define*)
11797         dflt=n
11798         cat <<EOM
11799  
11800 Every now and then someone has a $call() that lies about the hostname
11801 but can't be fixed for political or economic reasons.  If you wish, I can
11802 pretend $call() isn't there and maybe compute hostname at run-time
11803 thanks to the '$phostname' command.
11804
11805 EOM
11806         rp="Shall I ignore $call() from now on?"
11807         . ./myread
11808         case "$ans" in
11809         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11810         esac;;
11811 esac
11812 case "$phostname" in
11813 '') aphostname='';;
11814 *) case "$aphostname" in
11815         /*) ;;
11816         *) set X $phostname
11817                 shift
11818                 file=$1
11819                 shift
11820                 file=`./loc $file $file $pth`
11821                 aphostname=`echo $file $*`
11822                 ;;
11823         esac
11824         ;;
11825 esac
11826 case "$d_uname$d_gethname" in
11827 *define*) ;;
11828 *)
11829         case "$phostname" in
11830         '')
11831                 echo "There will be no way for $package to get your hostname." >&4;;
11832         *)
11833         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11834                 ;;
11835         esac;;
11836 esac
11837 case "$d_phostname" in
11838 '') d_phostname="$undef";;
11839 esac
11840
11841 : see if gethostbyaddr_r exists
11842 set gethostbyaddr_r d_gethostbyaddr_r
11843 eval $inlibc
11844 case "$d_gethostbyaddr_r" in
11845 "$define")
11846         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11847         case "$d_gethostbyaddr_r_proto:$usethreads" in
11848         ":define")      d_gethostbyaddr_r_proto=define
11849                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11850                 eval $hasproto ;;
11851         *)      ;;
11852         esac
11853         case "$d_gethostbyaddr_r_proto" in
11854         define)
11855         case "$gethostbyaddr_r_proto" in
11856         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11857         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11858         esac
11859         case "$gethostbyaddr_r_proto" in
11860         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11861         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11862         esac
11863         case "$gethostbyaddr_r_proto" in
11864         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11865         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11866         esac
11867         case "$gethostbyaddr_r_proto" in
11868         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11869         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11870         esac
11871         case "$gethostbyaddr_r_proto" in
11872         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11873         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11874         esac
11875         case "$gethostbyaddr_r_proto" in
11876         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11877         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11878         esac
11879         case "$gethostbyaddr_r_proto" in
11880         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11881         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11882         esac
11883         case "$gethostbyaddr_r_proto" in
11884         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11885         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11886         esac
11887         case "$gethostbyaddr_r_proto" in
11888         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11889         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11890         esac
11891         case "$gethostbyaddr_r_proto" in
11892         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11893         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11894         esac
11895         case "$gethostbyaddr_r_proto" in
11896         ''|0)   d_gethostbyaddr_r=undef
11897                 gethostbyaddr_r_proto=0
11898                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11899         * )     case "$gethostbyaddr_r_proto" in
11900                 REENTRANT_PROTO*) ;;
11901                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11902                 esac
11903                 echo "Prototype: $try" ;;
11904         esac
11905         ;;
11906         *)      case "$usethreads" in
11907                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11908                 esac
11909                 d_gethostbyaddr_r=undef
11910                 gethostbyaddr_r_proto=0
11911                 ;;
11912         esac
11913         ;;
11914 *)      gethostbyaddr_r_proto=0
11915         ;;
11916 esac
11917
11918 : see if gethostbyname_r exists
11919 set gethostbyname_r d_gethostbyname_r
11920 eval $inlibc
11921 case "$d_gethostbyname_r" in
11922 "$define")
11923         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11924         case "$d_gethostbyname_r_proto:$usethreads" in
11925         ":define")      d_gethostbyname_r_proto=define
11926                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11927                 eval $hasproto ;;
11928         *)      ;;
11929         esac
11930         case "$d_gethostbyname_r_proto" in
11931         define)
11932         case "$gethostbyname_r_proto" in
11933         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11934         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11935         esac
11936         case "$gethostbyname_r_proto" in
11937         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11938         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11939         esac
11940         case "$gethostbyname_r_proto" in
11941         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11942         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11943         esac
11944         case "$gethostbyname_r_proto" in
11945         ''|0)   d_gethostbyname_r=undef
11946                 gethostbyname_r_proto=0
11947                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11948         * )     case "$gethostbyname_r_proto" in
11949                 REENTRANT_PROTO*) ;;
11950                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11951                 esac
11952                 echo "Prototype: $try" ;;
11953         esac
11954         ;;
11955         *)      case "$usethreads" in
11956                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11957                 esac
11958                 d_gethostbyname_r=undef
11959                 gethostbyname_r_proto=0
11960                 ;;
11961         esac
11962         ;;
11963 *)      gethostbyname_r_proto=0
11964         ;;
11965 esac
11966
11967 : see if gethostent_r exists
11968 set gethostent_r d_gethostent_r
11969 eval $inlibc
11970 case "$d_gethostent_r" in
11971 "$define")
11972         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11973         case "$d_gethostent_r_proto:$usethreads" in
11974         ":define")      d_gethostent_r_proto=define
11975                 set d_gethostent_r_proto gethostent_r $hdrs
11976                 eval $hasproto ;;
11977         *)      ;;
11978         esac
11979         case "$d_gethostent_r_proto" in
11980         define)
11981         case "$gethostent_r_proto" in
11982         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11983         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11984         esac
11985         case "$gethostent_r_proto" in
11986         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11987         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11988         esac
11989         case "$gethostent_r_proto" in
11990         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11991         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11992         esac
11993         case "$gethostent_r_proto" in
11994         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11995         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11996         esac
11997         case "$gethostent_r_proto" in
11998         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11999         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12000         esac
12001         case "$gethostent_r_proto" in
12002         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12003         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12004         esac
12005         case "$gethostent_r_proto" in
12006         ''|0)   d_gethostent_r=undef
12007                 gethostent_r_proto=0
12008                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12009         * )     case "$gethostent_r_proto" in
12010                 REENTRANT_PROTO*) ;;
12011                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12012                 esac
12013                 echo "Prototype: $try" ;;
12014         esac
12015         ;;
12016         *)      case "$usethreads" in
12017                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12018                 esac
12019                 d_gethostent_r=undef
12020                 gethostent_r_proto=0
12021                 ;;
12022         esac
12023         ;;
12024 *)      gethostent_r_proto=0
12025         ;;
12026 esac
12027
12028 : see if prototypes for various gethostxxx netdb.h functions are available
12029 echo " "
12030 set d_gethostprotos gethostent $i_netdb netdb.h
12031 eval $hasproto
12032
12033 : see if getitimer exists
12034 set getitimer d_getitimer
12035 eval $inlibc
12036
12037 : see if getlogin exists
12038 set getlogin d_getlogin
12039 eval $inlibc
12040
12041 : see if getlogin_r exists
12042 set getlogin_r d_getlogin_r
12043 eval $inlibc
12044 case "$d_getlogin_r" in
12045 "$define")
12046         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12047         case "$d_getlogin_r_proto:$usethreads" in
12048         ":define")      d_getlogin_r_proto=define
12049                 set d_getlogin_r_proto getlogin_r $hdrs
12050                 eval $hasproto ;;
12051         *)      ;;
12052         esac
12053         case "$d_getlogin_r_proto" in
12054         define)
12055         case "$getlogin_r_proto" in
12056         ''|0) try='int getlogin_r(char*, size_t);'
12057         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12058         esac
12059         case "$getlogin_r_proto" in
12060         ''|0) try='int getlogin_r(char*, int);'
12061         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12062         esac
12063         case "$getlogin_r_proto" in
12064         ''|0) try='char* getlogin_r(char*, size_t);'
12065         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12066         esac
12067         case "$getlogin_r_proto" in
12068         ''|0) try='char* getlogin_r(char*, int);'
12069         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12070         esac
12071         case "$getlogin_r_proto" in
12072         ''|0)   d_getlogin_r=undef
12073                 getlogin_r_proto=0
12074                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12075         * )     case "$getlogin_r_proto" in
12076                 REENTRANT_PROTO*) ;;
12077                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12078                 esac
12079                 echo "Prototype: $try" ;;
12080         esac
12081         ;;
12082         *)      case "$usethreads" in
12083                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12084                 esac
12085                 d_getlogin_r=undef
12086                 getlogin_r_proto=0
12087                 ;;
12088         esac
12089         ;;
12090 *)      getlogin_r_proto=0
12091         ;;
12092 esac
12093
12094 : see if getmnt exists
12095 set getmnt d_getmnt
12096 eval $inlibc
12097
12098 : see if getmntent exists
12099 set getmntent d_getmntent
12100 eval $inlibc
12101
12102 : see if getnetbyaddr exists
12103 set getnetbyaddr d_getnbyaddr
12104 eval $inlibc
12105
12106 : see if getnetbyname exists
12107 set getnetbyname d_getnbyname
12108 eval $inlibc
12109
12110 : see if getnetent exists
12111 set getnetent d_getnent
12112 eval $inlibc
12113
12114 : see if getnetbyaddr_r exists
12115 set getnetbyaddr_r d_getnetbyaddr_r
12116 eval $inlibc
12117 case "$d_getnetbyaddr_r" in
12118 "$define")
12119         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12120         case "$d_getnetbyaddr_r_proto:$usethreads" in
12121         ":define")      d_getnetbyaddr_r_proto=define
12122                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12123                 eval $hasproto ;;
12124         *)      ;;
12125         esac
12126         case "$d_getnetbyaddr_r_proto" in
12127         define)
12128         case "$getnetbyaddr_r_proto" in
12129         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12130         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12131         esac
12132         case "$getnetbyaddr_r_proto" in
12133         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12134         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12135         esac
12136         case "$getnetbyaddr_r_proto" in
12137         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12138         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12139         esac
12140         case "$getnetbyaddr_r_proto" in
12141         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12142         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12143         esac
12144         case "$getnetbyaddr_r_proto" in
12145         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12146         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12147         esac
12148         case "$getnetbyaddr_r_proto" in
12149         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12150         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12151         esac
12152         case "$getnetbyaddr_r_proto" in
12153         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12154         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12155         esac
12156         case "$getnetbyaddr_r_proto" in
12157         ''|0)   d_getnetbyaddr_r=undef
12158                 getnetbyaddr_r_proto=0
12159                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12160         * )     case "$getnetbyaddr_r_proto" in
12161                 REENTRANT_PROTO*) ;;
12162                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12163                 esac
12164                 echo "Prototype: $try" ;;
12165         esac
12166         ;;
12167         *)      case "$usethreads" in
12168                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12169                 esac
12170                 d_getnetbyaddr_r=undef
12171                 getnetbyaddr_r_proto=0
12172                 ;;
12173         esac
12174         ;;
12175 *)      getnetbyaddr_r_proto=0
12176         ;;
12177 esac
12178
12179 : see if getnetbyname_r exists
12180 set getnetbyname_r d_getnetbyname_r
12181 eval $inlibc
12182 case "$d_getnetbyname_r" in
12183 "$define")
12184         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12185         case "$d_getnetbyname_r_proto:$usethreads" in
12186         ":define")      d_getnetbyname_r_proto=define
12187                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12188                 eval $hasproto ;;
12189         *)      ;;
12190         esac
12191         case "$d_getnetbyname_r_proto" in
12192         define)
12193         case "$getnetbyname_r_proto" in
12194         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12195         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12196         esac
12197         case "$getnetbyname_r_proto" in
12198         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12199         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12200         esac
12201         case "$getnetbyname_r_proto" in
12202         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12203         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12204         esac
12205         case "$getnetbyname_r_proto" in
12206         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12207         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12208         esac
12209         case "$getnetbyname_r_proto" in
12210         ''|0)   d_getnetbyname_r=undef
12211                 getnetbyname_r_proto=0
12212                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12213         * )     case "$getnetbyname_r_proto" in
12214                 REENTRANT_PROTO*) ;;
12215                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12216                 esac
12217                 echo "Prototype: $try" ;;
12218         esac
12219         ;;
12220         *)      case "$usethreads" in
12221                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12222                 esac
12223                 d_getnetbyname_r=undef
12224                 getnetbyname_r_proto=0
12225                 ;;
12226         esac
12227         ;;
12228 *)      getnetbyname_r_proto=0
12229         ;;
12230 esac
12231
12232 : see if getnetent_r exists
12233 set getnetent_r d_getnetent_r
12234 eval $inlibc
12235 case "$d_getnetent_r" in
12236 "$define")
12237         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12238         case "$d_getnetent_r_proto:$usethreads" in
12239         ":define")      d_getnetent_r_proto=define
12240                 set d_getnetent_r_proto getnetent_r $hdrs
12241                 eval $hasproto ;;
12242         *)      ;;
12243         esac
12244         case "$d_getnetent_r_proto" in
12245         define)
12246         case "$getnetent_r_proto" in
12247         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12248         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12249         esac
12250         case "$getnetent_r_proto" in
12251         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12252         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12253         esac
12254         case "$getnetent_r_proto" in
12255         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12256         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12257         esac
12258         case "$getnetent_r_proto" in
12259         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12260         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12261         esac
12262         case "$getnetent_r_proto" in
12263         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12264         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12265         esac
12266         case "$getnetent_r_proto" in
12267         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12268         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12269         esac
12270         case "$getnetent_r_proto" in
12271         ''|0)   d_getnetent_r=undef
12272                 getnetent_r_proto=0
12273                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12274         * )     case "$getnetent_r_proto" in
12275                 REENTRANT_PROTO*) ;;
12276                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12277                 esac
12278                 echo "Prototype: $try" ;;
12279         esac
12280         ;;
12281         *)      case "$usethreads" in
12282                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12283                 esac
12284                 d_getnetent_r=undef
12285                 getnetent_r_proto=0
12286                 ;;
12287         esac
12288         ;;
12289 *)      getnetent_r_proto=0
12290         ;;
12291 esac
12292
12293 : see if prototypes for various getnetxxx netdb.h functions are available
12294 echo " "
12295 set d_getnetprotos getnetent $i_netdb netdb.h
12296 eval $hasproto
12297
12298 : see if getpagesize exists
12299 set getpagesize d_getpagsz
12300 eval $inlibc
12301
12302
12303 : see if getprotobyname exists
12304 set getprotobyname d_getpbyname
12305 eval $inlibc
12306
12307 : see if getprotobynumber exists
12308 set getprotobynumber d_getpbynumber
12309 eval $inlibc
12310
12311 : see if getprotoent exists
12312 set getprotoent d_getpent
12313 eval $inlibc
12314
12315 : see if getpgid exists
12316 set getpgid d_getpgid
12317 eval $inlibc
12318
12319 : see if getpgrp2 exists
12320 set getpgrp2 d_getpgrp2
12321 eval $inlibc
12322
12323 : see if getppid exists
12324 set getppid d_getppid
12325 eval $inlibc
12326
12327 : see if getpriority exists
12328 set getpriority d_getprior
12329 eval $inlibc
12330
12331 : see if getprotobyname_r exists
12332 set getprotobyname_r d_getprotobyname_r
12333 eval $inlibc
12334 case "$d_getprotobyname_r" in
12335 "$define")
12336         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12337         case "$d_getprotobyname_r_proto:$usethreads" in
12338         ":define")      d_getprotobyname_r_proto=define
12339                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12340                 eval $hasproto ;;
12341         *)      ;;
12342         esac
12343         case "$d_getprotobyname_r_proto" in
12344         define)
12345         case "$getprotobyname_r_proto" in
12346         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12347         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12348         esac
12349         case "$getprotobyname_r_proto" in
12350         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12351         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12352         esac
12353         case "$getprotobyname_r_proto" in
12354         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12355         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12356         esac
12357         case "$getprotobyname_r_proto" in
12358         ''|0)   d_getprotobyname_r=undef
12359                 getprotobyname_r_proto=0
12360                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12361         * )     case "$getprotobyname_r_proto" in
12362                 REENTRANT_PROTO*) ;;
12363                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12364                 esac
12365                 echo "Prototype: $try" ;;
12366         esac
12367         ;;
12368         *)      case "$usethreads" in
12369                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12370                 esac
12371                 d_getprotobyname_r=undef
12372                 getprotobyname_r_proto=0
12373                 ;;
12374         esac
12375         ;;
12376 *)      getprotobyname_r_proto=0
12377         ;;
12378 esac
12379
12380 : see if getprotobynumber_r exists
12381 set getprotobynumber_r d_getprotobynumber_r
12382 eval $inlibc
12383 case "$d_getprotobynumber_r" in
12384 "$define")
12385         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12386         case "$d_getprotobynumber_r_proto:$usethreads" in
12387         ":define")      d_getprotobynumber_r_proto=define
12388                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12389                 eval $hasproto ;;
12390         *)      ;;
12391         esac
12392         case "$d_getprotobynumber_r_proto" in
12393         define)
12394         case "$getprotobynumber_r_proto" in
12395         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12396         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12397         esac
12398         case "$getprotobynumber_r_proto" in
12399         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12400         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12401         esac
12402         case "$getprotobynumber_r_proto" in
12403         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12404         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12405         esac
12406         case "$getprotobynumber_r_proto" in
12407         ''|0)   d_getprotobynumber_r=undef
12408                 getprotobynumber_r_proto=0
12409                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12410         * )     case "$getprotobynumber_r_proto" in
12411                 REENTRANT_PROTO*) ;;
12412                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12413                 esac
12414                 echo "Prototype: $try" ;;
12415         esac
12416         ;;
12417         *)      case "$usethreads" in
12418                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12419                 esac
12420                 d_getprotobynumber_r=undef
12421                 getprotobynumber_r_proto=0
12422                 ;;
12423         esac
12424         ;;
12425 *)      getprotobynumber_r_proto=0
12426         ;;
12427 esac
12428
12429 : see if getprotoent_r exists
12430 set getprotoent_r d_getprotoent_r
12431 eval $inlibc
12432 case "$d_getprotoent_r" in
12433 "$define")
12434         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12435         case "$d_getprotoent_r_proto:$usethreads" in
12436         ":define")      d_getprotoent_r_proto=define
12437                 set d_getprotoent_r_proto getprotoent_r $hdrs
12438                 eval $hasproto ;;
12439         *)      ;;
12440         esac
12441         case "$d_getprotoent_r_proto" in
12442         define)
12443         case "$getprotoent_r_proto" in
12444         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12445         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12446         esac
12447         case "$getprotoent_r_proto" in
12448         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12449         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12450         esac
12451         case "$getprotoent_r_proto" in
12452         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12453         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12454         esac
12455         case "$getprotoent_r_proto" in
12456         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12457         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12458         esac
12459         case "$getprotoent_r_proto" in
12460         ''|0)   d_getprotoent_r=undef
12461                 getprotoent_r_proto=0
12462                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12463         * )     case "$getprotoent_r_proto" in
12464                 REENTRANT_PROTO*) ;;
12465                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12466                 esac
12467                 echo "Prototype: $try" ;;
12468         esac
12469         ;;
12470         *)      case "$usethreads" in
12471                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12472                 esac
12473                 d_getprotoent_r=undef
12474                 getprotoent_r_proto=0
12475                 ;;
12476         esac
12477         ;;
12478 *)      getprotoent_r_proto=0
12479         ;;
12480 esac
12481
12482 : see if prototypes for various getprotoxxx netdb.h functions are available
12483 echo " "
12484 set d_getprotoprotos getprotoent $i_netdb netdb.h
12485 eval $hasproto
12486
12487 : see if getprpwnam exists
12488 set getprpwnam d_getprpwnam
12489 eval $inlibc
12490
12491 : see if getpwent exists
12492 set getpwent d_getpwent
12493 eval $inlibc
12494
12495 : see if getpwent_r exists
12496 set getpwent_r d_getpwent_r
12497 eval $inlibc
12498 case "$d_getpwent_r" in
12499 "$define")
12500         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12501         case "$d_getpwent_r_proto:$usethreads" in
12502         ":define")      d_getpwent_r_proto=define
12503                 set d_getpwent_r_proto getpwent_r $hdrs
12504                 eval $hasproto ;;
12505         *)      ;;
12506         esac
12507         case "$d_getpwent_r_proto" in
12508         define)
12509         case "$getpwent_r_proto" in
12510         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12511         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12512         esac
12513         case "$getpwent_r_proto" in
12514         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12515         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12516         esac
12517         case "$getpwent_r_proto" in
12518         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12519         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12520         esac
12521         case "$getpwent_r_proto" in
12522         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12523         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12524         esac
12525         case "$getpwent_r_proto" in
12526         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12527         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12528         esac
12529         case "$getpwent_r_proto" in
12530         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12531         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12532         esac
12533         case "$getpwent_r_proto" in
12534         ''|0)   d_getpwent_r=undef
12535                 getpwent_r_proto=0
12536                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12537         * )     case "$getpwent_r_proto" in
12538                 REENTRANT_PROTO*) ;;
12539                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12540                 esac
12541                 echo "Prototype: $try" ;;
12542         esac
12543         ;;
12544         *)      case "$usethreads" in
12545                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12546                 esac
12547                 d_getpwent_r=undef
12548                 getpwent_r_proto=0
12549                 ;;
12550         esac
12551         ;;
12552 *)      getpwent_r_proto=0
12553         ;;
12554 esac
12555
12556 : see if getpwnam_r exists
12557 set getpwnam_r d_getpwnam_r
12558 eval $inlibc
12559 case "$d_getpwnam_r" in
12560 "$define")
12561         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12562         case "$d_getpwnam_r_proto:$usethreads" in
12563         ":define")      d_getpwnam_r_proto=define
12564                 set d_getpwnam_r_proto getpwnam_r $hdrs
12565                 eval $hasproto ;;
12566         *)      ;;
12567         esac
12568         case "$d_getpwnam_r_proto" in
12569         define)
12570         case "$getpwnam_r_proto" in
12571         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12572         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12573         esac
12574         case "$getpwnam_r_proto" in
12575         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12576         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12577         esac
12578         case "$getpwnam_r_proto" in
12579         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12580         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12581         esac
12582         case "$getpwnam_r_proto" in
12583         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12584         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12585         esac
12586         case "$getpwnam_r_proto" in
12587         ''|0)   d_getpwnam_r=undef
12588                 getpwnam_r_proto=0
12589                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12590         * )     case "$getpwnam_r_proto" in
12591                 REENTRANT_PROTO*) ;;
12592                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12593                 esac
12594                 echo "Prototype: $try" ;;
12595         esac
12596         ;;
12597         *)      case "$usethreads" in
12598                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12599                 esac
12600                 d_getpwnam_r=undef
12601                 getpwnam_r_proto=0
12602                 ;;
12603         esac
12604         ;;
12605 *)      getpwnam_r_proto=0
12606         ;;
12607 esac
12608
12609 : see if getpwuid_r exists
12610 set getpwuid_r d_getpwuid_r
12611 eval $inlibc
12612 case "$d_getpwuid_r" in
12613 "$define")
12614         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12615         case "$d_getpwuid_r_proto:$usethreads" in
12616         ":define")      d_getpwuid_r_proto=define
12617                 set d_getpwuid_r_proto getpwuid_r $hdrs
12618                 eval $hasproto ;;
12619         *)      ;;
12620         esac
12621         case "$d_getpwuid_r_proto" in
12622         define)
12623         case "$getpwuid_r_proto" in
12624         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12625         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12626         esac
12627         case "$getpwuid_r_proto" in
12628         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12629         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12630         esac
12631         case "$getpwuid_r_proto" in
12632         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12633         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12634         esac
12635         case "$getpwuid_r_proto" in
12636         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12637         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12638         esac
12639         case "$getpwuid_r_proto" in
12640         ''|0)   d_getpwuid_r=undef
12641                 getpwuid_r_proto=0
12642                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12643         * )     case "$getpwuid_r_proto" in
12644                 REENTRANT_PROTO*) ;;
12645                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12646                 esac
12647                 echo "Prototype: $try" ;;
12648         esac
12649         ;;
12650         *)      case "$usethreads" in
12651                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12652                 esac
12653                 d_getpwuid_r=undef
12654                 getpwuid_r_proto=0
12655                 ;;
12656         esac
12657         ;;
12658 *)      getpwuid_r_proto=0
12659         ;;
12660 esac
12661
12662
12663 : see if getservbyname exists
12664 set getservbyname d_getsbyname
12665 eval $inlibc
12666
12667 : see if getservbyport exists
12668 set getservbyport d_getsbyport
12669 eval $inlibc
12670
12671 : see if getservent exists
12672 set getservent d_getsent
12673 eval $inlibc
12674
12675 : see if getservbyname_r exists
12676 set getservbyname_r d_getservbyname_r
12677 eval $inlibc
12678 case "$d_getservbyname_r" in
12679 "$define")
12680         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12681         case "$d_getservbyname_r_proto:$usethreads" in
12682         ":define")      d_getservbyname_r_proto=define
12683                 set d_getservbyname_r_proto getservbyname_r $hdrs
12684                 eval $hasproto ;;
12685         *)      ;;
12686         esac
12687         case "$d_getservbyname_r_proto" in
12688         define)
12689         case "$getservbyname_r_proto" in
12690         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12691         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12692         esac
12693         case "$getservbyname_r_proto" in
12694         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12695         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12696         esac
12697         case "$getservbyname_r_proto" in
12698         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12699         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12700         esac
12701         case "$getservbyname_r_proto" in
12702         ''|0)   d_getservbyname_r=undef
12703                 getservbyname_r_proto=0
12704                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12705         * )     case "$getservbyname_r_proto" in
12706                 REENTRANT_PROTO*) ;;
12707                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12708                 esac
12709                 echo "Prototype: $try" ;;
12710         esac
12711         ;;
12712         *)      case "$usethreads" in
12713                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12714                 esac
12715                 d_getservbyname_r=undef
12716                 getservbyname_r_proto=0
12717                 ;;
12718         esac
12719         ;;
12720 *)      getservbyname_r_proto=0
12721         ;;
12722 esac
12723
12724 : see if getservbyport_r exists
12725 set getservbyport_r d_getservbyport_r
12726 eval $inlibc
12727 case "$d_getservbyport_r" in
12728 "$define")
12729         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12730         case "$d_getservbyport_r_proto:$usethreads" in
12731         ":define")      d_getservbyport_r_proto=define
12732                 set d_getservbyport_r_proto getservbyport_r $hdrs
12733                 eval $hasproto ;;
12734         *)      ;;
12735         esac
12736         case "$d_getservbyport_r_proto" in
12737         define)
12738         case "$getservbyport_r_proto" in
12739         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12740         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12741         esac
12742         case "$getservbyport_r_proto" in
12743         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12744         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12745         esac
12746         case "$getservbyport_r_proto" in
12747         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12748         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12749         esac
12750         case "$getservbyport_r_proto" in
12751         ''|0)   d_getservbyport_r=undef
12752                 getservbyport_r_proto=0
12753                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12754         * )     case "$getservbyport_r_proto" in
12755                 REENTRANT_PROTO*) ;;
12756                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12757                 esac
12758                 echo "Prototype: $try" ;;
12759         esac
12760         ;;
12761         *)      case "$usethreads" in
12762                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12763                 esac
12764                 d_getservbyport_r=undef
12765                 getservbyport_r_proto=0
12766                 ;;
12767         esac
12768         ;;
12769 *)      getservbyport_r_proto=0
12770         ;;
12771 esac
12772
12773 : see if getservent_r exists
12774 set getservent_r d_getservent_r
12775 eval $inlibc
12776 case "$d_getservent_r" in
12777 "$define")
12778         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12779         case "$d_getservent_r_proto:$usethreads" in
12780         ":define")      d_getservent_r_proto=define
12781                 set d_getservent_r_proto getservent_r $hdrs
12782                 eval $hasproto ;;
12783         *)      ;;
12784         esac
12785         case "$d_getservent_r_proto" in
12786         define)
12787         case "$getservent_r_proto" in
12788         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12789         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12790         esac
12791         case "$getservent_r_proto" in
12792         ''|0) try='int getservent_r(struct servent*, char*, int);'
12793         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12794         esac
12795         case "$getservent_r_proto" in
12796         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12797         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12798         esac
12799         case "$getservent_r_proto" in
12800         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12801         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12802         esac
12803         case "$getservent_r_proto" in
12804         ''|0)   d_getservent_r=undef
12805                 getservent_r_proto=0
12806                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12807         * )     case "$getservent_r_proto" in
12808                 REENTRANT_PROTO*) ;;
12809                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12810                 esac
12811                 echo "Prototype: $try" ;;
12812         esac
12813         ;;
12814         *)      case "$usethreads" in
12815                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12816                 esac
12817                 d_getservent_r=undef
12818                 getservent_r_proto=0
12819                 ;;
12820         esac
12821         ;;
12822 *)      getservent_r_proto=0
12823         ;;
12824 esac
12825
12826 : see if prototypes for various getservxxx netdb.h functions are available
12827 echo " "
12828 set d_getservprotos getservent $i_netdb netdb.h
12829 eval $hasproto
12830
12831 : see if getspnam exists
12832 set getspnam d_getspnam
12833 eval $inlibc
12834
12835 : see if this is a shadow.h system
12836 set shadow.h i_shadow
12837 eval $inhdr
12838
12839 : see if getspnam_r exists
12840 set getspnam_r d_getspnam_r
12841 eval $inlibc
12842 case "$d_getspnam_r" in
12843 "$define")
12844         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12845         case "$d_getspnam_r_proto:$usethreads" in
12846         ":define")      d_getspnam_r_proto=define
12847                 set d_getspnam_r_proto getspnam_r $hdrs
12848                 eval $hasproto ;;
12849         *)      ;;
12850         esac
12851         case "$d_getspnam_r_proto" in
12852         define)
12853         case "$getspnam_r_proto" in
12854         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12855         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12856         esac
12857         case "$getspnam_r_proto" in
12858         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12859         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12860         esac
12861         case "$getspnam_r_proto" in
12862         ''|0)   d_getspnam_r=undef
12863                 getspnam_r_proto=0
12864                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12865         * )     case "$getspnam_r_proto" in
12866                 REENTRANT_PROTO*) ;;
12867                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12868                 esac
12869                 echo "Prototype: $try" ;;
12870         esac
12871         ;;
12872         *)      case "$usethreads" in
12873                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12874                 esac
12875                 d_getspnam_r=undef
12876                 getspnam_r_proto=0
12877                 ;;
12878         esac
12879         ;;
12880 *)      getspnam_r_proto=0
12881         ;;
12882 esac
12883
12884 : see if gettimeofday or ftime exists
12885 set gettimeofday d_gettimeod
12886 eval $inlibc
12887 case "$d_gettimeod" in
12888 "$undef")
12889         set ftime d_ftime 
12890         eval $inlibc
12891         ;;
12892 *)
12893         val="$undef"; set d_ftime; eval $setvar
12894         ;;
12895 esac
12896 case "$d_gettimeod$d_ftime" in
12897 "$undef$undef")
12898         echo " "
12899         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12900         ;;
12901 esac
12902
12903 : see if gmtime_r exists
12904 set gmtime_r d_gmtime_r
12905 eval $inlibc
12906 case "$d_gmtime_r" in
12907 "$define")
12908         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12909         case "$d_gmtime_r_proto:$usethreads" in
12910         ":define")      d_gmtime_r_proto=define
12911                 set d_gmtime_r_proto gmtime_r $hdrs
12912                 eval $hasproto ;;
12913         *)      ;;
12914         esac
12915         case "$d_gmtime_r_proto" in
12916         define)
12917         case "$gmtime_r_proto" in
12918         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12919         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12920         esac
12921         case "$gmtime_r_proto" in
12922         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12923         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12924         esac
12925         case "$gmtime_r_proto" in
12926         ''|0)   d_gmtime_r=undef
12927                 gmtime_r_proto=0
12928                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12929         * )     case "$gmtime_r_proto" in
12930                 REENTRANT_PROTO*) ;;
12931                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12932                 esac
12933                 echo "Prototype: $try" ;;
12934         esac
12935         ;;
12936         *)      case "$usethreads" in
12937                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12938                 esac
12939                 d_gmtime_r=undef
12940                 gmtime_r_proto=0
12941                 ;;
12942         esac
12943         ;;
12944 *)      gmtime_r_proto=0
12945         ;;
12946 esac
12947
12948 : see if hasmntopt exists
12949 set hasmntopt d_hasmntopt
12950 eval $inlibc
12951
12952 : see if this is a netinet/in.h or sys/in.h system
12953 set netinet/in.h i_niin sys/in.h i_sysin
12954 eval $inhdr
12955
12956 : see if arpa/inet.h has to be included
12957 set arpa/inet.h i_arpainet
12958 eval $inhdr
12959
12960 : see if htonl --and friends-- exists
12961 val=''
12962 set htonl val
12963 eval $inlibc
12964
12965 : Maybe they are macros.
12966 case "$val" in
12967 $undef)
12968         $cat >htonl.c <<EOM
12969 #include <stdio.h>
12970 #include <sys/types.h>
12971 #$i_niin I_NETINET_IN
12972 #$i_sysin I_SYS_IN
12973 #$i_arpainet I_ARPA_INET
12974 #ifdef I_NETINET_IN
12975 #include <netinet/in.h>
12976 #endif
12977 #ifdef I_SYS_IN
12978 #include <sys/in.h>
12979 #endif
12980 #ifdef I_ARPA_INET
12981 #include <arpa/inet.h>
12982 #endif
12983 #ifdef htonl
12984 printf("Defined as a macro.");
12985 #endif
12986 EOM
12987         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12988         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12989                 val="$define"
12990                 echo "But it seems to be defined as a macro." >&4
12991         fi
12992         $rm -f htonl.?
12993         ;;
12994 esac
12995 set d_htonl
12996 eval $setvar
12997
12998 : index or strchr
12999 echo " "
13000 if set index val -f; eval $csym; $val; then
13001         if set strchr val -f d_strchr; eval $csym; $val; then
13002                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13003                         val="$define"
13004                         vali="$undef"
13005                         echo "strchr() found." >&4
13006                 else
13007                         val="$undef"
13008                         vali="$define"
13009                         echo "index() found." >&4
13010                 fi
13011         else
13012                 val="$undef"
13013                 vali="$define"
13014                 echo "index() found." >&4
13015         fi
13016 else
13017         if set strchr val -f d_strchr; eval $csym; $val; then
13018                 val="$define"
13019                 vali="$undef"
13020                 echo "strchr() found." >&4
13021         else
13022                 echo "No index() or strchr() found!" >&4
13023                 val="$undef"
13024                 vali="$undef"
13025         fi
13026 fi
13027 set d_strchr; eval $setvar
13028 val="$vali"
13029 set d_index; eval $setvar
13030
13031 : check whether inet_aton exists
13032 set inet_aton d_inetaton
13033 eval $inlibc
13034
13035 : Look for isascii
13036 echo " "
13037 $cat >isascii.c <<'EOCP'
13038 #include <stdio.h>
13039 #include <ctype.h>
13040 int main() {
13041         int c = 'A';
13042         if (isascii(c))
13043                 exit(0);
13044         else
13045                 exit(1);
13046 }
13047 EOCP
13048 set isascii
13049 if eval $compile; then
13050         echo "isascii() found." >&4
13051         val="$define"
13052 else
13053         echo "isascii() NOT found." >&4
13054         val="$undef"
13055 fi
13056 set d_isascii
13057 eval $setvar
13058 $rm -f isascii*
13059
13060 : see if isfinite exists
13061 set isfinite d_isfinite
13062 eval $inlibc
13063
13064 : see if isinf exists
13065 set isinf d_isinf
13066 eval $inlibc
13067
13068 : see if isnan exists
13069 set isnan d_isnan
13070 eval $inlibc
13071
13072 : see if isnanl exists
13073 set isnanl d_isnanl
13074 eval $inlibc
13075
13076 : see if killpg exists
13077 set killpg d_killpg
13078 eval $inlibc
13079
13080 : see if lchown exists
13081 echo " "
13082 $cat > try.c <<'EOCP'
13083 /* System header to define __stub macros and hopefully few prototypes,
13084     which can conflict with char lchown(); below.  */
13085 #include <assert.h>
13086 /* Override any gcc2 internal prototype to avoid an error.  */
13087 /* We use char because int might match the return type of a gcc2
13088    builtin and then its argument prototype would still apply.  */
13089 char lchown();
13090 int main() {
13091     /*  The GNU C library defines this for functions which it implements
13092         to always fail with ENOSYS.  Some functions are actually named
13093         something starting with __ and the normal name is an alias.  */
13094 #if defined (__stub_lchown) || defined (__stub___lchown)
13095 choke me
13096 #else
13097 lchown();
13098 #endif
13099 ; return 0; }
13100 EOCP
13101 set try
13102 if eval $compile; then
13103     $echo "lchown() found." >&4
13104     val="$define"
13105 else
13106     $echo "lchown() NOT found." >&4
13107     val="$undef"
13108 fi
13109 set d_lchown
13110 eval $setvar
13111
13112 : See if number of significant digits in a double precision number is known
13113 echo " "
13114 $cat >ldbl_dig.c <<EOM
13115 #$i_limits I_LIMITS
13116 #$i_float I_FLOAT
13117 #ifdef I_LIMITS
13118 #include <limits.h>
13119 #endif
13120 #ifdef I_FLOAT
13121 #include <float.h>
13122 #endif
13123 #ifdef LDBL_DIG
13124 printf("Contains LDBL_DIG");
13125 #endif
13126 EOM
13127 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13128 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13129         echo "LDBL_DIG found." >&4
13130         val="$define"
13131 else
13132         echo "LDBL_DIG NOT found." >&4
13133         val="$undef"
13134 fi
13135 $rm -f ldbl_dig.?
13136 set d_ldbl_dig
13137 eval $setvar
13138
13139 : see if link exists
13140 set link d_link
13141 eval $inlibc
13142
13143 : see if localtime_r exists
13144 set localtime_r d_localtime_r
13145 eval $inlibc
13146 case "$d_localtime_r" in
13147 "$define")
13148         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13149         case "$d_localtime_r_proto:$usethreads" in
13150         ":define")      d_localtime_r_proto=define
13151                 set d_localtime_r_proto localtime_r $hdrs
13152                 eval $hasproto ;;
13153         *)      ;;
13154         esac
13155         case "$d_localtime_r_proto" in
13156         define)
13157         case "$localtime_r_proto" in
13158         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13159         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13160         esac
13161         case "$localtime_r_proto" in
13162         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13163         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13164         esac
13165         case "$localtime_r_proto" in
13166         ''|0)   d_localtime_r=undef
13167                 localtime_r_proto=0
13168                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13169         * )     case "$localtime_r_proto" in
13170                 REENTRANT_PROTO*) ;;
13171                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13172                 esac
13173                 echo "Prototype: $try" ;;
13174         esac
13175         ;;
13176         *)      case "$usethreads" in
13177                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13178                 esac
13179                 d_localtime_r=undef
13180                 localtime_r_proto=0
13181                 ;;
13182         esac
13183         ;;
13184 *)      localtime_r_proto=0
13185         ;;
13186 esac
13187
13188 : see if localeconv exists
13189 set localeconv d_locconv
13190 eval $inlibc
13191
13192 : see if lockf exists
13193 set lockf d_lockf
13194 eval $inlibc
13195
13196 : see if prototype for lseek is available
13197 echo " "
13198 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13199 eval $hasproto
13200
13201 : see if lstat exists
13202 set lstat d_lstat
13203 eval $inlibc
13204
13205 : see if madvise exists
13206 set madvise d_madvise
13207 eval $inlibc
13208
13209 : see if mblen exists
13210 set mblen d_mblen
13211 eval $inlibc
13212
13213 : see if mbstowcs exists
13214 set mbstowcs d_mbstowcs
13215 eval $inlibc
13216
13217 : see if mbtowc exists
13218 set mbtowc d_mbtowc
13219 eval $inlibc
13220
13221 : see if memchr exists
13222 set memchr d_memchr
13223 eval $inlibc
13224
13225 : see if memcmp exists
13226 set memcmp d_memcmp
13227 eval $inlibc
13228
13229 : see if memcpy exists
13230 set memcpy d_memcpy
13231 eval $inlibc
13232
13233 : see if memmove exists
13234 set memmove d_memmove
13235 eval $inlibc
13236
13237 : see if memset exists
13238 set memset d_memset
13239 eval $inlibc
13240
13241 : see if mkdir exists
13242 set mkdir d_mkdir
13243 eval $inlibc
13244
13245 : see if mkdtemp exists
13246 set mkdtemp d_mkdtemp
13247 eval $inlibc
13248
13249 : see if mkfifo exists
13250 set mkfifo d_mkfifo
13251 eval $inlibc
13252
13253 : see if mkstemp exists
13254 set mkstemp d_mkstemp
13255 eval $inlibc
13256
13257 : see if mkstemps exists
13258 set mkstemps d_mkstemps
13259 eval $inlibc
13260
13261 : see if mktime exists
13262 set mktime d_mktime
13263 eval $inlibc
13264
13265 : see if this is a sys/mman.h system
13266 set sys/mman.h i_sysmman
13267 eval $inhdr
13268
13269 : see if mmap exists
13270 set mmap d_mmap
13271 eval $inlibc
13272 : see what shmat returns
13273 : default to something harmless
13274 mmaptype='void *'
13275 case "$i_sysmman$d_mmap" in
13276 "$define$define")
13277         $cat >mmap.c <<'END'
13278 #include <sys/mman.h>
13279 void *mmap();
13280 END
13281         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13282                 mmaptype='void *'
13283         else
13284                 mmaptype='caddr_t'
13285         fi
13286         echo "and it returns ($mmaptype)." >&4
13287         ;;
13288 esac
13289
13290
13291
13292 : see if mprotect exists
13293 set mprotect d_mprotect
13294 eval $inlibc
13295
13296 : see if msgctl exists
13297 set msgctl d_msgctl
13298 eval $inlibc
13299
13300 : see if msgget exists
13301 set msgget d_msgget
13302 eval $inlibc
13303
13304 : see if msgsnd exists
13305 set msgsnd d_msgsnd
13306 eval $inlibc
13307
13308 : see if msgrcv exists
13309 set msgrcv d_msgrcv
13310 eval $inlibc
13311
13312 : see how much of the 'msg*(2)' library is present.
13313 h_msg=true
13314 echo " "
13315 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13316 *"$undef"*) h_msg=false;;
13317 esac
13318 case "$osname" in
13319 freebsd)
13320     case "`ipcs 2>&1`" in
13321     "SVID messages"*"not configured"*)
13322         echo "Your $osname does not have the msg*(2) configured." >&4
13323         h_msg=false
13324         val="$undef"
13325         set msgctl d_msgctl
13326         eval $setvar
13327         set msgget d_msgget
13328         eval $setvar
13329         set msgsnd d_msgsnd
13330         eval $setvar
13331         set msgrcv d_msgrcv
13332         eval $setvar
13333         ;;
13334     esac
13335     ;;
13336 esac
13337 : we could also check for sys/ipc.h ...
13338 if $h_msg && $test `./findhdr sys/msg.h`; then
13339         echo "You have the full msg*(2) library." >&4
13340         val="$define"
13341 else
13342         echo "You don't have the full msg*(2) library." >&4
13343         val="$undef"
13344 fi
13345 set d_msg
13346 eval $setvar
13347
13348
13349 echo " "
13350 echo "Checking to see if your system supports struct msghdr..." >&4
13351 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13352 eval $hasstruct
13353 case "$d_msghdr_s" in
13354 "$define")      echo "Yes, it does."   ;;
13355 *)              echo "No, it doesn't." ;;
13356 esac
13357
13358
13359 : see if msync exists
13360 set msync d_msync
13361 eval $inlibc
13362
13363 : see if munmap exists
13364 set munmap d_munmap
13365 eval $inlibc
13366
13367 : see if nice exists
13368 set nice d_nice
13369 eval $inlibc
13370
13371 : see if this is a langinfo.h system
13372 set langinfo.h i_langinfo
13373 eval $inhdr
13374
13375 : see if nl_langinfo exists
13376 set nl_langinfo d_nl_langinfo
13377 eval $inlibc
13378
13379 : check for length of character
13380 echo " "
13381 case "$charsize" in
13382 '')
13383         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13384         $cat >try.c <<'EOCP'
13385 #include <stdio.h>
13386 int main()
13387 {
13388     printf("%d\n", (int)sizeof(char));
13389     exit(0);
13390 }
13391 EOCP
13392         set try
13393         if eval $compile_ok; then
13394                 dflt=`$run ./try`
13395         else
13396                 dflt='1'
13397                 echo "(I can't seem to compile the test program.  Guessing...)"
13398         fi
13399         ;;
13400 *)
13401         dflt="$charsize"
13402         ;;
13403 esac
13404 rp="What is the size of a character (in bytes)?"
13405 . ./myread
13406 charsize="$ans"
13407 $rm -f try.c try
13408
13409 : check for volatile keyword
13410 echo " "
13411 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13412 $cat >try.c <<'EOCP'
13413 main()
13414 {
13415         typedef struct _goo_struct goo_struct;
13416         goo_struct * volatile goo = ((goo_struct *)0);
13417         struct _goo_struct {
13418                 long long_int;
13419                 int reg_int;
13420                 char char_var;
13421         };
13422         typedef unsigned short foo_t;
13423         char *volatile foo;
13424         volatile int bar;
13425         volatile foo_t blech;
13426         foo = foo;
13427 }
13428 EOCP
13429 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13430         val="$define"
13431         echo "Yup, it does."
13432 else
13433         val="$undef"
13434         echo "Nope, it doesn't."
13435 fi
13436 set d_volatile
13437 eval $setvar
13438 $rm -f try.*
13439
13440
13441 echo " "
13442 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13443
13444 case "$use64bitint:$d_quad:$quadtype" in
13445 define:define:?*)
13446         ivtype="$quadtype"
13447         uvtype="$uquadtype"
13448         ivsize=8
13449         uvsize=8
13450         ;;
13451 *)      ivtype="long"
13452         uvtype="unsigned long"
13453         ivsize=$longsize
13454         uvsize=$longsize
13455         ;;
13456 esac
13457
13458 case "$uselongdouble:$d_longdbl" in
13459 define:define)
13460         nvtype="long double"
13461         nvsize=$longdblsize
13462         ;;
13463 *)      nvtype=double
13464         nvsize=$doublesize
13465         ;;
13466 esac
13467
13468 $echo "(IV will be "$ivtype", $ivsize bytes)"
13469 $echo "(UV will be "$uvtype", $uvsize bytes)"
13470 $echo "(NV will be "$nvtype", $nvsize bytes)"
13471
13472 $cat >try.c <<EOCP
13473 #$i_inttypes I_INTTYPES
13474 #ifdef I_INTTYPES
13475 #include <inttypes.h>
13476 #endif
13477 #include <stdio.h>
13478 int main() {
13479 #ifdef INT8
13480    int8_t i =  INT8_MAX;
13481   uint8_t u = UINT8_MAX;
13482   printf("int8_t\n");
13483 #endif
13484 #ifdef INT16
13485    int16_t i =  INT16_MAX;
13486   uint16_t i = UINT16_MAX;
13487   printf("int16_t\n");
13488 #endif
13489 #ifdef INT32
13490    int32_t i =  INT32_MAX;
13491   uint32_t u = UINT32_MAX;
13492   printf("int32_t\n");
13493 #endif
13494 }
13495 EOCP
13496
13497 case "$i8type" in
13498 '')     case "$charsize" in
13499         1)      i8type=char
13500                 u8type="unsigned char"
13501                 i8size=$charsize
13502                 u8size=$charsize
13503                 ;;
13504         esac
13505         ;;
13506 esac
13507 case "$i8type" in
13508 '')     set try -DINT8
13509         if eval $compile; then
13510                 case "`$run ./try`" in
13511                 int8_t) i8type=int8_t
13512                         u8type=uint8_t
13513                         i8size=1
13514                         u8size=1
13515                         ;;
13516                 esac
13517         fi
13518         ;;
13519 esac
13520 case "$i8type" in
13521 '')     if $test $charsize -ge 1; then
13522                 i8type=char
13523                 u8type="unsigned char"
13524                 i8size=$charsize
13525                 u8size=$charsize
13526         fi
13527         ;;
13528 esac
13529
13530 case "$i16type" in
13531 '')     case "$shortsize" in
13532         2)      i16type=short
13533                 u16type="unsigned short"
13534                 i16size=$shortsize
13535                 u16size=$shortsize
13536                 ;;
13537         esac
13538         ;;
13539 esac
13540 case "$i16type" in
13541 '')     set try -DINT16
13542         if eval $compile; then
13543                 case "`$run ./try`" in
13544                 int16_t)
13545                         i16type=int16_t
13546                         u16type=uint16_t
13547                         i16size=2
13548                         u16size=2
13549                         ;;
13550                 esac
13551         fi
13552         ;;
13553 esac
13554 case "$i16type" in
13555 '')     if $test $shortsize -ge 2; then
13556                 i16type=short
13557                 u16type="unsigned short"
13558                 i16size=$shortsize
13559                 u16size=$shortsize
13560         fi
13561         ;;
13562 esac
13563
13564 case "$i32type" in
13565 '')     case "$longsize" in
13566         4)      i32type=long
13567                 u32type="unsigned long"
13568                 i32size=$longsize
13569                 u32size=$longsize
13570                 ;;
13571         *)      case "$intsize" in
13572                 4)      i32type=int
13573                         u32type="unsigned int"
13574                         i32size=$intsize
13575                         u32size=$intsize
13576                         ;;
13577                 esac
13578                 ;;
13579         esac
13580         ;;
13581 esac
13582 case "$i32type" in
13583 '')     set try -DINT32
13584         if eval $compile; then
13585                 case "`$run ./try`" in
13586                 int32_t)
13587                         i32type=int32_t
13588                         u32type=uint32_t
13589                         i32size=4
13590                         u32size=4
13591                         ;;
13592                 esac
13593         fi
13594         ;;
13595 esac
13596 case "$i32type" in
13597 '')     if $test $intsize -ge 4; then
13598                 i32type=int
13599                 u32type="unsigned int"
13600                 i32size=$intsize
13601                 u32size=$intsize
13602         fi
13603         ;;
13604 esac
13605
13606 case "$i64type" in
13607 '')     case "$d_quad:$quadtype" in
13608         define:?*)
13609                 i64type="$quadtype"
13610                 u64type="$uquadtype"
13611                 i64size=8
13612                 u64size=8
13613                 ;;
13614         esac
13615         ;;
13616 esac
13617
13618 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13619 : volatile so that the compiler has to store it out to memory.
13620 if test X"$d_volatile" = X"$define"; then
13621         volatile=volatile
13622 fi
13623 $cat <<EOP >try.c
13624 #include <stdio.h>
13625 #include <sys/types.h>
13626 #include <signal.h>
13627 #ifdef SIGFPE
13628 $volatile int bletched = 0;
13629 $signal_t blech(s) int s; { bletched = 1; }
13630 #endif
13631 int main() {
13632     $uvtype u = 0;
13633     $nvtype d;
13634     int     n = 8 * $uvsize;
13635     int     i;
13636 #ifdef SIGFPE
13637     signal(SIGFPE, blech);
13638 #endif
13639
13640     for (i = 0; i < n; i++) {
13641       u = u << 1 | ($uvtype)1;
13642       d = ($nvtype)u;
13643       if (($uvtype)d != u)
13644         break;
13645       if (d <= 0)
13646         break;
13647       d = ($nvtype)(u - 1);
13648       if (($uvtype)d != (u - 1))
13649         break;
13650 #ifdef SIGFPE
13651       if (bletched) {
13652         break;
13653 #endif
13654       } 
13655     }
13656     printf("%d\n", ((i == n) ? -n : i));
13657     exit(0);
13658 }
13659 EOP
13660 set try
13661
13662 d_nv_preserves_uv="$undef"
13663 if eval $compile; then
13664         nv_preserves_uv_bits="`$run ./try`"
13665 fi
13666 case "$nv_preserves_uv_bits" in
13667 \-[1-9]*)       
13668         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13669         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13670         d_nv_preserves_uv="$define"
13671         ;;
13672 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13673         d_nv_preserves_uv="$undef" ;;
13674 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13675         nv_preserves_uv_bits="$undef" ;;
13676 esac
13677
13678 $rm -f try.* try
13679
13680
13681 : check for off64_t
13682 echo " "
13683 echo "Checking to see if you have off64_t..." >&4
13684 $cat >try.c <<EOCP
13685 #include <sys/types.h>
13686 #include <unistd.h>
13687 int main() { off64_t x = 7; }
13688 EOCP
13689 set try
13690 if eval $compile; then
13691         val="$define"
13692         echo "You have off64_t."
13693 else
13694         val="$undef"
13695         echo "You do not have off64_t."
13696         case "$lseeksize" in
13697         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13698         esac
13699 fi
13700 $rm -f try.* try
13701 set d_off64_t
13702 eval $setvar
13703
13704 : how to create joinable pthreads
13705 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13706         echo " "
13707         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13708         $cat >try.c <<'EOCP'
13709 #include <pthread.h>
13710 int main() {
13711     int detachstate = JOINABLE;
13712 }
13713 EOCP
13714         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13715         if eval $compile; then
13716                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13717                 val="$undef" # Yes, undef.
13718                 set d_old_pthread_create_joinable
13719                 eval $setvar
13720                 val=""
13721                 set old_pthread_create_joinable
13722                 eval $setvar
13723         else
13724                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13725                 if eval $compile; then
13726                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13727                         val="$define"
13728                         set d_old_pthread_create_joinable
13729                         eval $setvar
13730                         val=PTHREAD_CREATE_UNDETACHED
13731                         set old_pthread_create_joinable
13732                         eval $setvar
13733                 else            
13734                         set try -DJOINABLE=__UNDETACHED
13735                         if eval $compile; then
13736                                 echo "You seem to use __UNDETACHED." >&4
13737                                 val="$define"
13738                                 set d_old_pthread_create_joinable
13739                                 eval $setvar
13740                                 val=__UNDETACHED
13741                                 set old_pthread_create_joinable
13742                                 eval $setvar
13743                         else
13744                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13745                                 val="$define"
13746                                 set d_old_pthread_create_joinable
13747                                 eval $setvar
13748                                 val=0
13749                                 set old_pthread_create_joinable
13750                                 eval $setvar
13751                         fi
13752                 fi
13753         fi
13754         $rm -f try try.*
13755 else
13756     d_old_pthread_create_joinable="$undef"
13757     old_pthread_create_joinable=""
13758 fi
13759
13760 : see if pause exists
13761 set pause d_pause
13762 eval $inlibc
13763
13764 : see if pipe exists
13765 set pipe d_pipe
13766 eval $inlibc
13767
13768 : see if poll exists
13769 set poll d_poll
13770 eval $inlibc
13771
13772 : see if readlink exists
13773 set readlink d_readlink
13774 eval $inlibc
13775
13776 echo " "
13777 procselfexe=''
13778 val="$undef"
13779 case "$d_readlink" in
13780 "$define")
13781         if $issymlink /proc/self/exe ; then
13782                 $ls -l /proc/self/exe > reflect
13783                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13784                         echo "You have Linux-like /proc/self/exe."
13785                         procselfexe='"/proc/self/exe"'
13786                         val="$define"
13787                 fi
13788         fi
13789         if $issymlink /proc/curproc/file ; then
13790                 $ls -l /proc/curproc/file > reflect
13791                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13792                         echo "You have BSD-like /proc/curproc/file."
13793                         procselfexe='"/proc/curproc/file"'
13794                         val="$define"
13795                 fi
13796         fi
13797         ;;
13798 esac
13799 $rm -f reflect
13800 set d_procselfexe
13801 eval $setvar
13802
13803 : see whether the pthread_atfork exists
13804 $cat >try.c <<EOP
13805 #include <pthread.h>
13806 #include <stdio.h>
13807 int main() {
13808 #ifdef  PTHREAD_ATFORK
13809         pthread_atfork(NULL,NULL,NULL);
13810 #endif
13811 }
13812 EOP
13813
13814 : see if pthread_atfork exists
13815 set try -DPTHREAD_ATFORK
13816 if eval $compile; then
13817     val="$define"
13818 else
13819     val="$undef"
13820 fi
13821 case "$usethreads" in
13822 $define)
13823         case "$val" in
13824         $define) echo 'pthread_atfork found.' >&4        ;;
13825         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13826         esac
13827 esac
13828 set d_pthread_atfork
13829 eval $setvar
13830
13831
13832 : see whether the various POSIXish _yields exist
13833 $cat >try.c <<EOP
13834 #include <pthread.h>
13835 #include <stdio.h>
13836 int main() {
13837 #ifdef SCHED_YIELD
13838         sched_yield();
13839 #else
13840 #ifdef PTHREAD_YIELD
13841         pthread_yield();
13842 #else
13843 #ifdef PTHREAD_YIELD_NULL
13844         pthread_yield(NULL);
13845 #endif
13846 #endif
13847 #endif
13848 }
13849 EOP
13850 : see if sched_yield exists
13851 set try -DSCHED_YIELD
13852 if eval $compile; then
13853     val="$define"
13854     sched_yield='sched_yield()'
13855 else
13856     val="$undef"
13857 fi
13858 case "$usethreads" in
13859 $define)
13860         case "$val" in
13861         $define) echo 'sched_yield() found.' >&4        ;;
13862         *)       echo 'sched_yield() NOT found.' >&4    ;;
13863         esac
13864 esac
13865 set d_sched_yield
13866 eval $setvar
13867
13868 : see if pthread_yield exists
13869 set try -DPTHREAD_YIELD
13870 if eval $compile; then
13871     val="$define"
13872     case "$sched_yield" in
13873     '') sched_yield='pthread_yield()' ;;
13874     esac
13875 else
13876     set try -DPTHREAD_YIELD_NULL
13877     if eval $compile; then
13878         val="$define"
13879         case "$sched_yield" in
13880         '') sched_yield='pthread_yield(NULL)' ;;
13881         esac
13882     else
13883         val="$undef"
13884     fi
13885 fi
13886 case "$usethreads" in
13887 $define)
13888         case "$val" in
13889         $define) echo 'pthread_yield() found.' >&4      ;;
13890         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13891         esac
13892         ;;
13893 esac
13894 set d_pthread_yield
13895 eval $setvar
13896
13897 case "$sched_yield" in
13898 '') sched_yield=undef ;;
13899 esac
13900
13901 $rm -f try try.*
13902
13903 : see if random_r exists
13904 set random_r d_random_r
13905 eval $inlibc
13906 case "$d_random_r" in
13907 "$define")
13908         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13909         case "$d_random_r_proto:$usethreads" in
13910         ":define")      d_random_r_proto=define
13911                 set d_random_r_proto random_r $hdrs
13912                 eval $hasproto ;;
13913         *)      ;;
13914         esac
13915         case "$d_random_r_proto" in
13916         define)
13917         case "$random_r_proto" in
13918         ''|0) try='int random_r(int*, struct random_data*);'
13919         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13920         esac
13921         case "$random_r_proto" in
13922         ''|0)   d_random_r=undef
13923                 random_r_proto=0
13924                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13925         * )     case "$random_r_proto" in
13926                 REENTRANT_PROTO*) ;;
13927                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13928                 esac
13929                 echo "Prototype: $try" ;;
13930         esac
13931         ;;
13932         *)      case "$usethreads" in
13933                 define) echo "random_r has no prototype, not using it." >&4 ;;
13934                 esac
13935                 d_random_r=undef
13936                 random_r_proto=0
13937                 ;;
13938         esac
13939         ;;
13940 *)      random_r_proto=0
13941         ;;
13942 esac
13943
13944 : see if readdir and friends exist
13945 set readdir d_readdir
13946 eval $inlibc
13947 set seekdir d_seekdir
13948 eval $inlibc
13949 set telldir d_telldir
13950 eval $inlibc
13951 set rewinddir d_rewinddir
13952 eval $inlibc
13953
13954 : see if readdir64_r exists
13955 set readdir64_r d_readdir64_r
13956 eval $inlibc
13957 case "$d_readdir64_r" in
13958 "$define")
13959         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13960         case "$d_readdir64_r_proto:$usethreads" in
13961         ":define")      d_readdir64_r_proto=define
13962                 set d_readdir64_r_proto readdir64_r $hdrs
13963                 eval $hasproto ;;
13964         *)      ;;
13965         esac
13966         case "$d_readdir64_r_proto" in
13967         define)
13968         case "$readdir64_r_proto" in
13969         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13970         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13971         esac
13972         case "$readdir64_r_proto" in
13973         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13974         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13975         esac
13976         case "$readdir64_r_proto" in
13977         ''|0)   d_readdir64_r=undef
13978                 readdir64_r_proto=0
13979                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13980         * )     case "$readdir64_r_proto" in
13981                 REENTRANT_PROTO*) ;;
13982                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13983                 esac
13984                 echo "Prototype: $try" ;;
13985         esac
13986         ;;
13987         *)      case "$usethreads" in
13988                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13989                 esac
13990                 d_readdir64_r=undef
13991                 readdir64_r_proto=0
13992                 ;;
13993         esac
13994         ;;
13995 *)      readdir64_r_proto=0
13996         ;;
13997 esac
13998
13999 : see if readdir_r exists
14000 set readdir_r d_readdir_r
14001 eval $inlibc
14002 case "$d_readdir_r" in
14003 "$define")
14004         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14005         case "$d_readdir_r_proto:$usethreads" in
14006         ":define")      d_readdir_r_proto=define
14007                 set d_readdir_r_proto readdir_r $hdrs
14008                 eval $hasproto ;;
14009         *)      ;;
14010         esac
14011         case "$d_readdir_r_proto" in
14012         define)
14013         case "$readdir_r_proto" in
14014         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14015         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14016         esac
14017         case "$readdir_r_proto" in
14018         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14019         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14020         esac
14021         case "$readdir_r_proto" in
14022         ''|0)   d_readdir_r=undef
14023                 readdir_r_proto=0
14024                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14025         * )     case "$readdir_r_proto" in
14026                 REENTRANT_PROTO*) ;;
14027                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14028                 esac
14029                 echo "Prototype: $try" ;;
14030         esac
14031         ;;
14032         *)      case "$usethreads" in
14033                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14034                 esac
14035                 d_readdir_r=undef
14036                 readdir_r_proto=0
14037                 ;;
14038         esac
14039         ;;
14040 *)      readdir_r_proto=0
14041         ;;
14042 esac
14043
14044 : see if readv exists
14045 set readv d_readv
14046 eval $inlibc
14047
14048 : see if recvmsg exists
14049 set recvmsg d_recvmsg
14050 eval $inlibc
14051
14052 : see if rename exists
14053 set rename d_rename
14054 eval $inlibc
14055
14056 : see if rmdir exists
14057 set rmdir d_rmdir
14058 eval $inlibc
14059
14060 : see if memory.h is available.
14061 val=''
14062 set memory.h val
14063 eval $inhdr
14064
14065 : See if it conflicts with string.h
14066 case "$val" in
14067 $define)
14068         case "$strings" in
14069         '') ;;
14070         *)
14071                 $cppstdin $cppflags $cppminus < $strings > mem.h
14072                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14073                         echo " "
14074                         echo "We won't be including <memory.h>."
14075                         val="$undef"
14076                 fi
14077                 $rm -f mem.h
14078                 ;;
14079         esac
14080 esac
14081 set i_memory
14082 eval $setvar
14083
14084 : can bcopy handle overlapping blocks?
14085 echo " "
14086 val="$undef"
14087 case "$d_memmove" in
14088 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14089 *)      case "$d_bcopy" in
14090         "$define")
14091                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14092                 $cat >try.c <<EOCP
14093 #$i_memory I_MEMORY
14094 #$i_stdlib I_STDLIB
14095 #$i_string I_STRING
14096 #$i_unistd I_UNISTD
14097 EOCP
14098         $cat >>try.c <<'EOCP'
14099 #include <stdio.h>
14100 #ifdef I_MEMORY
14101 #  include <memory.h>
14102 #endif
14103 #ifdef I_STDLIB
14104 #  include <stdlib.h>
14105 #endif
14106 #ifdef I_STRING
14107 #  include <string.h>
14108 #else
14109 #  include <strings.h>
14110 #endif
14111 #ifdef I_UNISTD
14112 #  include <unistd.h>  /* Needed for NetBSD */
14113 #endif
14114 int main()
14115 {
14116 char buf[128], abc[128];
14117 char *b;
14118 int len;
14119 int off;
14120 int align;
14121
14122 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14123    try to store the string in read-only memory. */
14124 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14125
14126 for (align = 7; align >= 0; align--) {
14127         for (len = 36; len; len--) {
14128                 b = buf+align;
14129                 bcopy(abc, b, len);
14130                 for (off = 1; off <= len; off++) {
14131                         bcopy(b, b+off, len);
14132                         bcopy(b+off, b, len);
14133                         if (bcmp(b, abc, len))
14134                                 exit(1);
14135                 }
14136         }
14137 }
14138 exit(0);
14139 }
14140 EOCP
14141                 set try
14142                 if eval $compile_ok; then
14143                         if ./try 2>/dev/null; then
14144                                 echo "Yes, it can."
14145                                 val="$define"
14146                         else
14147                                 echo "It can't, sorry."
14148                         fi
14149                 else
14150                         echo "(I can't compile the test program, so we'll assume not...)"
14151                 fi
14152                 ;;
14153         esac
14154         $rm -f try.* try core
14155         ;;
14156 esac
14157 set d_safebcpy
14158 eval $setvar
14159
14160 : can memcpy handle overlapping blocks?
14161 echo " "
14162 val="$undef"
14163 case "$d_memmove" in
14164 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14165 *)      case "$d_memcpy" in
14166         "$define")
14167                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14168                 $cat >try.c <<EOCP
14169 #$i_memory I_MEMORY
14170 #$i_stdlib I_STDLIB
14171 #$i_string I_STRING
14172 #$i_unistd I_UNISTD
14173 EOCP
14174         $cat >>try.c <<'EOCP'
14175 #include <stdio.h>
14176 #ifdef I_MEMORY
14177 #  include <memory.h>
14178 #endif
14179 #ifdef I_STDLIB
14180 #  include <stdlib.h>
14181 #endif
14182 #ifdef I_STRING
14183 #  include <string.h>
14184 #else
14185 #  include <strings.h>
14186 #endif
14187 #ifdef I_UNISTD
14188 #  include <unistd.h>  /* Needed for NetBSD */
14189 #endif
14190 int main()
14191 {
14192 char buf[128], abc[128];
14193 char *b;
14194 int len;
14195 int off;
14196 int align;
14197
14198 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14199    try to store the string in read-only memory. */
14200 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14201
14202 for (align = 7; align >= 0; align--) {
14203         for (len = 36; len; len--) {
14204                 b = buf+align;
14205                 memcpy(b, abc, len);
14206                 for (off = 1; off <= len; off++) {
14207                         memcpy(b+off, b, len);
14208                         memcpy(b, b+off, len);
14209                         if (memcmp(b, abc, len))
14210                                 exit(1);
14211                 }
14212         }
14213 }
14214 exit(0);
14215 }
14216 EOCP
14217                 set try
14218                 if eval $compile_ok; then
14219                         if ./try 2>/dev/null; then
14220                                 echo "Yes, it can."
14221                                 val="$define"
14222                         else
14223                                 echo "It can't, sorry."
14224                         fi
14225                 else
14226                         echo "(I can't compile the test program, so we'll assume not...)"
14227                 fi
14228                 ;;
14229         esac
14230         $rm -f try.* try core
14231         ;;
14232 esac
14233 set d_safemcpy
14234 eval $setvar
14235
14236 : can memcmp be trusted to compare relative magnitude?
14237 val="$undef"
14238 case "$d_memcmp" in
14239 "$define")
14240         echo " "
14241         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14242         $cat >try.c <<EOCP
14243 #$i_memory I_MEMORY
14244 #$i_stdlib I_STDLIB
14245 #$i_string I_STRING
14246 #$i_unistd I_UNISTD
14247 EOCP
14248         $cat >>try.c <<'EOCP'
14249 #include <stdio.h>
14250 #ifdef I_MEMORY
14251 #  include <memory.h>
14252 #endif
14253 #ifdef I_STDLIB
14254 #  include <stdlib.h>
14255 #endif
14256 #ifdef I_STRING
14257 #  include <string.h>
14258 #else
14259 #  include <strings.h>
14260 #endif
14261 #ifdef I_UNISTD
14262 #  include <unistd.h>  /* Needed for NetBSD */
14263 #endif
14264 int main()
14265 {
14266 char a = -1;
14267 char b = 0;
14268 if ((a < b) && memcmp(&a, &b, 1) < 0)
14269         exit(1);
14270 exit(0);
14271 }
14272 EOCP
14273         set try
14274         if eval $compile_ok; then
14275                 if $run ./try 2>/dev/null; then
14276                         echo "Yes, it can."
14277                         val="$define"
14278                 else
14279                         echo "No, it can't (it uses signed chars)."
14280                 fi
14281         else
14282                 echo "(I can't compile the test program, so we'll assume not...)"
14283         fi
14284         ;;
14285 esac
14286 $rm -f try.* try core
14287 set d_sanemcmp
14288 eval $setvar
14289
14290 : see if prototype for sbrk is available
14291 echo " "
14292 set d_sbrkproto sbrk $i_unistd unistd.h
14293 eval $hasproto
14294
14295 : see if select exists
14296 set select d_select
14297 eval $inlibc
14298
14299 : see if semctl exists
14300 set semctl d_semctl
14301 eval $inlibc
14302
14303 : see if semget exists
14304 set semget d_semget
14305 eval $inlibc
14306
14307 : see if semop exists
14308 set semop d_semop
14309 eval $inlibc
14310
14311 : see how much of the 'sem*(2)' library is present.
14312 h_sem=true
14313 echo " "
14314 case "$d_semctl$d_semget$d_semop" in
14315 *"$undef"*) h_sem=false;;
14316 esac
14317 case "$osname" in
14318 freebsd)
14319     case "`ipcs 2>&1`" in
14320     "SVID messages"*"not configured"*)
14321         echo "Your $osname does not have the sem*(2) configured." >&4
14322         h_sem=false
14323         val="$undef"
14324         set semctl d_semctl
14325         eval $setvar
14326         set semget d_semget
14327         eval $setvar
14328         set semop d_semop
14329         eval $setvar
14330         ;;
14331     esac
14332     ;;
14333 esac
14334 : we could also check for sys/ipc.h ...
14335 if $h_sem && $test `./findhdr sys/sem.h`; then
14336         echo "You have the full sem*(2) library." >&4
14337         val="$define"
14338 else
14339         echo "You don't have the full sem*(2) library." >&4
14340         val="$undef"
14341 fi
14342 set d_sem
14343 eval $setvar
14344
14345 : see whether sys/sem.h defines union semun
14346 echo " "
14347 $cat > try.c <<'END'
14348 #include <sys/types.h>
14349 #include <sys/ipc.h>
14350 #include <sys/sem.h>
14351 int main () { union semun semun; semun.buf = 0; }
14352 END
14353 set try
14354 if eval $compile; then
14355     echo "You have union semun in <sys/sem.h>." >&4
14356     val="$define"
14357 else
14358     echo "You do not have union semun in <sys/sem.h>." >&4
14359     val="$undef"
14360 fi
14361 $rm -f try try.c try.h
14362 set d_union_semun
14363 eval $setvar
14364
14365 : see how to do semctl IPC_STAT
14366 case "$d_sem" in
14367 $define)
14368     : see whether semctl IPC_STAT can use union semun
14369     echo " "
14370     $cat > try.h <<END
14371 #ifndef S_IRUSR
14372 #   ifdef S_IREAD
14373 #       define S_IRUSR S_IREAD
14374 #       define S_IWUSR S_IWRITE
14375 #       define S_IXUSR S_IEXEC
14376 #   else
14377 #       define S_IRUSR 0400
14378 #       define S_IWUSR 0200
14379 #       define S_IXUSR 0100
14380 #   endif
14381 #   define S_IRGRP (S_IRUSR>>3)
14382 #   define S_IWGRP (S_IWUSR>>3)
14383 #   define S_IXGRP (S_IXUSR>>3)
14384 #   define S_IROTH (S_IRUSR>>6)
14385 #   define S_IWOTH (S_IWUSR>>6)
14386 #   define S_IXOTH (S_IXUSR>>6)
14387 #endif
14388 #ifndef S_IRWXU
14389 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14390 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14391 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14392 #endif
14393 END
14394
14395     $cat > try.c <<END
14396 #include <sys/types.h>
14397 #include <sys/ipc.h>
14398 #include <sys/sem.h>
14399 #include <sys/stat.h>
14400 #include <stdio.h>
14401 #include <errno.h>
14402 #include "try.h"
14403 #ifndef errno
14404 extern int errno;
14405 #endif
14406 #$d_union_semun HAS_UNION_SEMUN
14407 int main() {
14408     union semun
14409 #ifndef HAS_UNION_SEMUN
14410     {
14411         int val;
14412         struct semid_ds *buf;
14413         unsigned short *array;
14414     }
14415 #endif
14416     arg;
14417     int sem, st;
14418
14419 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14420     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14421     if (sem > -1) {
14422         struct semid_ds argbuf;
14423         arg.buf = &argbuf;
14424 #       ifdef IPC_STAT
14425         st = semctl(sem, 0, IPC_STAT, arg);
14426         if (st == 0)
14427             printf("semun\n");
14428         else
14429 #       endif /* IPC_STAT */
14430             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14431 #       ifdef IPC_RMID
14432         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14433 #       endif /* IPC_RMID */
14434             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14435     } else
14436 #endif /* IPC_PRIVATE && ... */
14437         printf("semget failed: errno = %d\n", errno);
14438   return 0;
14439 }
14440 END
14441     val="$undef"
14442     set try
14443     if eval $compile; then
14444         xxx=`$run ./try`
14445         case "$xxx" in
14446         semun) val="$define" ;;
14447         esac
14448     fi
14449     $rm -f try try.c
14450     set d_semctl_semun
14451     eval $setvar
14452     case "$d_semctl_semun" in
14453     $define)
14454         echo "You can use union semun for semctl IPC_STAT." >&4
14455         also='also'
14456         ;;
14457     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14458         also=''
14459         ;;
14460     esac
14461
14462     : see whether semctl IPC_STAT can use struct semid_ds pointer
14463     $cat > try.c <<'END'
14464 #include <sys/types.h>
14465 #include <sys/ipc.h>
14466 #include <sys/sem.h>
14467 #include <sys/stat.h>
14468 #include "try.h"
14469 #include <stdio.h>
14470 #include <errno.h>
14471 #ifndef errno
14472 extern int errno;
14473 #endif
14474 int main() {
14475     struct semid_ds arg;
14476     int sem, st;
14477
14478 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14479     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14480     if (sem > -1) {
14481 #       ifdef IPC_STAT
14482         st = semctl(sem, 0, IPC_STAT, &arg);
14483         if (st == 0)
14484             printf("semid_ds\n");
14485         else
14486 #       endif /* IPC_STAT */
14487             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14488 #       ifdef IPC_RMID
14489         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14490 #       endif /* IPC_RMID */
14491             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14492     } else
14493 #endif /* IPC_PRIVATE && ... */
14494         printf("semget failed: errno = %d\n", errno);
14495
14496     return 0;
14497 }
14498 END
14499     val="$undef"
14500     set try
14501     if eval $compile; then
14502         xxx=`$run ./try`
14503         case "$xxx" in
14504         semid_ds) val="$define" ;;
14505         esac
14506     fi
14507     $rm -f try try.c
14508     set d_semctl_semid_ds
14509     eval $setvar
14510     case "$d_semctl_semid_ds" in
14511     $define)
14512         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14513         ;;
14514     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14515         ;;
14516     esac
14517     $rm -f try.h
14518     ;;
14519 *)  val="$undef"
14520
14521     # We do not have the full sem*(2) library, so assume we can not
14522     # use either.
14523
14524     set d_semctl_semun
14525     eval $setvar
14526
14527     set d_semctl_semid_ds
14528     eval $setvar
14529     ;;
14530 esac
14531
14532 : see if sendmsg exists
14533 set sendmsg d_sendmsg
14534 eval $inlibc
14535
14536 : see if setegid exists
14537 set setegid d_setegid
14538 eval $inlibc
14539
14540 : see if seteuid exists
14541 set seteuid d_seteuid
14542 eval $inlibc
14543
14544 : see if setgrent exists
14545 set setgrent d_setgrent
14546 eval $inlibc
14547
14548 : see if setgrent_r exists
14549 set setgrent_r d_setgrent_r
14550 eval $inlibc
14551 case "$d_setgrent_r" in
14552 "$define")
14553         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14554         case "$d_setgrent_r_proto:$usethreads" in
14555         ":define")      d_setgrent_r_proto=define
14556                 set d_setgrent_r_proto setgrent_r $hdrs
14557                 eval $hasproto ;;
14558         *)      ;;
14559         esac
14560         case "$d_setgrent_r_proto" in
14561         define)
14562         case "$setgrent_r_proto" in
14563         ''|0) try='int setgrent_r(FILE**);'
14564         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14565         esac
14566         case "$setgrent_r_proto" in
14567         ''|0) try='void setgrent_r(FILE**);'
14568         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14569         esac
14570         case "$setgrent_r_proto" in
14571         ''|0)   d_setgrent_r=undef
14572                 setgrent_r_proto=0
14573                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14574         * )     case "$setgrent_r_proto" in
14575                 REENTRANT_PROTO*) ;;
14576                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14577                 esac
14578                 echo "Prototype: $try" ;;
14579         esac
14580         ;;
14581         *)      case "$usethreads" in
14582                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14583                 esac
14584                 d_setgrent_r=undef
14585                 setgrent_r_proto=0
14586                 ;;
14587         esac
14588         ;;
14589 *)      setgrent_r_proto=0
14590         ;;
14591 esac
14592
14593 : see if sethostent exists
14594 set sethostent d_sethent
14595 eval $inlibc
14596
14597 : see if sethostent_r exists
14598 set sethostent_r d_sethostent_r
14599 eval $inlibc
14600 case "$d_sethostent_r" in
14601 "$define")
14602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14603         case "$d_sethostent_r_proto:$usethreads" in
14604         ":define")      d_sethostent_r_proto=define
14605                 set d_sethostent_r_proto sethostent_r $hdrs
14606                 eval $hasproto ;;
14607         *)      ;;
14608         esac
14609         case "$d_sethostent_r_proto" in
14610         define)
14611         case "$sethostent_r_proto" in
14612         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14613         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14614         esac
14615         case "$sethostent_r_proto" in
14616         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14617         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14618         esac
14619         case "$sethostent_r_proto" in
14620         ''|0)   d_sethostent_r=undef
14621                 sethostent_r_proto=0
14622                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14623         * )     case "$sethostent_r_proto" in
14624                 REENTRANT_PROTO*) ;;
14625                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14626                 esac
14627                 echo "Prototype: $try" ;;
14628         esac
14629         ;;
14630         *)      case "$usethreads" in
14631                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14632                 esac
14633                 d_sethostent_r=undef
14634                 sethostent_r_proto=0
14635                 ;;
14636         esac
14637         ;;
14638 *)      sethostent_r_proto=0
14639         ;;
14640 esac
14641
14642 : see if setitimer exists
14643 set setitimer d_setitimer
14644 eval $inlibc
14645
14646 : see if setlinebuf exists
14647 set setlinebuf d_setlinebuf
14648 eval $inlibc
14649
14650 : see if setlocale exists
14651 set setlocale d_setlocale
14652 eval $inlibc
14653
14654 : see if locale.h is available
14655 set locale.h i_locale
14656 eval $inhdr
14657
14658 : see if setlocale_r exists
14659 set setlocale_r d_setlocale_r
14660 eval $inlibc
14661 case "$d_setlocale_r" in
14662 "$define")
14663         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14664         case "$d_setlocale_r_proto:$usethreads" in
14665         ":define")      d_setlocale_r_proto=define
14666                 set d_setlocale_r_proto setlocale_r $hdrs
14667                 eval $hasproto ;;
14668         *)      ;;
14669         esac
14670         case "$d_setlocale_r_proto" in
14671         define)
14672         case "$setlocale_r_proto" in
14673         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14674         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14675         esac
14676         case "$setlocale_r_proto" in
14677         ''|0)   d_setlocale_r=undef
14678                 setlocale_r_proto=0
14679                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14680         * )     case "$setlocale_r_proto" in
14681                 REENTRANT_PROTO*) ;;
14682                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14683                 esac
14684                 echo "Prototype: $try" ;;
14685         esac
14686         ;;
14687         *)      case "$usethreads" in
14688                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14689                 esac
14690                 d_setlocale_r=undef
14691                 setlocale_r_proto=0
14692                 ;;
14693         esac
14694         ;;
14695 *)      setlocale_r_proto=0
14696         ;;
14697 esac
14698
14699 : see if setnetent exists
14700 set setnetent d_setnent
14701 eval $inlibc
14702
14703 : see if setnetent_r exists
14704 set setnetent_r d_setnetent_r
14705 eval $inlibc
14706 case "$d_setnetent_r" in
14707 "$define")
14708         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14709         case "$d_setnetent_r_proto:$usethreads" in
14710         ":define")      d_setnetent_r_proto=define
14711                 set d_setnetent_r_proto setnetent_r $hdrs
14712                 eval $hasproto ;;
14713         *)      ;;
14714         esac
14715         case "$d_setnetent_r_proto" in
14716         define)
14717         case "$setnetent_r_proto" in
14718         ''|0) try='int setnetent_r(int, struct netent_data*);'
14719         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14720         esac
14721         case "$setnetent_r_proto" in
14722         ''|0) try='void setnetent_r(int, struct netent_data*);'
14723         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14724         esac
14725         case "$setnetent_r_proto" in
14726         ''|0)   d_setnetent_r=undef
14727                 setnetent_r_proto=0
14728                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14729         * )     case "$setnetent_r_proto" in
14730                 REENTRANT_PROTO*) ;;
14731                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14732                 esac
14733                 echo "Prototype: $try" ;;
14734         esac
14735         ;;
14736         *)      case "$usethreads" in
14737                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14738                 esac
14739                 d_setnetent_r=undef
14740                 setnetent_r_proto=0
14741                 ;;
14742         esac
14743         ;;
14744 *)      setnetent_r_proto=0
14745         ;;
14746 esac
14747
14748 : see if setprotoent exists
14749 set setprotoent d_setpent
14750 eval $inlibc
14751
14752 : see if setpgid exists
14753 set setpgid d_setpgid
14754 eval $inlibc
14755
14756 : see if setpgrp2 exists
14757 set setpgrp2 d_setpgrp2
14758 eval $inlibc
14759
14760 : see if setpriority exists
14761 set setpriority d_setprior
14762 eval $inlibc
14763
14764 : see if setproctitle exists
14765 set setproctitle d_setproctitle
14766 eval $inlibc
14767
14768 : see if setprotoent_r exists
14769 set setprotoent_r d_setprotoent_r
14770 eval $inlibc
14771 case "$d_setprotoent_r" in
14772 "$define")
14773         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14774         case "$d_setprotoent_r_proto:$usethreads" in
14775         ":define")      d_setprotoent_r_proto=define
14776                 set d_setprotoent_r_proto setprotoent_r $hdrs
14777                 eval $hasproto ;;
14778         *)      ;;
14779         esac
14780         case "$d_setprotoent_r_proto" in
14781         define)
14782         case "$setprotoent_r_proto" in
14783         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14784         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14785         esac
14786         case "$setprotoent_r_proto" in
14787         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14788         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14789         esac
14790         case "$setprotoent_r_proto" in
14791         ''|0)   d_setprotoent_r=undef
14792                 setprotoent_r_proto=0
14793                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14794         * )     case "$setprotoent_r_proto" in
14795                 REENTRANT_PROTO*) ;;
14796                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14797                 esac
14798                 echo "Prototype: $try" ;;
14799         esac
14800         ;;
14801         *)      case "$usethreads" in
14802                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14803                 esac
14804                 d_setprotoent_r=undef
14805                 setprotoent_r_proto=0
14806                 ;;
14807         esac
14808         ;;
14809 *)      setprotoent_r_proto=0
14810         ;;
14811 esac
14812
14813 : see if setpwent exists
14814 set setpwent d_setpwent
14815 eval $inlibc
14816
14817 : see if setpwent_r exists
14818 set setpwent_r d_setpwent_r
14819 eval $inlibc
14820 case "$d_setpwent_r" in
14821 "$define")
14822         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14823         case "$d_setpwent_r_proto:$usethreads" in
14824         ":define")      d_setpwent_r_proto=define
14825                 set d_setpwent_r_proto setpwent_r $hdrs
14826                 eval $hasproto ;;
14827         *)      ;;
14828         esac
14829         case "$d_setpwent_r_proto" in
14830         define)
14831         case "$setpwent_r_proto" in
14832         ''|0) try='int setpwent_r(FILE**);'
14833         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14834         esac
14835         case "$setpwent_r_proto" in
14836         ''|0) try='void setpwent_r(FILE**);'
14837         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14838         esac
14839         case "$setpwent_r_proto" in
14840         ''|0)   d_setpwent_r=undef
14841                 setpwent_r_proto=0
14842                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14843         * )     case "$setpwent_r_proto" in
14844                 REENTRANT_PROTO*) ;;
14845                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14846                 esac
14847                 echo "Prototype: $try" ;;
14848         esac
14849         ;;
14850         *)      case "$usethreads" in
14851                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14852                 esac
14853                 d_setpwent_r=undef
14854                 setpwent_r_proto=0
14855                 ;;
14856         esac
14857         ;;
14858 *)      setpwent_r_proto=0
14859         ;;
14860 esac
14861
14862 : see if setregid exists
14863 set setregid d_setregid
14864 eval $inlibc
14865 set setresgid d_setresgid
14866 eval $inlibc
14867
14868 : see if setreuid exists
14869 set setreuid d_setreuid
14870 eval $inlibc
14871 set setresuid d_setresuid
14872 eval $inlibc
14873
14874 : see if setrgid exists
14875 set setrgid d_setrgid
14876 eval $inlibc
14877
14878 : see if setruid exists
14879 set setruid d_setruid
14880 eval $inlibc
14881
14882 : see if setservent exists
14883 set setservent d_setsent
14884 eval $inlibc
14885
14886 : see if setservent_r exists
14887 set setservent_r d_setservent_r
14888 eval $inlibc
14889 case "$d_setservent_r" in
14890 "$define")
14891         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14892         case "$d_setservent_r_proto:$usethreads" in
14893         ":define")      d_setservent_r_proto=define
14894                 set d_setservent_r_proto setservent_r $hdrs
14895                 eval $hasproto ;;
14896         *)      ;;
14897         esac
14898         case "$d_setservent_r_proto" in
14899         define)
14900         case "$setservent_r_proto" in
14901         ''|0) try='int setservent_r(int, struct servent_data*);'
14902         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14903         esac
14904         case "$setservent_r_proto" in
14905         ''|0) try='void setservent_r(int, struct servent_data*);'
14906         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14907         esac
14908         case "$setservent_r_proto" in
14909         ''|0)   d_setservent_r=undef
14910                 setservent_r_proto=0
14911                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14912         * )     case "$setservent_r_proto" in
14913                 REENTRANT_PROTO*) ;;
14914                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14915                 esac
14916                 echo "Prototype: $try" ;;
14917         esac
14918         ;;
14919         *)      case "$usethreads" in
14920                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14921                 esac
14922                 d_setservent_r=undef
14923                 setservent_r_proto=0
14924                 ;;
14925         esac
14926         ;;
14927 *)      setservent_r_proto=0
14928         ;;
14929 esac
14930
14931 : see if setsid exists
14932 set setsid d_setsid
14933 eval $inlibc
14934
14935 : see if setvbuf exists
14936 set setvbuf d_setvbuf
14937 eval $inlibc
14938
14939 : see if sfio.h is available
14940 set sfio.h i_sfio
14941 eval $inhdr
14942
14943
14944 : see if sfio library is available
14945 case "$i_sfio" in
14946 $define)
14947         val=''
14948         set sfreserve val
14949         eval $inlibc
14950         ;;
14951 *)
14952         val="$undef"
14953         ;;
14954 esac
14955 : Ok, but do we want to use it.
14956 case "$val" in
14957 $define)
14958         case "$usesfio" in
14959         true|$define|[yY]*) dflt='y';;
14960         *) dflt='n';;
14961         esac
14962         echo "$package can use the sfio library, but it is experimental."
14963         case "$useperlio" in
14964         "$undef")
14965             echo "For sfio also the PerlIO abstraction layer is needed."
14966             echo "Earlier you said you wouldn't want that."
14967             ;;
14968         esac
14969         rp="You seem to have sfio available, do you want to try using it?"
14970         . ./myread
14971         case "$ans" in
14972         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14973                 useperlio="$define"
14974                 val="$define"
14975                 ;;
14976         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14977                 val="$undef"
14978                 ;;
14979         esac
14980         ;;
14981 *)      case "$usesfio" in
14982         true|$define|[yY]*)
14983                 echo "Sorry, cannot find sfio on this machine." >&4
14984                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14985                 val="$undef"
14986                 ;;
14987         esac
14988         ;;
14989 esac
14990 set d_sfio
14991 eval $setvar
14992 case "$d_sfio" in
14993 $define) usesfio='true';;
14994 *) usesfio='false';;
14995 esac
14996 case "$d_sfio" in
14997 $define) ;;
14998 *)      : Remove sfio from list of libraries to use
14999         case "$libs" in
15000         *-lsfio*)
15001                 echo "Removing unneeded -lsfio from library list" >&4
15002                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15003                 shift
15004                 libs="$*"
15005                 echo "libs = $libs" >&4
15006                 ;;
15007         esac
15008 ;;
15009 esac
15010
15011
15012 : see if shmctl exists
15013 set shmctl d_shmctl
15014 eval $inlibc
15015
15016 : see if shmget exists
15017 set shmget d_shmget
15018 eval $inlibc
15019
15020 : see if shmat exists
15021 set shmat d_shmat
15022 eval $inlibc
15023 : see what shmat returns
15024 case "$d_shmat" in
15025 "$define")
15026         $cat >shmat.c <<'END'
15027 #include <sys/shm.h>
15028 void *shmat();
15029 END
15030         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15031                 shmattype='void *'
15032         else
15033                 shmattype='char *'
15034         fi
15035         echo "and it returns ($shmattype)." >&4
15036         : see if a prototype for shmat is available
15037         xxx=`./findhdr sys/shm.h`
15038         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15039         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15040                 val="$define"
15041         else
15042                 val="$undef"
15043         fi
15044         $rm -f shmat.[co]
15045         ;;
15046 *)
15047         val="$undef"
15048         ;;
15049 esac
15050 set d_shmatprototype
15051 eval $setvar
15052
15053 : see if shmdt exists
15054 set shmdt d_shmdt
15055 eval $inlibc
15056
15057 : see how much of the 'shm*(2)' library is present.
15058 h_shm=true
15059 echo " "
15060 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15061 *"$undef"*) h_shm=false;;
15062 esac
15063 case "$osname" in
15064 freebsd)
15065     case "`ipcs 2>&1`" in
15066     "SVID shared memory"*"not configured"*)
15067         echo "Your $osname does not have the shm*(2) configured." >&4
15068         h_shm=false
15069         val="$undef"
15070         set shmctl d_shmctl
15071         evat $setvar
15072         set shmget d_shmget
15073         evat $setvar
15074         set shmat d_shmat
15075         evat $setvar
15076         set shmdt d_shmdt
15077         evat $setvar
15078         ;;
15079     esac
15080     ;;
15081 esac
15082 : we could also check for sys/ipc.h ...
15083 if $h_shm && $test `./findhdr sys/shm.h`; then
15084         echo "You have the full shm*(2) library." >&4
15085         val="$define"
15086 else
15087         echo "You don't have the full shm*(2) library." >&4
15088         val="$undef"
15089 fi
15090 set d_shm
15091 eval $setvar
15092
15093 echo " "
15094 : see if we have sigaction
15095 if set sigaction val -f d_sigaction; eval $csym; $val; then
15096         echo 'sigaction() found.' >&4
15097         $cat > try.c <<'EOP'
15098 #include <stdio.h>
15099 #include <sys/types.h>
15100 #include <signal.h>
15101 int main()
15102 {
15103     struct sigaction act, oact;
15104     act.sa_flags = 0;
15105     oact.sa_handler = 0;
15106     /* so that act and oact are used */
15107     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15108 }
15109 EOP
15110         set try
15111         if eval $compile_ok; then
15112                 val="$define"
15113         else
15114                 echo "But you don't seem to have a useable struct sigaction." >&4
15115                 val="$undef"
15116         fi
15117 else
15118         echo 'sigaction NOT found.' >&4
15119         val="$undef"
15120 fi
15121 set d_sigaction; eval $setvar
15122 $rm -f try try$_o try.c
15123
15124 : see if sigprocmask exists
15125 set sigprocmask d_sigprocmask
15126 eval $inlibc
15127
15128 : see if sigsetjmp exists
15129 echo " "
15130 case "$d_sigsetjmp" in
15131 '')
15132         $cat >try.c <<'EOP'
15133 #include <setjmp.h>
15134 sigjmp_buf env;
15135 int set = 1;
15136 int main()
15137 {
15138         if (sigsetjmp(env,1))
15139                 exit(set);
15140         set = 0;
15141         siglongjmp(env, 1);
15142         exit(1);
15143 }
15144 EOP
15145         set try
15146         if eval $compile; then
15147                 if $run ./try >/dev/null 2>&1; then
15148                         echo "POSIX sigsetjmp found." >&4
15149                         val="$define"
15150                 else
15151                         $cat >&4 <<EOM
15152 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15153 I'll ignore them.
15154 EOM
15155                         val="$undef"
15156                 fi
15157         else
15158                 echo "sigsetjmp not found." >&4
15159                 val="$undef"
15160         fi
15161         ;;
15162 *) val="$d_sigsetjmp"
15163         case "$d_sigsetjmp" in
15164         $define) echo "POSIX sigsetjmp found." >&4;;
15165         $undef) echo "sigsetjmp not found." >&4;;
15166         esac
15167         ;;
15168 esac
15169 set d_sigsetjmp
15170 eval $setvar
15171 $rm -f try.c try
15172
15173 : see if sockatmark exists
15174 set sockatmark d_sockatmark
15175 eval $inlibc
15176
15177 : see if prototype for sockatmark is available
15178 echo " "
15179 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15180 eval $hasproto
15181
15182 : see if socks5_init exists
15183 set socks5_init d_socks5_init
15184 eval $inlibc
15185
15186 : see if srand48_r exists
15187 set srand48_r d_srand48_r
15188 eval $inlibc
15189 case "$d_srand48_r" in
15190 "$define")
15191         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15192         case "$d_srand48_r_proto:$usethreads" in
15193         ":define")      d_srand48_r_proto=define
15194                 set d_srand48_r_proto srand48_r $hdrs
15195                 eval $hasproto ;;
15196         *)      ;;
15197         esac
15198         case "$d_srand48_r_proto" in
15199         define)
15200         case "$srand48_r_proto" in
15201         ''|0) try='int srand48_r(long, struct drand48_data*);'
15202         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15203         esac
15204         case "$srand48_r_proto" in
15205         ''|0)   d_srand48_r=undef
15206                 srand48_r_proto=0
15207                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15208         * )     case "$srand48_r_proto" in
15209                 REENTRANT_PROTO*) ;;
15210                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15211                 esac
15212                 echo "Prototype: $try" ;;
15213         esac
15214         ;;
15215         *)      case "$usethreads" in
15216                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15217                 esac
15218                 d_srand48_r=undef
15219                 srand48_r_proto=0
15220                 ;;
15221         esac
15222         ;;
15223 *)      srand48_r_proto=0
15224         ;;
15225 esac
15226
15227 : see if srandom_r exists
15228 set srandom_r d_srandom_r
15229 eval $inlibc
15230 case "$d_srandom_r" in
15231 "$define")
15232         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15233         case "$d_srandom_r_proto:$usethreads" in
15234         ":define")      d_srandom_r_proto=define
15235                 set d_srandom_r_proto srandom_r $hdrs
15236                 eval $hasproto ;;
15237         *)      ;;
15238         esac
15239         case "$d_srandom_r_proto" in
15240         define)
15241         case "$srandom_r_proto" in
15242         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15243         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15244         esac
15245         case "$srandom_r_proto" in
15246         ''|0)   d_srandom_r=undef
15247                 srandom_r_proto=0
15248                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15249         * )     case "$srandom_r_proto" in
15250                 REENTRANT_PROTO*) ;;
15251                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15252                 esac
15253                 echo "Prototype: $try" ;;
15254         esac
15255         ;;
15256         *)      case "$usethreads" in
15257                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15258                 esac
15259                 d_srandom_r=undef
15260                 srandom_r_proto=0
15261                 ;;
15262         esac
15263         ;;
15264 *)      srandom_r_proto=0
15265         ;;
15266 esac
15267
15268 : see if prototype for setresgid is available
15269 echo " "
15270 set d_sresgproto setresgid $i_unistd unistd.h
15271 eval $hasproto
15272
15273 : see if prototype for setresuid is available
15274 echo " "
15275 set d_sresuproto setresuid $i_unistd unistd.h
15276 eval $hasproto
15277
15278 : see if sys/stat.h is available
15279 set sys/stat.h i_sysstat
15280 eval $inhdr
15281
15282
15283 : see if stat knows about block sizes
15284 echo " "
15285 echo "Checking to see if your struct stat has st_blocks field..." >&4
15286 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15287 eval $hasfield
15288
15289
15290 : see if this is a sys/vfs.h system
15291 set sys/vfs.h i_sysvfs
15292 eval $inhdr
15293
15294
15295 : see if this is a sys/statfs.h system
15296 set sys/statfs.h i_sysstatfs
15297 eval $inhdr
15298
15299
15300 echo " "
15301 echo "Checking to see if your system supports struct statfs..." >&4
15302 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
15303 eval $hasstruct
15304 case "$d_statfs_s" in
15305 "$define")      echo "Yes, it does."   ;;
15306 *)              echo "No, it doesn't." ;;
15307 esac
15308
15309
15310
15311 : see if struct statfs knows about f_flags
15312 case "$d_statfs_s" in
15313 define) 
15314         echo " "
15315         echo "Checking to see if your struct statfs has f_flags field..." >&4
15316         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
15317         eval $hasfield
15318         ;;
15319 *)      val="$undef"
15320         set d_statfs_f_flags
15321         eval $setvar
15322         ;;
15323 esac
15324 case "$d_statfs_f_flags" in
15325 "$define")      echo "Yes, it does."   ;;
15326 *)              echo "No, it doesn't." ;;
15327 esac
15328
15329 : see if _ptr and _cnt from stdio act std
15330 echo " "
15331
15332 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15333         echo "(Looks like you have stdio.h from BSD.)"
15334         case "$stdio_ptr" in
15335         '') stdio_ptr='((fp)->_p)'
15336                 ptr_lval=$define
15337                 ;;
15338         *)      ptr_lval=$d_stdio_ptr_lval;;
15339         esac
15340         case "$stdio_cnt" in
15341         '') stdio_cnt='((fp)->_r)'
15342                 cnt_lval=$define
15343                 ;;
15344         *)      cnt_lval=$d_stdio_cnt_lval;;
15345         esac
15346         case "$stdio_base" in
15347         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15348         esac
15349         case "$stdio_bufsiz" in
15350         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15351         esac
15352 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15353         echo "(Looks like you have stdio.h from Linux.)"
15354         case "$stdio_ptr" in
15355         '') stdio_ptr='((fp)->_IO_read_ptr)'
15356                 ptr_lval=$define
15357                 ;;
15358         *)      ptr_lval=$d_stdio_ptr_lval;;
15359         esac
15360         case "$stdio_cnt" in
15361         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15362                 cnt_lval=$undef
15363                 ;;
15364         *)      cnt_lval=$d_stdio_cnt_lval;;
15365         esac
15366         case "$stdio_base" in
15367         '') stdio_base='((fp)->_IO_read_base)';;
15368         esac
15369         case "$stdio_bufsiz" in
15370         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15371         esac
15372 else
15373         case "$stdio_ptr" in
15374         '') stdio_ptr='((fp)->_ptr)'
15375                 ptr_lval=$define
15376                 ;;
15377         *)      ptr_lval=$d_stdio_ptr_lval;;
15378         esac
15379         case "$stdio_cnt" in
15380         '') stdio_cnt='((fp)->_cnt)'
15381                 cnt_lval=$define
15382                 ;;
15383         *)      cnt_lval=$d_stdio_cnt_lval;;
15384         esac
15385         case "$stdio_base" in
15386         '') stdio_base='((fp)->_base)';;
15387         esac
15388         case "$stdio_bufsiz" in
15389         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15390         esac
15391 fi
15392
15393 : test whether _ptr and _cnt really work
15394 echo "Checking how std your stdio is..." >&4
15395 $cat >try.c <<EOP
15396 #include <stdio.h>
15397 #define FILE_ptr(fp)    $stdio_ptr
15398 #define FILE_cnt(fp)    $stdio_cnt
15399 int main() {
15400         FILE *fp = fopen("try.c", "r");
15401         char c = getc(fp);
15402         if (
15403                 18 <= FILE_cnt(fp) &&
15404                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15405         )
15406                 exit(0);
15407         exit(1);
15408 }
15409 EOP
15410 val="$undef"
15411 set try
15412 if eval $compile && $to try.c; then
15413         if $run ./try; then
15414                 echo "Your stdio acts pretty std."
15415                 val="$define"
15416         else
15417                 echo "Your stdio isn't very std."
15418         fi
15419 else
15420         echo "Your stdio doesn't appear very std."
15421 fi
15422 $rm -f try.c try
15423
15424 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15425 # direct buffer manipulation no longer works.  The Configure tests
15426 # should be changed to correctly detect this, but until then,
15427 # the following check should at least let perl compile and run.
15428 # (This quick fix should be updated before 5.8.1.)
15429 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15430 # A. Dougherty, June 3, 2002.
15431 case "$d_gnulibc" in
15432 $define)
15433         case "$gnulibc_version" in
15434         2.[01]*)  ;;
15435         2.2) ;;
15436         2.2.[0-9]) ;;
15437         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15438                 val="$undef"
15439                 ;;
15440         esac
15441         ;;
15442 esac
15443 set d_stdstdio
15444 eval $setvar
15445
15446 : Can _ptr be used as an lvalue?
15447 case "$d_stdstdio$ptr_lval" in
15448 $define$define) val=$define ;;
15449 *) val=$undef ;;
15450 esac
15451 set d_stdio_ptr_lval
15452 eval $setvar
15453
15454 : Can _cnt be used as an lvalue?
15455 case "$d_stdstdio$cnt_lval" in
15456 $define$define) val=$define ;;
15457 *) val=$undef ;;
15458 esac
15459 set d_stdio_cnt_lval
15460 eval $setvar
15461
15462
15463 : test whether setting _ptr sets _cnt as a side effect
15464 d_stdio_ptr_lval_sets_cnt="$undef"
15465 d_stdio_ptr_lval_nochange_cnt="$undef"
15466 case "$d_stdio_ptr_lval$d_stdstdio" in
15467 $define$define)
15468         echo "Checking to see what happens if we set the stdio ptr..." >&4
15469 $cat >try.c <<EOP
15470 #include <stdio.h>
15471 /* Can we scream? */
15472 /* Eat dust sed :-) */
15473 /* In the buffer space, no one can hear you scream. */
15474 #define FILE_ptr(fp)    $stdio_ptr
15475 #define FILE_cnt(fp)    $stdio_cnt
15476 #include <sys/types.h>
15477 int main() {
15478         FILE *fp = fopen("try.c", "r");
15479         int c;
15480         char *ptr;
15481         size_t cnt;
15482         if (!fp) {
15483             puts("Fail even to read");
15484             exit(1);
15485         }
15486         c = getc(fp); /* Read away the first # */
15487         if (c == EOF) {
15488             puts("Fail even to read");
15489             exit(1);
15490         }
15491         if (!(
15492                 18 <= FILE_cnt(fp) &&
15493                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15494         )) {
15495                 puts("Fail even to read");
15496                 exit (1);
15497         }
15498         ptr = (char*) FILE_ptr(fp);
15499         cnt = (size_t)FILE_cnt(fp);
15500
15501         FILE_ptr(fp) += 42;
15502
15503         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15504                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15505                 exit (1);
15506         }
15507         if (FILE_cnt(fp) <= 20) {
15508                 printf ("Fail (<20 chars to test)");
15509                 exit (1);
15510         }
15511         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15512                 puts("Fail compare");
15513                 exit (1);
15514         }
15515         if (cnt == FILE_cnt(fp)) {
15516                 puts("Pass_unchanged");
15517                 exit (0);
15518         }       
15519         if (FILE_cnt(fp) == (cnt - 42)) {
15520                 puts("Pass_changed");
15521                 exit (0);
15522         }
15523         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15524         return 1;
15525
15526 }
15527 EOP
15528         set try
15529         if eval $compile && $to try.c; then
15530                 case `$run ./try` in
15531                 Pass_changed)
15532                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15533                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15534                 Pass_unchanged)
15535                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15536                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15537                 Fail*)
15538                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15539                 *)
15540                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15541         esac
15542         else
15543                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15544         fi
15545         $rm -f try.c try
15546         ;;
15547 esac
15548
15549 : see if _base is also standard
15550 val="$undef"
15551 case "$d_stdstdio" in
15552 $define)
15553         $cat >try.c <<EOP
15554 #include <stdio.h>
15555 #define FILE_base(fp)   $stdio_base
15556 #define FILE_bufsiz(fp) $stdio_bufsiz
15557 int main() {
15558         FILE *fp = fopen("try.c", "r");
15559         char c = getc(fp);
15560         if (
15561                 19 <= FILE_bufsiz(fp) &&
15562                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15563         )
15564                 exit(0);
15565         exit(1);
15566 }
15567 EOP
15568         set try
15569         if eval $compile && $to try.c; then
15570                 if $run ./try; then
15571                         echo "And its _base field acts std."
15572                         val="$define"
15573                 else
15574                         echo "But its _base field isn't std."
15575                 fi
15576         else
15577                 echo "However, it seems to be lacking the _base field."
15578         fi
15579         $rm -f try.c try
15580         ;;
15581 esac
15582 set d_stdiobase
15583 eval $setvar
15584
15585 $cat >&4 <<EOM
15586 Checking how to access stdio streams by file descriptor number...
15587 EOM
15588 case "$stdio_stream_array" in
15589 '')     $cat >try.c <<EOCP
15590 #include <stdio.h>
15591 int main() {
15592   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15593     printf("yes\n");
15594 }
15595 EOCP
15596         for s in _iob __iob __sF
15597         do
15598                 set try -DSTDIO_STREAM_ARRAY=$s
15599                 if eval $compile; then
15600                         case "`$run ./try`" in
15601                         yes)    stdio_stream_array=$s; break ;;
15602                         esac
15603                 fi
15604         done
15605         $rm -f try.* try$exe_ext
15606 esac
15607 case "$stdio_stream_array" in
15608 '')     $cat >&4 <<EOM
15609 I can't figure out how to access stdio streams by file descriptor number.
15610 EOM
15611         d_stdio_stream_array="$undef"
15612         ;;
15613 *)      $cat >&4 <<EOM
15614 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15615 EOM
15616         d_stdio_stream_array="$define"
15617         ;;
15618 esac
15619
15620 : see if strcoll exists
15621 set strcoll d_strcoll
15622 eval $inlibc
15623
15624 : check for structure copying
15625 echo " "
15626 echo "Checking to see if your C compiler can copy structs..." >&4
15627 $cat >try.c <<'EOCP'
15628 main()
15629 {
15630         struct blurfl {
15631                 int dyick;
15632         } foo, bar;
15633
15634         foo = bar;
15635 }
15636 EOCP
15637 if $cc -c try.c >/dev/null 2>&1 ; then
15638         val="$define"
15639         echo "Yup, it can."
15640 else
15641         val="$undef"
15642         echo "Nope, it can't."
15643 fi
15644 set d_strctcpy
15645 eval $setvar
15646 $rm -f try.*
15647
15648 : see if strerror and/or sys_errlist[] exist
15649 echo " "
15650 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15651     if set strerror val -f d_strerror; eval $csym; $val; then
15652                 echo 'strerror() found.' >&4
15653                 d_strerror="$define"
15654                 d_strerrm='strerror(e)'
15655                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15656                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15657                         d_syserrlst="$define"
15658                 else
15659                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15660                         d_syserrlst="$undef"
15661                 fi
15662     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15663                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15664                 echo 'strerror() found in string header.' >&4
15665                 d_strerror="$define"
15666                 d_strerrm='strerror(e)'
15667                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15668                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15669                                 d_syserrlst="$define"
15670                 else
15671                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15672                         d_syserrlst="$undef"
15673                 fi
15674     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15675                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15676                 d_strerror="$undef"
15677                 d_syserrlst="$define"
15678                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15679     else
15680                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15681                 d_strerror="$undef"
15682                 d_syserrlst="$undef"
15683                 d_strerrm='"unknown"'
15684     fi
15685 fi
15686
15687 : see if strerror_r exists
15688 set strerror_r d_strerror_r
15689 eval $inlibc
15690 case "$d_strerror_r" in
15691 "$define")
15692         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15693         case "$d_strerror_r_proto:$usethreads" in
15694         ":define")      d_strerror_r_proto=define
15695                 set d_strerror_r_proto strerror_r $hdrs
15696                 eval $hasproto ;;
15697         *)      ;;
15698         esac
15699         case "$d_strerror_r_proto" in
15700         define)
15701         case "$strerror_r_proto" in
15702         ''|0) try='int strerror_r(int, char*, size_t);'
15703         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15704         esac
15705         case "$strerror_r_proto" in
15706         ''|0) try='int strerror_r(int, char*, int);'
15707         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15708         esac
15709         case "$strerror_r_proto" in
15710         ''|0) try='char* strerror_r(int, char*, size_t);'
15711         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15712         esac
15713         case "$strerror_r_proto" in
15714         ''|0)   d_strerror_r=undef
15715                 strerror_r_proto=0
15716                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15717         * )     case "$strerror_r_proto" in
15718                 REENTRANT_PROTO*) ;;
15719                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15720                 esac
15721                 echo "Prototype: $try" ;;
15722         esac
15723         ;;
15724         *)      case "$usethreads" in
15725                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15726                 esac
15727                 d_strerror_r=undef
15728                 strerror_r_proto=0
15729                 ;;
15730         esac
15731         ;;
15732 *)      strerror_r_proto=0
15733         ;;
15734 esac
15735
15736 : see if strftime exists
15737 set strftime d_strftime
15738 eval $inlibc
15739
15740 : see if strtod exists
15741 set strtod d_strtod
15742 eval $inlibc
15743
15744 : see if strtol exists
15745 set strtol d_strtol
15746 eval $inlibc
15747
15748 : see if strtold exists
15749 set strtold d_strtold
15750 eval $inlibc
15751
15752 : see if strtoll exists
15753 set strtoll d_strtoll
15754 eval $inlibc
15755
15756 case "$d_longlong-$d_strtoll" in
15757 "$define-$define")
15758         $cat <<EOM
15759 Checking whether your strtoll() works okay...
15760 EOM
15761         $cat >try.c <<'EOCP'
15762 #include <errno.h>
15763 #ifdef __hpux
15764 #define strtoll __strtoll
15765 #endif
15766 #ifdef __EMX__
15767 #define strtoll _strtoll
15768 #endif
15769 #include <stdio.h>
15770 extern long long int strtoll(char *s, char **, int); 
15771 static int bad = 0;
15772 int check(char *s, long long ell, int een) {
15773         long long gll;
15774         errno = 0;
15775         gll = strtoll(s, 0, 10);
15776         if (!((gll == ell) && (errno == een)))
15777                 bad++;
15778 }
15779 int main() {
15780         check(" 1",                                      1LL, 0);
15781         check(" 0",                                      0LL, 0);
15782         check("-1",                                     -1LL, 0);
15783         check("-9223372036854775808", -9223372036854775808LL, 0);
15784         check("-9223372036854775808", -9223372036854775808LL, 0);
15785         check(" 9223372036854775807",  9223372036854775807LL, 0);
15786         check("-9223372036854775808", -9223372036854775808LL, 0);
15787         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15788         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15789         if (!bad)
15790                 printf("ok\n");
15791 }
15792 EOCP
15793         set try
15794         if eval $compile; then
15795                 yyy=`$run ./try`
15796                 case "$yyy" in
15797                 ok) echo "Your strtoll() seems to be working okay." ;;
15798                 *) cat <<EOM >&4
15799 Your strtoll() doesn't seem to be working okay.
15800 EOM
15801                    d_strtoll="$undef"
15802                    ;;
15803                 esac
15804         else
15805                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15806                 d_strtoll="$undef"
15807         fi
15808         ;;
15809 esac
15810
15811 : see if strtoq exists
15812 set strtoq d_strtoq
15813 eval $inlibc
15814
15815 : see if strtoul exists
15816 set strtoul d_strtoul
15817 eval $inlibc
15818
15819 case "$d_strtoul" in
15820 "$define")
15821         $cat <<EOM
15822 Checking whether your strtoul() works okay...
15823 EOM
15824         $cat >try.c <<'EOCP'
15825 #include <errno.h>
15826 #include <stdio.h>
15827 extern unsigned long int strtoul(char *s, char **, int); 
15828 static int bad = 0;
15829 void check(char *s, unsigned long eul, int een) {
15830         unsigned long gul;
15831         errno = 0;
15832         gul = strtoul(s, 0, 10);
15833         if (!((gul == eul) && (errno == een)))
15834                 bad++;
15835 }
15836 int main() {
15837         check(" 1", 1L, 0);
15838         check(" 0", 0L, 0);
15839 EOCP
15840         case "$longsize" in
15841         8)
15842             $cat >>try.c <<'EOCP'
15843         check("18446744073709551615", 18446744073709551615UL, 0);
15844         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15845 #if 0 /* strtoul() for /^-/ strings is undefined. */
15846         check("-1", 18446744073709551615UL, 0);
15847         check("-18446744073709551614", 2, 0);
15848         check("-18446744073709551615", 1, 0);
15849         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15850         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15851 #endif
15852 EOCP
15853                 ;;
15854         4)
15855                     $cat >>try.c <<'EOCP'
15856         check("4294967295", 4294967295UL, 0);
15857         check("4294967296", 4294967295UL, ERANGE);
15858 #if 0 /* strtoul() for /^-/ strings is undefined. */
15859         check("-1", 4294967295UL, 0);
15860         check("-4294967294", 2, 0);
15861         check("-4294967295", 1, 0);
15862         check("-4294967296", 4294967295UL, ERANGE);
15863         check("-4294967297", 4294967295UL, ERANGE);
15864 #endif
15865 EOCP
15866                 ;;
15867         *)
15868 : Should we write these tests to be more portable by sprintf-ing
15869 : ~0 and then manipulating that char string as input for strtol?
15870                 ;;
15871         esac
15872         $cat >>try.c <<'EOCP'
15873         if (!bad)
15874                 printf("ok\n");
15875         return 0;
15876 }
15877 EOCP
15878         set try
15879         if eval $compile; then
15880                 case "`$run ./try`" in
15881                 ok) echo "Your strtoul() seems to be working okay." ;;
15882                 *) cat <<EOM >&4
15883 Your strtoul() doesn't seem to be working okay.
15884 EOM
15885                    d_strtoul="$undef"
15886                    ;;
15887                 esac
15888         fi
15889         ;;
15890 esac
15891
15892 : see if strtoull exists
15893 set strtoull d_strtoull
15894 eval $inlibc
15895
15896 case "$d_longlong-$d_strtoull" in
15897 "$define-$define")
15898         $cat <<EOM
15899 Checking whether your strtoull() works okay...
15900 EOM
15901         $cat >try.c <<'EOCP'
15902 #include <errno.h>
15903 #ifdef __hpux
15904 #define strtoull __strtoull
15905 #endif
15906 #include <stdio.h>
15907 extern unsigned long long int strtoull(char *s, char **, int); 
15908 static int bad = 0;
15909 int check(char *s, long long eull, int een) {
15910         long long gull;
15911         errno = 0;
15912         gull = strtoull(s, 0, 10);
15913         if (!((gull == eull) && (errno == een)))
15914                 bad++;
15915 }
15916 int main() {
15917         check(" 1",                                        1LL, 0);
15918         check(" 0",                                        0LL, 0);
15919         check("18446744073709551615",  18446744073709551615ULL, 0);
15920         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15921 #if 0 /* strtoull() for /^-/ strings is undefined. */
15922         check("-1",                    18446744073709551615ULL, 0);
15923         check("-18446744073709551614",                     2LL, 0);
15924         check("-18446744073709551615",                     1LL, 0);
15925         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15926         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15927 #endif
15928         if (!bad)
15929                 printf("ok\n");
15930 }
15931 EOCP
15932         set try
15933         if eval $compile; then
15934                 case "`$run ./try`" in
15935                 ok) echo "Your strtoull() seems to be working okay." ;;
15936                 *) cat <<EOM >&4
15937 Your strtoull() doesn't seem to be working okay.
15938 EOM
15939                    d_strtoull="$undef"
15940                    ;;
15941                 esac
15942         fi
15943         ;;
15944 esac
15945
15946 : see if strtouq exists
15947 set strtouq d_strtouq
15948 eval $inlibc
15949
15950 case "$d_strtouq" in
15951 "$define")
15952         $cat <<EOM
15953 Checking whether your strtouq() works okay...
15954 EOM
15955         $cat >try.c <<'EOCP'
15956 #include <errno.h>
15957 #include <stdio.h>
15958 extern unsigned long long int strtouq(char *s, char **, int); 
15959 static int bad = 0;
15960 void check(char *s, unsigned long long eull, int een) {
15961         unsigned long long gull;
15962         errno = 0;
15963         gull = strtouq(s, 0, 10);
15964         if (!((gull == eull) && (errno == een)))
15965                 bad++;
15966 }
15967 int main() {
15968         check(" 1",                                        1LL, 0);
15969         check(" 0",                                        0LL, 0);
15970         check("18446744073709551615",  18446744073709551615ULL, 0);
15971         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15972 #if 0 /* strtouq() for /^-/ strings is undefined. */
15973         check("-1",                    18446744073709551615ULL, 0);
15974         check("-18446744073709551614",                     2LL, 0);
15975         check("-18446744073709551615",                     1LL, 0);
15976         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15977         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15978 #endif
15979         if (!bad)
15980                 printf("ok\n");
15981         return 0;
15982 }
15983 EOCP
15984         set try
15985         if eval $compile; then
15986                 case "`$run ./try`" in
15987                 ok) echo "Your strtouq() seems to be working okay." ;;
15988                 *) cat <<EOM >&4
15989 Your strtouq() doesn't seem to be working okay.
15990 EOM
15991                    d_strtouq="$undef"
15992                    ;;
15993                 esac
15994         fi
15995         ;;
15996 esac
15997
15998 : see if strxfrm exists
15999 set strxfrm d_strxfrm
16000 eval $inlibc
16001
16002 : see if symlink exists
16003 set symlink d_symlink
16004 eval $inlibc
16005
16006 : see if syscall exists
16007 set syscall d_syscall
16008 eval $inlibc
16009
16010 : see if prototype for syscall is available
16011 echo " "
16012 set d_syscallproto syscall $i_unistd unistd.h
16013 eval $hasproto
16014
16015 : see if sysconf exists
16016 set sysconf d_sysconf
16017 eval $inlibc
16018
16019 : see if system exists
16020 set system d_system
16021 eval $inlibc
16022
16023 : see if tcgetpgrp exists
16024 set tcgetpgrp d_tcgetpgrp
16025 eval $inlibc
16026
16027 : see if tcsetpgrp exists
16028 set tcsetpgrp d_tcsetpgrp
16029 eval $inlibc
16030
16031 : see if prototype for telldir is available
16032 echo " "
16033 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16034 eval $hasproto
16035
16036 : see if time exists
16037 echo " "
16038 if test "X$d_time" = X -o X"$timetype" = X; then
16039     if set time val -f d_time; eval $csym; $val; then
16040                 echo 'time() found.' >&4
16041                 val="$define"
16042                 rp="What is the type returned by time() on this system?"
16043                 set time_t timetype long stdio.h sys/types.h
16044                 eval $typedef_ask
16045     else
16046                 echo 'time() not found, hope that will do.' >&4
16047                 val="$undef"
16048                 timetype='int';
16049     fi
16050     set d_time
16051     eval $setvar
16052 fi
16053
16054 : see if this is a sys/times.h system
16055 set sys/times.h i_systimes
16056 eval $inhdr
16057
16058 : see if times exists
16059 echo " "
16060 if set times val -f d_times; eval $csym; $val; then
16061         echo 'times() found.' >&4
16062         d_times="$define"
16063         inc=''
16064         case "$i_systimes" in
16065         "$define") inc='sys/times.h';;
16066         esac
16067         rp="What is the type returned by times() on this system?"
16068         set clock_t clocktype long stdio.h sys/types.h $inc
16069         eval $typedef_ask
16070 else
16071         echo 'times() NOT found, hope that will do.' >&4
16072         d_times="$undef"
16073         clocktype='int'
16074 fi
16075
16076 : see if tmpnam_r exists
16077 set tmpnam_r d_tmpnam_r
16078 eval $inlibc
16079 case "$d_tmpnam_r" in
16080 "$define")
16081         hdrs="$i_systypes sys/types.h define stdio.h "
16082         case "$d_tmpnam_r_proto:$usethreads" in
16083         ":define")      d_tmpnam_r_proto=define
16084                 set d_tmpnam_r_proto tmpnam_r $hdrs
16085                 eval $hasproto ;;
16086         *)      ;;
16087         esac
16088         case "$d_tmpnam_r_proto" in
16089         define)
16090         case "$tmpnam_r_proto" in
16091         ''|0) try='char* tmpnam_r(char*);'
16092         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16093         esac
16094         case "$tmpnam_r_proto" in
16095         ''|0)   d_tmpnam_r=undef
16096                 tmpnam_r_proto=0
16097                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16098         * )     case "$tmpnam_r_proto" in
16099                 REENTRANT_PROTO*) ;;
16100                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16101                 esac
16102                 echo "Prototype: $try" ;;
16103         esac
16104         ;;
16105         *)      case "$usethreads" in
16106                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16107                 esac
16108                 d_tmpnam_r=undef
16109                 tmpnam_r_proto=0
16110                 ;;
16111         esac
16112         ;;
16113 *)      tmpnam_r_proto=0
16114         ;;
16115 esac
16116
16117 : see if truncate exists
16118 set truncate d_truncate
16119 eval $inlibc
16120
16121 : see if ttyname_r exists
16122 set ttyname_r d_ttyname_r
16123 eval $inlibc
16124 case "$d_ttyname_r" in
16125 "$define")
16126         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16127         case "$d_ttyname_r_proto:$usethreads" in
16128         ":define")      d_ttyname_r_proto=define
16129                 set d_ttyname_r_proto ttyname_r $hdrs
16130                 eval $hasproto ;;
16131         *)      ;;
16132         esac
16133         case "$d_ttyname_r_proto" in
16134         define)
16135         case "$ttyname_r_proto" in
16136         ''|0) try='int ttyname_r(int, char*, size_t);'
16137         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16138         esac
16139         case "$ttyname_r_proto" in
16140         ''|0) try='int ttyname_r(int, char*, int);'
16141         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16142         esac
16143         case "$ttyname_r_proto" in
16144         ''|0) try='char* ttyname_r(int, char*, int);'
16145         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16146         esac
16147         case "$ttyname_r_proto" in
16148         ''|0)   d_ttyname_r=undef
16149                 ttyname_r_proto=0
16150                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16151         * )     case "$ttyname_r_proto" in
16152                 REENTRANT_PROTO*) ;;
16153                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16154                 esac
16155                 echo "Prototype: $try" ;;
16156         esac
16157         ;;
16158         *)      case "$usethreads" in
16159                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16160                 esac
16161                 d_ttyname_r=undef
16162                 ttyname_r_proto=0
16163                 ;;
16164         esac
16165         ;;
16166 *)      ttyname_r_proto=0
16167         ;;
16168 esac
16169
16170 : see if tzname[] exists
16171 echo " "
16172 if set tzname val -a d_tzname; eval $csym; $val; then
16173         val="$define"
16174         echo 'tzname[] found.' >&4
16175 else
16176         val="$undef"
16177         echo 'tzname[] NOT found.' >&4
16178 fi
16179 set d_tzname
16180 eval $setvar
16181
16182 case "$osname" in
16183 next|rhapsody|darwin) multiarch="$define" ;;
16184 esac
16185 case "$multiarch" in
16186 ''|[nN]*) multiarch="$undef" ;;
16187 esac
16188
16189 : check for ordering of bytes in a UV
16190 echo " "
16191 case "$usecrosscompile$multiarch" in
16192 *$define*)
16193         $cat <<EOM
16194 You seem to be either cross-compiling or doing a multiarchitecture build,
16195 skipping the byteorder check.
16196
16197 EOM
16198         byteorder='ffff'
16199         ;;
16200 *)
16201         case "$byteorder" in
16202         '')
16203                 $cat <<'EOM'
16204 In the following, larger digits indicate more significance.  A big-endian
16205 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16206 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16207 machines may have weird orders like 3412.  A Cray will report 87654321,
16208 an Alpha will report 12345678. If the test program works the default is
16209 probably right.
16210 I'm now running the test program...
16211 EOM
16212                 $cat >try.c <<EOCP
16213 #include <stdio.h>
16214 #include <sys/types.h>
16215 typedef $uvtype UV;
16216 int main()
16217 {
16218         int i;
16219         union {
16220                 UV l;
16221                 char c[$uvsize];
16222         } u;
16223
16224         if ($uvsize > 4)
16225                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16226         else
16227                 u.l = (UV)0x04030201;
16228         for (i = 0; i < $uvsize; i++)
16229                 printf("%c", u.c[i]+'0');
16230         printf("\n");
16231         exit(0);
16232 }
16233 EOCP
16234                 xxx_prompt=y
16235                 set try
16236                 if eval $compile && ./try > /dev/null; then
16237                         dflt=`$run ./try`
16238                         case "$dflt" in
16239                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16240                                 echo "(The test program ran ok.)"
16241                                 echo "byteorder=$dflt"
16242                                 xxx_prompt=n
16243                         ;;
16244                         ????|????????) echo "(The test program ran ok.)" ;;
16245                         *) echo "(The test program didn't run right for some reason.)" ;;
16246                         esac
16247                 else
16248                         dflt='4321'
16249                         cat <<'EOM'
16250 (I can't seem to compile the test program.  Guessing big-endian...)
16251 EOM
16252                 fi
16253                 case "$xxx_prompt" in
16254                 y)
16255                         rp="What is the order of bytes in $uvtype?"
16256                         . ./myread
16257                         byteorder="$ans"
16258                         ;;
16259                 *)      byteorder=$dflt
16260                         ;;
16261                 esac
16262                 ;;
16263         esac
16264         $rm -f try.c try
16265         ;;
16266 esac
16267
16268
16269 $cat <<EOM
16270
16271 Checking to see whether you can access character data unalignedly...
16272 EOM
16273 case "$d_u32align" in
16274 '')   $cat >try.c <<EOCP
16275 #include <stdio.h>
16276 #define U32 $u32type
16277 #define BYTEORDER 0x$byteorder
16278 #define U8 $u8type
16279 #include <signal.h>
16280 #ifdef SIGBUS
16281 $signal_t bletch(s) int s; { exit(4); }
16282 #endif
16283 int main() {
16284 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16285     U8 buf[8];
16286     U32 *up;
16287     int i;
16288
16289     if (sizeof(U32) != 4) {
16290         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16291         exit(1);
16292     }
16293
16294     fflush(stdout);
16295
16296 #ifdef SIGBUS
16297     signal(SIGBUS, bletch);
16298 #endif
16299
16300     buf[0] = 0;
16301     buf[1] = 0;
16302     buf[2] = 0;
16303     buf[3] = 1;
16304     buf[5] = 0;
16305     buf[6] = 0;
16306     buf[7] = 0;
16307     buf[8] = 1;
16308
16309     for (i = 0; i < 4; i++) {
16310         up = (U32*)(buf + i);
16311         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16312                (*up == 1 << (8*(3-i)))  /* little-endian */
16313               )
16314            )
16315         {
16316             printf("read failed (%x)\n", *up);
16317             exit(2);
16318         }
16319     }
16320
16321     /* write test */
16322     for (i = 0; i < 4; i++) {
16323         up = (U32*)(buf + i);
16324         *up = 0xBeef;
16325         if (*up != 0xBeef) {
16326             printf("write failed (%x)\n", *up);
16327             exit(3);
16328         }
16329     }
16330
16331     exit(0);
16332 #else
16333     printf("1\n");
16334     exit(1);
16335 #endif
16336     return 0;
16337 }
16338 EOCP
16339 set try
16340 if eval $compile_ok; then
16341         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16342         $run ./try 2>&1 >/dev/null
16343         case "$?" in
16344         0)      cat >&4 <<EOM
16345 You can access character data pretty unalignedly.
16346 EOM
16347                 d_u32align="$undef"
16348                 ;;
16349         *)      cat >&4 <<EOM
16350 It seems that you must access character data in an aligned manner.
16351 EOM
16352                 d_u32align="$define"
16353                 ;;
16354         esac
16355 else
16356         rp='Can you access character data at unaligned addresses?'
16357         dflt='n'
16358         . ./myread
16359         case "$ans" in
16360         [yY]*)  d_u32align="$undef"  ;;
16361         *)      d_u32align="$define" ;;
16362         esac
16363 fi
16364 $rm -f core core.try.* try.core
16365 ;;
16366 esac
16367
16368 : see if ualarm exists
16369 set ualarm d_ualarm
16370 eval $inlibc
16371
16372 : see if umask exists
16373 set umask d_umask
16374 eval $inlibc
16375
16376 : see if unordered exists
16377 set unordered d_unordered
16378 eval $inlibc
16379
16380 : see if usleep exists
16381 set usleep d_usleep
16382 eval $inlibc
16383
16384 : see if prototype for usleep is available
16385 echo " "
16386 set d_usleepproto usleep $i_unistd unistd.h
16387 eval $hasproto
16388
16389 : see if ustat exists
16390 set ustat d_ustat
16391 eval $inlibc
16392
16393 : backward compatibility for d_hvfork
16394 if test X$d_hvfork != X; then
16395         d_vfork="$d_hvfork"
16396         d_hvfork=''
16397 fi
16398 : see if there is a vfork
16399 val=''
16400 set vfork val
16401 eval $inlibc
16402
16403 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16404 : perl on Solaris 2.x, and probably elsewhere.
16405 case "$val" in
16406 $define)
16407         echo " "
16408         case "$usevfork" in
16409         false) dflt='n';;
16410         *) dflt='y';;
16411         esac
16412         cat <<'EOM'
16413  
16414 Perl can only use a vfork() that doesn't suffer from strict
16415 restrictions on calling functions or modifying global data in
16416 the child.  For example, glibc-2.1 contains such a vfork()
16417 that is unsuitable.  If your system provides a proper fork()
16418 call, chances are that you do NOT want perl to use vfork().
16419
16420 EOM
16421         rp="Do you still want to use vfork()?"
16422         . ./myread
16423         case "$ans" in
16424         y|Y) ;;
16425         *)
16426                 echo "Ok, we won't use vfork()."
16427                 val="$undef"
16428                 ;;
16429         esac
16430         ;;
16431 esac
16432 set d_vfork
16433 eval $setvar
16434 case "$d_vfork" in
16435 $define) usevfork='true';;
16436 *) usevfork='false';;
16437 esac
16438
16439 : see if closedir exists
16440 set closedir d_closedir
16441 eval $inlibc
16442
16443 case "$d_closedir" in
16444 "$define")
16445         echo " "
16446         echo "Checking whether closedir() returns a status..." >&4
16447         cat > try.c <<EOM
16448 #$i_dirent I_DIRENT             /**/
16449 #$i_sysdir I_SYS_DIR            /**/
16450 #$i_sysndir I_SYS_NDIR          /**/
16451 #$i_systypes I_SYS_TYPES        /**/
16452
16453 #if defined(I_SYS_TYPES)
16454 #include <sys/types.h>
16455 #endif
16456 #if defined(I_DIRENT)
16457 #include <dirent.h>
16458 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16459 #include <sys/dir.h>
16460 #endif
16461 #else
16462 #ifdef I_SYS_NDIR
16463 #include <sys/ndir.h>
16464 #else
16465 #ifdef I_SYS_DIR
16466 #ifdef hp9000s500
16467 #include <ndir.h>       /* may be wrong in the future */
16468 #else
16469 #include <sys/dir.h>
16470 #endif
16471 #endif
16472 #endif
16473 #endif 
16474 int main() { return closedir(opendir(".")); }
16475 EOM
16476         set try
16477         if eval $compile_ok; then
16478                 if $run ./try > /dev/null 2>&1 ; then
16479                         echo "Yes, it does."
16480                         val="$undef"
16481                 else
16482                         echo "No, it doesn't."
16483                         val="$define"
16484                 fi
16485         else
16486                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16487                 val="$define"
16488         fi
16489         ;;
16490 *)
16491         val="$undef";
16492         ;;
16493 esac
16494 set d_void_closedir
16495 eval $setvar
16496 $rm -f try try.*
16497 : see if there is a wait4
16498 set wait4 d_wait4
16499 eval $inlibc
16500
16501 : see if waitpid exists
16502 set waitpid d_waitpid
16503 eval $inlibc
16504
16505 : see if wcstombs exists
16506 set wcstombs d_wcstombs
16507 eval $inlibc
16508
16509 : see if wctomb exists
16510 set wctomb d_wctomb
16511 eval $inlibc
16512
16513 : see if writev exists
16514 set writev d_writev
16515 eval $inlibc
16516
16517 : preserve RCS keywords in files with variable substitution, grrr
16518 Date='$Date'
16519 Id='$Id'
16520 Log='$Log'
16521 RCSfile='$RCSfile'
16522 Revision='$Revision'
16523
16524 : check for alignment requirements
16525 echo " "
16526 case "$usecrosscompile$multiarch" in
16527 *$define*)
16528         $cat <<EOM
16529 You seem to be either cross-compiling or doing a multiarchitecture build,
16530 skipping the memory alignment check.
16531
16532 EOM
16533         case "$alignbytes" in
16534         '') alignbytes=8 ;;
16535         esac
16536         ;;
16537 *)
16538         case "$alignbytes" in
16539         '') echo "Checking alignment constraints..." >&4
16540                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16541                         $cat >try.c <<'EOCP'
16542 typedef long double NV;
16543 EOCP
16544                 else
16545                         $cat >try.c <<'EOCP'
16546 typedef double NV;
16547 EOCP
16548                 fi
16549                 $cat >>try.c <<'EOCP'
16550 #include <stdio.h>
16551 struct foobar {
16552         char foo;
16553         NV bar;
16554 } try_algn;
16555 int main()
16556 {
16557     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16558     return(0);
16559 }
16560 EOCP
16561                 set try
16562                 if eval $compile_ok; then
16563                         dflt=`$run ./try`
16564                 else
16565                         dflt='8'
16566                         echo "(I can't seem to compile the test program...)"
16567                 fi
16568                 ;;
16569         *) dflt="$alignbytes"
16570                 ;;
16571         esac
16572         rp="Doubles must be aligned on a how-many-byte boundary?"
16573         . ./myread
16574         alignbytes="$ans"
16575         $rm -f try.c try
16576         ;;
16577 esac
16578
16579
16580 : set the base revision
16581 baserev=5.0
16582
16583 : how do we catenate cpp tokens here?
16584 echo " "
16585 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16586 $cat >cpp_stuff.c <<'EOCP'
16587 #define RCAT(a,b)a/**/b
16588 #define ACAT(a,b)a ## b
16589 RCAT(Rei,ser)
16590 ACAT(Cir,cus)
16591 EOCP
16592 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16593 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16594         echo "Oh!  Smells like ANSI's been here." >&4
16595         echo "We can catify or stringify, separately or together!"
16596         cpp_stuff=42
16597 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16598         echo "Ah, yes!  The good old days!" >&4
16599         echo "However, in the good old days we don't know how to stringify and"
16600         echo "catify at the same time."
16601         cpp_stuff=1
16602 else
16603         $cat >&4 <<EOM
16604 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16605 to have to edit the values of CAT[2-5] in config.h...
16606 EOM
16607         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16608 fi
16609 $rm -f cpp_stuff.*
16610
16611 : see if this is a db.h system
16612 set db.h i_db
16613 eval $inhdr
16614
16615 case "$i_db" in
16616 $define)
16617         : Check db version.
16618         echo " "
16619         echo "Checking Berkeley DB version ..." >&4
16620         $cat >try.c <<EOCP
16621 #$d_const HASCONST
16622 #ifndef HASCONST
16623 #define const
16624 #endif
16625 #include <sys/types.h>
16626 #include <stdio.h>
16627 #include <db.h>
16628 int main(int argc, char *argv[])
16629 {
16630 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16631     int Major, Minor, Patch ;
16632     unsigned long Version ;
16633     (void)db_version(&Major, &Minor, &Patch) ;
16634     if (argc == 2) {
16635         printf("%d %d %d %d %d %d\n",
16636                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16637                Major, Minor, Patch);
16638         exit(0);
16639     }
16640     printf("You have Berkeley DB Version 2 or greater.\n");
16641
16642     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16643                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16644     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16645                 Major, Minor, Patch) ;
16646
16647     /* check that db.h & libdb are compatible */
16648     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16649         printf("db.h and libdb are incompatible.\n") ;
16650         exit(3);        
16651     }
16652
16653     printf("db.h and libdb are compatible.\n") ;
16654
16655     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16656                 + DB_VERSION_PATCH ;
16657
16658     /* needs to be >= 2.3.4 */
16659     if (Version < 2003004) {
16660     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16661         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16662         exit(2);        
16663     }
16664
16665     exit(0);
16666 #else
16667 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16668     if (argc == 2) {
16669         printf("1 0 0\n");
16670         exit(0);
16671     }
16672     printf("You have Berkeley DB Version 1.\n");
16673     exit(0);    /* DB version < 2: the coast is clear. */
16674 #else
16675     exit(1);    /* <db.h> not Berkeley DB? */
16676 #endif
16677 #endif
16678 }
16679 EOCP
16680         set try
16681         if eval $compile_ok && $run ./try; then
16682                 echo 'Looks OK.' >&4
16683                 set `$run ./try 1`
16684                 db_version_major=$1
16685                 db_version_minor=$2
16686                 db_version_patch=$3
16687         else
16688                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16689                 i_db=$undef
16690                 case " $libs " in
16691                 *"-ldb "*)
16692                         : Remove db from list of libraries to use
16693                         echo "Removing unusable -ldb from library list" >&4
16694                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16695                         shift
16696                         libs="$*"
16697                         echo "libs = $libs" >&4
16698                         ;;
16699                 esac
16700         fi
16701         $rm -f try.*
16702         ;;
16703 esac
16704
16705 case "$i_db" in
16706 define)
16707         : Check the return type needed for hash 
16708         echo " "
16709         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16710         $cat >try.c <<EOCP
16711 #$d_const HASCONST
16712 #ifndef HASCONST
16713 #define const
16714 #endif
16715 #include <sys/types.h>
16716 #include <db.h>
16717
16718 #ifndef DB_VERSION_MAJOR
16719 u_int32_t hash_cb (ptr, size)
16720 const void *ptr;
16721 size_t size;
16722 {
16723 }
16724 HASHINFO info;
16725 int main()
16726 {
16727         info.hash = hash_cb;
16728 }
16729 #endif
16730 EOCP
16731         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16732                 if $contains warning try.out >>/dev/null 2>&1 ; then
16733                         db_hashtype='int'
16734                 else
16735                         db_hashtype='u_int32_t'
16736                 fi
16737         else
16738                 : XXX Maybe we should just give up here.
16739                 db_hashtype=u_int32_t
16740                 $cat try.out >&4
16741                 echo "Help:  I can't seem to compile the db test program." >&4
16742                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16743         fi
16744         $rm -f try.*
16745         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16746         ;;
16747 *)      db_hashtype=u_int32_t
16748         ;;
16749 esac
16750 case "$i_db" in
16751 define)
16752         : Check the return type needed for prefix 
16753         echo " "
16754         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16755         cat >try.c <<EOCP
16756 #$d_const HASCONST
16757 #ifndef HASCONST
16758 #define const
16759 #endif
16760 #include <sys/types.h>
16761 #include <db.h>
16762
16763 #ifndef DB_VERSION_MAJOR
16764 size_t prefix_cb (key1, key2)
16765 const DBT *key1;
16766 const DBT *key2;
16767 {
16768 }
16769 BTREEINFO info;
16770 int main()
16771 {
16772         info.prefix = prefix_cb;
16773 }
16774 #endif
16775 EOCP
16776         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16777                 if $contains warning try.out >>/dev/null 2>&1 ; then
16778                         db_prefixtype='int'
16779                 else
16780                         db_prefixtype='size_t'
16781                 fi
16782         else
16783                 db_prefixtype='size_t'
16784                 : XXX Maybe we should just give up here.
16785                 $cat try.out >&4
16786                 echo "Help:  I can't seem to compile the db test program." >&4
16787                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16788         fi
16789         $rm -f try.*
16790         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16791         ;;
16792 *)      db_prefixtype='size_t'
16793         ;;
16794 esac
16795
16796
16797 : How can we generate normalized random numbers ?
16798 echo " "
16799 echo "Looking for a random number function..." >&4
16800 case "$randfunc" in
16801 '')
16802         if set drand48 val -f; eval $csym; $val; then
16803                 dflt="drand48"
16804                 echo "Good, found drand48()." >&4
16805         elif set random val -f; eval $csym; $val; then
16806                 dflt="random"
16807                 echo "OK, found random()." >&4
16808         else
16809                 dflt="rand"
16810                 echo "Yick, looks like I have to use rand()." >&4
16811         fi
16812         echo " "
16813         ;;
16814 *)
16815         dflt="$randfunc"
16816         ;;
16817 esac
16818 cont=true
16819
16820 case "$ccflags" in
16821 *-Dmy_rand=*|*-Dmy_srand=*)
16822         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16823         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16824         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16825         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16826         ;;
16827 esac
16828
16829 while $test "$cont"; do
16830         rp="Use which function to generate random numbers?"
16831         . ./myread
16832         if $test "$ans" = "$dflt"; then
16833                 : null
16834         else
16835                 randbits=''
16836         fi
16837         randfunc="$ans"
16838         if set $ans val -f; eval $csym; $val; then
16839                 cont=''
16840         else
16841                 dflt=y
16842                 rp="I cannot find function $ans. Use that name anyway?"
16843                 . ./myread
16844                 dflt=rand
16845                 case "$ans" in
16846                         [yY]*) cont='';;
16847                 esac
16848         fi
16849         case "$cont" in
16850         '')
16851                 case "$randfunc" in
16852                 drand48)
16853                         drand01="drand48()"
16854                         seedfunc="srand48"
16855                         randbits=48
16856                         randseedtype=long
16857                         ;;
16858                 rand|random)
16859                         case "$randbits" in
16860                         '')
16861 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16862                                 $cat >try.c <<EOCP
16863 #$i_unistd I_UNISTD
16864 #$i_stdlib I_STDLIB
16865 #include <stdio.h>
16866 #ifdef I_UNISTD
16867 #  include <unistd.h>
16868 #endif
16869 #ifdef I_STDLIB
16870 #  include <stdlib.h>
16871 #endif
16872 int main()
16873 {
16874         register int i;
16875         register unsigned long tmp;
16876         register unsigned long max = 0L;
16877
16878         for (i = 1000; i; i--) {
16879                 tmp = (unsigned long) $randfunc();
16880                 if (tmp > max) max = tmp;
16881         }
16882         for (i = 0; max; i++)
16883                 max /= 2;
16884         printf("%d\n",i);
16885 }
16886 EOCP
16887                                 set try
16888                                 if eval $compile_ok; then
16889                                         dflt=`try`
16890                                 else
16891                                         dflt='?'
16892                                         echo "(I can't seem to compile the test program...)"
16893                                 fi
16894                                 ;;
16895                         *)
16896                                 dflt="$randbits"
16897                                 ;;
16898                         esac
16899                         rp="How many bits does your $randfunc() function produce?"
16900                         . ./myread
16901                         randbits="$ans"
16902                         $rm -f try.c try
16903                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16904                         seedfunc="s$randfunc"
16905                         randseedtype=unsigned
16906                         ;;
16907                 *)
16908                         dflt="31"
16909                         rp="How many bits does your $randfunc() function produce?"
16910                         . ./myread
16911                         randbits="$ans"
16912                         seedfunc="s$randfunc"
16913                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16914                         if set $seedfunc val -f; eval $csym; $val; then
16915                                 echo "(Using $seedfunc() to seed random generator)"
16916                         else
16917                                 echo "(Warning: no $seedfunc() to seed random generator)"
16918                                 seedfunc=rand
16919                         fi
16920                         randseedtype=unsigned
16921                         ;;
16922                 esac
16923                 ;;
16924         esac
16925 done
16926
16927 echo " "
16928 echo "Determining whether or not we are on an EBCDIC system..." >&4
16929 $cat >try.c <<'EOM'
16930 int main()
16931 {
16932   if ('M'==0xd4) return 0;
16933   return 1;
16934 }
16935 EOM
16936
16937 val=$undef
16938 set try
16939 if eval $compile_ok; then
16940         if $run ./try; then
16941                 echo "You seem to speak EBCDIC." >&4
16942                 val="$define"
16943         else
16944                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16945         fi
16946 else
16947         echo "I'm unable to compile the test program." >&4
16948         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16949 fi
16950 $rm -f try try.*
16951 set ebcdic
16952 eval $setvar
16953
16954 echo " "
16955 $cat >&4 <<EOM
16956 Checking how to flush all pending stdio output...
16957 EOM
16958 # I only know how to find the first 32 possibly open files on SunOS.
16959 # See also hints/sunos_4_1.sh and util.c  --AD
16960 case "$osname" in
16961 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16962 esac
16963 $cat >>try.c <<EOCP
16964 #include <stdio.h>
16965 #$i_unistd I_UNISTD
16966 #ifdef I_UNISTD
16967 # include <unistd.h>
16968 #endif
16969 #$d_sysconf HAS_SYSCONF
16970 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16971 #ifdef HAS_STDIO_STREAM_ARRAY
16972 # define STDIO_STREAM_ARRAY $stdio_stream_array
16973 #endif
16974 int main() {
16975   FILE* p;
16976   unlink("try.out");
16977   p = fopen("try.out", "w");
16978 #ifdef TRY_FPUTC
16979   fputc('x', p);
16980 #else
16981 # ifdef TRY_FPRINTF
16982   fprintf(p, "x");
16983 # endif
16984 #endif
16985 #ifdef TRY_FFLUSH_NULL
16986   fflush(NULL);
16987 #endif
16988 #ifdef TRY_FFLUSH_ALL
16989   {
16990     long open_max = -1;
16991 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16992     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16993 # else
16994 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16995     open_max = sysconf(_SC_OPEN_MAX);
16996 #  else
16997 #   ifdef FOPEN_MAX
16998     open_max = FOPEN_MAX;
16999 #   else
17000 #    ifdef OPEN_MAX
17001     open_max = OPEN_MAX;
17002 #    else
17003 #     ifdef _NFILE
17004     open_max = _NFILE;
17005 #     endif
17006 #    endif
17007 #   endif
17008 #  endif
17009 # endif 
17010 # ifdef HAS_STDIO_STREAM_ARRAY
17011     if (open_max > 0) {
17012       long i;
17013       for (i = 0; i < open_max; i++)
17014             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17015                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17016                 STDIO_STREAM_ARRAY[i]._flag)
17017                 fflush(&STDIO_STREAM_ARRAY[i]);
17018     }   
17019   }
17020 # endif
17021 #endif
17022   _exit(42);
17023 }
17024 EOCP
17025 : first we have to find out how _not_ to flush
17026 $to try.c
17027 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17028     output=''
17029     set try -DTRY_FPUTC
17030     if eval $compile; then
17031             $run ./try 2>/dev/null
17032             code="$?"
17033             $from try.out
17034             if $test ! -s try.out -a "X$code" = X42; then
17035                 output=-DTRY_FPUTC
17036             fi
17037     fi
17038     case "$output" in
17039     '')
17040             set try -DTRY_FPRINTF
17041             if eval $compile; then
17042                     $run ./try 2>/dev/null
17043                     code="$?"
17044                     $from try.out
17045                     if $test ! -s try.out -a "X$code" = X42; then
17046                         output=-DTRY_FPRINTF
17047                     fi
17048             fi
17049         ;;
17050     esac
17051 fi
17052 : check for fflush NULL behaviour
17053 case "$fflushNULL" in
17054 '')     set try -DTRY_FFLUSH_NULL $output
17055         if eval $compile; then
17056                 $run ./try 2>/dev/null
17057                 code="$?"
17058                 $from try.out
17059                 if $test -s try.out -a "X$code" = X42; then
17060                         fflushNULL="`$cat try.out`"
17061                 else
17062                         if $test "X$code" != X42; then
17063                                 $cat >&4 <<EOM
17064 (If this test failed, don't worry, we'll try another method shortly.)
17065 EOM
17066                         fi
17067                 fi
17068         fi
17069         $rm -f core try.core core.try.*
17070         case "$fflushNULL" in
17071         x)      $cat >&4 <<EOM
17072 Your fflush(NULL) works okay for output streams.
17073 Let's see if it clobbers input pipes...
17074 EOM
17075 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17076 # bug that improperly flushes the input end of pipes.  So we avoid the
17077 # autoflush on fork/system/exec support for now. :-(
17078 $cat >tryp.c <<EOCP
17079 #include <stdio.h>
17080 int
17081 main(int argc, char **argv)
17082 {
17083     char buf[1024];
17084     int i;
17085     char *bp = buf;
17086     while (1) {
17087         while ((i = getc(stdin)) != -1
17088                && (*bp++ = i) != '\n'
17089                && bp < &buf[1024])
17090         /* DO NOTHING */ ;
17091         *bp = '\0';
17092         fprintf(stdout, "%s", buf);
17093         fflush(NULL);
17094         if (i == -1)
17095             return 0;
17096         bp = buf;
17097     }
17098 }
17099 EOCP
17100                 fflushNULL="$define"
17101                 set tryp
17102                 if eval $compile; then
17103                     $rm -f tryp.out
17104                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17105                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17106                        $cat >&4 <<EOM
17107 fflush(NULL) seems to behave okay with input streams.
17108 EOM
17109                         fflushNULL="$define"
17110                     else
17111                         $cat >&4 <<EOM
17112 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17113 EOM
17114                         fflushNULL="$undef"
17115                     fi
17116                 fi
17117                 $rm -f core tryp.c tryp.core core.tryp.*
17118                 ;;
17119         '')     $cat >&4 <<EOM
17120 Your fflush(NULL) isn't working (contrary to ANSI C).
17121 EOM
17122                 fflushNULL="$undef"
17123                 ;;
17124         *)      $cat >&4 <<EOM
17125 Cannot figure out whether your fflush(NULL) works or not.
17126 I'm assuming it doesn't (contrary to ANSI C).
17127 EOM
17128                 fflushNULL="$undef"
17129                 ;;
17130         esac
17131         ;;
17132 $define|true|[yY]*)
17133         fflushNULL="$define"
17134         ;;
17135 *)
17136         fflushNULL="$undef"
17137         ;;
17138 esac
17139 : check explicit looping only if NULL did not work, and if the pipe
17140 : bug does not show up on an explicit flush too
17141 case "$fflushNULL" in
17142 "$undef")
17143         $cat >tryp.c <<EOCP
17144 #include <stdio.h>
17145 int
17146 main(int argc, char **argv)
17147 {
17148     char buf[1024];
17149     int i;
17150     char *bp = buf;
17151     while (1) {
17152         while ((i = getc(stdin)) != -1
17153                && (*bp++ = i) != '\n'
17154                && bp < &buf[1024])
17155         /* DO NOTHING */ ;
17156         *bp = '\0';
17157         fprintf(stdout, "%s", buf);
17158         fflush(stdin);
17159         if (i == -1)
17160             return 0;
17161         bp = buf;
17162     }
17163 }
17164 EOCP
17165         set tryp
17166         if eval $compile; then
17167             $rm -f tryp.out
17168             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17169             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17170                $cat >&4 <<EOM
17171 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17172 EOM
17173                 : now check for fflushall behaviour
17174                 case "$fflushall" in
17175                 '')     set try -DTRY_FFLUSH_ALL $output
17176                         if eval $compile; then
17177                                 $cat >&4 <<EOM
17178 (Now testing the other method--but note that this also may fail.)
17179 EOM
17180                                 $run ./try 2>/dev/null
17181                                 code=$?
17182                                 $from try.out
17183                                 if $test -s try.out -a "X$code" = X42; then
17184                                         fflushall="`$cat try.out`"
17185                                 fi
17186                         fi
17187                         $rm -f core try.core core.try.*
17188                         case "$fflushall" in
17189                         x)      $cat >&4 <<EOM
17190 Whew. Flushing explicitly all the stdio streams works.
17191 EOM
17192                                 fflushall="$define"
17193                                 ;;
17194                         '')     $cat >&4 <<EOM
17195 Sigh. Flushing explicitly all the stdio streams doesn't work.
17196 EOM
17197                                 fflushall="$undef"
17198                                 ;;
17199                         *)      $cat >&4 <<EOM
17200 Cannot figure out whether flushing stdio streams explicitly works or not.
17201 I'm assuming it doesn't.
17202 EOM
17203                                 fflushall="$undef"
17204                                 ;;
17205                         esac
17206                         ;;
17207                 "$define"|true|[yY]*)
17208                         fflushall="$define"
17209                         ;;
17210                 *)
17211                         fflushall="$undef"
17212                         ;;
17213                 esac
17214             else
17215                 $cat >&4 <<EOM
17216 All is futile.  Even fflush(stdin) clobbers input pipes!
17217 EOM
17218                 fflushall="$undef"
17219             fi
17220         else
17221             fflushall="$undef"
17222         fi
17223         $rm -f core tryp.c tryp.core core.tryp.*
17224         ;;
17225 *)      fflushall="$undef"
17226         ;;
17227 esac
17228
17229 case "$fflushNULL$fflushall" in
17230 undefundef)
17231         $cat <<EOM
17232 OK, I give up.  I cannot figure out how to flush pending stdio output.
17233 We won't be flushing handles at all before fork/exec/popen.
17234 EOM
17235         ;;
17236 esac
17237 $rm -f try.* try$exe_ext
17238
17239 : Store the full pathname to the ar program for use in the C program
17240 : Respect a hint or command line value for full_ar.
17241 case "$full_ar" in
17242 '') full_ar=$ar ;;
17243 esac
17244
17245 : Store the full pathname to the sed program for use in the C program
17246 full_sed=$sed
17247
17248 : see what type gids are declared as in the kernel
17249 echo " "
17250 echo "Looking for the type for group ids returned by getgid()."
17251 set gid_t gidtype xxx stdio.h sys/types.h
17252 eval $typedef
17253 case "$gidtype" in
17254 xxx)
17255         xxx=`./findhdr sys/user.h`
17256         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17257         case $1 in
17258         unsigned) dflt="$1 $2" ;;
17259         *) dflt="$1" ;;
17260         esac
17261         ;;
17262 *) dflt="$gidtype";;
17263 esac
17264 case "$gidtype" in
17265 gid_t) echo "gid_t found." ;;
17266 *)      rp="What is the type for group ids returned by getgid()?"
17267         . ./myread
17268         gidtype="$ans"
17269         ;;
17270 esac
17271
17272 echo " "
17273 case "$gidtype" in
17274 *_t) zzz="$gidtype"     ;;
17275 *)   zzz="gid"          ;;
17276 esac
17277 echo "Checking the size of $zzz..." >&4 
17278 cat > try.c <<EOCP
17279 #include <sys/types.h>
17280 #include <stdio.h>
17281 int main() {
17282     printf("%d\n", (int)sizeof($gidtype));
17283     exit(0);
17284 }
17285 EOCP
17286 set try
17287 if eval $compile_ok; then
17288         yyy=`$run ./try`
17289         case "$yyy" in
17290         '')     gidsize=4
17291                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17292                 ;;
17293         *)      gidsize=$yyy
17294                 echo "Your $zzz is $gidsize bytes long."
17295                 ;;
17296         esac
17297 else
17298         gidsize=4
17299         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17300 fi
17301
17302
17303 echo " "
17304 case "$gidtype" in
17305 *_t) zzz="$gidtype"     ;;
17306 *)   zzz="gid"          ;;
17307 esac
17308 echo "Checking the sign of $zzz..." >&4 
17309 cat > try.c <<EOCP
17310 #include <sys/types.h>
17311 #include <stdio.h>
17312 int main() {
17313         $gidtype foo = -1;
17314         if (foo < 0)
17315                 printf("-1\n");
17316         else
17317                 printf("1\n");
17318 }
17319 EOCP
17320 set try
17321 if eval $compile; then
17322         yyy=`$run ./try`
17323         case "$yyy" in
17324         '')     gidsign=1
17325                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17326                 ;;
17327         *)      gidsign=$yyy
17328                 case "$gidsign" in
17329                  1) echo "Your $zzz is unsigned." ;;
17330                 -1) echo "Your $zzz is signed."   ;;
17331                 esac
17332                 ;;
17333         esac
17334 else
17335         gidsign=1
17336         echo "(I can't compile the test program--guessing unsigned.)" >&4
17337 fi
17338
17339
17340 echo " "
17341
17342 if $test X"$quadtype" != X; then
17343
17344 echo "Checking how to print 64-bit integers..." >&4
17345
17346 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17347         $cat >try.c <<'EOCP'
17348 #include <sys/types.h>
17349 #include <stdio.h>
17350 int main() {
17351   int q = 12345678901;
17352   printf("%ld\n", q);
17353 }
17354 EOCP
17355         set try
17356         if eval $compile; then
17357                 yyy=`$run ./try`
17358                 case "$yyy" in
17359                 12345678901)
17360                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17361                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17362                         echo "We will use %d."
17363                         ;;
17364                 esac
17365         fi
17366 fi
17367
17368 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17369         $cat >try.c <<'EOCP'
17370 #include <sys/types.h>
17371 #include <stdio.h>
17372 int main() {
17373   long q = 12345678901;
17374   printf("%ld\n", q);
17375 }
17376 EOCP
17377         set try
17378         if eval $compile; then
17379                 yyy=`$run ./try`
17380                 case "$yyy" in
17381                 12345678901)
17382                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17383                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17384                         echo "We will use %ld."
17385                         ;;
17386                 esac
17387         fi
17388 fi
17389
17390 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17391         $cat >try.c <<'EOCP'
17392 #include <sys/types.h>
17393 #include <inttypes.h>
17394 #include <stdio.h>
17395 int main() {
17396   int64_t q = 12345678901;
17397   printf("%" PRId64 "\n", q);
17398 }
17399 EOCP
17400         set try
17401         if eval $compile; then
17402                 yyy=`$run ./try`
17403                 case "$yyy" in
17404                 12345678901)
17405                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17406                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17407                         echo "We will use the C9X style."
17408                         ;;
17409                 esac
17410         fi
17411 fi
17412
17413 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17414         $cat >try.c <<EOCP
17415 #include <sys/types.h>
17416 #include <stdio.h>
17417 int main() {
17418   $quadtype q = 12345678901;
17419   printf("%Ld\n", q);
17420 }
17421 EOCP
17422         set try
17423         if eval $compile; then
17424                 yyy=`$run ./try`
17425                 case "$yyy" in
17426                 12345678901)
17427                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17428                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17429                         echo "We will use %Ld."
17430                         ;;
17431                 esac
17432         fi
17433 fi
17434
17435 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17436         $cat >try.c <<'EOCP'
17437 #include <sys/types.h>
17438 #include <stdio.h>
17439 int main() {
17440   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17441   printf("%lld\n", q);
17442 }
17443 EOCP
17444         set try
17445         if eval $compile; then
17446                 yyy=`$run ./try`
17447                 case "$yyy" in
17448                 12345678901)
17449                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17450                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17451                         echo "We will use the %lld style."
17452                         ;;
17453                 esac
17454         fi
17455 fi
17456
17457 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17458         $cat >try.c <<EOCP
17459 #include <sys/types.h>
17460 #include <stdio.h>
17461 int main() {
17462   $quadtype q = 12345678901;
17463   printf("%qd\n", q);
17464 }
17465 EOCP
17466         set try
17467         if eval $compile; then
17468                 yyy=`$run ./try`
17469                 case "$yyy" in
17470                 12345678901)
17471                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17472                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17473                         echo "We will use %qd."
17474                         ;;
17475                 esac
17476         fi
17477 fi
17478
17479 if $test X"$sPRId64" = X; then
17480         echo "Cannot figure out how to print 64-bit integers." >&4
17481 fi
17482
17483 $rm -f try try.*
17484
17485 fi
17486
17487 case "$sPRId64" in
17488 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17489         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17490         ;;
17491 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17492         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17493         ;;
17494 esac
17495
17496
17497 echo " "
17498 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17499
17500 if $test X"$ivsize" = X8; then
17501         ivdformat="$sPRId64"
17502         uvuformat="$sPRIu64"
17503         uvoformat="$sPRIo64"
17504         uvxformat="$sPRIx64"
17505         uvXUformat="$sPRIXU64"
17506 else
17507         if $test X"$ivsize" = X"$longsize"; then
17508                 ivdformat='"ld"'
17509                 uvuformat='"lu"'
17510                 uvoformat='"lo"'
17511                 uvxformat='"lx"'
17512                 uvXUformat='"lX"'
17513         else
17514                 if $test X"$ivsize" = X"$intsize"; then
17515                         ivdformat='"d"'
17516                         uvuformat='"u"'
17517                         uvoformat='"o"'
17518                         uvxformat='"x"'
17519                         uvXUformat='"X"'
17520                 else
17521                         : far out
17522                         if $test X"$ivsize" = X"$shortsize"; then
17523                                 ivdformat='"hd"'
17524                                 uvuformat='"hu"'
17525                                 uvoformat='"ho"'
17526                                 uvxformat='"hx"'
17527                                 uvXUformat='"hX"'
17528                         fi
17529                 fi
17530         fi
17531 fi
17532
17533 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17534         nveformat="$sPRIeldbl"
17535         nvfformat="$sPRIfldbl"
17536         nvgformat="$sPRIgldbl"
17537         nvEUformat="$sPRIEUldbl"
17538         nvFUformat="$sPRIFUldbl"
17539         nvGUformat="$sPRIGUldbl"
17540 else
17541         nveformat='"e"'
17542         nvfformat='"f"'
17543         nvgformat='"g"'
17544         nvEUformat='"E"'
17545         nvFUformat='"F"'
17546         nvGUformat='"G"'
17547 fi
17548
17549 case "$ivdformat" in
17550 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17551     exit 1
17552     ;;
17553 esac
17554
17555
17556 echo " "
17557 $echo "Checking the format string to be used for gids..." >&4
17558
17559 case "$gidsign" in
17560 -1)     if $test X"$gidsize" = X"$ivsize"; then
17561                 gidformat="$ivdformat"
17562         else
17563                 if $test X"$gidsize" = X"$longsize"; then
17564                         gidformat='"ld"'
17565                 else
17566                         if $test X"$gidsize" = X"$intsize"; then
17567                                 gidformat='"d"'
17568                         else
17569                                 if $test X"$gidsize" = X"$shortsize"; then
17570                                         gidformat='"hd"'
17571                                 fi
17572                         fi
17573                 fi
17574         fi
17575         ;;
17576 *)      if $test X"$gidsize" = X"$uvsize"; then
17577                 gidformat="$uvuformat"
17578         else
17579                 if $test X"$gidsize" = X"$longsize"; then
17580                         gidformat='"lu"'
17581                 else
17582                         if $test X"$gidsize" = X"$intsize"; then
17583                                 gidformat='"u"'
17584                         else
17585                                 if $test X"$gidsize" = X"$shortsize"; then
17586                                         gidformat='"hu"'
17587                                 fi
17588                         fi
17589                 fi
17590         fi
17591         ;;
17592 esac
17593
17594 : see if getgroups exists
17595 set getgroups d_getgrps
17596 eval $inlibc
17597
17598 : see if setgroups exists
17599 set setgroups d_setgrps
17600 eval $inlibc
17601
17602
17603 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17604 echo " "
17605 case "$d_getgrps$d_setgrps" in
17606 *define*)
17607         case "$groupstype" in
17608         '') dflt="$gidtype" ;;
17609         *)  dflt="$groupstype" ;;
17610         esac
17611         $cat <<EOM
17612 What type of pointer is the second argument to getgroups() and setgroups()?
17613 Usually this is the same as group ids, $gidtype, but not always.
17614
17615 EOM
17616         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17617         . ./myread
17618         groupstype="$ans"
17619         ;;
17620 *)  groupstype="$gidtype";;
17621 esac
17622
17623 echo " "
17624 echo "Checking if your $make program sets \$(MAKE)..." >&4
17625 case "$make_set_make" in
17626 '')
17627         $sed 's/^X //' > testmake.mak << 'EOF'
17628 Xall:
17629 X       @echo 'maketemp="$(MAKE)"'
17630 EOF
17631         case "`$make -f testmake.mak 2>/dev/null`" in
17632         *maketemp=*) make_set_make='#' ;;
17633         *)      make_set_make="MAKE=$make" ;;
17634         esac
17635         $rm -f testmake.mak
17636         ;;
17637 esac
17638 case "$make_set_make" in
17639 '#') echo "Yup, it does.";;
17640 *) echo "Nope, it doesn't.";;
17641 esac
17642
17643 : see what type is used for mode_t
17644 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17645 set mode_t modetype int stdio.h sys/types.h
17646 eval $typedef_ask
17647
17648 : see if stdarg is available
17649 echo " "
17650 if $test `./findhdr stdarg.h`; then
17651         echo "<stdarg.h> found." >&4
17652         valstd="$define"
17653 else
17654         echo "<stdarg.h> NOT found." >&4
17655         valstd="$undef"
17656 fi
17657
17658 : see if varags is available
17659 echo " "
17660 if $test `./findhdr varargs.h`; then
17661         echo "<varargs.h> found." >&4
17662 else
17663         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17664 fi
17665
17666 : set up the varargs testing programs
17667 $cat > varargs.c <<EOP
17668 #ifdef I_STDARG
17669 #include <stdarg.h>
17670 #endif
17671 #ifdef I_VARARGS
17672 #include <varargs.h>
17673 #endif
17674
17675 #ifdef I_STDARG
17676 int f(char *p, ...)
17677 #else
17678 int f(va_alist)
17679 va_dcl
17680 #endif
17681 {
17682         va_list ap;
17683 #ifndef I_STDARG
17684         char *p;
17685 #endif
17686 #ifdef I_STDARG
17687         va_start(ap,p);
17688 #else
17689         va_start(ap);
17690         p = va_arg(ap, char *);
17691 #endif
17692         va_end(ap);
17693 }
17694 EOP
17695 $cat > varargs <<EOP
17696 $startsh
17697 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17698         echo "true"
17699 else
17700         echo "false"
17701 fi
17702 $rm -f varargs$_o
17703 EOP
17704 chmod +x varargs
17705
17706 : now check which varargs header should be included
17707 echo " "
17708 i_varhdr=''
17709 case "$valstd" in
17710 "$define")
17711         if `./varargs I_STDARG`; then
17712                 val='stdarg.h'
17713         elif `./varargs I_VARARGS`; then
17714                 val='varargs.h'
17715         fi
17716         ;;
17717 *)
17718         if `./varargs I_VARARGS`; then
17719                 val='varargs.h'
17720         fi
17721         ;;
17722 esac
17723 case "$val" in
17724 '')
17725 echo "I could not find the definition for va_dcl... You have problems..." >&4
17726         val="$undef"; set i_stdarg; eval $setvar
17727         val="$undef"; set i_varargs; eval $setvar
17728         ;;
17729 *) 
17730         set i_varhdr
17731         eval $setvar
17732         case "$i_varhdr" in
17733         stdarg.h)
17734                 val="$define"; set i_stdarg; eval $setvar
17735                 val="$undef"; set i_varargs; eval $setvar
17736                 ;;
17737         varargs.h)
17738                 val="$undef"; set i_stdarg; eval $setvar
17739                 val="$define"; set i_varargs; eval $setvar
17740                 ;;
17741         esac
17742         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17743 esac
17744 $rm -f varargs*
17745
17746 : see if we need va_copy
17747 echo " "
17748 case "$i_stdarg" in
17749 "$define")
17750         $cat >try.c <<EOCP
17751 #include <stdarg.h>
17752 #include <stdio.h>
17753 #$i_stdlib I_STDLIB
17754 #ifdef I_STDLIB
17755 #include <stdlib.h>
17756 #endif
17757 #include <signal.h>
17758
17759 int
17760 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17761 {
17762   return vfprintf(f, fmt, *valp);
17763 }
17764  
17765 int    
17766 myvfprintf(FILE *f, const  char *fmt, va_list val)
17767 {
17768   return ivfprintf(f, fmt, &val);
17769 }
17770       
17771 int
17772 myprintf(char *fmt, ...) 
17773 {
17774   va_list val;
17775   va_start(val, fmt);
17776   return myvfprintf(stdout, fmt, val); 
17777 }         
17778
17779 int
17780 main(int ac, char **av)
17781 {
17782   signal(SIGSEGV, exit);
17783
17784   myprintf("%s%cs all right, then\n", "that", '\'');                            
17785   exit(0);      
17786 }
17787 EOCP
17788         set try
17789         if eval $compile && $run ./try 2>&1 >/dev/null; then
17790                 case "`$run ./try`" in
17791                 "that's all right, then")
17792                         okay=yes
17793                         ;;
17794                 esac
17795         fi
17796         case "$okay" in
17797         yes)    echo "It seems that you don't need va_copy()." >&4
17798                 need_va_copy="$undef"
17799                 ;;
17800         *)      echo "It seems that va_copy() or similar will be needed." >&4
17801                 need_va_copy="$define"
17802                 ;;
17803         esac
17804         $rm -f try.* core core.* *.core *.core.*
17805         ;;
17806 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17807         ;;
17808 esac
17809
17810 : see what type is used for size_t
17811 rp="What is the type used for the length parameter for string functions?"
17812 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17813 eval $typedef_ask
17814
17815 : check for type of arguments to gethostbyaddr. 
17816 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17817         case "$d_gethbyaddr" in
17818         $define)
17819                 $cat <<EOM
17820
17821 Checking to see what type of arguments are accepted by gethostbyaddr().
17822 EOM
17823                 hdrs="$define sys/types.h
17824                         $d_socket sys/socket.h 
17825                         $i_niin netinet/in.h 
17826                         $i_netdb netdb.h
17827                         $i_unistd unistd.h"
17828                 : The first arg can 'char *' or 'void *'
17829                 : The second arg is some of integral type
17830                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17831                         for yyy in size_t long int; do
17832                                 case "$netdb_host_type" in
17833                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17834                                         if ./protochk "$try" $hdrs; then
17835                                                 echo "Your system accepts $xxx for the first arg."
17836                                                 echo "...and $yyy for the second arg."
17837                                                 netdb_host_type="$xxx"
17838                                                 netdb_hlen_type="$yyy"
17839                                         fi
17840                                         ;;
17841                                 esac
17842                         done
17843                 done
17844                 : In case none of those worked, prompt the user.
17845                 case "$netdb_host_type" in
17846                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17847                         dflt='char *'
17848                         . ./myread
17849                         netdb_host_type=$ans
17850                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17851                         dflt="$sizetype"
17852                         . ./myread
17853                         netdb_hlen_type=$ans
17854                         ;;
17855                 esac
17856                 ;;
17857         *)      : no gethostbyaddr, so pick harmless defaults
17858                 netdb_host_type='char *'
17859                 netdb_hlen_type="$sizetype"
17860                 ;;
17861         esac
17862         # Remove the "const" if needed. -- but then we'll have a 
17863         # prototype clash!
17864         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17865 fi
17866
17867 : check for type of argument to gethostbyname. 
17868 if test "X$netdb_name_type" = X ; then
17869         case "$d_gethbyname" in
17870         $define)
17871                 $cat <<EOM
17872
17873 Checking to see what type of argument is accepted by gethostbyname().
17874 EOM
17875                 hdrs="$define sys/types.h
17876                         $d_socket sys/socket.h 
17877                         $i_niin netinet/in.h 
17878                         $i_netdb netdb.h
17879                         $i_unistd unistd.h"
17880                 for xxx in "const char *" "char *"; do
17881                         case "$netdb_name_type" in
17882                         '')     try="extern struct hostent *gethostbyname($xxx);"
17883                                 if ./protochk "$try" $hdrs; then
17884                                         echo "Your system accepts $xxx."
17885                                         netdb_name_type="$xxx"
17886                                 fi
17887                                 ;;
17888                         esac
17889                 done
17890                 : In case none of those worked, prompt the user.
17891                 case "$netdb_name_type" in
17892                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17893                         dflt='char *'
17894                         . ./myread
17895                         netdb_name_type=$ans
17896                         ;;
17897                 esac
17898                 ;;
17899         *)      : no gethostbyname, so pick harmless default
17900                 netdb_name_type='char *'
17901                 ;;
17902         esac
17903 fi
17904
17905 : check for type of 1st argument to getnetbyaddr. 
17906 if test "X$netdb_net_type" = X ; then
17907         case "$d_getnbyaddr" in
17908         $define)
17909                 $cat <<EOM
17910
17911 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17912 EOM
17913                 hdrs="$define sys/types.h
17914                         $d_socket sys/socket.h 
17915                         $i_niin netinet/in.h 
17916                         $i_netdb netdb.h
17917                         $i_unistd unistd.h"
17918                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17919                         case "$netdb_net_type" in
17920                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17921                                 if ./protochk "$try" $hdrs; then
17922                                         echo "Your system accepts $xxx."
17923                                         netdb_net_type="$xxx"
17924                                 fi
17925                                 ;;
17926                         esac
17927                 done
17928                 : In case none of those worked, prompt the user.
17929                 case "$netdb_net_type" in
17930                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17931                         dflt='long'
17932                         . ./myread
17933                         netdb_net_type=$ans
17934                         ;;
17935                 esac
17936                 ;;
17937         *)      : no getnetbyaddr, so pick harmless default
17938                 netdb_net_type='long'
17939                 ;;
17940         esac
17941 fi
17942 : locate the preferred pager for this system
17943 fn=f/
17944 case "$pager" in
17945 '')
17946         dflt=''
17947         case "$pg" in
17948         /*) dflt=$pg;;
17949         [a-zA-Z]:/*) dflt=$pg;;
17950         esac
17951         case "$more" in
17952         /*) dflt=$more;;
17953         [a-zA-Z]:/*) dflt=$more;;
17954         esac
17955         case "$less" in
17956         /*) dflt=$less;;
17957         [a-zA-Z]:/*) dflt=$less;;
17958         esac
17959         case "$dflt" in
17960         '') dflt=/usr/ucb/more;;
17961         esac
17962         ;;
17963 *)      dflt="$pager"
17964         : Instruct ./getfile to trust the hinted or previous pager value,
17965         : even if it does not begin with a slash.  For example, on os2,
17966         : pager might be cmd /c more.  See comments in UU/getfile.
17967         fn="f/($pager)"
17968         ;;
17969 esac
17970 echo " "
17971 rp='What pager is used on your system?'
17972 . ./getfile
17973 pager="$ans"
17974
17975 : see what type pids are declared as in the kernel
17976 rp="What is the type of process ids on this system?"
17977 set pid_t pidtype int stdio.h sys/types.h
17978 eval $typedef_ask
17979
17980 : Find earliest binary compatible site_perl subdirectory perl can use.
17981 xs_apiversion=$version # The current site_perl version.
17982 : Find earliest pure perl site_perl subdirectory perl can use.
17983 : The versioned directories started at 5.005.
17984 pm_apiversion='5.005'
17985
17986 : see if ar generates random libraries by itself
17987 echo " "
17988 echo "Checking how to generate random libraries on your machine..." >&4
17989 echo 'int bar1() { return bar2(); }' > bar1.c
17990 echo 'int bar2() { return 2; }' > bar2.c
17991 $cat > foo.c <<'EOP'
17992 int main() { printf("%d\n", bar1()); exit(0); }
17993 EOP
17994 $cc $ccflags -c bar1.c >/dev/null 2>&1
17995 $cc $ccflags -c bar2.c >/dev/null 2>&1
17996 $cc $ccflags -c foo.c >/dev/null 2>&1
17997 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17998 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17999         $run ./foobar >/dev/null 2>&1; then
18000         echo "$ar appears to generate random libraries itself."
18001         orderlib=false
18002         ranlib=":"
18003 elif $ar ts bar$_a >/dev/null 2>&1 &&
18004         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18005         $run ./foobar >/dev/null 2>&1; then
18006                 echo "a table of contents needs to be added with '$ar ts'."
18007                 orderlib=false
18008                 ranlib="$ar ts"
18009 else
18010         case "$ranlib" in
18011         :) ranlib='';;
18012         '')
18013                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18014                 $test -f $ranlib || ranlib=''
18015                 ;;
18016         esac
18017         if $test -n "$ranlib"; then
18018                 echo "your system has '$ranlib'; we'll use that."
18019                 orderlib=false
18020         else
18021                 echo "your system doesn't seem to support random libraries"
18022                 echo "so we'll use lorder and tsort to order the libraries."
18023                 orderlib=true
18024                 ranlib=":"
18025         fi
18026 fi
18027 $rm -f foo* bar* 
18028
18029 : check for type of arguments to select. 
18030 case "$selecttype" in
18031 '') case "$d_select" in
18032         $define)
18033                 echo " "
18034                 $cat <<EOM
18035 Checking to see what type of arguments are accepted by select().
18036 EOM
18037                 hdrs="$define sys/types.h
18038                         $i_systime sys/time.h 
18039                         $i_sysselct sys/select.h
18040                         $d_socket sys/socket.h"
18041                 : The first arg can be int, unsigned, or size_t
18042                 : The last arg may or may not be 'const'
18043                 val=''
18044                 : void pointer has been seen but using that
18045                 : breaks the selectminbits test
18046                 for xxx in 'fd_set *' 'int *'; do
18047                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18048                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18049                                         case "$val" in
18050                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18051                                                 if ./protochk "$try" $hdrs; then
18052                                                         echo "Your system accepts $xxx."
18053                                                         val="$xxx"
18054                                                 fi
18055                                                 ;;
18056                                         esac
18057                                 done
18058                         done
18059                 done
18060                 case "$val" in
18061                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18062                         case "$d_fd_set" in
18063                                 $define) dflt="fd_set *" ;;
18064                                 *)              dflt="int *" ;;
18065                         esac
18066                         . ./myread
18067                         val=$ans
18068                         ;;
18069                 esac
18070                 selecttype="$val"
18071                 ;;
18072         *)      : no select, so pick a harmless default
18073                 selecttype='int *'
18074                 ;;
18075         esac
18076         ;;
18077 esac
18078
18079 : check for the select 'width'
18080 case "$selectminbits" in
18081 '') case "$d_select" in
18082         $define)
18083                 $cat <<EOM
18084
18085 Checking to see on how many bits at a time your select() operates...
18086 EOM
18087                 $cat >try.c <<EOCP
18088 #include <sys/types.h>
18089 #$i_time I_TIME
18090 #$i_systime I_SYS_TIME
18091 #$i_systimek I_SYS_TIME_KERNEL
18092 #ifdef I_TIME
18093 #   include <time.h>
18094 #endif
18095 #ifdef I_SYS_TIME
18096 #   ifdef I_SYS_TIME_KERNEL
18097 #       define KERNEL
18098 #   endif
18099 #   include <sys/time.h>
18100 #   ifdef I_SYS_TIME_KERNEL
18101 #       undef KERNEL
18102 #   endif
18103 #endif
18104 #$i_sysselct I_SYS_SELECT
18105 #ifdef I_SYS_SELECT
18106 #include <sys/select.h>
18107 #endif
18108 #$d_socket HAS_SOCKET
18109 #ifdef HAS_SOCKET
18110 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18111 #endif
18112 #include <stdio.h>
18113 $selecttype b;
18114 #define S sizeof(*(b))
18115 #define MINBITS 64
18116 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18117 #define NBITS  (NBYTES * 8)
18118 int main() {
18119     char s[NBYTES];
18120     struct timeval t;
18121     int i;
18122     FILE* fp;
18123     int fd;
18124
18125     fclose(stdin);
18126     fp = fopen("try.c", "r");
18127     if (fp == 0)
18128       exit(1);
18129     fd = fileno(fp);
18130     if (fd < 0)
18131       exit(2);
18132     b = ($selecttype)s;
18133     for (i = 0; i < NBITS; i++)
18134         FD_SET(i, b);
18135     t.tv_sec  = 0;
18136     t.tv_usec = 0;
18137     select(fd + 1, b, 0, 0, &t);
18138     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18139     printf("%d\n", i + 1);
18140     return 0;
18141 }
18142 EOCP
18143                 set try
18144                 if eval $compile_ok; then
18145                         selectminbits=`$run ./try`
18146                         case "$selectminbits" in
18147                         '')     cat >&4 <<EOM
18148 Cannot figure out on how many bits at a time your select() operates.
18149 I'll play safe and guess it is 32 bits.
18150 EOM
18151                                 selectminbits=32
18152                                 bits="32 bits"
18153                                 ;;
18154                         1)      bits="1 bit" ;;
18155                         *)      bits="$selectminbits bits" ;;
18156                         esac
18157                         echo "Your select() operates on $bits at a time." >&4
18158                 else
18159                         rp='What is the minimum number of bits your select() operates on?'
18160                         case "$byteorder" in
18161                         1234|12345678)  dflt=32 ;;
18162                         *)              dflt=1  ;;
18163                         esac
18164                         . ./myread
18165                         val=$ans
18166                         selectminbits="$val"
18167                 fi
18168                 $rm -f try.* try
18169                 ;;
18170         *)      : no select, so pick a harmless default
18171                 selectminbits='32'
18172                 ;;
18173         esac
18174         ;;
18175 esac
18176
18177 : Trace out the files included by signal.h, then look for SIGxxx names.
18178 : Remove SIGARRAYSIZE used by HPUX.
18179 : Remove SIGSTKSIZE used by Linux.
18180 : Remove SIGSTKSZ used by Posix.
18181 : Remove SIGTYP void lines used by OS2.
18182 : Some cpps, like os390, dont give the file name anywhere
18183 if [ "X$fieldn" = X ]; then
18184         : Just make some guesses.  We check them later.
18185         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18186 else
18187         xxx=`echo '#include <signal.h>' |
18188         $cppstdin $cppminus $cppflags 2>/dev/null |
18189         $grep '^[       ]*#.*include' | 
18190         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18191 fi
18192 : Check this list of files to be sure we have parsed the cpp output ok.
18193 : This will also avoid potentially non-existent files, such 
18194 : as ../foo/bar.h
18195 xxxfiles=''
18196 for xx in $xxx /dev/null ; do
18197         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18198 done
18199 : If we have found no files, at least try signal.h
18200 case "$xxxfiles" in
18201 '')     xxxfiles=`./findhdr signal.h` ;;
18202 esac
18203 xxx=`awk '
18204 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18205         print substr($2, 4, 20)
18206 }
18207 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18208         print substr($3, 4, 20)
18209 }' $xxxfiles`
18210 : Append some common names just in case the awk scan failed.
18211 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18212 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18213 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18214 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18215 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18216
18217 : generate a few handy files for later
18218 $cat > signal.c <<'EOCP'
18219 #include <sys/types.h>
18220 #include <signal.h>
18221 #include <stdio.h>
18222 int main() {
18223
18224 /* Strange style to avoid deeply-nested #if/#else/#endif */
18225 #ifndef NSIG
18226 #  ifdef _NSIG
18227 #    define NSIG (_NSIG)
18228 #  endif
18229 #endif
18230
18231 #ifndef NSIG
18232 #  ifdef SIGMAX
18233 #    define NSIG (SIGMAX+1)
18234 #  endif
18235 #endif
18236
18237 #ifndef NSIG
18238 #  ifdef SIG_MAX
18239 #    define NSIG (SIG_MAX+1)
18240 #  endif
18241 #endif
18242
18243 #ifndef NSIG
18244 #  ifdef MAXSIG
18245 #    define NSIG (MAXSIG+1)
18246 #  endif
18247 #endif
18248
18249 #ifndef NSIG
18250 #  ifdef MAX_SIG
18251 #    define NSIG (MAX_SIG+1)
18252 #  endif
18253 #endif
18254
18255 #ifndef NSIG
18256 #  ifdef SIGARRAYSIZE
18257 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18258 #  endif
18259 #endif
18260
18261 #ifndef NSIG
18262 #  ifdef _sys_nsig
18263 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18264 #  endif
18265 #endif
18266
18267 /* Default to some arbitrary number that's big enough to get most
18268    of the common signals.
18269 */
18270 #ifndef NSIG
18271 #    define NSIG 50
18272 #endif
18273
18274 printf("NSIG %d\n", NSIG);
18275
18276 #ifndef JUST_NSIG
18277
18278 EOCP
18279
18280 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18281 {
18282         printf "#ifdef SIG"; printf $1; printf "\n"
18283         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18284         printf $1; printf ");\n"
18285         printf "#endif\n"
18286 }
18287 END {
18288         printf "#endif /* JUST_NSIG */\n";
18289         printf "exit(0);\n}\n";
18290 }
18291 ' >>signal.c
18292 $cat >signal.awk <<'EOP'
18293 BEGIN { ndups = 0 }
18294 $1 ~ /^NSIG$/ { nsig = $2 }
18295 ($1 !~ /^NSIG$/) && (NF == 2) {
18296     if ($2 > maxsig) { maxsig = $2 }
18297     if (sig_name[$2]) {
18298         dup_name[ndups] = $1
18299         dup_num[ndups] = $2
18300         ndups++ 
18301     }
18302     else {
18303         sig_name[$2] = $1
18304         sig_num[$2] = $2
18305     }
18306 }
18307 END { 
18308     if (nsig == 0) {
18309         nsig = maxsig + 1
18310     }
18311     printf("NSIG %d\n", nsig);
18312     for (n = 1; n < nsig; n++) {
18313         if (sig_name[n]) {
18314             printf("%s %d\n", sig_name[n], sig_num[n])
18315         }
18316         else {
18317             printf("NUM%d %d\n", n, n) 
18318         }
18319     }
18320     for (n = 0; n < ndups; n++) {
18321         printf("%s %d\n", dup_name[n], dup_num[n])
18322     }
18323 }
18324 EOP
18325 $cat >signal_cmd <<EOS
18326 $startsh
18327 if $test -s signal.lst; then
18328     echo "Using your existing signal.lst file"
18329         exit 0
18330 fi
18331 xxx="$xxx"
18332 EOS
18333 $cat >>signal_cmd <<'EOS'
18334
18335 set signal
18336 if eval $compile_ok; then
18337         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18338 else
18339         echo "(I can't seem be able to compile the whole test program)" >&4
18340         echo "(I'll try it in little pieces.)" >&4
18341         set signal -DJUST_NSIG
18342         if eval $compile_ok; then
18343                 $run ./signal$_exe > signal.nsg
18344                 $cat signal.nsg
18345         else
18346                 echo "I can't seem to figure out how many signals you have." >&4
18347                 echo "Guessing 50." >&4
18348                 echo 'NSIG 50' > signal.nsg
18349         fi
18350         : Now look at all the signal names, one at a time.
18351         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18352                 $cat > signal.c <<EOCP
18353 #include <sys/types.h>
18354 #include <signal.h>
18355 #include <stdio.h>
18356 int main() {
18357 printf("$xx %d\n", SIG${xx});
18358 return 0;
18359 }
18360 EOCP
18361                 set signal
18362                 if eval $compile; then
18363                         echo "SIG${xx} found."
18364                         $run ./signal$_exe  >> signal.ls1
18365                 else
18366                         echo "SIG${xx} NOT found."
18367                 fi
18368         done
18369         if $test -s signal.ls1; then
18370                 $cat signal.nsg signal.ls1 |
18371                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18372         fi
18373
18374 fi
18375 if $test -s signal.lst; then
18376         :
18377 else
18378         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18379         echo 'kill -l' >signal
18380         set X `csh -f <signal`
18381         $rm -f signal
18382         shift
18383         case $# in
18384         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18385         esac
18386         echo $@ | $tr ' ' $trnl | \
18387             $awk '{ printf "%s %d\n", $1, ++s; }
18388                   END { printf "NSIG %d\n", ++s }' >signal.lst
18389 fi
18390 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18391 EOS
18392 chmod a+x signal_cmd
18393 $eunicefix signal_cmd
18394
18395 : generate list of signal names
18396 echo " "
18397 case "$sig_name_init" in
18398 '') doinit=yes ;;
18399 *)  case "$sig_num_init" in
18400     ''|*,*) doinit=yes ;;
18401     esac ;;
18402 esac
18403 case "$doinit" in
18404 yes)
18405         echo "Generating a list of signal names and numbers..." >&4
18406         . ./signal_cmd
18407         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18408         sig_name=`$awk 'BEGIN { printf "ZERO " }
18409                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18410         sig_num=`$awk  'BEGIN { printf "0 " }
18411                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18412         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18413                              !/^NSIG/   { printf "\"%s\", ", $1 }
18414                              END        { printf "0\n" }' signal.lst`
18415         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18416                              !/^NSIG/   { printf "%d, ", $2}
18417                              END        { printf "0\n"}' signal.lst`
18418         ;;
18419 esac
18420 echo "The following $sig_count signals are available:"
18421 echo " "
18422 echo $sig_name | $awk \
18423 'BEGIN { linelen = 0 }
18424 {
18425         for (i = 1; i <= NF; i++) {
18426                 name = "SIG" $i " "
18427                 linelen = linelen + length(name)
18428                 if (linelen > 70) {
18429                         printf "\n"
18430                         linelen = length(name)
18431                 }
18432                 printf "%s", name
18433         }
18434         printf "\n"
18435 }'
18436 sig_size=`echo $sig_name | awk '{print NF}'`
18437 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18438
18439 echo " "
18440 case "$sizetype" in
18441 *_t) zzz="$sizetype"    ;;
18442 *)   zzz="filesize"     ;;
18443 esac
18444 echo "Checking the size of $zzz..." >&4 
18445 cat > try.c <<EOCP
18446 #include <sys/types.h>
18447 #include <stdio.h>
18448 int main() {
18449     printf("%d\n", (int)sizeof($sizetype));
18450     exit(0);
18451 }
18452 EOCP
18453 set try
18454 if eval $compile_ok; then
18455         yyy=`$run ./try`
18456         case "$yyy" in
18457         '')     sizesize=4
18458                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18459                 ;;
18460         *)      sizesize=$yyy
18461                 echo "Your $zzz size is $sizesize bytes."
18462                 ;;
18463         esac
18464 else
18465         sizesize=4
18466         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18467 fi
18468
18469
18470 : check for socklen_t
18471 echo " "
18472 echo "Checking to see if you have socklen_t..." >&4
18473 $cat >try.c <<EOCP
18474 #include <sys/types.h>
18475 #$d_socket HAS_SOCKET
18476 #ifdef HAS_SOCKET
18477 #include <sys/socket.h>
18478 #endif
18479 int main() { socklen_t x = 16; }
18480 EOCP
18481 set try
18482 if eval $compile; then
18483         val="$define"
18484         echo "You have socklen_t."
18485 else
18486         val="$undef"
18487         echo "You do not have socklen_t."
18488         case "$sizetype" in
18489         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18490         esac
18491 fi
18492 $rm -f try try.*
18493 set d_socklen_t
18494 eval $setvar
18495
18496 : see if this is a socks.h system
18497 set socks.h i_socks
18498 eval $inhdr
18499
18500 : check for type of the size argument to socket calls
18501 case "$d_socket" in
18502 "$define")
18503         $cat <<EOM
18504
18505 Checking to see what type is the last argument of accept().
18506 EOM
18507         yyy=''
18508         case "$d_socklen_t" in
18509         "$define") yyy="$yyy socklen_t"
18510         esac
18511         yyy="$yyy $sizetype int long unsigned"
18512         for xxx in $yyy; do
18513                 case "$socksizetype" in
18514                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18515                         case "$usesocks" in
18516                         "$define")
18517                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18518                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18519                                         socksizetype="$xxx"
18520                                 fi
18521                                 ;;
18522                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18523                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18524                                         socksizetype="$xxx"
18525                                 fi
18526                                 ;;
18527                         esac
18528                         ;;
18529                 esac
18530         done
18531 : In case none of those worked, prompt the user.
18532         case "$socksizetype" in
18533         '')     rp='What is the type for socket address structure sizes?'
18534                 dflt='int'
18535                 . ./myread
18536                 socksizetype=$ans
18537                 ;;
18538         esac
18539         ;;
18540 *)      : no sockets, so pick relatively harmless default
18541         socksizetype='int'
18542         ;;
18543 esac
18544
18545 : see what type is used for signed size_t
18546 set ssize_t ssizetype int stdio.h sys/types.h
18547 eval $typedef
18548 dflt="$ssizetype"
18549 $cat > try.c <<EOM
18550 #include <stdio.h>
18551 #include <sys/types.h>
18552 #define Size_t $sizetype
18553 #define SSize_t $dflt
18554 int main()
18555 {
18556         if (sizeof(Size_t) == sizeof(SSize_t))
18557                 printf("$dflt\n");
18558         else if (sizeof(Size_t) == sizeof(int))
18559                 printf("int\n");
18560         else 
18561                 printf("long\n");
18562         exit(0);
18563 }
18564 EOM
18565 echo " "
18566 set try
18567 if eval $compile_ok && $run ./try > /dev/null; then
18568         ssizetype=`$run ./try`
18569         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18570 else
18571         $cat >&4 <<EOM
18572 Help! I can't compile and run the ssize_t test program: please enlighten me!
18573 (This is probably a misconfiguration in your system or libraries, and
18574 you really ought to fix it.  Still, I'll try anyway.)
18575
18576 I need a type that is the same size as $sizetype, but is guaranteed to
18577 be signed.  Common values are ssize_t, int and long.
18578
18579 EOM
18580         rp="What signed type is the same size as $sizetype?"
18581         . ./myread
18582         ssizetype="$ans"
18583 fi
18584 $rm -f try try.*
18585
18586 : see what type of char stdio uses.
18587 echo " "
18588 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18589 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18590         echo "Your stdio uses unsigned chars." >&4
18591         stdchar="unsigned char"
18592 else
18593         echo "Your stdio uses signed chars." >&4
18594         stdchar="char"
18595 fi
18596 $rm -f stdioh
18597
18598
18599
18600 : see what type uids are declared as in the kernel
18601 echo " "
18602 echo "Looking for the type for user ids returned by getuid()."
18603 set uid_t uidtype xxx stdio.h sys/types.h
18604 eval $typedef
18605 case "$uidtype" in
18606 xxx)
18607         xxx=`./findhdr sys/user.h`
18608         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18609         case $1 in
18610         unsigned) dflt="$1 $2" ;;
18611         *) dflt="$1" ;;
18612         esac
18613         ;;
18614 *) dflt="$uidtype";;
18615 esac
18616 case "$uidtype" in
18617 uid_t)  echo "uid_t found." ;;
18618 *)      rp="What is the type for user ids returned by getuid()?"
18619         . ./myread
18620         uidtype="$ans"
18621         ;;
18622 esac
18623
18624 echo " "
18625 case "$uidtype" in
18626 *_t) zzz="$uidtype"     ;;
18627 *)   zzz="uid"          ;;
18628 esac
18629 echo "Checking the size of $zzz..." >&4 
18630 cat > try.c <<EOCP
18631 #include <sys/types.h>
18632 #include <stdio.h>
18633 int main() {
18634     printf("%d\n", (int)sizeof($uidtype));
18635     exit(0);
18636 }
18637 EOCP
18638 set try
18639 if eval $compile_ok; then
18640         yyy=`$run ./try`
18641         case "$yyy" in
18642         '')     uidsize=4
18643                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18644                 ;;
18645         *)      uidsize=$yyy
18646                 echo "Your $zzz is $uidsize bytes long."
18647                 ;;
18648         esac
18649 else
18650         uidsize=4
18651         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18652 fi
18653
18654 echo " "
18655 case "$uidtype" in
18656 *_t) zzz="$uidtype"     ;;
18657 *)   zzz="uid"          ;;
18658 esac
18659 echo "Checking the sign of $zzz..." >&4
18660 cat > try.c <<EOCP
18661 #include <sys/types.h>
18662 #include <stdio.h>
18663 int main() {
18664         $uidtype foo = -1;
18665         if (foo < 0)
18666                 printf("-1\n");
18667         else
18668                 printf("1\n");
18669 }
18670 EOCP
18671 set try
18672 if eval $compile; then
18673         yyy=`$run ./try`
18674         case "$yyy" in
18675         '')     uidsign=1
18676                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18677                 ;;
18678         *)      uidsign=$yyy
18679                 case "$uidsign" in
18680                  1) echo "Your $zzz is unsigned." ;;
18681                 -1) echo "Your $zzz is signed."   ;;
18682                 esac
18683                 ;;
18684         esac
18685 else
18686         uidsign=1
18687         echo "(I can't compile the test program--guessing unsigned.)" >&4
18688 fi
18689
18690
18691
18692 echo " "
18693 $echo "Checking the format string to be used for uids..." >&4
18694
18695 case "$uidsign" in
18696 -1)     if $test X"$uidsize" = X"$ivsize"; then
18697                 uidformat="$ivdformat"
18698         else
18699                 if $test X"$uidsize" = X"$longsize"; then
18700                         uidformat='"ld"'
18701                 else
18702                         if $test X"$uidsize" = X"$intsize"; then
18703                                 uidformat='"d"'
18704                         else
18705                                 if $test X"$uidsize" = X"$shortsize"; then
18706                                         uidformat='"hd"'
18707                                 fi
18708                         fi
18709                 fi
18710         fi
18711         ;;
18712 *)      if $test X"$uidsize" = X"$uvsize"; then
18713                 uidformat="$uvuformat"
18714         else
18715                 if $test X"$uidsize" = X"$longsize"; then
18716                         uidformat='"lu"'
18717                 else
18718                         if $test X"$uidsize" = X"$intsize"; then
18719                                 uidformat='"u"'
18720                         else
18721                                 if $test X"$uidsize" = X"$shortsize"; then
18722                                         uidformat='"hu"'
18723                                 fi
18724                         fi
18725                 fi
18726         fi
18727         ;;
18728 esac
18729
18730 : determine compiler compiler
18731 case "$yacc" in
18732 '')
18733         dflt=yacc;;
18734 *)
18735         dflt="$yacc";;
18736 esac
18737 echo " "
18738 comp='yacc'
18739 if $test -f "$byacc$_exe"; then
18740         dflt="$byacc"
18741         comp="byacc or $comp"
18742 fi
18743 if $test -f "$bison$_exe"; then
18744         comp="$comp or bison -y"
18745 fi
18746 rp="Which compiler compiler ($comp) shall I use?"
18747 . ./myread
18748 yacc="$ans"
18749 case "$yacc" in
18750 *bis*)
18751         case "$yacc" in
18752         *-y*) ;;
18753         *)
18754                 yacc="$yacc -y"
18755                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18756                 ;;
18757         esac
18758         ;;
18759 esac
18760
18761 : see if this is a fp.h system
18762 set fp.h i_fp
18763 eval $inhdr
18764
18765 : see if this is a fp_class.h system
18766 set fp_class.h i_fp_class
18767 eval $inhdr
18768
18769 : see if this is a ieeefp.h system
18770 case "$i_ieeefp" in
18771 '' ) set ieeefp.h i_ieeefp
18772      eval $inhdr
18773      ;;
18774 esac
18775
18776 : see if this is a libutil.h system
18777 set libutil.h i_libutil
18778 eval $inhdr
18779
18780 : see if mach cthreads are available
18781 if test "X$usethreads" = "X$define"; then
18782         set mach/cthreads.h i_machcthr
18783         eval $inhdr
18784 else
18785         i_machcthr="$undef"
18786 fi
18787
18788
18789
18790 : see if this is a math.h system
18791 set math.h i_math
18792 eval $inhdr
18793
18794 : see if this is a mntent.h system
18795 set mntent.h i_mntent
18796 eval $inhdr
18797
18798 : see if ndbm.h is available
18799 set ndbm.h t_ndbm
18800 eval $inhdr
18801
18802 case "$t_ndbm" in
18803 $undef)
18804     # Some Linux distributions such as RedHat 7.1 put the
18805     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18806     if $test -f /usr/include/gdbm/ndbm.h; then
18807         echo '<gdbm/ndbm.h> found.'
18808         ccflags="$ccflags -I/usr/include/gdbm"
18809         cppflags="$cppflags -I/usr/include/gdbm"
18810         t_ndbm=$define
18811     fi
18812     ;;
18813 esac
18814
18815 case "$t_ndbm" in
18816 $define)
18817         : see if dbm_open exists
18818         set dbm_open d_dbm_open
18819         eval $inlibc
18820         case "$d_dbm_open" in
18821         $undef)
18822                 t_ndbm="$undef"
18823                 echo "We won't be including <ndbm.h>"
18824                 ;;
18825         esac
18826         ;;
18827 esac
18828 val="$t_ndbm"
18829 set i_ndbm
18830 eval $setvar
18831
18832 : see if net/errno.h is available
18833 val=''
18834 set net/errno.h val
18835 eval $inhdr
18836
18837 : Unfortunately, it causes problems on some systems.  Arrgh.
18838 case "$val" in
18839 $define)
18840         cat > try.c <<'EOM'
18841 #include <stdio.h>
18842 #include <errno.h>
18843 #include <net/errno.h>
18844 int func()
18845 {
18846         return ENOTSOCK;
18847 }
18848 EOM
18849         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18850                 echo "We'll be including <net/errno.h>." >&4
18851         else
18852                 echo "We won't be including <net/errno.h>." >&4
18853                 val="$undef"
18854         fi
18855         $rm -f try.* try
18856         ;;
18857 esac
18858 set i_neterrno
18859 eval $setvar
18860
18861 : see if netinet/tcp.h is available
18862 set netinet/tcp.h i_netinettcp
18863 eval $inhdr
18864
18865 : see if this is a poll.h system
18866 set poll.h i_poll
18867 eval $inhdr
18868
18869 : see if this is a prot.h system
18870 set prot.h i_prot
18871 eval $inhdr
18872
18873 echo " "
18874 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18875 $cat <<'EOSH' > Cppsym.know
18876 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18877 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18878 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18879 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18880 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18881 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18882 bull c cadmus clipper CMU COFF COMPILER_VERSION
18883 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18884 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18885 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18886 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18887 GLIBC GLIBC_MINOR
18888 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18889 H3050R H3050RX hbullx20 hcx host_mips
18890 hp200 hp300 hp700 HP700 hp800 hp9000
18891 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18892 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18893 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18894 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18895 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18896 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18897 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18898 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18899 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18900 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18901 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18902 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18903 MATH_HAS_NO_SIDE_EFFECTS
18904 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18905 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18906 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18907 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18908 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18909 NetBSD news1500 news1700 news1800 news1900 news3700
18910 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18911 ns32016 ns32332 ns32k nsc32000
18912 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18913 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18914 pc532 pdp11 PGC PIC plexus PORTAR posix
18915 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18916 POSIX_C_SOURCE POSIX_SOURCE POWER
18917 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18918 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18919 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18920 sony sony_news sonyrisc sparc sparclite spectrum
18921 stardent stdc STDC_EXT stratos sun sun3 sun386
18922 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18923 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18924 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18925 sysV68 sysV88 Tek4132 Tek4300 titan
18926 TM3200 TM5400 TM5600
18927 tower tower32 tower32_200 tower32_600 tower32_700
18928 tower32_800 tower32_850 tss
18929 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18930 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18931 unix UNIX95 UNIX99 unixpc unos
18932 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18933 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18934 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18935 USGr4 USGr4_2
18936 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18937 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18938 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18939 z8000
18940 EOSH
18941 # Maybe put other stuff here too.
18942 cat <<EOSH >>Cppsym.know
18943 $osname
18944 EOSH
18945 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18946 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18947 $cat Cppsym.know > Cppsym.c
18948 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18949 $rm -f Cppsym.a Cppsym.b Cppsym.c
18950 cat <<EOSH > Cppsym
18951 $startsh
18952 if $test \$# -gt 0; then
18953     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18954     if $test -s Cppsym.got; then
18955         $rm -f Cppsym.got
18956         exit 0
18957     fi
18958     $rm -f Cppsym.got
18959     exit 1
18960 else
18961     $tr " " "$trnl" | ./Cppsym.try
18962     exit 0
18963 fi
18964 EOSH
18965 chmod +x Cppsym
18966 $eunicefix Cppsym
18967 cat <<EOSH > Cppsym.try
18968 $startsh
18969 cat <<'EOCP' > try.c
18970 #include <stdio.h>
18971 int main() {
18972 EOCP
18973 $awk \\
18974 EOSH
18975 cat <<'EOSH' >> Cppsym.try
18976 'length($1) > 0 {
18977     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
18978     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
18979     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
18980     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
18981 }'       >> try.c
18982 echo 'return 0;}' >> try.c
18983 EOSH
18984 cat <<EOSH >> Cppsym.try
18985 ccflags="$ccflags"
18986 case "$osname-$gccversion" in
18987 irix-) ccflags="\$ccflags -woff 1178" ;;
18988 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18989 esac
18990 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18991 EOSH
18992 chmod +x Cppsym.try
18993 $eunicefix Cppsym.try
18994 ./Cppsym < Cppsym.know > Cppsym.true
18995 : now check the C compiler for additional symbols
18996 postprocess_cc_v=''
18997 case "$osname" in
18998 aix) postprocess_cc_v="|$tr , ' '" ;;
18999 esac
19000 $cat >ccsym <<EOS
19001 $startsh
19002 $cat >tmp.c <<EOF
19003 extern int foo;
19004 EOF
19005 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19006 do
19007         case "\$i" in
19008         -D*) echo "\$i" | $sed 's/^-D//';;
19009         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19010         esac
19011 done
19012 $rm -f try.c
19013 EOS
19014 postprocess_cc_v=''
19015 chmod +x ccsym
19016 $eunicefix ccsym
19017 ./ccsym > ccsym1.raw
19018 if $test -s ccsym1.raw; then
19019        $sort ccsym1.raw | $uniq >ccsym.raw
19020 else
19021        mv ccsym1.raw ccsym.raw
19022 fi
19023
19024 $awk '/\=/ { print $0; next }
19025         { print $0"=1" }' ccsym.raw >ccsym.list
19026 $awk '/\=/ { print $0; next }
19027         { print $0"=1" }' Cppsym.true >ccsym.true
19028 $comm -13 ccsym.true ccsym.list >ccsym.own
19029 $comm -12 ccsym.true ccsym.list >ccsym.com
19030 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19031 also=''
19032 if $test -z ccsym.raw; then
19033         echo "Your C compiler doesn't seem to define any symbols!" >&4
19034         echo " "
19035         echo "However, your C preprocessor defines the following symbols:"
19036         $cat Cppsym.true
19037         ccsymbols=''
19038         cppsymbols=`$cat Cppsym.true`
19039         cppsymbols=`echo $cppsymbols`
19040         cppccsymbols="$cppsymbols"
19041 else
19042         if $test -s ccsym.com; then
19043                 echo "Your C compiler and pre-processor define these symbols:"
19044                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19045                 also='also '
19046                 symbols='ones'
19047                 cppccsymbols=`$cat ccsym.com`
19048                 cppccsymbols=`echo $cppccsymbols`
19049                 $test "$silent" || sleep 1
19050         fi
19051         if $test -s ccsym.cpp; then
19052                 $test "$also" && echo " "
19053                 echo "Your C pre-processor ${also}defines the following symbols:"
19054                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19055                 also='further '
19056                 cppsymbols=`$cat ccsym.cpp`
19057                 cppsymbols=`echo $cppsymbols`
19058                 $test "$silent" || sleep 1
19059         fi
19060         if $test -s ccsym.own; then
19061                 $test "$also" && echo " "
19062                 echo "Your C compiler ${also}defines the following cpp symbols:"
19063                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19064                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19065                 ccsymbols=`$cat ccsym.own`
19066                 ccsymbols=`echo $ccsymbols`
19067                 $test "$silent" || sleep 1
19068         fi
19069 fi
19070
19071 : see if this is a termio system
19072 val="$undef"
19073 val2="$undef"
19074 val3="$undef"
19075 if $test `./findhdr termios.h`; then
19076         set tcsetattr i_termios
19077         eval $inlibc
19078         val3="$i_termios"
19079 fi
19080 echo " "
19081 case "$val3" in
19082 "$define") echo "You have POSIX termios.h... good!" >&4;;
19083 *) if ./Cppsym pyr; then
19084                 case "`/bin/universe`" in
19085                 ucb) if $test `./findhdr sgtty.h`; then
19086                                 val2="$define"
19087                                 echo "<sgtty.h> found." >&4
19088                         else
19089                                 echo "System is pyramid with BSD universe."
19090                                 echo "<sgtty.h> not found--you could have problems." >&4
19091                         fi;;
19092                 *) if $test `./findhdr termio.h`; then
19093                                 val="$define"
19094                                 echo "<termio.h> found." >&4
19095                         else
19096                                 echo "System is pyramid with USG universe."
19097                                 echo "<termio.h> not found--you could have problems." >&4
19098                         fi;;
19099                 esac
19100         elif ./usg; then
19101                 if $test `./findhdr termio.h`; then
19102                         echo "<termio.h> found." >&4
19103                         val="$define"
19104                 elif $test `./findhdr sgtty.h`; then
19105                         echo "<sgtty.h> found." >&4
19106                         val2="$define"
19107                 else
19108 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19109                 fi
19110         else
19111                 if $test `./findhdr sgtty.h`; then
19112                         echo "<sgtty.h> found." >&4
19113                         val2="$define"
19114                 elif $test `./findhdr termio.h`; then
19115                         echo "<termio.h> found." >&4
19116                         val="$define"
19117                 else
19118 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19119                 fi
19120         fi;;
19121 esac
19122 set i_termio; eval $setvar
19123 val=$val2; set i_sgtty; eval $setvar
19124 val=$val3; set i_termios; eval $setvar
19125
19126 : see if stddef is available
19127 set stddef.h i_stddef
19128 eval $inhdr
19129
19130 : see if this is a sunmath.h system
19131 set sunmath.h i_sunmath
19132 eval $inhdr
19133
19134 : see if sys/access.h is available
19135 set sys/access.h i_sysaccess
19136 eval $inhdr
19137
19138 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19139 set sys/filio.h i_sysfilio
19140 eval $inhdr
19141 echo " "
19142 if $test `./findhdr sys/ioctl.h`; then
19143         val="$define"
19144         echo '<sys/ioctl.h> found.' >&4
19145 else
19146         val="$undef"
19147         if $test $i_sysfilio = "$define"; then
19148             echo '<sys/ioctl.h> NOT found.' >&4
19149         else
19150                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19151                 $test $i_termio = "$define" && xxx="termio.h"
19152                 $test $i_termios = "$define" && xxx="termios.h"
19153 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19154         fi
19155 fi
19156 set i_sysioctl
19157 eval $setvar
19158
19159 : see if socket ioctl defs are in sys/sockio.h
19160 echo " "
19161 xxx=`./findhdr sys/sockio.h`
19162 if $test "$xxx"; then
19163         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19164                 val="$define"
19165                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19166         else
19167                 val="$undef"
19168                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19169         fi
19170 else
19171         val="$undef"
19172         $cat <<EOM
19173 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19174 EOM
19175 fi
19176 set i_syssockio
19177 eval $setvar
19178
19179
19180 : see if this is a syslog.h system
19181 set syslog.h i_syslog
19182 eval $inhdr
19183
19184
19185 : see if this is a sys/mode.h system
19186 set sys/mode.h i_sysmode
19187 eval $inhdr
19188
19189 : see if sys/resource.h has to be included
19190 set sys/resource.h i_sysresrc
19191 eval $inhdr
19192
19193 : see if sys/security.h is available
19194 set sys/security.h i_syssecrt
19195 eval $inhdr
19196
19197 : see if this is a sys/statvfs.h system
19198 set sys/statvfs.h i_sysstatvfs
19199 eval $inhdr
19200
19201 : see if this is a sys/un.h system
19202 set sys/un.h i_sysun
19203 eval $inhdr
19204
19205
19206 : see if this is a sys/utsname.h system
19207 set sys/utsname.h i_sysutsname
19208 eval $inhdr
19209
19210 : see if this is a syswait system
19211 set sys/wait.h i_syswait
19212 eval $inhdr
19213
19214 : see if this is a ustat.h system
19215 set ustat.h i_ustat
19216 eval $inhdr
19217
19218 : see if this is an utime system
19219 set utime.h i_utime
19220 eval $inhdr
19221
19222 : see if this is a values.h system
19223 set values.h i_values
19224 eval $inhdr
19225
19226 : see if this is a vfork system
19227 case "$d_vfork" in
19228 "$define")
19229         set vfork.h i_vfork
19230         eval $inhdr
19231         ;;
19232 *)
19233         i_vfork="$undef"
19234         ;;
19235 esac
19236
19237 : see if gdbm.h is available
19238 set gdbm.h t_gdbm
19239 eval $inhdr
19240 case "$t_gdbm" in
19241 $define)
19242         : see if gdbm_open exists
19243         set gdbm_open d_gdbm_open
19244         eval $inlibc
19245         case "$d_gdbm_open" in
19246         $undef)
19247                 t_gdbm="$undef"
19248                 echo "We won't be including <gdbm.h>"
19249                 ;;
19250         esac
19251         ;;
19252 esac
19253 val="$t_gdbm"
19254 set i_gdbm
19255 eval $setvar
19256
19257 echo " "
19258 echo "Looking for extensions..." >&4
19259 : If we are using the old config.sh, known_extensions may contain
19260 : old or inaccurate or duplicate values.
19261 known_extensions=''
19262 nonxs_extensions=''
19263 : We do not use find because it might not be available.
19264 : We do not just use MANIFEST because the user may have dropped
19265 : some additional extensions into the source tree and expect them
19266 : to be built.
19267
19268 : Function to recursively find available extensions, ignoring DynaLoader
19269 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19270 find_extensions='
19271     for xxx in *; do
19272        case "$xxx" in
19273            DynaLoader|dynaload) ;;
19274            *)
19275            if $test -f $xxx/$xxx.xs; then
19276                known_extensions="$known_extensions $1$xxx";
19277            elif $test -f $xxx/Makefile.PL; then
19278                nonxs_extensions="$nonxs_extensions $1$xxx";
19279            else
19280                if $test -d $xxx -a $# -lt 10; then
19281                    set $1$xxx/ $*;
19282                    cd "$xxx";
19283                    eval $find_extensions;
19284                    cd ..;
19285                    shift;
19286                fi;
19287            fi
19288            ;;
19289        esac;
19290     done'
19291 tdir=`pwd`
19292 cd "$rsrc/ext"
19293 set X
19294 shift
19295 eval $find_extensions
19296 # Special case:  Add in threads/shared since it is not picked up by the
19297 # recursive find above (and adding in general recursive finding breaks
19298 # SDBM_File/sdbm).  A.D.  10/25/2001.
19299 known_extensions="$known_extensions threads/shared"
19300 set X $nonxs_extensions
19301 shift
19302 nonxs_extensions="$*"
19303 set X $known_extensions
19304 shift
19305 known_extensions="$*"
19306 cd "$tdir"
19307
19308 : Now see which are supported on this system.
19309 avail_ext=''
19310 for xxx in $known_extensions ; do
19311         case "$xxx" in
19312         DB_File|db_file)
19313                 case "$i_db" in
19314                 $define) avail_ext="$avail_ext $xxx" ;;
19315                 esac
19316                 ;;
19317         GDBM_File|gdbm_fil)
19318                 case "$i_gdbm" in 
19319                 $define) avail_ext="$avail_ext $xxx" ;;
19320                 esac
19321                 ;;
19322         I18N/Langinfo|i18n_lan)
19323                 case "$i_langinfo$d_nl_langinfo" in 
19324                 $define$define) avail_ext="$avail_ext $xxx" ;;
19325                 esac
19326                 ;;
19327         NDBM_File|ndbm_fil)
19328                 case "$i_ndbm" in
19329                 $define)
19330                     case "$osname-$use64bitint" in
19331                     hpux-define)
19332                         case "$libs" in
19333                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19334                         esac
19335                         ;;
19336                     *) avail_ext="$avail_ext $xxx" ;;
19337                     esac
19338                     ;;
19339                 esac
19340                 ;;
19341         ODBM_File|odbm_fil) 
19342                 case "${i_dbm}${i_rpcsvcdbm}" in
19343                 *"${define}"*)
19344                     case "$osname-$use64bitint" in
19345                     hpux-define)
19346                         case "$libs" in
19347                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19348                         esac
19349                         ;;
19350                     *) avail_ext="$avail_ext $xxx" ;;
19351                     esac
19352                     ;;
19353                 esac
19354                 ;;
19355         POSIX|posix)
19356                 case "$useposix" in
19357                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19358                 esac
19359                 ;;
19360         Opcode|opcode)
19361                 case "$useopcode" in
19362                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19363                 esac
19364                 ;;
19365         Socket|socket)
19366                 case "$d_socket" in 
19367                 true|$define|y)
19368                     case "$osname" in
19369                     beos) ;; # not unless BONE
19370                     *) avail_ext="$avail_ext $xxx" ;;
19371                     esac
19372                     ;;
19373                 esac
19374                 ;;
19375         Sys/Syslog|sys/syslog)
19376                 : XXX syslog requires socket
19377                 case "$d_socket" in 
19378                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19379                 esac
19380                 ;;
19381         Thread|thread)
19382                 case "$usethreads" in
19383                 true|$define|y)
19384                         case "$useithreads" in
19385                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19386                         esac
19387                 esac
19388                 ;;
19389         XS/APItest|xs/apitest)
19390                 # This is just for testing.  Skip it unless we have dynamic loading.
19391
19392                 case "$usedl" in
19393                 $define) avail_ext="$avail_ext $xxx" ;;
19394                 esac
19395                 ;;
19396         XS/Typemap|xs/typemap)
19397                 # This is just for testing.  Skip it unless we have dynamic loading.
19398                 case "$usedl" in
19399                 $define) avail_ext="$avail_ext $xxx" ;;
19400                 esac
19401                 ;;
19402         threads|threads/shared)
19403                 # threads and threads::shared are special cases.
19404                 # To stop people from asking "Perl 5.8.0 was supposed
19405                 # to have this new fancy threads implementation but my
19406                 # perl doesn't have it" and from people trying to
19407                 # (re)install the threads module using CPAN.pm and
19408                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19409                 # the threads.pm and threads/shared.pm will always be
19410                 # there, croaking informatively ("you need to rebuild
19411                 # all of Perl with threads, sorry") when threads haven't
19412                 # been compiled in.
19413                 # --jhi
19414                 avail_ext="$avail_ext $xxx"
19415                 ;;
19416         IPC/SysV|ipc/sysv)
19417                 : XXX Do we need a useipcsysv variable here
19418                 case "${d_msg}${d_sem}${d_shm}" in 
19419                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19420                 esac
19421                 ;;
19422         *)      avail_ext="$avail_ext $xxx"
19423                 ;;
19424         esac
19425 done
19426
19427 set X $avail_ext
19428 shift
19429 avail_ext="$*"
19430
19431 : Now see which nonxs extensions are supported on this system.
19432 : For now assume all are.
19433 nonxs_ext=''
19434 for xxx in $nonxs_extensions ; do
19435         case "$xxx" in
19436         *)      nonxs_ext="$nonxs_ext $xxx"
19437                 ;;
19438         esac
19439 done
19440
19441 set X $nonxs_ext
19442 shift
19443 nonxs_ext="$*"
19444
19445 case $usedl in
19446 $define)
19447         $cat <<EOM
19448 A number of extensions are supplied with $package.  You may choose to
19449 compile these extensions for dynamic loading (the default), compile
19450 them into the $package executable (static loading), or not include
19451 them at all.  Answer "none" to include no extensions.
19452 Note that DynaLoader is always built and need not be mentioned here.
19453
19454 EOM
19455         case "$dynamic_ext" in
19456         '')
19457                 : Exclude those listed in static_ext
19458                 dflt=''
19459                 for xxx in $avail_ext; do
19460                         case " $static_ext " in
19461                         *" $xxx "*) ;;
19462                         *) dflt="$dflt $xxx" ;;
19463                         esac
19464                 done
19465                 set X $dflt
19466                 shift
19467                 dflt="$*"
19468                 ;;
19469         *)      dflt="$dynamic_ext"
19470                 # Perhaps we are reusing an old out-of-date config.sh.
19471                 case "$hint" in
19472                 previous)
19473                         if test X"$dynamic_ext" != X"$avail_ext"; then
19474                                 $cat <<EOM
19475 NOTICE:  Your previous config.sh list may be incorrect. 
19476 The extensions now available to you are 
19477         ${avail_ext}
19478 but the default list from your previous config.sh is
19479         ${dynamic_ext} 
19480
19481 EOM
19482                         fi
19483                         ;;
19484                 esac
19485                 ;;
19486         esac
19487         case "$dflt" in
19488         '')     dflt=none;;
19489         esac
19490         rp="What extensions do you wish to load dynamically?"
19491         . ./myread
19492         case "$ans" in
19493         none) dynamic_ext=' ' ;;
19494         *) dynamic_ext="$ans" ;;
19495         esac
19496
19497         case "$static_ext" in
19498         '')
19499                 : Exclude those already listed in dynamic linking
19500                 dflt=''
19501                 for xxx in $avail_ext; do
19502                         case " $dynamic_ext " in
19503                         *" $xxx "*) ;;
19504                         *) dflt="$dflt $xxx" ;;
19505                         esac
19506                 done
19507                 set X $dflt
19508                 shift
19509                 dflt="$*"
19510                 ;;
19511         *)  dflt="$static_ext" 
19512                 ;;
19513         esac
19514
19515         case "$dflt" in
19516         '')     dflt=none;;
19517         esac
19518         rp="What extensions do you wish to load statically?"
19519         . ./myread
19520         case "$ans" in
19521         none) static_ext=' ' ;;
19522         *) static_ext="$ans" ;;
19523         esac
19524         ;;
19525 *)
19526         $cat <<EOM
19527 A number of extensions are supplied with $package.  Answer "none" 
19528 to include no extensions. 
19529 Note that DynaLoader is always built and need not be mentioned here.
19530
19531 EOM
19532         case "$static_ext" in
19533         '') dflt="$avail_ext" ;;
19534         *)      dflt="$static_ext"
19535                 # Perhaps we are reusing an old out-of-date config.sh.
19536                 case "$hint" in
19537                 previous)
19538                         if test X"$static_ext" != X"$avail_ext"; then
19539                                 $cat <<EOM
19540 NOTICE:  Your previous config.sh list may be incorrect. 
19541 The extensions now available to you are 
19542         ${avail_ext}
19543 but the default list from your previous config.sh is
19544         ${static_ext} 
19545
19546 EOM
19547                         fi
19548                         ;;
19549                 esac
19550                 ;;
19551         esac
19552         : Exclude those that are not xs extensions
19553         case "$dflt" in
19554         '')     dflt=none;;
19555         esac
19556         rp="What extensions do you wish to include?"
19557         . ./myread
19558         case "$ans" in
19559         none) static_ext=' ' ;;
19560         *) static_ext="$ans" ;;
19561         esac
19562         ;;
19563 esac
19564 #        
19565 # Encode is a special case.  If we are building Encode as a static
19566 # extension, we need to explicitly list its subextensions as well.
19567 # For other nested extensions, this is handled automatically by
19568 # the appropriate Makefile.PL.
19569 case " $static_ext " in
19570         *" Encode "*) # Add the subextensions of Encode
19571         cd "$rsrc/ext"
19572         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19573                 static_ext="$static_ext Encode/$xxx"
19574         done
19575         cd "$tdir"
19576         ;;
19577 esac
19578
19579 set X $dynamic_ext $static_ext $nonxs_ext
19580 shift
19581 extensions="$*"
19582
19583 : Remove libraries needed only for extensions
19584 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19585 : The exception is SunOS 4.x, which needs them.
19586 case "${osname}X${osvers}" in
19587 sunos*X4*)
19588     perllibs="$libs"
19589     ;;
19590 *) case "$usedl" in
19591     $define|true|[yY]*)
19592             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19593             shift
19594             perllibs="$*"
19595             ;;
19596     *)  perllibs="$libs"
19597             ;;
19598     esac
19599     ;;
19600 esac
19601
19602 : Remove build directory name from cppstdin so it can be used from
19603 : either the present location or the final installed location.
19604 echo " "
19605 : Get out of the UU directory to get correct path name.
19606 cd ..
19607 case "$cppstdin" in
19608 `pwd`/cppstdin)
19609         echo "Stripping down cppstdin path name"
19610         cppstdin=cppstdin
19611         ;;
19612 esac
19613 cd UU
19614
19615 : end of configuration questions
19616 echo " "
19617 echo "End of configuration questions."
19618 echo " "
19619
19620 : back to where it started
19621 if test -d ../UU; then
19622         cd ..
19623 fi
19624
19625 : configuration may be patched via a 'config.arch' file
19626 if $test -f config.arch; then
19627         echo "I see a config.arch file, loading it."
19628         . ./config.arch
19629 fi
19630
19631 : configuration may be patched via a 'config.over' file
19632 if $test -f config.over; then
19633         echo " "
19634         dflt=y
19635         rp='I see a config.over file.  Do you wish to load it?'
19636         . UU/myread
19637         case "$ans" in
19638         n*) echo "OK, I'll ignore it.";;
19639         *)      . ./config.over
19640                 echo "Configuration override changes have been loaded."
19641                 ;;
19642         esac
19643 fi
19644
19645 : in case they want portability, strip down executable paths
19646 case "$d_portable" in
19647 "$define")
19648         echo " "
19649         echo "Stripping down executable paths..." >&4
19650         for file in $loclist $trylist; do
19651                 eval temp=\$$file
19652                 eval $file=`basename $temp`
19653         done
19654         ;;
19655 esac
19656
19657 : create config.sh file
19658 echo " "
19659 echo "Creating config.sh..." >&4
19660 $spitshell <<EOT >config.sh
19661 $startsh
19662 #
19663 # This file was produced by running the Configure script. It holds all the
19664 # definitions figured out by Configure. Should you modify one of these values,
19665 # do not forget to propagate your changes by running "Configure -der". You may
19666 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19667 #
19668
19669 # Package name      : $package
19670 # Source directory  : $src
19671 # Configuration time: $cf_time
19672 # Configured by     : $cf_by
19673 # Target system     : $myuname
19674
19675 Author='$Author'
19676 Date='$Date'
19677 Header='$Header'
19678 Id='$Id'
19679 Locker='$Locker'
19680 Log='$Log'
19681 Mcc='$Mcc'
19682 RCSfile='$RCSfile'
19683 Revision='$Revision'
19684 Source='$Source'
19685 State='$State'
19686 _a='$_a'
19687 _exe='$_exe'
19688 _o='$_o'
19689 afs='$afs'
19690 afsroot='$afsroot'
19691 alignbytes='$alignbytes'
19692 ansi2knr='$ansi2knr'
19693 aphostname='$aphostname'
19694 api_revision='$api_revision'
19695 api_subversion='$api_subversion'
19696 api_version='$api_version'
19697 api_versionstring='$api_versionstring'
19698 ar='$ar'
19699 archlib='$archlib'
19700 archlibexp='$archlibexp'
19701 archname64='$archname64'
19702 archname='$archname'
19703 archobjs='$archobjs'
19704 asctime_r_proto='$asctime_r_proto'
19705 awk='$awk'
19706 baserev='$baserev'
19707 bash='$bash'
19708 bin='$bin'
19709 binexp='$binexp'
19710 bison='$bison'
19711 byacc='$byacc'
19712 byteorder='$byteorder'
19713 c='$c'
19714 castflags='$castflags'
19715 cat='$cat'
19716 cc='$cc'
19717 cccdlflags='$cccdlflags'
19718 ccdlflags='$ccdlflags'
19719 ccflags='$ccflags'
19720 ccflags_uselargefiles='$ccflags_uselargefiles'
19721 ccname='$ccname'
19722 ccsymbols='$ccsymbols'
19723 ccversion='$ccversion'
19724 cf_by='$cf_by'
19725 cf_email='$cf_email'
19726 cf_time='$cf_time'
19727 charsize='$charsize'
19728 chgrp='$chgrp'
19729 chmod='$chmod'
19730 chown='$chown'
19731 clocktype='$clocktype'
19732 comm='$comm'
19733 compress='$compress'
19734 contains='$contains'
19735 cp='$cp'
19736 cpio='$cpio'
19737 cpp='$cpp'
19738 cpp_stuff='$cpp_stuff'
19739 cppccsymbols='$cppccsymbols'
19740 cppflags='$cppflags'
19741 cpplast='$cpplast'
19742 cppminus='$cppminus'
19743 cpprun='$cpprun'
19744 cppstdin='$cppstdin'
19745 cppsymbols='$cppsymbols'
19746 crypt_r_proto='$crypt_r_proto'
19747 cryptlib='$cryptlib'
19748 csh='$csh'
19749 ctermid_r_proto='$ctermid_r_proto'
19750 ctime_r_proto='$ctime_r_proto'
19751 d_Gconvert='$d_Gconvert'
19752 d_PRIEUldbl='$d_PRIEUldbl'
19753 d_PRIFUldbl='$d_PRIFUldbl'
19754 d_PRIGUldbl='$d_PRIGUldbl'
19755 d_PRIXU64='$d_PRIXU64'
19756 d_PRId64='$d_PRId64'
19757 d_PRIeldbl='$d_PRIeldbl'
19758 d_PRIfldbl='$d_PRIfldbl'
19759 d_PRIgldbl='$d_PRIgldbl'
19760 d_PRIi64='$d_PRIi64'
19761 d_PRIo64='$d_PRIo64'
19762 d_PRIu64='$d_PRIu64'
19763 d_PRIx64='$d_PRIx64'
19764 d_SCNfldbl='$d_SCNfldbl'
19765 d__fwalk='$d__fwalk'
19766 d_access='$d_access'
19767 d_accessx='$d_accessx'
19768 d_alarm='$d_alarm'
19769 d_archlib='$d_archlib'
19770 d_asctime_r='$d_asctime_r'
19771 d_atolf='$d_atolf'
19772 d_atoll='$d_atoll'
19773 d_attribut='$d_attribut'
19774 d_bcmp='$d_bcmp'
19775 d_bcopy='$d_bcopy'
19776 d_bsd='$d_bsd'
19777 d_bsdgetpgrp='$d_bsdgetpgrp'
19778 d_bsdsetpgrp='$d_bsdsetpgrp'
19779 d_bzero='$d_bzero'
19780 d_casti32='$d_casti32'
19781 d_castneg='$d_castneg'
19782 d_charvspr='$d_charvspr'
19783 d_chown='$d_chown'
19784 d_chroot='$d_chroot'
19785 d_chsize='$d_chsize'
19786 d_class='$d_class'
19787 d_closedir='$d_closedir'
19788 d_cmsghdr_s='$d_cmsghdr_s'
19789 d_const='$d_const'
19790 d_crypt='$d_crypt'
19791 d_crypt_r='$d_crypt_r'
19792 d_csh='$d_csh'
19793 d_ctermid_r='$d_ctermid_r'
19794 d_ctime_r='$d_ctime_r'
19795 d_cuserid='$d_cuserid'
19796 d_dbl_dig='$d_dbl_dig'
19797 d_dbminitproto='$d_dbminitproto'
19798 d_difftime='$d_difftime'
19799 d_dirfd='$d_dirfd'
19800 d_dirnamlen='$d_dirnamlen'
19801 d_dlerror='$d_dlerror'
19802 d_dlopen='$d_dlopen'
19803 d_dlsymun='$d_dlsymun'
19804 d_dosuid='$d_dosuid'
19805 d_drand48_r='$d_drand48_r'
19806 d_drand48proto='$d_drand48proto'
19807 d_dup2='$d_dup2'
19808 d_eaccess='$d_eaccess'
19809 d_endgrent='$d_endgrent'
19810 d_endgrent_r='$d_endgrent_r'
19811 d_endhent='$d_endhent'
19812 d_endhostent_r='$d_endhostent_r'
19813 d_endnent='$d_endnent'
19814 d_endnetent_r='$d_endnetent_r'
19815 d_endpent='$d_endpent'
19816 d_endprotoent_r='$d_endprotoent_r'
19817 d_endpwent='$d_endpwent'
19818 d_endpwent_r='$d_endpwent_r'
19819 d_endsent='$d_endsent'
19820 d_endservent_r='$d_endservent_r'
19821 d_eofnblk='$d_eofnblk'
19822 d_eunice='$d_eunice'
19823 d_fchdir='$d_fchdir'
19824 d_fchmod='$d_fchmod'
19825 d_fchown='$d_fchown'
19826 d_fcntl='$d_fcntl'
19827 d_fcntl_can_lock='$d_fcntl_can_lock'
19828 d_fd_macros='$d_fd_macros'
19829 d_fd_set='$d_fd_set'
19830 d_fds_bits='$d_fds_bits'
19831 d_fgetpos='$d_fgetpos'
19832 d_finite='$d_finite'
19833 d_finitel='$d_finitel'
19834 d_flexfnam='$d_flexfnam'
19835 d_flock='$d_flock'
19836 d_flockproto='$d_flockproto'
19837 d_fork='$d_fork'
19838 d_fp_class='$d_fp_class'
19839 d_fpathconf='$d_fpathconf'
19840 d_fpclass='$d_fpclass'
19841 d_fpclassify='$d_fpclassify'
19842 d_fpclassl='$d_fpclassl'
19843 d_fpos64_t='$d_fpos64_t'
19844 d_frexpl='$d_frexpl'
19845 d_fs_data_s='$d_fs_data_s'
19846 d_fseeko='$d_fseeko'
19847 d_fsetpos='$d_fsetpos'
19848 d_fstatfs='$d_fstatfs'
19849 d_fstatvfs='$d_fstatvfs'
19850 d_fsync='$d_fsync'
19851 d_ftello='$d_ftello'
19852 d_ftime='$d_ftime'
19853 d_getcwd='$d_getcwd'
19854 d_getespwnam='$d_getespwnam'
19855 d_getfsstat='$d_getfsstat'
19856 d_getgrent='$d_getgrent'
19857 d_getgrent_r='$d_getgrent_r'
19858 d_getgrgid_r='$d_getgrgid_r'
19859 d_getgrnam_r='$d_getgrnam_r'
19860 d_getgrps='$d_getgrps'
19861 d_gethbyaddr='$d_gethbyaddr'
19862 d_gethbyname='$d_gethbyname'
19863 d_gethent='$d_gethent'
19864 d_gethname='$d_gethname'
19865 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19866 d_gethostbyname_r='$d_gethostbyname_r'
19867 d_gethostent_r='$d_gethostent_r'
19868 d_gethostprotos='$d_gethostprotos'
19869 d_getitimer='$d_getitimer'
19870 d_getlogin='$d_getlogin'
19871 d_getlogin_r='$d_getlogin_r'
19872 d_getmnt='$d_getmnt'
19873 d_getmntent='$d_getmntent'
19874 d_getnbyaddr='$d_getnbyaddr'
19875 d_getnbyname='$d_getnbyname'
19876 d_getnent='$d_getnent'
19877 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19878 d_getnetbyname_r='$d_getnetbyname_r'
19879 d_getnetent_r='$d_getnetent_r'
19880 d_getnetprotos='$d_getnetprotos'
19881 d_getpagsz='$d_getpagsz'
19882 d_getpbyname='$d_getpbyname'
19883 d_getpbynumber='$d_getpbynumber'
19884 d_getpent='$d_getpent'
19885 d_getpgid='$d_getpgid'
19886 d_getpgrp2='$d_getpgrp2'
19887 d_getpgrp='$d_getpgrp'
19888 d_getppid='$d_getppid'
19889 d_getprior='$d_getprior'
19890 d_getprotobyname_r='$d_getprotobyname_r'
19891 d_getprotobynumber_r='$d_getprotobynumber_r'
19892 d_getprotoent_r='$d_getprotoent_r'
19893 d_getprotoprotos='$d_getprotoprotos'
19894 d_getprpwnam='$d_getprpwnam'
19895 d_getpwent='$d_getpwent'
19896 d_getpwent_r='$d_getpwent_r'
19897 d_getpwnam_r='$d_getpwnam_r'
19898 d_getpwuid_r='$d_getpwuid_r'
19899 d_getsbyname='$d_getsbyname'
19900 d_getsbyport='$d_getsbyport'
19901 d_getsent='$d_getsent'
19902 d_getservbyname_r='$d_getservbyname_r'
19903 d_getservbyport_r='$d_getservbyport_r'
19904 d_getservent_r='$d_getservent_r'
19905 d_getservprotos='$d_getservprotos'
19906 d_getspnam='$d_getspnam'
19907 d_getspnam_r='$d_getspnam_r'
19908 d_gettimeod='$d_gettimeod'
19909 d_gmtime_r='$d_gmtime_r'
19910 d_gnulibc='$d_gnulibc'
19911 d_grpasswd='$d_grpasswd'
19912 d_hasmntopt='$d_hasmntopt'
19913 d_htonl='$d_htonl'
19914 d_index='$d_index'
19915 d_inetaton='$d_inetaton'
19916 d_int64_t='$d_int64_t'
19917 d_isascii='$d_isascii'
19918 d_isfinite='$d_isfinite'
19919 d_isinf='$d_isinf'
19920 d_isnan='$d_isnan'
19921 d_isnanl='$d_isnanl'
19922 d_killpg='$d_killpg'
19923 d_lchown='$d_lchown'
19924 d_ldbl_dig='$d_ldbl_dig'
19925 d_link='$d_link'
19926 d_localtime_r='$d_localtime_r'
19927 d_locconv='$d_locconv'
19928 d_lockf='$d_lockf'
19929 d_longdbl='$d_longdbl'
19930 d_longlong='$d_longlong'
19931 d_lseekproto='$d_lseekproto'
19932 d_lstat='$d_lstat'
19933 d_madvise='$d_madvise'
19934 d_mblen='$d_mblen'
19935 d_mbstowcs='$d_mbstowcs'
19936 d_mbtowc='$d_mbtowc'
19937 d_memchr='$d_memchr'
19938 d_memcmp='$d_memcmp'
19939 d_memcpy='$d_memcpy'
19940 d_memmove='$d_memmove'
19941 d_memset='$d_memset'
19942 d_mkdir='$d_mkdir'
19943 d_mkdtemp='$d_mkdtemp'
19944 d_mkfifo='$d_mkfifo'
19945 d_mkstemp='$d_mkstemp'
19946 d_mkstemps='$d_mkstemps'
19947 d_mktime='$d_mktime'
19948 d_mmap='$d_mmap'
19949 d_modfl='$d_modfl'
19950 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19951 d_modflproto='$d_modflproto'
19952 d_mprotect='$d_mprotect'
19953 d_msg='$d_msg'
19954 d_msg_ctrunc='$d_msg_ctrunc'
19955 d_msg_dontroute='$d_msg_dontroute'
19956 d_msg_oob='$d_msg_oob'
19957 d_msg_peek='$d_msg_peek'
19958 d_msg_proxy='$d_msg_proxy'
19959 d_msgctl='$d_msgctl'
19960 d_msgget='$d_msgget'
19961 d_msghdr_s='$d_msghdr_s'
19962 d_msgrcv='$d_msgrcv'
19963 d_msgsnd='$d_msgsnd'
19964 d_msync='$d_msync'
19965 d_munmap='$d_munmap'
19966 d_mymalloc='$d_mymalloc'
19967 d_nice='$d_nice'
19968 d_nl_langinfo='$d_nl_langinfo'
19969 d_nv_preserves_uv='$d_nv_preserves_uv'
19970 d_off64_t='$d_off64_t'
19971 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19972 d_oldpthreads='$d_oldpthreads'
19973 d_oldsock='$d_oldsock'
19974 d_open3='$d_open3'
19975 d_pathconf='$d_pathconf'
19976 d_pause='$d_pause'
19977 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19978 d_phostname='$d_phostname'
19979 d_pipe='$d_pipe'
19980 d_poll='$d_poll'
19981 d_portable='$d_portable'
19982 d_procselfexe='$d_procselfexe'
19983 d_pthread_atfork='$d_pthread_atfork'
19984 d_pthread_yield='$d_pthread_yield'
19985 d_pwage='$d_pwage'
19986 d_pwchange='$d_pwchange'
19987 d_pwclass='$d_pwclass'
19988 d_pwcomment='$d_pwcomment'
19989 d_pwexpire='$d_pwexpire'
19990 d_pwgecos='$d_pwgecos'
19991 d_pwpasswd='$d_pwpasswd'
19992 d_pwquota='$d_pwquota'
19993 d_qgcvt='$d_qgcvt'
19994 d_quad='$d_quad'
19995 d_random_r='$d_random_r'
19996 d_readdir64_r='$d_readdir64_r'
19997 d_readdir='$d_readdir'
19998 d_readdir_r='$d_readdir_r'
19999 d_readlink='$d_readlink'
20000 d_readv='$d_readv'
20001 d_recvmsg='$d_recvmsg'
20002 d_rename='$d_rename'
20003 d_rewinddir='$d_rewinddir'
20004 d_rmdir='$d_rmdir'
20005 d_safebcpy='$d_safebcpy'
20006 d_safemcpy='$d_safemcpy'
20007 d_sanemcmp='$d_sanemcmp'
20008 d_sbrkproto='$d_sbrkproto'
20009 d_sched_yield='$d_sched_yield'
20010 d_scm_rights='$d_scm_rights'
20011 d_seekdir='$d_seekdir'
20012 d_select='$d_select'
20013 d_sem='$d_sem'
20014 d_semctl='$d_semctl'
20015 d_semctl_semid_ds='$d_semctl_semid_ds'
20016 d_semctl_semun='$d_semctl_semun'
20017 d_semget='$d_semget'
20018 d_semop='$d_semop'
20019 d_sendmsg='$d_sendmsg'
20020 d_setegid='$d_setegid'
20021 d_seteuid='$d_seteuid'
20022 d_setgrent='$d_setgrent'
20023 d_setgrent_r='$d_setgrent_r'
20024 d_setgrps='$d_setgrps'
20025 d_sethent='$d_sethent'
20026 d_sethostent_r='$d_sethostent_r'
20027 d_setitimer='$d_setitimer'
20028 d_setlinebuf='$d_setlinebuf'
20029 d_setlocale='$d_setlocale'
20030 d_setlocale_r='$d_setlocale_r'
20031 d_setnent='$d_setnent'
20032 d_setnetent_r='$d_setnetent_r'
20033 d_setpent='$d_setpent'
20034 d_setpgid='$d_setpgid'
20035 d_setpgrp2='$d_setpgrp2'
20036 d_setpgrp='$d_setpgrp'
20037 d_setprior='$d_setprior'
20038 d_setproctitle='$d_setproctitle'
20039 d_setprotoent_r='$d_setprotoent_r'
20040 d_setpwent='$d_setpwent'
20041 d_setpwent_r='$d_setpwent_r'
20042 d_setregid='$d_setregid'
20043 d_setresgid='$d_setresgid'
20044 d_setresuid='$d_setresuid'
20045 d_setreuid='$d_setreuid'
20046 d_setrgid='$d_setrgid'
20047 d_setruid='$d_setruid'
20048 d_setsent='$d_setsent'
20049 d_setservent_r='$d_setservent_r'
20050 d_setsid='$d_setsid'
20051 d_setvbuf='$d_setvbuf'
20052 d_sfio='$d_sfio'
20053 d_shm='$d_shm'
20054 d_shmat='$d_shmat'
20055 d_shmatprototype='$d_shmatprototype'
20056 d_shmctl='$d_shmctl'
20057 d_shmdt='$d_shmdt'
20058 d_shmget='$d_shmget'
20059 d_sigaction='$d_sigaction'
20060 d_sigprocmask='$d_sigprocmask'
20061 d_sigsetjmp='$d_sigsetjmp'
20062 d_sockatmark='$d_sockatmark'
20063 d_sockatmarkproto='$d_sockatmarkproto'
20064 d_socket='$d_socket'
20065 d_socklen_t='$d_socklen_t'
20066 d_sockpair='$d_sockpair'
20067 d_socks5_init='$d_socks5_init'
20068 d_sqrtl='$d_sqrtl'
20069 d_srand48_r='$d_srand48_r'
20070 d_srandom_r='$d_srandom_r'
20071 d_sresgproto='$d_sresgproto'
20072 d_sresuproto='$d_sresuproto'
20073 d_statblks='$d_statblks'
20074 d_statfs_f_flags='$d_statfs_f_flags'
20075 d_statfs_s='$d_statfs_s'
20076 d_statvfs='$d_statvfs'
20077 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20078 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20079 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20080 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20081 d_stdio_stream_array='$d_stdio_stream_array'
20082 d_stdiobase='$d_stdiobase'
20083 d_stdstdio='$d_stdstdio'
20084 d_strchr='$d_strchr'
20085 d_strcoll='$d_strcoll'
20086 d_strctcpy='$d_strctcpy'
20087 d_strerrm='$d_strerrm'
20088 d_strerror='$d_strerror'
20089 d_strerror_r='$d_strerror_r'
20090 d_strftime='$d_strftime'
20091 d_strtod='$d_strtod'
20092 d_strtol='$d_strtol'
20093 d_strtold='$d_strtold'
20094 d_strtoll='$d_strtoll'
20095 d_strtoq='$d_strtoq'
20096 d_strtoul='$d_strtoul'
20097 d_strtoull='$d_strtoull'
20098 d_strtouq='$d_strtouq'
20099 d_strxfrm='$d_strxfrm'
20100 d_suidsafe='$d_suidsafe'
20101 d_symlink='$d_symlink'
20102 d_syscall='$d_syscall'
20103 d_syscallproto='$d_syscallproto'
20104 d_sysconf='$d_sysconf'
20105 d_sysernlst='$d_sysernlst'
20106 d_syserrlst='$d_syserrlst'
20107 d_system='$d_system'
20108 d_tcgetpgrp='$d_tcgetpgrp'
20109 d_tcsetpgrp='$d_tcsetpgrp'
20110 d_telldir='$d_telldir'
20111 d_telldirproto='$d_telldirproto'
20112 d_time='$d_time'
20113 d_times='$d_times'
20114 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20115 d_tm_tm_zone='$d_tm_tm_zone'
20116 d_tmpnam_r='$d_tmpnam_r'
20117 d_truncate='$d_truncate'
20118 d_ttyname_r='$d_ttyname_r'
20119 d_tzname='$d_tzname'
20120 d_u32align='$d_u32align'
20121 d_ualarm='$d_ualarm'
20122 d_umask='$d_umask'
20123 d_uname='$d_uname'
20124 d_union_semun='$d_union_semun'
20125 d_unordered='$d_unordered'
20126 d_usleep='$d_usleep'
20127 d_usleepproto='$d_usleepproto'
20128 d_ustat='$d_ustat'
20129 d_vendorarch='$d_vendorarch'
20130 d_vendorbin='$d_vendorbin'
20131 d_vendorlib='$d_vendorlib'
20132 d_vfork='$d_vfork'
20133 d_void_closedir='$d_void_closedir'
20134 d_voidsig='$d_voidsig'
20135 d_voidtty='$d_voidtty'
20136 d_volatile='$d_volatile'
20137 d_vprintf='$d_vprintf'
20138 d_wait4='$d_wait4'
20139 d_waitpid='$d_waitpid'
20140 d_wcstombs='$d_wcstombs'
20141 d_wctomb='$d_wctomb'
20142 d_writev='$d_writev'
20143 d_xenix='$d_xenix'
20144 date='$date'
20145 db_hashtype='$db_hashtype'
20146 db_prefixtype='$db_prefixtype'
20147 db_version_major='$db_version_major'
20148 db_version_minor='$db_version_minor'
20149 db_version_patch='$db_version_patch'
20150 defvoidused='$defvoidused'
20151 direntrytype='$direntrytype'
20152 dlext='$dlext'
20153 dlsrc='$dlsrc'
20154 doublesize='$doublesize'
20155 drand01='$drand01'
20156 drand48_r_proto='$drand48_r_proto'
20157 dynamic_ext='$dynamic_ext'
20158 eagain='$eagain'
20159 ebcdic='$ebcdic'
20160 echo='$echo'
20161 egrep='$egrep'
20162 emacs='$emacs'
20163 endgrent_r_proto='$endgrent_r_proto'
20164 endhostent_r_proto='$endhostent_r_proto'
20165 endnetent_r_proto='$endnetent_r_proto'
20166 endprotoent_r_proto='$endprotoent_r_proto'
20167 endpwent_r_proto='$endpwent_r_proto'
20168 endservent_r_proto='$endservent_r_proto'
20169 eunicefix='$eunicefix'
20170 exe_ext='$exe_ext'
20171 expr='$expr'
20172 extensions='$extensions'
20173 extras='$extras'
20174 fflushNULL='$fflushNULL'
20175 fflushall='$fflushall'
20176 find='$find'
20177 firstmakefile='$firstmakefile'
20178 flex='$flex'
20179 fpossize='$fpossize'
20180 fpostype='$fpostype'
20181 freetype='$freetype'
20182 from='$from'
20183 full_ar='$full_ar'
20184 full_csh='$full_csh'
20185 full_sed='$full_sed'
20186 gccosandvers='$gccosandvers'
20187 gccversion='$gccversion'
20188 getgrent_r_proto='$getgrent_r_proto'
20189 getgrgid_r_proto='$getgrgid_r_proto'
20190 getgrnam_r_proto='$getgrnam_r_proto'
20191 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20192 gethostbyname_r_proto='$gethostbyname_r_proto'
20193 gethostent_r_proto='$gethostent_r_proto'
20194 getlogin_r_proto='$getlogin_r_proto'
20195 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20196 getnetbyname_r_proto='$getnetbyname_r_proto'
20197 getnetent_r_proto='$getnetent_r_proto'
20198 getprotobyname_r_proto='$getprotobyname_r_proto'
20199 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20200 getprotoent_r_proto='$getprotoent_r_proto'
20201 getpwent_r_proto='$getpwent_r_proto'
20202 getpwnam_r_proto='$getpwnam_r_proto'
20203 getpwuid_r_proto='$getpwuid_r_proto'
20204 getservbyname_r_proto='$getservbyname_r_proto'
20205 getservbyport_r_proto='$getservbyport_r_proto'
20206 getservent_r_proto='$getservent_r_proto'
20207 getspnam_r_proto='$getspnam_r_proto'
20208 gidformat='$gidformat'
20209 gidsign='$gidsign'
20210 gidsize='$gidsize'
20211 gidtype='$gidtype'
20212 glibpth='$glibpth'
20213 gmake='$gmake'
20214 gmtime_r_proto='$gmtime_r_proto'
20215 gnulibc_version='$gnulibc_version'
20216 grep='$grep'
20217 groupcat='$groupcat'
20218 groupstype='$groupstype'
20219 gzip='$gzip'
20220 h_fcntl='$h_fcntl'
20221 h_sysfile='$h_sysfile'
20222 hint='$hint'
20223 hostcat='$hostcat'
20224 i16size='$i16size'
20225 i16type='$i16type'
20226 i32size='$i32size'
20227 i32type='$i32type'
20228 i64size='$i64size'
20229 i64type='$i64type'
20230 i8size='$i8size'
20231 i8type='$i8type'
20232 i_arpainet='$i_arpainet'
20233 i_bsdioctl='$i_bsdioctl'
20234 i_crypt='$i_crypt'
20235 i_db='$i_db'
20236 i_dbm='$i_dbm'
20237 i_dirent='$i_dirent'
20238 i_dld='$i_dld'
20239 i_dlfcn='$i_dlfcn'
20240 i_fcntl='$i_fcntl'
20241 i_float='$i_float'
20242 i_fp='$i_fp'
20243 i_fp_class='$i_fp_class'
20244 i_gdbm='$i_gdbm'
20245 i_grp='$i_grp'
20246 i_ieeefp='$i_ieeefp'
20247 i_inttypes='$i_inttypes'
20248 i_langinfo='$i_langinfo'
20249 i_libutil='$i_libutil'
20250 i_limits='$i_limits'
20251 i_locale='$i_locale'
20252 i_machcthr='$i_machcthr'
20253 i_malloc='$i_malloc'
20254 i_math='$i_math'
20255 i_memory='$i_memory'
20256 i_mntent='$i_mntent'
20257 i_ndbm='$i_ndbm'
20258 i_netdb='$i_netdb'
20259 i_neterrno='$i_neterrno'
20260 i_netinettcp='$i_netinettcp'
20261 i_niin='$i_niin'
20262 i_poll='$i_poll'
20263 i_prot='$i_prot'
20264 i_pthread='$i_pthread'
20265 i_pwd='$i_pwd'
20266 i_rpcsvcdbm='$i_rpcsvcdbm'
20267 i_sfio='$i_sfio'
20268 i_sgtty='$i_sgtty'
20269 i_shadow='$i_shadow'
20270 i_socks='$i_socks'
20271 i_stdarg='$i_stdarg'
20272 i_stddef='$i_stddef'
20273 i_stdlib='$i_stdlib'
20274 i_string='$i_string'
20275 i_sunmath='$i_sunmath'
20276 i_sysaccess='$i_sysaccess'
20277 i_sysdir='$i_sysdir'
20278 i_sysfile='$i_sysfile'
20279 i_sysfilio='$i_sysfilio'
20280 i_sysin='$i_sysin'
20281 i_sysioctl='$i_sysioctl'
20282 i_syslog='$i_syslog'
20283 i_sysmman='$i_sysmman'
20284 i_sysmode='$i_sysmode'
20285 i_sysmount='$i_sysmount'
20286 i_sysndir='$i_sysndir'
20287 i_sysparam='$i_sysparam'
20288 i_sysresrc='$i_sysresrc'
20289 i_syssecrt='$i_syssecrt'
20290 i_sysselct='$i_sysselct'
20291 i_syssockio='$i_syssockio'
20292 i_sysstat='$i_sysstat'
20293 i_sysstatfs='$i_sysstatfs'
20294 i_sysstatvfs='$i_sysstatvfs'
20295 i_systime='$i_systime'
20296 i_systimek='$i_systimek'
20297 i_systimes='$i_systimes'
20298 i_systypes='$i_systypes'
20299 i_sysuio='$i_sysuio'
20300 i_sysun='$i_sysun'
20301 i_sysutsname='$i_sysutsname'
20302 i_sysvfs='$i_sysvfs'
20303 i_syswait='$i_syswait'
20304 i_termio='$i_termio'
20305 i_termios='$i_termios'
20306 i_time='$i_time'
20307 i_unistd='$i_unistd'
20308 i_ustat='$i_ustat'
20309 i_utime='$i_utime'
20310 i_values='$i_values'
20311 i_varargs='$i_varargs'
20312 i_varhdr='$i_varhdr'
20313 i_vfork='$i_vfork'
20314 ignore_versioned_solibs='$ignore_versioned_solibs'
20315 inc_version_list='$inc_version_list'
20316 inc_version_list_init='$inc_version_list_init'
20317 incpath='$incpath'
20318 inews='$inews'
20319 installarchlib='$installarchlib'
20320 installbin='$installbin'
20321 installman1dir='$installman1dir'
20322 installman3dir='$installman3dir'
20323 installprefix='$installprefix'
20324 installprefixexp='$installprefixexp'
20325 installprivlib='$installprivlib'
20326 installscript='$installscript'
20327 installsitearch='$installsitearch'
20328 installsitebin='$installsitebin'
20329 installsitelib='$installsitelib'
20330 installstyle='$installstyle'
20331 installusrbinperl='$installusrbinperl'
20332 installvendorarch='$installvendorarch'
20333 installvendorbin='$installvendorbin'
20334 installvendorlib='$installvendorlib'
20335 intsize='$intsize'
20336 issymlink='$issymlink'
20337 ivdformat='$ivdformat'
20338 ivsize='$ivsize'
20339 ivtype='$ivtype'
20340 known_extensions='$known_extensions'
20341 ksh='$ksh'
20342 ld='$ld'
20343 lddlflags='$lddlflags'
20344 ldflags='$ldflags'
20345 ldflags_uselargefiles='$ldflags_uselargefiles'
20346 ldlibpthname='$ldlibpthname'
20347 less='$less'
20348 lib_ext='$lib_ext'
20349 libc='$libc'
20350 libperl='$libperl'
20351 libpth='$libpth'
20352 libs='$libs'
20353 libsdirs='$libsdirs'
20354 libsfiles='$libsfiles'
20355 libsfound='$libsfound'
20356 libspath='$libspath'
20357 libswanted='$libswanted'
20358 libswanted_uselargefiles='$libswanted_uselargefiles'
20359 line='$line'
20360 lint='$lint'
20361 lkflags='$lkflags'
20362 ln='$ln'
20363 lns='$lns'
20364 localtime_r_proto='$localtime_r_proto'
20365 locincpth='$locincpth'
20366 loclibpth='$loclibpth'
20367 longdblsize='$longdblsize'
20368 longlongsize='$longlongsize'
20369 longsize='$longsize'
20370 lp='$lp'
20371 lpr='$lpr'
20372 ls='$ls'
20373 lseeksize='$lseeksize'
20374 lseektype='$lseektype'
20375 mail='$mail'
20376 mailx='$mailx'
20377 make='$make'
20378 make_set_make='$make_set_make'
20379 mallocobj='$mallocobj'
20380 mallocsrc='$mallocsrc'
20381 malloctype='$malloctype'
20382 man1dir='$man1dir'
20383 man1direxp='$man1direxp'
20384 man1ext='$man1ext'
20385 man3dir='$man3dir'
20386 man3direxp='$man3direxp'
20387 man3ext='$man3ext'
20388 mips_type='$mips_type'
20389 mkdir='$mkdir'
20390 mmaptype='$mmaptype'
20391 modetype='$modetype'
20392 more='$more'
20393 multiarch='$multiarch'
20394 mv='$mv'
20395 myarchname='$myarchname'
20396 mydomain='$mydomain'
20397 myhostname='$myhostname'
20398 myuname='$myuname'
20399 n='$n'
20400 need_va_copy='$need_va_copy'
20401 netdb_hlen_type='$netdb_hlen_type'
20402 netdb_host_type='$netdb_host_type'
20403 netdb_name_type='$netdb_name_type'
20404 netdb_net_type='$netdb_net_type'
20405 nm='$nm'
20406 nm_opt='$nm_opt'
20407 nm_so_opt='$nm_so_opt'
20408 nonxs_ext='$nonxs_ext'
20409 nroff='$nroff'
20410 nvEUformat='$nvEUformat'
20411 nvFUformat='$nvFUformat'
20412 nvGUformat='$nvGUformat'
20413 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20414 nveformat='$nveformat'
20415 nvfformat='$nvfformat'
20416 nvgformat='$nvgformat'
20417 nvsize='$nvsize'
20418 nvtype='$nvtype'
20419 o_nonblock='$o_nonblock'
20420 obj_ext='$obj_ext'
20421 old_pthread_create_joinable='$old_pthread_create_joinable'
20422 optimize='$optimize'
20423 orderlib='$orderlib'
20424 osname='$osname'
20425 osvers='$osvers'
20426 otherlibdirs='$otherlibdirs'
20427 package='$package'
20428 pager='$pager'
20429 passcat='$passcat'
20430 patchlevel='$patchlevel'
20431 path_sep='$path_sep'
20432 perl5='$perl5'
20433 perl='$perl'
20434 perl_patchlevel='$perl_patchlevel'
20435 perladmin='$perladmin'
20436 perllibs='$perllibs'
20437 perlpath='$perlpath'
20438 pg='$pg'
20439 phostname='$phostname'
20440 pidtype='$pidtype'
20441 plibpth='$plibpth'
20442 pm_apiversion='$pm_apiversion'
20443 pmake='$pmake'
20444 pr='$pr'
20445 prefix='$prefix'
20446 prefixexp='$prefixexp'
20447 privlib='$privlib'
20448 privlibexp='$privlibexp'
20449 procselfexe='$procselfexe'
20450 prototype='$prototype'
20451 ptrsize='$ptrsize'
20452 quadkind='$quadkind'
20453 quadtype='$quadtype'
20454 randbits='$randbits'
20455 randfunc='$randfunc'
20456 random_r_proto='$random_r_proto'
20457 randseedtype='$randseedtype'
20458 ranlib='$ranlib'
20459 rd_nodata='$rd_nodata'
20460 readdir64_r_proto='$readdir64_r_proto'
20461 readdir_r_proto='$readdir_r_proto'
20462 revision='$revision'
20463 rm='$rm'
20464 rmail='$rmail'
20465 run='$run'
20466 runnm='$runnm'
20467 sPRIEUldbl='$sPRIEUldbl'
20468 sPRIFUldbl='$sPRIFUldbl'
20469 sPRIGUldbl='$sPRIGUldbl'
20470 sPRIXU64='$sPRIXU64'
20471 sPRId64='$sPRId64'
20472 sPRIeldbl='$sPRIeldbl'
20473 sPRIfldbl='$sPRIfldbl'
20474 sPRIgldbl='$sPRIgldbl'
20475 sPRIi64='$sPRIi64'
20476 sPRIo64='$sPRIo64'
20477 sPRIu64='$sPRIu64'
20478 sPRIx64='$sPRIx64'
20479 sSCNfldbl='$sSCNfldbl'
20480 sched_yield='$sched_yield'
20481 scriptdir='$scriptdir'
20482 scriptdirexp='$scriptdirexp'
20483 sed='$sed'
20484 seedfunc='$seedfunc'
20485 selectminbits='$selectminbits'
20486 selecttype='$selecttype'
20487 sendmail='$sendmail'
20488 setgrent_r_proto='$setgrent_r_proto'
20489 sethostent_r_proto='$sethostent_r_proto'
20490 setlocale_r_proto='$setlocale_r_proto'
20491 setnetent_r_proto='$setnetent_r_proto'
20492 setprotoent_r_proto='$setprotoent_r_proto'
20493 setpwent_r_proto='$setpwent_r_proto'
20494 setservent_r_proto='$setservent_r_proto'
20495 sh='$sh'
20496 shar='$shar'
20497 sharpbang='$sharpbang'
20498 shmattype='$shmattype'
20499 shortsize='$shortsize'
20500 shrpenv='$shrpenv'
20501 shsharp='$shsharp'
20502 sig_count='$sig_count'
20503 sig_name='$sig_name'
20504 sig_name_init='$sig_name_init'
20505 sig_num='$sig_num'
20506 sig_num_init='$sig_num_init'
20507 sig_size='$sig_size'
20508 signal_t='$signal_t'
20509 sitearch='$sitearch'
20510 sitearchexp='$sitearchexp'
20511 sitebin='$sitebin'
20512 sitebinexp='$sitebinexp'
20513 sitelib='$sitelib'
20514 sitelib_stem='$sitelib_stem'
20515 sitelibexp='$sitelibexp'
20516 siteprefix='$siteprefix'
20517 siteprefixexp='$siteprefixexp'
20518 sizesize='$sizesize'
20519 sizetype='$sizetype'
20520 sleep='$sleep'
20521 smail='$smail'
20522 so='$so'
20523 sockethdr='$sockethdr'
20524 socketlib='$socketlib'
20525 socksizetype='$socksizetype'
20526 sort='$sort'
20527 spackage='$spackage'
20528 spitshell='$spitshell'
20529 srand48_r_proto='$srand48_r_proto'
20530 srandom_r_proto='$srandom_r_proto'
20531 src='$src'
20532 ssizetype='$ssizetype'
20533 startperl='$startperl'
20534 startsh='$startsh'
20535 static_ext='$static_ext'
20536 stdchar='$stdchar'
20537 stdio_base='$stdio_base'
20538 stdio_bufsiz='$stdio_bufsiz'
20539 stdio_cnt='$stdio_cnt'
20540 stdio_filbuf='$stdio_filbuf'
20541 stdio_ptr='$stdio_ptr'
20542 stdio_stream_array='$stdio_stream_array'
20543 strerror_r_proto='$strerror_r_proto'
20544 strings='$strings'
20545 submit='$submit'
20546 subversion='$subversion'
20547 sysman='$sysman'
20548 tail='$tail'
20549 tar='$tar'
20550 targetarch='$targetarch'
20551 tbl='$tbl'
20552 tee='$tee'
20553 test='$test'
20554 timeincl='$timeincl'
20555 timetype='$timetype'
20556 tmpnam_r_proto='$tmpnam_r_proto'
20557 to='$to'
20558 touch='$touch'
20559 tr='$tr'
20560 trnl='$trnl'
20561 troff='$troff'
20562 ttyname_r_proto='$ttyname_r_proto'
20563 u16size='$u16size'
20564 u16type='$u16type'
20565 u32size='$u32size'
20566 u32type='$u32type'
20567 u64size='$u64size'
20568 u64type='$u64type'
20569 u8size='$u8size'
20570 u8type='$u8type'
20571 uidformat='$uidformat'
20572 uidsign='$uidsign'
20573 uidsize='$uidsize'
20574 uidtype='$uidtype'
20575 uname='$uname'
20576 uniq='$uniq'
20577 uquadtype='$uquadtype'
20578 use5005threads='$use5005threads'
20579 use64bitall='$use64bitall'
20580 use64bitint='$use64bitint'
20581 usecrosscompile='$usecrosscompile'
20582 usedl='$usedl'
20583 useithreads='$useithreads'
20584 uselargefiles='$uselargefiles'
20585 uselongdouble='$uselongdouble'
20586 usemorebits='$usemorebits'
20587 usemultiplicity='$usemultiplicity'
20588 usemymalloc='$usemymalloc'
20589 usenm='$usenm'
20590 useopcode='$useopcode'
20591 useperlio='$useperlio'
20592 useposix='$useposix'
20593 usereentrant='$usereentrant'
20594 usesfio='$usesfio'
20595 useshrplib='$useshrplib'
20596 usesocks='$usesocks'
20597 usethreads='$usethreads'
20598 usevendorprefix='$usevendorprefix'
20599 usevfork='$usevfork'
20600 usrinc='$usrinc'
20601 uuname='$uuname'
20602 uvXUformat='$uvXUformat'
20603 uvoformat='$uvoformat'
20604 uvsize='$uvsize'
20605 uvtype='$uvtype'
20606 uvuformat='$uvuformat'
20607 uvxformat='$uvxformat'
20608 vendorarch='$vendorarch'
20609 vendorarchexp='$vendorarchexp'
20610 vendorbin='$vendorbin'
20611 vendorbinexp='$vendorbinexp'
20612 vendorlib='$vendorlib'
20613 vendorlib_stem='$vendorlib_stem'
20614 vendorlibexp='$vendorlibexp'
20615 vendorprefix='$vendorprefix'
20616 vendorprefixexp='$vendorprefixexp'
20617 version='$version'
20618 version_patchlevel_string='$version_patchlevel_string'
20619 versiononly='$versiononly'
20620 vi='$vi'
20621 voidflags='$voidflags'
20622 xlibpth='$xlibpth'
20623 xs_apiversion='$xs_apiversion'
20624 yacc='$yacc'
20625 yaccflags='$yaccflags'
20626 zcat='$zcat'
20627 zip='$zip'
20628 EOT
20629
20630 : Add in command line options if available
20631 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20632
20633 : add special variables
20634 $test -f $src/patchlevel.h && \
20635 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20636 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20637 echo "PERL_CONFIG_SH=true" >>config.sh
20638
20639 : propagate old symbols
20640 if $test -f UU/config.sh; then
20641         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20642         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20643         $sort | $uniq -u >UU/oldsyms
20644         set X `cat UU/oldsyms`
20645         shift
20646         case $# in
20647         0) ;;
20648         *)
20649                 cat <<EOM
20650 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20651 EOM
20652                 echo "# Variables propagated from previous config.sh file." >>config.sh
20653                 for sym in `cat UU/oldsyms`; do
20654                         echo "    Propagating $hint variable "'$'"$sym..."
20655                         eval 'tmp="$'"${sym}"'"'
20656                         echo "$tmp" | \
20657                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20658                 done
20659                 ;;
20660         esac
20661 fi
20662
20663 : Finish up by extracting the .SH files
20664 case "$alldone" in
20665 exit)
20666         $rm -rf UU
20667         echo "Extraction done."
20668         exit 0
20669         ;;
20670 cont)
20671         ;;
20672 '')
20673         dflt=''
20674         nostick=true
20675         $cat <<EOM
20676
20677 If you'd like to make any changes to the config.sh file before I begin
20678 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20679
20680 EOM
20681         rp="Press return or use a shell escape to edit config.sh:"
20682         . UU/myread
20683         nostick=''
20684         case "$ans" in
20685         '') ;;
20686         *) : in case they cannot read
20687                 sh 1>&4 -c "$ans";;
20688         esac
20689         ;;
20690 esac
20691
20692 : if this fails, just run all the .SH files by hand
20693 . ./config.sh
20694
20695 echo " "
20696 exec 1>&4
20697 pwd=`pwd`
20698 . ./UU/extract
20699 cd "$pwd"
20700
20701 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20702         dflt=y
20703         case "$silent" in
20704         true) ;;
20705         *)
20706                 $cat <<EOM
20707
20708 Now you need to generate make dependencies by running "$make depend".
20709 You might prefer to run it in background: "$make depend > makedepend.out &"
20710 It can take a while, so you might not want to run it right now.
20711
20712 EOM
20713                 ;;
20714         esac
20715         rp="Run $make depend now?"
20716         . UU/myread
20717         case "$ans" in
20718         y*)
20719                 $make depend && echo "Now you must run '$make'."
20720                 ;;
20721         *)
20722                 echo "You must run '$make depend' then '$make'."
20723                 ;;
20724         esac
20725 elif test -f [Mm]akefile; then
20726         echo " "
20727         echo "Now you must run a $make."
20728 else
20729         echo "Configure done."
20730 fi
20731
20732 if $test -f Policy.sh; then
20733     $cat <<EOM
20734
20735 If you compile $package on a different machine or from a different object
20736 directory, copy the Policy.sh file from this object directory to the
20737 new one before you run Configure -- this will help you with most of
20738 the policy defaults.
20739
20740 EOM
20741 fi
20742 if $test -f config.msg; then
20743     echo "Hmm.  I also noted the following information while running:"
20744     echo " "
20745     $cat config.msg >&4
20746     $rm -f config.msg
20747 fi
20748 $rm -f kit*isdone ark*isdone
20749 $rm -rf UU
20750
20751 : End of Configure
20752