Configure missing d_modflproto=''
[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.1 complains about adding -Idirectories that it already knows 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 `$cc -v -c try.c 2>&1 | \
3862        sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
3863        locincpth=`echo $locincpth | sed s!$incdir!!`
3864     done
3865     $rm -f try try.*
3866 esac
3867
3868 : decide how portable to be.  Allow command line overrides.
3869 case "$d_portable" in
3870 "$undef") ;;
3871 *)      d_portable="$define" ;;
3872 esac
3873
3874 : set up shell script to do ~ expansion
3875 cat >filexp <<EOSS
3876 $startsh
3877 : expand filename
3878 case "\$1" in
3879  ~/*|~)
3880         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3881         ;;
3882  ~*)
3883         if $test -f /bin/csh; then
3884                 /bin/csh -f -c "glob \$1"
3885                 failed=\$?
3886                 echo ""
3887                 exit \$failed
3888         else
3889                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3890                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3891                 if $test ! -d "\$dir"; then
3892                         me=\`basename \$0\`
3893                         echo "\$me: can't locate home directory for: \$name" >&2
3894                         exit 1
3895                 fi
3896                 case "\$1" in
3897                 */*)
3898                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3899                         ;;
3900                 *)
3901                         echo \$dir
3902                         ;;
3903                 esac
3904         fi
3905         ;;
3906 *)
3907         echo \$1
3908         ;;
3909 esac
3910 EOSS
3911 chmod +x filexp
3912 $eunicefix filexp
3913
3914 : now set up to get a file name
3915 cat <<EOS >getfile
3916 $startsh
3917 EOS
3918 cat <<'EOSC' >>getfile
3919 tilde=''
3920 fullpath=''
3921 already=''
3922 skip=''
3923 none_ok=''
3924 exp_file=''
3925 nopath_ok=''
3926 orig_rp="$rp"
3927 orig_dflt="$dflt"
3928 case "$gfpth" in
3929 '') gfpth='.' ;;
3930 esac
3931
3932 case "$fn" in
3933 *\(*)
3934         : getfile will accept an answer from the comma-separated list
3935         : enclosed in parentheses even if it does not meet other criteria.
3936         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3937         fn=`echo $fn | sed 's/(.*)//'`
3938         ;;
3939 esac
3940
3941 case "$fn" in
3942 *:*)
3943         loc_file=`expr $fn : '.*:\(.*\)'`
3944         fn=`expr $fn : '\(.*\):.*'`
3945         ;;
3946 esac
3947
3948 case "$fn" in
3949 *~*) tilde=true;;
3950 esac
3951 case "$fn" in
3952 */*) fullpath=true;;
3953 esac
3954 case "$fn" in
3955 *+*) skip=true;;
3956 esac
3957 case "$fn" in
3958 *n*) none_ok=true;;
3959 esac
3960 case "$fn" in
3961 *e*) exp_file=true;;
3962 esac
3963 case "$fn" in
3964 *p*) nopath_ok=true;;
3965 esac
3966
3967 case "$fn" in
3968 *f*) type='File';;
3969 *d*) type='Directory';;
3970 *l*) type='Locate';;
3971 esac
3972
3973 what="$type"
3974 case "$what" in
3975 Locate) what='File';;
3976 esac
3977
3978 case "$exp_file" in
3979 '')
3980         case "$d_portable" in
3981         "$define") ;;
3982         *) exp_file=true;;
3983         esac
3984         ;;
3985 esac
3986
3987 cd ..
3988 while test "$type"; do
3989         redo=''
3990         rp="$orig_rp"
3991         dflt="$orig_dflt"
3992         case "$tilde" in
3993         true) rp="$rp (~name ok)";;
3994         esac
3995         . UU/myread
3996         if test -f UU/getfile.ok && \
3997                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3998         then
3999                 value="$ans"
4000                 ansexp="$ans"
4001                 break
4002         fi
4003         case "$ans" in
4004         none)
4005                 value=''
4006                 ansexp=''
4007                 case "$none_ok" in
4008                 true) type='';;
4009                 esac
4010                 ;;
4011         *)
4012                 case "$tilde" in
4013                 '') value="$ans"
4014                         ansexp="$ans";;
4015                 *)
4016                         value=`UU/filexp $ans`
4017                         case $? in
4018                         0)
4019                                 if test "$ans" != "$value"; then
4020                                         echo "(That expands to $value on this system.)"
4021                                 fi
4022                                 ;;
4023                         *) value="$ans";;
4024                         esac
4025                         ansexp="$value"
4026                         case "$exp_file" in
4027                         '') value="$ans";;
4028                         esac
4029                         ;;
4030                 esac
4031                 case "$fullpath" in
4032                 true)
4033                         case "$ansexp" in
4034                         /*) value="$ansexp" ;;
4035                         [a-zA-Z]:/*) value="$ansexp" ;;
4036                         *)
4037                                 redo=true
4038                                 case "$already" in
4039                                 true)
4040                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4041                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4042                                         ;;
4043                                 *)
4044                                 echo "Please give a full path name, starting with slash." >&4
4045                                         case "$tilde" in
4046                                         true)
4047                                 echo "Note that using ~name is ok provided it expands well." >&4
4048                                                 already=true
4049                                                 ;;
4050                                         esac
4051                                 esac
4052                                 ;;
4053                         esac
4054                         ;;
4055                 esac
4056                 case "$redo" in
4057                 '')
4058                         case "$type" in
4059                         File)
4060                                 for fp in $gfpth; do
4061                                         if test "X$fp" = X.; then
4062                                             pf="$ansexp"
4063                                         else    
4064                                             pf="$fp/$ansexp"
4065                                         fi
4066                                         if test -f "$pf"; then
4067                                                 type=''
4068                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4069                                         then
4070                                                 echo "($value is not a plain file, but that's ok.)"
4071                                                 type=''
4072                                         fi
4073                                         if test X"$type" = X; then
4074                                             value="$pf"
4075                                             break
4076                                         fi
4077                                 done
4078                                 ;;
4079                         Directory)
4080                                 for fp in $gfpth; do
4081                                         if test "X$fp" = X.; then
4082                                             dir="$ans"
4083                                             direxp="$ansexp"
4084                                         else    
4085                                             dir="$fp/$ansexp"
4086                                             direxp="$fp/$ansexp"
4087                                         fi
4088                                         if test -d "$direxp"; then
4089                                                 type=''
4090                                                 value="$dir"
4091                                                 break
4092                                         fi
4093                                 done
4094                                 ;;
4095                         Locate)
4096                                 if test -d "$ansexp"; then
4097                                         echo "(Looking for $loc_file in directory $value.)"
4098                                         value="$value/$loc_file"
4099                                         ansexp="$ansexp/$loc_file"
4100                                 fi
4101                                 if test -f "$ansexp"; then
4102                                         type=''
4103                                 fi
4104                                 case "$nopath_ok" in
4105                                 true)   case "$value" in
4106                                         */*) ;;
4107                                         *)      echo "Assuming $value will be in people's path."
4108                                                 type=''
4109                                                 ;;
4110                                         esac
4111                                         ;;
4112                                 esac
4113                                 ;;
4114                         esac
4115
4116                         case "$skip" in
4117                         true) type='';
4118                         esac
4119
4120                         case "$type" in
4121                         '') ;;
4122                         *)
4123                                 if test "$fastread" = yes; then
4124                                         dflt=y
4125                                 else
4126                                         dflt=n
4127                                 fi
4128                                 rp="$what $value doesn't exist.  Use that name anyway?"
4129                                 . UU/myread
4130                                 dflt=''
4131                                 case "$ans" in
4132                                 y*) type='';;
4133                                 *) echo " ";;
4134                                 esac
4135                                 ;;
4136                         esac
4137                         ;;
4138                 esac
4139                 ;;
4140         esac
4141 done
4142 cd UU
4143 ans="$value"
4144 rp="$orig_rp"
4145 dflt="$orig_dflt"
4146 rm -f getfile.ok
4147 test "X$gfpthkeep" != Xy && gfpth=""
4148 EOSC
4149
4150 : What should the include directory be ?
4151 echo " "
4152 $echo $n "Hmm...  $c"
4153 dflt='/usr/include'
4154 incpath=''
4155 mips_type=''
4156 if $test -f /bin/mips && /bin/mips; then
4157         echo "Looks like a MIPS system..."
4158         $cat >usr.c <<'EOCP'
4159 #ifdef SYSTYPE_BSD43
4160 /bsd43
4161 #endif
4162 EOCP
4163         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4164                 dflt='/bsd43/usr/include'
4165                 incpath='/bsd43'
4166                 mips_type='BSD 4.3'
4167         else
4168                 mips_type='System V'
4169         fi
4170         $rm -f usr.c usr.out
4171         echo "and you're compiling with the $mips_type compiler and libraries."
4172         xxx_prompt=y
4173         echo "exit 0" >mips
4174 else
4175         echo "Doesn't look like a MIPS system."
4176         xxx_prompt=n
4177         echo "exit 1" >mips
4178 fi
4179 chmod +x mips
4180 $eunicefix mips
4181 case "$usrinc" in
4182 '') ;;
4183 *) dflt="$usrinc";;
4184 esac
4185 case "$xxx_prompt" in
4186 y)      fn=d/
4187         echo " "
4188         rp='Where are the include files you want to use?'
4189         . ./getfile
4190         usrinc="$ans"
4191         ;;
4192 *)      usrinc="$dflt"
4193         ;;
4194 esac
4195
4196 : see how we invoke the C preprocessor
4197 echo " "
4198 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4199 cat <<'EOT' >testcpp.c
4200 #define ABC abc
4201 #define XYZ xyz
4202 ABC.XYZ
4203 EOT
4204 cd ..
4205 if test ! -f cppstdin; then
4206         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4207                 # AIX cc -E doesn't show the absolute headerfile
4208                 # locations but we'll cheat by using the -M flag.
4209                 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
4210         else
4211                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4212         fi
4213 else
4214         echo "Keeping your $hint cppstdin wrapper."
4215 fi
4216 chmod 755 cppstdin
4217 wrapper=`pwd`/cppstdin
4218 ok='false'
4219 cd UU
4220
4221 if $test "X$cppstdin" != "X" && \
4222         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4223         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4224 then
4225         echo "You used to use $cppstdin $cppminus so we'll use that again."
4226         case "$cpprun" in
4227         '') echo "But let's see if we can live without a wrapper..." ;;
4228         *)
4229                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4230                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4231                 then
4232                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4233                         ok='true'
4234                 else
4235                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4236                 fi
4237                 ;;
4238         esac
4239 else
4240         case "$cppstdin" in
4241         '') ;;
4242         *)
4243                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4244                 ;;
4245         esac
4246 fi
4247
4248 if $ok; then
4249         : nothing
4250 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4251         $cc -E <testcpp.c >testcpp.out 2>&1; \
4252         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4253         echo "Yup, it does."
4254         x_cpp="$cc -E"
4255         x_minus='';
4256 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4257         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4258         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4259         echo "Yup, it does."
4260         x_cpp="$cc -E"
4261         x_minus='-';
4262 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4263         $cc -P <testcpp.c >testcpp.out 2>&1; \
4264         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4265         echo "Yipee, that works!"
4266         x_cpp="$cc -P"
4267         x_minus='';
4268 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4269         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4270         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4271         echo "At long last!"
4272         x_cpp="$cc -P"
4273         x_minus='-';
4274 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4275         $cpp <testcpp.c >testcpp.out 2>&1; \
4276         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4277         echo "It works!"
4278         x_cpp="$cpp"
4279         x_minus='';
4280 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4281         $cpp - <testcpp.c >testcpp.out 2>&1; \
4282         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4283         echo "Hooray, it works!  I was beginning to wonder."
4284         x_cpp="$cpp"
4285         x_minus='-';
4286 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4287         $wrapper <testcpp.c >testcpp.out 2>&1; \
4288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4289         x_cpp="$wrapper"
4290         x_minus=''
4291         echo "Eureka!"
4292 else
4293         dflt=''
4294         rp="No dice.  I can't find a C preprocessor.  Name one:"
4295         . ./myread
4296         x_cpp="$ans"
4297         x_minus=''
4298         $x_cpp <testcpp.c >testcpp.out 2>&1
4299         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4300                 echo "OK, that will do." >&4
4301         else
4302 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4303                 exit 1
4304         fi
4305 fi
4306
4307 case "$ok" in
4308 false)
4309         cppstdin="$x_cpp"
4310         cppminus="$x_minus"
4311         cpprun="$x_cpp"
4312         cpplast="$x_minus"
4313         set X $x_cpp
4314         shift
4315         case "$1" in
4316         "$cpp")
4317                 echo "Perhaps can we force $cc -E using a wrapper..."
4318                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4319                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4320                 then
4321                         echo "Yup, we can."
4322                         cppstdin="$wrapper"
4323                         cppminus='';
4324                 else
4325                         echo "Nope, we'll have to live without it..."
4326                 fi
4327                 ;;
4328         esac
4329         case "$cpprun" in
4330         "$wrapper")
4331                 cpprun=''
4332                 cpplast=''
4333                 ;;
4334         esac
4335         ;;
4336 esac
4337
4338 case "$cppstdin" in
4339 "$wrapper"|'cppstdin') ;;
4340 *) $rm -f $wrapper;;
4341 esac
4342 $rm -f testcpp.c testcpp.out
4343
4344 : Set private lib path
4345 case "$plibpth" in
4346 '') if ./mips; then
4347                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4348         fi;;
4349 esac
4350 case "$libpth" in
4351 ' ') dlist='';;
4352 '') dlist="$loclibpth $plibpth $glibpth";;
4353 *) dlist="$libpth";;
4354 esac
4355
4356 : Now check and see which directories actually exist, avoiding duplicates
4357 libpth=''
4358 for xxx in $dlist
4359 do
4360     if $test -d $xxx; then
4361                 case " $libpth " in
4362                 *" $xxx "*) ;;
4363                 *) libpth="$libpth $xxx";;
4364                 esac
4365     fi
4366 done
4367 $cat <<'EOM'
4368
4369 Some systems have incompatible or broken versions of libraries.  Among
4370 the directories listed in the question below, please remove any you
4371 know not to be holding relevant libraries, and add any that are needed.
4372 Say "none" for none.
4373
4374 EOM
4375 case "$libpth" in
4376 '') dflt='none';;
4377 *)
4378         set X $libpth
4379         shift
4380         dflt=${1+"$@"}
4381         ;;
4382 esac
4383 rp="Directories to use for library searches?"
4384 . ./myread
4385 case "$ans" in
4386 none) libpth=' ';;
4387 *) libpth="$ans";;
4388 esac
4389
4390 : compute shared library extension
4391 case "$so" in
4392 '')
4393         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4394                 dflt='sl'
4395         else
4396                 dflt='so'
4397         fi
4398         ;;
4399 *) dflt="$so";;
4400 esac
4401 $cat <<EOM
4402
4403 On some systems, shared libraries may be available.  Answer 'none' if
4404 you want to suppress searching of shared libraries for the remainder
4405 of this configuration.
4406
4407 EOM
4408 rp='What is the file extension used for shared libraries?'
4409 . ./myread
4410 so="$ans"
4411
4412 : Define several unixisms.
4413 : Hints files or command line option can be used to override them.
4414 : The convoluted testing is in case hints files set either the old
4415 : or the new name.
4416 case "$_exe" in
4417 '')     case "$exe_ext" in
4418         '')     ;;
4419         *)      _exe="$exe_ext" ;;
4420         esac
4421         ;;
4422 esac
4423 case "$_a" in
4424 '')     case "$lib_ext" in
4425     '') _a='.a';;
4426         *)      _a="$lib_ext" ;;
4427         esac
4428         ;;
4429 esac
4430 case "$_o" in
4431 '') case "$obj_ext" in
4432         '')     _o='.o';;
4433         *)      _o="$obj_ext";;
4434         esac
4435         ;;
4436 esac
4437 case "$p_" in
4438 '') case "$path_sep" in
4439         '')     p_=':';;
4440         *)      p_="$path_sep";;
4441         esac
4442         ;;
4443 esac
4444 exe_ext=$_exe
4445 lib_ext=$_a
4446 obj_ext=$_o
4447 path_sep=$p_
4448
4449 : Which makefile gets called first.  This is used by make depend.
4450 case "$firstmakefile" in
4451 '') firstmakefile='makefile';;
4452 esac
4453
4454 : Looking for optional libraries
4455 echo " "
4456 echo "Checking for optional libraries..." >&4
4457 case "$libs" in
4458 ' '|'') dflt='';;
4459 *) dflt="$libs";;
4460 esac
4461 case "$libswanted" in
4462 '') libswanted='c_s';;
4463 esac
4464 case "$usesocks" in
4465 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4466 esac
4467 libsfound=''
4468 libsfiles=''
4469 libsdirs=''
4470 libspath=''
4471 for thisdir in $libpth $xlibpth; do
4472   test -d $thisdir && libspath="$libspath $thisdir"
4473 done
4474 for thislib in $libswanted; do
4475         for thisdir in $libspath; do
4476             xxx=''
4477             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4478                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4479                 $test -f "$xxx" && eval $libscheck
4480                 $test -f "$xxx" && libstyle=shared
4481             fi
4482             if test ! -f "$xxx"; then
4483                 xxx=$thisdir/lib$thislib.$so
4484                 $test -f "$xxx" && eval $libscheck
4485                 $test -f "$xxx" && libstyle=shared
4486             fi  
4487             if test ! -f "$xxx"; then
4488                 xxx=$thisdir/lib$thislib$_a
4489                 $test -f "$xxx" && eval $libscheck
4490                 $test -f "$xxx" && libstyle=static
4491             fi
4492             if test ! -f "$xxx"; then
4493                 xxx=$thisdir/$thislib$_a
4494                 $test -f "$xxx" && eval $libscheck
4495                 $test -f "$xxx" && libstyle=static
4496             fi
4497             if test ! -f "$xxx"; then
4498                 xxx=$thisdir/lib${thislib}_s$_a
4499                 $test -f "$xxx" && eval $libscheck
4500                 $test -f "$xxx" && libstyle=static
4501                 $test -f "$xxx" && thislib=${thislib}_s
4502             fi
4503             if test ! -f "$xxx"; then
4504                 xxx=$thisdir/Slib$thislib$_a
4505                 $test -f "$xxx" && eval $libscheck
4506                 $test -f "$xxx" && libstyle=static
4507             fi
4508             if $test -f "$xxx"; then
4509                 case "$libstyle" in
4510                 shared) echo "Found -l$thislib (shared)." ;;
4511                 static) echo "Found -l$thislib." ;;
4512                 *)      echo "Found -l$thislib ($libstyle)." ;;
4513                 esac
4514                 case " $dflt " in
4515                 *"-l$thislib "*);;
4516                 *) dflt="$dflt -l$thislib"
4517                    libsfound="$libsfound $xxx"
4518                    yyy=`basename $xxx`
4519                    libsfiles="$libsfiles $yyy"
4520                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4521                    case " $libsdirs " in
4522                    *" $yyy "*) ;;
4523                    *) libsdirs="$libsdirs $yyy" ;;
4524                    esac
4525                    ;;
4526                 esac
4527                 break
4528             fi  
4529         done
4530         if $test ! -f "$xxx"; then
4531             echo "No -l$thislib."
4532         fi
4533 done
4534 set X $dflt
4535 shift
4536 dflt="$*"
4537 case "$libs" in
4538 '') dflt="$dflt";;
4539 *) dflt="$libs";;
4540 esac
4541 case "$dflt" in
4542 ' '|'') dflt='none';;
4543 esac
4544
4545 $cat <<EOM
4546
4547 In order to compile $package on your machine, a number of libraries
4548 are usually needed.  Include any other special libraries here as well.
4549 Say "none" for none.  The default list is almost always right.
4550 EOM
4551
4552 echo " "
4553 rp="What libraries to use?"
4554 . ./myread
4555 case "$ans" in
4556 none) libs=' ';;
4557 *) libs="$ans";;
4558 esac
4559
4560 : determine optimization, if desired, or use for debug flag also
4561 case "$optimize" in
4562 ' '|$undef) dflt='none';;
4563 '') dflt='-O';;
4564 *) dflt="$optimize";;
4565 esac
4566 $cat <<EOH
4567
4568 By default, $package compiles with the -O flag to use the optimizer.
4569 Alternately, you might want to use the symbolic debugger, which uses
4570 the -g flag (on traditional Unix systems).  Either flag can be
4571 specified here.  To use neither flag, specify the word "none".
4572
4573 EOH
4574 rp="What optimizer/debugger flag should be used?"
4575 . ./myread
4576 optimize="$ans"
4577 case "$optimize" in
4578 'none') optimize=" ";;
4579 esac
4580
4581 dflt=''
4582 : We will not override a previous value, but we might want to
4583 : augment a hint file
4584 case "$hint" in
4585 default|recommended)
4586         case "$gccversion" in
4587         1*) dflt='-fpcc-struct-return' ;;
4588         esac
4589         case "$optimize" in
4590         *-g*) dflt="$dflt -DDEBUGGING";;
4591         esac
4592         case "$gccversion" in
4593         2*) if test -d /etc/conf/kconfig.d &&
4594                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4595                 then
4596                         dflt="$dflt -posix"
4597                 fi
4598                 ;;
4599         esac
4600         case "$gccversion" in
4601         1*) ;;
4602         2.[0-8]*) ;;
4603         ?*)     echo " "
4604                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4605                 echo 'int main(void) { return 0; }' > gcctest.c
4606                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4607                         echo "Yes, it does." 2>&1
4608                         case "$ccflags" in
4609                         *strict-aliasing*) 
4610                                 echo "Leaving current flags $ccflags alone." 2>&1
4611                                 ;;
4612                         *) dflt="$dflt -fno-strict-aliasing" ;;
4613                         esac
4614                 else
4615                         echo "Nope, it doesn't, but that's ok." 2>&1
4616                 fi
4617                 ;;
4618         esac
4619         ;;
4620 esac
4621
4622 case "$mips_type" in
4623 *BSD*|'') inclwanted="$locincpth $usrinc";;
4624 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4625 esac
4626 for thisincl in $inclwanted; do
4627         if $test -d $thisincl; then
4628                 if $test x$thisincl != x$usrinc; then
4629                         case "$dflt" in
4630                         *" -I$thisincl "*);;
4631                         *) dflt="$dflt -I$thisincl ";;
4632                         esac
4633                 fi
4634         fi
4635 done
4636
4637 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4638         xxx=true;
4639 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4640         xxx=true;
4641 else
4642         xxx=false;
4643 fi;
4644 if $xxx; then
4645         case "$dflt" in
4646         *$2*);;
4647         *) dflt="$dflt -D$2";;
4648         esac;
4649 fi'
4650
4651 set signal.h LANGUAGE_C; eval $inctest
4652
4653 case "$usesocks" in
4654 $define)
4655         ccflags="$ccflags -DSOCKS"
4656         ;;
4657 esac
4658
4659 case "$hint" in
4660 default|recommended) dflt="$ccflags $dflt" ;;
4661 *) dflt="$ccflags";;
4662 esac
4663
4664 case "$dflt" in
4665 ''|' ') dflt=none;;
4666 esac
4667
4668 $cat <<EOH
4669
4670 Your C compiler may want other flags.  For this question you should include
4671 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4672 but you should NOT include libraries or ld flags like -lwhatever.  If you
4673 want $package to honor its debug switch, you should include -DDEBUGGING here.
4674 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4675
4676 To use no flags, specify the word "none".
4677
4678 EOH
4679 set X $dflt
4680 shift
4681 dflt=${1+"$@"}
4682 rp="Any additional cc flags?"
4683 . ./myread
4684 case "$ans" in
4685 none) ccflags='';;
4686 *) ccflags="$ans";;
4687 esac
4688
4689 : the following weeds options from ccflags that are of no interest to cpp
4690 case "$cppflags" in
4691 '') cppflags="$ccflags" ;;
4692 *)  cppflags="$cppflags $ccflags" ;;
4693 esac
4694 case "$gccversion" in
4695 1*) cppflags="$cppflags -D__GNUC__"
4696 esac
4697 case "$mips_type" in
4698 '');;
4699 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4700 esac
4701 case "$cppflags" in
4702 '');;
4703 *)
4704         echo " "
4705         echo "Let me guess what the preprocessor flags are..." >&4
4706         set X $cppflags
4707         shift
4708         cppflags=''
4709         $cat >cpp.c <<'EOM'
4710 #define BLURFL foo
4711
4712 BLURFL xx LFRULB
4713 EOM
4714         previous=''
4715         for flag in $*
4716         do
4717                 case "$flag" in
4718                 -*) ftry="$flag";;
4719                 *) ftry="$previous $flag";;
4720                 esac
4721                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4722                         >cpp1.out 2>/dev/null && \
4723                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4724                         >cpp2.out 2>/dev/null && \
4725                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4726                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4727                 then
4728                         cppflags="$cppflags $ftry"
4729                         previous=''
4730                 else
4731                         previous="$flag"
4732                 fi
4733         done
4734         set X $cppflags
4735         shift
4736         cppflags=${1+"$@"}
4737         case "$cppflags" in
4738         *-*)  echo "They appear to be: $cppflags";;
4739         esac
4740         $rm -f cpp.c cpp?.out
4741         ;;
4742 esac
4743
4744 : flags used in final linking phase
4745 case "$ldflags" in
4746 '') if ./venix; then
4747                 dflt='-i -z'
4748         else
4749                 dflt=''
4750         fi
4751         case "$ccflags" in
4752         *-posix*) dflt="$dflt -posix" ;;
4753         esac
4754         ;;
4755 *) dflt="$ldflags";;
4756 esac
4757
4758 : Try to guess additional flags to pick up local libraries.
4759 for thislibdir in $libpth; do
4760         case " $loclibpth " in
4761         *" $thislibdir "*)
4762                 case "$dflt " in 
4763                 *"-L$thislibdir "*) ;;
4764                 *)  dflt="$dflt -L$thislibdir" ;;
4765                 esac
4766                 ;;
4767         esac
4768 done
4769
4770 case "$dflt" in
4771 '') dflt='none' ;;
4772 esac
4773
4774 $cat <<EOH
4775
4776 Your C linker may need flags.  For this question you should
4777 include -L/whatever and any other flags used by the C linker, but you
4778 should NOT include libraries like -lwhatever.
4779
4780 Make sure you include the appropriate -L/path flags if your C linker
4781 does not normally search all of the directories you specified above,
4782 namely
4783         $libpth
4784 To use no flags, specify the word "none".
4785
4786 EOH
4787
4788 rp="Any additional ld flags (NOT including libraries)?"
4789 . ./myread
4790 case "$ans" in
4791 none) ldflags='';;
4792 *) ldflags="$ans";;
4793 esac
4794 rmlist="$rmlist pdp11"
4795
4796 : coherency check
4797 echo " "
4798 echo "Checking your choice of C compiler and flags for coherency..." >&4
4799 $cat > try.c <<'EOF'
4800 #include <stdio.h>
4801 int main() { printf("Ok\n"); exit(0); }
4802 EOF
4803 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4804 shift
4805 $cat >try.msg <<'EOM'
4806 I've tried to compile and run the following simple program:
4807
4808 EOM
4809 $cat try.c >> try.msg
4810
4811 $cat >> try.msg <<EOM
4812
4813 I used the command:
4814
4815         $*
4816         $run ./try
4817
4818 and I got the following output:
4819
4820 EOM
4821 dflt=y
4822 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4823         if $sh -c "$run ./try" >>try.msg 2>&1; then
4824                 xxx=`$run ./try`
4825                 case "$xxx" in
4826                 "Ok") dflt=n ;;
4827                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4828                         case " $libs " in
4829                         *" -lsfio "*)
4830                                 cat >> try.msg <<'EOQS'
4831 If $libs contains -lsfio, and sfio is mis-configured, then it
4832 sometimes (apparently) runs and exits with a 0 status, but with no
4833 output!  It may have to do with sfio's use of _exit vs. exit.
4834
4835 EOQS
4836                                 rp="You have a big problem.  Shall I abort Configure"
4837                                 dflt=y
4838                                 ;;
4839                         esac
4840                         ;;
4841                 esac
4842         else
4843                 echo "The program compiled OK, but exited with status $?." >>try.msg
4844                 rp="You have a problem.  Shall I abort Configure"
4845                 dflt=y
4846         fi
4847 else
4848         echo "I can't compile the test program." >>try.msg
4849         rp="You have a BIG problem.  Shall I abort Configure"
4850         dflt=y
4851 fi
4852 case "$dflt" in
4853 y)
4854         $cat try.msg >&4
4855         case "$knowitall" in
4856         '')
4857                 echo "(The supplied flags or libraries might be incorrect.)"
4858                 ;;
4859         *) dflt=n;;
4860         esac
4861         echo " "
4862         . ./myread
4863         case "$ans" in
4864         n*|N*) ;;
4865         *)      echo "Ok.  Stopping Configure." >&4
4866                 exit 1
4867                 ;;
4868         esac
4869         ;;
4870 n) echo "OK, that should do.";;
4871 esac
4872 $rm -f try try.* core
4873
4874 : define a shorthand compile call
4875 compile='
4876 mc_file=$1;
4877 shift;
4878 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4879 : define a shorthand compile call for compilations that should be ok.
4880 compile_ok='
4881 mc_file=$1;
4882 shift;
4883 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4884
4885 : check for lengths of integral types
4886 echo " "
4887 case "$intsize" in
4888 '')
4889         echo "Checking to see how big your integers are..." >&4
4890         $cat >try.c <<'EOCP'
4891 #include <stdio.h>
4892 int main()
4893 {
4894         printf("intsize=%d;\n", (int)sizeof(int));
4895         printf("longsize=%d;\n", (int)sizeof(long));
4896         printf("shortsize=%d;\n", (int)sizeof(short));
4897         exit(0);
4898 }
4899 EOCP
4900         set try
4901         if eval $compile_ok && $run ./try > /dev/null; then
4902                 eval `$run ./try`
4903                 echo "Your integers are $intsize bytes long."
4904                 echo "Your long integers are $longsize bytes long."
4905                 echo "Your short integers are $shortsize bytes long."
4906         else
4907                 $cat >&4 <<EOM
4908 !
4909 Help! I can't compile and run the intsize test program: please enlighten me!
4910 (This is probably a misconfiguration in your system or libraries, and
4911 you really ought to fix it.  Still, I'll try anyway.)
4912 !
4913 EOM
4914                 dflt=4
4915                 rp="What is the size of an integer (in bytes)?"
4916                 . ./myread
4917                 intsize="$ans"
4918                 dflt=$intsize
4919                 rp="What is the size of a long integer (in bytes)?"
4920                 . ./myread
4921                 longsize="$ans"
4922                 dflt=2
4923                 rp="What is the size of a short integer (in bytes)?"
4924                 . ./myread
4925                 shortsize="$ans"
4926         fi
4927         ;;
4928 esac
4929 $rm -f try try.*
4930
4931 : check for long long
4932 echo " "
4933 echo "Checking to see if you have long long..." >&4
4934 echo 'int main() { long long x = 7; return 0; }' > try.c
4935 set try
4936 if eval $compile; then
4937         val="$define"
4938         echo "You have long long."
4939 else
4940         val="$undef"
4941         echo "You do not have long long."
4942 fi
4943 $rm try.*
4944 set d_longlong
4945 eval $setvar
4946
4947 : check for length of long long
4948 case "${d_longlong}${longlongsize}" in
4949 $define)
4950         echo " "
4951         echo "Checking to see how big your long longs are..." >&4
4952         $cat >try.c <<'EOCP'
4953 #include <stdio.h>
4954 int main()
4955 {
4956     printf("%d\n", (int)sizeof(long long));
4957     return(0);
4958 }
4959 EOCP
4960         set try
4961         if eval $compile_ok; then
4962                 longlongsize=`$run ./try`
4963                 echo "Your long longs are $longlongsize bytes long."
4964         else
4965                 dflt='8'
4966                 echo " "
4967                 echo "(I can't seem to compile the test program.  Guessing...)"
4968                 rp="What is the size of a long long (in bytes)?"
4969                 . ./myread
4970                 longlongsize="$ans"
4971         fi
4972         if $test "X$longsize" = "X$longlongsize"; then
4973                 echo "(That isn't any different from an ordinary long.)"
4974         fi      
4975         ;;
4976 esac
4977 $rm -f try.* try
4978
4979 : determine filename position in cpp output
4980 echo " "
4981 echo "Computing filename position in cpp output for #include directives..." >&4
4982 case "$osname" in
4983 vos) testaccess=-e ;;
4984 *)   testaccess=-r ;;
4985 esac
4986 echo '#include <stdio.h>' > foo.c
4987 $cat >fieldn <<EOF
4988 $startsh
4989 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4990 $grep '^[       ]*#.*stdio\.h' | \
4991 while read cline; do
4992         pos=1
4993         set \$cline
4994         while $test \$# -gt 0; do
4995                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4996                         echo "\$pos"
4997                         exit 0
4998                 fi
4999                 shift
5000                 pos=\`expr \$pos + 1\`
5001         done
5002 done
5003 EOF
5004 chmod +x fieldn
5005 fieldn=`./fieldn`
5006 $rm -f foo.c fieldn
5007 case $fieldn in
5008 '') pos='???';;
5009 1) pos=first;;
5010 2) pos=second;;
5011 3) pos=third;;
5012 *) pos="${fieldn}th";;
5013 esac
5014 echo "Your cpp writes the filename in the $pos field of the line."
5015
5016 case "$osname" in
5017 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5018 *)   cppfilter='' ;;
5019 esac
5020 : locate header file
5021 $cat >findhdr <<EOF
5022 $startsh
5023 wanted=\$1
5024 name=''
5025 for usrincdir in $usrinc
5026 do
5027         if test -f \$usrincdir/\$wanted; then
5028                 echo "\$usrincdir/\$wanted"
5029                 exit 0
5030         fi
5031 done
5032 awkprg='{ print \$$fieldn }'
5033 echo "#include <\$wanted>" > foo\$\$.c
5034 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5035 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5036 while read cline; do
5037         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5038         case "\$name" in
5039         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5040         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5041         *) exit 2;;
5042         esac;
5043 done;
5044 #
5045 # status = 0: grep returned 0 lines, case statement not executed
5046 # status = 1: headerfile found
5047 # status = 2: while loop executed, no headerfile found
5048 #
5049 status=\$?
5050 $rm -f foo\$\$.c;
5051 if test \$status -eq 1; then
5052         exit 0;
5053 fi
5054 exit 1
5055 EOF
5056 chmod +x findhdr
5057
5058 : define an alternate in-header-list? function
5059 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5060 cont=true; xxf="echo \"<\$1> found.\" >&4";
5061 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5062 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5063 esac;
5064 case $# in 4) instead=instead;; *) instead="at last";; esac;
5065 while $test "$cont"; do
5066         xxx=`./findhdr $1`
5067         var=$2; eval "was=\$$2";
5068         if $test "$xxx" && $test -r "$xxx";
5069         then eval $xxf;
5070         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5071                 cont="";
5072         else eval $xxnf;
5073         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5074         set $yyy; shift; shift; yyy=$@;
5075         case $# in 0) cont="";;
5076         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5077                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5078         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5079                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5080         esac;
5081 done;
5082 while $test "$yyy";
5083 do set $yyy; var=$2; eval "was=\$$2";
5084         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5085         set $yyy; shift; shift; yyy=$@;
5086 done'
5087
5088 : see if inttypes.h is available
5089 : we want a real compile instead of Inhdr because some systems
5090 : have an inttypes.h which includes non-existent headers
5091 echo " "
5092 $cat >try.c <<EOCP
5093 #include <inttypes.h>
5094 int main() {
5095         static int32_t foo32 = 0x12345678;
5096 }
5097 EOCP
5098 set try
5099 if eval $compile; then
5100         echo "<inttypes.h> found." >&4
5101         val="$define"
5102 else
5103         echo "<inttypes.h> NOT found." >&4
5104         val="$undef"
5105 fi
5106 $rm -f try.c try
5107 set i_inttypes
5108 eval $setvar
5109
5110 : check for int64_t
5111 echo " "
5112 echo "Checking to see if you have int64_t..." >&4
5113 $cat >try.c <<EOCP
5114 #include <sys/types.h>
5115 #$i_inttypes I_INTTYPES
5116 #ifdef I_INTTYPES
5117 #include <inttypes.h>
5118 #endif
5119 int main() { int64_t x = 7; }
5120 EOCP
5121 set try
5122 if eval $compile; then
5123         val="$define"
5124         echo "You have int64_t."
5125 else
5126         val="$undef"
5127         echo "You do not have int64_t."
5128 fi
5129 $rm -f try try.*
5130 set d_int64_t
5131 eval $setvar
5132
5133
5134 echo " "
5135 echo "Checking which 64-bit integer type we could use..." >&4
5136
5137 case "$intsize" in
5138 8) val=int
5139    set quadtype
5140    eval $setvar
5141    val='"unsigned int"'
5142    set uquadtype
5143    eval $setvar
5144    quadkind=1
5145    ;;
5146 *) case "$longsize" in
5147    8) val=long
5148       set quadtype
5149       eval $setvar
5150       val='"unsigned long"'
5151       set uquadtype
5152       eval $setvar
5153       quadkind=2
5154       ;;
5155    *) case "$d_longlong:$longlongsize" in
5156       define:8)
5157         val='"long long"'
5158         set quadtype
5159         eval $setvar
5160         val='"unsigned long long"'
5161         set uquadtype
5162         eval $setvar
5163         quadkind=3
5164         ;;
5165       *) case "$d_int64_t" in
5166          define)
5167            val=int64_t
5168            set quadtype
5169            eval $setvar
5170            val=uint64_t
5171            set uquadtype
5172            eval $setvar
5173            quadkind=4
5174            ;;
5175          esac
5176          ;;
5177       esac
5178       ;;
5179    esac
5180    ;;
5181 esac
5182
5183 case "$quadtype" in
5184 '')     echo "Alas, no 64-bit integer types in sight." >&4
5185         d_quad="$undef"
5186         ;;
5187 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5188         d_quad="$define"
5189         ;;
5190 esac
5191
5192
5193 case "$uselonglong" in
5194 "$define"|true|[yY]*)
5195         cat <<EOM >&4
5196
5197 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5198 EOM
5199         use64bitint="$define"
5200         ;;
5201 esac                          
5202 case "$use64bits" in
5203 "$define"|true|[yY]*)
5204         cat <<EOM >&4
5205
5206 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5207 EOM
5208         use64bitint="$define"
5209         ;;
5210 esac                          
5211 case "$use64bitints" in
5212 "$define"|true|[yY]*)
5213         cat <<EOM >&4
5214
5215 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5216 EOM
5217         use64bitint="$define"
5218         ;;
5219 esac                          
5220 case "$use64bitsint" in
5221 "$define"|true|[yY]*)
5222         cat <<EOM >&4
5223
5224 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5225 EOM
5226         use64bitint="$define"
5227         ;;
5228 esac                          
5229 case "$uselonglongs" in
5230 "$define"|true|[yY]*)
5231         cat <<EOM >&4
5232
5233 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5234 EOM
5235         use64bitint="$define"
5236         ;;
5237 esac                          
5238 case "$use64bitsall" in
5239 "$define"|true|[yY]*)
5240         cat <<EOM >&4
5241
5242 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5243 EOM
5244         use64bitall="$define"
5245         ;;
5246 esac                          
5247
5248 case "$ccflags" in
5249 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5250 esac
5251 case "$use64bitall" in
5252 "$define"|true|[yY]*) use64bitint="$define" ;;
5253 esac
5254
5255 case "$longsize" in
5256 8) cat <<EOM
5257
5258 You have natively 64-bit long integers.
5259 EOM
5260    val="$define"
5261    ;;
5262 *) case "$use64bitint" in
5263    "$define"|true|[yY]*) dflt='y';;
5264    *) dflt='n';;
5265    esac
5266    case "$d_quad" in
5267    "$define") ;;
5268    *) dflt='n' ;;
5269    esac
5270    cat <<EOM
5271
5272 Perl can be built to take advantage of 64-bit integer types
5273 on some systems.  To do so, Configure can be run with -Duse64bitint.
5274 Choosing this option will most probably introduce binary incompatibilities.
5275
5276 If this doesn't make any sense to you, just accept the default '$dflt'.
5277 (The default has been chosen based on your configuration.)
5278 EOM
5279    rp='Try to use 64-bit integers, if available?'
5280    . ./myread
5281    case "$ans" in
5282    [yY]*) val="$define" ;;
5283    *)     val="$undef"  ;;
5284    esac
5285    ;;
5286 esac
5287 set use64bitint
5288 eval $setvar
5289
5290 case "$use64bitall" in
5291 "$define"|true|[yY]*) dflt='y' ;;
5292 *) case "$longsize" in
5293    8) dflt='y' ;;
5294    *) dflt='n' ;;
5295    esac
5296    ;;
5297 esac    
5298 cat <<EOM
5299
5300 You may also choose to try maximal 64-bitness.  It means using as much
5301 64-bitness as possible on the platform.  This in turn means even more
5302 binary incompatibilities.  On the other hand, your platform may not
5303 have any more 64-bitness available than what you already have chosen.
5304
5305 If this doesn't make any sense to you, just accept the default '$dflt'.
5306 (The default has been chosen based on your configuration.)
5307 EOM
5308 rp='Try to use maximal 64-bit support, if available?'
5309 . ./myread
5310 case "$ans" in
5311 [yY]*) val="$define" ;;
5312 *)     val="$undef"  ;;
5313 esac
5314 set use64bitall
5315 eval $setvar
5316 case "$use64bitall" in
5317 "$define")
5318         case "$use64bitint" in
5319         "$undef")
5320                 cat <<EOM
5321
5322 Since you have chosen a maximally 64-bit build, I'm also turning on
5323 the use of 64-bit integers.
5324 EOM
5325                 use64bitint="$define" ;;
5326         esac
5327         ;;
5328 esac
5329
5330 case "$use64bitint" in
5331 "$define"|true|[yY]*)
5332 : Look for a hint-file generated 'call-back-unit'.  If the
5333 : user has specified that a 64-bit perl is to be built,
5334 : we may need to set or change some other defaults.
5335         if $test -f use64bitint.cbu; then
5336                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5337                 . ./use64bitint.cbu
5338         fi
5339         case "$longsize" in
5340         4) case "$archname64" in
5341            '') archname64=64int ;;
5342            esac
5343            ;;
5344         esac
5345         ;;
5346 esac
5347
5348 case "$use64bitall" in
5349 "$define"|true|[yY]*)
5350 : Look for a hint-file generated 'call-back-unit'.  If the
5351 : user has specified that a maximally 64-bit perl is to be built,
5352 : we may need to set or change some other defaults.
5353         if $test -f use64bitall.cbu; then
5354                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5355                 . ./use64bitall.cbu
5356         fi
5357         case "$longsize" in
5358         4) case "$archname64" in
5359            ''|64int) archname64=64all ;;
5360            esac
5361            ;;
5362         esac
5363         ;;
5364 esac
5365
5366 echo " "
5367 echo "Checking for GNU C Library..." >&4
5368 cat >try.c <<'EOCP'
5369 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5370    alone are insufficient to distinguish different versions, such as
5371    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5372    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5373 */
5374 #include <stdio.h>
5375 int main(void)
5376 {
5377 #ifdef __GLIBC__
5378 #   ifdef __GLIBC_MINOR__
5379 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5380 #           include <gnu/libc-version.h>
5381             printf("%s\n",  gnu_get_libc_version());
5382 #       else
5383             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5384 #       endif
5385 #   else
5386         printf("%d\n",  __GLIBC__);
5387 #   endif
5388     return 0;
5389 #else
5390     return 1;
5391 #endif
5392 }
5393 EOCP
5394 set try
5395 if eval $compile_ok && $run ./try > glibc.ver; then
5396         val="$define"
5397         gnulibc_version=`$cat glibc.ver`
5398         echo "You are using the GNU C Library version $gnulibc_version"
5399 else
5400         val="$undef"
5401         gnulibc_version=''
5402         echo "You are not using the GNU C Library"
5403 fi
5404 $rm -f try try.* glibc.ver
5405 set d_gnulibc
5406 eval $setvar
5407
5408 : see if nm is to be used to determine whether a symbol is defined or not
5409 case "$usenm" in
5410 '')
5411         dflt=''
5412         case "$d_gnulibc" in
5413         "$define")
5414                 echo " "
5415                 echo "nm probably won't work on the GNU C Library." >&4
5416                 dflt=n
5417                 ;;
5418         esac
5419         case "$dflt" in
5420         '') 
5421                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5422                         echo " "
5423                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5424                         echo "'nm' won't be sufficient on this sytem." >&4
5425                         dflt=n
5426                 fi
5427                 ;;
5428         esac
5429         case "$dflt" in
5430         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5431                 if $test $dflt -gt 20; then
5432                         dflt=y
5433                 else
5434                         dflt=n
5435                 fi
5436                 ;;
5437         esac
5438         ;;
5439 *)
5440         case "$usenm" in
5441         true|$define) dflt=y;;
5442         *) dflt=n;;
5443         esac
5444         ;;
5445 esac
5446 $cat <<EOM
5447
5448 I can use $nm to extract the symbols from your C libraries. This
5449 is a time consuming task which may generate huge output on the disk (up
5450 to 3 megabytes) but that should make the symbols extraction faster. The
5451 alternative is to skip the 'nm' extraction part and to compile a small
5452 test program instead to determine whether each symbol is present. If
5453 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5454 this may be the best solution.
5455
5456 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5457
5458 EOM
5459 rp="Shall I use $nm to extract C symbols from the libraries?"
5460 . ./myread
5461 case "$ans" in
5462 [Nn]*) usenm=false;;
5463 *) usenm=true;;
5464 esac
5465
5466 runnm=$usenm
5467 case "$reuseval" in
5468 true) runnm=false;;
5469 esac
5470
5471 : nm options which may be necessary
5472 case "$nm_opt" in
5473 '') if $test -f /mach_boot; then
5474                 nm_opt=''       # Mach
5475         elif $test -d /usr/ccs/lib; then
5476                 nm_opt='-p'     # Solaris (and SunOS?)
5477         elif $test -f /dgux; then
5478                 nm_opt='-p'     # DG-UX
5479         elif $test -f /lib64/rld; then
5480                 nm_opt='-p'     # 64-bit Irix
5481         else
5482                 nm_opt=''
5483         fi;;
5484 esac
5485
5486 : nm options which may be necessary for shared libraries but illegal
5487 : for archive libraries.  Thank you, Linux.
5488 case "$nm_so_opt" in
5489 '')     case "$myuname" in
5490         *linux*)
5491                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5492                         nm_so_opt='--dynamic'
5493                 fi
5494                 ;;
5495         esac
5496         ;;
5497 esac
5498
5499 case "$runnm" in
5500 true)
5501 : get list of predefined functions in a handy place
5502 echo " "
5503 case "$libc" in
5504 '') libc=unknown
5505         case "$libs" in
5506         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5507         esac
5508         ;;
5509 esac
5510 case "$libs" in
5511 '') ;;
5512 *)  for thislib in $libs; do
5513         case "$thislib" in
5514         -lc|-lc_s)
5515                 : Handle C library specially below.
5516                 ;;
5517         -l*)
5518                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5519                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5520                         :
5521                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5522                         :
5523                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5524                         :
5525                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5526                         :
5527                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5528                         :
5529                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5530                         :
5531                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5532                         :
5533                 else
5534                         try=''
5535                 fi
5536                 libnames="$libnames $try"
5537                 ;;
5538         *) libnames="$libnames $thislib" ;;
5539         esac
5540         done
5541         ;;
5542 esac
5543 xxx=normal
5544 case "$libc" in
5545 unknown)
5546         set /lib/libc.$so
5547         for xxx in $libpth; do
5548                 $test -r $1 || set $xxx/libc.$so
5549                 : The messy sed command sorts on library version numbers.
5550                 $test -r $1 || \
5551                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5552                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5553                                 h
5554                                 s/[0-9][0-9]*/0000&/g
5555                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5556                                 G
5557                                 s/\n/ /' | \
5558                          $sort | $sed -e 's/^.* //'`
5559                 eval set \$$#
5560         done
5561         $test -r $1 || set /usr/ccs/lib/libc.$so
5562         $test -r $1 || set /lib/libsys_s$_a
5563         ;;
5564 *)
5565         set blurfl
5566         ;;
5567 esac
5568 if $test -r "$1"; then
5569         echo "Your (shared) C library seems to be in $1."
5570         libc="$1"
5571 elif $test -r /lib/libc && $test -r /lib/clib; then
5572         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5573         xxx=apollo
5574         libc='/lib/clib /lib/libc'
5575         if $test -r /lib/syslib; then
5576                 echo "(Your math library is in /lib/syslib.)"
5577                 libc="$libc /lib/syslib"
5578         fi
5579 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5580         echo "Your C library seems to be in $libc, as you said before."
5581 elif $test -r $incpath/usr/lib/libc$_a; then
5582         libc=$incpath/usr/lib/libc$_a;
5583         echo "Your C library seems to be in $libc.  That's fine."
5584 elif $test -r /lib/libc$_a; then
5585         libc=/lib/libc$_a;
5586         echo "Your C library seems to be in $libc.  You're normal."
5587 else
5588         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5589                 :
5590         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5591                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5592         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5593                 :
5594         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5595                 :
5596         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5597                 :
5598         else
5599                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5600         fi
5601         if $test -r "$tans"; then
5602                 echo "Your C library seems to be in $tans, of all places."
5603                 libc=$tans
5604         else
5605                 libc='blurfl'
5606         fi
5607 fi
5608 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5609         dflt="$libc"
5610         cat <<EOM
5611
5612 If the guess above is wrong (which it might be if you're using a strange
5613 compiler, or your machine supports multiple models), you can override it here.
5614
5615 EOM
5616 else
5617         dflt=''
5618         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5619         cat >&4 <<EOM
5620 I can't seem to find your C library.  I've looked in the following places:
5621
5622 EOM
5623         $sed 's/^/      /' libpath
5624         cat <<EOM
5625
5626 None of these seems to contain your C library. I need to get its name...
5627
5628 EOM
5629 fi
5630 fn=f
5631 rp='Where is your C library?'
5632 . ./getfile
5633 libc="$ans"
5634
5635 echo " "
5636 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5637 set X `cat libnames`
5638 shift
5639 xxx=files
5640 case $# in 1) xxx=file; esac
5641 echo "Extracting names from the following $xxx for later perusal:" >&4
5642 echo " "
5643 $sed 's/^/      /' libnames >&4
5644 echo " "
5645 $echo $n "This may take a while...$c" >&4
5646
5647 for file in $*; do
5648         case $file in
5649         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5650         *) $nm $nm_opt $file 2>/dev/null;;
5651         esac
5652 done >libc.tmp
5653
5654 $echo $n ".$c"
5655 $grep fprintf libc.tmp > libc.ptf
5656 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5657 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5658 xxx='[ADTSIW]'
5659 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5660         eval $xscan;\
5661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5662                 eval $xrun
5663 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5664         eval $xscan;\
5665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5666                 eval $xrun
5667 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5668         eval $xscan;\
5669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5670                 eval $xrun
5671 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5672         eval $xscan;\
5673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5674                 eval $xrun
5675 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5676         eval $xscan;\
5677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5678                 eval $xrun
5679 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5680         eval $xscan;\
5681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5682                 eval $xrun
5683 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5684                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5685         eval $xscan;\
5686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5687                 eval $xrun
5688 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5689         eval $xscan;\
5690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5691                 eval $xrun
5692 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5693         eval $xscan;\
5694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5695                 eval $xrun
5696 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5697         eval $xscan;\
5698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5699                 eval $xrun
5700 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5701         eval $xscan;\
5702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5703                 eval $xrun
5704 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5705         eval $xscan;\
5706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5707                 eval $xrun
5708 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5709         eval $xscan;\
5710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5711                 eval $xrun
5712 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5713         eval $xscan;\
5714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715                 eval $xrun
5716 else
5717         $nm -p $* 2>/dev/null >libc.tmp
5718         $grep fprintf libc.tmp > libc.ptf
5719         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5720                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5721         then
5722                 nm_opt='-p'
5723                 eval $xrun
5724         else
5725                 echo " "
5726                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5727                 com=''
5728                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5729                         for thisname in $libnames $libc; do
5730                                 $ar t $thisname >>libc.tmp
5731                         done
5732                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5733                         echo "Ok." >&4
5734                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5735                         # Repeat libc to extract forwarders to DLL entries too
5736                         for thisname in $libnames $libc; do
5737                                 $ar tv $thisname >>libc.tmp
5738                                 # Revision 50 of EMX has bug in $ar.
5739                                 # it will not extract forwarders to DLL entries
5740                                 # Use emximp which will extract exactly them.
5741                                 emximp -o tmp.imp $thisname \
5742                                     2>/dev/null && \
5743                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5744                                     < tmp.imp >>libc.tmp
5745                                 $rm tmp.imp
5746                         done
5747                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5748                         echo "Ok." >&4
5749                 else
5750                         echo "$ar didn't seem to work right." >&4
5751                         echo "Maybe this is a Cray...trying bld instead..." >&4
5752                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5753                         then
5754                                 for thisname in $libnames; do
5755                                         bld t $libnames | \
5756                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5757                                         $ar t $thisname >>libc.tmp
5758                                 done
5759                                 echo "Ok." >&4
5760                         else
5761                                 echo "That didn't work either.  Giving up." >&4
5762                                 exit 1
5763                         fi
5764                 fi
5765         fi
5766 fi
5767 nm_extract="$com"
5768 if $test -f /lib/syscalls.exp; then
5769         echo " "
5770         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5771         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5772 fi
5773 ;;
5774 esac
5775 $rm -f libnames libpath
5776
5777 : is a C symbol defined?
5778 csym='tlook=$1;
5779 case "$3" in
5780 -v) tf=libc.tmp; tc=""; tdc="";;
5781 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5782 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5783 esac;
5784 tx=yes;
5785 case "$reuseval-$4" in
5786 true-) ;;
5787 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5788 esac;
5789 case "$tx" in
5790 yes)
5791         case "$runnm" in
5792         true)
5793                 if $contains $tlook $tf >/dev/null 2>&1;
5794                 then tval=true;
5795                 else tval=false;
5796                 fi;;
5797         *)
5798                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5799                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5800                 then tval=true;
5801                 else tval=false;
5802                 fi;
5803                 $rm -f t t.c;;
5804         esac;;
5805 *)
5806         case "$tval" in
5807         $define) tval=true;;
5808         *) tval=false;;
5809         esac;;
5810 esac;
5811 eval "$2=$tval"'
5812
5813 : define an is-in-libc? function
5814 inlibc='echo " "; td=$define; tu=$undef;
5815 sym=$1; var=$2; eval "was=\$$2";
5816 tx=yes;
5817 case "$reuseval$was" in
5818 true) ;;
5819 true*) tx=no;;
5820 esac;
5821 case "$tx" in
5822 yes)
5823         set $sym tres -f;
5824         eval $csym;
5825         case "$tres" in
5826         true)
5827                 echo "$sym() found." >&4;
5828                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5829         *)
5830                 echo "$sym() NOT found." >&4;
5831                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5832         esac;;
5833 *)
5834         case "$was" in
5835         $define) echo "$sym() found." >&4;;
5836         *) echo "$sym() NOT found." >&4;;
5837         esac;;
5838 esac'
5839
5840 : see if sqrtl exists
5841 set sqrtl d_sqrtl
5842 eval $inlibc
5843
5844 : check for length of double
5845 echo " "
5846 case "$doublesize" in
5847 '')
5848         echo "Checking to see how big your double precision numbers are..." >&4
5849         $cat >try.c <<'EOCP'
5850 #include <stdio.h>
5851 int main()
5852 {
5853     printf("%d\n", (int)sizeof(double));
5854     exit(0);
5855 }
5856 EOCP
5857         set try
5858         if eval $compile_ok; then
5859                 doublesize=`$run ./try`
5860                 echo "Your double is $doublesize bytes long."
5861         else
5862                 dflt='8'
5863                 echo "(I can't seem to compile the test program.  Guessing...)"
5864                 rp="What is the size of a double precision number (in bytes)?"
5865                 . ./myread
5866                 doublesize="$ans"
5867         fi
5868         ;;
5869 esac
5870 $rm -f try.c try
5871
5872 : check for long doubles
5873 echo " "
5874 echo "Checking to see if you have long double..." >&4
5875 echo 'int main() { long double x = 7.0; }' > try.c
5876 set try
5877 if eval $compile; then
5878         val="$define"
5879         echo "You have long double."
5880 else
5881         val="$undef"
5882         echo "You do not have long double."
5883 fi
5884 $rm try.*
5885 set d_longdbl
5886 eval $setvar
5887
5888 : check for length of long double
5889 case "${d_longdbl}${longdblsize}" in
5890 $define)
5891         echo " "
5892         echo "Checking to see how big your long doubles are..." >&4
5893         $cat >try.c <<'EOCP'
5894 #include <stdio.h>
5895 int main()
5896 {
5897         printf("%d\n", sizeof(long double));
5898 }
5899 EOCP
5900         set try
5901         set try
5902         if eval $compile; then
5903                 longdblsize=`$run ./try`
5904                 echo "Your long doubles are $longdblsize bytes long."
5905         else
5906                 dflt='8'
5907                 echo " "
5908                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5909                 rp="What is the size of a long double (in bytes)?"
5910                 . ./myread
5911                 longdblsize="$ans"
5912         fi
5913         if $test "X$doublesize" = "X$longdblsize"; then
5914                 echo "(That isn't any different from an ordinary double.)"
5915         fi      
5916         ;;
5917 esac
5918 $rm -f try.* try
5919
5920 echo " "
5921
5922 if $test X"$d_longdbl" = X"$define"; then
5923
5924 echo "Checking how to print long doubles..." >&4
5925
5926 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5927         $cat >try.c <<'EOCP'
5928 #include <sys/types.h>
5929 #include <stdio.h>
5930 int main() {
5931   double d = 123.456;
5932   printf("%.3f\n", d);
5933 }
5934 EOCP
5935         set try
5936         if eval $compile; then
5937                 yyy=`$run ./try`
5938                 case "$yyy" in
5939                 123.456)
5940                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5941                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5942                         echo "We will use %f."
5943                         ;;
5944                 esac
5945         fi
5946 fi
5947
5948 if $test X"$sPRIfldbl" = X; then
5949         $cat >try.c <<'EOCP'
5950 #include <sys/types.h>
5951 #include <stdio.h>
5952 int main() {
5953   long double d = 123.456;
5954   printf("%.3Lf\n", d);
5955 }
5956 EOCP
5957         set try
5958         if eval $compile; then
5959                 yyy=`$run ./try`
5960                 case "$yyy" in
5961                 123.456)
5962                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5963                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5964                         echo "We will use %Lf."
5965                         ;;
5966                 esac
5967         fi
5968 fi
5969
5970 if $test X"$sPRIfldbl" = X; then
5971         $cat >try.c <<'EOCP'
5972 #include <sys/types.h>
5973 #include <stdio.h>
5974 int main() {
5975   long double d = 123.456;
5976   printf("%.3llf\n", d);
5977 }
5978 EOCP
5979         set try
5980         if eval $compile; then
5981                 yyy=`$run ./try`
5982                 case "$yyy" in
5983                 123.456)
5984                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5985                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5986                         echo "We will use %llf."
5987                         ;;
5988                 esac
5989         fi
5990 fi
5991
5992 if $test X"$sPRIfldbl" = X; then
5993         $cat >try.c <<'EOCP'
5994 #include <sys/types.h>
5995 #include <stdio.h>
5996 int main() {
5997   long double d = 123.456;
5998   printf("%.3lf\n", d);
5999 }
6000 EOCP
6001         set try
6002         if eval $compile; then
6003                 yyy=`$run ./try`
6004                 case "$yyy" in
6005                 123.456)
6006                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6007                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6008                         echo "We will use %lf."
6009                         ;;
6010                 esac
6011         fi
6012 fi
6013
6014 if $test X"$sPRIfldbl" = X; then
6015         echo "Cannot figure out how to print long doubles." >&4
6016 else
6017         sSCNfldbl=$sPRIfldbl    # expect consistency
6018 fi
6019
6020 $rm -f try try.*
6021
6022 fi # d_longdbl
6023
6024 case "$sPRIfldbl" in
6025 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6026         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6027         d_SCNfldbl="$undef";
6028         ;;
6029 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6030         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6031         d_SCNfldbl="$define";
6032         ;;
6033 esac
6034
6035 : see if modfl exists
6036 set modfl d_modfl
6037 eval $inlibc
6038
6039
6040 hasproto='varname=$1; func=$2; shift; shift;
6041 while $test $# -ge 2; do
6042         case "$1" in
6043         $define) echo "#include <$2>";;
6044         esac ;
6045     shift 2;
6046 done > try.c;
6047 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
6048 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
6049         echo "$func() prototype found.";
6050         val="$define";
6051 else
6052         echo "$func() prototype NOT found.";
6053         val="$undef";
6054 fi;
6055 set $varname;
6056 eval $setvar;
6057 $rm -f try.c tryout.c'
6058
6059 : see if prototype for modfl is available
6060 echo " "
6061 set d_modflproto modfl math.h
6062 eval $hasproto
6063
6064 d_modfl_pow32_bug="$undef"
6065
6066 case "$d_longdbl$d_modfl" in
6067 $define$define)
6068         $cat <<EOM
6069 Checking to see whether your modfl() is okay for large values...
6070 EOM
6071 $cat >try.c <<EOCP
6072 #include <math.h> 
6073 #include <stdio.h>
6074 EOCP
6075 if $test "X$d_modflproto" != "X$define"; then
6076         $cat >>try.c <<EOCP
6077 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6078 long double modfl (long double, long double *);
6079 EOCP
6080 fi
6081 $cat >>try.c <<EOCP
6082 int main() {
6083     long double nv = 4294967303.15;
6084     long double v, w;
6085     v = modfl(nv, &w);         
6086 #ifdef __GLIBC__
6087     printf("glibc");
6088 #endif
6089     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6090     return 0;
6091 }
6092 EOCP
6093         case "$osname:$gccversion" in
6094         aix:)   saveccflags="$ccflags"
6095                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6096         esac
6097         set try
6098         if eval $compile; then
6099                 foo=`$run ./try`
6100                 case "$foo" in
6101                 *" 4294967303.150000 1.150000 4294967302.000000")
6102                         echo >&4 "Your modfl() is broken for large values."
6103                         d_modfl_pow32_bug="$define"
6104                         case "$foo" in
6105                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6106                         ;;
6107                         esac
6108                         ;;
6109                 *" 4294967303.150000 0.150000 4294967303.000000")
6110                         echo >&4 "Your modfl() seems okay for large values."
6111                         ;;
6112                 *)      echo >&4 "I don't understand your modfl() at all."
6113                         d_modfl="$undef"
6114                         ;;
6115                 esac
6116                 $rm -f try.* try core core.try.*
6117         else
6118                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6119                 d_modfl="$undef"
6120         fi
6121         case "$osname:$gccversion" in
6122         aix:)   ccflags="$saveccflags" ;; # restore
6123         esac
6124         ;;
6125 esac
6126
6127 case "$ccflags" in
6128 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6129 esac
6130
6131 case "$uselongdouble" in
6132 $define|true|[yY]*)     dflt='y';;
6133 *) dflt='n';;
6134 esac
6135 cat <<EOM
6136
6137 Perl can be built to take advantage of long doubles which
6138 (if available) may give more accuracy and range for floating point numbers.
6139
6140 If this doesn't make any sense to you, just accept the default '$dflt'.
6141 EOM
6142 rp='Try to use long doubles if available?'
6143 . ./myread
6144 case "$ans" in
6145 y|Y)    val="$define"   ;;
6146 *)      val="$undef"    ;;
6147 esac
6148 set uselongdouble
6149 eval $setvar
6150
6151 case "$uselongdouble" in
6152 true|[yY]*) uselongdouble="$define" ;;
6153 esac
6154
6155 case "$uselongdouble" in
6156 $define)
6157 : Look for a hint-file generated 'call-back-unit'.  If the
6158 : user has specified that long doubles should be used,
6159 : we may need to set or change some other defaults.
6160         if $test -f uselongdouble.cbu; then
6161                 echo "Your platform has some specific hints for long doubles, using them..."
6162                 . ./uselongdouble.cbu
6163         else
6164                 $cat <<EOM
6165 (Your platform doesn't have any specific hints for long doubles.)
6166 EOM
6167         fi
6168         ;;
6169 esac
6170
6171 message=X
6172 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6173 $define:$define:$define)
6174         : You have both
6175         ;;
6176 $define:$define:$undef)
6177         message="I could not find modfl"
6178         ;;
6179 $define:$undef:$define)
6180         message="I could not find sqrtl"
6181         ;;
6182 $define:$undef:$undef)
6183         message="I found neither sqrtl nor modfl"
6184         ;;
6185 esac
6186
6187 if $test "$message" != X; then
6188         $cat <<EOM >&4
6189
6190 *** You requested the use of long doubles but you do not seem to have
6191 *** the mathematic functions for long doubles.
6192 *** ($message)
6193 *** I'm disabling the use of long doubles.
6194
6195 EOM
6196
6197         uselongdouble=$undef
6198 fi
6199
6200 : determine the architecture name
6201 echo " "
6202 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6203         tarch=`arch`"-$osname"
6204 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6205         if uname -m > tmparch 2>&1 ; then
6206                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6207                         -e 's/$/'"-$osname/" tmparch`
6208         else
6209                 tarch="$osname"
6210         fi
6211         $rm -f tmparch
6212 else
6213         tarch="$osname"
6214 fi
6215 case "$myarchname" in
6216 ''|"$tarch") ;;
6217 *)
6218         echo "(Your architecture name used to be $myarchname.)"
6219         archname=''
6220         ;;
6221 esac
6222 case "$targetarch" in
6223 '') ;;
6224 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6225 esac
6226 myarchname="$tarch"
6227 case "$archname" in
6228 '') dflt="$tarch";;
6229 *) dflt="$archname";;
6230 esac
6231 rp='What is your architecture name'
6232 . ./myread
6233 archname="$ans"
6234 case "$usethreads" in
6235 $define)
6236         echo "Threads selected." >&4
6237         case "$archname" in
6238         *-thread*) echo "...and architecture name already has -thread." >&4
6239                 ;;
6240         *)      archname="$archname-thread"
6241                 echo "...setting architecture name to $archname." >&4
6242                 ;;
6243         esac
6244         ;;
6245 esac
6246 case "$usemultiplicity" in
6247 $define)
6248         echo "Multiplicity selected." >&4
6249         case "$archname" in
6250         *-multi*) echo "...and architecture name already has -multi." >&4
6251                 ;;
6252         *)      archname="$archname-multi"
6253                 echo "...setting architecture name to $archname." >&4
6254                 ;;
6255         esac
6256         ;;
6257 esac
6258 case "$use64bitint$use64bitall" in
6259 *"$define"*)
6260         case "$archname64" in
6261         '')
6262                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6263                 ;;
6264         *)
6265                 case "$use64bitint" in
6266                 "$define") echo "64 bit integers selected." >&4 ;;
6267                 esac
6268                 case "$use64bitall" in
6269                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6270                 esac
6271                 case "$archname" in
6272                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6273                         ;;
6274                 *)      archname="$archname-$archname64"
6275                         echo "...setting architecture name to $archname." >&4
6276                         ;;
6277                 esac
6278                 ;;
6279         esac
6280 esac
6281 case "$uselongdouble" in
6282 $define)
6283         echo "Long doubles selected." >&4
6284         case "$longdblsize" in
6285         $doublesize)
6286                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6287                 ;;
6288         *)
6289                 case "$archname" in
6290                 *-ld*) echo "...and architecture name already has -ld." >&4
6291                         ;;
6292                 *)      archname="$archname-ld"
6293                         echo "...setting architecture name to $archname." >&4
6294                         ;;
6295                 esac
6296                 ;;
6297         esac
6298         ;;
6299 esac
6300 case "$useperlio" in
6301 $define)
6302         echo "Perlio selected." >&4
6303         ;;
6304 *)
6305         echo "Perlio not selected, using stdio." >&4
6306         case "$archname" in
6307         *-stdio*) echo "...and architecture name already has -stdio." >&4
6308                 ;;
6309         *)      archname="$archname-stdio"
6310                 echo "...setting architecture name to $archname." >&4
6311                 ;;
6312         esac
6313         ;;
6314 esac
6315
6316 : determine root of directory hierarchy where package will be installed.
6317 case "$prefix" in
6318 '')
6319         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6320         ;;
6321 *)
6322         dflt="$prefix"
6323         ;;
6324 esac
6325 $cat <<EOM
6326
6327 By default, $package will be installed in $dflt/bin, manual pages
6328 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6329 installation directories. Typically this is something like /usr/local.
6330 If you wish to have binaries under /usr/bin but other parts of the
6331 installation under /usr/local, that's ok: you will be prompted
6332 separately for each of the installation directories, the prefix being
6333 only used to set the defaults.
6334
6335 EOM
6336 fn=d~
6337 rp='Installation prefix to use?'
6338 . ./getfile
6339 oldprefix=''
6340 case "$prefix" in
6341 '') ;;
6342 *)
6343         case "$ans" in
6344         "$prefix") ;;
6345         *) oldprefix="$prefix";;
6346         esac
6347         ;;
6348 esac
6349 prefix="$ans"
6350 prefixexp="$ansexp"
6351
6352 case "$afsroot" in
6353 '')     afsroot=/afs ;;
6354 *)      afsroot=$afsroot ;;
6355 esac
6356
6357 : is AFS running?
6358 echo " "
6359 case "$afs" in
6360 $define|true)   afs=true ;;
6361 $undef|false)   afs=false ;;
6362 *)      if test -d $afsroot; then
6363                 afs=true
6364         else
6365                 afs=false
6366         fi
6367         ;;
6368 esac
6369 if $afs; then
6370         echo "AFS may be running... I'll be extra cautious then..." >&4
6371 else
6372         echo "AFS does not seem to be running..." >&4
6373 fi
6374
6375 : determine installation prefix for where package is to be installed.
6376 if $afs; then 
6377 $cat <<EOM
6378
6379 Since you are running AFS, I need to distinguish the directory in which
6380 files will reside from the directory in which they are installed (and from
6381 which they are presumably copied to the former directory by occult means).
6382
6383 EOM
6384         case "$installprefix" in
6385         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6386         *) dflt="$installprefix";;
6387         esac
6388 else
6389 $cat <<EOM
6390
6391 In some special cases, particularly when building $package for distribution,
6392 it is convenient to distinguish between the directory in which files should 
6393 be installed from the directory ($prefix) in which they 
6394 will eventually reside.  For most users, these two directories are the same.
6395
6396 EOM
6397         case "$installprefix" in
6398         '') dflt=$prefix ;;
6399         *) dflt=$installprefix;;
6400         esac
6401 fi
6402 fn=d~
6403 rp='What installation prefix should I use for installing files?'
6404 . ./getfile
6405 installprefix="$ans"
6406 installprefixexp="$ansexp"
6407
6408 : set the prefixit variable, to compute a suitable default value
6409 prefixit='case "$3" in
6410 ""|none)
6411         case "$oldprefix" in
6412         "") eval "$1=\"\$$2\"";;
6413         *)
6414                 case "$3" in
6415                 "") eval "$1=";;
6416                 none)
6417                         eval "tp=\"\$$2\"";
6418                         case "$tp" in
6419                         ""|" ") eval "$1=\"\$$2\"";;
6420                         *) eval "$1=";;
6421                         esac;;
6422                 esac;;
6423         esac;;
6424 *)
6425         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6426         case "$tp" in
6427         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6428         /*-$oldprefix/*|\~*-$oldprefix/*)
6429                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6430         *) eval "$1=\"\$$2\"";;
6431         esac;;
6432 esac'
6433
6434 : get the patchlevel
6435 echo " "
6436 echo "Getting the current patchlevel..." >&4
6437 if $test -r $rsrc/patchlevel.h;then
6438         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6439         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6440         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6441         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6442         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6443         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6444        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6445 else
6446         revision=0
6447         patchlevel=0
6448         subversion=0
6449         api_revision=0
6450         api_version=0
6451         api_subversion=0
6452         perl_patchlevel=0
6453         $echo "(You do not have patchlevel.h.  Eek.)"
6454 fi
6455 if $test -r $rsrc/.patch ; then  
6456         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6457                 perl_patchlevel=`cat $rsrc/.patch`
6458         fi
6459 fi
6460 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6461 version_patchlevel_string="version $patchlevel subversion $subversion"
6462 case "$perl_patchlevel" in
6463 0|'') ;;
6464 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6465 esac
6466
6467 $echo "(You have $package $version_patchlevel_string.)"
6468
6469 case "$osname" in
6470 dos|vms)
6471         : XXX Should be a Configure test for double-dots in filenames.
6472         version=`echo $revision $patchlevel $subversion | \
6473                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6474         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6475                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6476         ;;
6477 *)
6478         version=`echo $revision $patchlevel $subversion | \
6479                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6480         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6481                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6482         ;;
6483 esac
6484 : Special case the 5.005_xx maintenance series, which used 5.005
6485 : without any subversion label as a subdirectory in $sitelib
6486 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6487         api_versionstring='5.005'
6488 fi
6489
6490 : determine installation style
6491 : For now, try to deduce it from prefix unless it is already set.
6492 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6493 case "$installstyle" in
6494 '')     case "$prefix" in
6495                 *perl*) dflt='lib';;
6496                 *) dflt='lib/perl5' ;;
6497         esac
6498         ;;
6499 *)      dflt="$installstyle" ;;
6500 esac
6501 : Probably not worth prompting for this since we prompt for all
6502 : the directories individually, and the prompt would be too long and
6503 : confusing anyway.
6504 installstyle=$dflt
6505
6506 : determine where private library files go
6507 : Usual default is /usr/local/lib/perl5/$version.
6508 : Also allow things like /opt/perl/lib/$version, since 
6509 : /opt/perl/lib/perl5... would be redundant.
6510 : The default "style" setting is made in installstyle.U
6511 case "$installstyle" in
6512 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6513 *)       set dflt privlib lib/$version ;;
6514 esac
6515 eval $prefixit
6516 $cat <<EOM
6517
6518 There are some auxiliary files for $package that need to be put into a
6519 private library directory that is accessible by everyone.
6520
6521 EOM
6522 fn=d~+
6523 rp='Pathname where the private library files will reside?'
6524 . ./getfile
6525 privlib="$ans"
6526 privlibexp="$ansexp"
6527 : Change installation prefix, if necessary.
6528 if $test X"$prefix" != X"$installprefix"; then
6529         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6530 else
6531         installprivlib="$privlibexp"
6532 fi
6533
6534 : set the prefixup variable, to restore leading tilda escape
6535 prefixup='case "$prefixexp" in
6536 "$prefix") ;;
6537 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6538 esac'
6539
6540 : determine where public architecture dependent libraries go
6541 set archlib archlib
6542 eval $prefixit
6543 : privlib default is /usr/local/lib/$package/$version
6544 : archlib default is /usr/local/lib/$package/$version/$archname
6545 : privlib may have an optional trailing /share.
6546 tdflt=`echo $privlib | $sed 's,/share$,,'`
6547 tdflt=$tdflt/$archname
6548 case "$archlib" in
6549 '')     dflt=$tdflt
6550         ;;
6551 *)      dflt="$archlib"
6552     ;;
6553 esac
6554 $cat <<EOM
6555
6556 $spackage contains architecture-dependent library files.  If you are
6557 sharing libraries in a heterogeneous environment, you might store
6558 these files in a separate location.  Otherwise, you can just include
6559 them with the rest of the public library files.
6560
6561 EOM
6562 fn=d+~
6563 rp='Where do you want to put the public architecture-dependent libraries?'
6564 . ./getfile
6565 archlib="$ans"
6566 archlibexp="$ansexp"
6567 if $test X"$archlib" = X"$privlib"; then
6568         d_archlib="$undef"
6569 else
6570         d_archlib="$define"
6571 fi
6572 : Change installation prefix, if necessary.
6573 if $test X"$prefix" != X"$installprefix"; then
6574         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6575 else
6576         installarchlib="$archlibexp"
6577 fi
6578
6579 : see if setuid scripts can be secure
6580 $cat <<EOM
6581
6582 Some kernels have a bug that prevents setuid #! scripts from being
6583 secure.  Some sites have disabled setuid #! scripts because of this.
6584
6585 First let's decide if your kernel supports secure setuid #! scripts.
6586 (If setuid #! scripts would be secure but have been disabled anyway,
6587 don't say that they are secure if asked.)
6588
6589 EOM
6590
6591 val="$undef"
6592 if $test -d /dev/fd; then
6593         echo "#!$ls" >reflect
6594         chmod +x,u+s reflect
6595         ./reflect >flect 2>&1
6596         if $contains "/dev/fd" flect >/dev/null; then
6597                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6598                 val="$define"
6599         else
6600                 $cat <<EOM
6601 If you are not sure if they are secure, I can check but I'll need a
6602 username and password different from the one you are using right now.
6603 If you don't have such a username or don't want me to test, simply
6604 enter 'none'.
6605
6606 EOM
6607                 rp='Other username to test security of setuid scripts with?'
6608                 dflt='none'
6609                 . ./myread
6610                 case "$ans" in
6611                 n|none)
6612                         case "$d_suidsafe" in
6613                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6614                                 dflt=n;;
6615                         "$undef")
6616                                 echo "Well, the $hint value is *not* secure." >&4
6617                                 dflt=n;;
6618                         *)      echo "Well, the $hint value *is* secure." >&4
6619                                 dflt=y;;
6620                         esac
6621                         ;;
6622                 *)
6623                         $rm -f reflect flect
6624                         echo "#!$ls" >reflect
6625                         chmod +x,u+s reflect
6626                         echo >flect
6627                         chmod a+w flect
6628                         echo '"su" will (probably) prompt you for '"$ans's password."
6629                         su $ans -c './reflect >flect'
6630                         if $contains "/dev/fd" flect >/dev/null; then
6631                                 echo "Okay, it looks like setuid scripts are secure." >&4
6632                                 dflt=y
6633                         else
6634                                 echo "I don't think setuid scripts are secure." >&4
6635                                 dflt=n
6636                         fi
6637                         ;;
6638                 esac
6639                 rp='Does your kernel have *secure* setuid scripts?'
6640                 . ./myread
6641                 case "$ans" in
6642                 [yY]*)  val="$define";;
6643                 *)      val="$undef";;
6644                 esac
6645         fi
6646 else
6647         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6648         echo "(That's for file descriptors, not floppy disks.)"
6649         val="$undef"
6650 fi
6651 set d_suidsafe
6652 eval $setvar
6653
6654 $rm -f reflect flect
6655
6656 : now see if they want to do setuid emulation
6657 echo " "
6658 val="$undef"
6659 case "$d_suidsafe" in
6660 "$define")
6661         val="$undef"
6662         echo "No need to emulate SUID scripts since they are secure here." >&4
6663         ;;
6664 *)
6665         $cat <<EOM
6666 Some systems have disabled setuid scripts, especially systems where
6667 setuid scripts cannot be secure.  On systems where setuid scripts have
6668 been disabled, the setuid/setgid bits on scripts are currently
6669 useless.  It is possible for $package to detect those bits and emulate
6670 setuid/setgid in a secure fashion.  This emulation will only work if
6671 setuid scripts have been disabled in your kernel.
6672
6673 EOM
6674         case "$d_dosuid" in
6675         "$define") dflt=y ;;
6676         *) dflt=n ;;
6677         esac
6678         rp="Do you want to do setuid/setgid emulation?"
6679         . ./myread
6680         case "$ans" in
6681         [yY]*)  val="$define";;
6682         *)      val="$undef";;
6683         esac
6684         ;;
6685 esac
6686 set d_dosuid
6687 eval $setvar
6688
6689 : see if this is a malloc.h system
6690 set malloc.h i_malloc
6691 eval $inhdr
6692
6693 : see if stdlib is available
6694 set stdlib.h i_stdlib
6695 eval $inhdr
6696
6697 : check for void type
6698 echo " "
6699 echo "Checking to see how well your C compiler groks the void type..." >&4
6700 case "$voidflags" in
6701 '')
6702         $cat >try.c <<'EOCP'
6703 #if TRY & 1
6704 void sub() {
6705 #else
6706 sub() {
6707 #endif
6708         extern void moo();      /* function returning void */
6709         void (*goo)();          /* ptr to func returning void */
6710 #if TRY & 8
6711         void *hue;              /* generic ptr */
6712 #endif
6713 #if TRY & 2
6714         void (*foo[10])();
6715 #endif
6716
6717 #if TRY & 4
6718         if(goo == moo) {
6719                 exit(0);
6720         }
6721 #endif
6722         exit(0);
6723 }
6724 int main() { sub(); }
6725 EOCP
6726         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6727                 voidflags=$defvoidused
6728         echo "Good.  It appears to support void to the level $package wants.">&4
6729                 if $contains warning .out >/dev/null 2>&1; then
6730                         echo "However, you might get some warnings that look like this:"
6731                         $cat .out
6732                 fi
6733         else
6734 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6735                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6736                         echo "It supports 1..."
6737                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6738                                 echo "It also supports 2..."
6739                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6740                                         voidflags=7
6741                                         echo "And it supports 4 but not 8 definitely."
6742                                 else
6743                                         echo "It doesn't support 4..."
6744                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6745                                                 voidflags=11
6746                                                 echo "But it supports 8."
6747                                         else
6748                                                 voidflags=3
6749                                                 echo "Neither does it support 8."
6750                                         fi
6751                                 fi
6752                         else
6753                                 echo "It does not support 2..."
6754                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6755                                         voidflags=13
6756                                         echo "But it supports 4 and 8."
6757                                 else
6758                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6759                                                 voidflags=5
6760                                                 echo "And it supports 4 but has not heard about 8."
6761                                         else
6762                                                 echo "However it supports 8 but not 4."
6763                                         fi
6764                                 fi
6765                         fi
6766                 else
6767                         echo "There is no support at all for void."
6768                         voidflags=0
6769                 fi
6770         fi
6771 esac
6772 case "$voidflags" in
6773 "$defvoidused") ;;
6774 *)      $cat >&4 <<'EOM'
6775   Support flag bits are:
6776     1: basic void declarations.
6777     2: arrays of pointers to functions returning void.
6778     4: operations between pointers to and addresses of void functions.
6779     8: generic void pointers.
6780 EOM
6781         dflt="$voidflags";
6782         rp="Your void support flags add up to what?"
6783         . ./myread
6784         voidflags="$ans"
6785         ;;
6786 esac
6787 $rm -f try.* .out
6788
6789 : check for length of pointer
6790 echo " "
6791 case "$ptrsize" in
6792 '')
6793         echo "Checking to see how big your pointers are..." >&4
6794         if test "$voidflags" -gt 7; then
6795                 echo '#define VOID_PTR char *' > try.c
6796         else
6797                 echo '#define VOID_PTR void *' > try.c
6798         fi
6799         $cat >>try.c <<'EOCP'
6800 #include <stdio.h>
6801 int main()
6802 {
6803     printf("%d\n", (int)sizeof(VOID_PTR));
6804     exit(0);
6805 }
6806 EOCP
6807         set try
6808         if eval $compile_ok; then
6809                 ptrsize=`$run ./try`
6810                 echo "Your pointers are $ptrsize bytes long."
6811         else
6812                 dflt='4'
6813                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6814                 rp="What is the size of a pointer (in bytes)?"
6815                 . ./myread
6816                 ptrsize="$ans"
6817         fi
6818         ;;
6819 esac
6820 $rm -f try.c try
6821 case "$use64bitall" in
6822 "$define"|true|[yY]*)
6823         case "$ptrsize" in
6824         4)      cat <<EOM >&4
6825
6826 *** You have chosen a maximally 64-bit build, but your pointers
6827 *** are only 4 bytes wide, disabling maximal 64-bitness.
6828
6829 EOM
6830                 use64bitall="$undef"
6831                 case "$use64bitint" in
6832                 "$define"|true|[yY]*) ;;
6833                 *)      cat <<EOM >&4
6834
6835 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6836
6837 EOM
6838                         use64bitint="$define"
6839                         ;;
6840                 esac
6841                 ;;
6842         esac
6843         ;;
6844 esac
6845
6846
6847 : determine which malloc to compile in
6848 echo " "
6849 case "$usemymalloc" in
6850 [yY]*|true|$define)     dflt='y' ;;
6851 [nN]*|false|$undef)     dflt='n' ;;
6852 *)      case "$ptrsize" in
6853         4) dflt='y' ;;
6854         *) dflt='n' ;;
6855         esac
6856         ;;
6857 esac
6858 rp="Do you wish to attempt to use the malloc that comes with $package?"
6859 . ./myread
6860 usemymalloc="$ans"
6861 case "$ans" in
6862 y*|true)
6863         usemymalloc='y'
6864         mallocsrc='malloc.c'
6865         mallocobj="malloc$_o"
6866         d_mymalloc="$define"
6867         case "$libs" in
6868         *-lmalloc*)
6869                 : Remove malloc from list of libraries to use
6870                 echo "Removing unneeded -lmalloc from library list" >&4
6871                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6872                 shift
6873                 libs="$*"
6874                 echo "libs = $libs" >&4
6875                 ;;
6876         esac
6877         ;;
6878 *)
6879         usemymalloc='n'
6880         mallocsrc=''
6881         mallocobj=''
6882         d_mymalloc="$undef"
6883         ;;
6884 esac
6885
6886 : compute the return types of malloc and free
6887 echo " "
6888 $cat >malloc.c <<END
6889 #$i_malloc I_MALLOC
6890 #$i_stdlib I_STDLIB
6891 #include <stdio.h>
6892 #include <sys/types.h>
6893 #ifdef I_MALLOC
6894 #include <malloc.h>
6895 #endif
6896 #ifdef I_STDLIB
6897 #include <stdlib.h>
6898 #endif
6899 #ifdef TRY_MALLOC
6900 void *malloc();
6901 #endif
6902 #ifdef TRY_FREE
6903 void free();
6904 #endif
6905 END
6906 case "$malloctype" in
6907 '')
6908         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6909                 malloctype='void *'
6910         else
6911                 malloctype='char *'
6912         fi
6913         ;;
6914 esac
6915 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6916
6917 case "$freetype" in
6918 '')
6919         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6920                 freetype='void'
6921         else
6922                 freetype='int'
6923         fi
6924         ;;
6925 esac
6926 echo "Your system uses $freetype free(), it would seem." >&4
6927 $rm -f malloc.[co]
6928 $cat <<EOM
6929
6930 After $package is installed, you may wish to install various
6931 add-on modules and utilities.  Typically, these add-ons will
6932 be installed under $prefix with the rest
6933 of this package.  However, you may wish to install such add-ons
6934 elsewhere under a different prefix.
6935
6936 If you do not wish to put everything under a single prefix, that's
6937 ok.  You will be prompted for the individual locations; this siteprefix
6938 is only used to suggest the defaults.
6939
6940 The default should be fine for most people.
6941
6942 EOM
6943 fn=d~+
6944 rp='Installation prefix to use for add-on modules and utilities?'
6945 : XXX Here might be another good place for an installstyle setting.
6946 case "$siteprefix" in
6947 '') dflt=$prefix ;;
6948 *)  dflt=$siteprefix ;;
6949 esac
6950 . ./getfile
6951 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6952 oldsiteprefix=''
6953 case "$siteprefix" in
6954 '') ;;
6955 *)      case "$ans" in
6956         "$prefix") ;;
6957         *) oldsiteprefix="$prefix";;
6958         esac
6959         ;;
6960 esac
6961 siteprefix="$ans"
6962 siteprefixexp="$ansexp"
6963
6964 : determine where site specific libraries go.
6965 : Usual default is /usr/local/lib/perl5/site_perl/$version
6966 : The default "style" setting is made in installstyle.U
6967 : XXX No longer works with Prefixit stuff.
6968 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6969 case "$sitelib" in
6970 '') case "$installstyle" in
6971         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6972         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6973         esac
6974         ;;
6975 *)      dflt="$sitelib"
6976         ;;
6977 esac
6978 $cat <<EOM
6979
6980 The installation process will create a directory for
6981 site-specific extensions and modules.  Most users find it convenient
6982 to place all site-specific files in this directory rather than in the
6983 main distribution directory.
6984
6985 EOM
6986 fn=d~+
6987 rp='Pathname for the site-specific library files?'
6988 . ./getfile
6989 sitelib="$ans"
6990 sitelibexp="$ansexp"
6991 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6992 : Change installation prefix, if necessary.
6993 if $test X"$prefix" != X"$installprefix"; then
6994         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6995 else
6996         installsitelib="$sitelibexp"
6997 fi
6998
6999 : determine where site specific architecture-dependent libraries go.
7000 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7001 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7002 : sitelib may have an optional trailing /share.
7003 case "$sitearch" in
7004 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7005         dflt="$dflt/$archname"
7006         ;;
7007 *)      dflt="$sitearch"
7008         ;;
7009 esac
7010 set sitearch sitearch none
7011 eval $prefixit
7012 $cat <<EOM
7013
7014 The installation process will also create a directory for
7015 architecture-dependent site-specific extensions and modules.
7016
7017 EOM
7018 fn=d~+
7019 rp='Pathname for the site-specific architecture-dependent library files?'
7020 . ./getfile
7021 sitearch="$ans"
7022 sitearchexp="$ansexp"
7023 : Change installation prefix, if necessary.
7024 if $test X"$prefix" != X"$installprefix"; then
7025         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7026 else
7027         installsitearch="$sitearchexp"
7028 fi
7029
7030 $cat <<EOM
7031
7032 The installation process will also create a directory for
7033 vendor-supplied add-ons.  Vendors who supply perl with their system
7034 may find it convenient to place all vendor-supplied files in this
7035 directory rather than in the main distribution directory.  This will
7036 ease upgrades between binary-compatible maintenance versions of perl.
7037
7038 Of course you may also use these directories in whatever way you see
7039 fit.  For example, you might use them to access modules shared over a
7040 company-wide network.
7041
7042 The default answer should be fine for most people.
7043 This causes further questions about vendor add-ons to be skipped
7044 and no vendor-specific directories will be configured for perl.
7045
7046 EOM
7047 rp='Do you want to configure vendor-specific add-on directories?'
7048 case "$usevendorprefix" in
7049 define|true|[yY]*) dflt=y ;;
7050 *)      : User may have set vendorprefix directly on Configure command line.
7051         case "$vendorprefix" in
7052         ''|' ') dflt=n ;;
7053         *)      dflt=y ;;
7054         esac
7055         ;;
7056 esac
7057 . ./myread
7058 case "$ans" in
7059 [yY]*)  fn=d~+
7060         rp='Installation prefix to use for vendor-supplied add-ons?'
7061         case "$vendorprefix" in
7062         '') dflt='' ;;
7063         *)  dflt=$vendorprefix ;;
7064         esac
7065         . ./getfile
7066         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7067         oldvendorprefix=''
7068         case "$vendorprefix" in
7069         '') ;;
7070         *)      case "$ans" in
7071                 "$prefix") ;;
7072                 *) oldvendorprefix="$prefix";;
7073                 esac
7074                 ;;
7075         esac
7076         usevendorprefix="$define"
7077         vendorprefix="$ans"
7078         vendorprefixexp="$ansexp"
7079         ;;
7080 *)      usevendorprefix="$undef"
7081         vendorprefix=''
7082         vendorprefixexp=''
7083         ;;
7084 esac
7085
7086 case "$vendorprefix" in
7087 '')     d_vendorlib="$undef"
7088         vendorlib=''
7089         vendorlibexp=''
7090         ;;
7091 *)      d_vendorlib="$define"
7092         : determine where vendor-supplied modules go.
7093         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7094         case "$vendorlib" in
7095         '')
7096                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7097                 case "$installstyle" in
7098                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7099                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7100                 esac
7101                 ;;
7102         *)      dflt="$vendorlib"
7103                 ;;
7104         esac
7105         fn=d~+
7106         rp='Pathname for the vendor-supplied library files?'
7107         . ./getfile
7108         vendorlib="$ans"
7109         vendorlibexp="$ansexp"
7110         ;;
7111 esac
7112 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7113 : Change installation prefix, if necessary.
7114 if $test X"$prefix" != X"$installprefix"; then
7115         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7116 else
7117         installvendorlib="$vendorlibexp"
7118 fi
7119
7120 case "$vendorprefix" in
7121 '')     d_vendorarch="$undef"
7122         vendorarch=''
7123         vendorarchexp=''
7124         ;;
7125 *)      d_vendorarch="$define"
7126         : determine where vendor-supplied architecture-dependent libraries go.
7127         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7128         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7129         : vendorlib may have an optional trailing /share.
7130         case "$vendorarch" in
7131         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7132                 dflt="$dflt/$archname"
7133                 ;;
7134         *)      dflt="$vendorarch" ;;
7135         esac
7136         fn=d~+
7137         rp='Pathname for vendor-supplied architecture-dependent files?'
7138         . ./getfile
7139         vendorarch="$ans"
7140         vendorarchexp="$ansexp"
7141         ;;
7142 esac
7143 : Change installation prefix, if necessary.
7144 if $test X"$prefix" != X"$installprefix"; then
7145         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7146 else
7147         installvendorarch="$vendorarchexp"
7148 fi
7149
7150 : Final catch-all directories to search
7151 $cat <<EOM
7152
7153 Lastly, you can have perl look in other directories for extensions and
7154 modules in addition to those already specified.
7155 These directories will be searched after 
7156         $sitearch 
7157         $sitelib 
7158 EOM
7159 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7160 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7161 echo ' '
7162 case "$otherlibdirs" in
7163 ''|' ') dflt='none' ;;
7164 *)      dflt="$otherlibdirs" ;;
7165 esac
7166 $cat <<EOM
7167 Enter a colon-separated set of extra paths to include in perl's @INC
7168 search path, or enter 'none' for no extra paths.
7169
7170 EOM
7171
7172 rp='Colon-separated list of additional directories for perl to search?'
7173 . ./myread
7174 case "$ans" in
7175 ' '|''|none)    otherlibdirs=' ' ;;     
7176 *)      otherlibdirs="$ans" ;;
7177 esac
7178 case "$otherlibdirs" in
7179 ' ') val=$undef ;;
7180 *)      val=$define ;;
7181 esac
7182 set d_perl_otherlibdirs
7183 eval $setvar
7184
7185 : Cruising for prototypes
7186 echo " "
7187 echo "Checking out function prototypes..." >&4
7188 $cat >prototype.c <<'EOCP'
7189 int main(int argc, char *argv[]) {
7190         exit(0);}
7191 EOCP
7192 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7193         echo "Your C compiler appears to support function prototypes."
7194         val="$define"
7195 else
7196         echo "Your C compiler doesn't seem to understand function prototypes."
7197         val="$undef"
7198 fi
7199 set prototype
7200 eval $setvar
7201 $rm -f prototype*
7202
7203 case "$prototype" in
7204 "$define") ;;
7205 *)      ansi2knr='ansi2knr'
7206         echo " "
7207         cat <<EOM >&4
7208
7209 $me:  FATAL ERROR:
7210 This version of $package can only be compiled by a compiler that 
7211 understands function prototypes.  Unfortunately, your C compiler 
7212         $cc $ccflags
7213 doesn't seem to understand them.  Sorry about that.
7214
7215 If GNU cc is available for your system, perhaps you could try that instead.  
7216
7217 Eventually, we hope to support building Perl with pre-ANSI compilers.
7218 If you would like to help in that effort, please contact <perlbug@perl.org>.
7219
7220 Aborting Configure now.
7221 EOM
7222         exit 2
7223         ;;
7224 esac
7225
7226 : determine where public executables go
7227 echo " "
7228 set dflt bin bin
7229 eval $prefixit
7230 fn=d~
7231 rp='Pathname where the public executables will reside?'
7232 . ./getfile
7233 if $test "X$ansexp" != "X$binexp"; then
7234         installbin=''
7235 fi
7236 bin="$ans"
7237 binexp="$ansexp"
7238 : Change installation prefix, if necessary.
7239 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7240 if $test X"$prefix" != X"$installprefix"; then
7241         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7242 else
7243         installbin="$binexp"
7244 fi
7245
7246 echo " "
7247 case "$extras" in
7248 '') dflt='n';;
7249 *) dflt='y';;
7250 esac
7251 cat <<EOM
7252 Perl can be built with extra modules or bundles of modules which
7253 will be fetched from the CPAN and installed alongside Perl.
7254
7255 Notice that you will need access to the CPAN; either via the Internet,
7256 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7257 be asked later to configure the CPAN.pm module which will in turn do
7258 the installation of the rest of the extra modules or bundles.)
7259
7260 Notice also that if the modules require any external software such as
7261 libraries and headers (the libz library and the zlib.h header for the
7262 Compress::Zlib module, for example) you MUST have any such software
7263 already installed, this configuration process will NOT install such
7264 things for you.
7265
7266 If this doesn't make any sense to you, just accept the default '$dflt'.
7267 EOM
7268 rp='Install any extra modules (y or n)?'
7269 . ./myread
7270 case "$ans" in
7271 y|Y)
7272         cat <<EOM
7273
7274 Please list any extra modules or bundles to be installed from CPAN,
7275 with spaces between the names.  The names can be in any format the
7276 'install' command of CPAN.pm will understand.  (Answer 'none',
7277 without the quotes, to install no extra modules or bundles.)
7278 EOM
7279         rp='Extras?'
7280         dflt="$extras"
7281         . ./myread
7282         extras="$ans"
7283 esac
7284 case "$extras" in
7285 ''|'none')
7286         val=''
7287         $rm -f ../extras.lst
7288         ;;
7289 *)      echo "(Saving the list of extras for later...)"
7290         echo "$extras" > ../extras.lst
7291         val="'$extras'"
7292         ;;
7293 esac
7294 set extras
7295 eval $setvar
7296 echo " "
7297
7298 : Find perl5.005 or later.
7299 echo "Looking for a previously installed perl5.005 or later... "
7300 case "$perl5" in
7301 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7302                 : Check if this perl is recent and can load a simple module
7303                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7304                         perl5=$tdir/perl
7305                         break;
7306                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7307                         perl5=$tdir/perl5
7308                         break;
7309                 fi
7310         done
7311         ;;
7312 *)      perl5="$perl5"
7313         ;;
7314 esac
7315 case "$perl5" in
7316 '')     echo "None found.  That's ok.";;
7317 *)      echo "Using $perl5." ;;
7318 esac
7319
7320 : Determine list of previous versions to include in @INC
7321 $cat > getverlist <<EOPL
7322 #!$perl5 -w
7323 use File::Basename;
7324 \$api_versionstring = "$api_versionstring";
7325 \$version = "$version";
7326 \$stem = "$sitelib_stem";
7327 \$archname = "$archname";
7328 EOPL
7329         $cat >> getverlist <<'EOPL'
7330 # Can't have leading @ because metaconfig interprets it as a command!
7331 ;@inc_version_list=();
7332 # XXX Redo to do opendir/readdir? 
7333 if (-d $stem) {
7334     chdir($stem);
7335     ;@candidates = glob("5.*");
7336 }
7337 else {
7338     ;@candidates = ();
7339 }
7340
7341 # XXX ToDo:  These comparisons must be reworked when two-digit
7342 # subversions come along, so that 5.7.10 compares as greater than
7343 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7344 # widespread that we can use the built-in version vectors rather
7345 # than reinventing them here.  For 5.6.0, however, we must
7346 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7347 foreach $d (@candidates) {
7348     if ($d lt $version) {
7349         if ($d ge $api_versionstring) {
7350             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7351         }
7352         elsif ($d ge "5.005") {
7353             unshift(@inc_version_list, grep { -d } $d);
7354         }
7355     }
7356     else {
7357         # Skip newer version.  I.e. don't look in
7358         # 5.7.0 if we're installing 5.6.1.
7359     }
7360 }
7361
7362 if (@inc_version_list) {
7363     print join(' ', @inc_version_list);
7364 }
7365 else {
7366     # Blank space to preserve value for next Configure run.
7367     print " ";
7368 }
7369 EOPL
7370 chmod +x getverlist
7371 case "$inc_version_list" in
7372 '')     if test -x "$perl5$exe_ext"; then
7373                 dflt=`$perl5 getverlist`
7374         else
7375                 dflt='none'
7376         fi
7377         ;;
7378 $undef) dflt='none' ;;
7379 *)  eval dflt=\"$inc_version_list\" ;;
7380 esac
7381 case "$dflt" in
7382 ''|' ') dflt=none ;;
7383 esac
7384 case "$dflt" in
7385 5.005) dflt=none ;;
7386 esac
7387 $cat <<EOM
7388
7389 In order to ease the process of upgrading, this version of perl 
7390 can be configured to use modules built and installed with earlier 
7391 versions of perl that were installed under $prefix.  Specify here
7392 the list of earlier versions that this version of perl should check.
7393 If Configure detected no earlier versions of perl installed under
7394 $prefix, then the list will be empty.  Answer 'none' to tell perl
7395 to not search earlier versions.
7396
7397 The default should almost always be sensible, so if you're not sure,
7398 just accept the default.
7399 EOM
7400
7401 rp='List of earlier versions to include in @INC?'
7402 . ./myread
7403 case "$ans" in
7404 [Nn]one|''|' ') inc_version_list=' ' ;;
7405 *) inc_version_list="$ans" ;;
7406 esac
7407 case "$inc_version_list" in
7408 ''|' ') 
7409         inc_version_list_init='0';;
7410 *)      inc_version_list_init=`echo $inc_version_list |
7411                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7412         ;;
7413 esac
7414 $rm -f getverlist
7415
7416 : determine whether to install perl also as /usr/bin/perl
7417
7418 echo " "
7419 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7420         $cat <<EOM
7421 Many scripts expect perl to be installed as /usr/bin/perl.
7422 I can install the perl you are about to compile also as /usr/bin/perl
7423 (in addition to $installbin/perl).
7424 EOM
7425         case "$installusrbinperl" in
7426         "$undef"|[nN]*) dflt='n';;
7427         *)              dflt='y';;
7428         esac
7429         rp="Do you want to install perl as /usr/bin/perl?"
7430         . ./myread
7431         case "$ans" in
7432         [yY]*)  val="$define";;
7433         *)      val="$undef" ;;
7434         esac
7435 else
7436         val="$undef"
7437 fi
7438 set installusrbinperl
7439 eval $setvar
7440
7441 : see if dld is available
7442 set dld.h i_dld
7443 eval $inhdr
7444
7445 : see if dlopen exists
7446 xxx_runnm="$runnm"
7447 runnm=false
7448 set dlopen d_dlopen
7449 eval $inlibc
7450 runnm="$xxx_runnm"
7451
7452 : determine which dynamic loading, if any, to compile in
7453 echo " "
7454 dldir="ext/DynaLoader"
7455 case "$usedl" in
7456 $define|y|true)
7457         dflt='y'
7458         usedl="$define"
7459         ;;
7460 $undef|n|false)
7461         dflt='n'
7462         usedl="$undef"
7463         ;;
7464 *) 
7465         dflt='n'
7466         case "$d_dlopen" in
7467             $define) dflt='y' ;;
7468         esac
7469         case "$i_dld" in
7470             $define) dflt='y' ;;
7471         esac
7472         : Does a dl_xxx.xs file exist for this operating system
7473         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7474         ;;
7475 esac
7476 rp="Do you wish to use dynamic loading?"
7477 . ./myread
7478 usedl="$ans"
7479 case "$ans" in
7480 y*) usedl="$define"
7481         case "$dlsrc" in
7482         '')
7483                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7484                         dflt="$dldir/dl_${osname}.xs"
7485                 elif $test "$d_dlopen" = "$define" ; then
7486                         dflt="$dldir/dl_dlopen.xs"
7487                 elif $test "$i_dld" = "$define" ; then
7488                         dflt="$dldir/dl_dld.xs"
7489                 else
7490                         dflt=''
7491                 fi
7492                 ;;
7493         *)      dflt="$dldir/$dlsrc"
7494                 ;;
7495         esac
7496     echo "The following dynamic loading files are available:"
7497         : Can not go over to $dldir because getfile has path hard-coded in.
7498         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7499         rp="Source file to use for dynamic loading"
7500         fn="fne"
7501         gfpth="$src"
7502         . ./getfile
7503         usedl="$define"
7504         : emulate basename
7505         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7506
7507         $cat << EOM
7508
7509 Some systems may require passing special flags to $cc -c to
7510 compile modules that will be used to create a shared library.
7511 To use no flags, say "none".
7512
7513 EOM
7514     case "$cccdlflags" in
7515     '') case "$gccversion" in
7516                 '') case "$osname" in
7517                         hpux)   dflt='+z' ;;
7518                         next)   dflt='none' ;;
7519                         irix*)  dflt='-KPIC' ;;
7520                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7521                         sunos)  dflt='-pic' ;;
7522                         *)      dflt='none' ;;
7523                     esac
7524                         ;;
7525                 *)  case "$osname" in
7526                         darwin) dflt='none' ;;
7527                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7528                         *)      dflt='-fpic' ;;
7529                     esac ;;
7530             esac ;;
7531         ' ') dflt='none' ;;
7532     *)  dflt="$cccdlflags" ;;
7533     esac
7534     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7535     . ./myread
7536     case "$ans" in
7537     none) cccdlflags=' ' ;;
7538     *) cccdlflags="$ans" ;;
7539     esac
7540
7541     cat << EOM
7542
7543 Some systems use ld to create libraries that can be dynamically loaded,
7544 while other systems (such as those using ELF) use $cc.
7545
7546 EOM
7547         case "$ld" in
7548         '')     $cat >try.c <<'EOM'
7549 /* Test for whether ELF binaries are produced */
7550 #include <fcntl.h>
7551 #include <stdlib.h>
7552 int main() {
7553         char b[4];
7554         int i = open("a.out",O_RDONLY);
7555         if(i == -1) 
7556                 exit(1); /* fail */
7557         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7558                 exit(0); /* succeed (yes, it's ELF) */
7559         else
7560                 exit(1); /* fail */
7561 }
7562 EOM
7563                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7564                         cat <<EOM
7565 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7566 EOM
7567                         dflt="$cc"
7568                 else
7569                         echo "I'll use ld to build dynamic libraries."
7570                         dflt='ld'
7571                 fi
7572                 rm -f try.c a.out
7573                 ;;
7574         *)      dflt="$ld"
7575                 ;;
7576         esac
7577
7578     rp="What command should be used to create dynamic libraries?"
7579     . ./myread
7580         ld="$ans"
7581
7582     cat << EOM
7583
7584 Some systems may require passing special flags to $ld to create a
7585 library that can be dynamically loaded.  If your ld flags include
7586 -L/other/path options to locate libraries outside your loader's normal
7587 search path, you may need to specify those -L options here as well.  To
7588 use no flags, say "none".
7589
7590 EOM
7591     case "$lddlflags" in
7592     '') case "$osname" in
7593                         beos) dflt='-nostart' ;;
7594                         hpux) dflt='-b';
7595                               case "$gccversion" in
7596                               '') dflt="$dflt +vnocompatwarnings" ;;
7597                               esac
7598                               ;;        
7599                         linux|irix*)    dflt='-shared' ;;
7600                         next)  dflt='none' ;;
7601                         solaris) dflt='-G' ;;
7602                         sunos) dflt='-assert nodefinitions' ;;
7603                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7604                 *)     dflt='none' ;;
7605                         esac
7606                         ;;
7607     *) dflt="$lddlflags" ;;
7608     esac
7609
7610         : Try to guess additional flags to pick up local libraries.
7611         : Be careful not to append to a plain 'none'
7612         case "$dflt" in
7613         none) dflt='' ;;
7614         esac
7615         for thisflag in $ldflags; do
7616                 case "$thisflag" in
7617                 -L*|-R*|-Wl,-R*)
7618                         case " $dflt " in
7619                         *" $thisflag "*) ;;
7620                         *) dflt="$dflt $thisflag" ;;
7621                         esac
7622                         ;;
7623                 esac
7624         done
7625
7626         case "$dflt" in
7627         ''|' ') dflt='none' ;;
7628         esac
7629
7630     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7631     . ./myread
7632     case "$ans" in
7633     none) lddlflags=' ' ;;
7634     *) lddlflags="$ans" ;;
7635     esac
7636
7637         cat <<EOM
7638
7639 Some systems may require passing special flags to $cc to indicate that
7640 the resulting executable will use dynamic linking.  To use no flags,
7641 say "none".
7642
7643 EOM
7644     case "$ccdlflags" in
7645     '') case "$osname" in
7646                 hpux)   dflt='-Wl,-E' ;;
7647                 linux)  dflt='-rdynamic' ;;
7648                 next)   dflt='none' ;;
7649                 sunos)  dflt='none' ;;
7650                 *)      dflt='none' ;;
7651             esac ;;
7652     ' ')  dflt='none' ;;
7653     *)  dflt="$ccdlflags" ;;
7654     esac
7655     rp="Any special flags to pass to $cc to use dynamic linking?"
7656     . ./myread
7657     case "$ans" in
7658     none) ccdlflags=' ' ;;
7659     *) ccdlflags="$ans" ;;
7660     esac
7661     ;;
7662 *)  usedl="$undef"
7663         ld='ld'
7664     dlsrc='dl_none.xs'
7665     lddlflags=''
7666     ccdlflags=''
7667     ;;
7668 esac
7669
7670 also=''
7671 case "$usedl" in
7672 $undef)
7673         # No dynamic loading being used, so don't bother even to prompt.
7674         useshrplib='false'
7675         ;;
7676 *)      case "$useshrplib" in
7677         '')     case "$osname" in
7678                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7679                         dflt=y
7680                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7681                         ;;
7682                 next*)
7683                         case "$osvers" in
7684                         4*)     dflt=y
7685                                 also='Building a shared libperl is needed for MAB support.'
7686                                 ;;
7687                         *)      dflt=n
7688                                 ;;
7689                         esac
7690                         ;;
7691                 *)      dflt=n
7692                         ;;
7693                 esac
7694                 ;;
7695         $define|true|[Yy]*)
7696                 dflt=y
7697                 ;;
7698         *)      dflt=n
7699                 ;;
7700         esac
7701         $cat << EOM
7702
7703 The perl executable is normally obtained by linking perlmain.c with
7704 libperl${_a}, any static extensions (usually just DynaLoader), and
7705 any other libraries needed on this system (such as -lm, etc.).  Since
7706 your system supports dynamic loading, it is probably possible to build
7707 a shared libperl.$so.  If you will have more than one executable linked
7708 to libperl.$so, this will significantly reduce the size of each
7709 executable, but it may have a noticeable affect on performance.  The
7710 default is probably sensible for your system.
7711 $also
7712
7713 EOM
7714         rp="Build a shared libperl.$so (y/n)"
7715         . ./myread
7716         case "$ans" in
7717         true|$define|[Yy]*)
7718                 useshrplib='true'  ;;
7719         *)      useshrplib='false' ;;
7720         esac
7721         ;;
7722 esac
7723
7724 case "$useshrplib" in
7725 true)
7726         case "$libperl" in
7727         '')
7728                 # Figure out a good name for libperl.so.  Since it gets stored in
7729                 # a version-specific architecture-dependent library, the version
7730                 # number isn't really that important, except for making cc/ld happy.
7731                 #
7732                 # A name such as libperl.so.3.1
7733                 majmin="libperl.$so.$patchlevel.$subversion"
7734                 # A name such as libperl.so.301
7735                 majonly=`echo $patchlevel $subversion |
7736                         $awk '{printf "%d%02d", $1, $2}'`
7737                 majonly=libperl.$so.$majonly
7738                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7739                 # rely on figuring it out from the naming of libc.
7740                 case "${osname}${osvers}" in
7741                 next4*)
7742                         dflt=libperl.5.$so
7743                         # XXX How handle the --version stuff for MAB?
7744                         ;;
7745                 linux*)  # ld won't link with a bare -lperl otherwise.
7746                         dflt=libperl.$so
7747                         ;;
7748                 cygwin*) # ld links against an importlib
7749                         dflt=libperl$lib_ext
7750                         ;;
7751                 *)      # Try to guess based on whether libc has major.minor.
7752                         case "$libc" in
7753                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7754                         *libc.$so.[0-9]*) dflt=$majonly ;;
7755                         *)      dflt=libperl.$so ;;
7756                         esac
7757                         ;;
7758                 esac
7759                 ;;
7760         *)      dflt=$libperl
7761                 ;;
7762         esac
7763         cat << EOM
7764
7765 I need to select a good name for the shared libperl.  If your system uses
7766 library names with major and minor numbers, then you might want something
7767 like $majmin.  Alternatively, if your system uses a single version
7768 number for shared libraries, then you might want to use $majonly.
7769 Or, your system might be quite happy with a simple libperl.$so.
7770
7771 Since the shared libperl will get installed into a version-specific
7772 architecture-dependent directory, the version number of the shared perl
7773 library probably isn't important, so the default should be o.k.
7774
7775 EOM
7776         rp='What name do you want to give to the shared libperl?'
7777         . ./myread
7778         libperl=$ans
7779         echo "Ok, I'll use $libperl"
7780         ;;
7781 *)
7782         libperl="libperl${_a}"
7783         ;;
7784 esac
7785
7786 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7787 case "$shrpdir" in
7788 '') ;;
7789 *)      $cat >&4 <<EOM
7790 WARNING:  Use of the shrpdir variable for the installation location of
7791 the shared $libperl is not supported.  It was never documented and
7792 will not work in this version.  Let me (perlbug@perl.org)
7793 know of any problems this may cause.
7794
7795 EOM
7796         case "$shrpdir" in
7797         "$archlibexp/CORE")
7798                 $cat >&4 <<EOM
7799 But your current setting of $shrpdir is
7800 the default anyway, so it's harmless.
7801 EOM
7802                 ;;
7803         *)
7804                 $cat >&4 <<EOM
7805 Further, your current attempted setting of $shrpdir
7806 conflicts with the value of $archlibexp/CORE
7807 that installperl will use.
7808 EOM
7809                 ;;
7810         esac
7811         ;;
7812 esac
7813
7814 # How will the perl executable find the installed shared $libperl?
7815 # Add $xxx to ccdlflags.
7816 # If we can't figure out a command-line option, use $shrpenv to
7817 # set env LD_RUN_PATH.  The main perl makefile uses this.
7818 shrpdir=$archlibexp/CORE
7819 xxx=''
7820 tmp_shrpenv=''
7821 if "$useshrplib"; then
7822     case "$osname" in 
7823         aix)
7824                 # We'll set it in Makefile.SH...
7825                 ;;
7826         solaris)
7827                 xxx="-R $shrpdir"
7828                 ;;
7829         freebsd|netbsd)
7830                 xxx="-Wl,-R$shrpdir"
7831                 ;;
7832         bsdos|linux|irix*|dec_osf)
7833                 xxx="-Wl,-rpath,$shrpdir"
7834                 ;;
7835         next)
7836                 # next doesn't like the default...
7837                 ;;
7838         beos)
7839                 # beos doesn't like the default, either.
7840                 ;;
7841         hpux*)
7842                 # hpux doesn't like the default, either.
7843                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7844                 ;;
7845         *)
7846                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7847                 ;;
7848         esac
7849         case "$xxx" in
7850         '') ;;
7851         *)      
7852                 # Only add $xxx if it isn't already in ccdlflags.
7853                 case " $ccdlflags " in
7854                 *" $xxx "*)     ;;
7855                 *)      ccdlflags="$ccdlflags $xxx"
7856                         cat <<EOM >&4
7857
7858 Adding $xxx to the flags
7859 passed to $ld so that the perl executable will find the 
7860 installed shared $libperl.
7861
7862 EOM
7863                         ;;
7864                 esac
7865                 ;;
7866         esac
7867 fi
7868 # Fix ccdlflags in AIX for building external extensions.
7869 # (For building Perl itself bare -bE:perl.exp is needed,
7870 #  Makefile.SH takes care of this.)
7871 case "$osname" in
7872 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7873 esac
7874 # Respect a hint or command-line value.
7875 case "$shrpenv" in
7876 '') shrpenv="$tmp_shrpenv" ;;
7877 esac
7878 case "$ldlibpthname" in
7879 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7880 none)   ldlibpthname='' ;;
7881 esac
7882
7883 : determine where manual pages are on this system
7884 echo " "
7885 case "$sysman" in
7886 '') 
7887         syspath='/usr/share/man/man1 /usr/man/man1'
7888         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7889         syspath="$syspath /usr/man/u_man/man1"
7890         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7891         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7892         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7893         sysman=`./loc . /usr/man/man1 $syspath`
7894         ;;
7895 esac
7896 if $test -d "$sysman"; then
7897         echo "System manual is in $sysman." >&4
7898 else
7899         echo "Could not find manual pages in source form." >&4
7900 fi
7901
7902 : determine where manual pages go
7903 set man1dir man1dir none
7904 eval $prefixit
7905 $cat <<EOM
7906
7907 $spackage has manual pages available in source form.
7908 EOM
7909 case "$nroff" in
7910 nroff)
7911         echo "However, you don't have nroff, so they're probably useless to you."
7912         case "$man1dir" in
7913         '') man1dir="none";;
7914         esac;;
7915 esac
7916 echo "If you don't want the manual sources installed, answer 'none'."
7917 case "$man1dir" in
7918 ' ') dflt=none
7919         ;;
7920 '')
7921         lookpath="$prefixexp/share/man/man1"
7922         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7923         lookpath="$lookpath $prefixexp/man/p_man/man1"
7924         lookpath="$lookpath $prefixexp/man/u_man/man1"
7925         lookpath="$lookpath $prefixexp/man/man.1"
7926         case "$sysman" in
7927         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7928         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7929         esac
7930         set dflt
7931         eval $prefixup
7932         ;;
7933 *)  dflt="$man1dir"
7934         ;;
7935 esac
7936 echo " "
7937 fn=dn+~
7938 rp="Where do the main $spackage manual pages (source) go?"
7939 . ./getfile
7940 if $test "X$man1direxp" != "X$ansexp"; then
7941         installman1dir=''
7942 fi
7943 man1dir="$ans"
7944 man1direxp="$ansexp"
7945 case "$man1dir" in
7946 '')     man1dir=' '
7947         installman1dir='';;
7948 esac
7949
7950 : Change installation prefix, if necessary.
7951 if $test X"$prefix" != X"$installprefix"; then
7952         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7953 else
7954         installman1dir="$man1direxp"
7955 fi
7956
7957 : What suffix to use on installed man pages
7958
7959 case "$man1dir" in
7960 ' ')
7961         man1ext='0'
7962         ;;
7963 *)
7964         rp="What suffix should be used for the main $spackage man pages?"
7965         case "$man1ext" in
7966         '')     case "$man1dir" in
7967                 *1)  dflt=1 ;;
7968                 *1p) dflt=1p ;;
7969                 *1pm) dflt=1pm ;;
7970                 *l) dflt=l;;
7971                 *n) dflt=n;;
7972                 *o) dflt=o;;
7973                 *p) dflt=p;;
7974                 *C) dflt=C;;
7975                 *L) dflt=L;;
7976                 *L1) dflt=L1;;
7977                 *) dflt=1;;
7978                 esac
7979                 ;;
7980         *)      dflt="$man1ext";;
7981         esac
7982         . ./myread
7983         man1ext="$ans"
7984         ;;
7985 esac
7986
7987 : see if we can have long filenames
7988 echo " "
7989 first=123456789abcdef
7990 $rm -f $first
7991 if (echo hi >$first) 2>/dev/null; then
7992         if $test -f 123456789abcde; then
7993                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7994                 val="$undef"
7995         else
7996                 echo 'You can have filenames longer than 14 characters.'>&4
7997                 val="$define"
7998         fi
7999 else
8000         $cat <<'EOM'
8001 You can't have filenames longer than 14 chars.
8002 You can't even think about them!
8003 EOM
8004         val="$undef"
8005 fi 
8006 set d_flexfnam
8007 eval $setvar
8008 $rm -rf 123456789abcde*
8009
8010 : determine where library module manual pages go
8011 set man3dir man3dir none
8012 eval $prefixit
8013 $cat <<EOM
8014
8015 $spackage has manual pages for many of the library modules.
8016 EOM
8017
8018 case "$nroff" in
8019 nroff)
8020         $cat <<'EOM'
8021 However, you don't have nroff, so they're probably useless to you.
8022 EOM
8023         case "$man3dir" in
8024         '') man3dir="none";;
8025         esac;;
8026 esac
8027
8028 case "$d_flexfnam" in
8029 undef)
8030         $cat <<'EOM'
8031 However, your system can't handle the long file names like File::Basename.3. 
8032 EOM
8033         case "$man3dir" in
8034         '') man3dir="none";;
8035         esac;;
8036 esac
8037
8038 echo "If you don't want the manual sources installed, answer 'none'."
8039 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8040 case "$man3dir" in
8041 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8042         if $test -d "$privlib/man/man3"; then
8043                 cat <<EOM >&4
8044
8045 WARNING:  Previous versions of perl installed man3 pages into
8046 $privlib/man/man3.  This version will suggest a 
8047 new default of $dflt.  
8048 EOM
8049                 tdflt=$dflt
8050                 dflt='n'
8051                 rp='Do you wish to preserve the old behavior?(y/n)'
8052                 . ./myread
8053                 case "$ans" in
8054                 y*) dflt="$privlib/man/man3" ;;
8055                 *)  dflt=$tdflt ;;
8056                 esac
8057     fi
8058         ;;
8059 *)      dflt="$man3dir" ;;
8060 esac
8061 case "$dflt" in
8062 ' ') dflt=none ;;
8063 esac
8064 echo " "
8065 fn=dn+~
8066 rp="Where do the $package library man pages (source) go?"
8067 . ./getfile
8068 man3dir="$ans"
8069 man3direxp="$ansexp"
8070 case "$man3dir" in
8071 '')     man3dir=' '
8072         installman3dir='';;
8073 esac
8074
8075 : Change installation prefix, if necessary.
8076 if $test X"$prefix" != X"$installprefix"; then
8077         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8078 else
8079         installman3dir="$man3direxp"
8080 fi
8081
8082 : What suffix to use on installed man pages
8083 case "$man3dir" in
8084 ' ')
8085         man3ext='0'
8086         ;;
8087 *)
8088         rp="What suffix should be used for the $package library man pages?"
8089         case "$man3ext" in
8090         '')     case "$man3dir" in
8091                 *3)  dflt=3 ;;
8092                 *3p) dflt=3p ;;
8093                 *3pm) dflt=3pm ;;
8094                 *l) dflt=l;;
8095                 *n) dflt=n;;
8096                 *o) dflt=o;;
8097                 *p) dflt=p;;
8098                 *C) dflt=C;;
8099                 *L) dflt=L;;
8100                 *L3) dflt=L3;;
8101                 *) dflt=3;;
8102                 esac
8103                 ;;
8104         *)      dflt="$man3ext";;
8105         esac
8106         . ./myread
8107         man3ext="$ans"
8108         ;;
8109 esac
8110
8111 : see if we have to deal with yellow pages, now NIS.
8112 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8113         if $test -f /usr/etc/nibindd; then
8114                 echo " "
8115                 echo "I'm fairly confident you're on a NeXT."
8116                 echo " "
8117                 rp='Do you get the hosts file via NetInfo?'
8118                 dflt=y
8119                 case "$hostcat" in
8120                 nidump*) ;;
8121                 '') ;;
8122                 *) dflt=n;;
8123                 esac
8124                 . ./myread
8125                 case "$ans" in
8126                 y*) hostcat='nidump hosts .';;
8127                 *)      case "$hostcat" in
8128                         nidump*) hostcat='';;
8129                         esac
8130                         ;;
8131                 esac
8132         fi
8133         case "$hostcat" in
8134         nidump*) ;;
8135         *)
8136                 case "$hostcat" in
8137                 *ypcat*) dflt=y;;
8138                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8139                                 dflt=y
8140                         else
8141                                 dflt=n
8142                         fi;;
8143                 *) dflt=n;;
8144                 esac
8145                 echo " "
8146                 rp='Are you getting the hosts file via yellow pages?'
8147                 . ./myread
8148                 case "$ans" in
8149                 y*) hostcat='ypcat hosts';;
8150                 *) hostcat='cat /etc/hosts';;
8151                 esac
8152                 ;;
8153         esac
8154 fi
8155 case "$hostcat" in
8156 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8157 esac
8158 case "$groupcat" in
8159 '') test -f /etc/group && groupcat='cat /etc/group';;
8160 esac
8161 case "$passcat" in
8162 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8163 esac
8164
8165 : now get the host name
8166 echo " "
8167 echo "Figuring out host name..." >&4
8168 case "$myhostname" in
8169 '') cont=true
8170         echo 'Maybe "hostname" will work...'
8171         if tans=`sh -c hostname 2>&1` ; then
8172                 myhostname=$tans
8173                 phostname=hostname
8174                 cont=''
8175         fi
8176         ;;
8177 *) cont='';;
8178 esac
8179 if $test "$cont"; then
8180         if ./xenix; then
8181                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8182                 if tans=`cat /etc/systemid 2>&1` ; then
8183                         myhostname=$tans
8184                         phostname='cat /etc/systemid'
8185                         echo "Whadyaknow.  Xenix always was a bit strange..."
8186                         cont=''
8187                 fi
8188         elif $test -r /etc/systemid; then
8189                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8190         fi
8191 fi
8192 if $test "$cont"; then
8193         echo 'No, maybe "uuname -l" will work...'
8194         if tans=`sh -c 'uuname -l' 2>&1` ; then
8195                 myhostname=$tans
8196                 phostname='uuname -l'
8197         else
8198                 echo 'Strange.  Maybe "uname -n" will work...'
8199                 if tans=`sh -c 'uname -n' 2>&1` ; then
8200                         myhostname=$tans
8201                         phostname='uname -n'
8202                 else
8203                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8204                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8205                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8206                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8207                         else
8208                                 case "$myhostname" in
8209                                 '') echo "Does this machine have an identity crisis or something?"
8210                                         phostname='';;
8211                                 *)
8212                                         echo "Well, you said $myhostname before..."
8213                                         phostname='echo $myhostname';;
8214                                 esac
8215                         fi
8216                 fi
8217         fi
8218 fi
8219 case "$myhostname" in
8220 '') myhostname=noname ;;
8221 esac
8222 : you do not want to know about this
8223 set $myhostname
8224 myhostname=$1
8225
8226 : verify guess
8227 if $test "$myhostname" ; then
8228         dflt=y
8229         rp='Your host name appears to be "'$myhostname'".'" Right?"
8230         . ./myread
8231         case "$ans" in
8232         y*) ;;
8233         *) myhostname='';;
8234         esac
8235 fi
8236
8237 : bad guess or no guess
8238 while $test "X$myhostname" = X ; do
8239         dflt=''
8240         rp="Please type the (one word) name of your host:"
8241         . ./myread
8242         myhostname="$ans"
8243 done
8244
8245 : translate upper to lower if necessary
8246 case "$myhostname" in
8247 *[A-Z]*)
8248         echo "(Normalizing case in your host name)"
8249         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8250         ;;
8251 esac
8252
8253 case "$myhostname" in
8254 *.*)
8255         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8256         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8257         echo "(Trimming domain name from host name--host name is now $myhostname)"
8258         ;;
8259 *) case "$mydomain" in
8260         '')
8261                 {
8262                         test "X$hostcat" = "Xypcat hosts" &&
8263                         ypmatch "$myhostname" hosts 2>/dev/null |\
8264                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8265                         $test -s hosts
8266                 } || {
8267                         test "X$hostcat" != "X" &&
8268                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8269                                         /[       ]$myhostname[  . ]/p" > hosts
8270                 }
8271                 tmp_re="[       . ]"
8272                 if $test -f hosts; then
8273                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8274                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8275                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8276                                 hosts | $sort | $uniq | \
8277                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8278                         case `$echo X$dflt` in
8279                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8280                                 dflt=.
8281                                 ;;
8282                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8283                                 ;;
8284                         esac
8285                 else
8286                         echo "(I cannot locate a hosts database anywhere)"
8287                         dflt=.
8288                 fi
8289                 case "$dflt" in
8290                 .)
8291                         tans=`./loc resolv.conf X /etc /usr/etc`
8292                         if $test -f "$tans"; then
8293                                 echo "(Attempting domain name extraction from $tans)"
8294                                 dflt=.`$sed -n -e 's/   / /g' \
8295                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8296                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8297                                 case "$dflt" in
8298                                 .) dflt=.`$sed -n -e 's/        / /g' \
8299                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8300                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8301                                         ;;
8302                                 esac
8303                         fi
8304                         ;;
8305                 esac
8306                 case "$dflt" in
8307                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8308                         dflt=.`sh -c domainname 2>/dev/null`
8309                         case "$dflt" in
8310                         '') dflt='.';;
8311                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8312                         esac
8313                         ;;
8314                 esac
8315                 case "$dflt$osname" in
8316                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8317                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8318                         ;;
8319                 esac
8320                 case "$dflt" in
8321                 .) echo "(Lost all hope -- silly guess then)"
8322                         dflt='.nonet'
8323                         ;;
8324                 esac
8325                 $rm -f hosts
8326                 ;;
8327         *) dflt="$mydomain";;
8328         esac;;
8329 esac
8330 echo " "
8331 rp="What is your domain name?"
8332 . ./myread
8333 tans="$ans"
8334 case "$ans" in
8335 '') ;;
8336 .*) ;;
8337 *) tans=".$tans";;
8338 esac
8339 mydomain="$tans"
8340
8341 : translate upper to lower if necessary
8342 case "$mydomain" in
8343 *[A-Z]*)
8344         echo "(Normalizing case in your domain name)"
8345         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8346         ;;
8347 esac
8348
8349 : a little sanity check here
8350 case "$phostname" in
8351 '') ;;
8352 *)
8353         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8354         $myhostname$mydomain|$myhostname) ;;
8355         *)
8356                 case "$phostname" in
8357                 sed*)
8358                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8359                         ;;
8360                 *)
8361                         echo "(That doesn't agree with your $phostname command, by the way.)"
8362                         ;;
8363                 esac
8364         ;;
8365         esac
8366         ;;
8367 esac
8368
8369 $cat <<EOM
8370
8371 I need to get your e-mail address in Internet format if possible, i.e.
8372 something like user@host.domain. Please answer accurately since I have
8373 no easy means to double check it. The default value provided below
8374 is most probably close to reality but may not be valid from outside
8375 your organization...
8376
8377 EOM
8378 cont=x
8379 while test "$cont"; do
8380         case "$cf_email" in
8381         '') dflt="$cf_by@$myhostname$mydomain";;
8382         *) dflt="$cf_email";;
8383         esac
8384         rp='What is your e-mail address?'
8385         . ./myread
8386         cf_email="$ans"
8387         case "$cf_email" in
8388         *@*.*) cont='' ;;
8389         *)
8390                 rp='Address does not look like an Internet one.  Use it anyway?'
8391                 case "$fastread" in
8392                 yes) dflt=y ;;
8393                 *) dflt=n ;;
8394                 esac
8395                 . ./myread
8396                 case "$ans" in
8397                 y*) cont='' ;;
8398                 *) echo " " ;;
8399                 esac
8400                 ;;
8401         esac
8402 done
8403
8404 $cat <<EOM
8405
8406 If you or somebody else will be maintaining perl at your site, please
8407 fill in the correct e-mail address here so that they may be contacted
8408 if necessary. Currently, the "perlbug" program included with perl
8409 will send mail to this address in addition to perlbug@perl.org. You may
8410 enter "none" for no administrator.
8411
8412 EOM
8413 case "$perladmin" in
8414 '') dflt="$cf_email";;
8415 *) dflt="$perladmin";;
8416 esac
8417 rp='Perl administrator e-mail address'
8418 . ./myread
8419 perladmin="$ans"
8420
8421 : determine whether to only install version-specific parts.
8422 echo " "
8423 $cat <<EOM
8424 Do you want to install only the version-specific parts of the perl
8425 distribution?  Usually you do *not* want to do this.
8426 EOM
8427 case "$versiononly" in
8428 "$define"|[Yy]*|true) dflt='y' ;;
8429 *) dflt='n';
8430 esac
8431 rp="Do you want to install only the version-specific parts of perl?"
8432 . ./myread
8433 case "$ans" in
8434 [yY]*)  val="$define";;
8435 *)      val="$undef" ;;
8436 esac
8437 set versiononly
8438 eval $setvar
8439
8440 case "$versiononly" in
8441 "$define") inc_version_list=''
8442            inc_version_list_init=0
8443            ;;
8444 esac
8445
8446 : figure out how to guarantee perl startup
8447 case "$startperl" in
8448 '')
8449         case "$sharpbang" in
8450         *!)
8451                 $cat <<EOH
8452
8453 I can use the #! construct to start perl on your system. This will
8454 make startup of perl scripts faster, but may cause problems if you
8455 want to share those scripts and perl is not in a standard place
8456 ($binexp/perl) on all your platforms. The alternative is to force
8457 a shell by starting the script with a single ':' character.
8458
8459 EOH
8460                 case "$versiononly" in
8461                 "$define")      dflt="$binexp/perl$version";;  
8462                 *)              dflt="$binexp/perl";;
8463                 esac
8464                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8465                 . ./myread
8466                 case "$ans" in
8467                 none)   startperl=": # use perl";;
8468                 *)      startperl="#!$ans"
8469                         if $test 30 -lt `echo "$ans" | wc -c`; then
8470                                 $cat >&4 <<EOM
8471
8472 WARNING:  Some systems limit the #! command to 32 characters.
8473 If you experience difficulty running Perl scripts with #!, try
8474 installing Perl in a directory with a shorter pathname.
8475
8476 EOM
8477                         fi ;;
8478                 esac
8479                 ;;
8480         *) startperl=": # use perl"
8481                 ;;
8482         esac
8483         ;;
8484 esac
8485 echo "I'll use $startperl to start perl scripts."
8486
8487 : figure best path for perl in scripts
8488 case "$perlpath" in
8489 '')
8490         case "$versiononly" in
8491         "$define")      perlpath="$binexp/perl$version";;
8492         *)              perlpath="$binexp/perl";;
8493         esac
8494         case "$startperl" in
8495         *!*) ;;
8496         *)
8497                 $cat <<EOH
8498
8499 I will use the "eval 'exec'" idiom to start Perl on your system.
8500 I can use the full path of your Perl binary for this purpose, but
8501 doing so may cause problems if you want to share those scripts and
8502 Perl is not always in a standard place ($binexp/perl).
8503
8504 EOH
8505                 dflt="$binexp/perl"
8506                 rp="What path shall I use in \"eval 'exec'\"?"
8507                 . ./myread
8508                 perlpath="$ans"
8509                 ;;
8510         esac
8511         ;;
8512 esac
8513 case "$startperl" in
8514 *!*)    ;;
8515 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8516 esac
8517
8518 : determine where public executable scripts go
8519 set scriptdir scriptdir
8520 eval $prefixit
8521 case "$scriptdir" in
8522 '')
8523         dflt="$bin"
8524         : guess some guesses
8525         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8526         $test -d /usr/share/bin     && dflt=/usr/share/bin
8527         $test -d /usr/local/script  && dflt=/usr/local/script
8528         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8529         $test -d $prefixexp/script  && dflt=$prefixexp/script
8530         set dflt
8531         eval $prefixup
8532         ;;
8533 *)  dflt="$scriptdir"
8534         ;;
8535 esac
8536 $cat <<EOM
8537  
8538 Some installations have a separate directory just for executable scripts so
8539 that they can mount it across multiple architectures but keep the scripts in
8540 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8541 Or you might just lump your scripts in with all your other executables.
8542  
8543 EOM
8544 fn=d~
8545 rp='Where do you keep publicly executable scripts?'
8546 . ./getfile
8547 if $test "X$ansexp" != "X$scriptdirexp"; then
8548         installscript=''
8549 fi
8550 scriptdir="$ans"
8551 scriptdirexp="$ansexp"
8552 : Change installation prefix, if necessary.
8553 if $test X"$prefix" != X"$installprefix"; then
8554         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8555 else
8556         installscript="$scriptdirexp"
8557 fi
8558
8559 : determine where add-on public executables go
8560 case "$sitebin" in
8561 '')     dflt=$siteprefix/bin ;;
8562 *)      dflt=$sitebin ;;
8563 esac
8564 fn=d~
8565 rp='Pathname where the add-on public executables should be installed?'
8566 . ./getfile
8567 sitebin="$ans"
8568 sitebinexp="$ansexp"
8569 : Change installation prefix, if necessary.
8570 if $test X"$prefix" != X"$installprefix"; then
8571         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8572 else
8573         installsitebin="$sitebinexp"
8574 fi
8575
8576 : define an is-a-typedef? function
8577 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8578 case "$inclist" in
8579 "") inclist="sys/types.h";;
8580 esac;
8581 eval "varval=\$$var";
8582 case "$varval" in
8583 "")
8584         $rm -f temp.c;
8585         for inc in $inclist; do
8586                 echo "#include <$inc>" >>temp.c;
8587         done;
8588         echo "#ifdef $type" >> temp.c;
8589         echo "printf(\"We have $type\");" >> temp.c;
8590         echo "#endif" >> temp.c;
8591         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8592         if $contains $type temp.E >/dev/null 2>&1; then
8593                 eval "$var=\$type";
8594         else
8595                 eval "$var=\$def";
8596         fi;
8597         $rm -f temp.?;;
8598 *) eval "$var=\$varval";;
8599 esac'
8600
8601 : define an is-a-typedef? function that prompts if the type is not available.
8602 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8603 case "$inclist" in
8604 "") inclist="sys/types.h";;
8605 esac;
8606 eval "varval=\$$var";
8607 case "$varval" in
8608 "")
8609         $rm -f temp.c;
8610         for inc in $inclist; do
8611                 echo "#include <$inc>" >>temp.c;
8612         done;
8613         echo "#ifdef $type" >> temp.c;
8614         echo "printf(\"We have $type\");" >> temp.c;
8615         echo "#endif" >> temp.c;
8616         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8617         echo " " ;
8618         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8619         if $contains $type temp.E >/dev/null 2>&1; then
8620                 echo "$type found." >&4;
8621                 eval "$var=\$type";
8622         else
8623                 echo "$type NOT found." >&4;
8624                 dflt="$def";
8625                 . ./myread ;
8626                 eval "$var=\$ans";
8627         fi;
8628         $rm -f temp.?;;
8629 *) eval "$var=\$varval";;
8630 esac'
8631
8632 : see what type lseek is declared as in the kernel
8633 rp="What is the type used for lseek's offset on this system?"
8634 set off_t lseektype long stdio.h sys/types.h
8635 eval $typedef_ask
8636
8637 echo " "
8638 echo "Checking to see how big your file offsets are..." >&4
8639 $cat >try.c <<EOCP
8640 #include <sys/types.h>
8641 #include <stdio.h>
8642 int main()
8643 {
8644     printf("%d\n", (int)sizeof($lseektype));
8645     return(0); 
8646 }
8647 EOCP
8648 set try
8649 if eval $compile_ok; then
8650         lseeksize=`$run ./try`
8651         echo "Your file offsets are $lseeksize bytes long."
8652 else
8653         dflt=$longsize
8654         echo " "
8655         echo "(I can't seem to compile the test program.  Guessing...)"
8656         rp="What is the size of your file offsets (in bytes)?"
8657         . ./myread
8658         lseeksize="$ans"
8659 fi
8660 $rm -f try.c try
8661
8662 : see what type file positions are declared as in the library
8663 rp="What is the type for file position used by fsetpos()?"
8664 set fpos_t fpostype long stdio.h sys/types.h
8665 eval $typedef_ask
8666
8667 echo " "
8668 case "$fpostype" in
8669 *_t) zzz="$fpostype"    ;;
8670 *)   zzz="fpos_t"       ;;
8671 esac
8672 echo "Checking the size of $zzz..." >&4 
8673 cat > try.c <<EOCP
8674 #include <sys/types.h>
8675 #include <stdio.h>
8676 int main() {
8677     printf("%d\n", (int)sizeof($fpostype));
8678     exit(0);
8679 }
8680 EOCP
8681 set try
8682 if eval $compile_ok; then
8683         yyy=`$run ./try`
8684         case "$yyy" in
8685         '')     fpossize=4
8686                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8687                 ;;
8688         *)      fpossize=$yyy
8689                 echo "Your $zzz is $fpossize bytes long."
8690                 ;;
8691         esac
8692 else
8693         dflt="$longsize"
8694         echo " " >&4
8695         echo "(I can't compile the test program.  Guessing...)" >&4
8696         rp="What is the size of your file positions (in bytes)?"
8697         . ./myread
8698         fpossize="$ans"
8699 fi
8700
8701
8702
8703 # Backward compatibility (uselfs is deprecated).
8704 case "$uselfs" in
8705 "$define"|true|[yY]*)
8706         cat <<EOM >&4
8707
8708 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8709 EOM
8710         uselargefiles="$define"
8711         ;;
8712 esac                          
8713
8714 case "$lseeksize:$fpossize" in
8715 8:8) cat <<EOM
8716
8717 You can have files larger than 2 gigabytes.
8718 EOM
8719    val="$define" ;;
8720 *)    case "$uselargefiles" in
8721    "$undef"|false|[nN]*) dflt='n' ;;
8722    *)   dflt='y' ;;
8723    esac
8724    cat <<EOM
8725
8726 Perl can be built to understand large files (files larger than 2 gigabytes)
8727 on some systems.  To do so, Configure can be run with -Duselargefiles.
8728
8729 If this doesn't make any sense to you, just accept the default '$dflt'.
8730 EOM
8731    rp='Try to understand large files, if available?'
8732    . ./myread
8733    case "$ans" in
8734    y|Y)         val="$define" ;;
8735    *)           val="$undef"  ;;
8736    esac
8737    ;;
8738 esac
8739 set uselargefiles
8740 eval $setvar
8741 case "$uselargefiles" in
8742 "$define")
8743 : Look for a hint-file generated 'call-back-unit'.  If the
8744 : user has specified that a large files perl is to be built,
8745 : we may need to set or change some other defaults.
8746         if $test -f uselargefiles.cbu; then
8747                 echo "Your platform has some specific hints for large file builds, using them..."
8748                 . ./uselargefiles.cbu
8749                 echo " "
8750                 echo "Rechecking to see how big your file offsets are..." >&4
8751                 $cat >try.c <<EOCP
8752 #include <sys/types.h>
8753 #include <stdio.h>
8754 int main()
8755 {
8756     printf("%d\n", (int)sizeof($lseektype));
8757     return(0); 
8758 }
8759 EOCP
8760                 set try
8761                 if eval $compile_ok; then
8762                         lseeksize=`$run ./try`
8763                         $echo "Your file offsets are now $lseeksize bytes long."
8764                 else
8765                         dflt="$lseeksize"
8766                         echo " "
8767                         echo "(I can't seem to compile the test program.  Guessing...)"
8768                         rp="What is the size of your file offsets (in bytes)?"
8769                         . ./myread
8770                         lseeksize="$ans"
8771                 fi
8772                 case "$fpostype" in
8773                 *_t) zzz="$fpostype"    ;;
8774                 *)   zzz="fpos_t"       ;;
8775                 esac
8776                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8777                 $cat > try.c <<EOCP
8778 #include <sys/types.h>
8779 #include <stdio.h>
8780 int main() {
8781     printf("%d\n", (int)sizeof($fpostype));
8782     exit(0);
8783 }
8784 EOCP
8785                 set try
8786                 if eval $compile_ok; then
8787                         yyy=`$run ./try`
8788                         dflt="$lseeksize"
8789                         case "$yyy" in
8790                         '')     echo " "
8791                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8792                                 ;;
8793                         *)      fpossize=$yyy
8794                                 echo " $fpossize bytes." >&4
8795                                 ;;
8796                         esac
8797                 else
8798                         dflt="$fpossize"
8799                         echo " "
8800                         echo "(I can't compile the test program.  Guessing...)" >&4
8801                         rp="What is the size of your file positions (in bytes)?"
8802                         . ./myread
8803                         fpossize="$ans"
8804                 fi
8805                 $rm -f try.c try
8806         fi
8807         ;;
8808 esac
8809
8810 case "$vendorprefix" in
8811 '')     d_vendorbin="$undef"
8812         vendorbin=''
8813         vendorbinexp=''
8814         ;;
8815 *)      d_vendorbin="$define"
8816         : determine where vendor-supplied executables go.
8817         case "$vendorbin" in
8818         '') dflt=$vendorprefix/bin ;;
8819         *)      dflt="$vendorbin" ;;
8820         esac
8821         fn=d~+
8822         rp='Pathname for the vendor-supplied executables directory?'
8823         . ./getfile
8824         vendorbin="$ans"
8825         vendorbinexp="$ansexp"
8826         ;;
8827 esac
8828 : Change installation prefix, if necessary.
8829 if $test X"$prefix" != X"$installprefix"; then
8830         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8831 else
8832         installvendorbin="$vendorbinexp"
8833 fi
8834
8835 : see if qgcvt exists
8836 set qgcvt d_qgcvt
8837 eval $inlibc
8838
8839 : Check how to convert floats to strings.
8840
8841 if test "X$d_Gconvert" = X; then
8842
8843 echo " "
8844 echo "Checking for an efficient way to convert floats to strings."
8845 echo " " > try.c
8846 case "$uselongdouble" in
8847 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8848 esac
8849 case "$d_longdbl" in
8850 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8851 esac
8852 case "$d_PRIgldbl" in
8853 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8854 esac
8855 $cat >>try.c <<EOP
8856 #ifdef TRY_gconvert
8857 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8858 char *myname = "gconvert";
8859 #endif
8860 #ifdef TRY_gcvt
8861 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8862 char *myname = "gcvt";
8863 #endif
8864 #ifdef TRY_qgcvt
8865 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8866 char *myname = "qgcvt";
8867 #define DOUBLETYPE long double
8868 #endif
8869 #ifdef TRY_sprintf
8870 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8871 #ifdef HAS_PRIgldbl
8872 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8873 #else
8874 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8875 #endif
8876 #else
8877 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8878 #endif
8879 char *myname = "sprintf";
8880 #endif
8881
8882 #ifndef DOUBLETYPE
8883 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8884 #define DOUBLETYPE long double
8885 #else
8886 #define DOUBLETYPE double
8887 #endif
8888 #endif
8889
8890 #include <stdio.h>
8891
8892 #define I_STDLIB $i_stdlib
8893 #ifdef I_STDLIB
8894 #include <stdlib.h>
8895 #endif
8896
8897 int
8898 checkit(expect, got)
8899 char *expect;
8900 char *got;
8901 {
8902     if (strcmp(expect, got)) {
8903                 printf("%s oddity:  Expected %s, got %s\n",
8904                         myname, expect, got);
8905                 exit(1);
8906         }
8907 }
8908
8909 int main()
8910
8911         char buf[64]; 
8912         buf[63] = '\0';
8913
8914         /* This must be 1st test on (which?) platform */
8915         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8916         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8917         checkit("0.1", buf);
8918
8919         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8920         checkit("0.01", buf);
8921
8922         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8923         checkit("0.001", buf);
8924
8925         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8926         checkit("0.0001", buf);
8927
8928         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8929         if (strlen(buf) > 5)
8930             checkit("9e-005", buf); /* for Microsoft ?? */
8931         else
8932             checkit("9e-05", buf);
8933
8934         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8935         checkit("1", buf);
8936
8937         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8938         checkit("1.1", buf);
8939
8940         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8941         checkit("1.01", buf);
8942
8943         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8944         checkit("1.001", buf);
8945
8946         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8947         checkit("1.0001", buf);
8948
8949         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8950         checkit("1.00001", buf);
8951
8952         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8953         checkit("1.000001", buf);
8954
8955         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8956         checkit("0", buf);
8957
8958         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8959         checkit("-1", buf);
8960
8961         /* Some Linux gcvt's give 1.e+5 here. */
8962         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8963         checkit("100000", buf);
8964         
8965         /* Some Linux gcvt's give -1.e+5 here. */
8966         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8967         checkit("-100000", buf);
8968
8969         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8970         checkit("123.456", buf);
8971
8972         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8973         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8974         /* 34 should be enough to scare even long double
8975          * places into using the e notation. */
8976         if (strlen(buf) > 5)
8977             checkit("1e+034", buf); /* for Microsoft */
8978         else
8979             checkit("1e+34", buf);
8980
8981         /* For Perl, if you add additional tests here, also add them to
8982          * t/base/num.t for benefit of platforms not using Configure or
8983          * overriding d_Gconvert */
8984
8985         exit(0);
8986 }
8987 EOP
8988 : first add preferred functions to our list
8989 xxx_list=""
8990 for xxx_convert in $gconvert_preference; do
8991     case $xxx_convert in
8992     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8993     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8994     esac 
8995 done
8996 : then add any others
8997 for xxx_convert in gconvert gcvt sprintf; do
8998     case "$xxx_list" in
8999     *$xxx_convert*) ;;
9000     *) xxx_list="$xxx_list $xxx_convert" ;;
9001     esac 
9002 done
9003
9004 case "$d_longdbl$uselongdouble" in
9005 "$define$define")
9006     : again, add prefered functions to our list first
9007     xxx_ld_list=""
9008     for xxx_convert in $gconvert_ld_preference; do
9009         case $xxx_convert in
9010         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9011         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9012         esac
9013     done
9014     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9015     for xxx_convert in qgcvt sprintf $xxx_list; do
9016         case "$xxx_ld_list" in
9017         $xxx_convert*|*" $xxx_convert"*) ;;
9018         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9019         esac
9020     done
9021     : if sprintf cannot do long doubles, move it to the end
9022     if test "$d_PRIgldbl" != "$define"; then
9023         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9024     fi
9025     : if no qgcvt, remove it
9026     if test "$d_qgcvt" != "$define"; then
9027         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9028     fi
9029     : use the ld_list
9030     xxx_list="$xxx_ld_list"
9031     ;;
9032 esac
9033
9034 for xxx_convert in $xxx_list; do
9035         echo "Trying $xxx_convert..."
9036         $rm -f try try$_o
9037         set try -DTRY_$xxx_convert
9038         if eval $compile; then
9039                 echo "$xxx_convert() found." >&4
9040                 if $run ./try; then
9041                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9042                         break;
9043                 else
9044                         echo "...But $xxx_convert didn't work as I expected."
9045                         xxx_convert=''
9046                 fi
9047         else
9048                 echo "$xxx_convert NOT found." >&4
9049         fi
9050 done
9051
9052 if test X$xxx_convert = X; then
9053     echo "*** WHOA THERE!!! ***" >&4
9054     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9055     xxx_convert=sprintf
9056 fi
9057
9058 case "$xxx_convert" in
9059 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9060 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9061 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9062 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9063    "$define$define$define")
9064       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9065    "$define$define$undef")
9066       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9067    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9068    esac
9069    ;;  
9070 esac
9071
9072 fi
9073
9074 : see if _fwalk exists
9075 set fwalk d__fwalk
9076 eval $inlibc
9077
9078 : Initialize h_fcntl
9079 h_fcntl=false
9080
9081 : Initialize h_sysfile
9082 h_sysfile=false
9083
9084 : access call always available on UNIX
9085 set access d_access
9086 eval $inlibc
9087
9088 : locate the flags for 'access()'
9089 case "$d_access" in
9090 "$define")
9091         echo " "
9092         $cat >access.c <<'EOCP'
9093 #include <sys/types.h>
9094 #ifdef I_FCNTL
9095 #include <fcntl.h>
9096 #endif
9097 #ifdef I_SYS_FILE
9098 #include <sys/file.h>
9099 #endif
9100 #ifdef I_UNISTD
9101 #include <unistd.h>
9102 #endif
9103 int main() {
9104         exit(R_OK);
9105 }
9106 EOCP
9107         : check sys/file.h first, no particular reason here
9108         if $test `./findhdr sys/file.h` && \
9109                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9110                 h_sysfile=true;
9111                 echo "<sys/file.h> defines the *_OK access constants." >&4
9112         elif $test `./findhdr fcntl.h` && \
9113                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9114                 h_fcntl=true;
9115                 echo "<fcntl.h> defines the *_OK access constants." >&4
9116         elif $test `./findhdr unistd.h` && \
9117                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9118                 echo "<unistd.h> defines the *_OK access constants." >&4
9119         else
9120                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9121         fi
9122         ;;
9123 esac
9124 $rm -f access*
9125
9126 : see if accessx exists
9127 set accessx d_accessx
9128 eval $inlibc
9129
9130 : see if alarm exists
9131 set alarm d_alarm
9132 eval $inlibc
9133
9134 : see if POSIX threads are available
9135 set pthread.h i_pthread
9136 eval $inhdr
9137
9138 : define a fucntion to check prototypes
9139 $cat > protochk <<EOSH
9140 $startsh
9141 cc="$cc"
9142 optimize="$optimize"
9143 ccflags="$ccflags"
9144 prototype="$prototype"
9145 define="$define"
9146 rm=$rm
9147 usethreads=$usethreads
9148 i_pthread=$i_pthread
9149 pthread_h_first=$pthread_h_first
9150 EOSH
9151
9152 $cat >> protochk <<'EOSH'
9153
9154 $rm -f try.c
9155 foo="$1"
9156 shift
9157 while test $# -ge 2; do
9158         case "$1" in
9159                 $define) echo "#include <$2>" >> try.c ;;
9160                 literal) echo "$2" >> try.c ;;
9161         esac
9162     # Extra magic for the benefit of systems that need pthread.h
9163     # to be included early to correctly detect threadsafe functions.
9164     # Such functions must guarantee themselves, though, that the usethreads
9165     # and i_pthread have been defined, before calling protochk.
9166     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9167         echo "#include <pthread.h>" >> try.c
9168         pthread_h_done=yes
9169     fi
9170     shift 2
9171 done
9172 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9173 cat >> try.c <<'EOCP'
9174 #ifdef CAN_PROTOTYPE
9175 #define _(args) args
9176 #else
9177 #define _(args) ()
9178 #endif
9179 EOCP
9180 echo "$foo" >> try.c
9181 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9182 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9183 status=$?
9184 $rm -f try.[co]
9185 exit $status
9186 EOSH
9187 chmod +x protochk
9188 $eunicefix protochk
9189
9190 : see if sys/types.h has to be included
9191 set sys/types.h i_systypes
9192 eval $inhdr
9193
9194 : see if sys/select.h has to be included
9195 set sys/select.h i_sysselct
9196 eval $inhdr
9197
9198 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9199 while $test $# -ge 2; do
9200         case "$1" in
9201         $define) echo "#include <$2>";;
9202         esac ;
9203     shift 2;
9204 done > try.c;
9205 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9206 set try;
9207 if eval $compile; then
9208         val="$define";
9209 else
9210         val="$undef";
9211 fi;
9212 set $varname;
9213 eval $setvar;
9214 $rm -f try.c try.o'
9215
9216 : see if we should include time.h, sys/time.h, or both
9217 echo " "
9218 if test "X$timeincl" = X; then
9219         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9220         $echo $n "I'm now running the test program...$c"
9221         $cat >try.c <<'EOCP'
9222 #include <sys/types.h>
9223 #ifdef I_TIME
9224 #include <time.h>
9225 #endif
9226 #ifdef I_SYSTIME
9227 #ifdef SYSTIMEKERNEL
9228 #define KERNEL
9229 #endif
9230 #include <sys/time.h>
9231 #endif
9232 #ifdef I_SYSSELECT
9233 #include <sys/select.h>
9234 #endif
9235 int main()
9236 {
9237         struct tm foo;
9238 #ifdef S_TIMEVAL
9239         struct timeval bar;
9240 #endif
9241 #ifdef S_TIMEZONE
9242         struct timezone tzp;
9243 #endif
9244         if (foo.tm_sec == foo.tm_sec)
9245                 exit(0);
9246 #ifdef S_TIMEVAL
9247         if (bar.tv_sec == bar.tv_sec)
9248                 exit(0);
9249 #endif
9250         exit(1);
9251 }
9252 EOCP
9253         flags=''
9254         for s_timezone in '-DS_TIMEZONE' ''; do
9255         sysselect=''
9256         for s_timeval in '-DS_TIMEVAL' ''; do
9257         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9258         for i_time in '' '-DI_TIME'; do
9259         for i_systime in '-DI_SYSTIME' ''; do
9260                 case "$flags" in
9261                 '') $echo $n ".$c"
9262                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9263                         if eval $compile; then
9264                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9265                                 shift
9266                                 flags="$*"
9267                                 echo " "
9268                                 $echo $n "Succeeded with $flags$c"
9269                         fi
9270                         ;;
9271                 esac
9272         done
9273         done
9274         done
9275         done
9276         done
9277         timeincl=''
9278         echo " "
9279         case "$flags" in
9280         *SYSTIMEKERNEL*) i_systimek="$define"
9281                 timeincl=`./findhdr sys/time.h`
9282                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9283         *) i_systimek="$undef";;
9284         esac
9285         case "$flags" in
9286         *I_TIME*) i_time="$define"
9287                 timeincl=`./findhdr time.h`" $timeincl"
9288                 echo "We'll include <time.h>." >&4;;
9289         *) i_time="$undef";;
9290         esac
9291         case "$flags" in
9292         *I_SYSTIME*) i_systime="$define"
9293                 timeincl=`./findhdr sys/time.h`" $timeincl"
9294                 echo "We'll include <sys/time.h>." >&4;;
9295         *) i_systime="$undef";;
9296         esac
9297         $rm -f try.c try
9298 fi
9299 : see if struct tm knows about tm_zone
9300 case "$i_systime$i_time" in
9301 *$define*) 
9302         echo " "
9303         echo "Checking to see if your struct tm has tm_zone field..." >&4
9304         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9305         eval $hasfield
9306         ;;
9307 *)      val="$undef"
9308         set d_tm_tm_zone
9309         eval $setvar
9310         ;;
9311 esac
9312 case "$d_tm_tm_zone" in
9313 "$define")      echo "Yes, it does."   ;;
9314 *)              echo "No, it doesn't." ;;
9315 esac
9316 : see if struct tm knows about tm_gmtoff
9317 case "$i_systime$i_time" in
9318 *$define*) 
9319         echo " "
9320         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9321         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9322         eval $hasfield
9323         ;;
9324 *)      val="$undef"
9325         set d_tm_tm_gmtoff
9326         eval $setvar
9327         ;;
9328 esac
9329 case "$d_tm_tm_gmtoff" in
9330 "$define")      echo "Yes, it does."   ;;
9331 *)              echo "No, it doesn't." ;;
9332 esac
9333
9334 : see if asctime_r exists
9335 set asctime_r d_asctime_r
9336 eval $inlibc
9337 case "$d_asctime_r" in
9338 "$define")
9339         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9340         case "$d_asctime_r_proto:$usethreads" in
9341         ":define")      d_asctime_r_proto=define
9342                 set d_asctime_r_proto asctime_r $hdrs
9343                 eval $hasproto ;;
9344         *)      ;;
9345         esac
9346         case "$d_asctime_r_proto" in
9347         define)
9348         case "$asctime_r_proto" in
9349         ''|0) try='char* asctime_r(const struct tm*, char*);'
9350         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9351         esac
9352         case "$asctime_r_proto" in
9353         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9354         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9355         esac
9356         case "$asctime_r_proto" in
9357         ''|0) try='int asctime_r(const struct tm*, char*);'
9358         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9359         esac
9360         case "$asctime_r_proto" in
9361         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9362         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9363         esac
9364         case "$asctime_r_proto" in
9365         ''|0)   d_asctime_r=undef
9366                 asctime_r_proto=0
9367                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9368         * )     case "$asctime_r_proto" in
9369                 REENTRANT_PROTO*) ;;
9370                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9371                 esac
9372                 echo "Prototype: $try" ;;
9373         esac
9374         ;;
9375         *)      case "$usethreads" in
9376                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9377                 esac
9378                 d_asctime_r=undef
9379                 asctime_r_proto=0
9380                 ;;
9381         esac
9382         ;;
9383 *)      asctime_r_proto=0
9384         ;;
9385 esac
9386
9387 : see if atolf exists
9388 set atolf d_atolf
9389 eval $inlibc
9390
9391 : see if atoll exists
9392 set atoll d_atoll
9393 eval $inlibc
9394
9395 : Look for GNU-cc style attribute checking
9396 echo " "
9397 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9398 $cat >attrib.c <<'EOCP'
9399 #include <stdio.h>
9400 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9401 EOCP
9402 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9403         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9404                 echo "Your C compiler doesn't fully support __attribute__."
9405                 val="$undef"
9406         else
9407                 echo "Your C compiler supports __attribute__."
9408                 val="$define"
9409         fi
9410 else
9411         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9412         val="$undef"
9413 fi
9414 set d_attribut
9415 eval $setvar
9416 $rm -f attrib*
9417
9418 : see if bcmp exists
9419 set bcmp d_bcmp
9420 eval $inlibc
9421
9422 : see if bcopy exists
9423 set bcopy d_bcopy
9424 eval $inlibc
9425
9426 : see if this is a unistd.h system
9427 set unistd.h i_unistd
9428 eval $inhdr
9429
9430 : see if getpgrp exists
9431 set getpgrp d_getpgrp
9432 eval $inlibc
9433
9434 case "$d_getpgrp" in
9435 "$define")
9436         echo " "
9437         echo "Checking to see which flavor of getpgrp is in use..."
9438         $cat >try.c <<EOP
9439 #$i_unistd I_UNISTD
9440 #include <sys/types.h>
9441 #ifdef I_UNISTD
9442 #  include <unistd.h>
9443 #endif
9444 int main()
9445 {
9446         if (getuid() == 0) {
9447                 printf("(I see you are running Configure as super-user...)\n");
9448                 setuid(1);
9449         }
9450 #ifdef TRY_BSD_PGRP
9451         if (getpgrp(1) == 0)
9452                 exit(0);
9453 #else
9454         if (getpgrp() > 0)
9455                 exit(0);
9456 #endif
9457         exit(1);
9458 }
9459 EOP
9460         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9461                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9462                 val="$define"
9463         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9464                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9465                 val="$undef"
9466         else
9467                 echo "I can't seem to compile and run the test program."
9468                 if ./usg; then
9469                         xxx="a USG one, i.e. you use getpgrp()."
9470                 else
9471                         # SVR4 systems can appear rather BSD-ish.
9472                         case "$i_unistd" in
9473                         $undef)
9474                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9475                                 val="$define"
9476                                 ;;
9477                         $define)
9478                                 xxx="probably a USG one, i.e. you use getpgrp()."
9479                                 val="$undef"
9480                                 ;;
9481                         esac
9482                 fi
9483                 echo "Assuming your getpgrp is $xxx" >&4
9484         fi
9485         ;;
9486 *) val="$undef";;
9487 esac
9488 set d_bsdgetpgrp
9489 eval $setvar
9490 $rm -f try try.*
9491
9492 : see if setpgrp exists
9493 set setpgrp d_setpgrp
9494 eval $inlibc
9495
9496 case "$d_setpgrp" in
9497 "$define")
9498         echo " "
9499         echo "Checking to see which flavor of setpgrp is in use..."
9500         $cat >try.c <<EOP
9501 #$i_unistd I_UNISTD
9502 #include <sys/types.h>
9503 #ifdef I_UNISTD
9504 #  include <unistd.h>
9505 #endif
9506 int main()
9507 {
9508         if (getuid() == 0) {
9509                 printf("(I see you are running Configure as super-user...)\n");
9510                 setuid(1);
9511         }
9512 #ifdef TRY_BSD_PGRP
9513         if (-1 == setpgrp(1, 1))
9514                 exit(0);
9515 #else
9516         if (setpgrp() != -1)
9517                 exit(0);
9518 #endif
9519         exit(1);
9520 }
9521 EOP
9522         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9523                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9524                 val="$define"
9525         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9526                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9527                 val="$undef"
9528         else
9529                 echo "(I can't seem to compile and run the test program.)"
9530                 if ./usg; then
9531                         xxx="a USG one, i.e. you use setpgrp()."
9532                 else
9533                         # SVR4 systems can appear rather BSD-ish.
9534                         case "$i_unistd" in
9535                         $undef)
9536                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9537                                 val="$define"
9538                                 ;;
9539                         $define)
9540                                 xxx="probably a USG one, i.e. you use setpgrp()."
9541                                 val="$undef"
9542                                 ;;
9543                         esac
9544                 fi
9545                 echo "Assuming your setpgrp is $xxx" >&4
9546         fi
9547         ;;
9548 *) val="$undef";;
9549 esac
9550 set d_bsdsetpgrp
9551 eval $setvar
9552 $rm -f try try.*
9553 : see if bzero exists
9554 set bzero d_bzero
9555 eval $inlibc
9556
9557 : see if signal is declared as pointer to function returning int or void
9558 echo " "
9559 xxx=`./findhdr signal.h`
9560 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9561 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9562         echo "You have int (*signal())() instead of void." >&4
9563         val="$undef"
9564 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9565         echo "You have void (*signal())()." >&4
9566         val="$define"
9567 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9568         echo "You have int (*signal())() instead of void." >&4
9569         val="$undef"
9570 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9571         echo "You have void (*signal())()." >&4
9572         val="$define"
9573 else
9574         case "$d_voidsig" in
9575         '')
9576         echo "I can't determine whether signal handler returns void or int..." >&4
9577                 dflt=void
9578                 rp="What type does your signal handler return?"
9579                 . ./myread
9580                 case "$ans" in
9581                 v*) val="$define";;
9582                 *) val="$undef";;
9583                 esac;;
9584         "$define")
9585                 echo "As you already told me, signal handler returns void." >&4
9586                 val="$define"
9587                 ;;
9588         *)      echo "As you already told me, signal handler returns int." >&4
9589                 val="$undef"
9590                 ;;
9591         esac
9592 fi
9593 set d_voidsig
9594 eval $setvar
9595 case "$d_voidsig" in
9596 "$define") signal_t="void";;
9597 *) signal_t="int";;
9598 esac
9599 $rm -f $$.tmp
9600
9601 : check for ability to cast large floats to 32-bit ints.
9602 echo " "
9603 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9604 if $test "$intsize" -ge 4; then
9605         xxx=int
9606 else
9607         xxx=long
9608 fi
9609 $cat >try.c <<EOCP
9610 #include <stdio.h>
9611 #include <sys/types.h>
9612 #include <signal.h>
9613 $signal_t blech(s) int s; { exit(3); }
9614 int main()
9615 {
9616         $xxx i32;
9617         double f, g;
9618         int result = 0;
9619         char str[16];
9620         signal(SIGFPE, blech);
9621
9622         /* Don't let compiler optimize the test away.  Store the number 
9623            in a writable string for gcc to pass to sscanf under HP/UX.
9624         */
9625         sprintf(str, "2147483647");
9626         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9627         g = 10 * f;
9628         i32  = ($xxx) g;
9629
9630         /* x86 processors will probably give 0x8000 0000, which is a
9631        sign change.  We don't want that.  We want to mimic SPARC
9632            behavior here, which is to preserve the sign and give
9633            back 0x7fff ffff.
9634         */
9635         if (i32 != ($xxx) f)
9636                 result |= 1;
9637         exit(result);
9638 }
9639 EOCP
9640 set try
9641 if eval $compile_ok; then
9642         $run ./try
9643         yyy=$?
9644 else
9645         echo "(I can't seem to compile the test program--assuming it can't)"
9646         yyy=1
9647 fi
9648 case "$yyy" in
9649 0)      val="$define"
9650         echo "Yup, it can."
9651         ;;
9652 *)      val="$undef"
9653         echo "Nope, it can't."
9654         ;;
9655 esac
9656 set d_casti32
9657 eval $setvar
9658 $rm -f try try.*
9659
9660 : check for ability to cast negative floats to unsigned
9661 echo " "
9662 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9663 $cat >try.c <<EOCP
9664 #include <stdio.h>
9665 #include <sys/types.h>
9666 #include <signal.h>
9667 $signal_t blech(s) int s; { exit(7); }
9668 $signal_t blech_in_list(s) int s; { exit(4); }
9669 unsigned long dummy_long(p) unsigned long p; { return p; }
9670 unsigned int dummy_int(p) unsigned int p; { return p; }
9671 unsigned short dummy_short(p) unsigned short p; { return p; }
9672 int main()
9673 {
9674         double f;
9675         unsigned long along;
9676         unsigned int aint;
9677         unsigned short ashort;
9678         int result = 0;
9679         char str[16];
9680         
9681         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9682            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9683            optimized the whole file away
9684         */
9685         /* Store the number in a writable string for gcc to pass to 
9686            sscanf under HP/UX.
9687         */
9688         sprintf(str, "-123");
9689         sscanf(str, "%lf", &f);  /* f = -123.; */
9690
9691         signal(SIGFPE, blech);
9692         along = (unsigned long)f;
9693         aint = (unsigned int)f;
9694         ashort = (unsigned short)f;
9695         if (along != (unsigned long)-123)
9696                 result |= 1;
9697         if (aint != (unsigned int)-123)
9698                 result |= 1;
9699         if (ashort != (unsigned short)-123)
9700                 result |= 1;
9701         sprintf(str, "1073741824.");
9702         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9703         f = f + f;
9704         along = 0;
9705         along = (unsigned long)f;
9706         if (along != 0x80000000)
9707                 result |= 2;
9708         f -= 1.;
9709         along = 0;
9710         along = (unsigned long)f;
9711         if (along != 0x7fffffff)
9712                 result |= 1;
9713         f += 2.;
9714         along = 0;
9715         along = (unsigned long)f;
9716         if (along != 0x80000001)
9717                 result |= 2;
9718         if (result)
9719                 exit(result);
9720         signal(SIGFPE, blech_in_list);
9721         sprintf(str, "123.");
9722         sscanf(str, "%lf", &f);  /* f = 123.; */
9723         along = dummy_long((unsigned long)f);
9724         aint = dummy_int((unsigned int)f);
9725         ashort = dummy_short((unsigned short)f);
9726         if (along != (unsigned long)123)
9727                 result |= 4;
9728         if (aint != (unsigned int)123)
9729                 result |= 4;
9730         if (ashort != (unsigned short)123)
9731                 result |= 4;
9732         exit(result);
9733
9734 }
9735 EOCP
9736 set try
9737 if eval $compile_ok; then
9738         $run ./try
9739         castflags=$?
9740 else
9741         echo "(I can't seem to compile the test program--assuming it can't)"
9742         castflags=7
9743 fi
9744 case "$castflags" in
9745 0)      val="$define"
9746         echo "Yup, it can."
9747         ;;
9748 *)      val="$undef"
9749         echo "Nope, it can't."
9750         ;;
9751 esac
9752 set d_castneg
9753 eval $setvar
9754 $rm -f try.*
9755
9756 : see if vprintf exists
9757 echo " "
9758 if set vprintf val -f d_vprintf; eval $csym; $val; then
9759         echo 'vprintf() found.' >&4
9760         val="$define"
9761         $cat >try.c <<'EOF'
9762 #include <varargs.h>
9763
9764 int main() { xxx("foo"); }
9765
9766 xxx(va_alist)
9767 va_dcl
9768 {
9769         va_list args;
9770         char buf[10];
9771
9772         va_start(args);
9773         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9774 }
9775 EOF
9776         set try
9777         if eval $compile && $run ./try; then
9778                 echo "Your vsprintf() returns (int)." >&4
9779                 val2="$undef"
9780         else
9781                 echo "Your vsprintf() returns (char*)." >&4
9782                 val2="$define"
9783         fi
9784 else
9785         echo 'vprintf() NOT found.' >&4
9786                 val="$undef"
9787                 val2="$undef"
9788 fi
9789 $rm -f try try.*
9790 set d_vprintf
9791 eval $setvar
9792 val=$val2
9793 set d_charvspr
9794 eval $setvar
9795
9796 : see if chown exists
9797 set chown d_chown
9798 eval $inlibc
9799
9800 : see if chroot exists
9801 set chroot d_chroot
9802 eval $inlibc
9803
9804 : see if chsize exists
9805 set chsize d_chsize
9806 eval $inlibc
9807
9808 : see if class exists
9809 set class d_class
9810 eval $inlibc
9811
9812 hasstruct='varname=$1; struct=$2; shift; shift;
9813 while $test $# -ge 2; do
9814         case "$1" in
9815         $define) echo "#include <$2>";;
9816         esac ;
9817     shift 2;
9818 done > try.c;
9819 echo "int main () { struct $struct foo; }" >> try.c;
9820 set try;
9821 if eval $compile; then
9822         val="$define";
9823 else
9824         val="$undef";
9825 fi;
9826 set $varname;
9827 eval $setvar;
9828 $rm -f try.c try.o'
9829
9830 socketlib=''
9831 sockethdr=''
9832 : see whether socket exists
9833 echo " "
9834 $echo $n "Hmm... $c" >&4
9835 if set socket val -f d_socket; eval $csym; $val; then
9836         echo "Looks like you have Berkeley networking support." >&4
9837         d_socket="$define"
9838         if set setsockopt val -f; eval $csym; $val; then
9839                 d_oldsock="$undef"
9840         else
9841                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9842                 d_oldsock="$define"
9843         fi
9844 else
9845         if $contains socklib libc.list >/dev/null 2>&1; then
9846                 echo "Looks like you have Berkeley networking support." >&4
9847                 d_socket="$define"
9848                 : we will have to assume that it supports the 4.2 BSD interface
9849                 d_oldsock="$undef"
9850         else
9851                 echo "You don't have Berkeley networking in libc$_a..." >&4
9852                 if test "X$d_socket" = "X$define"; then
9853                    echo "...but you seem to believe that you have sockets." >&4
9854                 else
9855                         for net in net socket
9856                         do
9857                                 if test -f /usr/lib/lib$net$_a; then
9858                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9859                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9860                                         if $contains socket libc.list >/dev/null 2>&1; then
9861                                                 d_socket="$define"
9862                                                 socketlib="-l$net"
9863                                                 case "$net" in
9864                                                 net)
9865                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9866                                                         sockethdr="-I/usr/netinclude"
9867                                                         ;;
9868                                                 esac
9869                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9870                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9871                                                         d_oldsock="$undef"
9872                                                 else
9873                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9874                                                         d_oldsock="$define"
9875                                                 fi
9876                                                 break
9877                                         fi
9878                                 fi
9879                         done
9880                         if test "X$d_socket" != "X$define"; then
9881                            echo "or anywhere else I see." >&4
9882                            d_socket="$undef"
9883                            d_oldsock="$undef"
9884                         fi
9885                 fi
9886         fi
9887 fi
9888
9889 : see if socketpair exists
9890 set socketpair d_sockpair
9891 eval $inlibc
9892
9893
9894 echo " "
9895 echo "Checking the availability of certain socket constants..." >&4
9896 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9897         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9898         $cat >try.c <<EOF
9899 #include <sys/types.h>
9900 #include <sys/socket.h>
9901 int main() {
9902     int i = $ENUM;
9903 }
9904 EOF
9905         val="$undef"
9906         set try; if eval $compile; then
9907                 val="$define"
9908         fi
9909         set d_${enum}; eval $setvar
9910         $rm -f try.c try
9911 done
9912
9913 : see if this is a sys/uio.h system
9914 set sys/uio.h i_sysuio
9915 eval $inhdr
9916
9917
9918 echo " "
9919 echo "Checking to see if your system supports struct cmsghdr..." >&4
9920 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9921 eval $hasstruct
9922 case "$d_cmsghdr_s" in
9923 "$define")      echo "Yes, it does."   ;;
9924 *)              echo "No, it doesn't." ;;
9925 esac
9926
9927
9928 : check for const keyword
9929 echo " "
9930 echo 'Checking to see if your C compiler knows about "const"...' >&4
9931 $cat >const.c <<'EOCP'
9932 typedef struct spug { int drokk; } spug;
9933 main()
9934 {
9935         const char *foo;
9936         const spug y;
9937 }
9938 EOCP
9939 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9940         val="$define"
9941         echo "Yup, it does."
9942 else
9943         val="$undef"
9944         echo "Nope, it doesn't."
9945 fi
9946 set d_const
9947 eval $setvar
9948
9949 : see if crypt exists
9950 echo " "
9951 set crypt d_crypt
9952 eval $inlibc
9953 case "$d_crypt" in
9954 $define) cryptlib='' ;;
9955 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9956                 echo 'crypt() found.' >&4
9957                 val="$define"
9958                 cryptlib=''
9959         else
9960                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9961                 if $test -z "$cryptlib"; then
9962                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9963                 else
9964                         cryptlib=-lcrypt
9965                 fi
9966                 if $test -z "$cryptlib"; then
9967                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9968                 else
9969                         cryptlib=-lcrypt
9970                 fi
9971                 if $test -z "$cryptlib"; then
9972                         cryptlib=`./loc libcrypt$_a "" $libpth`
9973                 else
9974                         cryptlib=-lcrypt
9975                 fi
9976                 if $test -z "$cryptlib"; then
9977                         echo 'crypt() NOT found.' >&4
9978                         val="$undef"
9979                 else
9980                         val="$define"
9981                 fi
9982         fi
9983         set d_crypt
9984         eval $setvar
9985         ;;
9986 esac
9987
9988 : see if this is a crypt.h system
9989 set crypt.h i_crypt
9990 eval $inhdr
9991
9992 : see if crypt_r exists
9993 set crypt_r d_crypt_r
9994 eval $inlibc
9995 case "$d_crypt_r" in
9996 "$define")
9997         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9998         case "$d_crypt_r_proto:$usethreads" in
9999         ":define")      d_crypt_r_proto=define
10000                 set d_crypt_r_proto crypt_r $hdrs
10001                 eval $hasproto ;;
10002         *)      ;;
10003         esac
10004         case "$d_crypt_r_proto" in
10005         define)
10006         case "$crypt_r_proto" in
10007         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10008         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10009         esac
10010         case "$crypt_r_proto" in
10011         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10012         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10013         esac
10014         case "$crypt_r_proto" in
10015         ''|0)   d_crypt_r=undef
10016                 crypt_r_proto=0
10017                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10018         * )     case "$crypt_r_proto" in
10019                 REENTRANT_PROTO*) ;;
10020                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10021                 esac
10022                 echo "Prototype: $try" ;;
10023         esac
10024         ;;
10025         *)      case "$usethreads" in
10026                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10027                 esac
10028                 d_crypt_r=undef
10029                 crypt_r_proto=0
10030                 ;;
10031         esac
10032         ;;
10033 *)      crypt_r_proto=0
10034         ;;
10035 esac
10036
10037 : get csh whereabouts
10038 case "$csh" in
10039 'csh') val="$undef" ;;
10040 *) val="$define" ;;
10041 esac
10042 set d_csh
10043 eval $setvar
10044 : Respect a hint or command line value for full_csh.
10045 case "$full_csh" in
10046 '') full_csh=$csh ;;
10047 esac
10048
10049 : see if ctermid_r exists
10050 set ctermid_r d_ctermid_r
10051 eval $inlibc
10052 case "$d_ctermid_r" in
10053 "$define")
10054         hdrs="$i_systypes sys/types.h define stdio.h "
10055         case "$d_ctermid_r_proto:$usethreads" in
10056         ":define")      d_ctermid_r_proto=define
10057                 set d_ctermid_r_proto ctermid_r $hdrs
10058                 eval $hasproto ;;
10059         *)      ;;
10060         esac
10061         case "$d_ctermid_r_proto" in
10062         define)
10063         case "$ctermid_r_proto" in
10064         ''|0) try='char* ctermid_r(char*);'
10065         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10066         esac
10067         case "$ctermid_r_proto" in
10068         ''|0)   d_ctermid_r=undef
10069                 ctermid_r_proto=0
10070                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10071         * )     case "$ctermid_r_proto" in
10072                 REENTRANT_PROTO*) ;;
10073                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10074                 esac
10075                 echo "Prototype: $try" ;;
10076         esac
10077         ;;
10078         *)      case "$usethreads" in
10079                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10080                 esac
10081                 d_ctermid_r=undef
10082                 ctermid_r_proto=0
10083                 ;;
10084         esac
10085         ;;
10086 *)      ctermid_r_proto=0
10087         ;;
10088 esac
10089
10090 : see if ctime_r exists
10091 set ctime_r d_ctime_r
10092 eval $inlibc
10093 case "$d_ctime_r" in
10094 "$define")
10095         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10096         case "$d_ctime_r_proto:$usethreads" in
10097         ":define")      d_ctime_r_proto=define
10098                 set d_ctime_r_proto ctime_r $hdrs
10099                 eval $hasproto ;;
10100         *)      ;;
10101         esac
10102         case "$d_ctime_r_proto" in
10103         define)
10104         case "$ctime_r_proto" in
10105         ''|0) try='char* ctime_r(const time_t*, char*);'
10106         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10107         esac
10108         case "$ctime_r_proto" in
10109         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10110         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10111         esac
10112         case "$ctime_r_proto" in
10113         ''|0) try='int ctime_r(const time_t*, char*);'
10114         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10115         esac
10116         case "$ctime_r_proto" in
10117         ''|0) try='int ctime_r(const time_t*, char*, int);'
10118         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10119         esac
10120         case "$ctime_r_proto" in
10121         ''|0)   d_ctime_r=undef
10122                 ctime_r_proto=0
10123                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10124         * )     case "$ctime_r_proto" in
10125                 REENTRANT_PROTO*) ;;
10126                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10127                 esac
10128                 echo "Prototype: $try" ;;
10129         esac
10130         ;;
10131         *)      case "$usethreads" in
10132                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10133                 esac
10134                 d_ctime_r=undef
10135                 ctime_r_proto=0
10136                 ;;
10137         esac
10138         ;;
10139 *)      ctime_r_proto=0
10140         ;;
10141 esac
10142
10143 : see if cuserid exists
10144 set cuserid d_cuserid
10145 eval $inlibc
10146
10147 : see if this is a limits.h system
10148 set limits.h i_limits
10149 eval $inhdr
10150
10151 : see if this is a float.h system
10152 set float.h i_float
10153 eval $inhdr
10154
10155 : See if number of significant digits in a double precision number is known
10156 echo " "
10157 $cat >dbl_dig.c <<EOM
10158 #$i_limits I_LIMITS
10159 #$i_float I_FLOAT
10160 #ifdef I_LIMITS
10161 #include <limits.h>
10162 #endif
10163 #ifdef I_FLOAT
10164 #include <float.h>
10165 #endif
10166 #ifdef DBL_DIG
10167 printf("Contains DBL_DIG");
10168 #endif
10169 EOM
10170 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10171 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10172         echo "DBL_DIG found." >&4
10173         val="$define"
10174 else
10175         echo "DBL_DIG NOT found." >&4
10176         val="$undef"
10177 fi
10178 $rm -f dbl_dig.?
10179 set d_dbl_dig
10180 eval $setvar
10181
10182 : see if dbm.h is available
10183 : see if dbmclose exists
10184 set dbmclose d_dbmclose
10185 eval $inlibc
10186
10187 case "$d_dbmclose" in
10188 $define)
10189         set dbm.h i_dbm
10190         eval $inhdr
10191         case "$i_dbm" in
10192         $define)
10193                 val="$undef"
10194                 set i_rpcsvcdbm
10195                 eval $setvar
10196                 ;;
10197         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10198                 eval $inhdr
10199                 ;;
10200         esac
10201         ;;
10202 *)      echo "We won't be including <dbm.h>"
10203         val="$undef"
10204         set i_dbm
10205         eval $setvar
10206         val="$undef"
10207         set i_rpcsvcdbm
10208         eval $setvar
10209         ;;
10210 esac
10211
10212 : see if prototype for dbminit is available
10213 echo " "
10214 set d_dbminitproto dbminit $i_dbm dbm.h
10215 eval $hasproto
10216
10217 : see if difftime exists
10218 set difftime d_difftime
10219 eval $inlibc
10220
10221 : see if this is a dirent system
10222 echo " "
10223 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10224         val="$define"
10225         echo "<dirent.h> found." >&4
10226 else
10227         val="$undef"
10228         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10229                 echo "<sys/dir.h> found." >&4
10230                 echo " "
10231         else
10232                 xinc=`./findhdr sys/ndir.h`
10233         fi
10234         echo "<dirent.h> NOT found." >&4
10235 fi
10236 set i_dirent
10237 eval $setvar
10238
10239 : Look for type of directory structure.
10240 echo " "
10241 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10242
10243 case "$direntrytype" in
10244 ''|' ')
10245         case "$i_dirent" in
10246         $define) guess1='struct dirent' ;;
10247         *) guess1='struct direct'  ;;
10248         esac
10249         ;;
10250 *)      guess1="$direntrytype"
10251         ;;
10252 esac
10253
10254 case "$guess1" in
10255 'struct dirent') guess2='struct direct' ;;
10256 *) guess2='struct dirent' ;;
10257 esac
10258                 
10259 if $contains "$guess1" try.c >/dev/null 2>&1; then
10260         direntrytype="$guess1"
10261         echo "Your directory entries are $direntrytype." >&4
10262 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10263         direntrytype="$guess2"
10264         echo "Your directory entries seem to be $direntrytype." >&4
10265 else
10266         echo "I don't recognize your system's directory entries." >&4
10267         rp="What type is used for directory entries on this system?"
10268         dflt="$guess1"
10269         . ./myread
10270         direntrytype="$ans"
10271 fi
10272 $rm -f try.c
10273
10274
10275 : see if the directory entry stores field length
10276 echo " "
10277 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10278 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10279         echo "Good, your directory entry keeps length information in d_namlen." >&4
10280         val="$define"
10281 else
10282         echo "Your directory entry does not know about the d_namlen field." >&4
10283         val="$undef"
10284 fi
10285 set d_dirnamlen
10286 eval $setvar
10287 $rm -f try.c
10288
10289 : see if this is an sysdir system
10290 set sys/dir.h i_sysdir
10291 eval $inhdr
10292
10293 : see if this is an sysndir system
10294 set sys/ndir.h i_sysndir
10295 eval $inhdr
10296
10297 : Look for dirfd
10298 echo " "
10299 $cat >dirfd.c <<EOM
10300 #include <stdio.h>
10301 #$i_dirent I_DIRENT             /**/
10302 #$i_sysdir I_SYS_DIR            /**/
10303 #$i_sysndir I_SYS_NDIR          /**/
10304 #$i_systypes I_SYS_TYPES        /**/
10305 #if defined(I_SYS_TYPES)
10306 #include <sys/types.h>
10307 #endif
10308 #if defined(I_DIRENT)
10309 #include <dirent.h>
10310 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10311 #include <sys/dir.h>
10312 #endif
10313 #else
10314 #ifdef I_SYS_NDIR
10315 #include <sys/ndir.h>
10316 #else
10317 #ifdef I_SYS_DIR
10318 #ifdef hp9000s500
10319 #include <ndir.h>       /* may be wrong in the future */
10320 #else
10321 #include <sys/dir.h>
10322 #endif
10323 #endif
10324 #endif
10325 #endif 
10326 int main() {
10327         DIR *dirp = opendir(".");
10328         if (dirfd(dirp) >= 0)
10329                 exit(0);
10330         else
10331                 exit(1);
10332 }
10333 EOM
10334 set dirfd
10335 if eval $compile; then
10336         val="$define"
10337 fi
10338 case "$val" in
10339 $define)        echo "dirfd() found." >&4       ;;
10340 *)              echo "dirfd() NOT found." >&4   ;;
10341 esac
10342 set d_dirfd
10343 eval $setvar
10344 $rm -f dirfd*
10345
10346 : see if dlerror exists
10347 xxx_runnm="$runnm"
10348 runnm=false
10349 set dlerror d_dlerror
10350 eval $inlibc
10351 runnm="$xxx_runnm"
10352
10353 : see if dlfcn is available
10354 set dlfcn.h i_dlfcn
10355 eval $inhdr
10356
10357 case "$usedl" in
10358 $define|y|true)
10359         $cat << EOM
10360
10361 On a few systems, the dynamically loaded modules that perl generates and uses
10362 will need a different extension than shared libs. The default will probably
10363 be appropriate.
10364
10365 EOM
10366         case "$dlext" in
10367         '')     dflt="$so" ;;
10368         *)      dflt="$dlext" ;;
10369         esac
10370         rp='What is the extension of dynamically loaded modules'
10371         . ./myread
10372         dlext="$ans"
10373         ;;
10374 *)
10375         dlext="none"
10376         ;;
10377 esac
10378
10379 : Check if dlsym need a leading underscore
10380 echo " "
10381 val="$undef"
10382
10383 case "$dlsrc" in
10384 dl_dlopen.xs)
10385         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10386         $cat >dyna.c <<'EOM'
10387 fred () { }
10388 EOM
10389
10390 $cat >fred.c<<EOM
10391
10392 #include <stdio.h>
10393 #$i_dlfcn I_DLFCN
10394 #ifdef I_DLFCN
10395 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10396 #else
10397 #include <sys/types.h>
10398 #include <nlist.h>
10399 #include <link.h>
10400 #endif
10401
10402 extern int fred() ;
10403
10404 int main()
10405 {
10406     void * handle ;
10407     void * symbol ;
10408 #ifndef RTLD_LAZY
10409     int mode = 1 ;
10410 #else
10411     int mode = RTLD_LAZY ;
10412 #endif
10413     handle = dlopen("./dyna.$dlext", mode) ;
10414     if (handle == NULL) {
10415         printf ("1\n") ;
10416         fflush (stdout) ;
10417         exit(0);
10418     }
10419     symbol = dlsym(handle, "fred") ;
10420     if (symbol == NULL) {
10421         /* try putting a leading underscore */
10422         symbol = dlsym(handle, "_fred") ;
10423         if (symbol == NULL) {
10424             printf ("2\n") ;
10425             fflush (stdout) ;
10426             exit(0);
10427         }
10428         printf ("3\n") ;
10429     }
10430     else
10431         printf ("4\n") ;
10432     fflush (stdout) ;
10433     exit(0);
10434 }
10435 EOM
10436         : Call the object file tmp-dyna.o in case dlext=o.
10437         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10438                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10439                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10440                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10441                 xxx=`$run ./fred`
10442                 case $xxx in
10443                 1)      echo "Test program failed using dlopen." >&4
10444                         echo "Perhaps you should not use dynamic loading." >&4;;
10445                 2)      echo "Test program failed using dlsym." >&4
10446                         echo "Perhaps you should not use dynamic loading." >&4;;
10447                 3)      echo "dlsym needs a leading underscore" >&4
10448                         val="$define" ;;
10449                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10450                 esac
10451         else
10452                 echo "I can't compile and run the test program." >&4
10453                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10454         fi
10455         ;;
10456 esac
10457                 
10458 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10459
10460 set d_dlsymun
10461 eval $setvar
10462
10463 : see if drand48_r exists
10464 set drand48_r d_drand48_r
10465 eval $inlibc
10466 case "$d_drand48_r" in
10467 "$define")
10468         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10469         case "$d_drand48_r_proto:$usethreads" in
10470         ":define")      d_drand48_r_proto=define
10471                 set d_drand48_r_proto drand48_r $hdrs
10472                 eval $hasproto ;;
10473         *)      ;;
10474         esac
10475         case "$d_drand48_r_proto" in
10476         define)
10477         case "$drand48_r_proto" in
10478         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10479         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10480         esac
10481         case "$drand48_r_proto" in
10482         ''|0)   d_drand48_r=undef
10483                 drand48_r_proto=0
10484                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10485         * )     case "$drand48_r_proto" in
10486                 REENTRANT_PROTO*) ;;
10487                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10488                 esac
10489                 echo "Prototype: $try" ;;
10490         esac
10491         ;;
10492         *)      case "$usethreads" in
10493                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10494                 esac
10495                 d_drand48_r=undef
10496                 drand48_r_proto=0
10497                 ;;
10498         esac
10499         ;;
10500 *)      drand48_r_proto=0
10501         ;;
10502 esac
10503
10504 : see if prototype for drand48 is available
10505 echo " "
10506 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10507 eval $hasproto
10508
10509 : see if dup2 exists
10510 set dup2 d_dup2
10511 eval $inlibc
10512
10513 : see if eaccess exists
10514 set eaccess d_eaccess
10515 eval $inlibc
10516
10517 : see if endgrent exists
10518 set endgrent d_endgrent
10519 eval $inlibc
10520
10521 : see if this is an grp system
10522 set grp.h i_grp
10523 eval $inhdr
10524
10525 case "$i_grp" in
10526 $define)
10527         xxx=`./findhdr grp.h`
10528         $cppstdin $cppflags $cppminus < $xxx >$$.h
10529
10530         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10531                 val="$define"
10532         else
10533                 val="$undef"
10534         fi
10535         set d_grpasswd
10536         eval $setvar
10537
10538         $rm -f $$.h
10539         ;;
10540 *)
10541         val="$undef";
10542         set d_grpasswd; eval $setvar
10543         ;;
10544 esac
10545
10546 : see if endgrent_r exists
10547 set endgrent_r d_endgrent_r
10548 eval $inlibc
10549 case "$d_endgrent_r" in
10550 "$define")
10551         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10552         case "$d_endgrent_r_proto:$usethreads" in
10553         ":define")      d_endgrent_r_proto=define
10554                 set d_endgrent_r_proto endgrent_r $hdrs
10555                 eval $hasproto ;;
10556         *)      ;;
10557         esac
10558         case "$d_endgrent_r_proto" in
10559         define)
10560         case "$endgrent_r_proto" in
10561         ''|0) try='int endgrent_r(FILE**);'
10562         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10563         esac
10564         case "$endgrent_r_proto" in
10565         ''|0) try='void endgrent_r(FILE**);'
10566         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10567         esac
10568         case "$endgrent_r_proto" in
10569         ''|0)   d_endgrent_r=undef
10570                 endgrent_r_proto=0
10571                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10572         * )     case "$endgrent_r_proto" in
10573                 REENTRANT_PROTO*) ;;
10574                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10575                 esac
10576                 echo "Prototype: $try" ;;
10577         esac
10578         ;;
10579         *)      case "$usethreads" in
10580                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10581                 esac
10582                 d_endgrent_r=undef
10583                 endgrent_r_proto=0
10584                 ;;
10585         esac
10586         ;;
10587 *)      endgrent_r_proto=0
10588         ;;
10589 esac
10590
10591 : see if endhostent exists
10592 set endhostent d_endhent
10593 eval $inlibc
10594
10595 : see if this is a netdb.h system
10596 set netdb.h i_netdb
10597 eval $inhdr
10598
10599 : see if endhostent_r exists
10600 set endhostent_r d_endhostent_r
10601 eval $inlibc
10602 case "$d_endhostent_r" in
10603 "$define")
10604         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10605         case "$d_endhostent_r_proto:$usethreads" in
10606         ":define")      d_endhostent_r_proto=define
10607                 set d_endhostent_r_proto endhostent_r $hdrs
10608                 eval $hasproto ;;
10609         *)      ;;
10610         esac
10611         case "$d_endhostent_r_proto" in
10612         define)
10613         case "$endhostent_r_proto" in
10614         ''|0) try='int endhostent_r(struct hostent_data*);'
10615         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10616         esac
10617         case "$endhostent_r_proto" in
10618         ''|0) try='void endhostent_r(struct hostent_data*);'
10619         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10620         esac
10621         case "$endhostent_r_proto" in
10622         ''|0)   d_endhostent_r=undef
10623                 endhostent_r_proto=0
10624                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10625         * )     case "$endhostent_r_proto" in
10626                 REENTRANT_PROTO*) ;;
10627                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10628                 esac
10629                 echo "Prototype: $try" ;;
10630         esac
10631         ;;
10632         *)      case "$usethreads" in
10633                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10634                 esac
10635                 d_endhostent_r=undef
10636                 endhostent_r_proto=0
10637                 ;;
10638         esac
10639         ;;
10640 *)      endhostent_r_proto=0
10641         ;;
10642 esac
10643
10644 : see if endnetent exists
10645 set endnetent d_endnent
10646 eval $inlibc
10647
10648 : see if endnetent_r exists
10649 set endnetent_r d_endnetent_r
10650 eval $inlibc
10651 case "$d_endnetent_r" in
10652 "$define")
10653         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10654         case "$d_endnetent_r_proto:$usethreads" in
10655         ":define")      d_endnetent_r_proto=define
10656                 set d_endnetent_r_proto endnetent_r $hdrs
10657                 eval $hasproto ;;
10658         *)      ;;
10659         esac
10660         case "$d_endnetent_r_proto" in
10661         define)
10662         case "$endnetent_r_proto" in
10663         ''|0) try='int endnetent_r(struct netent_data*);'
10664         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10665         esac
10666         case "$endnetent_r_proto" in
10667         ''|0) try='void endnetent_r(struct netent_data*);'
10668         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10669         esac
10670         case "$endnetent_r_proto" in
10671         ''|0)   d_endnetent_r=undef
10672                 endnetent_r_proto=0
10673                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10674         * )     case "$endnetent_r_proto" in
10675                 REENTRANT_PROTO*) ;;
10676                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10677                 esac
10678                 echo "Prototype: $try" ;;
10679         esac
10680         ;;
10681         *)      case "$usethreads" in
10682                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10683                 esac
10684                 d_endnetent_r=undef
10685                 endnetent_r_proto=0
10686                 ;;
10687         esac
10688         ;;
10689 *)      endnetent_r_proto=0
10690         ;;
10691 esac
10692
10693 : see if endprotoent exists
10694 set endprotoent d_endpent
10695 eval $inlibc
10696
10697 : see if endprotoent_r exists
10698 set endprotoent_r d_endprotoent_r
10699 eval $inlibc
10700 case "$d_endprotoent_r" in
10701 "$define")
10702         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10703         case "$d_endprotoent_r_proto:$usethreads" in
10704         ":define")      d_endprotoent_r_proto=define
10705                 set d_endprotoent_r_proto endprotoent_r $hdrs
10706                 eval $hasproto ;;
10707         *)      ;;
10708         esac
10709         case "$d_endprotoent_r_proto" in
10710         define)
10711         case "$endprotoent_r_proto" in
10712         ''|0) try='int endprotoent_r(struct protoent_data*);'
10713         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10714         esac
10715         case "$endprotoent_r_proto" in
10716         ''|0) try='void endprotoent_r(struct protoent_data*);'
10717         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10718         esac
10719         case "$endprotoent_r_proto" in
10720         ''|0)   d_endprotoent_r=undef
10721                 endprotoent_r_proto=0
10722                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10723         * )     case "$endprotoent_r_proto" in
10724                 REENTRANT_PROTO*) ;;
10725                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10726                 esac
10727                 echo "Prototype: $try" ;;
10728         esac
10729         ;;
10730         *)      case "$usethreads" in
10731                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10732                 esac
10733                 d_endprotoent_r=undef
10734                 endprotoent_r_proto=0
10735                 ;;
10736         esac
10737         ;;
10738 *)      endprotoent_r_proto=0
10739         ;;
10740 esac
10741
10742 : see if endpwent exists
10743 set endpwent d_endpwent
10744 eval $inlibc
10745
10746 : see if this is a pwd.h system
10747 set pwd.h i_pwd
10748 eval $inhdr
10749
10750 case "$i_pwd" in
10751 $define)
10752         xxx=`./findhdr pwd.h`
10753         $cppstdin $cppflags $cppminus < $xxx >$$.h
10754
10755         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10756                 val="$define"
10757         else
10758                 val="$undef"
10759         fi
10760         set d_pwquota
10761         eval $setvar
10762
10763         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10764                 val="$define"
10765         else
10766                 val="$undef"
10767         fi
10768         set d_pwage
10769         eval $setvar
10770
10771         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10772                 val="$define"
10773         else
10774                 val="$undef"
10775         fi
10776         set d_pwchange
10777         eval $setvar
10778
10779         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10780                 val="$define"
10781         else
10782                 val="$undef"
10783         fi
10784         set d_pwclass
10785         eval $setvar
10786
10787         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10788                 val="$define"
10789         else
10790                 val="$undef"
10791         fi
10792         set d_pwexpire
10793         eval $setvar
10794
10795         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10796                 val="$define"
10797         else
10798                 val="$undef"
10799         fi
10800         set d_pwcomment
10801         eval $setvar
10802
10803         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10804                 val="$define"
10805         else
10806                 val="$undef"
10807         fi
10808         set d_pwgecos
10809         eval $setvar
10810
10811         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10812                 val="$define"
10813         else
10814                 val="$undef"
10815         fi
10816         set d_pwpasswd
10817         eval $setvar
10818
10819         $rm -f $$.h
10820         ;;
10821 *)
10822         val="$undef"; 
10823         set d_pwquota; eval $setvar
10824         set d_pwage; eval $setvar
10825         set d_pwchange; eval $setvar
10826         set d_pwclass; eval $setvar
10827         set d_pwexpire; eval $setvar
10828         set d_pwcomment; eval $setvar
10829         set d_pwgecos; eval $setvar
10830         set d_pwpasswd; eval $setvar
10831         ;;
10832 esac
10833
10834 : see if endpwent_r exists
10835 set endpwent_r d_endpwent_r
10836 eval $inlibc
10837 case "$d_endpwent_r" in
10838 "$define")
10839         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10840         case "$d_endpwent_r_proto:$usethreads" in
10841         ":define")      d_endpwent_r_proto=define
10842                 set d_endpwent_r_proto endpwent_r $hdrs
10843                 eval $hasproto ;;
10844         *)      ;;
10845         esac
10846         case "$d_endpwent_r_proto" in
10847         define)
10848         case "$endpwent_r_proto" in
10849         ''|0) try='int endpwent_r(FILE**);'
10850         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10851         esac
10852         case "$endpwent_r_proto" in
10853         ''|0) try='void endpwent_r(FILE**);'
10854         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10855         esac
10856         case "$endpwent_r_proto" in
10857         ''|0)   d_endpwent_r=undef
10858                 endpwent_r_proto=0
10859                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10860         * )     case "$endpwent_r_proto" in
10861                 REENTRANT_PROTO*) ;;
10862                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10863                 esac
10864                 echo "Prototype: $try" ;;
10865         esac
10866         ;;
10867         *)      case "$usethreads" in
10868                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10869                 esac
10870                 d_endpwent_r=undef
10871                 endpwent_r_proto=0
10872                 ;;
10873         esac
10874         ;;
10875 *)      endpwent_r_proto=0
10876         ;;
10877 esac
10878
10879 : see if endservent exists
10880 set endservent d_endsent
10881 eval $inlibc
10882
10883 : see if endservent_r exists
10884 set endservent_r d_endservent_r
10885 eval $inlibc
10886 case "$d_endservent_r" in
10887 "$define")
10888         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10889         case "$d_endservent_r_proto:$usethreads" in
10890         ":define")      d_endservent_r_proto=define
10891                 set d_endservent_r_proto endservent_r $hdrs
10892                 eval $hasproto ;;
10893         *)      ;;
10894         esac
10895         case "$d_endservent_r_proto" in
10896         define)
10897         case "$endservent_r_proto" in
10898         ''|0) try='int endservent_r(struct servent_data*);'
10899         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10900         esac
10901         case "$endservent_r_proto" in
10902         ''|0) try='void endservent_r(struct servent_data*);'
10903         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10904         esac
10905         case "$endservent_r_proto" in
10906         ''|0)   d_endservent_r=undef
10907                 endservent_r_proto=0
10908                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10909         * )     case "$endservent_r_proto" in
10910                 REENTRANT_PROTO*) ;;
10911                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10912                 esac
10913                 echo "Prototype: $try" ;;
10914         esac
10915         ;;
10916         *)      case "$usethreads" in
10917                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10918                 esac
10919                 d_endservent_r=undef
10920                 endservent_r_proto=0
10921                 ;;
10922         esac
10923         ;;
10924 *)      endservent_r_proto=0
10925         ;;
10926 esac
10927
10928 : Locate the flags for 'open()'
10929 echo " "
10930 $cat >try.c <<'EOCP'
10931 #include <sys/types.h>
10932 #ifdef I_FCNTL
10933 #include <fcntl.h>
10934 #endif
10935 #ifdef I_SYS_FILE
10936 #include <sys/file.h>
10937 #endif
10938 int main() {
10939         if(O_RDONLY);
10940 #ifdef O_TRUNC
10941         exit(0);
10942 #else
10943         exit(1);
10944 #endif
10945 }
10946 EOCP
10947 : check sys/file.h first to get FREAD on Sun
10948 if $test `./findhdr sys/file.h` && \
10949                 set try -DI_SYS_FILE && eval $compile; then
10950         h_sysfile=true;
10951         echo "<sys/file.h> defines the O_* constants..." >&4
10952         if $run ./try; then
10953                 echo "and you have the 3 argument form of open()." >&4
10954                 val="$define"
10955         else
10956                 echo "but not the 3 argument form of open().  Oh, well." >&4
10957                 val="$undef"
10958         fi
10959 elif $test `./findhdr fcntl.h` && \
10960                 set try -DI_FCNTL && eval $compile; then
10961         h_fcntl=true;
10962         echo "<fcntl.h> defines the O_* constants..." >&4
10963         if $run ./try; then
10964                 echo "and you have the 3 argument form of open()." >&4
10965                 val="$define"
10966         else
10967                 echo "but not the 3 argument form of open().  Oh, well." >&4
10968                 val="$undef"
10969         fi
10970 else
10971         val="$undef"
10972         echo "I can't find the O_* constant definitions!  You got problems." >&4
10973 fi
10974 set d_open3
10975 eval $setvar
10976 $rm -f try try.*
10977
10978 : see which of string.h or strings.h is needed
10979 echo " "
10980 strings=`./findhdr string.h`
10981 if $test "$strings" && $test -r "$strings"; then
10982         echo "Using <string.h> instead of <strings.h>." >&4
10983         val="$define"
10984 else
10985         val="$undef"
10986         strings=`./findhdr strings.h`
10987         if $test "$strings" && $test -r "$strings"; then
10988                 echo "Using <strings.h> instead of <string.h>." >&4
10989         else
10990                 echo "No string header found -- You'll surely have problems." >&4
10991         fi
10992 fi
10993 set i_string
10994 eval $setvar
10995 case "$i_string" in
10996 "$undef") strings=`./findhdr strings.h`;;
10997 *)        strings=`./findhdr string.h`;;
10998 esac
10999
11000 : see if this is a sys/file.h system
11001 val=''
11002 set sys/file.h val
11003 eval $inhdr
11004
11005 : do we need to include sys/file.h ?
11006 case "$val" in
11007 "$define")
11008         echo " "
11009         if $h_sysfile; then
11010                 val="$define"
11011                 echo "We'll be including <sys/file.h>." >&4
11012         else
11013                 val="$undef"
11014                 echo "We won't be including <sys/file.h>." >&4
11015         fi
11016         ;;
11017 *)
11018         h_sysfile=false
11019         ;;
11020 esac
11021 set i_sysfile
11022 eval $setvar
11023
11024 : see if fcntl.h is there
11025 val=''
11026 set fcntl.h val
11027 eval $inhdr
11028
11029 : see if we can include fcntl.h
11030 case "$val" in
11031 "$define")
11032         echo " "
11033         if $h_fcntl; then
11034                 val="$define"
11035                 echo "We'll be including <fcntl.h>." >&4
11036         else
11037                 val="$undef"
11038                 if $h_sysfile; then
11039         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11040                 else
11041                         echo "We won't be including <fcntl.h>." >&4
11042                 fi
11043         fi
11044         ;;
11045 *)
11046         h_fcntl=false
11047         val="$undef"
11048         ;;
11049 esac
11050 set i_fcntl
11051 eval $setvar
11052
11053 : check for non-blocking I/O stuff
11054 case "$h_sysfile" in
11055 true) echo "#include <sys/file.h>" > head.c;;
11056 *)
11057        case "$h_fcntl" in
11058        true) echo "#include <fcntl.h>" > head.c;;
11059        *) echo "#include <sys/fcntl.h>" > head.c;;
11060        esac
11061        ;;
11062 esac
11063 echo " "
11064 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11065 case "$o_nonblock" in
11066 '')
11067         $cat head.c > try.c
11068         $cat >>try.c <<EOCP
11069 #include <stdio.h>
11070 #include <stdlib.h>
11071 #$i_fcntl I_FCNTL
11072 #ifdef I_FCNTL
11073 #include <fcntl.h>
11074 #endif
11075 int main() {
11076 #ifdef O_NONBLOCK
11077         printf("O_NONBLOCK\n");
11078         exit(0);
11079 #endif
11080 #ifdef O_NDELAY
11081         printf("O_NDELAY\n");
11082         exit(0);
11083 #endif
11084 #ifdef FNDELAY
11085         printf("FNDELAY\n");
11086         exit(0);
11087 #endif
11088         exit(0);
11089 }
11090 EOCP
11091         set try
11092         if eval $compile_ok; then
11093                 o_nonblock=`$run ./try`
11094                 case "$o_nonblock" in
11095                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11096                 *) echo "Seems like we can use $o_nonblock.";;
11097                 esac
11098         else
11099                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11100         fi
11101         ;;
11102 *) echo "Using $hint value $o_nonblock.";;
11103 esac
11104 $rm -f try try.* .out core
11105
11106 echo " "
11107 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11108 case "$eagain" in
11109 '')
11110         $cat head.c > try.c
11111         $cat >>try.c <<EOCP
11112 #include <errno.h>
11113 #include <sys/types.h>
11114 #include <signal.h>
11115 #include <stdio.h> 
11116 #include <stdlib.h> 
11117 #$i_fcntl I_FCNTL
11118 #ifdef I_FCNTL
11119 #include <fcntl.h>
11120 #endif
11121 #define MY_O_NONBLOCK $o_nonblock
11122 #ifndef errno  /* XXX need better Configure test */
11123 extern int errno;
11124 #endif
11125 #$i_unistd I_UNISTD
11126 #ifdef I_UNISTD
11127 #include <unistd.h>
11128 #endif
11129 #$i_string I_STRING
11130 #ifdef I_STRING
11131 #include <string.h>
11132 #else
11133 #include <strings.h>
11134 #endif
11135 $signal_t blech(x) int x; { exit(3); }
11136 EOCP
11137         $cat >> try.c <<'EOCP'
11138 int main()
11139 {
11140         int pd[2];
11141         int pu[2];
11142         char buf[1];
11143         char string[100];
11144
11145         pipe(pd);       /* Down: child -> parent */
11146         pipe(pu);       /* Up: parent -> child */
11147         if (0 != fork()) {
11148                 int ret;
11149                 close(pd[1]);   /* Parent reads from pd[0] */
11150                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11151 #ifdef F_SETFL
11152                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11153                         exit(1);
11154 #else
11155                 exit(4);
11156 #endif
11157                 signal(SIGALRM, blech);
11158                 alarm(5);
11159                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11160                         exit(2);
11161                 sprintf(string, "%d\n", ret);
11162                 write(2, string, strlen(string));
11163                 alarm(0);
11164 #ifdef EAGAIN
11165                 if (errno == EAGAIN) {
11166                         printf("EAGAIN\n");
11167                         goto ok;
11168                 }
11169 #endif
11170 #ifdef EWOULDBLOCK
11171                 if (errno == EWOULDBLOCK)
11172                         printf("EWOULDBLOCK\n");
11173 #endif
11174         ok:
11175                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11176                 sleep(2);                               /* Give it time to close our pipe */
11177                 alarm(5);
11178                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11179                 alarm(0);
11180                 sprintf(string, "%d\n", ret);
11181                 write(4, string, strlen(string));
11182                 exit(0);
11183         }
11184
11185         close(pd[0]);                   /* We write to pd[1] */
11186         close(pu[1]);                   /* We read from pu[0] */
11187         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11188         close(pd[1]);                   /* Pipe pd is now fully closed! */
11189         exit(0);                                /* Bye bye, thank you for playing! */
11190 }
11191 EOCP
11192         set try
11193         if eval $compile_ok; then
11194                 echo "$startsh" >mtry
11195                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11196                 chmod +x mtry
11197                 ./mtry >/dev/null 2>&1
11198                 case $? in
11199                 0) eagain=`$cat try.out`;;
11200                 1) echo "Could not perform non-blocking setting!";;
11201                 2) echo "I did a successful read() for something that was not there!";;
11202                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11203                 4) echo "Could not find F_SETFL!";;
11204                 *) echo "Something terribly wrong happened during testing.";;
11205                 esac
11206                 rd_nodata=`$cat try.ret`
11207                 echo "A read() system call with no data present returns $rd_nodata."
11208                 case "$rd_nodata" in
11209                 0|-1) ;;
11210                 *)
11211                         echo "(That's peculiar, fixing that to be -1.)"
11212                         rd_nodata=-1
11213                         ;;
11214                 esac
11215                 case "$eagain" in
11216                 '')
11217                         echo "Forcing errno EAGAIN on read() with no data available."
11218                         eagain=EAGAIN
11219                         ;;
11220                 *)
11221                         echo "Your read() sets errno to $eagain when no data is available."
11222                         ;;
11223                 esac
11224                 status=`$cat try.err`
11225                 case "$status" in
11226                 0) echo "And it correctly returns 0 to signal EOF.";;
11227                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11228                 *) echo "However, your read() returns '$status' on EOF??";;
11229                 esac
11230                 val="$define"
11231                 if test "$status" = "$rd_nodata"; then
11232                         echo "WARNING: you can't distinguish between EOF and no data!"
11233                         val="$undef"
11234                 fi
11235         else
11236                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11237                 eagain=EAGAIN
11238         fi
11239         set d_eofnblk
11240         eval $setvar
11241         ;;
11242 *)
11243         echo "Using $hint value $eagain."
11244         echo "Your read() returns $rd_nodata when no data is present."
11245         case "$d_eofnblk" in
11246         "$define") echo "And you can see EOF because read() returns 0.";;
11247         "$undef") echo "But you can't see EOF status from read() returned value.";;
11248         *)
11249                 echo "(Assuming you can't see EOF status from read anyway.)"
11250                 d_eofnblk=$undef
11251                 ;;
11252         esac
11253         ;;
11254 esac
11255 $rm -f try try.* .out core head.c mtry
11256
11257 : see if fchdir exists
11258 set fchdir d_fchdir
11259 eval $inlibc
11260
11261 : see if fchmod exists
11262 set fchmod d_fchmod
11263 eval $inlibc
11264
11265 : see if fchown exists
11266 set fchown d_fchown
11267 eval $inlibc
11268
11269 : see if this is an fcntl system
11270 set fcntl d_fcntl
11271 eval $inlibc
11272
11273 echo " "
11274 : See if fcntl-based locking works.
11275 $cat >try.c <<EOCP
11276 #include <stdlib.h>
11277 #include <unistd.h>
11278 #include <fcntl.h>
11279 #include <signal.h>
11280 $signal_t blech(x) int x; { exit(3); }
11281 int main() {
11282 #if defined(F_SETLK) && defined(F_SETLKW)
11283      struct flock flock;
11284      int retval, fd;
11285      fd = open("try.c", O_RDONLY);
11286      flock.l_type = F_RDLCK;
11287      flock.l_whence = SEEK_SET;
11288      flock.l_start = flock.l_len = 0;
11289      signal(SIGALRM, blech);
11290      alarm(10);
11291      retval = fcntl(fd, F_SETLK, &flock);
11292      close(fd);
11293      (retval < 0 ? exit(2) : exit(0));
11294 #else
11295      exit(2);
11296 #endif
11297 }
11298 EOCP
11299 echo "Checking if fcntl-based file locking works... "
11300 case "$d_fcntl" in
11301 "$define")
11302         set try
11303         if eval $compile_ok; then
11304                 if $run ./try; then
11305                         echo "Yes, it seems to work."
11306                         val="$define"
11307                 else
11308                         echo "Nope, it didn't work."
11309                         val="$undef"
11310                         case "$?" in
11311                         3) $cat >&4 <<EOM
11312 ***
11313 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11314 *** This is (almost) impossible.
11315 *** If your NFS lock daemons are not feeling well, something like
11316 *** this may happen, please investigate.  Cannot continue, aborting.
11317 ***
11318 EOM
11319                                 exit 1
11320                                 ;;
11321                         esac
11322                 fi
11323         else
11324                 echo "I'm unable to compile the test program, so I'll assume not."
11325                 val="$undef"
11326         fi
11327         ;;
11328 *) val="$undef";
11329         echo "Nope, since you don't even have fcntl()."
11330         ;;
11331 esac
11332 set d_fcntl_can_lock
11333 eval $setvar
11334 $rm -f try*
11335
11336
11337 : check for fd_set items
11338 $cat <<EOM
11339
11340 Checking to see how well your C compiler handles fd_set and friends ...
11341 EOM
11342 $cat >try.c <<EOCP
11343 #$i_systime I_SYS_TIME
11344 #$i_sysselct I_SYS_SELECT
11345 #$d_socket HAS_SOCKET
11346 #include <sys/types.h>
11347 #ifdef HAS_SOCKET
11348 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11349 #endif
11350 #ifdef I_SYS_TIME
11351 #include <sys/time.h>
11352 #endif
11353 #ifdef I_SYS_SELECT
11354 #include <sys/select.h>
11355 #endif
11356 int main() {
11357         fd_set fds;
11358
11359 #ifdef TRYBITS
11360         if(fds.fds_bits);
11361 #endif
11362
11363 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11364         exit(0);
11365 #else
11366         exit(1);
11367 #endif
11368 }
11369 EOCP
11370 set try -DTRYBITS
11371 if eval $compile; then
11372         d_fds_bits="$define"
11373         d_fd_set="$define"
11374         echo "Well, your system knows about the normal fd_set typedef..." >&4
11375         if $run ./try; then
11376                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11377                 d_fd_macros="$define"
11378         else
11379                 $cat >&4 <<'EOM'
11380 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11381 EOM
11382                 d_fd_macros="$undef"
11383         fi
11384 else
11385         $cat <<'EOM'
11386 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11387 EOM
11388         set try
11389         if eval $compile; then
11390                 d_fds_bits="$undef"
11391                 d_fd_set="$define"
11392                 echo "Well, your system has some sort of fd_set available..." >&4
11393                 if $run ./try; then
11394                         echo "and you have the normal fd_set macros." >&4
11395                         d_fd_macros="$define"
11396                 else
11397                         $cat <<'EOM'
11398 but not the normal fd_set macros!  Gross!  More work for me...
11399 EOM
11400                         d_fd_macros="$undef"
11401                 fi
11402         else
11403         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11404                 d_fd_set="$undef"
11405                 d_fds_bits="$undef"
11406                 d_fd_macros="$undef"
11407         fi
11408 fi
11409 $rm -f try try.*
11410
11411 : see if fgetpos exists
11412 set fgetpos d_fgetpos
11413 eval $inlibc
11414
11415 : see if finite exists
11416 set finite d_finite
11417 eval $inlibc
11418
11419 : see if finitel exists
11420 set finitel d_finitel
11421 eval $inlibc
11422
11423 : see if flock exists
11424 set flock d_flock
11425 eval $inlibc
11426
11427 : see if prototype for flock is available
11428 echo " "
11429 set d_flockproto flock $i_sysfile sys/file.h
11430 eval $hasproto
11431
11432 : see if fork exists
11433 set fork d_fork
11434 eval $inlibc
11435
11436 : see if fp_class exists
11437 set fp_class d_fp_class
11438 eval $inlibc
11439
11440 : see if pathconf exists
11441 set pathconf d_pathconf
11442 eval $inlibc
11443
11444 : see if fpathconf exists
11445 set fpathconf d_fpathconf
11446 eval $inlibc
11447
11448 : see if fpclass exists
11449 set fpclass d_fpclass
11450 eval $inlibc
11451
11452 : see if fpclassify exists
11453 set fpclassify d_fpclassify
11454 eval $inlibc
11455
11456 : see if fpclassl exists
11457 set fpclassl d_fpclassl
11458 eval $inlibc
11459
11460
11461 : check for fpos64_t
11462 echo " "
11463 echo "Checking to see if you have fpos64_t..." >&4
11464 $cat >try.c <<EOCP
11465 #include <stdio.h>
11466 int main() { fpos64_t x = 7; }
11467 EOCP
11468 set try
11469 if eval $compile; then
11470         val="$define"
11471         echo "You have fpos64_t."
11472 else
11473         val="$undef"
11474         echo "You do not have fpos64_t."
11475         case "$fpossize" in
11476         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11477         esac
11478 fi
11479 $rm -f try.* try
11480 set d_fpos64_t
11481 eval $setvar
11482
11483 : see if frexpl exists
11484 set frexpl d_frexpl
11485 eval $inlibc
11486
11487 : see if this is a sys/param system
11488 set sys/param.h i_sysparam
11489 eval $inhdr
11490
11491 : see if this is a sys/mount.h system
11492 set sys/mount.h i_sysmount
11493 eval $inhdr
11494
11495
11496 echo " "
11497 echo "Checking to see if your system supports struct fs_data..." >&4
11498 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11499 eval $hasstruct
11500 case "$d_fs_data_s" in
11501 "$define")      echo "Yes, it does."   ;;
11502 *)              echo "No, it doesn't." ;;
11503 esac
11504
11505 : see if fseeko exists
11506 set fseeko d_fseeko
11507 eval $inlibc
11508 case "$longsize" in
11509 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11510 esac
11511
11512 : see if fsetpos exists
11513 set fsetpos d_fsetpos
11514 eval $inlibc
11515
11516
11517 : see if fstatfs exists
11518 set fstatfs d_fstatfs
11519 eval $inlibc
11520
11521
11522 : see if statvfs exists
11523 set statvfs d_statvfs
11524 eval $inlibc
11525
11526 : see if fstatvfs exists
11527 set fstatvfs d_fstatvfs
11528 eval $inlibc
11529
11530
11531 : see if fsync exists
11532 set fsync d_fsync
11533 eval $inlibc
11534
11535 : see if ftello exists
11536 set ftello d_ftello
11537 eval $inlibc
11538 case "$longsize" in
11539 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11540 esac
11541
11542 : see if getcwd exists
11543 set getcwd d_getcwd
11544 eval $inlibc
11545
11546 : see if getespwnam exists
11547 set getespwnam d_getespwnam
11548 eval $inlibc
11549
11550
11551 : see if getfsstat exists
11552 set getfsstat d_getfsstat
11553 eval $inlibc
11554
11555 : see if getgrent exists
11556 set getgrent d_getgrent
11557 eval $inlibc
11558
11559 : see if getgrent_r exists
11560 set getgrent_r d_getgrent_r
11561 eval $inlibc
11562 case "$d_getgrent_r" in
11563 "$define")
11564         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11565         case "$d_getgrent_r_proto:$usethreads" in
11566         ":define")      d_getgrent_r_proto=define
11567                 set d_getgrent_r_proto getgrent_r $hdrs
11568                 eval $hasproto ;;
11569         *)      ;;
11570         esac
11571         case "$d_getgrent_r_proto" in
11572         define)
11573         case "$getgrent_r_proto" in
11574         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11575         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11576         esac
11577         case "$getgrent_r_proto" in
11578         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11579         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11580         esac
11581         case "$getgrent_r_proto" in
11582         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11583         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11584         esac
11585         case "$getgrent_r_proto" in
11586         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11587         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11588         esac
11589         case "$getgrent_r_proto" in
11590         ''|0) try='int getgrent_r(struct group*, char*, int);'
11591         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11592         esac
11593         case "$getgrent_r_proto" in
11594         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11595         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11596         esac
11597         case "$getgrent_r_proto" in
11598         ''|0)   d_getgrent_r=undef
11599                 getgrent_r_proto=0
11600                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11601         * )     case "$getgrent_r_proto" in
11602                 REENTRANT_PROTO*) ;;
11603                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11604                 esac
11605                 echo "Prototype: $try" ;;
11606         esac
11607         ;;
11608         *)      case "$usethreads" in
11609                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11610                 esac
11611                 d_getgrent_r=undef
11612                 getgrent_r_proto=0
11613                 ;;
11614         esac
11615         ;;
11616 *)      getgrent_r_proto=0
11617         ;;
11618 esac
11619
11620 : see if getgrgid_r exists
11621 set getgrgid_r d_getgrgid_r
11622 eval $inlibc
11623 case "$d_getgrgid_r" in
11624 "$define")
11625         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11626         case "$d_getgrgid_r_proto:$usethreads" in
11627         ":define")      d_getgrgid_r_proto=define
11628                 set d_getgrgid_r_proto getgrgid_r $hdrs
11629                 eval $hasproto ;;
11630         *)      ;;
11631         esac
11632         case "$d_getgrgid_r_proto" in
11633         define)
11634         case "$getgrgid_r_proto" in
11635         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11636         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11637         esac
11638         case "$getgrgid_r_proto" in
11639         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11640         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11641         esac
11642         case "$getgrgid_r_proto" in
11643         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11644         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11645         esac
11646         case "$getgrgid_r_proto" in
11647         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11648         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11649         esac
11650         case "$getgrgid_r_proto" in
11651         ''|0)   d_getgrgid_r=undef
11652                 getgrgid_r_proto=0
11653                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11654         * )     case "$getgrgid_r_proto" in
11655                 REENTRANT_PROTO*) ;;
11656                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11657                 esac
11658                 echo "Prototype: $try" ;;
11659         esac
11660         ;;
11661         *)      case "$usethreads" in
11662                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11663                 esac
11664                 d_getgrgid_r=undef
11665                 getgrgid_r_proto=0
11666                 ;;
11667         esac
11668         ;;
11669 *)      getgrgid_r_proto=0
11670         ;;
11671 esac
11672
11673 : see if getgrnam_r exists
11674 set getgrnam_r d_getgrnam_r
11675 eval $inlibc
11676 case "$d_getgrnam_r" in
11677 "$define")
11678         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11679         case "$d_getgrnam_r_proto:$usethreads" in
11680         ":define")      d_getgrnam_r_proto=define
11681                 set d_getgrnam_r_proto getgrnam_r $hdrs
11682                 eval $hasproto ;;
11683         *)      ;;
11684         esac
11685         case "$d_getgrnam_r_proto" in
11686         define)
11687         case "$getgrnam_r_proto" in
11688         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11689         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11690         esac
11691         case "$getgrnam_r_proto" in
11692         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11693         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11694         esac
11695         case "$getgrnam_r_proto" in
11696         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11697         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11698         esac
11699         case "$getgrnam_r_proto" in
11700         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11701         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11702         esac
11703         case "$getgrnam_r_proto" in
11704         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11705         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11706         esac
11707         case "$getgrnam_r_proto" in
11708         ''|0)   d_getgrnam_r=undef
11709                 getgrnam_r_proto=0
11710                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11711         * )     case "$getgrnam_r_proto" in
11712                 REENTRANT_PROTO*) ;;
11713                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11714                 esac
11715                 echo "Prototype: $try" ;;
11716         esac
11717         ;;
11718         *)      case "$usethreads" in
11719                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11720                 esac
11721                 d_getgrnam_r=undef
11722                 getgrnam_r_proto=0
11723                 ;;
11724         esac
11725         ;;
11726 *)      getgrnam_r_proto=0
11727         ;;
11728 esac
11729
11730 : see if gethostbyaddr exists
11731 set gethostbyaddr d_gethbyaddr
11732 eval $inlibc
11733
11734 : see if gethostbyname exists
11735 set gethostbyname d_gethbyname
11736 eval $inlibc
11737
11738 : see if gethostent exists
11739 set gethostent d_gethent
11740 eval $inlibc
11741
11742 : see how we will look up host name
11743 echo " "
11744 call=''
11745 if set gethostname val -f d_gethname; eval $csym; $val; then
11746         echo 'gethostname() found.' >&4
11747         d_gethname="$define"
11748         call=gethostname
11749 fi
11750 if set uname val -f d_uname; eval $csym; $val; then
11751         if ./xenix; then
11752                 $cat <<'EOM'
11753 uname() was found, but you're running xenix, and older versions of xenix
11754 have a broken uname(). If you don't really know whether your xenix is old
11755 enough to have a broken system call, use the default answer.
11756
11757 EOM
11758                 dflt=y
11759                 case "$d_uname" in
11760                 "$define") dflt=n;;
11761                 esac
11762                 rp='Is your uname() broken?'
11763                 . ./myread
11764                 case "$ans" in
11765                 n*) d_uname="$define"; call=uname;;
11766                 esac
11767         else
11768                 echo 'uname() found.' >&4
11769                 d_uname="$define"
11770                 case "$call" in
11771                 '') call=uname ;;
11772                 esac
11773         fi
11774 fi
11775 case "$d_gethname" in
11776 '') d_gethname="$undef";;
11777 esac
11778 case "$d_uname" in
11779 '') d_uname="$undef";;
11780 esac
11781 case "$d_uname$d_gethname" in
11782 *define*)
11783         dflt=n
11784         cat <<EOM
11785  
11786 Every now and then someone has a $call() that lies about the hostname
11787 but can't be fixed for political or economic reasons.  If you wish, I can
11788 pretend $call() isn't there and maybe compute hostname at run-time
11789 thanks to the '$phostname' command.
11790
11791 EOM
11792         rp="Shall I ignore $call() from now on?"
11793         . ./myread
11794         case "$ans" in
11795         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11796         esac;;
11797 esac
11798 case "$phostname" in
11799 '') aphostname='';;
11800 *) case "$aphostname" in
11801         /*) ;;
11802         *) set X $phostname
11803                 shift
11804                 file=$1
11805                 shift
11806                 file=`./loc $file $file $pth`
11807                 aphostname=`echo $file $*`
11808                 ;;
11809         esac
11810         ;;
11811 esac
11812 case "$d_uname$d_gethname" in
11813 *define*) ;;
11814 *)
11815         case "$phostname" in
11816         '')
11817                 echo "There will be no way for $package to get your hostname." >&4;;
11818         *)
11819         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11820                 ;;
11821         esac;;
11822 esac
11823 case "$d_phostname" in
11824 '') d_phostname="$undef";;
11825 esac
11826
11827 : see if gethostbyaddr_r exists
11828 set gethostbyaddr_r d_gethostbyaddr_r
11829 eval $inlibc
11830 case "$d_gethostbyaddr_r" in
11831 "$define")
11832         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11833         case "$d_gethostbyaddr_r_proto:$usethreads" in
11834         ":define")      d_gethostbyaddr_r_proto=define
11835                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11836                 eval $hasproto ;;
11837         *)      ;;
11838         esac
11839         case "$d_gethostbyaddr_r_proto" in
11840         define)
11841         case "$gethostbyaddr_r_proto" in
11842         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11843         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11844         esac
11845         case "$gethostbyaddr_r_proto" in
11846         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11847         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11848         esac
11849         case "$gethostbyaddr_r_proto" in
11850         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11851         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11852         esac
11853         case "$gethostbyaddr_r_proto" in
11854         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11855         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11856         esac
11857         case "$gethostbyaddr_r_proto" in
11858         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11859         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11860         esac
11861         case "$gethostbyaddr_r_proto" in
11862         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11863         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11864         esac
11865         case "$gethostbyaddr_r_proto" in
11866         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11867         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11868         esac
11869         case "$gethostbyaddr_r_proto" in
11870         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11871         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11872         esac
11873         case "$gethostbyaddr_r_proto" in
11874         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11875         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11876         esac
11877         case "$gethostbyaddr_r_proto" in
11878         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11879         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11880         esac
11881         case "$gethostbyaddr_r_proto" in
11882         ''|0)   d_gethostbyaddr_r=undef
11883                 gethostbyaddr_r_proto=0
11884                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11885         * )     case "$gethostbyaddr_r_proto" in
11886                 REENTRANT_PROTO*) ;;
11887                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11888                 esac
11889                 echo "Prototype: $try" ;;
11890         esac
11891         ;;
11892         *)      case "$usethreads" in
11893                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11894                 esac
11895                 d_gethostbyaddr_r=undef
11896                 gethostbyaddr_r_proto=0
11897                 ;;
11898         esac
11899         ;;
11900 *)      gethostbyaddr_r_proto=0
11901         ;;
11902 esac
11903
11904 : see if gethostbyname_r exists
11905 set gethostbyname_r d_gethostbyname_r
11906 eval $inlibc
11907 case "$d_gethostbyname_r" in
11908 "$define")
11909         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11910         case "$d_gethostbyname_r_proto:$usethreads" in
11911         ":define")      d_gethostbyname_r_proto=define
11912                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11913                 eval $hasproto ;;
11914         *)      ;;
11915         esac
11916         case "$d_gethostbyname_r_proto" in
11917         define)
11918         case "$gethostbyname_r_proto" in
11919         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11920         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11921         esac
11922         case "$gethostbyname_r_proto" in
11923         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11924         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11925         esac
11926         case "$gethostbyname_r_proto" in
11927         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11928         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11929         esac
11930         case "$gethostbyname_r_proto" in
11931         ''|0)   d_gethostbyname_r=undef
11932                 gethostbyname_r_proto=0
11933                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11934         * )     case "$gethostbyname_r_proto" in
11935                 REENTRANT_PROTO*) ;;
11936                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11937                 esac
11938                 echo "Prototype: $try" ;;
11939         esac
11940         ;;
11941         *)      case "$usethreads" in
11942                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11943                 esac
11944                 d_gethostbyname_r=undef
11945                 gethostbyname_r_proto=0
11946                 ;;
11947         esac
11948         ;;
11949 *)      gethostbyname_r_proto=0
11950         ;;
11951 esac
11952
11953 : see if gethostent_r exists
11954 set gethostent_r d_gethostent_r
11955 eval $inlibc
11956 case "$d_gethostent_r" in
11957 "$define")
11958         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11959         case "$d_gethostent_r_proto:$usethreads" in
11960         ":define")      d_gethostent_r_proto=define
11961                 set d_gethostent_r_proto gethostent_r $hdrs
11962                 eval $hasproto ;;
11963         *)      ;;
11964         esac
11965         case "$d_gethostent_r_proto" in
11966         define)
11967         case "$gethostent_r_proto" in
11968         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11969         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11970         esac
11971         case "$gethostent_r_proto" in
11972         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11973         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11974         esac
11975         case "$gethostent_r_proto" in
11976         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11977         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11978         esac
11979         case "$gethostent_r_proto" in
11980         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11981         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11982         esac
11983         case "$gethostent_r_proto" in
11984         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11985         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11986         esac
11987         case "$gethostent_r_proto" in
11988         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11989         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11990         esac
11991         case "$gethostent_r_proto" in
11992         ''|0)   d_gethostent_r=undef
11993                 gethostent_r_proto=0
11994                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11995         * )     case "$gethostent_r_proto" in
11996                 REENTRANT_PROTO*) ;;
11997                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11998                 esac
11999                 echo "Prototype: $try" ;;
12000         esac
12001         ;;
12002         *)      case "$usethreads" in
12003                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12004                 esac
12005                 d_gethostent_r=undef
12006                 gethostent_r_proto=0
12007                 ;;
12008         esac
12009         ;;
12010 *)      gethostent_r_proto=0
12011         ;;
12012 esac
12013
12014 : see if prototypes for various gethostxxx netdb.h functions are available
12015 echo " "
12016 set d_gethostprotos gethostent $i_netdb netdb.h
12017 eval $hasproto
12018
12019 : see if getitimer exists
12020 set getitimer d_getitimer
12021 eval $inlibc
12022
12023 : see if getlogin exists
12024 set getlogin d_getlogin
12025 eval $inlibc
12026
12027 : see if getlogin_r exists
12028 set getlogin_r d_getlogin_r
12029 eval $inlibc
12030 case "$d_getlogin_r" in
12031 "$define")
12032         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12033         case "$d_getlogin_r_proto:$usethreads" in
12034         ":define")      d_getlogin_r_proto=define
12035                 set d_getlogin_r_proto getlogin_r $hdrs
12036                 eval $hasproto ;;
12037         *)      ;;
12038         esac
12039         case "$d_getlogin_r_proto" in
12040         define)
12041         case "$getlogin_r_proto" in
12042         ''|0) try='int getlogin_r(char*, size_t);'
12043         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12044         esac
12045         case "$getlogin_r_proto" in
12046         ''|0) try='int getlogin_r(char*, int);'
12047         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12048         esac
12049         case "$getlogin_r_proto" in
12050         ''|0) try='char* getlogin_r(char*, size_t);'
12051         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12052         esac
12053         case "$getlogin_r_proto" in
12054         ''|0) try='char* getlogin_r(char*, int);'
12055         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12056         esac
12057         case "$getlogin_r_proto" in
12058         ''|0)   d_getlogin_r=undef
12059                 getlogin_r_proto=0
12060                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12061         * )     case "$getlogin_r_proto" in
12062                 REENTRANT_PROTO*) ;;
12063                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12064                 esac
12065                 echo "Prototype: $try" ;;
12066         esac
12067         ;;
12068         *)      case "$usethreads" in
12069                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12070                 esac
12071                 d_getlogin_r=undef
12072                 getlogin_r_proto=0
12073                 ;;
12074         esac
12075         ;;
12076 *)      getlogin_r_proto=0
12077         ;;
12078 esac
12079
12080 : see if getmnt exists
12081 set getmnt d_getmnt
12082 eval $inlibc
12083
12084 : see if getmntent exists
12085 set getmntent d_getmntent
12086 eval $inlibc
12087
12088 : see if getnetbyaddr exists
12089 set getnetbyaddr d_getnbyaddr
12090 eval $inlibc
12091
12092 : see if getnetbyname exists
12093 set getnetbyname d_getnbyname
12094 eval $inlibc
12095
12096 : see if getnetent exists
12097 set getnetent d_getnent
12098 eval $inlibc
12099
12100 : see if getnetbyaddr_r exists
12101 set getnetbyaddr_r d_getnetbyaddr_r
12102 eval $inlibc
12103 case "$d_getnetbyaddr_r" in
12104 "$define")
12105         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12106         case "$d_getnetbyaddr_r_proto:$usethreads" in
12107         ":define")      d_getnetbyaddr_r_proto=define
12108                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12109                 eval $hasproto ;;
12110         *)      ;;
12111         esac
12112         case "$d_getnetbyaddr_r_proto" in
12113         define)
12114         case "$getnetbyaddr_r_proto" in
12115         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12116         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12117         esac
12118         case "$getnetbyaddr_r_proto" in
12119         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12120         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12121         esac
12122         case "$getnetbyaddr_r_proto" in
12123         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12124         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12125         esac
12126         case "$getnetbyaddr_r_proto" in
12127         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12128         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12129         esac
12130         case "$getnetbyaddr_r_proto" in
12131         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12132         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12133         esac
12134         case "$getnetbyaddr_r_proto" in
12135         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12136         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12137         esac
12138         case "$getnetbyaddr_r_proto" in
12139         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12140         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12141         esac
12142         case "$getnetbyaddr_r_proto" in
12143         ''|0)   d_getnetbyaddr_r=undef
12144                 getnetbyaddr_r_proto=0
12145                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12146         * )     case "$getnetbyaddr_r_proto" in
12147                 REENTRANT_PROTO*) ;;
12148                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12149                 esac
12150                 echo "Prototype: $try" ;;
12151         esac
12152         ;;
12153         *)      case "$usethreads" in
12154                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12155                 esac
12156                 d_getnetbyaddr_r=undef
12157                 getnetbyaddr_r_proto=0
12158                 ;;
12159         esac
12160         ;;
12161 *)      getnetbyaddr_r_proto=0
12162         ;;
12163 esac
12164
12165 : see if getnetbyname_r exists
12166 set getnetbyname_r d_getnetbyname_r
12167 eval $inlibc
12168 case "$d_getnetbyname_r" in
12169 "$define")
12170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12171         case "$d_getnetbyname_r_proto:$usethreads" in
12172         ":define")      d_getnetbyname_r_proto=define
12173                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12174                 eval $hasproto ;;
12175         *)      ;;
12176         esac
12177         case "$d_getnetbyname_r_proto" in
12178         define)
12179         case "$getnetbyname_r_proto" in
12180         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12181         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12182         esac
12183         case "$getnetbyname_r_proto" in
12184         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12185         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12186         esac
12187         case "$getnetbyname_r_proto" in
12188         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12189         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12190         esac
12191         case "$getnetbyname_r_proto" in
12192         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12193         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12194         esac
12195         case "$getnetbyname_r_proto" in
12196         ''|0)   d_getnetbyname_r=undef
12197                 getnetbyname_r_proto=0
12198                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12199         * )     case "$getnetbyname_r_proto" in
12200                 REENTRANT_PROTO*) ;;
12201                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12202                 esac
12203                 echo "Prototype: $try" ;;
12204         esac
12205         ;;
12206         *)      case "$usethreads" in
12207                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12208                 esac
12209                 d_getnetbyname_r=undef
12210                 getnetbyname_r_proto=0
12211                 ;;
12212         esac
12213         ;;
12214 *)      getnetbyname_r_proto=0
12215         ;;
12216 esac
12217
12218 : see if getnetent_r exists
12219 set getnetent_r d_getnetent_r
12220 eval $inlibc
12221 case "$d_getnetent_r" in
12222 "$define")
12223         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12224         case "$d_getnetent_r_proto:$usethreads" in
12225         ":define")      d_getnetent_r_proto=define
12226                 set d_getnetent_r_proto getnetent_r $hdrs
12227                 eval $hasproto ;;
12228         *)      ;;
12229         esac
12230         case "$d_getnetent_r_proto" in
12231         define)
12232         case "$getnetent_r_proto" in
12233         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12234         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12235         esac
12236         case "$getnetent_r_proto" in
12237         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12238         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12239         esac
12240         case "$getnetent_r_proto" in
12241         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12242         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12243         esac
12244         case "$getnetent_r_proto" in
12245         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12246         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12247         esac
12248         case "$getnetent_r_proto" in
12249         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12250         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12251         esac
12252         case "$getnetent_r_proto" in
12253         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12254         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12255         esac
12256         case "$getnetent_r_proto" in
12257         ''|0)   d_getnetent_r=undef
12258                 getnetent_r_proto=0
12259                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12260         * )     case "$getnetent_r_proto" in
12261                 REENTRANT_PROTO*) ;;
12262                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12263                 esac
12264                 echo "Prototype: $try" ;;
12265         esac
12266         ;;
12267         *)      case "$usethreads" in
12268                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12269                 esac
12270                 d_getnetent_r=undef
12271                 getnetent_r_proto=0
12272                 ;;
12273         esac
12274         ;;
12275 *)      getnetent_r_proto=0
12276         ;;
12277 esac
12278
12279 : see if prototypes for various getnetxxx netdb.h functions are available
12280 echo " "
12281 set d_getnetprotos getnetent $i_netdb netdb.h
12282 eval $hasproto
12283
12284 : see if getpagesize exists
12285 set getpagesize d_getpagsz
12286 eval $inlibc
12287
12288
12289 : see if getprotobyname exists
12290 set getprotobyname d_getpbyname
12291 eval $inlibc
12292
12293 : see if getprotobynumber exists
12294 set getprotobynumber d_getpbynumber
12295 eval $inlibc
12296
12297 : see if getprotoent exists
12298 set getprotoent d_getpent
12299 eval $inlibc
12300
12301 : see if getpgid exists
12302 set getpgid d_getpgid
12303 eval $inlibc
12304
12305 : see if getpgrp2 exists
12306 set getpgrp2 d_getpgrp2
12307 eval $inlibc
12308
12309 : see if getppid exists
12310 set getppid d_getppid
12311 eval $inlibc
12312
12313 : see if getpriority exists
12314 set getpriority d_getprior
12315 eval $inlibc
12316
12317 : see if getprotobyname_r exists
12318 set getprotobyname_r d_getprotobyname_r
12319 eval $inlibc
12320 case "$d_getprotobyname_r" in
12321 "$define")
12322         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12323         case "$d_getprotobyname_r_proto:$usethreads" in
12324         ":define")      d_getprotobyname_r_proto=define
12325                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12326                 eval $hasproto ;;
12327         *)      ;;
12328         esac
12329         case "$d_getprotobyname_r_proto" in
12330         define)
12331         case "$getprotobyname_r_proto" in
12332         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12333         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12334         esac
12335         case "$getprotobyname_r_proto" in
12336         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12337         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12338         esac
12339         case "$getprotobyname_r_proto" in
12340         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12341         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12342         esac
12343         case "$getprotobyname_r_proto" in
12344         ''|0)   d_getprotobyname_r=undef
12345                 getprotobyname_r_proto=0
12346                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12347         * )     case "$getprotobyname_r_proto" in
12348                 REENTRANT_PROTO*) ;;
12349                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12350                 esac
12351                 echo "Prototype: $try" ;;
12352         esac
12353         ;;
12354         *)      case "$usethreads" in
12355                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12356                 esac
12357                 d_getprotobyname_r=undef
12358                 getprotobyname_r_proto=0
12359                 ;;
12360         esac
12361         ;;
12362 *)      getprotobyname_r_proto=0
12363         ;;
12364 esac
12365
12366 : see if getprotobynumber_r exists
12367 set getprotobynumber_r d_getprotobynumber_r
12368 eval $inlibc
12369 case "$d_getprotobynumber_r" in
12370 "$define")
12371         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12372         case "$d_getprotobynumber_r_proto:$usethreads" in
12373         ":define")      d_getprotobynumber_r_proto=define
12374                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12375                 eval $hasproto ;;
12376         *)      ;;
12377         esac
12378         case "$d_getprotobynumber_r_proto" in
12379         define)
12380         case "$getprotobynumber_r_proto" in
12381         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12382         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12383         esac
12384         case "$getprotobynumber_r_proto" in
12385         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12386         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12387         esac
12388         case "$getprotobynumber_r_proto" in
12389         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12390         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12391         esac
12392         case "$getprotobynumber_r_proto" in
12393         ''|0)   d_getprotobynumber_r=undef
12394                 getprotobynumber_r_proto=0
12395                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12396         * )     case "$getprotobynumber_r_proto" in
12397                 REENTRANT_PROTO*) ;;
12398                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12399                 esac
12400                 echo "Prototype: $try" ;;
12401         esac
12402         ;;
12403         *)      case "$usethreads" in
12404                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12405                 esac
12406                 d_getprotobynumber_r=undef
12407                 getprotobynumber_r_proto=0
12408                 ;;
12409         esac
12410         ;;
12411 *)      getprotobynumber_r_proto=0
12412         ;;
12413 esac
12414
12415 : see if getprotoent_r exists
12416 set getprotoent_r d_getprotoent_r
12417 eval $inlibc
12418 case "$d_getprotoent_r" in
12419 "$define")
12420         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12421         case "$d_getprotoent_r_proto:$usethreads" in
12422         ":define")      d_getprotoent_r_proto=define
12423                 set d_getprotoent_r_proto getprotoent_r $hdrs
12424                 eval $hasproto ;;
12425         *)      ;;
12426         esac
12427         case "$d_getprotoent_r_proto" in
12428         define)
12429         case "$getprotoent_r_proto" in
12430         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12431         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12432         esac
12433         case "$getprotoent_r_proto" in
12434         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12435         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12436         esac
12437         case "$getprotoent_r_proto" in
12438         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12439         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12440         esac
12441         case "$getprotoent_r_proto" in
12442         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12443         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12444         esac
12445         case "$getprotoent_r_proto" in
12446         ''|0)   d_getprotoent_r=undef
12447                 getprotoent_r_proto=0
12448                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12449         * )     case "$getprotoent_r_proto" in
12450                 REENTRANT_PROTO*) ;;
12451                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12452                 esac
12453                 echo "Prototype: $try" ;;
12454         esac
12455         ;;
12456         *)      case "$usethreads" in
12457                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12458                 esac
12459                 d_getprotoent_r=undef
12460                 getprotoent_r_proto=0
12461                 ;;
12462         esac
12463         ;;
12464 *)      getprotoent_r_proto=0
12465         ;;
12466 esac
12467
12468 : see if prototypes for various getprotoxxx netdb.h functions are available
12469 echo " "
12470 set d_getprotoprotos getprotoent $i_netdb netdb.h
12471 eval $hasproto
12472
12473 : see if getprpwnam exists
12474 set getprpwnam d_getprpwnam
12475 eval $inlibc
12476
12477 : see if getpwent exists
12478 set getpwent d_getpwent
12479 eval $inlibc
12480
12481 : see if getpwent_r exists
12482 set getpwent_r d_getpwent_r
12483 eval $inlibc
12484 case "$d_getpwent_r" in
12485 "$define")
12486         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12487         case "$d_getpwent_r_proto:$usethreads" in
12488         ":define")      d_getpwent_r_proto=define
12489                 set d_getpwent_r_proto getpwent_r $hdrs
12490                 eval $hasproto ;;
12491         *)      ;;
12492         esac
12493         case "$d_getpwent_r_proto" in
12494         define)
12495         case "$getpwent_r_proto" in
12496         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12497         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12498         esac
12499         case "$getpwent_r_proto" in
12500         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12501         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12502         esac
12503         case "$getpwent_r_proto" in
12504         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12505         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12506         esac
12507         case "$getpwent_r_proto" in
12508         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12509         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12510         esac
12511         case "$getpwent_r_proto" in
12512         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12513         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12514         esac
12515         case "$getpwent_r_proto" in
12516         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12517         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12518         esac
12519         case "$getpwent_r_proto" in
12520         ''|0)   d_getpwent_r=undef
12521                 getpwent_r_proto=0
12522                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12523         * )     case "$getpwent_r_proto" in
12524                 REENTRANT_PROTO*) ;;
12525                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12526                 esac
12527                 echo "Prototype: $try" ;;
12528         esac
12529         ;;
12530         *)      case "$usethreads" in
12531                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12532                 esac
12533                 d_getpwent_r=undef
12534                 getpwent_r_proto=0
12535                 ;;
12536         esac
12537         ;;
12538 *)      getpwent_r_proto=0
12539         ;;
12540 esac
12541
12542 : see if getpwnam_r exists
12543 set getpwnam_r d_getpwnam_r
12544 eval $inlibc
12545 case "$d_getpwnam_r" in
12546 "$define")
12547         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12548         case "$d_getpwnam_r_proto:$usethreads" in
12549         ":define")      d_getpwnam_r_proto=define
12550                 set d_getpwnam_r_proto getpwnam_r $hdrs
12551                 eval $hasproto ;;
12552         *)      ;;
12553         esac
12554         case "$d_getpwnam_r_proto" in
12555         define)
12556         case "$getpwnam_r_proto" in
12557         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12558         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12559         esac
12560         case "$getpwnam_r_proto" in
12561         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12562         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12563         esac
12564         case "$getpwnam_r_proto" in
12565         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12566         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12567         esac
12568         case "$getpwnam_r_proto" in
12569         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12570         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12571         esac
12572         case "$getpwnam_r_proto" in
12573         ''|0)   d_getpwnam_r=undef
12574                 getpwnam_r_proto=0
12575                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12576         * )     case "$getpwnam_r_proto" in
12577                 REENTRANT_PROTO*) ;;
12578                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12579                 esac
12580                 echo "Prototype: $try" ;;
12581         esac
12582         ;;
12583         *)      case "$usethreads" in
12584                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12585                 esac
12586                 d_getpwnam_r=undef
12587                 getpwnam_r_proto=0
12588                 ;;
12589         esac
12590         ;;
12591 *)      getpwnam_r_proto=0
12592         ;;
12593 esac
12594
12595 : see if getpwuid_r exists
12596 set getpwuid_r d_getpwuid_r
12597 eval $inlibc
12598 case "$d_getpwuid_r" in
12599 "$define")
12600         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12601         case "$d_getpwuid_r_proto:$usethreads" in
12602         ":define")      d_getpwuid_r_proto=define
12603                 set d_getpwuid_r_proto getpwuid_r $hdrs
12604                 eval $hasproto ;;
12605         *)      ;;
12606         esac
12607         case "$d_getpwuid_r_proto" in
12608         define)
12609         case "$getpwuid_r_proto" in
12610         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12611         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12612         esac
12613         case "$getpwuid_r_proto" in
12614         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12615         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12616         esac
12617         case "$getpwuid_r_proto" in
12618         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12619         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12620         esac
12621         case "$getpwuid_r_proto" in
12622         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12623         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12624         esac
12625         case "$getpwuid_r_proto" in
12626         ''|0)   d_getpwuid_r=undef
12627                 getpwuid_r_proto=0
12628                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12629         * )     case "$getpwuid_r_proto" in
12630                 REENTRANT_PROTO*) ;;
12631                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12632                 esac
12633                 echo "Prototype: $try" ;;
12634         esac
12635         ;;
12636         *)      case "$usethreads" in
12637                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12638                 esac
12639                 d_getpwuid_r=undef
12640                 getpwuid_r_proto=0
12641                 ;;
12642         esac
12643         ;;
12644 *)      getpwuid_r_proto=0
12645         ;;
12646 esac
12647
12648
12649 : see if getservbyname exists
12650 set getservbyname d_getsbyname
12651 eval $inlibc
12652
12653 : see if getservbyport exists
12654 set getservbyport d_getsbyport
12655 eval $inlibc
12656
12657 : see if getservent exists
12658 set getservent d_getsent
12659 eval $inlibc
12660
12661 : see if getservbyname_r exists
12662 set getservbyname_r d_getservbyname_r
12663 eval $inlibc
12664 case "$d_getservbyname_r" in
12665 "$define")
12666         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12667         case "$d_getservbyname_r_proto:$usethreads" in
12668         ":define")      d_getservbyname_r_proto=define
12669                 set d_getservbyname_r_proto getservbyname_r $hdrs
12670                 eval $hasproto ;;
12671         *)      ;;
12672         esac
12673         case "$d_getservbyname_r_proto" in
12674         define)
12675         case "$getservbyname_r_proto" in
12676         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12677         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12678         esac
12679         case "$getservbyname_r_proto" in
12680         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12681         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12682         esac
12683         case "$getservbyname_r_proto" in
12684         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12685         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12686         esac
12687         case "$getservbyname_r_proto" in
12688         ''|0)   d_getservbyname_r=undef
12689                 getservbyname_r_proto=0
12690                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12691         * )     case "$getservbyname_r_proto" in
12692                 REENTRANT_PROTO*) ;;
12693                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12694                 esac
12695                 echo "Prototype: $try" ;;
12696         esac
12697         ;;
12698         *)      case "$usethreads" in
12699                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12700                 esac
12701                 d_getservbyname_r=undef
12702                 getservbyname_r_proto=0
12703                 ;;
12704         esac
12705         ;;
12706 *)      getservbyname_r_proto=0
12707         ;;
12708 esac
12709
12710 : see if getservbyport_r exists
12711 set getservbyport_r d_getservbyport_r
12712 eval $inlibc
12713 case "$d_getservbyport_r" in
12714 "$define")
12715         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12716         case "$d_getservbyport_r_proto:$usethreads" in
12717         ":define")      d_getservbyport_r_proto=define
12718                 set d_getservbyport_r_proto getservbyport_r $hdrs
12719                 eval $hasproto ;;
12720         *)      ;;
12721         esac
12722         case "$d_getservbyport_r_proto" in
12723         define)
12724         case "$getservbyport_r_proto" in
12725         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12726         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12727         esac
12728         case "$getservbyport_r_proto" in
12729         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12730         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12731         esac
12732         case "$getservbyport_r_proto" in
12733         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12734         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12735         esac
12736         case "$getservbyport_r_proto" in
12737         ''|0)   d_getservbyport_r=undef
12738                 getservbyport_r_proto=0
12739                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12740         * )     case "$getservbyport_r_proto" in
12741                 REENTRANT_PROTO*) ;;
12742                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12743                 esac
12744                 echo "Prototype: $try" ;;
12745         esac
12746         ;;
12747         *)      case "$usethreads" in
12748                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12749                 esac
12750                 d_getservbyport_r=undef
12751                 getservbyport_r_proto=0
12752                 ;;
12753         esac
12754         ;;
12755 *)      getservbyport_r_proto=0
12756         ;;
12757 esac
12758
12759 : see if getservent_r exists
12760 set getservent_r d_getservent_r
12761 eval $inlibc
12762 case "$d_getservent_r" in
12763 "$define")
12764         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12765         case "$d_getservent_r_proto:$usethreads" in
12766         ":define")      d_getservent_r_proto=define
12767                 set d_getservent_r_proto getservent_r $hdrs
12768                 eval $hasproto ;;
12769         *)      ;;
12770         esac
12771         case "$d_getservent_r_proto" in
12772         define)
12773         case "$getservent_r_proto" in
12774         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12775         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12776         esac
12777         case "$getservent_r_proto" in
12778         ''|0) try='int getservent_r(struct servent*, char*, int);'
12779         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12780         esac
12781         case "$getservent_r_proto" in
12782         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12783         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12784         esac
12785         case "$getservent_r_proto" in
12786         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12787         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12788         esac
12789         case "$getservent_r_proto" in
12790         ''|0)   d_getservent_r=undef
12791                 getservent_r_proto=0
12792                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12793         * )     case "$getservent_r_proto" in
12794                 REENTRANT_PROTO*) ;;
12795                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12796                 esac
12797                 echo "Prototype: $try" ;;
12798         esac
12799         ;;
12800         *)      case "$usethreads" in
12801                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12802                 esac
12803                 d_getservent_r=undef
12804                 getservent_r_proto=0
12805                 ;;
12806         esac
12807         ;;
12808 *)      getservent_r_proto=0
12809         ;;
12810 esac
12811
12812 : see if prototypes for various getservxxx netdb.h functions are available
12813 echo " "
12814 set d_getservprotos getservent $i_netdb netdb.h
12815 eval $hasproto
12816
12817 : see if getspnam exists
12818 set getspnam d_getspnam
12819 eval $inlibc
12820
12821 : see if this is a shadow.h system
12822 set shadow.h i_shadow
12823 eval $inhdr
12824
12825 : see if getspnam_r exists
12826 set getspnam_r d_getspnam_r
12827 eval $inlibc
12828 case "$d_getspnam_r" in
12829 "$define")
12830         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12831         case "$d_getspnam_r_proto:$usethreads" in
12832         ":define")      d_getspnam_r_proto=define
12833                 set d_getspnam_r_proto getspnam_r $hdrs
12834                 eval $hasproto ;;
12835         *)      ;;
12836         esac
12837         case "$d_getspnam_r_proto" in
12838         define)
12839         case "$getspnam_r_proto" in
12840         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12841         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12842         esac
12843         case "$getspnam_r_proto" in
12844         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12845         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12846         esac
12847         case "$getspnam_r_proto" in
12848         ''|0)   d_getspnam_r=undef
12849                 getspnam_r_proto=0
12850                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12851         * )     case "$getspnam_r_proto" in
12852                 REENTRANT_PROTO*) ;;
12853                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12854                 esac
12855                 echo "Prototype: $try" ;;
12856         esac
12857         ;;
12858         *)      case "$usethreads" in
12859                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12860                 esac
12861                 d_getspnam_r=undef
12862                 getspnam_r_proto=0
12863                 ;;
12864         esac
12865         ;;
12866 *)      getspnam_r_proto=0
12867         ;;
12868 esac
12869
12870 : see if gettimeofday or ftime exists
12871 set gettimeofday d_gettimeod
12872 eval $inlibc
12873 case "$d_gettimeod" in
12874 "$undef")
12875         set ftime d_ftime 
12876         eval $inlibc
12877         ;;
12878 *)
12879         val="$undef"; set d_ftime; eval $setvar
12880         ;;
12881 esac
12882 case "$d_gettimeod$d_ftime" in
12883 "$undef$undef")
12884         echo " "
12885         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12886         ;;
12887 esac
12888
12889 : see if gmtime_r exists
12890 set gmtime_r d_gmtime_r
12891 eval $inlibc
12892 case "$d_gmtime_r" in
12893 "$define")
12894         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12895         case "$d_gmtime_r_proto:$usethreads" in
12896         ":define")      d_gmtime_r_proto=define
12897                 set d_gmtime_r_proto gmtime_r $hdrs
12898                 eval $hasproto ;;
12899         *)      ;;
12900         esac
12901         case "$d_gmtime_r_proto" in
12902         define)
12903         case "$gmtime_r_proto" in
12904         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12905         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12906         esac
12907         case "$gmtime_r_proto" in
12908         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12909         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12910         esac
12911         case "$gmtime_r_proto" in
12912         ''|0)   d_gmtime_r=undef
12913                 gmtime_r_proto=0
12914                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12915         * )     case "$gmtime_r_proto" in
12916                 REENTRANT_PROTO*) ;;
12917                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12918                 esac
12919                 echo "Prototype: $try" ;;
12920         esac
12921         ;;
12922         *)      case "$usethreads" in
12923                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12924                 esac
12925                 d_gmtime_r=undef
12926                 gmtime_r_proto=0
12927                 ;;
12928         esac
12929         ;;
12930 *)      gmtime_r_proto=0
12931         ;;
12932 esac
12933
12934 : see if hasmntopt exists
12935 set hasmntopt d_hasmntopt
12936 eval $inlibc
12937
12938 : see if this is a netinet/in.h or sys/in.h system
12939 set netinet/in.h i_niin sys/in.h i_sysin
12940 eval $inhdr
12941
12942 : see if arpa/inet.h has to be included
12943 set arpa/inet.h i_arpainet
12944 eval $inhdr
12945
12946 : see if htonl --and friends-- exists
12947 val=''
12948 set htonl val
12949 eval $inlibc
12950
12951 : Maybe they are macros.
12952 case "$val" in
12953 $undef)
12954         $cat >htonl.c <<EOM
12955 #include <stdio.h>
12956 #include <sys/types.h>
12957 #$i_niin I_NETINET_IN
12958 #$i_sysin I_SYS_IN
12959 #$i_arpainet I_ARPA_INET
12960 #ifdef I_NETINET_IN
12961 #include <netinet/in.h>
12962 #endif
12963 #ifdef I_SYS_IN
12964 #include <sys/in.h>
12965 #endif
12966 #ifdef I_ARPA_INET
12967 #include <arpa/inet.h>
12968 #endif
12969 #ifdef htonl
12970 printf("Defined as a macro.");
12971 #endif
12972 EOM
12973         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12974         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12975                 val="$define"
12976                 echo "But it seems to be defined as a macro." >&4
12977         fi
12978         $rm -f htonl.?
12979         ;;
12980 esac
12981 set d_htonl
12982 eval $setvar
12983
12984 : index or strchr
12985 echo " "
12986 if set index val -f; eval $csym; $val; then
12987         if set strchr val -f d_strchr; eval $csym; $val; then
12988                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12989                         val="$define"
12990                         vali="$undef"
12991                         echo "strchr() found." >&4
12992                 else
12993                         val="$undef"
12994                         vali="$define"
12995                         echo "index() found." >&4
12996                 fi
12997         else
12998                 val="$undef"
12999                 vali="$define"
13000                 echo "index() found." >&4
13001         fi
13002 else
13003         if set strchr val -f d_strchr; eval $csym; $val; then
13004                 val="$define"
13005                 vali="$undef"
13006                 echo "strchr() found." >&4
13007         else
13008                 echo "No index() or strchr() found!" >&4
13009                 val="$undef"
13010                 vali="$undef"
13011         fi
13012 fi
13013 set d_strchr; eval $setvar
13014 val="$vali"
13015 set d_index; eval $setvar
13016
13017 : check whether inet_aton exists
13018 set inet_aton d_inetaton
13019 eval $inlibc
13020
13021 : Look for isascii
13022 echo " "
13023 $cat >isascii.c <<'EOCP'
13024 #include <stdio.h>
13025 #include <ctype.h>
13026 int main() {
13027         int c = 'A';
13028         if (isascii(c))
13029                 exit(0);
13030         else
13031                 exit(1);
13032 }
13033 EOCP
13034 set isascii
13035 if eval $compile; then
13036         echo "isascii() found." >&4
13037         val="$define"
13038 else
13039         echo "isascii() NOT found." >&4
13040         val="$undef"
13041 fi
13042 set d_isascii
13043 eval $setvar
13044 $rm -f isascii*
13045
13046 : see if isfinite exists
13047 set isfinite d_isfinite
13048 eval $inlibc
13049
13050 : see if isinf exists
13051 set isinf d_isinf
13052 eval $inlibc
13053
13054 : see if isnan exists
13055 set isnan d_isnan
13056 eval $inlibc
13057
13058 : see if isnanl exists
13059 set isnanl d_isnanl
13060 eval $inlibc
13061
13062 : see if killpg exists
13063 set killpg d_killpg
13064 eval $inlibc
13065
13066 : see if lchown exists
13067 echo " "
13068 $cat > try.c <<'EOCP'
13069 /* System header to define __stub macros and hopefully few prototypes,
13070     which can conflict with char lchown(); below.  */
13071 #include <assert.h>
13072 /* Override any gcc2 internal prototype to avoid an error.  */
13073 /* We use char because int might match the return type of a gcc2
13074    builtin and then its argument prototype would still apply.  */
13075 char lchown();
13076 int main() {
13077     /*  The GNU C library defines this for functions which it implements
13078         to always fail with ENOSYS.  Some functions are actually named
13079         something starting with __ and the normal name is an alias.  */
13080 #if defined (__stub_lchown) || defined (__stub___lchown)
13081 choke me
13082 #else
13083 lchown();
13084 #endif
13085 ; return 0; }
13086 EOCP
13087 set try
13088 if eval $compile; then
13089     $echo "lchown() found." >&4
13090     val="$define"
13091 else
13092     $echo "lchown() NOT found." >&4
13093     val="$undef"
13094 fi
13095 set d_lchown
13096 eval $setvar
13097
13098 : See if number of significant digits in a double precision number is known
13099 echo " "
13100 $cat >ldbl_dig.c <<EOM
13101 #$i_limits I_LIMITS
13102 #$i_float I_FLOAT
13103 #ifdef I_LIMITS
13104 #include <limits.h>
13105 #endif
13106 #ifdef I_FLOAT
13107 #include <float.h>
13108 #endif
13109 #ifdef LDBL_DIG
13110 printf("Contains LDBL_DIG");
13111 #endif
13112 EOM
13113 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13114 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13115         echo "LDBL_DIG found." >&4
13116         val="$define"
13117 else
13118         echo "LDBL_DIG NOT found." >&4
13119         val="$undef"
13120 fi
13121 $rm -f ldbl_dig.?
13122 set d_ldbl_dig
13123 eval $setvar
13124
13125 : see if link exists
13126 set link d_link
13127 eval $inlibc
13128
13129 : see if localtime_r exists
13130 set localtime_r d_localtime_r
13131 eval $inlibc
13132 case "$d_localtime_r" in
13133 "$define")
13134         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13135         case "$d_localtime_r_proto:$usethreads" in
13136         ":define")      d_localtime_r_proto=define
13137                 set d_localtime_r_proto localtime_r $hdrs
13138                 eval $hasproto ;;
13139         *)      ;;
13140         esac
13141         case "$d_localtime_r_proto" in
13142         define)
13143         case "$localtime_r_proto" in
13144         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13145         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13146         esac
13147         case "$localtime_r_proto" in
13148         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13149         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13150         esac
13151         case "$localtime_r_proto" in
13152         ''|0)   d_localtime_r=undef
13153                 localtime_r_proto=0
13154                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13155         * )     case "$localtime_r_proto" in
13156                 REENTRANT_PROTO*) ;;
13157                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13158                 esac
13159                 echo "Prototype: $try" ;;
13160         esac
13161         ;;
13162         *)      case "$usethreads" in
13163                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13164                 esac
13165                 d_localtime_r=undef
13166                 localtime_r_proto=0
13167                 ;;
13168         esac
13169         ;;
13170 *)      localtime_r_proto=0
13171         ;;
13172 esac
13173
13174 : see if localeconv exists
13175 set localeconv d_locconv
13176 eval $inlibc
13177
13178 : see if lockf exists
13179 set lockf d_lockf
13180 eval $inlibc
13181
13182 : see if prototype for lseek is available
13183 echo " "
13184 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13185 eval $hasproto
13186
13187 : see if lstat exists
13188 set lstat d_lstat
13189 eval $inlibc
13190
13191 : see if madvise exists
13192 set madvise d_madvise
13193 eval $inlibc
13194
13195 : see if mblen exists
13196 set mblen d_mblen
13197 eval $inlibc
13198
13199 : see if mbstowcs exists
13200 set mbstowcs d_mbstowcs
13201 eval $inlibc
13202
13203 : see if mbtowc exists
13204 set mbtowc d_mbtowc
13205 eval $inlibc
13206
13207 : see if memchr exists
13208 set memchr d_memchr
13209 eval $inlibc
13210
13211 : see if memcmp exists
13212 set memcmp d_memcmp
13213 eval $inlibc
13214
13215 : see if memcpy exists
13216 set memcpy d_memcpy
13217 eval $inlibc
13218
13219 : see if memmove exists
13220 set memmove d_memmove
13221 eval $inlibc
13222
13223 : see if memset exists
13224 set memset d_memset
13225 eval $inlibc
13226
13227 : see if mkdir exists
13228 set mkdir d_mkdir
13229 eval $inlibc
13230
13231 : see if mkdtemp exists
13232 set mkdtemp d_mkdtemp
13233 eval $inlibc
13234
13235 : see if mkfifo exists
13236 set mkfifo d_mkfifo
13237 eval $inlibc
13238
13239 : see if mkstemp exists
13240 set mkstemp d_mkstemp
13241 eval $inlibc
13242
13243 : see if mkstemps exists
13244 set mkstemps d_mkstemps
13245 eval $inlibc
13246
13247 : see if mktime exists
13248 set mktime d_mktime
13249 eval $inlibc
13250
13251 : see if this is a sys/mman.h system
13252 set sys/mman.h i_sysmman
13253 eval $inhdr
13254
13255 : see if mmap exists
13256 set mmap d_mmap
13257 eval $inlibc
13258 : see what shmat returns
13259 : default to something harmless
13260 mmaptype='void *'
13261 case "$i_sysmman$d_mmap" in
13262 "$define$define")
13263         $cat >mmap.c <<'END'
13264 #include <sys/mman.h>
13265 void *mmap();
13266 END
13267         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13268                 mmaptype='void *'
13269         else
13270                 mmaptype='caddr_t'
13271         fi
13272         echo "and it returns ($mmaptype)." >&4
13273         ;;
13274 esac
13275
13276
13277
13278 : see if mprotect exists
13279 set mprotect d_mprotect
13280 eval $inlibc
13281
13282 : see if msgctl exists
13283 set msgctl d_msgctl
13284 eval $inlibc
13285
13286 : see if msgget exists
13287 set msgget d_msgget
13288 eval $inlibc
13289
13290 : see if msgsnd exists
13291 set msgsnd d_msgsnd
13292 eval $inlibc
13293
13294 : see if msgrcv exists
13295 set msgrcv d_msgrcv
13296 eval $inlibc
13297
13298 : see how much of the 'msg*(2)' library is present.
13299 h_msg=true
13300 echo " "
13301 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13302 *"$undef"*) h_msg=false;;
13303 esac
13304 case "$osname" in
13305 freebsd)
13306     case "`ipcs 2>&1`" in
13307     "SVID messages"*"not configured"*)
13308         echo "Your $osname does not have the msg*(2) configured." >&4
13309         h_msg=false
13310         val="$undef"
13311         set msgctl d_msgctl
13312         eval $setvar
13313         set msgget d_msgget
13314         eval $setvar
13315         set msgsnd d_msgsnd
13316         eval $setvar
13317         set msgrcv d_msgrcv
13318         eval $setvar
13319         ;;
13320     esac
13321     ;;
13322 esac
13323 : we could also check for sys/ipc.h ...
13324 if $h_msg && $test `./findhdr sys/msg.h`; then
13325         echo "You have the full msg*(2) library." >&4
13326         val="$define"
13327 else
13328         echo "You don't have the full msg*(2) library." >&4
13329         val="$undef"
13330 fi
13331 set d_msg
13332 eval $setvar
13333
13334
13335 echo " "
13336 echo "Checking to see if your system supports struct msghdr..." >&4
13337 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13338 eval $hasstruct
13339 case "$d_msghdr_s" in
13340 "$define")      echo "Yes, it does."   ;;
13341 *)              echo "No, it doesn't." ;;
13342 esac
13343
13344
13345 : see if msync exists
13346 set msync d_msync
13347 eval $inlibc
13348
13349 : see if munmap exists
13350 set munmap d_munmap
13351 eval $inlibc
13352
13353 : see if nice exists
13354 set nice d_nice
13355 eval $inlibc
13356
13357 : see if this is a langinfo.h system
13358 set langinfo.h i_langinfo
13359 eval $inhdr
13360
13361 : see if nl_langinfo exists
13362 set nl_langinfo d_nl_langinfo
13363 eval $inlibc
13364
13365 : check for length of character
13366 echo " "
13367 case "$charsize" in
13368 '')
13369         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13370         $cat >try.c <<'EOCP'
13371 #include <stdio.h>
13372 int main()
13373 {
13374     printf("%d\n", (int)sizeof(char));
13375     exit(0);
13376 }
13377 EOCP
13378         set try
13379         if eval $compile_ok; then
13380                 dflt=`$run ./try`
13381         else
13382                 dflt='1'
13383                 echo "(I can't seem to compile the test program.  Guessing...)"
13384         fi
13385         ;;
13386 *)
13387         dflt="$charsize"
13388         ;;
13389 esac
13390 rp="What is the size of a character (in bytes)?"
13391 . ./myread
13392 charsize="$ans"
13393 $rm -f try.c try
13394
13395 : check for volatile keyword
13396 echo " "
13397 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13398 $cat >try.c <<'EOCP'
13399 main()
13400 {
13401         typedef struct _goo_struct goo_struct;
13402         goo_struct * volatile goo = ((goo_struct *)0);
13403         struct _goo_struct {
13404                 long long_int;
13405                 int reg_int;
13406                 char char_var;
13407         };
13408         typedef unsigned short foo_t;
13409         char *volatile foo;
13410         volatile int bar;
13411         volatile foo_t blech;
13412         foo = foo;
13413 }
13414 EOCP
13415 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13416         val="$define"
13417         echo "Yup, it does."
13418 else
13419         val="$undef"
13420         echo "Nope, it doesn't."
13421 fi
13422 set d_volatile
13423 eval $setvar
13424 $rm -f try.*
13425
13426
13427 echo " "
13428 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13429
13430 case "$use64bitint:$d_quad:$quadtype" in
13431 define:define:?*)
13432         ivtype="$quadtype"
13433         uvtype="$uquadtype"
13434         ivsize=8
13435         uvsize=8
13436         ;;
13437 *)      ivtype="long"
13438         uvtype="unsigned long"
13439         ivsize=$longsize
13440         uvsize=$longsize
13441         ;;
13442 esac
13443
13444 case "$uselongdouble:$d_longdbl" in
13445 define:define)
13446         nvtype="long double"
13447         nvsize=$longdblsize
13448         ;;
13449 *)      nvtype=double
13450         nvsize=$doublesize
13451         ;;
13452 esac
13453
13454 $echo "(IV will be "$ivtype", $ivsize bytes)"
13455 $echo "(UV will be "$uvtype", $uvsize bytes)"
13456 $echo "(NV will be "$nvtype", $nvsize bytes)"
13457
13458 $cat >try.c <<EOCP
13459 #$i_inttypes I_INTTYPES
13460 #ifdef I_INTTYPES
13461 #include <inttypes.h>
13462 #endif
13463 #include <stdio.h>
13464 int main() {
13465 #ifdef INT8
13466    int8_t i =  INT8_MAX;
13467   uint8_t u = UINT8_MAX;
13468   printf("int8_t\n");
13469 #endif
13470 #ifdef INT16
13471    int16_t i =  INT16_MAX;
13472   uint16_t i = UINT16_MAX;
13473   printf("int16_t\n");
13474 #endif
13475 #ifdef INT32
13476    int32_t i =  INT32_MAX;
13477   uint32_t u = UINT32_MAX;
13478   printf("int32_t\n");
13479 #endif
13480 }
13481 EOCP
13482
13483 case "$i8type" in
13484 '')     case "$charsize" in
13485         1)      i8type=char
13486                 u8type="unsigned char"
13487                 i8size=$charsize
13488                 u8size=$charsize
13489                 ;;
13490         esac
13491         ;;
13492 esac
13493 case "$i8type" in
13494 '')     set try -DINT8
13495         if eval $compile; then
13496                 case "`$run ./try`" in
13497                 int8_t) i8type=int8_t
13498                         u8type=uint8_t
13499                         i8size=1
13500                         u8size=1
13501                         ;;
13502                 esac
13503         fi
13504         ;;
13505 esac
13506 case "$i8type" in
13507 '')     if $test $charsize -ge 1; then
13508                 i8type=char
13509                 u8type="unsigned char"
13510                 i8size=$charsize
13511                 u8size=$charsize
13512         fi
13513         ;;
13514 esac
13515
13516 case "$i16type" in
13517 '')     case "$shortsize" in
13518         2)      i16type=short
13519                 u16type="unsigned short"
13520                 i16size=$shortsize
13521                 u16size=$shortsize
13522                 ;;
13523         esac
13524         ;;
13525 esac
13526 case "$i16type" in
13527 '')     set try -DINT16
13528         if eval $compile; then
13529                 case "`$run ./try`" in
13530                 int16_t)
13531                         i16type=int16_t
13532                         u16type=uint16_t
13533                         i16size=2
13534                         u16size=2
13535                         ;;
13536                 esac
13537         fi
13538         ;;
13539 esac
13540 case "$i16type" in
13541 '')     if $test $shortsize -ge 2; then
13542                 i16type=short
13543                 u16type="unsigned short"
13544                 i16size=$shortsize
13545                 u16size=$shortsize
13546         fi
13547         ;;
13548 esac
13549
13550 case "$i32type" in
13551 '')     case "$longsize" in
13552         4)      i32type=long
13553                 u32type="unsigned long"
13554                 i32size=$longsize
13555                 u32size=$longsize
13556                 ;;
13557         *)      case "$intsize" in
13558                 4)      i32type=int
13559                         u32type="unsigned int"
13560                         i32size=$intsize
13561                         u32size=$intsize
13562                         ;;
13563                 esac
13564                 ;;
13565         esac
13566         ;;
13567 esac
13568 case "$i32type" in
13569 '')     set try -DINT32
13570         if eval $compile; then
13571                 case "`$run ./try`" in
13572                 int32_t)
13573                         i32type=int32_t
13574                         u32type=uint32_t
13575                         i32size=4
13576                         u32size=4
13577                         ;;
13578                 esac
13579         fi
13580         ;;
13581 esac
13582 case "$i32type" in
13583 '')     if $test $intsize -ge 4; then
13584                 i32type=int
13585                 u32type="unsigned int"
13586                 i32size=$intsize
13587                 u32size=$intsize
13588         fi
13589         ;;
13590 esac
13591
13592 case "$i64type" in
13593 '')     case "$d_quad:$quadtype" in
13594         define:?*)
13595                 i64type="$quadtype"
13596                 u64type="$uquadtype"
13597                 i64size=8
13598                 u64size=8
13599                 ;;
13600         esac
13601         ;;
13602 esac
13603
13604 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13605 : volatile so that the compiler has to store it out to memory.
13606 if test X"$d_volatile" = X"$define"; then
13607         volatile=volatile
13608 fi
13609 $cat <<EOP >try.c
13610 #include <stdio.h>
13611 #include <sys/types.h>
13612 #include <signal.h>
13613 #ifdef SIGFPE
13614 $volatile int bletched = 0;
13615 $signal_t blech(s) int s; { bletched = 1; }
13616 #endif
13617 int main() {
13618     $uvtype u = 0;
13619     $nvtype d;
13620     int     n = 8 * $uvsize;
13621     int     i;
13622 #ifdef SIGFPE
13623     signal(SIGFPE, blech);
13624 #endif
13625
13626     for (i = 0; i < n; i++) {
13627       u = u << 1 | ($uvtype)1;
13628       d = ($nvtype)u;
13629       if (($uvtype)d != u)
13630         break;
13631       if (d <= 0)
13632         break;
13633       d = ($nvtype)(u - 1);
13634       if (($uvtype)d != (u - 1))
13635         break;
13636 #ifdef SIGFPE
13637       if (bletched) {
13638         break;
13639 #endif
13640       } 
13641     }
13642     printf("%d\n", ((i == n) ? -n : i));
13643     exit(0);
13644 }
13645 EOP
13646 set try
13647
13648 d_nv_preserves_uv="$undef"
13649 if eval $compile; then
13650         nv_preserves_uv_bits="`$run ./try`"
13651 fi
13652 case "$nv_preserves_uv_bits" in
13653 \-[1-9]*)       
13654         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13655         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13656         d_nv_preserves_uv="$define"
13657         ;;
13658 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13659         d_nv_preserves_uv="$undef" ;;
13660 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13661         nv_preserves_uv_bits="$undef" ;;
13662 esac
13663
13664 $rm -f try.* try
13665
13666
13667 : check for off64_t
13668 echo " "
13669 echo "Checking to see if you have off64_t..." >&4
13670 $cat >try.c <<EOCP
13671 #include <sys/types.h>
13672 #include <unistd.h>
13673 int main() { off64_t x = 7; }
13674 EOCP
13675 set try
13676 if eval $compile; then
13677         val="$define"
13678         echo "You have off64_t."
13679 else
13680         val="$undef"
13681         echo "You do not have off64_t."
13682         case "$lseeksize" in
13683         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13684         esac
13685 fi
13686 $rm -f try.* try
13687 set d_off64_t
13688 eval $setvar
13689
13690 : how to create joinable pthreads
13691 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13692         echo " "
13693         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13694         $cat >try.c <<'EOCP'
13695 #include <pthread.h>
13696 int main() {
13697     int detachstate = JOINABLE;
13698 }
13699 EOCP
13700         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13701         if eval $compile; then
13702                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13703                 val="$undef" # Yes, undef.
13704                 set d_old_pthread_create_joinable
13705                 eval $setvar
13706                 val=""
13707                 set old_pthread_create_joinable
13708                 eval $setvar
13709         else
13710                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13711                 if eval $compile; then
13712                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13713                         val="$define"
13714                         set d_old_pthread_create_joinable
13715                         eval $setvar
13716                         val=PTHREAD_CREATE_UNDETACHED
13717                         set old_pthread_create_joinable
13718                         eval $setvar
13719                 else            
13720                         set try -DJOINABLE=__UNDETACHED
13721                         if eval $compile; then
13722                                 echo "You seem to use __UNDETACHED." >&4
13723                                 val="$define"
13724                                 set d_old_pthread_create_joinable
13725                                 eval $setvar
13726                                 val=__UNDETACHED
13727                                 set old_pthread_create_joinable
13728                                 eval $setvar
13729                         else
13730                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13731                                 val="$define"
13732                                 set d_old_pthread_create_joinable
13733                                 eval $setvar
13734                                 val=0
13735                                 set old_pthread_create_joinable
13736                                 eval $setvar
13737                         fi
13738                 fi
13739         fi
13740         $rm -f try try.*
13741 else
13742     d_old_pthread_create_joinable="$undef"
13743     old_pthread_create_joinable=""
13744 fi
13745
13746 : see if pause exists
13747 set pause d_pause
13748 eval $inlibc
13749
13750 : see if pipe exists
13751 set pipe d_pipe
13752 eval $inlibc
13753
13754 : see if poll exists
13755 set poll d_poll
13756 eval $inlibc
13757
13758 : see if readlink exists
13759 set readlink d_readlink
13760 eval $inlibc
13761
13762 echo " "
13763 procselfexe=''
13764 val="$undef"
13765 case "$d_readlink" in
13766 "$define")
13767         if $issymlink /proc/self/exe ; then
13768                 $ls -l /proc/self/exe > reflect
13769                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13770                         echo "You have Linux-like /proc/self/exe."
13771                         procselfexe='"/proc/self/exe"'
13772                         val="$define"
13773                 fi
13774         fi
13775         if $issymlink /proc/curproc/file ; then
13776                 $ls -l /proc/curproc/file > reflect
13777                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13778                         echo "You have BSD-like /proc/curproc/file."
13779                         procselfexe='"/proc/curproc/file"'
13780                         val="$define"
13781                 fi
13782         fi
13783         ;;
13784 esac
13785 $rm -f reflect
13786 set d_procselfexe
13787 eval $setvar
13788
13789 : see whether the pthread_atfork exists
13790 $cat >try.c <<EOP
13791 #include <pthread.h>
13792 #include <stdio.h>
13793 int main() {
13794 #ifdef  PTHREAD_ATFORK
13795         pthread_atfork(NULL,NULL,NULL);
13796 #endif
13797 }
13798 EOP
13799
13800 : see if pthread_atfork exists
13801 set try -DPTHREAD_ATFORK
13802 if eval $compile; then
13803     val="$define"
13804 else
13805     val="$undef"
13806 fi
13807 case "$usethreads" in
13808 $define)
13809         case "$val" in
13810         $define) echo 'pthread_atfork found.' >&4        ;;
13811         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13812         esac
13813 esac
13814 set d_pthread_atfork
13815 eval $setvar
13816
13817
13818 : see whether the various POSIXish _yields exist
13819 $cat >try.c <<EOP
13820 #include <pthread.h>
13821 #include <stdio.h>
13822 int main() {
13823 #ifdef SCHED_YIELD
13824         sched_yield();
13825 #else
13826 #ifdef PTHREAD_YIELD
13827         pthread_yield();
13828 #else
13829 #ifdef PTHREAD_YIELD_NULL
13830         pthread_yield(NULL);
13831 #endif
13832 #endif
13833 #endif
13834 }
13835 EOP
13836 : see if sched_yield exists
13837 set try -DSCHED_YIELD
13838 if eval $compile; then
13839     val="$define"
13840     sched_yield='sched_yield()'
13841 else
13842     val="$undef"
13843 fi
13844 case "$usethreads" in
13845 $define)
13846         case "$val" in
13847         $define) echo 'sched_yield() found.' >&4        ;;
13848         *)       echo 'sched_yield() NOT found.' >&4    ;;
13849         esac
13850 esac
13851 set d_sched_yield
13852 eval $setvar
13853
13854 : see if pthread_yield exists
13855 set try -DPTHREAD_YIELD
13856 if eval $compile; then
13857     val="$define"
13858     case "$sched_yield" in
13859     '') sched_yield='pthread_yield()' ;;
13860     esac
13861 else
13862     set try -DPTHREAD_YIELD_NULL
13863     if eval $compile; then
13864         val="$define"
13865         case "$sched_yield" in
13866         '') sched_yield='pthread_yield(NULL)' ;;
13867         esac
13868     else
13869         val="$undef"
13870     fi
13871 fi
13872 case "$usethreads" in
13873 $define)
13874         case "$val" in
13875         $define) echo 'pthread_yield() found.' >&4      ;;
13876         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13877         esac
13878         ;;
13879 esac
13880 set d_pthread_yield
13881 eval $setvar
13882
13883 case "$sched_yield" in
13884 '') sched_yield=undef ;;
13885 esac
13886
13887 $rm -f try try.*
13888
13889 : see if random_r exists
13890 set random_r d_random_r
13891 eval $inlibc
13892 case "$d_random_r" in
13893 "$define")
13894         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13895         case "$d_random_r_proto:$usethreads" in
13896         ":define")      d_random_r_proto=define
13897                 set d_random_r_proto random_r $hdrs
13898                 eval $hasproto ;;
13899         *)      ;;
13900         esac
13901         case "$d_random_r_proto" in
13902         define)
13903         case "$random_r_proto" in
13904         ''|0) try='int random_r(int*, struct random_data*);'
13905         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13906         esac
13907         case "$random_r_proto" in
13908         ''|0)   d_random_r=undef
13909                 random_r_proto=0
13910                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13911         * )     case "$random_r_proto" in
13912                 REENTRANT_PROTO*) ;;
13913                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13914                 esac
13915                 echo "Prototype: $try" ;;
13916         esac
13917         ;;
13918         *)      case "$usethreads" in
13919                 define) echo "random_r has no prototype, not using it." >&4 ;;
13920                 esac
13921                 d_random_r=undef
13922                 random_r_proto=0
13923                 ;;
13924         esac
13925         ;;
13926 *)      random_r_proto=0
13927         ;;
13928 esac
13929
13930 : see if readdir and friends exist
13931 set readdir d_readdir
13932 eval $inlibc
13933 set seekdir d_seekdir
13934 eval $inlibc
13935 set telldir d_telldir
13936 eval $inlibc
13937 set rewinddir d_rewinddir
13938 eval $inlibc
13939
13940 : see if readdir64_r exists
13941 set readdir64_r d_readdir64_r
13942 eval $inlibc
13943 case "$d_readdir64_r" in
13944 "$define")
13945         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13946         case "$d_readdir64_r_proto:$usethreads" in
13947         ":define")      d_readdir64_r_proto=define
13948                 set d_readdir64_r_proto readdir64_r $hdrs
13949                 eval $hasproto ;;
13950         *)      ;;
13951         esac
13952         case "$d_readdir64_r_proto" in
13953         define)
13954         case "$readdir64_r_proto" in
13955         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13956         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13957         esac
13958         case "$readdir64_r_proto" in
13959         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13960         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13961         esac
13962         case "$readdir64_r_proto" in
13963         ''|0)   d_readdir64_r=undef
13964                 readdir64_r_proto=0
13965                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13966         * )     case "$readdir64_r_proto" in
13967                 REENTRANT_PROTO*) ;;
13968                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13969                 esac
13970                 echo "Prototype: $try" ;;
13971         esac
13972         ;;
13973         *)      case "$usethreads" in
13974                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13975                 esac
13976                 d_readdir64_r=undef
13977                 readdir64_r_proto=0
13978                 ;;
13979         esac
13980         ;;
13981 *)      readdir64_r_proto=0
13982         ;;
13983 esac
13984
13985 : see if readdir_r exists
13986 set readdir_r d_readdir_r
13987 eval $inlibc
13988 case "$d_readdir_r" in
13989 "$define")
13990         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13991         case "$d_readdir_r_proto:$usethreads" in
13992         ":define")      d_readdir_r_proto=define
13993                 set d_readdir_r_proto readdir_r $hdrs
13994                 eval $hasproto ;;
13995         *)      ;;
13996         esac
13997         case "$d_readdir_r_proto" in
13998         define)
13999         case "$readdir_r_proto" in
14000         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14001         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14002         esac
14003         case "$readdir_r_proto" in
14004         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14005         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14006         esac
14007         case "$readdir_r_proto" in
14008         ''|0)   d_readdir_r=undef
14009                 readdir_r_proto=0
14010                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14011         * )     case "$readdir_r_proto" in
14012                 REENTRANT_PROTO*) ;;
14013                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14014                 esac
14015                 echo "Prototype: $try" ;;
14016         esac
14017         ;;
14018         *)      case "$usethreads" in
14019                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14020                 esac
14021                 d_readdir_r=undef
14022                 readdir_r_proto=0
14023                 ;;
14024         esac
14025         ;;
14026 *)      readdir_r_proto=0
14027         ;;
14028 esac
14029
14030 : see if readv exists
14031 set readv d_readv
14032 eval $inlibc
14033
14034 : see if recvmsg exists
14035 set recvmsg d_recvmsg
14036 eval $inlibc
14037
14038 : see if rename exists
14039 set rename d_rename
14040 eval $inlibc
14041
14042 : see if rmdir exists
14043 set rmdir d_rmdir
14044 eval $inlibc
14045
14046 : see if memory.h is available.
14047 val=''
14048 set memory.h val
14049 eval $inhdr
14050
14051 : See if it conflicts with string.h
14052 case "$val" in
14053 $define)
14054         case "$strings" in
14055         '') ;;
14056         *)
14057                 $cppstdin $cppflags $cppminus < $strings > mem.h
14058                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14059                         echo " "
14060                         echo "We won't be including <memory.h>."
14061                         val="$undef"
14062                 fi
14063                 $rm -f mem.h
14064                 ;;
14065         esac
14066 esac
14067 set i_memory
14068 eval $setvar
14069
14070 : can bcopy handle overlapping blocks?
14071 echo " "
14072 val="$undef"
14073 case "$d_memmove" in
14074 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14075 *)      case "$d_bcopy" in
14076         "$define")
14077                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14078                 $cat >try.c <<EOCP
14079 #$i_memory I_MEMORY
14080 #$i_stdlib I_STDLIB
14081 #$i_string I_STRING
14082 #$i_unistd I_UNISTD
14083 EOCP
14084         $cat >>try.c <<'EOCP'
14085 #include <stdio.h>
14086 #ifdef I_MEMORY
14087 #  include <memory.h>
14088 #endif
14089 #ifdef I_STDLIB
14090 #  include <stdlib.h>
14091 #endif
14092 #ifdef I_STRING
14093 #  include <string.h>
14094 #else
14095 #  include <strings.h>
14096 #endif
14097 #ifdef I_UNISTD
14098 #  include <unistd.h>  /* Needed for NetBSD */
14099 #endif
14100 int main()
14101 {
14102 char buf[128], abc[128];
14103 char *b;
14104 int len;
14105 int off;
14106 int align;
14107
14108 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14109    try to store the string in read-only memory. */
14110 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14111
14112 for (align = 7; align >= 0; align--) {
14113         for (len = 36; len; len--) {
14114                 b = buf+align;
14115                 bcopy(abc, b, len);
14116                 for (off = 1; off <= len; off++) {
14117                         bcopy(b, b+off, len);
14118                         bcopy(b+off, b, len);
14119                         if (bcmp(b, abc, len))
14120                                 exit(1);
14121                 }
14122         }
14123 }
14124 exit(0);
14125 }
14126 EOCP
14127                 set try
14128                 if eval $compile_ok; then
14129                         if ./try 2>/dev/null; then
14130                                 echo "Yes, it can."
14131                                 val="$define"
14132                         else
14133                                 echo "It can't, sorry."
14134                         fi
14135                 else
14136                         echo "(I can't compile the test program, so we'll assume not...)"
14137                 fi
14138                 ;;
14139         esac
14140         $rm -f try.* try core
14141         ;;
14142 esac
14143 set d_safebcpy
14144 eval $setvar
14145
14146 : can memcpy handle overlapping blocks?
14147 echo " "
14148 val="$undef"
14149 case "$d_memmove" in
14150 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14151 *)      case "$d_memcpy" in
14152         "$define")
14153                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14154                 $cat >try.c <<EOCP
14155 #$i_memory I_MEMORY
14156 #$i_stdlib I_STDLIB
14157 #$i_string I_STRING
14158 #$i_unistd I_UNISTD
14159 EOCP
14160         $cat >>try.c <<'EOCP'
14161 #include <stdio.h>
14162 #ifdef I_MEMORY
14163 #  include <memory.h>
14164 #endif
14165 #ifdef I_STDLIB
14166 #  include <stdlib.h>
14167 #endif
14168 #ifdef I_STRING
14169 #  include <string.h>
14170 #else
14171 #  include <strings.h>
14172 #endif
14173 #ifdef I_UNISTD
14174 #  include <unistd.h>  /* Needed for NetBSD */
14175 #endif
14176 int main()
14177 {
14178 char buf[128], abc[128];
14179 char *b;
14180 int len;
14181 int off;
14182 int align;
14183
14184 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14185    try to store the string in read-only memory. */
14186 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14187
14188 for (align = 7; align >= 0; align--) {
14189         for (len = 36; len; len--) {
14190                 b = buf+align;
14191                 memcpy(b, abc, len);
14192                 for (off = 1; off <= len; off++) {
14193                         memcpy(b+off, b, len);
14194                         memcpy(b, b+off, len);
14195                         if (memcmp(b, abc, len))
14196                                 exit(1);
14197                 }
14198         }
14199 }
14200 exit(0);
14201 }
14202 EOCP
14203                 set try
14204                 if eval $compile_ok; then
14205                         if ./try 2>/dev/null; then
14206                                 echo "Yes, it can."
14207                                 val="$define"
14208                         else
14209                                 echo "It can't, sorry."
14210                         fi
14211                 else
14212                         echo "(I can't compile the test program, so we'll assume not...)"
14213                 fi
14214                 ;;
14215         esac
14216         $rm -f try.* try core
14217         ;;
14218 esac
14219 set d_safemcpy
14220 eval $setvar
14221
14222 : can memcmp be trusted to compare relative magnitude?
14223 val="$undef"
14224 case "$d_memcmp" in
14225 "$define")
14226         echo " "
14227         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14228         $cat >try.c <<EOCP
14229 #$i_memory I_MEMORY
14230 #$i_stdlib I_STDLIB
14231 #$i_string I_STRING
14232 #$i_unistd I_UNISTD
14233 EOCP
14234         $cat >>try.c <<'EOCP'
14235 #include <stdio.h>
14236 #ifdef I_MEMORY
14237 #  include <memory.h>
14238 #endif
14239 #ifdef I_STDLIB
14240 #  include <stdlib.h>
14241 #endif
14242 #ifdef I_STRING
14243 #  include <string.h>
14244 #else
14245 #  include <strings.h>
14246 #endif
14247 #ifdef I_UNISTD
14248 #  include <unistd.h>  /* Needed for NetBSD */
14249 #endif
14250 int main()
14251 {
14252 char a = -1;
14253 char b = 0;
14254 if ((a < b) && memcmp(&a, &b, 1) < 0)
14255         exit(1);
14256 exit(0);
14257 }
14258 EOCP
14259         set try
14260         if eval $compile_ok; then
14261                 if $run ./try 2>/dev/null; then
14262                         echo "Yes, it can."
14263                         val="$define"
14264                 else
14265                         echo "No, it can't (it uses signed chars)."
14266                 fi
14267         else
14268                 echo "(I can't compile the test program, so we'll assume not...)"
14269         fi
14270         ;;
14271 esac
14272 $rm -f try.* try core
14273 set d_sanemcmp
14274 eval $setvar
14275
14276 : see if prototype for sbrk is available
14277 echo " "
14278 set d_sbrkproto sbrk $i_unistd unistd.h
14279 eval $hasproto
14280
14281 : see if select exists
14282 set select d_select
14283 eval $inlibc
14284
14285 : see if semctl exists
14286 set semctl d_semctl
14287 eval $inlibc
14288
14289 : see if semget exists
14290 set semget d_semget
14291 eval $inlibc
14292
14293 : see if semop exists
14294 set semop d_semop
14295 eval $inlibc
14296
14297 : see how much of the 'sem*(2)' library is present.
14298 h_sem=true
14299 echo " "
14300 case "$d_semctl$d_semget$d_semop" in
14301 *"$undef"*) h_sem=false;;
14302 esac
14303 case "$osname" in
14304 freebsd)
14305     case "`ipcs 2>&1`" in
14306     "SVID messages"*"not configured"*)
14307         echo "Your $osname does not have the sem*(2) configured." >&4
14308         h_sem=false
14309         val="$undef"
14310         set semctl d_semctl
14311         eval $setvar
14312         set semget d_semget
14313         eval $setvar
14314         set semop d_semop
14315         eval $setvar
14316         ;;
14317     esac
14318     ;;
14319 esac
14320 : we could also check for sys/ipc.h ...
14321 if $h_sem && $test `./findhdr sys/sem.h`; then
14322         echo "You have the full sem*(2) library." >&4
14323         val="$define"
14324 else
14325         echo "You don't have the full sem*(2) library." >&4
14326         val="$undef"
14327 fi
14328 set d_sem
14329 eval $setvar
14330
14331 : see whether sys/sem.h defines union semun
14332 echo " "
14333 $cat > try.c <<'END'
14334 #include <sys/types.h>
14335 #include <sys/ipc.h>
14336 #include <sys/sem.h>
14337 int main () { union semun semun; semun.buf = 0; }
14338 END
14339 set try
14340 if eval $compile; then
14341     echo "You have union semun in <sys/sem.h>." >&4
14342     val="$define"
14343 else
14344     echo "You do not have union semun in <sys/sem.h>." >&4
14345     val="$undef"
14346 fi
14347 $rm -f try try.c try.h
14348 set d_union_semun
14349 eval $setvar
14350
14351 : see how to do semctl IPC_STAT
14352 case "$d_sem" in
14353 $define)
14354     : see whether semctl IPC_STAT can use union semun
14355     echo " "
14356     $cat > try.h <<END
14357 #ifndef S_IRUSR
14358 #   ifdef S_IREAD
14359 #       define S_IRUSR S_IREAD
14360 #       define S_IWUSR S_IWRITE
14361 #       define S_IXUSR S_IEXEC
14362 #   else
14363 #       define S_IRUSR 0400
14364 #       define S_IWUSR 0200
14365 #       define S_IXUSR 0100
14366 #   endif
14367 #   define S_IRGRP (S_IRUSR>>3)
14368 #   define S_IWGRP (S_IWUSR>>3)
14369 #   define S_IXGRP (S_IXUSR>>3)
14370 #   define S_IROTH (S_IRUSR>>6)
14371 #   define S_IWOTH (S_IWUSR>>6)
14372 #   define S_IXOTH (S_IXUSR>>6)
14373 #endif
14374 #ifndef S_IRWXU
14375 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14376 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14377 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14378 #endif
14379 END
14380
14381     $cat > try.c <<END
14382 #include <sys/types.h>
14383 #include <sys/ipc.h>
14384 #include <sys/sem.h>
14385 #include <sys/stat.h>
14386 #include <stdio.h>
14387 #include <errno.h>
14388 #include "try.h"
14389 #ifndef errno
14390 extern int errno;
14391 #endif
14392 #$d_union_semun HAS_UNION_SEMUN
14393 int main() {
14394     union semun
14395 #ifndef HAS_UNION_SEMUN
14396     {
14397         int val;
14398         struct semid_ds *buf;
14399         unsigned short *array;
14400     }
14401 #endif
14402     arg;
14403     int sem, st;
14404
14405 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14406     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14407     if (sem > -1) {
14408         struct semid_ds argbuf;
14409         arg.buf = &argbuf;
14410 #       ifdef IPC_STAT
14411         st = semctl(sem, 0, IPC_STAT, arg);
14412         if (st == 0)
14413             printf("semun\n");
14414         else
14415 #       endif /* IPC_STAT */
14416             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14417 #       ifdef IPC_RMID
14418         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14419 #       endif /* IPC_RMID */
14420             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14421     } else
14422 #endif /* IPC_PRIVATE && ... */
14423         printf("semget failed: errno = %d\n", errno);
14424   return 0;
14425 }
14426 END
14427     val="$undef"
14428     set try
14429     if eval $compile; then
14430         xxx=`$run ./try`
14431         case "$xxx" in
14432         semun) val="$define" ;;
14433         esac
14434     fi
14435     $rm -f try try.c
14436     set d_semctl_semun
14437     eval $setvar
14438     case "$d_semctl_semun" in
14439     $define)
14440         echo "You can use union semun for semctl IPC_STAT." >&4
14441         also='also'
14442         ;;
14443     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14444         also=''
14445         ;;
14446     esac
14447
14448     : see whether semctl IPC_STAT can use struct semid_ds pointer
14449     $cat > try.c <<'END'
14450 #include <sys/types.h>
14451 #include <sys/ipc.h>
14452 #include <sys/sem.h>
14453 #include <sys/stat.h>
14454 #include "try.h"
14455 #include <stdio.h>
14456 #include <errno.h>
14457 #ifndef errno
14458 extern int errno;
14459 #endif
14460 int main() {
14461     struct semid_ds arg;
14462     int sem, st;
14463
14464 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14465     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14466     if (sem > -1) {
14467 #       ifdef IPC_STAT
14468         st = semctl(sem, 0, IPC_STAT, &arg);
14469         if (st == 0)
14470             printf("semid_ds\n");
14471         else
14472 #       endif /* IPC_STAT */
14473             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14474 #       ifdef IPC_RMID
14475         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14476 #       endif /* IPC_RMID */
14477             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14478     } else
14479 #endif /* IPC_PRIVATE && ... */
14480         printf("semget failed: errno = %d\n", errno);
14481
14482     return 0;
14483 }
14484 END
14485     val="$undef"
14486     set try
14487     if eval $compile; then
14488         xxx=`$run ./try`
14489         case "$xxx" in
14490         semid_ds) val="$define" ;;
14491         esac
14492     fi
14493     $rm -f try try.c
14494     set d_semctl_semid_ds
14495     eval $setvar
14496     case "$d_semctl_semid_ds" in
14497     $define)
14498         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14499         ;;
14500     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14501         ;;
14502     esac
14503     $rm -f try.h
14504     ;;
14505 *)  val="$undef"
14506
14507     # We do not have the full sem*(2) library, so assume we can not
14508     # use either.
14509
14510     set d_semctl_semun
14511     eval $setvar
14512
14513     set d_semctl_semid_ds
14514     eval $setvar
14515     ;;
14516 esac
14517
14518 : see if sendmsg exists
14519 set sendmsg d_sendmsg
14520 eval $inlibc
14521
14522 : see if setegid exists
14523 set setegid d_setegid
14524 eval $inlibc
14525
14526 : see if seteuid exists
14527 set seteuid d_seteuid
14528 eval $inlibc
14529
14530 : see if setgrent exists
14531 set setgrent d_setgrent
14532 eval $inlibc
14533
14534 : see if setgrent_r exists
14535 set setgrent_r d_setgrent_r
14536 eval $inlibc
14537 case "$d_setgrent_r" in
14538 "$define")
14539         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14540         case "$d_setgrent_r_proto:$usethreads" in
14541         ":define")      d_setgrent_r_proto=define
14542                 set d_setgrent_r_proto setgrent_r $hdrs
14543                 eval $hasproto ;;
14544         *)      ;;
14545         esac
14546         case "$d_setgrent_r_proto" in
14547         define)
14548         case "$setgrent_r_proto" in
14549         ''|0) try='int setgrent_r(FILE**);'
14550         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14551         esac
14552         case "$setgrent_r_proto" in
14553         ''|0) try='void setgrent_r(FILE**);'
14554         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14555         esac
14556         case "$setgrent_r_proto" in
14557         ''|0)   d_setgrent_r=undef
14558                 setgrent_r_proto=0
14559                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14560         * )     case "$setgrent_r_proto" in
14561                 REENTRANT_PROTO*) ;;
14562                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14563                 esac
14564                 echo "Prototype: $try" ;;
14565         esac
14566         ;;
14567         *)      case "$usethreads" in
14568                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14569                 esac
14570                 d_setgrent_r=undef
14571                 setgrent_r_proto=0
14572                 ;;
14573         esac
14574         ;;
14575 *)      setgrent_r_proto=0
14576         ;;
14577 esac
14578
14579 : see if sethostent exists
14580 set sethostent d_sethent
14581 eval $inlibc
14582
14583 : see if sethostent_r exists
14584 set sethostent_r d_sethostent_r
14585 eval $inlibc
14586 case "$d_sethostent_r" in
14587 "$define")
14588         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14589         case "$d_sethostent_r_proto:$usethreads" in
14590         ":define")      d_sethostent_r_proto=define
14591                 set d_sethostent_r_proto sethostent_r $hdrs
14592                 eval $hasproto ;;
14593         *)      ;;
14594         esac
14595         case "$d_sethostent_r_proto" in
14596         define)
14597         case "$sethostent_r_proto" in
14598         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14599         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14600         esac
14601         case "$sethostent_r_proto" in
14602         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14603         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14604         esac
14605         case "$sethostent_r_proto" in
14606         ''|0)   d_sethostent_r=undef
14607                 sethostent_r_proto=0
14608                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14609         * )     case "$sethostent_r_proto" in
14610                 REENTRANT_PROTO*) ;;
14611                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14612                 esac
14613                 echo "Prototype: $try" ;;
14614         esac
14615         ;;
14616         *)      case "$usethreads" in
14617                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14618                 esac
14619                 d_sethostent_r=undef
14620                 sethostent_r_proto=0
14621                 ;;
14622         esac
14623         ;;
14624 *)      sethostent_r_proto=0
14625         ;;
14626 esac
14627
14628 : see if setitimer exists
14629 set setitimer d_setitimer
14630 eval $inlibc
14631
14632 : see if setlinebuf exists
14633 set setlinebuf d_setlinebuf
14634 eval $inlibc
14635
14636 : see if setlocale exists
14637 set setlocale d_setlocale
14638 eval $inlibc
14639
14640 : see if locale.h is available
14641 set locale.h i_locale
14642 eval $inhdr
14643
14644 : see if setlocale_r exists
14645 set setlocale_r d_setlocale_r
14646 eval $inlibc
14647 case "$d_setlocale_r" in
14648 "$define")
14649         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14650         case "$d_setlocale_r_proto:$usethreads" in
14651         ":define")      d_setlocale_r_proto=define
14652                 set d_setlocale_r_proto setlocale_r $hdrs
14653                 eval $hasproto ;;
14654         *)      ;;
14655         esac
14656         case "$d_setlocale_r_proto" in
14657         define)
14658         case "$setlocale_r_proto" in
14659         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14660         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14661         esac
14662         case "$setlocale_r_proto" in
14663         ''|0)   d_setlocale_r=undef
14664                 setlocale_r_proto=0
14665                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14666         * )     case "$setlocale_r_proto" in
14667                 REENTRANT_PROTO*) ;;
14668                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14669                 esac
14670                 echo "Prototype: $try" ;;
14671         esac
14672         ;;
14673         *)      case "$usethreads" in
14674                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14675                 esac
14676                 d_setlocale_r=undef
14677                 setlocale_r_proto=0
14678                 ;;
14679         esac
14680         ;;
14681 *)      setlocale_r_proto=0
14682         ;;
14683 esac
14684
14685 : see if setnetent exists
14686 set setnetent d_setnent
14687 eval $inlibc
14688
14689 : see if setnetent_r exists
14690 set setnetent_r d_setnetent_r
14691 eval $inlibc
14692 case "$d_setnetent_r" in
14693 "$define")
14694         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14695         case "$d_setnetent_r_proto:$usethreads" in
14696         ":define")      d_setnetent_r_proto=define
14697                 set d_setnetent_r_proto setnetent_r $hdrs
14698                 eval $hasproto ;;
14699         *)      ;;
14700         esac
14701         case "$d_setnetent_r_proto" in
14702         define)
14703         case "$setnetent_r_proto" in
14704         ''|0) try='int setnetent_r(int, struct netent_data*);'
14705         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14706         esac
14707         case "$setnetent_r_proto" in
14708         ''|0) try='void setnetent_r(int, struct netent_data*);'
14709         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14710         esac
14711         case "$setnetent_r_proto" in
14712         ''|0)   d_setnetent_r=undef
14713                 setnetent_r_proto=0
14714                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14715         * )     case "$setnetent_r_proto" in
14716                 REENTRANT_PROTO*) ;;
14717                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14718                 esac
14719                 echo "Prototype: $try" ;;
14720         esac
14721         ;;
14722         *)      case "$usethreads" in
14723                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14724                 esac
14725                 d_setnetent_r=undef
14726                 setnetent_r_proto=0
14727                 ;;
14728         esac
14729         ;;
14730 *)      setnetent_r_proto=0
14731         ;;
14732 esac
14733
14734 : see if setprotoent exists
14735 set setprotoent d_setpent
14736 eval $inlibc
14737
14738 : see if setpgid exists
14739 set setpgid d_setpgid
14740 eval $inlibc
14741
14742 : see if setpgrp2 exists
14743 set setpgrp2 d_setpgrp2
14744 eval $inlibc
14745
14746 : see if setpriority exists
14747 set setpriority d_setprior
14748 eval $inlibc
14749
14750 : see if setproctitle exists
14751 set setproctitle d_setproctitle
14752 eval $inlibc
14753
14754 : see if setprotoent_r exists
14755 set setprotoent_r d_setprotoent_r
14756 eval $inlibc
14757 case "$d_setprotoent_r" in
14758 "$define")
14759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14760         case "$d_setprotoent_r_proto:$usethreads" in
14761         ":define")      d_setprotoent_r_proto=define
14762                 set d_setprotoent_r_proto setprotoent_r $hdrs
14763                 eval $hasproto ;;
14764         *)      ;;
14765         esac
14766         case "$d_setprotoent_r_proto" in
14767         define)
14768         case "$setprotoent_r_proto" in
14769         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14770         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14771         esac
14772         case "$setprotoent_r_proto" in
14773         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14774         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14775         esac
14776         case "$setprotoent_r_proto" in
14777         ''|0)   d_setprotoent_r=undef
14778                 setprotoent_r_proto=0
14779                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14780         * )     case "$setprotoent_r_proto" in
14781                 REENTRANT_PROTO*) ;;
14782                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14783                 esac
14784                 echo "Prototype: $try" ;;
14785         esac
14786         ;;
14787         *)      case "$usethreads" in
14788                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14789                 esac
14790                 d_setprotoent_r=undef
14791                 setprotoent_r_proto=0
14792                 ;;
14793         esac
14794         ;;
14795 *)      setprotoent_r_proto=0
14796         ;;
14797 esac
14798
14799 : see if setpwent exists
14800 set setpwent d_setpwent
14801 eval $inlibc
14802
14803 : see if setpwent_r exists
14804 set setpwent_r d_setpwent_r
14805 eval $inlibc
14806 case "$d_setpwent_r" in
14807 "$define")
14808         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14809         case "$d_setpwent_r_proto:$usethreads" in
14810         ":define")      d_setpwent_r_proto=define
14811                 set d_setpwent_r_proto setpwent_r $hdrs
14812                 eval $hasproto ;;
14813         *)      ;;
14814         esac
14815         case "$d_setpwent_r_proto" in
14816         define)
14817         case "$setpwent_r_proto" in
14818         ''|0) try='int setpwent_r(FILE**);'
14819         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14820         esac
14821         case "$setpwent_r_proto" in
14822         ''|0) try='void setpwent_r(FILE**);'
14823         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14824         esac
14825         case "$setpwent_r_proto" in
14826         ''|0)   d_setpwent_r=undef
14827                 setpwent_r_proto=0
14828                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14829         * )     case "$setpwent_r_proto" in
14830                 REENTRANT_PROTO*) ;;
14831                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14832                 esac
14833                 echo "Prototype: $try" ;;
14834         esac
14835         ;;
14836         *)      case "$usethreads" in
14837                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14838                 esac
14839                 d_setpwent_r=undef
14840                 setpwent_r_proto=0
14841                 ;;
14842         esac
14843         ;;
14844 *)      setpwent_r_proto=0
14845         ;;
14846 esac
14847
14848 : see if setregid exists
14849 set setregid d_setregid
14850 eval $inlibc
14851 set setresgid d_setresgid
14852 eval $inlibc
14853
14854 : see if setreuid exists
14855 set setreuid d_setreuid
14856 eval $inlibc
14857 set setresuid d_setresuid
14858 eval $inlibc
14859
14860 : see if setrgid exists
14861 set setrgid d_setrgid
14862 eval $inlibc
14863
14864 : see if setruid exists
14865 set setruid d_setruid
14866 eval $inlibc
14867
14868 : see if setservent exists
14869 set setservent d_setsent
14870 eval $inlibc
14871
14872 : see if setservent_r exists
14873 set setservent_r d_setservent_r
14874 eval $inlibc
14875 case "$d_setservent_r" in
14876 "$define")
14877         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14878         case "$d_setservent_r_proto:$usethreads" in
14879         ":define")      d_setservent_r_proto=define
14880                 set d_setservent_r_proto setservent_r $hdrs
14881                 eval $hasproto ;;
14882         *)      ;;
14883         esac
14884         case "$d_setservent_r_proto" in
14885         define)
14886         case "$setservent_r_proto" in
14887         ''|0) try='int setservent_r(int, struct servent_data*);'
14888         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14889         esac
14890         case "$setservent_r_proto" in
14891         ''|0) try='void setservent_r(int, struct servent_data*);'
14892         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14893         esac
14894         case "$setservent_r_proto" in
14895         ''|0)   d_setservent_r=undef
14896                 setservent_r_proto=0
14897                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14898         * )     case "$setservent_r_proto" in
14899                 REENTRANT_PROTO*) ;;
14900                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14901                 esac
14902                 echo "Prototype: $try" ;;
14903         esac
14904         ;;
14905         *)      case "$usethreads" in
14906                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14907                 esac
14908                 d_setservent_r=undef
14909                 setservent_r_proto=0
14910                 ;;
14911         esac
14912         ;;
14913 *)      setservent_r_proto=0
14914         ;;
14915 esac
14916
14917 : see if setsid exists
14918 set setsid d_setsid
14919 eval $inlibc
14920
14921 : see if setvbuf exists
14922 set setvbuf d_setvbuf
14923 eval $inlibc
14924
14925 : see if sfio.h is available
14926 set sfio.h i_sfio
14927 eval $inhdr
14928
14929
14930 : see if sfio library is available
14931 case "$i_sfio" in
14932 $define)
14933         val=''
14934         set sfreserve val
14935         eval $inlibc
14936         ;;
14937 *)
14938         val="$undef"
14939         ;;
14940 esac
14941 : Ok, but do we want to use it.
14942 case "$val" in
14943 $define)
14944         case "$usesfio" in
14945         true|$define|[yY]*) dflt='y';;
14946         *) dflt='n';;
14947         esac
14948         echo "$package can use the sfio library, but it is experimental."
14949         case "$useperlio" in
14950         "$undef")
14951             echo "For sfio also the PerlIO abstraction layer is needed."
14952             echo "Earlier you said you wouldn't want that."
14953             ;;
14954         esac
14955         rp="You seem to have sfio available, do you want to try using it?"
14956         . ./myread
14957         case "$ans" in
14958         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14959                 useperlio="$define"
14960                 val="$define"
14961                 ;;
14962         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14963                 val="$undef"
14964                 ;;
14965         esac
14966         ;;
14967 *)      case "$usesfio" in
14968         true|$define|[yY]*)
14969                 echo "Sorry, cannot find sfio on this machine." >&4
14970                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14971                 val="$undef"
14972                 ;;
14973         esac
14974         ;;
14975 esac
14976 set d_sfio
14977 eval $setvar
14978 case "$d_sfio" in
14979 $define) usesfio='true';;
14980 *) usesfio='false';;
14981 esac
14982 case "$d_sfio" in
14983 $define) ;;
14984 *)      : Remove sfio from list of libraries to use
14985         case "$libs" in
14986         *-lsfio*)
14987                 echo "Removing unneeded -lsfio from library list" >&4
14988                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14989                 shift
14990                 libs="$*"
14991                 echo "libs = $libs" >&4
14992                 ;;
14993         esac
14994 ;;
14995 esac
14996
14997
14998 : see if shmctl exists
14999 set shmctl d_shmctl
15000 eval $inlibc
15001
15002 : see if shmget exists
15003 set shmget d_shmget
15004 eval $inlibc
15005
15006 : see if shmat exists
15007 set shmat d_shmat
15008 eval $inlibc
15009 : see what shmat returns
15010 case "$d_shmat" in
15011 "$define")
15012         $cat >shmat.c <<'END'
15013 #include <sys/shm.h>
15014 void *shmat();
15015 END
15016         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15017                 shmattype='void *'
15018         else
15019                 shmattype='char *'
15020         fi
15021         echo "and it returns ($shmattype)." >&4
15022         : see if a prototype for shmat is available
15023         xxx=`./findhdr sys/shm.h`
15024         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15025         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15026                 val="$define"
15027         else
15028                 val="$undef"
15029         fi
15030         $rm -f shmat.[co]
15031         ;;
15032 *)
15033         val="$undef"
15034         ;;
15035 esac
15036 set d_shmatprototype
15037 eval $setvar
15038
15039 : see if shmdt exists
15040 set shmdt d_shmdt
15041 eval $inlibc
15042
15043 : see how much of the 'shm*(2)' library is present.
15044 h_shm=true
15045 echo " "
15046 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15047 *"$undef"*) h_shm=false;;
15048 esac
15049 case "$osname" in
15050 freebsd)
15051     case "`ipcs 2>&1`" in
15052     "SVID shared memory"*"not configured"*)
15053         echo "Your $osname does not have the shm*(2) configured." >&4
15054         h_shm=false
15055         val="$undef"
15056         set shmctl d_shmctl
15057         evat $setvar
15058         set shmget d_shmget
15059         evat $setvar
15060         set shmat d_shmat
15061         evat $setvar
15062         set shmdt d_shmdt
15063         evat $setvar
15064         ;;
15065     esac
15066     ;;
15067 esac
15068 : we could also check for sys/ipc.h ...
15069 if $h_shm && $test `./findhdr sys/shm.h`; then
15070         echo "You have the full shm*(2) library." >&4
15071         val="$define"
15072 else
15073         echo "You don't have the full shm*(2) library." >&4
15074         val="$undef"
15075 fi
15076 set d_shm
15077 eval $setvar
15078
15079 echo " "
15080 : see if we have sigaction
15081 if set sigaction val -f d_sigaction; eval $csym; $val; then
15082         echo 'sigaction() found.' >&4
15083         $cat > try.c <<'EOP'
15084 #include <stdio.h>
15085 #include <sys/types.h>
15086 #include <signal.h>
15087 int main()
15088 {
15089     struct sigaction act, oact;
15090     act.sa_flags = 0;
15091     oact.sa_handler = 0;
15092     /* so that act and oact are used */
15093     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15094 }
15095 EOP
15096         set try
15097         if eval $compile_ok; then
15098                 val="$define"
15099         else
15100                 echo "But you don't seem to have a useable struct sigaction." >&4
15101                 val="$undef"
15102         fi
15103 else
15104         echo 'sigaction NOT found.' >&4
15105         val="$undef"
15106 fi
15107 set d_sigaction; eval $setvar
15108 $rm -f try try$_o try.c
15109
15110 : see if sigprocmask exists
15111 set sigprocmask d_sigprocmask
15112 eval $inlibc
15113
15114 : see if sigsetjmp exists
15115 echo " "
15116 case "$d_sigsetjmp" in
15117 '')
15118         $cat >try.c <<'EOP'
15119 #include <setjmp.h>
15120 sigjmp_buf env;
15121 int set = 1;
15122 int main()
15123 {
15124         if (sigsetjmp(env,1))
15125                 exit(set);
15126         set = 0;
15127         siglongjmp(env, 1);
15128         exit(1);
15129 }
15130 EOP
15131         set try
15132         if eval $compile; then
15133                 if $run ./try >/dev/null 2>&1; then
15134                         echo "POSIX sigsetjmp found." >&4
15135                         val="$define"
15136                 else
15137                         $cat >&4 <<EOM
15138 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15139 I'll ignore them.
15140 EOM
15141                         val="$undef"
15142                 fi
15143         else
15144                 echo "sigsetjmp not found." >&4
15145                 val="$undef"
15146         fi
15147         ;;
15148 *) val="$d_sigsetjmp"
15149         case "$d_sigsetjmp" in
15150         $define) echo "POSIX sigsetjmp found." >&4;;
15151         $undef) echo "sigsetjmp not found." >&4;;
15152         esac
15153         ;;
15154 esac
15155 set d_sigsetjmp
15156 eval $setvar
15157 $rm -f try.c try
15158
15159 : see if sockatmark exists
15160 set sockatmark d_sockatmark
15161 eval $inlibc
15162
15163 : see if prototype for sockatmark is available
15164 echo " "
15165 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15166 eval $hasproto
15167
15168 : see if socks5_init exists
15169 set socks5_init d_socks5_init
15170 eval $inlibc
15171
15172 : see if srand48_r exists
15173 set srand48_r d_srand48_r
15174 eval $inlibc
15175 case "$d_srand48_r" in
15176 "$define")
15177         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15178         case "$d_srand48_r_proto:$usethreads" in
15179         ":define")      d_srand48_r_proto=define
15180                 set d_srand48_r_proto srand48_r $hdrs
15181                 eval $hasproto ;;
15182         *)      ;;
15183         esac
15184         case "$d_srand48_r_proto" in
15185         define)
15186         case "$srand48_r_proto" in
15187         ''|0) try='int srand48_r(long, struct drand48_data*);'
15188         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15189         esac
15190         case "$srand48_r_proto" in
15191         ''|0)   d_srand48_r=undef
15192                 srand48_r_proto=0
15193                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15194         * )     case "$srand48_r_proto" in
15195                 REENTRANT_PROTO*) ;;
15196                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15197                 esac
15198                 echo "Prototype: $try" ;;
15199         esac
15200         ;;
15201         *)      case "$usethreads" in
15202                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15203                 esac
15204                 d_srand48_r=undef
15205                 srand48_r_proto=0
15206                 ;;
15207         esac
15208         ;;
15209 *)      srand48_r_proto=0
15210         ;;
15211 esac
15212
15213 : see if srandom_r exists
15214 set srandom_r d_srandom_r
15215 eval $inlibc
15216 case "$d_srandom_r" in
15217 "$define")
15218         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15219         case "$d_srandom_r_proto:$usethreads" in
15220         ":define")      d_srandom_r_proto=define
15221                 set d_srandom_r_proto srandom_r $hdrs
15222                 eval $hasproto ;;
15223         *)      ;;
15224         esac
15225         case "$d_srandom_r_proto" in
15226         define)
15227         case "$srandom_r_proto" in
15228         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15229         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15230         esac
15231         case "$srandom_r_proto" in
15232         ''|0)   d_srandom_r=undef
15233                 srandom_r_proto=0
15234                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15235         * )     case "$srandom_r_proto" in
15236                 REENTRANT_PROTO*) ;;
15237                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15238                 esac
15239                 echo "Prototype: $try" ;;
15240         esac
15241         ;;
15242         *)      case "$usethreads" in
15243                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15244                 esac
15245                 d_srandom_r=undef
15246                 srandom_r_proto=0
15247                 ;;
15248         esac
15249         ;;
15250 *)      srandom_r_proto=0
15251         ;;
15252 esac
15253
15254 : see if prototype for setresgid is available
15255 echo " "
15256 set d_sresgproto setresgid $i_unistd unistd.h
15257 eval $hasproto
15258
15259 : see if prototype for setresuid is available
15260 echo " "
15261 set d_sresuproto setresuid $i_unistd unistd.h
15262 eval $hasproto
15263
15264 : see if sys/stat.h is available
15265 set sys/stat.h i_sysstat
15266 eval $inhdr
15267
15268
15269 : see if stat knows about block sizes
15270 echo " "
15271 echo "Checking to see if your struct stat has st_blocks field..." >&4
15272 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15273 eval $hasfield
15274
15275
15276 : see if this is a sys/vfs.h system
15277 set sys/vfs.h i_sysvfs
15278 eval $inhdr
15279
15280
15281 : see if this is a sys/statfs.h system
15282 set sys/statfs.h i_sysstatfs
15283 eval $inhdr
15284
15285
15286 echo " "
15287 echo "Checking to see if your system supports struct statfs..." >&4
15288 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
15289 eval $hasstruct
15290 case "$d_statfs_s" in
15291 "$define")      echo "Yes, it does."   ;;
15292 *)              echo "No, it doesn't." ;;
15293 esac
15294
15295
15296
15297 : see if struct statfs knows about f_flags
15298 case "$d_statfs_s" in
15299 define) 
15300         echo " "
15301         echo "Checking to see if your struct statfs has f_flags field..." >&4
15302         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
15303         eval $hasfield
15304         ;;
15305 *)      val="$undef"
15306         set d_statfs_f_flags
15307         eval $setvar
15308         ;;
15309 esac
15310 case "$d_statfs_f_flags" in
15311 "$define")      echo "Yes, it does."   ;;
15312 *)              echo "No, it doesn't." ;;
15313 esac
15314
15315 : see if _ptr and _cnt from stdio act std
15316 echo " "
15317
15318 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15319         echo "(Looks like you have stdio.h from BSD.)"
15320         case "$stdio_ptr" in
15321         '') stdio_ptr='((fp)->_p)'
15322                 ptr_lval=$define
15323                 ;;
15324         *)      ptr_lval=$d_stdio_ptr_lval;;
15325         esac
15326         case "$stdio_cnt" in
15327         '') stdio_cnt='((fp)->_r)'
15328                 cnt_lval=$define
15329                 ;;
15330         *)      cnt_lval=$d_stdio_cnt_lval;;
15331         esac
15332         case "$stdio_base" in
15333         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15334         esac
15335         case "$stdio_bufsiz" in
15336         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15337         esac
15338 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15339         echo "(Looks like you have stdio.h from Linux.)"
15340         case "$stdio_ptr" in
15341         '') stdio_ptr='((fp)->_IO_read_ptr)'
15342                 ptr_lval=$define
15343                 ;;
15344         *)      ptr_lval=$d_stdio_ptr_lval;;
15345         esac
15346         case "$stdio_cnt" in
15347         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15348                 cnt_lval=$undef
15349                 ;;
15350         *)      cnt_lval=$d_stdio_cnt_lval;;
15351         esac
15352         case "$stdio_base" in
15353         '') stdio_base='((fp)->_IO_read_base)';;
15354         esac
15355         case "$stdio_bufsiz" in
15356         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15357         esac
15358 else
15359         case "$stdio_ptr" in
15360         '') stdio_ptr='((fp)->_ptr)'
15361                 ptr_lval=$define
15362                 ;;
15363         *)      ptr_lval=$d_stdio_ptr_lval;;
15364         esac
15365         case "$stdio_cnt" in
15366         '') stdio_cnt='((fp)->_cnt)'
15367                 cnt_lval=$define
15368                 ;;
15369         *)      cnt_lval=$d_stdio_cnt_lval;;
15370         esac
15371         case "$stdio_base" in
15372         '') stdio_base='((fp)->_base)';;
15373         esac
15374         case "$stdio_bufsiz" in
15375         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15376         esac
15377 fi
15378
15379 : test whether _ptr and _cnt really work
15380 echo "Checking how std your stdio is..." >&4
15381 $cat >try.c <<EOP
15382 #include <stdio.h>
15383 #define FILE_ptr(fp)    $stdio_ptr
15384 #define FILE_cnt(fp)    $stdio_cnt
15385 int main() {
15386         FILE *fp = fopen("try.c", "r");
15387         char c = getc(fp);
15388         if (
15389                 18 <= FILE_cnt(fp) &&
15390                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15391         )
15392                 exit(0);
15393         exit(1);
15394 }
15395 EOP
15396 val="$undef"
15397 set try
15398 if eval $compile && $to try.c; then
15399         if $run ./try; then
15400                 echo "Your stdio acts pretty std."
15401                 val="$define"
15402         else
15403                 echo "Your stdio isn't very std."
15404         fi
15405 else
15406         echo "Your stdio doesn't appear very std."
15407 fi
15408 $rm -f try.c try
15409
15410 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15411 # direct buffer manipulation no longer works.  The Configure tests
15412 # should be changed to correctly detect this, but until then,
15413 # the following check should at least let perl compile and run.
15414 # (This quick fix should be updated before 5.8.1.)
15415 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15416 # A. Dougherty, June 3, 2002.
15417 case "$d_gnulibc" in
15418 $define)
15419         case "$gnulibc_version" in
15420         2.[01]*)  ;;
15421         2.2) ;;
15422         2.2.[0-9]) ;;
15423         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15424                 val="$undef"
15425                 ;;
15426         esac
15427         ;;
15428 esac
15429 set d_stdstdio
15430 eval $setvar
15431
15432 : Can _ptr be used as an lvalue?
15433 case "$d_stdstdio$ptr_lval" in
15434 $define$define) val=$define ;;
15435 *) val=$undef ;;
15436 esac
15437 set d_stdio_ptr_lval
15438 eval $setvar
15439
15440 : Can _cnt be used as an lvalue?
15441 case "$d_stdstdio$cnt_lval" in
15442 $define$define) val=$define ;;
15443 *) val=$undef ;;
15444 esac
15445 set d_stdio_cnt_lval
15446 eval $setvar
15447
15448
15449 : test whether setting _ptr sets _cnt as a side effect
15450 d_stdio_ptr_lval_sets_cnt="$undef"
15451 d_stdio_ptr_lval_nochange_cnt="$undef"
15452 case "$d_stdio_ptr_lval$d_stdstdio" in
15453 $define$define)
15454         echo "Checking to see what happens if we set the stdio ptr..." >&4
15455 $cat >try.c <<EOP
15456 #include <stdio.h>
15457 /* Can we scream? */
15458 /* Eat dust sed :-) */
15459 /* In the buffer space, no one can hear you scream. */
15460 #define FILE_ptr(fp)    $stdio_ptr
15461 #define FILE_cnt(fp)    $stdio_cnt
15462 #include <sys/types.h>
15463 int main() {
15464         FILE *fp = fopen("try.c", "r");
15465         int c;
15466         char *ptr;
15467         size_t cnt;
15468         if (!fp) {
15469             puts("Fail even to read");
15470             exit(1);
15471         }
15472         c = getc(fp); /* Read away the first # */
15473         if (c == EOF) {
15474             puts("Fail even to read");
15475             exit(1);
15476         }
15477         if (!(
15478                 18 <= FILE_cnt(fp) &&
15479                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15480         )) {
15481                 puts("Fail even to read");
15482                 exit (1);
15483         }
15484         ptr = (char*) FILE_ptr(fp);
15485         cnt = (size_t)FILE_cnt(fp);
15486
15487         FILE_ptr(fp) += 42;
15488
15489         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15490                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15491                 exit (1);
15492         }
15493         if (FILE_cnt(fp) <= 20) {
15494                 printf ("Fail (<20 chars to test)");
15495                 exit (1);
15496         }
15497         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15498                 puts("Fail compare");
15499                 exit (1);
15500         }
15501         if (cnt == FILE_cnt(fp)) {
15502                 puts("Pass_unchanged");
15503                 exit (0);
15504         }       
15505         if (FILE_cnt(fp) == (cnt - 42)) {
15506                 puts("Pass_changed");
15507                 exit (0);
15508         }
15509         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15510         return 1;
15511
15512 }
15513 EOP
15514         set try
15515         if eval $compile && $to try.c; then
15516                 case `$run ./try` in
15517                 Pass_changed)
15518                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15519                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15520                 Pass_unchanged)
15521                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15522                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15523                 Fail*)
15524                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15525                 *)
15526                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15527         esac
15528         else
15529                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15530         fi
15531         $rm -f try.c try
15532         ;;
15533 esac
15534
15535 : see if _base is also standard
15536 val="$undef"
15537 case "$d_stdstdio" in
15538 $define)
15539         $cat >try.c <<EOP
15540 #include <stdio.h>
15541 #define FILE_base(fp)   $stdio_base
15542 #define FILE_bufsiz(fp) $stdio_bufsiz
15543 int main() {
15544         FILE *fp = fopen("try.c", "r");
15545         char c = getc(fp);
15546         if (
15547                 19 <= FILE_bufsiz(fp) &&
15548                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15549         )
15550                 exit(0);
15551         exit(1);
15552 }
15553 EOP
15554         set try
15555         if eval $compile && $to try.c; then
15556                 if $run ./try; then
15557                         echo "And its _base field acts std."
15558                         val="$define"
15559                 else
15560                         echo "But its _base field isn't std."
15561                 fi
15562         else
15563                 echo "However, it seems to be lacking the _base field."
15564         fi
15565         $rm -f try.c try
15566         ;;
15567 esac
15568 set d_stdiobase
15569 eval $setvar
15570
15571 $cat >&4 <<EOM
15572 Checking how to access stdio streams by file descriptor number...
15573 EOM
15574 case "$stdio_stream_array" in
15575 '')     $cat >try.c <<EOCP
15576 #include <stdio.h>
15577 int main() {
15578   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15579     printf("yes\n");
15580 }
15581 EOCP
15582         for s in _iob __iob __sF
15583         do
15584                 set try -DSTDIO_STREAM_ARRAY=$s
15585                 if eval $compile; then
15586                         case "`$run ./try`" in
15587                         yes)    stdio_stream_array=$s; break ;;
15588                         esac
15589                 fi
15590         done
15591         $rm -f try.* try$exe_ext
15592 esac
15593 case "$stdio_stream_array" in
15594 '')     $cat >&4 <<EOM
15595 I can't figure out how to access stdio streams by file descriptor number.
15596 EOM
15597         d_stdio_stream_array="$undef"
15598         ;;
15599 *)      $cat >&4 <<EOM
15600 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15601 EOM
15602         d_stdio_stream_array="$define"
15603         ;;
15604 esac
15605
15606 : see if strcoll exists
15607 set strcoll d_strcoll
15608 eval $inlibc
15609
15610 : check for structure copying
15611 echo " "
15612 echo "Checking to see if your C compiler can copy structs..." >&4
15613 $cat >try.c <<'EOCP'
15614 main()
15615 {
15616         struct blurfl {
15617                 int dyick;
15618         } foo, bar;
15619
15620         foo = bar;
15621 }
15622 EOCP
15623 if $cc -c try.c >/dev/null 2>&1 ; then
15624         val="$define"
15625         echo "Yup, it can."
15626 else
15627         val="$undef"
15628         echo "Nope, it can't."
15629 fi
15630 set d_strctcpy
15631 eval $setvar
15632 $rm -f try.*
15633
15634 : see if strerror and/or sys_errlist[] exist
15635 echo " "
15636 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15637     if set strerror val -f d_strerror; eval $csym; $val; then
15638                 echo 'strerror() found.' >&4
15639                 d_strerror="$define"
15640                 d_strerrm='strerror(e)'
15641                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15642                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15643                         d_syserrlst="$define"
15644                 else
15645                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15646                         d_syserrlst="$undef"
15647                 fi
15648     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15649                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15650                 echo 'strerror() found in string header.' >&4
15651                 d_strerror="$define"
15652                 d_strerrm='strerror(e)'
15653                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15654                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15655                                 d_syserrlst="$define"
15656                 else
15657                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15658                         d_syserrlst="$undef"
15659                 fi
15660     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15661                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15662                 d_strerror="$undef"
15663                 d_syserrlst="$define"
15664                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15665     else
15666                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15667                 d_strerror="$undef"
15668                 d_syserrlst="$undef"
15669                 d_strerrm='"unknown"'
15670     fi
15671 fi
15672
15673 : see if strerror_r exists
15674 set strerror_r d_strerror_r
15675 eval $inlibc
15676 case "$d_strerror_r" in
15677 "$define")
15678         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15679         case "$d_strerror_r_proto:$usethreads" in
15680         ":define")      d_strerror_r_proto=define
15681                 set d_strerror_r_proto strerror_r $hdrs
15682                 eval $hasproto ;;
15683         *)      ;;
15684         esac
15685         case "$d_strerror_r_proto" in
15686         define)
15687         case "$strerror_r_proto" in
15688         ''|0) try='int strerror_r(int, char*, size_t);'
15689         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15690         esac
15691         case "$strerror_r_proto" in
15692         ''|0) try='int strerror_r(int, char*, int);'
15693         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15694         esac
15695         case "$strerror_r_proto" in
15696         ''|0) try='char* strerror_r(int, char*, size_t);'
15697         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15698         esac
15699         case "$strerror_r_proto" in
15700         ''|0)   d_strerror_r=undef
15701                 strerror_r_proto=0
15702                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15703         * )     case "$strerror_r_proto" in
15704                 REENTRANT_PROTO*) ;;
15705                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15706                 esac
15707                 echo "Prototype: $try" ;;
15708         esac
15709         ;;
15710         *)      case "$usethreads" in
15711                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15712                 esac
15713                 d_strerror_r=undef
15714                 strerror_r_proto=0
15715                 ;;
15716         esac
15717         ;;
15718 *)      strerror_r_proto=0
15719         ;;
15720 esac
15721
15722 : see if strftime exists
15723 set strftime d_strftime
15724 eval $inlibc
15725
15726 : see if strtod exists
15727 set strtod d_strtod
15728 eval $inlibc
15729
15730 : see if strtol exists
15731 set strtol d_strtol
15732 eval $inlibc
15733
15734 : see if strtold exists
15735 set strtold d_strtold
15736 eval $inlibc
15737
15738 : see if strtoll exists
15739 set strtoll d_strtoll
15740 eval $inlibc
15741
15742 case "$d_longlong-$d_strtoll" in
15743 "$define-$define")
15744         $cat <<EOM
15745 Checking whether your strtoll() works okay...
15746 EOM
15747         $cat >try.c <<'EOCP'
15748 #include <errno.h>
15749 #ifdef __hpux
15750 #define strtoll __strtoll
15751 #endif
15752 #ifdef __EMX__
15753 #define strtoll _strtoll
15754 #endif
15755 #include <stdio.h>
15756 extern long long int strtoll(char *s, char **, int); 
15757 static int bad = 0;
15758 int check(char *s, long long ell, int een) {
15759         long long gll;
15760         errno = 0;
15761         gll = strtoll(s, 0, 10);
15762         if (!((gll == ell) && (errno == een)))
15763                 bad++;
15764 }
15765 int main() {
15766         check(" 1",                                      1LL, 0);
15767         check(" 0",                                      0LL, 0);
15768         check("-1",                                     -1LL, 0);
15769         check("-9223372036854775808", -9223372036854775808LL, 0);
15770         check("-9223372036854775808", -9223372036854775808LL, 0);
15771         check(" 9223372036854775807",  9223372036854775807LL, 0);
15772         check("-9223372036854775808", -9223372036854775808LL, 0);
15773         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15774         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15775         if (!bad)
15776                 printf("ok\n");
15777 }
15778 EOCP
15779         set try
15780         if eval $compile; then
15781                 yyy=`$run ./try`
15782                 case "$yyy" in
15783                 ok) echo "Your strtoll() seems to be working okay." ;;
15784                 *) cat <<EOM >&4
15785 Your strtoll() doesn't seem to be working okay.
15786 EOM
15787                    d_strtoll="$undef"
15788                    ;;
15789                 esac
15790         else
15791                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15792                 d_strtoll="$undef"
15793         fi
15794         ;;
15795 esac
15796
15797 : see if strtoq exists
15798 set strtoq d_strtoq
15799 eval $inlibc
15800
15801 : see if strtoul exists
15802 set strtoul d_strtoul
15803 eval $inlibc
15804
15805 case "$d_strtoul" in
15806 "$define")
15807         $cat <<EOM
15808 Checking whether your strtoul() works okay...
15809 EOM
15810         $cat >try.c <<'EOCP'
15811 #include <errno.h>
15812 #include <stdio.h>
15813 extern unsigned long int strtoul(char *s, char **, int); 
15814 static int bad = 0;
15815 void check(char *s, unsigned long eul, int een) {
15816         unsigned long gul;
15817         errno = 0;
15818         gul = strtoul(s, 0, 10);
15819         if (!((gul == eul) && (errno == een)))
15820                 bad++;
15821 }
15822 int main() {
15823         check(" 1", 1L, 0);
15824         check(" 0", 0L, 0);
15825 EOCP
15826         case "$longsize" in
15827         8)
15828             $cat >>try.c <<'EOCP'
15829         check("18446744073709551615", 18446744073709551615UL, 0);
15830         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15831 #if 0 /* strtoul() for /^-/ strings is undefined. */
15832         check("-1", 18446744073709551615UL, 0);
15833         check("-18446744073709551614", 2, 0);
15834         check("-18446744073709551615", 1, 0);
15835         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15836         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15837 #endif
15838 EOCP
15839                 ;;
15840         4)
15841                     $cat >>try.c <<'EOCP'
15842         check("4294967295", 4294967295UL, 0);
15843         check("4294967296", 4294967295UL, ERANGE);
15844 #if 0 /* strtoul() for /^-/ strings is undefined. */
15845         check("-1", 4294967295UL, 0);
15846         check("-4294967294", 2, 0);
15847         check("-4294967295", 1, 0);
15848         check("-4294967296", 4294967295UL, ERANGE);
15849         check("-4294967297", 4294967295UL, ERANGE);
15850 #endif
15851 EOCP
15852                 ;;
15853         *)
15854 : Should we write these tests to be more portable by sprintf-ing
15855 : ~0 and then manipulating that char string as input for strtol?
15856                 ;;
15857         esac
15858         $cat >>try.c <<'EOCP'
15859         if (!bad)
15860                 printf("ok\n");
15861         return 0;
15862 }
15863 EOCP
15864         set try
15865         if eval $compile; then
15866                 case "`$run ./try`" in
15867                 ok) echo "Your strtoul() seems to be working okay." ;;
15868                 *) cat <<EOM >&4
15869 Your strtoul() doesn't seem to be working okay.
15870 EOM
15871                    d_strtoul="$undef"
15872                    ;;
15873                 esac
15874         fi
15875         ;;
15876 esac
15877
15878 : see if strtoull exists
15879 set strtoull d_strtoull
15880 eval $inlibc
15881
15882 case "$d_longlong-$d_strtoull" in
15883 "$define-$define")
15884         $cat <<EOM
15885 Checking whether your strtoull() works okay...
15886 EOM
15887         $cat >try.c <<'EOCP'
15888 #include <errno.h>
15889 #ifdef __hpux
15890 #define strtoull __strtoull
15891 #endif
15892 #include <stdio.h>
15893 extern unsigned long long int strtoull(char *s, char **, int); 
15894 static int bad = 0;
15895 int check(char *s, long long eull, int een) {
15896         long long gull;
15897         errno = 0;
15898         gull = strtoull(s, 0, 10);
15899         if (!((gull == eull) && (errno == een)))
15900                 bad++;
15901 }
15902 int main() {
15903         check(" 1",                                        1LL, 0);
15904         check(" 0",                                        0LL, 0);
15905         check("18446744073709551615",  18446744073709551615ULL, 0);
15906         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15907 #if 0 /* strtoull() for /^-/ strings is undefined. */
15908         check("-1",                    18446744073709551615ULL, 0);
15909         check("-18446744073709551614",                     2LL, 0);
15910         check("-18446744073709551615",                     1LL, 0);
15911         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15912         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15913 #endif
15914         if (!bad)
15915                 printf("ok\n");
15916 }
15917 EOCP
15918         set try
15919         if eval $compile; then
15920                 case "`$run ./try`" in
15921                 ok) echo "Your strtoull() seems to be working okay." ;;
15922                 *) cat <<EOM >&4
15923 Your strtoull() doesn't seem to be working okay.
15924 EOM
15925                    d_strtoull="$undef"
15926                    ;;
15927                 esac
15928         fi
15929         ;;
15930 esac
15931
15932 : see if strtouq exists
15933 set strtouq d_strtouq
15934 eval $inlibc
15935
15936 case "$d_strtouq" in
15937 "$define")
15938         $cat <<EOM
15939 Checking whether your strtouq() works okay...
15940 EOM
15941         $cat >try.c <<'EOCP'
15942 #include <errno.h>
15943 #include <stdio.h>
15944 extern unsigned long long int strtouq(char *s, char **, int); 
15945 static int bad = 0;
15946 void check(char *s, unsigned long long eull, int een) {
15947         unsigned long long gull;
15948         errno = 0;
15949         gull = strtouq(s, 0, 10);
15950         if (!((gull == eull) && (errno == een)))
15951                 bad++;
15952 }
15953 int main() {
15954         check(" 1",                                        1LL, 0);
15955         check(" 0",                                        0LL, 0);
15956         check("18446744073709551615",  18446744073709551615ULL, 0);
15957         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15958 #if 0 /* strtouq() for /^-/ strings is undefined. */
15959         check("-1",                    18446744073709551615ULL, 0);
15960         check("-18446744073709551614",                     2LL, 0);
15961         check("-18446744073709551615",                     1LL, 0);
15962         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15963         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15964 #endif
15965         if (!bad)
15966                 printf("ok\n");
15967         return 0;
15968 }
15969 EOCP
15970         set try
15971         if eval $compile; then
15972                 case "`$run ./try`" in
15973                 ok) echo "Your strtouq() seems to be working okay." ;;
15974                 *) cat <<EOM >&4
15975 Your strtouq() doesn't seem to be working okay.
15976 EOM
15977                    d_strtouq="$undef"
15978                    ;;
15979                 esac
15980         fi
15981         ;;
15982 esac
15983
15984 : see if strxfrm exists
15985 set strxfrm d_strxfrm
15986 eval $inlibc
15987
15988 : see if symlink exists
15989 set symlink d_symlink
15990 eval $inlibc
15991
15992 : see if syscall exists
15993 set syscall d_syscall
15994 eval $inlibc
15995
15996 : see if prototype for syscall is available
15997 echo " "
15998 set d_syscallproto syscall $i_unistd unistd.h
15999 eval $hasproto
16000
16001 : see if sysconf exists
16002 set sysconf d_sysconf
16003 eval $inlibc
16004
16005 : see if system exists
16006 set system d_system
16007 eval $inlibc
16008
16009 : see if tcgetpgrp exists
16010 set tcgetpgrp d_tcgetpgrp
16011 eval $inlibc
16012
16013 : see if tcsetpgrp exists
16014 set tcsetpgrp d_tcsetpgrp
16015 eval $inlibc
16016
16017 : see if prototype for telldir is available
16018 echo " "
16019 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16020 eval $hasproto
16021
16022 : see if time exists
16023 echo " "
16024 if test "X$d_time" = X -o X"$timetype" = X; then
16025     if set time val -f d_time; eval $csym; $val; then
16026                 echo 'time() found.' >&4
16027                 val="$define"
16028                 rp="What is the type returned by time() on this system?"
16029                 set time_t timetype long stdio.h sys/types.h
16030                 eval $typedef_ask
16031     else
16032                 echo 'time() not found, hope that will do.' >&4
16033                 val="$undef"
16034                 timetype='int';
16035     fi
16036     set d_time
16037     eval $setvar
16038 fi
16039
16040 : see if this is a sys/times.h system
16041 set sys/times.h i_systimes
16042 eval $inhdr
16043
16044 : see if times exists
16045 echo " "
16046 if set times val -f d_times; eval $csym; $val; then
16047         echo 'times() found.' >&4
16048         d_times="$define"
16049         inc=''
16050         case "$i_systimes" in
16051         "$define") inc='sys/times.h';;
16052         esac
16053         rp="What is the type returned by times() on this system?"
16054         set clock_t clocktype long stdio.h sys/types.h $inc
16055         eval $typedef_ask
16056 else
16057         echo 'times() NOT found, hope that will do.' >&4
16058         d_times="$undef"
16059         clocktype='int'
16060 fi
16061
16062 : see if tmpnam_r exists
16063 set tmpnam_r d_tmpnam_r
16064 eval $inlibc
16065 case "$d_tmpnam_r" in
16066 "$define")
16067         hdrs="$i_systypes sys/types.h define stdio.h "
16068         case "$d_tmpnam_r_proto:$usethreads" in
16069         ":define")      d_tmpnam_r_proto=define
16070                 set d_tmpnam_r_proto tmpnam_r $hdrs
16071                 eval $hasproto ;;
16072         *)      ;;
16073         esac
16074         case "$d_tmpnam_r_proto" in
16075         define)
16076         case "$tmpnam_r_proto" in
16077         ''|0) try='char* tmpnam_r(char*);'
16078         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16079         esac
16080         case "$tmpnam_r_proto" in
16081         ''|0)   d_tmpnam_r=undef
16082                 tmpnam_r_proto=0
16083                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16084         * )     case "$tmpnam_r_proto" in
16085                 REENTRANT_PROTO*) ;;
16086                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16087                 esac
16088                 echo "Prototype: $try" ;;
16089         esac
16090         ;;
16091         *)      case "$usethreads" in
16092                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16093                 esac
16094                 d_tmpnam_r=undef
16095                 tmpnam_r_proto=0
16096                 ;;
16097         esac
16098         ;;
16099 *)      tmpnam_r_proto=0
16100         ;;
16101 esac
16102
16103 : see if truncate exists
16104 set truncate d_truncate
16105 eval $inlibc
16106
16107 : see if ttyname_r exists
16108 set ttyname_r d_ttyname_r
16109 eval $inlibc
16110 case "$d_ttyname_r" in
16111 "$define")
16112         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16113         case "$d_ttyname_r_proto:$usethreads" in
16114         ":define")      d_ttyname_r_proto=define
16115                 set d_ttyname_r_proto ttyname_r $hdrs
16116                 eval $hasproto ;;
16117         *)      ;;
16118         esac
16119         case "$d_ttyname_r_proto" in
16120         define)
16121         case "$ttyname_r_proto" in
16122         ''|0) try='int ttyname_r(int, char*, size_t);'
16123         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16124         esac
16125         case "$ttyname_r_proto" in
16126         ''|0) try='int ttyname_r(int, char*, int);'
16127         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16128         esac
16129         case "$ttyname_r_proto" in
16130         ''|0) try='char* ttyname_r(int, char*, int);'
16131         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16132         esac
16133         case "$ttyname_r_proto" in
16134         ''|0)   d_ttyname_r=undef
16135                 ttyname_r_proto=0
16136                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16137         * )     case "$ttyname_r_proto" in
16138                 REENTRANT_PROTO*) ;;
16139                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16140                 esac
16141                 echo "Prototype: $try" ;;
16142         esac
16143         ;;
16144         *)      case "$usethreads" in
16145                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16146                 esac
16147                 d_ttyname_r=undef
16148                 ttyname_r_proto=0
16149                 ;;
16150         esac
16151         ;;
16152 *)      ttyname_r_proto=0
16153         ;;
16154 esac
16155
16156 : see if tzname[] exists
16157 echo " "
16158 if set tzname val -a d_tzname; eval $csym; $val; then
16159         val="$define"
16160         echo 'tzname[] found.' >&4
16161 else
16162         val="$undef"
16163         echo 'tzname[] NOT found.' >&4
16164 fi
16165 set d_tzname
16166 eval $setvar
16167
16168 case "$osname" in
16169 next|rhapsody|darwin) multiarch="$define" ;;
16170 esac
16171 case "$multiarch" in
16172 ''|[nN]*) multiarch="$undef" ;;
16173 esac
16174
16175 : check for ordering of bytes in a UV
16176 echo " "
16177 case "$usecrosscompile$multiarch" in
16178 *$define*)
16179         $cat <<EOM
16180 You seem to be either cross-compiling or doing a multiarchitecture build,
16181 skipping the byteorder check.
16182
16183 EOM
16184         byteorder='ffff'
16185         ;;
16186 *)
16187         case "$byteorder" in
16188         '')
16189                 $cat <<'EOM'
16190 In the following, larger digits indicate more significance.  A big-endian
16191 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16192 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16193 machines may have weird orders like 3412.  A Cray will report 87654321,
16194 an Alpha will report 12345678. If the test program works the default is
16195 probably right.
16196 I'm now running the test program...
16197 EOM
16198                 $cat >try.c <<EOCP
16199 #include <stdio.h>
16200 #include <sys/types.h>
16201 typedef $uvtype UV;
16202 int main()
16203 {
16204         int i;
16205         union {
16206                 UV l;
16207                 char c[$uvsize];
16208         } u;
16209
16210         if ($uvsize > 4)
16211                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16212         else
16213                 u.l = (UV)0x04030201;
16214         for (i = 0; i < $uvsize; i++)
16215                 printf("%c", u.c[i]+'0');
16216         printf("\n");
16217         exit(0);
16218 }
16219 EOCP
16220                 xxx_prompt=y
16221                 set try
16222                 if eval $compile && ./try > /dev/null; then
16223                         dflt=`$run ./try`
16224                         case "$dflt" in
16225                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16226                                 echo "(The test program ran ok.)"
16227                                 echo "byteorder=$dflt"
16228                                 xxx_prompt=n
16229                         ;;
16230                         ????|????????) echo "(The test program ran ok.)" ;;
16231                         *) echo "(The test program didn't run right for some reason.)" ;;
16232                         esac
16233                 else
16234                         dflt='4321'
16235                         cat <<'EOM'
16236 (I can't seem to compile the test program.  Guessing big-endian...)
16237 EOM
16238                 fi
16239                 case "$xxx_prompt" in
16240                 y)
16241                         rp="What is the order of bytes in $uvtype?"
16242                         . ./myread
16243                         byteorder="$ans"
16244                         ;;
16245                 *)      byteorder=$dflt
16246                         ;;
16247                 esac
16248                 ;;
16249         esac
16250         $rm -f try.c try
16251         ;;
16252 esac
16253
16254
16255 $cat <<EOM
16256
16257 Checking to see whether you can access character data unalignedly...
16258 EOM
16259 case "$d_u32align" in
16260 '')   $cat >try.c <<EOCP
16261 #include <stdio.h>
16262 #define U32 $u32type
16263 #define BYTEORDER 0x$byteorder
16264 #define U8 $u8type
16265 #include <signal.h>
16266 #ifdef SIGBUS
16267 $signal_t bletch(s) int s; { exit(4); }
16268 #endif
16269 int main() {
16270 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16271     U8 buf[8];
16272     U32 *up;
16273     int i;
16274
16275     if (sizeof(U32) != 4) {
16276         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16277         exit(1);
16278     }
16279
16280     fflush(stdout);
16281
16282 #ifdef SIGBUS
16283     signal(SIGBUS, bletch);
16284 #endif
16285
16286     buf[0] = 0;
16287     buf[1] = 0;
16288     buf[2] = 0;
16289     buf[3] = 1;
16290     buf[5] = 0;
16291     buf[6] = 0;
16292     buf[7] = 0;
16293     buf[8] = 1;
16294
16295     for (i = 0; i < 4; i++) {
16296         up = (U32*)(buf + i);
16297         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16298                (*up == 1 << (8*(3-i)))  /* little-endian */
16299               )
16300            )
16301         {
16302             printf("read failed (%x)\n", *up);
16303             exit(2);
16304         }
16305     }
16306
16307     /* write test */
16308     for (i = 0; i < 4; i++) {
16309         up = (U32*)(buf + i);
16310         *up = 0xBeef;
16311         if (*up != 0xBeef) {
16312             printf("write failed (%x)\n", *up);
16313             exit(3);
16314         }
16315     }
16316
16317     exit(0);
16318 #else
16319     printf("1\n");
16320     exit(1);
16321 #endif
16322     return 0;
16323 }
16324 EOCP
16325 set try
16326 if eval $compile_ok; then
16327         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16328         $run ./try 2>&1 >/dev/null
16329         case "$?" in
16330         0)      cat >&4 <<EOM
16331 You can access character data pretty unalignedly.
16332 EOM
16333                 d_u32align="$undef"
16334                 ;;
16335         *)      cat >&4 <<EOM
16336 It seems that you must access character data in an aligned manner.
16337 EOM
16338                 d_u32align="$define"
16339                 ;;
16340         esac
16341 else
16342         rp='Can you access character data at unaligned addresses?'
16343         dflt='n'
16344         . ./myread
16345         case "$ans" in
16346         [yY]*)  d_u32align="$undef"  ;;
16347         *)      d_u32align="$define" ;;
16348         esac
16349 fi
16350 $rm -f core core.try.* try.core
16351 ;;
16352 esac
16353
16354 : see if ualarm exists
16355 set ualarm d_ualarm
16356 eval $inlibc
16357
16358 : see if umask exists
16359 set umask d_umask
16360 eval $inlibc
16361
16362 : see if unordered exists
16363 set unordered d_unordered
16364 eval $inlibc
16365
16366 : see if usleep exists
16367 set usleep d_usleep
16368 eval $inlibc
16369
16370 : see if prototype for usleep is available
16371 echo " "
16372 set d_usleepproto usleep $i_unistd unistd.h
16373 eval $hasproto
16374
16375 : see if ustat exists
16376 set ustat d_ustat
16377 eval $inlibc
16378
16379 : backward compatibility for d_hvfork
16380 if test X$d_hvfork != X; then
16381         d_vfork="$d_hvfork"
16382         d_hvfork=''
16383 fi
16384 : see if there is a vfork
16385 val=''
16386 set vfork val
16387 eval $inlibc
16388
16389 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16390 : perl on Solaris 2.x, and probably elsewhere.
16391 case "$val" in
16392 $define)
16393         echo " "
16394         case "$usevfork" in
16395         false) dflt='n';;
16396         *) dflt='y';;
16397         esac
16398         cat <<'EOM'
16399  
16400 Perl can only use a vfork() that doesn't suffer from strict
16401 restrictions on calling functions or modifying global data in
16402 the child.  For example, glibc-2.1 contains such a vfork()
16403 that is unsuitable.  If your system provides a proper fork()
16404 call, chances are that you do NOT want perl to use vfork().
16405
16406 EOM
16407         rp="Do you still want to use vfork()?"
16408         . ./myread
16409         case "$ans" in
16410         y|Y) ;;
16411         *)
16412                 echo "Ok, we won't use vfork()."
16413                 val="$undef"
16414                 ;;
16415         esac
16416         ;;
16417 esac
16418 set d_vfork
16419 eval $setvar
16420 case "$d_vfork" in
16421 $define) usevfork='true';;
16422 *) usevfork='false';;
16423 esac
16424
16425 : see if closedir exists
16426 set closedir d_closedir
16427 eval $inlibc
16428
16429 case "$d_closedir" in
16430 "$define")
16431         echo " "
16432         echo "Checking whether closedir() returns a status..." >&4
16433         cat > try.c <<EOM
16434 #$i_dirent I_DIRENT             /**/
16435 #$i_sysdir I_SYS_DIR            /**/
16436 #$i_sysndir I_SYS_NDIR          /**/
16437 #$i_systypes I_SYS_TYPES        /**/
16438
16439 #if defined(I_SYS_TYPES)
16440 #include <sys/types.h>
16441 #endif
16442 #if defined(I_DIRENT)
16443 #include <dirent.h>
16444 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16445 #include <sys/dir.h>
16446 #endif
16447 #else
16448 #ifdef I_SYS_NDIR
16449 #include <sys/ndir.h>
16450 #else
16451 #ifdef I_SYS_DIR
16452 #ifdef hp9000s500
16453 #include <ndir.h>       /* may be wrong in the future */
16454 #else
16455 #include <sys/dir.h>
16456 #endif
16457 #endif
16458 #endif
16459 #endif 
16460 int main() { return closedir(opendir(".")); }
16461 EOM
16462         set try
16463         if eval $compile_ok; then
16464                 if $run ./try > /dev/null 2>&1 ; then
16465                         echo "Yes, it does."
16466                         val="$undef"
16467                 else
16468                         echo "No, it doesn't."
16469                         val="$define"
16470                 fi
16471         else
16472                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16473                 val="$define"
16474         fi
16475         ;;
16476 *)
16477         val="$undef";
16478         ;;
16479 esac
16480 set d_void_closedir
16481 eval $setvar
16482 $rm -f try try.*
16483 : see if there is a wait4
16484 set wait4 d_wait4
16485 eval $inlibc
16486
16487 : see if waitpid exists
16488 set waitpid d_waitpid
16489 eval $inlibc
16490
16491 : see if wcstombs exists
16492 set wcstombs d_wcstombs
16493 eval $inlibc
16494
16495 : see if wctomb exists
16496 set wctomb d_wctomb
16497 eval $inlibc
16498
16499 : see if writev exists
16500 set writev d_writev
16501 eval $inlibc
16502
16503 : preserve RCS keywords in files with variable substitution, grrr
16504 Date='$Date'
16505 Id='$Id'
16506 Log='$Log'
16507 RCSfile='$RCSfile'
16508 Revision='$Revision'
16509
16510 : check for alignment requirements
16511 echo " "
16512 case "$usecrosscompile$multiarch" in
16513 *$define*)
16514         $cat <<EOM
16515 You seem to be either cross-compiling or doing a multiarchitecture build,
16516 skipping the memory alignment check.
16517
16518 EOM
16519         case "$alignbytes" in
16520         '') alignbytes=8 ;;
16521         esac
16522         ;;
16523 *)
16524         case "$alignbytes" in
16525         '') echo "Checking alignment constraints..." >&4
16526                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16527                         $cat >try.c <<'EOCP'
16528 typedef long double NV;
16529 EOCP
16530                 else
16531                         $cat >try.c <<'EOCP'
16532 typedef double NV;
16533 EOCP
16534                 fi
16535                 $cat >>try.c <<'EOCP'
16536 #include <stdio.h>
16537 struct foobar {
16538         char foo;
16539         NV bar;
16540 } try_algn;
16541 int main()
16542 {
16543     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16544     return(0);
16545 }
16546 EOCP
16547                 set try
16548                 if eval $compile_ok; then
16549                         dflt=`$run ./try`
16550                 else
16551                         dflt='8'
16552                         echo "(I can't seem to compile the test program...)"
16553                 fi
16554                 ;;
16555         *) dflt="$alignbytes"
16556                 ;;
16557         esac
16558         rp="Doubles must be aligned on a how-many-byte boundary?"
16559         . ./myread
16560         alignbytes="$ans"
16561         $rm -f try.c try
16562         ;;
16563 esac
16564
16565
16566 : set the base revision
16567 baserev=5.0
16568
16569 : how do we catenate cpp tokens here?
16570 echo " "
16571 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16572 $cat >cpp_stuff.c <<'EOCP'
16573 #define RCAT(a,b)a/**/b
16574 #define ACAT(a,b)a ## b
16575 RCAT(Rei,ser)
16576 ACAT(Cir,cus)
16577 EOCP
16578 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16579 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16580         echo "Oh!  Smells like ANSI's been here." >&4
16581         echo "We can catify or stringify, separately or together!"
16582         cpp_stuff=42
16583 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16584         echo "Ah, yes!  The good old days!" >&4
16585         echo "However, in the good old days we don't know how to stringify and"
16586         echo "catify at the same time."
16587         cpp_stuff=1
16588 else
16589         $cat >&4 <<EOM
16590 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16591 to have to edit the values of CAT[2-5] in config.h...
16592 EOM
16593         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16594 fi
16595 $rm -f cpp_stuff.*
16596
16597 : see if this is a db.h system
16598 set db.h i_db
16599 eval $inhdr
16600
16601 case "$i_db" in
16602 $define)
16603         : Check db version.
16604         echo " "
16605         echo "Checking Berkeley DB version ..." >&4
16606         $cat >try.c <<EOCP
16607 #$d_const HASCONST
16608 #ifndef HASCONST
16609 #define const
16610 #endif
16611 #include <sys/types.h>
16612 #include <stdio.h>
16613 #include <db.h>
16614 int main(int argc, char *argv[])
16615 {
16616 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16617     int Major, Minor, Patch ;
16618     unsigned long Version ;
16619     (void)db_version(&Major, &Minor, &Patch) ;
16620     if (argc == 2) {
16621         printf("%d %d %d %d %d %d\n",
16622                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16623                Major, Minor, Patch);
16624         exit(0);
16625     }
16626     printf("You have Berkeley DB Version 2 or greater.\n");
16627
16628     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16629                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16630     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16631                 Major, Minor, Patch) ;
16632
16633     /* check that db.h & libdb are compatible */
16634     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16635         printf("db.h and libdb are incompatible.\n") ;
16636         exit(3);        
16637     }
16638
16639     printf("db.h and libdb are compatible.\n") ;
16640
16641     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16642                 + DB_VERSION_PATCH ;
16643
16644     /* needs to be >= 2.3.4 */
16645     if (Version < 2003004) {
16646     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16647         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16648         exit(2);        
16649     }
16650
16651     exit(0);
16652 #else
16653 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16654     if (argc == 2) {
16655         printf("1 0 0\n");
16656         exit(0);
16657     }
16658     printf("You have Berkeley DB Version 1.\n");
16659     exit(0);    /* DB version < 2: the coast is clear. */
16660 #else
16661     exit(1);    /* <db.h> not Berkeley DB? */
16662 #endif
16663 #endif
16664 }
16665 EOCP
16666         set try
16667         if eval $compile_ok && $run ./try; then
16668                 echo 'Looks OK.' >&4
16669                 set `$run ./try 1`
16670                 db_version_major=$1
16671                 db_version_minor=$2
16672                 db_version_patch=$3
16673         else
16674                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16675                 i_db=$undef
16676                 case " $libs " in
16677                 *"-ldb "*)
16678                         : Remove db from list of libraries to use
16679                         echo "Removing unusable -ldb from library list" >&4
16680                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16681                         shift
16682                         libs="$*"
16683                         echo "libs = $libs" >&4
16684                         ;;
16685                 esac
16686         fi
16687         $rm -f try.*
16688         ;;
16689 esac
16690
16691 case "$i_db" in
16692 define)
16693         : Check the return type needed for hash 
16694         echo " "
16695         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16696         $cat >try.c <<EOCP
16697 #$d_const HASCONST
16698 #ifndef HASCONST
16699 #define const
16700 #endif
16701 #include <sys/types.h>
16702 #include <db.h>
16703
16704 #ifndef DB_VERSION_MAJOR
16705 u_int32_t hash_cb (ptr, size)
16706 const void *ptr;
16707 size_t size;
16708 {
16709 }
16710 HASHINFO info;
16711 int main()
16712 {
16713         info.hash = hash_cb;
16714 }
16715 #endif
16716 EOCP
16717         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16718                 if $contains warning try.out >>/dev/null 2>&1 ; then
16719                         db_hashtype='int'
16720                 else
16721                         db_hashtype='u_int32_t'
16722                 fi
16723         else
16724                 : XXX Maybe we should just give up here.
16725                 db_hashtype=u_int32_t
16726                 $cat try.out >&4
16727                 echo "Help:  I can't seem to compile the db test program." >&4
16728                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16729         fi
16730         $rm -f try.*
16731         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16732         ;;
16733 *)      db_hashtype=u_int32_t
16734         ;;
16735 esac
16736 case "$i_db" in
16737 define)
16738         : Check the return type needed for prefix 
16739         echo " "
16740         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16741         cat >try.c <<EOCP
16742 #$d_const HASCONST
16743 #ifndef HASCONST
16744 #define const
16745 #endif
16746 #include <sys/types.h>
16747 #include <db.h>
16748
16749 #ifndef DB_VERSION_MAJOR
16750 size_t prefix_cb (key1, key2)
16751 const DBT *key1;
16752 const DBT *key2;
16753 {
16754 }
16755 BTREEINFO info;
16756 int main()
16757 {
16758         info.prefix = prefix_cb;
16759 }
16760 #endif
16761 EOCP
16762         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16763                 if $contains warning try.out >>/dev/null 2>&1 ; then
16764                         db_prefixtype='int'
16765                 else
16766                         db_prefixtype='size_t'
16767                 fi
16768         else
16769                 db_prefixtype='size_t'
16770                 : XXX Maybe we should just give up here.
16771                 $cat try.out >&4
16772                 echo "Help:  I can't seem to compile the db test program." >&4
16773                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16774         fi
16775         $rm -f try.*
16776         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16777         ;;
16778 *)      db_prefixtype='size_t'
16779         ;;
16780 esac
16781
16782
16783 : How can we generate normalized random numbers ?
16784 echo " "
16785 echo "Looking for a random number function..." >&4
16786 case "$randfunc" in
16787 '')
16788         if set drand48 val -f; eval $csym; $val; then
16789                 dflt="drand48"
16790                 echo "Good, found drand48()." >&4
16791         elif set random val -f; eval $csym; $val; then
16792                 dflt="random"
16793                 echo "OK, found random()." >&4
16794         else
16795                 dflt="rand"
16796                 echo "Yick, looks like I have to use rand()." >&4
16797         fi
16798         echo " "
16799         ;;
16800 *)
16801         dflt="$randfunc"
16802         ;;
16803 esac
16804 cont=true
16805
16806 case "$ccflags" in
16807 *-Dmy_rand=*|*-Dmy_srand=*)
16808         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16809         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16810         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16811         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16812         ;;
16813 esac
16814
16815 while $test "$cont"; do
16816         rp="Use which function to generate random numbers?"
16817         . ./myread
16818         if $test "$ans" = "$dflt"; then
16819                 : null
16820         else
16821                 randbits=''
16822         fi
16823         randfunc="$ans"
16824         if set $ans val -f; eval $csym; $val; then
16825                 cont=''
16826         else
16827                 dflt=y
16828                 rp="I cannot find function $ans. Use that name anyway?"
16829                 . ./myread
16830                 dflt=rand
16831                 case "$ans" in
16832                         [yY]*) cont='';;
16833                 esac
16834         fi
16835         case "$cont" in
16836         '')
16837                 case "$randfunc" in
16838                 drand48)
16839                         drand01="drand48()"
16840                         seedfunc="srand48"
16841                         randbits=48
16842                         randseedtype=long
16843                         ;;
16844                 rand|random)
16845                         case "$randbits" in
16846                         '')
16847 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16848                                 $cat >try.c <<EOCP
16849 #$i_unistd I_UNISTD
16850 #$i_stdlib I_STDLIB
16851 #include <stdio.h>
16852 #ifdef I_UNISTD
16853 #  include <unistd.h>
16854 #endif
16855 #ifdef I_STDLIB
16856 #  include <stdlib.h>
16857 #endif
16858 int main()
16859 {
16860         register int i;
16861         register unsigned long tmp;
16862         register unsigned long max = 0L;
16863
16864         for (i = 1000; i; i--) {
16865                 tmp = (unsigned long) $randfunc();
16866                 if (tmp > max) max = tmp;
16867         }
16868         for (i = 0; max; i++)
16869                 max /= 2;
16870         printf("%d\n",i);
16871 }
16872 EOCP
16873                                 set try
16874                                 if eval $compile_ok; then
16875                                         dflt=`try`
16876                                 else
16877                                         dflt='?'
16878                                         echo "(I can't seem to compile the test program...)"
16879                                 fi
16880                                 ;;
16881                         *)
16882                                 dflt="$randbits"
16883                                 ;;
16884                         esac
16885                         rp="How many bits does your $randfunc() function produce?"
16886                         . ./myread
16887                         randbits="$ans"
16888                         $rm -f try.c try
16889                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16890                         seedfunc="s$randfunc"
16891                         randseedtype=unsigned
16892                         ;;
16893                 *)
16894                         dflt="31"
16895                         rp="How many bits does your $randfunc() function produce?"
16896                         . ./myread
16897                         randbits="$ans"
16898                         seedfunc="s$randfunc"
16899                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16900                         if set $seedfunc val -f; eval $csym; $val; then
16901                                 echo "(Using $seedfunc() to seed random generator)"
16902                         else
16903                                 echo "(Warning: no $seedfunc() to seed random generator)"
16904                                 seedfunc=rand
16905                         fi
16906                         randseedtype=unsigned
16907                         ;;
16908                 esac
16909                 ;;
16910         esac
16911 done
16912
16913 echo " "
16914 echo "Determining whether or not we are on an EBCDIC system..." >&4
16915 $cat >try.c <<'EOM'
16916 int main()
16917 {
16918   if ('M'==0xd4) return 0;
16919   return 1;
16920 }
16921 EOM
16922
16923 val=$undef
16924 set try
16925 if eval $compile_ok; then
16926         if $run ./try; then
16927                 echo "You seem to speak EBCDIC." >&4
16928                 val="$define"
16929         else
16930                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16931         fi
16932 else
16933         echo "I'm unable to compile the test program." >&4
16934         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16935 fi
16936 $rm -f try try.*
16937 set ebcdic
16938 eval $setvar
16939
16940 echo " "
16941 $cat >&4 <<EOM
16942 Checking how to flush all pending stdio output...
16943 EOM
16944 # I only know how to find the first 32 possibly open files on SunOS.
16945 # See also hints/sunos_4_1.sh and util.c  --AD
16946 case "$osname" in
16947 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16948 esac
16949 $cat >>try.c <<EOCP
16950 #include <stdio.h>
16951 #$i_unistd I_UNISTD
16952 #ifdef I_UNISTD
16953 # include <unistd.h>
16954 #endif
16955 #$d_sysconf HAS_SYSCONF
16956 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16957 #ifdef HAS_STDIO_STREAM_ARRAY
16958 # define STDIO_STREAM_ARRAY $stdio_stream_array
16959 #endif
16960 int main() {
16961   FILE* p;
16962   unlink("try.out");
16963   p = fopen("try.out", "w");
16964 #ifdef TRY_FPUTC
16965   fputc('x', p);
16966 #else
16967 # ifdef TRY_FPRINTF
16968   fprintf(p, "x");
16969 # endif
16970 #endif
16971 #ifdef TRY_FFLUSH_NULL
16972   fflush(NULL);
16973 #endif
16974 #ifdef TRY_FFLUSH_ALL
16975   {
16976     long open_max = -1;
16977 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16978     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16979 # else
16980 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16981     open_max = sysconf(_SC_OPEN_MAX);
16982 #  else
16983 #   ifdef FOPEN_MAX
16984     open_max = FOPEN_MAX;
16985 #   else
16986 #    ifdef OPEN_MAX
16987     open_max = OPEN_MAX;
16988 #    else
16989 #     ifdef _NFILE
16990     open_max = _NFILE;
16991 #     endif
16992 #    endif
16993 #   endif
16994 #  endif
16995 # endif 
16996 # ifdef HAS_STDIO_STREAM_ARRAY
16997     if (open_max > 0) {
16998       long i;
16999       for (i = 0; i < open_max; i++)
17000             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17001                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17002                 STDIO_STREAM_ARRAY[i]._flag)
17003                 fflush(&STDIO_STREAM_ARRAY[i]);
17004     }   
17005   }
17006 # endif
17007 #endif
17008   _exit(42);
17009 }
17010 EOCP
17011 : first we have to find out how _not_ to flush
17012 $to try.c
17013 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17014     output=''
17015     set try -DTRY_FPUTC
17016     if eval $compile; then
17017             $run ./try 2>/dev/null
17018             code="$?"
17019             $from try.out
17020             if $test ! -s try.out -a "X$code" = X42; then
17021                 output=-DTRY_FPUTC
17022             fi
17023     fi
17024     case "$output" in
17025     '')
17026             set try -DTRY_FPRINTF
17027             if eval $compile; then
17028                     $run ./try 2>/dev/null
17029                     code="$?"
17030                     $from try.out
17031                     if $test ! -s try.out -a "X$code" = X42; then
17032                         output=-DTRY_FPRINTF
17033                     fi
17034             fi
17035         ;;
17036     esac
17037 fi
17038 : check for fflush NULL behaviour
17039 case "$fflushNULL" in
17040 '')     set try -DTRY_FFLUSH_NULL $output
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                         fflushNULL="`$cat try.out`"
17047                 else
17048                         if $test "X$code" != X42; then
17049                                 $cat >&4 <<EOM
17050 (If this test failed, don't worry, we'll try another method shortly.)
17051 EOM
17052                         fi
17053                 fi
17054         fi
17055         $rm -f core try.core core.try.*
17056         case "$fflushNULL" in
17057         x)      $cat >&4 <<EOM
17058 Your fflush(NULL) works okay for output streams.
17059 Let's see if it clobbers input pipes...
17060 EOM
17061 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17062 # bug that improperly flushes the input end of pipes.  So we avoid the
17063 # autoflush on fork/system/exec support for now. :-(
17064 $cat >tryp.c <<EOCP
17065 #include <stdio.h>
17066 int
17067 main(int argc, char **argv)
17068 {
17069     char buf[1024];
17070     int i;
17071     char *bp = buf;
17072     while (1) {
17073         while ((i = getc(stdin)) != -1
17074                && (*bp++ = i) != '\n'
17075                && bp < &buf[1024])
17076         /* DO NOTHING */ ;
17077         *bp = '\0';
17078         fprintf(stdout, "%s", buf);
17079         fflush(NULL);
17080         if (i == -1)
17081             return 0;
17082         bp = buf;
17083     }
17084 }
17085 EOCP
17086                 fflushNULL="$define"
17087                 set tryp
17088                 if eval $compile; then
17089                     $rm -f tryp.out
17090                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17091                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17092                        $cat >&4 <<EOM
17093 fflush(NULL) seems to behave okay with input streams.
17094 EOM
17095                         fflushNULL="$define"
17096                     else
17097                         $cat >&4 <<EOM
17098 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17099 EOM
17100                         fflushNULL="$undef"
17101                     fi
17102                 fi
17103                 $rm -f core tryp.c tryp.core core.tryp.*
17104                 ;;
17105         '')     $cat >&4 <<EOM
17106 Your fflush(NULL) isn't working (contrary to ANSI C).
17107 EOM
17108                 fflushNULL="$undef"
17109                 ;;
17110         *)      $cat >&4 <<EOM
17111 Cannot figure out whether your fflush(NULL) works or not.
17112 I'm assuming it doesn't (contrary to ANSI C).
17113 EOM
17114                 fflushNULL="$undef"
17115                 ;;
17116         esac
17117         ;;
17118 $define|true|[yY]*)
17119         fflushNULL="$define"
17120         ;;
17121 *)
17122         fflushNULL="$undef"
17123         ;;
17124 esac
17125 : check explicit looping only if NULL did not work, and if the pipe
17126 : bug does not show up on an explicit flush too
17127 case "$fflushNULL" in
17128 "$undef")
17129         $cat >tryp.c <<EOCP
17130 #include <stdio.h>
17131 int
17132 main(int argc, char **argv)
17133 {
17134     char buf[1024];
17135     int i;
17136     char *bp = buf;
17137     while (1) {
17138         while ((i = getc(stdin)) != -1
17139                && (*bp++ = i) != '\n'
17140                && bp < &buf[1024])
17141         /* DO NOTHING */ ;
17142         *bp = '\0';
17143         fprintf(stdout, "%s", buf);
17144         fflush(stdin);
17145         if (i == -1)
17146             return 0;
17147         bp = buf;
17148     }
17149 }
17150 EOCP
17151         set tryp
17152         if eval $compile; then
17153             $rm -f tryp.out
17154             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17155             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17156                $cat >&4 <<EOM
17157 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17158 EOM
17159                 : now check for fflushall behaviour
17160                 case "$fflushall" in
17161                 '')     set try -DTRY_FFLUSH_ALL $output
17162                         if eval $compile; then
17163                                 $cat >&4 <<EOM
17164 (Now testing the other method--but note that this also may fail.)
17165 EOM
17166                                 $run ./try 2>/dev/null
17167                                 code=$?
17168                                 $from try.out
17169                                 if $test -s try.out -a "X$code" = X42; then
17170                                         fflushall="`$cat try.out`"
17171                                 fi
17172                         fi
17173                         $rm -f core try.core core.try.*
17174                         case "$fflushall" in
17175                         x)      $cat >&4 <<EOM
17176 Whew. Flushing explicitly all the stdio streams works.
17177 EOM
17178                                 fflushall="$define"
17179                                 ;;
17180                         '')     $cat >&4 <<EOM
17181 Sigh. Flushing explicitly all the stdio streams doesn't work.
17182 EOM
17183                                 fflushall="$undef"
17184                                 ;;
17185                         *)      $cat >&4 <<EOM
17186 Cannot figure out whether flushing stdio streams explicitly works or not.
17187 I'm assuming it doesn't.
17188 EOM
17189                                 fflushall="$undef"
17190                                 ;;
17191                         esac
17192                         ;;
17193                 "$define"|true|[yY]*)
17194                         fflushall="$define"
17195                         ;;
17196                 *)
17197                         fflushall="$undef"
17198                         ;;
17199                 esac
17200             else
17201                 $cat >&4 <<EOM
17202 All is futile.  Even fflush(stdin) clobbers input pipes!
17203 EOM
17204                 fflushall="$undef"
17205             fi
17206         else
17207             fflushall="$undef"
17208         fi
17209         $rm -f core tryp.c tryp.core core.tryp.*
17210         ;;
17211 *)      fflushall="$undef"
17212         ;;
17213 esac
17214
17215 case "$fflushNULL$fflushall" in
17216 undefundef)
17217         $cat <<EOM
17218 OK, I give up.  I cannot figure out how to flush pending stdio output.
17219 We won't be flushing handles at all before fork/exec/popen.
17220 EOM
17221         ;;
17222 esac
17223 $rm -f try.* try$exe_ext
17224
17225 : Store the full pathname to the ar program for use in the C program
17226 : Respect a hint or command line value for full_ar.
17227 case "$full_ar" in
17228 '') full_ar=$ar ;;
17229 esac
17230
17231 : Store the full pathname to the sed program for use in the C program
17232 full_sed=$sed
17233
17234 : see what type gids are declared as in the kernel
17235 echo " "
17236 echo "Looking for the type for group ids returned by getgid()."
17237 set gid_t gidtype xxx stdio.h sys/types.h
17238 eval $typedef
17239 case "$gidtype" in
17240 xxx)
17241         xxx=`./findhdr sys/user.h`
17242         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17243         case $1 in
17244         unsigned) dflt="$1 $2" ;;
17245         *) dflt="$1" ;;
17246         esac
17247         ;;
17248 *) dflt="$gidtype";;
17249 esac
17250 case "$gidtype" in
17251 gid_t) echo "gid_t found." ;;
17252 *)      rp="What is the type for group ids returned by getgid()?"
17253         . ./myread
17254         gidtype="$ans"
17255         ;;
17256 esac
17257
17258 echo " "
17259 case "$gidtype" in
17260 *_t) zzz="$gidtype"     ;;
17261 *)   zzz="gid"          ;;
17262 esac
17263 echo "Checking the size of $zzz..." >&4 
17264 cat > try.c <<EOCP
17265 #include <sys/types.h>
17266 #include <stdio.h>
17267 int main() {
17268     printf("%d\n", (int)sizeof($gidtype));
17269     exit(0);
17270 }
17271 EOCP
17272 set try
17273 if eval $compile_ok; then
17274         yyy=`$run ./try`
17275         case "$yyy" in
17276         '')     gidsize=4
17277                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17278                 ;;
17279         *)      gidsize=$yyy
17280                 echo "Your $zzz is $gidsize bytes long."
17281                 ;;
17282         esac
17283 else
17284         gidsize=4
17285         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17286 fi
17287
17288
17289 echo " "
17290 case "$gidtype" in
17291 *_t) zzz="$gidtype"     ;;
17292 *)   zzz="gid"          ;;
17293 esac
17294 echo "Checking the sign of $zzz..." >&4 
17295 cat > try.c <<EOCP
17296 #include <sys/types.h>
17297 #include <stdio.h>
17298 int main() {
17299         $gidtype foo = -1;
17300         if (foo < 0)
17301                 printf("-1\n");
17302         else
17303                 printf("1\n");
17304 }
17305 EOCP
17306 set try
17307 if eval $compile; then
17308         yyy=`$run ./try`
17309         case "$yyy" in
17310         '')     gidsign=1
17311                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17312                 ;;
17313         *)      gidsign=$yyy
17314                 case "$gidsign" in
17315                  1) echo "Your $zzz is unsigned." ;;
17316                 -1) echo "Your $zzz is signed."   ;;
17317                 esac
17318                 ;;
17319         esac
17320 else
17321         gidsign=1
17322         echo "(I can't compile the test program--guessing unsigned.)" >&4
17323 fi
17324
17325
17326 echo " "
17327
17328 if $test X"$quadtype" != X; then
17329
17330 echo "Checking how to print 64-bit integers..." >&4
17331
17332 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17333         $cat >try.c <<'EOCP'
17334 #include <sys/types.h>
17335 #include <stdio.h>
17336 int main() {
17337   int q = 12345678901;
17338   printf("%ld\n", q);
17339 }
17340 EOCP
17341         set try
17342         if eval $compile; then
17343                 yyy=`$run ./try`
17344                 case "$yyy" in
17345                 12345678901)
17346                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17347                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17348                         echo "We will use %d."
17349                         ;;
17350                 esac
17351         fi
17352 fi
17353
17354 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17355         $cat >try.c <<'EOCP'
17356 #include <sys/types.h>
17357 #include <stdio.h>
17358 int main() {
17359   long q = 12345678901;
17360   printf("%ld\n", q);
17361 }
17362 EOCP
17363         set try
17364         if eval $compile; then
17365                 yyy=`$run ./try`
17366                 case "$yyy" in
17367                 12345678901)
17368                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17369                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17370                         echo "We will use %ld."
17371                         ;;
17372                 esac
17373         fi
17374 fi
17375
17376 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17377         $cat >try.c <<'EOCP'
17378 #include <sys/types.h>
17379 #include <inttypes.h>
17380 #include <stdio.h>
17381 int main() {
17382   int64_t q = 12345678901;
17383   printf("%" PRId64 "\n", q);
17384 }
17385 EOCP
17386         set try
17387         if eval $compile; then
17388                 yyy=`$run ./try`
17389                 case "$yyy" in
17390                 12345678901)
17391                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17392                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17393                         echo "We will use the C9X style."
17394                         ;;
17395                 esac
17396         fi
17397 fi
17398
17399 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17400         $cat >try.c <<EOCP
17401 #include <sys/types.h>
17402 #include <stdio.h>
17403 int main() {
17404   $quadtype q = 12345678901;
17405   printf("%Ld\n", q);
17406 }
17407 EOCP
17408         set try
17409         if eval $compile; then
17410                 yyy=`$run ./try`
17411                 case "$yyy" in
17412                 12345678901)
17413                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17414                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17415                         echo "We will use %Ld."
17416                         ;;
17417                 esac
17418         fi
17419 fi
17420
17421 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17422         $cat >try.c <<'EOCP'
17423 #include <sys/types.h>
17424 #include <stdio.h>
17425 int main() {
17426   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17427   printf("%lld\n", q);
17428 }
17429 EOCP
17430         set try
17431         if eval $compile; then
17432                 yyy=`$run ./try`
17433                 case "$yyy" in
17434                 12345678901)
17435                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17436                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17437                         echo "We will use the %lld style."
17438                         ;;
17439                 esac
17440         fi
17441 fi
17442
17443 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17444         $cat >try.c <<EOCP
17445 #include <sys/types.h>
17446 #include <stdio.h>
17447 int main() {
17448   $quadtype q = 12345678901;
17449   printf("%qd\n", q);
17450 }
17451 EOCP
17452         set try
17453         if eval $compile; then
17454                 yyy=`$run ./try`
17455                 case "$yyy" in
17456                 12345678901)
17457                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17458                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17459                         echo "We will use %qd."
17460                         ;;
17461                 esac
17462         fi
17463 fi
17464
17465 if $test X"$sPRId64" = X; then
17466         echo "Cannot figure out how to print 64-bit integers." >&4
17467 fi
17468
17469 $rm -f try try.*
17470
17471 fi
17472
17473 case "$sPRId64" in
17474 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17475         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17476         ;;
17477 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17478         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17479         ;;
17480 esac
17481
17482
17483 echo " "
17484 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17485
17486 if $test X"$ivsize" = X8; then
17487         ivdformat="$sPRId64"
17488         uvuformat="$sPRIu64"
17489         uvoformat="$sPRIo64"
17490         uvxformat="$sPRIx64"
17491         uvXUformat="$sPRIXU64"
17492 else
17493         if $test X"$ivsize" = X"$longsize"; then
17494                 ivdformat='"ld"'
17495                 uvuformat='"lu"'
17496                 uvoformat='"lo"'
17497                 uvxformat='"lx"'
17498                 uvXUformat='"lX"'
17499         else
17500                 if $test X"$ivsize" = X"$intsize"; then
17501                         ivdformat='"d"'
17502                         uvuformat='"u"'
17503                         uvoformat='"o"'
17504                         uvxformat='"x"'
17505                         uvXUformat='"X"'
17506                 else
17507                         : far out
17508                         if $test X"$ivsize" = X"$shortsize"; then
17509                                 ivdformat='"hd"'
17510                                 uvuformat='"hu"'
17511                                 uvoformat='"ho"'
17512                                 uvxformat='"hx"'
17513                                 uvXUformat='"hX"'
17514                         fi
17515                 fi
17516         fi
17517 fi
17518
17519 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17520         nveformat="$sPRIeldbl"
17521         nvfformat="$sPRIfldbl"
17522         nvgformat="$sPRIgldbl"
17523         nvEUformat="$sPRIEUldbl"
17524         nvFUformat="$sPRIFUldbl"
17525         nvGUformat="$sPRIGUldbl"
17526 else
17527         nveformat='"e"'
17528         nvfformat='"f"'
17529         nvgformat='"g"'
17530         nvEUformat='"E"'
17531         nvFUformat='"F"'
17532         nvGUformat='"G"'
17533 fi
17534
17535 case "$ivdformat" in
17536 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17537     exit 1
17538     ;;
17539 esac
17540
17541
17542 echo " "
17543 $echo "Checking the format string to be used for gids..." >&4
17544
17545 case "$gidsign" in
17546 -1)     if $test X"$gidsize" = X"$ivsize"; then
17547                 gidformat="$ivdformat"
17548         else
17549                 if $test X"$gidsize" = X"$longsize"; then
17550                         gidformat='"ld"'
17551                 else
17552                         if $test X"$gidsize" = X"$intsize"; then
17553                                 gidformat='"d"'
17554                         else
17555                                 if $test X"$gidsize" = X"$shortsize"; then
17556                                         gidformat='"hd"'
17557                                 fi
17558                         fi
17559                 fi
17560         fi
17561         ;;
17562 *)      if $test X"$gidsize" = X"$uvsize"; then
17563                 gidformat="$uvuformat"
17564         else
17565                 if $test X"$gidsize" = X"$longsize"; then
17566                         gidformat='"lu"'
17567                 else
17568                         if $test X"$gidsize" = X"$intsize"; then
17569                                 gidformat='"u"'
17570                         else
17571                                 if $test X"$gidsize" = X"$shortsize"; then
17572                                         gidformat='"hu"'
17573                                 fi
17574                         fi
17575                 fi
17576         fi
17577         ;;
17578 esac
17579
17580 : see if getgroups exists
17581 set getgroups d_getgrps
17582 eval $inlibc
17583
17584 : see if setgroups exists
17585 set setgroups d_setgrps
17586 eval $inlibc
17587
17588
17589 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17590 echo " "
17591 case "$d_getgrps$d_setgrps" in
17592 *define*)
17593         case "$groupstype" in
17594         '') dflt="$gidtype" ;;
17595         *)  dflt="$groupstype" ;;
17596         esac
17597         $cat <<EOM
17598 What type of pointer is the second argument to getgroups() and setgroups()?
17599 Usually this is the same as group ids, $gidtype, but not always.
17600
17601 EOM
17602         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17603         . ./myread
17604         groupstype="$ans"
17605         ;;
17606 *)  groupstype="$gidtype";;
17607 esac
17608
17609 echo " "
17610 echo "Checking if your $make program sets \$(MAKE)..." >&4
17611 case "$make_set_make" in
17612 '')
17613         $sed 's/^X //' > testmake.mak << 'EOF'
17614 Xall:
17615 X       @echo 'maketemp="$(MAKE)"'
17616 EOF
17617         case "`$make -f testmake.mak 2>/dev/null`" in
17618         *maketemp=*) make_set_make='#' ;;
17619         *)      make_set_make="MAKE=$make" ;;
17620         esac
17621         $rm -f testmake.mak
17622         ;;
17623 esac
17624 case "$make_set_make" in
17625 '#') echo "Yup, it does.";;
17626 *) echo "Nope, it doesn't.";;
17627 esac
17628
17629 : see what type is used for mode_t
17630 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17631 set mode_t modetype int stdio.h sys/types.h
17632 eval $typedef_ask
17633
17634 : see if stdarg is available
17635 echo " "
17636 if $test `./findhdr stdarg.h`; then
17637         echo "<stdarg.h> found." >&4
17638         valstd="$define"
17639 else
17640         echo "<stdarg.h> NOT found." >&4
17641         valstd="$undef"
17642 fi
17643
17644 : see if varags is available
17645 echo " "
17646 if $test `./findhdr varargs.h`; then
17647         echo "<varargs.h> found." >&4
17648 else
17649         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17650 fi
17651
17652 : set up the varargs testing programs
17653 $cat > varargs.c <<EOP
17654 #ifdef I_STDARG
17655 #include <stdarg.h>
17656 #endif
17657 #ifdef I_VARARGS
17658 #include <varargs.h>
17659 #endif
17660
17661 #ifdef I_STDARG
17662 int f(char *p, ...)
17663 #else
17664 int f(va_alist)
17665 va_dcl
17666 #endif
17667 {
17668         va_list ap;
17669 #ifndef I_STDARG
17670         char *p;
17671 #endif
17672 #ifdef I_STDARG
17673         va_start(ap,p);
17674 #else
17675         va_start(ap);
17676         p = va_arg(ap, char *);
17677 #endif
17678         va_end(ap);
17679 }
17680 EOP
17681 $cat > varargs <<EOP
17682 $startsh
17683 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17684         echo "true"
17685 else
17686         echo "false"
17687 fi
17688 $rm -f varargs$_o
17689 EOP
17690 chmod +x varargs
17691
17692 : now check which varargs header should be included
17693 echo " "
17694 i_varhdr=''
17695 case "$valstd" in
17696 "$define")
17697         if `./varargs I_STDARG`; then
17698                 val='stdarg.h'
17699         elif `./varargs I_VARARGS`; then
17700                 val='varargs.h'
17701         fi
17702         ;;
17703 *)
17704         if `./varargs I_VARARGS`; then
17705                 val='varargs.h'
17706         fi
17707         ;;
17708 esac
17709 case "$val" in
17710 '')
17711 echo "I could not find the definition for va_dcl... You have problems..." >&4
17712         val="$undef"; set i_stdarg; eval $setvar
17713         val="$undef"; set i_varargs; eval $setvar
17714         ;;
17715 *) 
17716         set i_varhdr
17717         eval $setvar
17718         case "$i_varhdr" in
17719         stdarg.h)
17720                 val="$define"; set i_stdarg; eval $setvar
17721                 val="$undef"; set i_varargs; eval $setvar
17722                 ;;
17723         varargs.h)
17724                 val="$undef"; set i_stdarg; eval $setvar
17725                 val="$define"; set i_varargs; eval $setvar
17726                 ;;
17727         esac
17728         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17729 esac
17730 $rm -f varargs*
17731
17732 : see if we need va_copy
17733 echo " "
17734 case "$i_stdarg" in
17735 "$define")
17736         $cat >try.c <<EOCP
17737 #include <stdarg.h>
17738 #include <stdio.h>
17739 #$i_stdlib I_STDLIB
17740 #ifdef I_STDLIB
17741 #include <stdlib.h>
17742 #endif
17743 #include <signal.h>
17744
17745 int
17746 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17747 {
17748   return vfprintf(f, fmt, *valp);
17749 }
17750  
17751 int    
17752 myvfprintf(FILE *f, const  char *fmt, va_list val)
17753 {
17754   return ivfprintf(f, fmt, &val);
17755 }
17756       
17757 int
17758 myprintf(char *fmt, ...) 
17759 {
17760   va_list val;
17761   va_start(val, fmt);
17762   return myvfprintf(stdout, fmt, val); 
17763 }         
17764
17765 int
17766 main(int ac, char **av)
17767 {
17768   signal(SIGSEGV, exit);
17769
17770   myprintf("%s%cs all right, then\n", "that", '\'');                            
17771   exit(0);      
17772 }
17773 EOCP
17774         set try
17775         if eval $compile && $run ./try 2>&1 >/dev/null; then
17776                 case "`$run ./try`" in
17777                 "that's all right, then")
17778                         okay=yes
17779                         ;;
17780                 esac
17781         fi
17782         case "$okay" in
17783         yes)    echo "It seems that you don't need va_copy()." >&4
17784                 need_va_copy="$undef"
17785                 ;;
17786         *)      echo "It seems that va_copy() or similar will be needed." >&4
17787                 need_va_copy="$define"
17788                 ;;
17789         esac
17790         $rm -f try.* core core.* *.core *.core.*
17791         ;;
17792 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17793         ;;
17794 esac
17795
17796 : see what type is used for size_t
17797 rp="What is the type used for the length parameter for string functions?"
17798 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17799 eval $typedef_ask
17800
17801 : check for type of arguments to gethostbyaddr. 
17802 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17803         case "$d_gethbyaddr" in
17804         $define)
17805                 $cat <<EOM
17806
17807 Checking to see what type of arguments are accepted by gethostbyaddr().
17808 EOM
17809                 hdrs="$define sys/types.h
17810                         $d_socket sys/socket.h 
17811                         $i_niin netinet/in.h 
17812                         $i_netdb netdb.h
17813                         $i_unistd unistd.h"
17814                 : The first arg can 'char *' or 'void *'
17815                 : The second arg is some of integral type
17816                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17817                         for yyy in size_t long int; do
17818                                 case "$netdb_host_type" in
17819                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17820                                         if ./protochk "$try" $hdrs; then
17821                                                 echo "Your system accepts $xxx for the first arg."
17822                                                 echo "...and $yyy for the second arg."
17823                                                 netdb_host_type="$xxx"
17824                                                 netdb_hlen_type="$yyy"
17825                                         fi
17826                                         ;;
17827                                 esac
17828                         done
17829                 done
17830                 : In case none of those worked, prompt the user.
17831                 case "$netdb_host_type" in
17832                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17833                         dflt='char *'
17834                         . ./myread
17835                         netdb_host_type=$ans
17836                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17837                         dflt="$sizetype"
17838                         . ./myread
17839                         netdb_hlen_type=$ans
17840                         ;;
17841                 esac
17842                 ;;
17843         *)      : no gethostbyaddr, so pick harmless defaults
17844                 netdb_host_type='char *'
17845                 netdb_hlen_type="$sizetype"
17846                 ;;
17847         esac
17848         # Remove the "const" if needed. -- but then we'll have a 
17849         # prototype clash!
17850         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17851 fi
17852
17853 : check for type of argument to gethostbyname. 
17854 if test "X$netdb_name_type" = X ; then
17855         case "$d_gethbyname" in
17856         $define)
17857                 $cat <<EOM
17858
17859 Checking to see what type of argument is accepted by gethostbyname().
17860 EOM
17861                 hdrs="$define sys/types.h
17862                         $d_socket sys/socket.h 
17863                         $i_niin netinet/in.h 
17864                         $i_netdb netdb.h
17865                         $i_unistd unistd.h"
17866                 for xxx in "const char *" "char *"; do
17867                         case "$netdb_name_type" in
17868                         '')     try="extern struct hostent *gethostbyname($xxx);"
17869                                 if ./protochk "$try" $hdrs; then
17870                                         echo "Your system accepts $xxx."
17871                                         netdb_name_type="$xxx"
17872                                 fi
17873                                 ;;
17874                         esac
17875                 done
17876                 : In case none of those worked, prompt the user.
17877                 case "$netdb_name_type" in
17878                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17879                         dflt='char *'
17880                         . ./myread
17881                         netdb_name_type=$ans
17882                         ;;
17883                 esac
17884                 ;;
17885         *)      : no gethostbyname, so pick harmless default
17886                 netdb_name_type='char *'
17887                 ;;
17888         esac
17889 fi
17890
17891 : check for type of 1st argument to getnetbyaddr. 
17892 if test "X$netdb_net_type" = X ; then
17893         case "$d_getnbyaddr" in
17894         $define)
17895                 $cat <<EOM
17896
17897 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17898 EOM
17899                 hdrs="$define sys/types.h
17900                         $d_socket sys/socket.h 
17901                         $i_niin netinet/in.h 
17902                         $i_netdb netdb.h
17903                         $i_unistd unistd.h"
17904                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17905                         case "$netdb_net_type" in
17906                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17907                                 if ./protochk "$try" $hdrs; then
17908                                         echo "Your system accepts $xxx."
17909                                         netdb_net_type="$xxx"
17910                                 fi
17911                                 ;;
17912                         esac
17913                 done
17914                 : In case none of those worked, prompt the user.
17915                 case "$netdb_net_type" in
17916                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17917                         dflt='long'
17918                         . ./myread
17919                         netdb_net_type=$ans
17920                         ;;
17921                 esac
17922                 ;;
17923         *)      : no getnetbyaddr, so pick harmless default
17924                 netdb_net_type='long'
17925                 ;;
17926         esac
17927 fi
17928 : locate the preferred pager for this system
17929 fn=f/
17930 case "$pager" in
17931 '')
17932         dflt=''
17933         case "$pg" in
17934         /*) dflt=$pg;;
17935         [a-zA-Z]:/*) dflt=$pg;;
17936         esac
17937         case "$more" in
17938         /*) dflt=$more;;
17939         [a-zA-Z]:/*) dflt=$more;;
17940         esac
17941         case "$less" in
17942         /*) dflt=$less;;
17943         [a-zA-Z]:/*) dflt=$less;;
17944         esac
17945         case "$dflt" in
17946         '') dflt=/usr/ucb/more;;
17947         esac
17948         ;;
17949 *)      dflt="$pager"
17950         : Instruct ./getfile to trust the hinted or previous pager value,
17951         : even if it does not begin with a slash.  For example, on os2,
17952         : pager might be cmd /c more.  See comments in UU/getfile.
17953         fn="f/($pager)"
17954         ;;
17955 esac
17956 echo " "
17957 rp='What pager is used on your system?'
17958 . ./getfile
17959 pager="$ans"
17960
17961 : see what type pids are declared as in the kernel
17962 rp="What is the type of process ids on this system?"
17963 set pid_t pidtype int stdio.h sys/types.h
17964 eval $typedef_ask
17965
17966 : Find earliest binary compatible site_perl subdirectory perl can use.
17967 xs_apiversion=$version # The current site_perl version.
17968 : Find earliest pure perl site_perl subdirectory perl can use.
17969 : The versioned directories started at 5.005.
17970 pm_apiversion='5.005'
17971
17972 : see if ar generates random libraries by itself
17973 echo " "
17974 echo "Checking how to generate random libraries on your machine..." >&4
17975 echo 'int bar1() { return bar2(); }' > bar1.c
17976 echo 'int bar2() { return 2; }' > bar2.c
17977 $cat > foo.c <<'EOP'
17978 int main() { printf("%d\n", bar1()); exit(0); }
17979 EOP
17980 $cc $ccflags -c bar1.c >/dev/null 2>&1
17981 $cc $ccflags -c bar2.c >/dev/null 2>&1
17982 $cc $ccflags -c foo.c >/dev/null 2>&1
17983 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17984 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17985         $run ./foobar >/dev/null 2>&1; then
17986         echo "$ar appears to generate random libraries itself."
17987         orderlib=false
17988         ranlib=":"
17989 elif $ar ts bar$_a >/dev/null 2>&1 &&
17990         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17991         $run ./foobar >/dev/null 2>&1; then
17992                 echo "a table of contents needs to be added with '$ar ts'."
17993                 orderlib=false
17994                 ranlib="$ar ts"
17995 else
17996         case "$ranlib" in
17997         :) ranlib='';;
17998         '')
17999                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18000                 $test -f $ranlib || ranlib=''
18001                 ;;
18002         esac
18003         if $test -n "$ranlib"; then
18004                 echo "your system has '$ranlib'; we'll use that."
18005                 orderlib=false
18006         else
18007                 echo "your system doesn't seem to support random libraries"
18008                 echo "so we'll use lorder and tsort to order the libraries."
18009                 orderlib=true
18010                 ranlib=":"
18011         fi
18012 fi
18013 $rm -f foo* bar* 
18014
18015 : check for type of arguments to select. 
18016 case "$selecttype" in
18017 '') case "$d_select" in
18018         $define)
18019                 echo " "
18020                 $cat <<EOM
18021 Checking to see what type of arguments are accepted by select().
18022 EOM
18023                 hdrs="$define sys/types.h
18024                         $i_systime sys/time.h 
18025                         $i_sysselct sys/select.h
18026                         $d_socket sys/socket.h"
18027                 : The first arg can be int, unsigned, or size_t
18028                 : The last arg may or may not be 'const'
18029                 val=''
18030                 : void pointer has been seen but using that
18031                 : breaks the selectminbits test
18032                 for xxx in 'fd_set *' 'int *'; do
18033                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18034                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18035                                         case "$val" in
18036                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18037                                                 if ./protochk "$try" $hdrs; then
18038                                                         echo "Your system accepts $xxx."
18039                                                         val="$xxx"
18040                                                 fi
18041                                                 ;;
18042                                         esac
18043                                 done
18044                         done
18045                 done
18046                 case "$val" in
18047                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18048                         case "$d_fd_set" in
18049                                 $define) dflt="fd_set *" ;;
18050                                 *)              dflt="int *" ;;
18051                         esac
18052                         . ./myread
18053                         val=$ans
18054                         ;;
18055                 esac
18056                 selecttype="$val"
18057                 ;;
18058         *)      : no select, so pick a harmless default
18059                 selecttype='int *'
18060                 ;;
18061         esac
18062         ;;
18063 esac
18064
18065 : check for the select 'width'
18066 case "$selectminbits" in
18067 '') case "$d_select" in
18068         $define)
18069                 $cat <<EOM
18070
18071 Checking to see on how many bits at a time your select() operates...
18072 EOM
18073                 $cat >try.c <<EOCP
18074 #include <sys/types.h>
18075 #$i_time I_TIME
18076 #$i_systime I_SYS_TIME
18077 #$i_systimek I_SYS_TIME_KERNEL
18078 #ifdef I_TIME
18079 #   include <time.h>
18080 #endif
18081 #ifdef I_SYS_TIME
18082 #   ifdef I_SYS_TIME_KERNEL
18083 #       define KERNEL
18084 #   endif
18085 #   include <sys/time.h>
18086 #   ifdef I_SYS_TIME_KERNEL
18087 #       undef KERNEL
18088 #   endif
18089 #endif
18090 #$i_sysselct I_SYS_SELECT
18091 #ifdef I_SYS_SELECT
18092 #include <sys/select.h>
18093 #endif
18094 #$d_socket HAS_SOCKET
18095 #ifdef HAS_SOCKET
18096 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18097 #endif
18098 #include <stdio.h>
18099 $selecttype b;
18100 #define S sizeof(*(b))
18101 #define MINBITS 64
18102 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18103 #define NBITS  (NBYTES * 8)
18104 int main() {
18105     char s[NBYTES];
18106     struct timeval t;
18107     int i;
18108     FILE* fp;
18109     int fd;
18110
18111     fclose(stdin);
18112     fp = fopen("try.c", "r");
18113     if (fp == 0)
18114       exit(1);
18115     fd = fileno(fp);
18116     if (fd < 0)
18117       exit(2);
18118     b = ($selecttype)s;
18119     for (i = 0; i < NBITS; i++)
18120         FD_SET(i, b);
18121     t.tv_sec  = 0;
18122     t.tv_usec = 0;
18123     select(fd + 1, b, 0, 0, &t);
18124     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18125     printf("%d\n", i + 1);
18126     return 0;
18127 }
18128 EOCP
18129                 set try
18130                 if eval $compile_ok; then
18131                         selectminbits=`$run ./try`
18132                         case "$selectminbits" in
18133                         '')     cat >&4 <<EOM
18134 Cannot figure out on how many bits at a time your select() operates.
18135 I'll play safe and guess it is 32 bits.
18136 EOM
18137                                 selectminbits=32
18138                                 bits="32 bits"
18139                                 ;;
18140                         1)      bits="1 bit" ;;
18141                         *)      bits="$selectminbits bits" ;;
18142                         esac
18143                         echo "Your select() operates on $bits at a time." >&4
18144                 else
18145                         rp='What is the minimum number of bits your select() operates on?'
18146                         case "$byteorder" in
18147                         1234|12345678)  dflt=32 ;;
18148                         *)              dflt=1  ;;
18149                         esac
18150                         . ./myread
18151                         val=$ans
18152                         selectminbits="$val"
18153                 fi
18154                 $rm -f try.* try
18155                 ;;
18156         *)      : no select, so pick a harmless default
18157                 selectminbits='32'
18158                 ;;
18159         esac
18160         ;;
18161 esac
18162
18163 : Trace out the files included by signal.h, then look for SIGxxx names.
18164 : Remove SIGARRAYSIZE used by HPUX.
18165 : Remove SIGSTKSIZE used by Linux.
18166 : Remove SIGSTKSZ used by Posix.
18167 : Remove SIGTYP void lines used by OS2.
18168 : Some cpps, like os390, dont give the file name anywhere
18169 if [ "X$fieldn" = X ]; then
18170         : Just make some guesses.  We check them later.
18171         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18172 else
18173         xxx=`echo '#include <signal.h>' |
18174         $cppstdin $cppminus $cppflags 2>/dev/null |
18175         $grep '^[       ]*#.*include' | 
18176         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18177 fi
18178 : Check this list of files to be sure we have parsed the cpp output ok.
18179 : This will also avoid potentially non-existent files, such 
18180 : as ../foo/bar.h
18181 xxxfiles=''
18182 for xx in $xxx /dev/null ; do
18183         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18184 done
18185 : If we have found no files, at least try signal.h
18186 case "$xxxfiles" in
18187 '')     xxxfiles=`./findhdr signal.h` ;;
18188 esac
18189 xxx=`awk '
18190 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18191         print substr($2, 4, 20)
18192 }
18193 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18194         print substr($3, 4, 20)
18195 }' $xxxfiles`
18196 : Append some common names just in case the awk scan failed.
18197 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18198 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18199 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18200 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18201 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18202
18203 : generate a few handy files for later
18204 $cat > signal.c <<'EOCP'
18205 #include <sys/types.h>
18206 #include <signal.h>
18207 #include <stdio.h>
18208 int main() {
18209
18210 /* Strange style to avoid deeply-nested #if/#else/#endif */
18211 #ifndef NSIG
18212 #  ifdef _NSIG
18213 #    define NSIG (_NSIG)
18214 #  endif
18215 #endif
18216
18217 #ifndef NSIG
18218 #  ifdef SIGMAX
18219 #    define NSIG (SIGMAX+1)
18220 #  endif
18221 #endif
18222
18223 #ifndef NSIG
18224 #  ifdef SIG_MAX
18225 #    define NSIG (SIG_MAX+1)
18226 #  endif
18227 #endif
18228
18229 #ifndef NSIG
18230 #  ifdef MAXSIG
18231 #    define NSIG (MAXSIG+1)
18232 #  endif
18233 #endif
18234
18235 #ifndef NSIG
18236 #  ifdef MAX_SIG
18237 #    define NSIG (MAX_SIG+1)
18238 #  endif
18239 #endif
18240
18241 #ifndef NSIG
18242 #  ifdef SIGARRAYSIZE
18243 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18244 #  endif
18245 #endif
18246
18247 #ifndef NSIG
18248 #  ifdef _sys_nsig
18249 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18250 #  endif
18251 #endif
18252
18253 /* Default to some arbitrary number that's big enough to get most
18254    of the common signals.
18255 */
18256 #ifndef NSIG
18257 #    define NSIG 50
18258 #endif
18259
18260 printf("NSIG %d\n", NSIG);
18261
18262 #ifndef JUST_NSIG
18263
18264 EOCP
18265
18266 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18267 {
18268         printf "#ifdef SIG"; printf $1; printf "\n"
18269         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18270         printf $1; printf ");\n"
18271         printf "#endif\n"
18272 }
18273 END {
18274         printf "#endif /* JUST_NSIG */\n";
18275         printf "exit(0);\n}\n";
18276 }
18277 ' >>signal.c
18278 $cat >signal.awk <<'EOP'
18279 BEGIN { ndups = 0 }
18280 $1 ~ /^NSIG$/ { nsig = $2 }
18281 ($1 !~ /^NSIG$/) && (NF == 2) {
18282     if ($2 > maxsig) { maxsig = $2 }
18283     if (sig_name[$2]) {
18284         dup_name[ndups] = $1
18285         dup_num[ndups] = $2
18286         ndups++ 
18287     }
18288     else {
18289         sig_name[$2] = $1
18290         sig_num[$2] = $2
18291     }
18292 }
18293 END { 
18294     if (nsig == 0) {
18295         nsig = maxsig + 1
18296     }
18297     printf("NSIG %d\n", nsig);
18298     for (n = 1; n < nsig; n++) {
18299         if (sig_name[n]) {
18300             printf("%s %d\n", sig_name[n], sig_num[n])
18301         }
18302         else {
18303             printf("NUM%d %d\n", n, n) 
18304         }
18305     }
18306     for (n = 0; n < ndups; n++) {
18307         printf("%s %d\n", dup_name[n], dup_num[n])
18308     }
18309 }
18310 EOP
18311 $cat >signal_cmd <<EOS
18312 $startsh
18313 if $test -s signal.lst; then
18314     echo "Using your existing signal.lst file"
18315         exit 0
18316 fi
18317 xxx="$xxx"
18318 EOS
18319 $cat >>signal_cmd <<'EOS'
18320
18321 set signal
18322 if eval $compile_ok; then
18323         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18324 else
18325         echo "(I can't seem be able to compile the whole test program)" >&4
18326         echo "(I'll try it in little pieces.)" >&4
18327         set signal -DJUST_NSIG
18328         if eval $compile_ok; then
18329                 $run ./signal$_exe > signal.nsg
18330                 $cat signal.nsg
18331         else
18332                 echo "I can't seem to figure out how many signals you have." >&4
18333                 echo "Guessing 50." >&4
18334                 echo 'NSIG 50' > signal.nsg
18335         fi
18336         : Now look at all the signal names, one at a time.
18337         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18338                 $cat > signal.c <<EOCP
18339 #include <sys/types.h>
18340 #include <signal.h>
18341 #include <stdio.h>
18342 int main() {
18343 printf("$xx %d\n", SIG${xx});
18344 return 0;
18345 }
18346 EOCP
18347                 set signal
18348                 if eval $compile; then
18349                         echo "SIG${xx} found."
18350                         $run ./signal$_exe  >> signal.ls1
18351                 else
18352                         echo "SIG${xx} NOT found."
18353                 fi
18354         done
18355         if $test -s signal.ls1; then
18356                 $cat signal.nsg signal.ls1 |
18357                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18358         fi
18359
18360 fi
18361 if $test -s signal.lst; then
18362         :
18363 else
18364         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18365         echo 'kill -l' >signal
18366         set X `csh -f <signal`
18367         $rm -f signal
18368         shift
18369         case $# in
18370         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18371         esac
18372         echo $@ | $tr ' ' $trnl | \
18373             $awk '{ printf "%s %d\n", $1, ++s; }
18374                   END { printf "NSIG %d\n", ++s }' >signal.lst
18375 fi
18376 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18377 EOS
18378 chmod a+x signal_cmd
18379 $eunicefix signal_cmd
18380
18381 : generate list of signal names
18382 echo " "
18383 case "$sig_name_init" in
18384 '') doinit=yes ;;
18385 *)  case "$sig_num_init" in
18386     ''|*,*) doinit=yes ;;
18387     esac ;;
18388 esac
18389 case "$doinit" in
18390 yes)
18391         echo "Generating a list of signal names and numbers..." >&4
18392         . ./signal_cmd
18393         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18394         sig_name=`$awk 'BEGIN { printf "ZERO " }
18395                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18396         sig_num=`$awk  'BEGIN { printf "0 " }
18397                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18398         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18399                              !/^NSIG/   { printf "\"%s\", ", $1 }
18400                              END        { printf "0\n" }' signal.lst`
18401         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18402                              !/^NSIG/   { printf "%d, ", $2}
18403                              END        { printf "0\n"}' signal.lst`
18404         ;;
18405 esac
18406 echo "The following $sig_count signals are available:"
18407 echo " "
18408 echo $sig_name | $awk \
18409 'BEGIN { linelen = 0 }
18410 {
18411         for (i = 1; i <= NF; i++) {
18412                 name = "SIG" $i " "
18413                 linelen = linelen + length(name)
18414                 if (linelen > 70) {
18415                         printf "\n"
18416                         linelen = length(name)
18417                 }
18418                 printf "%s", name
18419         }
18420         printf "\n"
18421 }'
18422 sig_size=`echo $sig_name | awk '{print NF}'`
18423 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18424
18425 echo " "
18426 case "$sizetype" in
18427 *_t) zzz="$sizetype"    ;;
18428 *)   zzz="filesize"     ;;
18429 esac
18430 echo "Checking the size of $zzz..." >&4 
18431 cat > try.c <<EOCP
18432 #include <sys/types.h>
18433 #include <stdio.h>
18434 int main() {
18435     printf("%d\n", (int)sizeof($sizetype));
18436     exit(0);
18437 }
18438 EOCP
18439 set try
18440 if eval $compile_ok; then
18441         yyy=`$run ./try`
18442         case "$yyy" in
18443         '')     sizesize=4
18444                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18445                 ;;
18446         *)      sizesize=$yyy
18447                 echo "Your $zzz size is $sizesize bytes."
18448                 ;;
18449         esac
18450 else
18451         sizesize=4
18452         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18453 fi
18454
18455
18456 : check for socklen_t
18457 echo " "
18458 echo "Checking to see if you have socklen_t..." >&4
18459 $cat >try.c <<EOCP
18460 #include <sys/types.h>
18461 #$d_socket HAS_SOCKET
18462 #ifdef HAS_SOCKET
18463 #include <sys/socket.h>
18464 #endif
18465 int main() { socklen_t x = 16; }
18466 EOCP
18467 set try
18468 if eval $compile; then
18469         val="$define"
18470         echo "You have socklen_t."
18471 else
18472         val="$undef"
18473         echo "You do not have socklen_t."
18474         case "$sizetype" in
18475         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18476         esac
18477 fi
18478 $rm -f try try.*
18479 set d_socklen_t
18480 eval $setvar
18481
18482 : see if this is a socks.h system
18483 set socks.h i_socks
18484 eval $inhdr
18485
18486 : check for type of the size argument to socket calls
18487 case "$d_socket" in
18488 "$define")
18489         $cat <<EOM
18490
18491 Checking to see what type is the last argument of accept().
18492 EOM
18493         yyy=''
18494         case "$d_socklen_t" in
18495         "$define") yyy="$yyy socklen_t"
18496         esac
18497         yyy="$yyy $sizetype int long unsigned"
18498         for xxx in $yyy; do
18499                 case "$socksizetype" in
18500                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18501                         case "$usesocks" in
18502                         "$define")
18503                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18504                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18505                                         socksizetype="$xxx"
18506                                 fi
18507                                 ;;
18508                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18509                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18510                                         socksizetype="$xxx"
18511                                 fi
18512                                 ;;
18513                         esac
18514                         ;;
18515                 esac
18516         done
18517 : In case none of those worked, prompt the user.
18518         case "$socksizetype" in
18519         '')     rp='What is the type for socket address structure sizes?'
18520                 dflt='int'
18521                 . ./myread
18522                 socksizetype=$ans
18523                 ;;
18524         esac
18525         ;;
18526 *)      : no sockets, so pick relatively harmless default
18527         socksizetype='int'
18528         ;;
18529 esac
18530
18531 : see what type is used for signed size_t
18532 set ssize_t ssizetype int stdio.h sys/types.h
18533 eval $typedef
18534 dflt="$ssizetype"
18535 $cat > try.c <<EOM
18536 #include <stdio.h>
18537 #include <sys/types.h>
18538 #define Size_t $sizetype
18539 #define SSize_t $dflt
18540 int main()
18541 {
18542         if (sizeof(Size_t) == sizeof(SSize_t))
18543                 printf("$dflt\n");
18544         else if (sizeof(Size_t) == sizeof(int))
18545                 printf("int\n");
18546         else 
18547                 printf("long\n");
18548         exit(0);
18549 }
18550 EOM
18551 echo " "
18552 set try
18553 if eval $compile_ok && $run ./try > /dev/null; then
18554         ssizetype=`$run ./try`
18555         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18556 else
18557         $cat >&4 <<EOM
18558 Help! I can't compile and run the ssize_t test program: please enlighten me!
18559 (This is probably a misconfiguration in your system or libraries, and
18560 you really ought to fix it.  Still, I'll try anyway.)
18561
18562 I need a type that is the same size as $sizetype, but is guaranteed to
18563 be signed.  Common values are ssize_t, int and long.
18564
18565 EOM
18566         rp="What signed type is the same size as $sizetype?"
18567         . ./myread
18568         ssizetype="$ans"
18569 fi
18570 $rm -f try try.*
18571
18572 : see what type of char stdio uses.
18573 echo " "
18574 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18575 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18576         echo "Your stdio uses unsigned chars." >&4
18577         stdchar="unsigned char"
18578 else
18579         echo "Your stdio uses signed chars." >&4
18580         stdchar="char"
18581 fi
18582 $rm -f stdioh
18583
18584
18585
18586 : see what type uids are declared as in the kernel
18587 echo " "
18588 echo "Looking for the type for user ids returned by getuid()."
18589 set uid_t uidtype xxx stdio.h sys/types.h
18590 eval $typedef
18591 case "$uidtype" in
18592 xxx)
18593         xxx=`./findhdr sys/user.h`
18594         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18595         case $1 in
18596         unsigned) dflt="$1 $2" ;;
18597         *) dflt="$1" ;;
18598         esac
18599         ;;
18600 *) dflt="$uidtype";;
18601 esac
18602 case "$uidtype" in
18603 uid_t)  echo "uid_t found." ;;
18604 *)      rp="What is the type for user ids returned by getuid()?"
18605         . ./myread
18606         uidtype="$ans"
18607         ;;
18608 esac
18609
18610 echo " "
18611 case "$uidtype" in
18612 *_t) zzz="$uidtype"     ;;
18613 *)   zzz="uid"          ;;
18614 esac
18615 echo "Checking the size of $zzz..." >&4 
18616 cat > try.c <<EOCP
18617 #include <sys/types.h>
18618 #include <stdio.h>
18619 int main() {
18620     printf("%d\n", (int)sizeof($uidtype));
18621     exit(0);
18622 }
18623 EOCP
18624 set try
18625 if eval $compile_ok; then
18626         yyy=`$run ./try`
18627         case "$yyy" in
18628         '')     uidsize=4
18629                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18630                 ;;
18631         *)      uidsize=$yyy
18632                 echo "Your $zzz is $uidsize bytes long."
18633                 ;;
18634         esac
18635 else
18636         uidsize=4
18637         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18638 fi
18639
18640 echo " "
18641 case "$uidtype" in
18642 *_t) zzz="$uidtype"     ;;
18643 *)   zzz="uid"          ;;
18644 esac
18645 echo "Checking the sign of $zzz..." >&4
18646 cat > try.c <<EOCP
18647 #include <sys/types.h>
18648 #include <stdio.h>
18649 int main() {
18650         $uidtype foo = -1;
18651         if (foo < 0)
18652                 printf("-1\n");
18653         else
18654                 printf("1\n");
18655 }
18656 EOCP
18657 set try
18658 if eval $compile; then
18659         yyy=`$run ./try`
18660         case "$yyy" in
18661         '')     uidsign=1
18662                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18663                 ;;
18664         *)      uidsign=$yyy
18665                 case "$uidsign" in
18666                  1) echo "Your $zzz is unsigned." ;;
18667                 -1) echo "Your $zzz is signed."   ;;
18668                 esac
18669                 ;;
18670         esac
18671 else
18672         uidsign=1
18673         echo "(I can't compile the test program--guessing unsigned.)" >&4
18674 fi
18675
18676
18677
18678 echo " "
18679 $echo "Checking the format string to be used for uids..." >&4
18680
18681 case "$uidsign" in
18682 -1)     if $test X"$uidsize" = X"$ivsize"; then
18683                 uidformat="$ivdformat"
18684         else
18685                 if $test X"$uidsize" = X"$longsize"; then
18686                         uidformat='"ld"'
18687                 else
18688                         if $test X"$uidsize" = X"$intsize"; then
18689                                 uidformat='"d"'
18690                         else
18691                                 if $test X"$uidsize" = X"$shortsize"; then
18692                                         uidformat='"hd"'
18693                                 fi
18694                         fi
18695                 fi
18696         fi
18697         ;;
18698 *)      if $test X"$uidsize" = X"$uvsize"; then
18699                 uidformat="$uvuformat"
18700         else
18701                 if $test X"$uidsize" = X"$longsize"; then
18702                         uidformat='"lu"'
18703                 else
18704                         if $test X"$uidsize" = X"$intsize"; then
18705                                 uidformat='"u"'
18706                         else
18707                                 if $test X"$uidsize" = X"$shortsize"; then
18708                                         uidformat='"hu"'
18709                                 fi
18710                         fi
18711                 fi
18712         fi
18713         ;;
18714 esac
18715
18716 : determine compiler compiler
18717 case "$yacc" in
18718 '')
18719         dflt=yacc;;
18720 *)
18721         dflt="$yacc";;
18722 esac
18723 echo " "
18724 comp='yacc'
18725 if $test -f "$byacc$_exe"; then
18726         dflt="$byacc"
18727         comp="byacc or $comp"
18728 fi
18729 if $test -f "$bison$_exe"; then
18730         comp="$comp or bison -y"
18731 fi
18732 rp="Which compiler compiler ($comp) shall I use?"
18733 . ./myread
18734 yacc="$ans"
18735 case "$yacc" in
18736 *bis*)
18737         case "$yacc" in
18738         *-y*) ;;
18739         *)
18740                 yacc="$yacc -y"
18741                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18742                 ;;
18743         esac
18744         ;;
18745 esac
18746
18747 : see if this is a fp.h system
18748 set fp.h i_fp
18749 eval $inhdr
18750
18751 : see if this is a fp_class.h system
18752 set fp_class.h i_fp_class
18753 eval $inhdr
18754
18755 : see if this is a ieeefp.h system
18756 case "$i_ieeefp" in
18757 '' ) set ieeefp.h i_ieeefp
18758      eval $inhdr
18759      ;;
18760 esac
18761
18762 : see if this is a libutil.h system
18763 set libutil.h i_libutil
18764 eval $inhdr
18765
18766 : see if mach cthreads are available
18767 if test "X$usethreads" = "X$define"; then
18768         set mach/cthreads.h i_machcthr
18769         eval $inhdr
18770 else
18771         i_machcthr="$undef"
18772 fi
18773
18774
18775
18776 : see if this is a math.h system
18777 set math.h i_math
18778 eval $inhdr
18779
18780 : see if this is a mntent.h system
18781 set mntent.h i_mntent
18782 eval $inhdr
18783
18784 : see if ndbm.h is available
18785 set ndbm.h t_ndbm
18786 eval $inhdr
18787
18788 case "$t_ndbm" in
18789 $undef)
18790     # Some Linux distributions such as RedHat 7.1 put the
18791     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18792     if $test -f /usr/include/gdbm/ndbm.h; then
18793         echo '<gdbm/ndbm.h> found.'
18794         ccflags="$ccflags -I/usr/include/gdbm"
18795         cppflags="$cppflags -I/usr/include/gdbm"
18796         t_ndbm=$define
18797     fi
18798     ;;
18799 esac
18800
18801 case "$t_ndbm" in
18802 $define)
18803         : see if dbm_open exists
18804         set dbm_open d_dbm_open
18805         eval $inlibc
18806         case "$d_dbm_open" in
18807         $undef)
18808                 t_ndbm="$undef"
18809                 echo "We won't be including <ndbm.h>"
18810                 ;;
18811         esac
18812         ;;
18813 esac
18814 val="$t_ndbm"
18815 set i_ndbm
18816 eval $setvar
18817
18818 : see if net/errno.h is available
18819 val=''
18820 set net/errno.h val
18821 eval $inhdr
18822
18823 : Unfortunately, it causes problems on some systems.  Arrgh.
18824 case "$val" in
18825 $define)
18826         cat > try.c <<'EOM'
18827 #include <stdio.h>
18828 #include <errno.h>
18829 #include <net/errno.h>
18830 int func()
18831 {
18832         return ENOTSOCK;
18833 }
18834 EOM
18835         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18836                 echo "We'll be including <net/errno.h>." >&4
18837         else
18838                 echo "We won't be including <net/errno.h>." >&4
18839                 val="$undef"
18840         fi
18841         $rm -f try.* try
18842         ;;
18843 esac
18844 set i_neterrno
18845 eval $setvar
18846
18847 : see if netinet/tcp.h is available
18848 set netinet/tcp.h i_netinettcp
18849 eval $inhdr
18850
18851 : see if this is a poll.h system
18852 set poll.h i_poll
18853 eval $inhdr
18854
18855 : see if this is a prot.h system
18856 set prot.h i_prot
18857 eval $inhdr
18858
18859 echo " "
18860 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18861 $cat <<'EOSH' > Cppsym.know
18862 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18863 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18864 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18865 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18866 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18867 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18868 bull c cadmus clipper CMU COFF COMPILER_VERSION
18869 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18870 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18871 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18872 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18873 GLIBC GLIBC_MINOR
18874 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18875 H3050R H3050RX hbullx20 hcx host_mips
18876 hp200 hp300 hp700 HP700 hp800 hp9000
18877 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18878 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18879 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18880 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18881 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18882 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18883 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18884 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18885 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18886 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18887 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18888 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18889 MATH_HAS_NO_SIDE_EFFECTS
18890 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18891 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18892 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18893 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18894 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18895 NetBSD news1500 news1700 news1800 news1900 news3700
18896 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18897 ns32016 ns32332 ns32k nsc32000
18898 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18899 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18900 pc532 pdp11 PGC PIC plexus PORTAR posix
18901 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18902 POSIX_C_SOURCE POSIX_SOURCE POWER
18903 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18904 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18905 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18906 sony sony_news sonyrisc sparc sparclite spectrum
18907 stardent stdc STDC_EXT stratos sun sun3 sun386
18908 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18909 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18910 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18911 sysV68 sysV88 Tek4132 Tek4300 titan
18912 TM3200 TM5400 TM5600
18913 tower tower32 tower32_200 tower32_600 tower32_700
18914 tower32_800 tower32_850 tss
18915 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18916 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18917 unix UNIX95 UNIX99 unixpc unos
18918 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18919 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18920 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18921 USGr4 USGr4_2
18922 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18923 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18924 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18925 z8000
18926 EOSH
18927 # Maybe put other stuff here too.
18928 cat <<EOSH >>Cppsym.know
18929 $osname
18930 EOSH
18931 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18932 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18933 $cat Cppsym.know > Cppsym.c
18934 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18935 $rm -f Cppsym.a Cppsym.b Cppsym.c
18936 cat <<EOSH > Cppsym
18937 $startsh
18938 if $test \$# -gt 0; then
18939     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18940     if $test -s Cppsym.got; then
18941         $rm -f Cppsym.got
18942         exit 0
18943     fi
18944     $rm -f Cppsym.got
18945     exit 1
18946 else
18947     $tr " " "$trnl" | ./Cppsym.try
18948     exit 0
18949 fi
18950 EOSH
18951 chmod +x Cppsym
18952 $eunicefix Cppsym
18953 cat <<EOSH > Cppsym.try
18954 $startsh
18955 cat <<'EOCP' > try.c
18956 #include <stdio.h>
18957 int main() {
18958 EOCP
18959 $awk \\
18960 EOSH
18961 cat <<'EOSH' >> Cppsym.try
18962 'length($1) > 0 {
18963     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
18964     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
18965     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
18966     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
18967 }'       >> try.c
18968 echo 'return 0;}' >> try.c
18969 EOSH
18970 cat <<EOSH >> Cppsym.try
18971 ccflags="$ccflags"
18972 case "$osname-$gccversion" in
18973 irix-) ccflags="\$ccflags -woff 1178" ;;
18974 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18975 esac
18976 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18977 EOSH
18978 chmod +x Cppsym.try
18979 $eunicefix Cppsym.try
18980 ./Cppsym < Cppsym.know > Cppsym.true
18981 : now check the C compiler for additional symbols
18982 postprocess_cc_v=''
18983 case "$osname" in
18984 aix) postprocess_cc_v="|$tr , ' '" ;;
18985 esac
18986 $cat >ccsym <<EOS
18987 $startsh
18988 $cat >tmp.c <<EOF
18989 extern int foo;
18990 EOF
18991 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18992 do
18993         case "\$i" in
18994         -D*) echo "\$i" | $sed 's/^-D//';;
18995         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18996         esac
18997 done
18998 $rm -f try.c
18999 EOS
19000 postprocess_cc_v=''
19001 chmod +x ccsym
19002 $eunicefix ccsym
19003 ./ccsym > ccsym1.raw
19004 if $test -s ccsym1.raw; then
19005        $sort ccsym1.raw | $uniq >ccsym.raw
19006 else
19007        mv ccsym1.raw ccsym.raw
19008 fi
19009
19010 $awk '/\=/ { print $0; next }
19011         { print $0"=1" }' ccsym.raw >ccsym.list
19012 $awk '/\=/ { print $0; next }
19013         { print $0"=1" }' Cppsym.true >ccsym.true
19014 $comm -13 ccsym.true ccsym.list >ccsym.own
19015 $comm -12 ccsym.true ccsym.list >ccsym.com
19016 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19017 also=''
19018 if $test -z ccsym.raw; then
19019         echo "Your C compiler doesn't seem to define any symbols!" >&4
19020         echo " "
19021         echo "However, your C preprocessor defines the following symbols:"
19022         $cat Cppsym.true
19023         ccsymbols=''
19024         cppsymbols=`$cat Cppsym.true`
19025         cppsymbols=`echo $cppsymbols`
19026         cppccsymbols="$cppsymbols"
19027 else
19028         if $test -s ccsym.com; then
19029                 echo "Your C compiler and pre-processor define these symbols:"
19030                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19031                 also='also '
19032                 symbols='ones'
19033                 cppccsymbols=`$cat ccsym.com`
19034                 cppccsymbols=`echo $cppccsymbols`
19035                 $test "$silent" || sleep 1
19036         fi
19037         if $test -s ccsym.cpp; then
19038                 $test "$also" && echo " "
19039                 echo "Your C pre-processor ${also}defines the following symbols:"
19040                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19041                 also='further '
19042                 cppsymbols=`$cat ccsym.cpp`
19043                 cppsymbols=`echo $cppsymbols`
19044                 $test "$silent" || sleep 1
19045         fi
19046         if $test -s ccsym.own; then
19047                 $test "$also" && echo " "
19048                 echo "Your C compiler ${also}defines the following cpp symbols:"
19049                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19050                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19051                 ccsymbols=`$cat ccsym.own`
19052                 ccsymbols=`echo $ccsymbols`
19053                 $test "$silent" || sleep 1
19054         fi
19055 fi
19056
19057 : see if this is a termio system
19058 val="$undef"
19059 val2="$undef"
19060 val3="$undef"
19061 if $test `./findhdr termios.h`; then
19062         set tcsetattr i_termios
19063         eval $inlibc
19064         val3="$i_termios"
19065 fi
19066 echo " "
19067 case "$val3" in
19068 "$define") echo "You have POSIX termios.h... good!" >&4;;
19069 *) if ./Cppsym pyr; then
19070                 case "`/bin/universe`" in
19071                 ucb) if $test `./findhdr sgtty.h`; then
19072                                 val2="$define"
19073                                 echo "<sgtty.h> found." >&4
19074                         else
19075                                 echo "System is pyramid with BSD universe."
19076                                 echo "<sgtty.h> not found--you could have problems." >&4
19077                         fi;;
19078                 *) if $test `./findhdr termio.h`; then
19079                                 val="$define"
19080                                 echo "<termio.h> found." >&4
19081                         else
19082                                 echo "System is pyramid with USG universe."
19083                                 echo "<termio.h> not found--you could have problems." >&4
19084                         fi;;
19085                 esac
19086         elif ./usg; then
19087                 if $test `./findhdr termio.h`; then
19088                         echo "<termio.h> found." >&4
19089                         val="$define"
19090                 elif $test `./findhdr sgtty.h`; then
19091                         echo "<sgtty.h> found." >&4
19092                         val2="$define"
19093                 else
19094 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19095                 fi
19096         else
19097                 if $test `./findhdr sgtty.h`; then
19098                         echo "<sgtty.h> found." >&4
19099                         val2="$define"
19100                 elif $test `./findhdr termio.h`; then
19101                         echo "<termio.h> found." >&4
19102                         val="$define"
19103                 else
19104 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19105                 fi
19106         fi;;
19107 esac
19108 set i_termio; eval $setvar
19109 val=$val2; set i_sgtty; eval $setvar
19110 val=$val3; set i_termios; eval $setvar
19111
19112 : see if stddef is available
19113 set stddef.h i_stddef
19114 eval $inhdr
19115
19116 : see if this is a sunmath.h system
19117 set sunmath.h i_sunmath
19118 eval $inhdr
19119
19120 : see if sys/access.h is available
19121 set sys/access.h i_sysaccess
19122 eval $inhdr
19123
19124 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19125 set sys/filio.h i_sysfilio
19126 eval $inhdr
19127 echo " "
19128 if $test `./findhdr sys/ioctl.h`; then
19129         val="$define"
19130         echo '<sys/ioctl.h> found.' >&4
19131 else
19132         val="$undef"
19133         if $test $i_sysfilio = "$define"; then
19134             echo '<sys/ioctl.h> NOT found.' >&4
19135         else
19136                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19137                 $test $i_termio = "$define" && xxx="termio.h"
19138                 $test $i_termios = "$define" && xxx="termios.h"
19139 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19140         fi
19141 fi
19142 set i_sysioctl
19143 eval $setvar
19144
19145 : see if socket ioctl defs are in sys/sockio.h
19146 echo " "
19147 xxx=`./findhdr sys/sockio.h`
19148 if $test "$xxx"; then
19149         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19150                 val="$define"
19151                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19152         else
19153                 val="$undef"
19154                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19155         fi
19156 else
19157         val="$undef"
19158         $cat <<EOM
19159 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19160 EOM
19161 fi
19162 set i_syssockio
19163 eval $setvar
19164
19165
19166 : see if this is a syslog.h system
19167 set syslog.h i_syslog
19168 eval $inhdr
19169
19170
19171 : see if this is a sys/mode.h system
19172 set sys/mode.h i_sysmode
19173 eval $inhdr
19174
19175 : see if sys/resource.h has to be included
19176 set sys/resource.h i_sysresrc
19177 eval $inhdr
19178
19179 : see if sys/security.h is available
19180 set sys/security.h i_syssecrt
19181 eval $inhdr
19182
19183 : see if this is a sys/statvfs.h system
19184 set sys/statvfs.h i_sysstatvfs
19185 eval $inhdr
19186
19187 : see if this is a sys/un.h system
19188 set sys/un.h i_sysun
19189 eval $inhdr
19190
19191
19192 : see if this is a sys/utsname.h system
19193 set sys/utsname.h i_sysutsname
19194 eval $inhdr
19195
19196 : see if this is a syswait system
19197 set sys/wait.h i_syswait
19198 eval $inhdr
19199
19200 : see if this is a ustat.h system
19201 set ustat.h i_ustat
19202 eval $inhdr
19203
19204 : see if this is an utime system
19205 set utime.h i_utime
19206 eval $inhdr
19207
19208 : see if this is a values.h system
19209 set values.h i_values
19210 eval $inhdr
19211
19212 : see if this is a vfork system
19213 case "$d_vfork" in
19214 "$define")
19215         set vfork.h i_vfork
19216         eval $inhdr
19217         ;;
19218 *)
19219         i_vfork="$undef"
19220         ;;
19221 esac
19222
19223 : see if gdbm.h is available
19224 set gdbm.h t_gdbm
19225 eval $inhdr
19226 case "$t_gdbm" in
19227 $define)
19228         : see if gdbm_open exists
19229         set gdbm_open d_gdbm_open
19230         eval $inlibc
19231         case "$d_gdbm_open" in
19232         $undef)
19233                 t_gdbm="$undef"
19234                 echo "We won't be including <gdbm.h>"
19235                 ;;
19236         esac
19237         ;;
19238 esac
19239 val="$t_gdbm"
19240 set i_gdbm
19241 eval $setvar
19242
19243 echo " "
19244 echo "Looking for extensions..." >&4
19245 : If we are using the old config.sh, known_extensions may contain
19246 : old or inaccurate or duplicate values.
19247 known_extensions=''
19248 nonxs_extensions=''
19249 : We do not use find because it might not be available.
19250 : We do not just use MANIFEST because the user may have dropped
19251 : some additional extensions into the source tree and expect them
19252 : to be built.
19253
19254 : Function to recursively find available extensions, ignoring DynaLoader
19255 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19256 find_extensions='
19257     for xxx in *; do
19258        case "$xxx" in
19259            DynaLoader|dynaload) ;;
19260            *)
19261            if $test -f $xxx/$xxx.xs; then
19262                known_extensions="$known_extensions $1$xxx";
19263            elif $test -f $xxx/Makefile.PL; then
19264                nonxs_extensions="$nonxs_extensions $1$xxx";
19265            else
19266                if $test -d $xxx -a $# -lt 10; then
19267                    set $1$xxx/ $*;
19268                    cd "$xxx";
19269                    eval $find_extensions;
19270                    cd ..;
19271                    shift;
19272                fi;
19273            fi
19274            ;;
19275        esac;
19276     done'
19277 tdir=`pwd`
19278 cd "$rsrc/ext"
19279 set X
19280 shift
19281 eval $find_extensions
19282 # Special case:  Add in threads/shared since it is not picked up by the
19283 # recursive find above (and adding in general recursive finding breaks
19284 # SDBM_File/sdbm).  A.D.  10/25/2001.
19285 known_extensions="$known_extensions threads/shared"
19286 set X $nonxs_extensions
19287 shift
19288 nonxs_extensions="$*"
19289 set X $known_extensions
19290 shift
19291 known_extensions="$*"
19292 cd "$tdir"
19293
19294 : Now see which are supported on this system.
19295 avail_ext=''
19296 for xxx in $known_extensions ; do
19297         case "$xxx" in
19298         DB_File|db_file)
19299                 case "$i_db" in
19300                 $define) avail_ext="$avail_ext $xxx" ;;
19301                 esac
19302                 ;;
19303         GDBM_File|gdbm_fil)
19304                 case "$i_gdbm" in 
19305                 $define) avail_ext="$avail_ext $xxx" ;;
19306                 esac
19307                 ;;
19308         I18N/Langinfo|i18n_lan)
19309                 case "$i_langinfo$d_nl_langinfo" in 
19310                 $define$define) avail_ext="$avail_ext $xxx" ;;
19311                 esac
19312                 ;;
19313         NDBM_File|ndbm_fil)
19314                 case "$i_ndbm" in
19315                 $define)
19316                     case "$osname-$use64bitint" in
19317                     hpux-define)
19318                         case "$libs" in
19319                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19320                         esac
19321                         ;;
19322                     *) avail_ext="$avail_ext $xxx" ;;
19323                     esac
19324                     ;;
19325                 esac
19326                 ;;
19327         ODBM_File|odbm_fil) 
19328                 case "${i_dbm}${i_rpcsvcdbm}" in
19329                 *"${define}"*)
19330                     case "$osname-$use64bitint" in
19331                     hpux-define)
19332                         case "$libs" in
19333                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19334                         esac
19335                         ;;
19336                     *) avail_ext="$avail_ext $xxx" ;;
19337                     esac
19338                     ;;
19339                 esac
19340                 ;;
19341         POSIX|posix)
19342                 case "$useposix" in
19343                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19344                 esac
19345                 ;;
19346         Opcode|opcode)
19347                 case "$useopcode" in
19348                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19349                 esac
19350                 ;;
19351         Socket|socket)
19352                 case "$d_socket" in 
19353                 true|$define|y)
19354                     case "$osname" in
19355                     beos) ;; # not unless BONE
19356                     *) avail_ext="$avail_ext $xxx" ;;
19357                     esac
19358                     ;;
19359                 esac
19360                 ;;
19361         Sys/Syslog|sys/syslog)
19362                 : XXX syslog requires socket
19363                 case "$d_socket" in 
19364                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19365                 esac
19366                 ;;
19367         Thread|thread)
19368                 case "$usethreads" in
19369                 true|$define|y)
19370                         case "$useithreads" in
19371                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19372                         esac
19373                 esac
19374                 ;;
19375         XS/APItest|xs/apitest)
19376                 # This is just for testing.  Skip it unless we have dynamic loading.
19377
19378                 case "$usedl" in
19379                 $define) avail_ext="$avail_ext $xxx" ;;
19380                 esac
19381                 ;;
19382         XS/Typemap|xs/typemap)
19383                 # This is just for testing.  Skip it unless we have dynamic loading.
19384                 case "$usedl" in
19385                 $define) avail_ext="$avail_ext $xxx" ;;
19386                 esac
19387                 ;;
19388         threads|threads/shared)
19389                 # threads and threads::shared are special cases.
19390                 # To stop people from asking "Perl 5.8.0 was supposed
19391                 # to have this new fancy threads implementation but my
19392                 # perl doesn't have it" and from people trying to
19393                 # (re)install the threads module using CPAN.pm and
19394                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19395                 # the threads.pm and threads/shared.pm will always be
19396                 # there, croaking informatively ("you need to rebuild
19397                 # all of Perl with threads, sorry") when threads haven't
19398                 # been compiled in.
19399                 # --jhi
19400                 avail_ext="$avail_ext $xxx"
19401                 ;;
19402         IPC/SysV|ipc/sysv)
19403                 : XXX Do we need a useipcsysv variable here
19404                 case "${d_msg}${d_sem}${d_shm}" in 
19405                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19406                 esac
19407                 ;;
19408         *)      avail_ext="$avail_ext $xxx"
19409                 ;;
19410         esac
19411 done
19412
19413 set X $avail_ext
19414 shift
19415 avail_ext="$*"
19416
19417 : Now see which nonxs extensions are supported on this system.
19418 : For now assume all are.
19419 nonxs_ext=''
19420 for xxx in $nonxs_extensions ; do
19421         case "$xxx" in
19422         *)      nonxs_ext="$nonxs_ext $xxx"
19423                 ;;
19424         esac
19425 done
19426
19427 set X $nonxs_ext
19428 shift
19429 nonxs_ext="$*"
19430
19431 case $usedl in
19432 $define)
19433         $cat <<EOM
19434 A number of extensions are supplied with $package.  You may choose to
19435 compile these extensions for dynamic loading (the default), compile
19436 them into the $package executable (static loading), or not include
19437 them at all.  Answer "none" to include no extensions.
19438 Note that DynaLoader is always built and need not be mentioned here.
19439
19440 EOM
19441         case "$dynamic_ext" in
19442         '')
19443                 : Exclude those listed in static_ext
19444                 dflt=''
19445                 for xxx in $avail_ext; do
19446                         case " $static_ext " in
19447                         *" $xxx "*) ;;
19448                         *) dflt="$dflt $xxx" ;;
19449                         esac
19450                 done
19451                 set X $dflt
19452                 shift
19453                 dflt="$*"
19454                 ;;
19455         *)      dflt="$dynamic_ext"
19456                 # Perhaps we are reusing an old out-of-date config.sh.
19457                 case "$hint" in
19458                 previous)
19459                         if test X"$dynamic_ext" != X"$avail_ext"; then
19460                                 $cat <<EOM
19461 NOTICE:  Your previous config.sh list may be incorrect. 
19462 The extensions now available to you are 
19463         ${avail_ext}
19464 but the default list from your previous config.sh is
19465         ${dynamic_ext} 
19466
19467 EOM
19468                         fi
19469                         ;;
19470                 esac
19471                 ;;
19472         esac
19473         case "$dflt" in
19474         '')     dflt=none;;
19475         esac
19476         rp="What extensions do you wish to load dynamically?"
19477         . ./myread
19478         case "$ans" in
19479         none) dynamic_ext=' ' ;;
19480         *) dynamic_ext="$ans" ;;
19481         esac
19482
19483         case "$static_ext" in
19484         '')
19485                 : Exclude those already listed in dynamic linking
19486                 dflt=''
19487                 for xxx in $avail_ext; do
19488                         case " $dynamic_ext " in
19489                         *" $xxx "*) ;;
19490                         *) dflt="$dflt $xxx" ;;
19491                         esac
19492                 done
19493                 set X $dflt
19494                 shift
19495                 dflt="$*"
19496                 ;;
19497         *)  dflt="$static_ext" 
19498                 ;;
19499         esac
19500
19501         case "$dflt" in
19502         '')     dflt=none;;
19503         esac
19504         rp="What extensions do you wish to load statically?"
19505         . ./myread
19506         case "$ans" in
19507         none) static_ext=' ' ;;
19508         *) static_ext="$ans" ;;
19509         esac
19510         ;;
19511 *)
19512         $cat <<EOM
19513 A number of extensions are supplied with $package.  Answer "none" 
19514 to include no extensions. 
19515 Note that DynaLoader is always built and need not be mentioned here.
19516
19517 EOM
19518         case "$static_ext" in
19519         '') dflt="$avail_ext" ;;
19520         *)      dflt="$static_ext"
19521                 # Perhaps we are reusing an old out-of-date config.sh.
19522                 case "$hint" in
19523                 previous)
19524                         if test X"$static_ext" != X"$avail_ext"; then
19525                                 $cat <<EOM
19526 NOTICE:  Your previous config.sh list may be incorrect. 
19527 The extensions now available to you are 
19528         ${avail_ext}
19529 but the default list from your previous config.sh is
19530         ${static_ext} 
19531
19532 EOM
19533                         fi
19534                         ;;
19535                 esac
19536                 ;;
19537         esac
19538         : Exclude those that are not xs extensions
19539         case "$dflt" in
19540         '')     dflt=none;;
19541         esac
19542         rp="What extensions do you wish to include?"
19543         . ./myread
19544         case "$ans" in
19545         none) static_ext=' ' ;;
19546         *) static_ext="$ans" ;;
19547         esac
19548         ;;
19549 esac
19550 #        
19551 # Encode is a special case.  If we are building Encode as a static
19552 # extension, we need to explicitly list its subextensions as well.
19553 # For other nested extensions, this is handled automatically by
19554 # the appropriate Makefile.PL.
19555 case " $static_ext " in
19556         *" Encode "*) # Add the subextensions of Encode
19557         cd "$rsrc/ext"
19558         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19559                 static_ext="$static_ext Encode/$xxx"
19560         done
19561         cd "$tdir"
19562         ;;
19563 esac
19564
19565 set X $dynamic_ext $static_ext $nonxs_ext
19566 shift
19567 extensions="$*"
19568
19569 : Remove libraries needed only for extensions
19570 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19571 : The exception is SunOS 4.x, which needs them.
19572 case "${osname}X${osvers}" in
19573 sunos*X4*)
19574     perllibs="$libs"
19575     ;;
19576 *) case "$usedl" in
19577     $define|true|[yY]*)
19578             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19579             shift
19580             perllibs="$*"
19581             ;;
19582     *)  perllibs="$libs"
19583             ;;
19584     esac
19585     ;;
19586 esac
19587
19588 : Remove build directory name from cppstdin so it can be used from
19589 : either the present location or the final installed location.
19590 echo " "
19591 : Get out of the UU directory to get correct path name.
19592 cd ..
19593 case "$cppstdin" in
19594 `pwd`/cppstdin)
19595         echo "Stripping down cppstdin path name"
19596         cppstdin=cppstdin
19597         ;;
19598 esac
19599 cd UU
19600
19601 : end of configuration questions
19602 echo " "
19603 echo "End of configuration questions."
19604 echo " "
19605
19606 : back to where it started
19607 if test -d ../UU; then
19608         cd ..
19609 fi
19610
19611 : configuration may be patched via a 'config.arch' file
19612 if $test -f config.arch; then
19613         echo "I see a config.arch file, loading it."
19614         . ./config.arch
19615 fi
19616
19617 : configuration may be patched via a 'config.over' file
19618 if $test -f config.over; then
19619         echo " "
19620         dflt=y
19621         rp='I see a config.over file.  Do you wish to load it?'
19622         . UU/myread
19623         case "$ans" in
19624         n*) echo "OK, I'll ignore it.";;
19625         *)      . ./config.over
19626                 echo "Configuration override changes have been loaded."
19627                 ;;
19628         esac
19629 fi
19630
19631 : in case they want portability, strip down executable paths
19632 case "$d_portable" in
19633 "$define")
19634         echo " "
19635         echo "Stripping down executable paths..." >&4
19636         for file in $loclist $trylist; do
19637                 eval temp=\$$file
19638                 eval $file=`basename $temp`
19639         done
19640         ;;
19641 esac
19642
19643 : create config.sh file
19644 echo " "
19645 echo "Creating config.sh..." >&4
19646 $spitshell <<EOT >config.sh
19647 $startsh
19648 #
19649 # This file was produced by running the Configure script. It holds all the
19650 # definitions figured out by Configure. Should you modify one of these values,
19651 # do not forget to propagate your changes by running "Configure -der". You may
19652 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19653 #
19654
19655 # Package name      : $package
19656 # Source directory  : $src
19657 # Configuration time: $cf_time
19658 # Configured by     : $cf_by
19659 # Target system     : $myuname
19660
19661 Author='$Author'
19662 Date='$Date'
19663 Header='$Header'
19664 Id='$Id'
19665 Locker='$Locker'
19666 Log='$Log'
19667 Mcc='$Mcc'
19668 RCSfile='$RCSfile'
19669 Revision='$Revision'
19670 Source='$Source'
19671 State='$State'
19672 _a='$_a'
19673 _exe='$_exe'
19674 _o='$_o'
19675 afs='$afs'
19676 afsroot='$afsroot'
19677 alignbytes='$alignbytes'
19678 ansi2knr='$ansi2knr'
19679 aphostname='$aphostname'
19680 api_revision='$api_revision'
19681 api_subversion='$api_subversion'
19682 api_version='$api_version'
19683 api_versionstring='$api_versionstring'
19684 ar='$ar'
19685 archlib='$archlib'
19686 archlibexp='$archlibexp'
19687 archname64='$archname64'
19688 archname='$archname'
19689 archobjs='$archobjs'
19690 asctime_r_proto='$asctime_r_proto'
19691 awk='$awk'
19692 baserev='$baserev'
19693 bash='$bash'
19694 bin='$bin'
19695 binexp='$binexp'
19696 bison='$bison'
19697 byacc='$byacc'
19698 byteorder='$byteorder'
19699 c='$c'
19700 castflags='$castflags'
19701 cat='$cat'
19702 cc='$cc'
19703 cccdlflags='$cccdlflags'
19704 ccdlflags='$ccdlflags'
19705 ccflags='$ccflags'
19706 ccflags_uselargefiles='$ccflags_uselargefiles'
19707 ccname='$ccname'
19708 ccsymbols='$ccsymbols'
19709 ccversion='$ccversion'
19710 cf_by='$cf_by'
19711 cf_email='$cf_email'
19712 cf_time='$cf_time'
19713 charsize='$charsize'
19714 chgrp='$chgrp'
19715 chmod='$chmod'
19716 chown='$chown'
19717 clocktype='$clocktype'
19718 comm='$comm'
19719 compress='$compress'
19720 contains='$contains'
19721 cp='$cp'
19722 cpio='$cpio'
19723 cpp='$cpp'
19724 cpp_stuff='$cpp_stuff'
19725 cppccsymbols='$cppccsymbols'
19726 cppflags='$cppflags'
19727 cpplast='$cpplast'
19728 cppminus='$cppminus'
19729 cpprun='$cpprun'
19730 cppstdin='$cppstdin'
19731 cppsymbols='$cppsymbols'
19732 crypt_r_proto='$crypt_r_proto'
19733 cryptlib='$cryptlib'
19734 csh='$csh'
19735 ctermid_r_proto='$ctermid_r_proto'
19736 ctime_r_proto='$ctime_r_proto'
19737 d_Gconvert='$d_Gconvert'
19738 d_PRIEUldbl='$d_PRIEUldbl'
19739 d_PRIFUldbl='$d_PRIFUldbl'
19740 d_PRIGUldbl='$d_PRIGUldbl'
19741 d_PRIXU64='$d_PRIXU64'
19742 d_PRId64='$d_PRId64'
19743 d_PRIeldbl='$d_PRIeldbl'
19744 d_PRIfldbl='$d_PRIfldbl'
19745 d_PRIgldbl='$d_PRIgldbl'
19746 d_PRIi64='$d_PRIi64'
19747 d_PRIo64='$d_PRIo64'
19748 d_PRIu64='$d_PRIu64'
19749 d_PRIx64='$d_PRIx64'
19750 d_SCNfldbl='$d_SCNfldbl'
19751 d__fwalk='$d__fwalk'
19752 d_access='$d_access'
19753 d_accessx='$d_accessx'
19754 d_alarm='$d_alarm'
19755 d_archlib='$d_archlib'
19756 d_asctime_r='$d_asctime_r'
19757 d_atolf='$d_atolf'
19758 d_atoll='$d_atoll'
19759 d_attribut='$d_attribut'
19760 d_bcmp='$d_bcmp'
19761 d_bcopy='$d_bcopy'
19762 d_bsd='$d_bsd'
19763 d_bsdgetpgrp='$d_bsdgetpgrp'
19764 d_bsdsetpgrp='$d_bsdsetpgrp'
19765 d_bzero='$d_bzero'
19766 d_casti32='$d_casti32'
19767 d_castneg='$d_castneg'
19768 d_charvspr='$d_charvspr'
19769 d_chown='$d_chown'
19770 d_chroot='$d_chroot'
19771 d_chsize='$d_chsize'
19772 d_class='$d_class'
19773 d_closedir='$d_closedir'
19774 d_cmsghdr_s='$d_cmsghdr_s'
19775 d_const='$d_const'
19776 d_crypt='$d_crypt'
19777 d_crypt_r='$d_crypt_r'
19778 d_csh='$d_csh'
19779 d_ctermid_r='$d_ctermid_r'
19780 d_ctime_r='$d_ctime_r'
19781 d_cuserid='$d_cuserid'
19782 d_dbl_dig='$d_dbl_dig'
19783 d_dbminitproto='$d_dbminitproto'
19784 d_difftime='$d_difftime'
19785 d_dirfd='$d_dirfd'
19786 d_dirnamlen='$d_dirnamlen'
19787 d_dlerror='$d_dlerror'
19788 d_dlopen='$d_dlopen'
19789 d_dlsymun='$d_dlsymun'
19790 d_dosuid='$d_dosuid'
19791 d_drand48_r='$d_drand48_r'
19792 d_drand48proto='$d_drand48proto'
19793 d_dup2='$d_dup2'
19794 d_eaccess='$d_eaccess'
19795 d_endgrent='$d_endgrent'
19796 d_endgrent_r='$d_endgrent_r'
19797 d_endhent='$d_endhent'
19798 d_endhostent_r='$d_endhostent_r'
19799 d_endnent='$d_endnent'
19800 d_endnetent_r='$d_endnetent_r'
19801 d_endpent='$d_endpent'
19802 d_endprotoent_r='$d_endprotoent_r'
19803 d_endpwent='$d_endpwent'
19804 d_endpwent_r='$d_endpwent_r'
19805 d_endsent='$d_endsent'
19806 d_endservent_r='$d_endservent_r'
19807 d_eofnblk='$d_eofnblk'
19808 d_eunice='$d_eunice'
19809 d_fchdir='$d_fchdir'
19810 d_fchmod='$d_fchmod'
19811 d_fchown='$d_fchown'
19812 d_fcntl='$d_fcntl'
19813 d_fcntl_can_lock='$d_fcntl_can_lock'
19814 d_fd_macros='$d_fd_macros'
19815 d_fd_set='$d_fd_set'
19816 d_fds_bits='$d_fds_bits'
19817 d_fgetpos='$d_fgetpos'
19818 d_finite='$d_finite'
19819 d_finitel='$d_finitel'
19820 d_flexfnam='$d_flexfnam'
19821 d_flock='$d_flock'
19822 d_flockproto='$d_flockproto'
19823 d_fork='$d_fork'
19824 d_fp_class='$d_fp_class'
19825 d_fpathconf='$d_fpathconf'
19826 d_fpclass='$d_fpclass'
19827 d_fpclassify='$d_fpclassify'
19828 d_fpclassl='$d_fpclassl'
19829 d_fpos64_t='$d_fpos64_t'
19830 d_frexpl='$d_frexpl'
19831 d_fs_data_s='$d_fs_data_s'
19832 d_fseeko='$d_fseeko'
19833 d_fsetpos='$d_fsetpos'
19834 d_fstatfs='$d_fstatfs'
19835 d_fstatvfs='$d_fstatvfs'
19836 d_fsync='$d_fsync'
19837 d_ftello='$d_ftello'
19838 d_ftime='$d_ftime'
19839 d_getcwd='$d_getcwd'
19840 d_getespwnam='$d_getespwnam'
19841 d_getfsstat='$d_getfsstat'
19842 d_getgrent='$d_getgrent'
19843 d_getgrent_r='$d_getgrent_r'
19844 d_getgrgid_r='$d_getgrgid_r'
19845 d_getgrnam_r='$d_getgrnam_r'
19846 d_getgrps='$d_getgrps'
19847 d_gethbyaddr='$d_gethbyaddr'
19848 d_gethbyname='$d_gethbyname'
19849 d_gethent='$d_gethent'
19850 d_gethname='$d_gethname'
19851 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19852 d_gethostbyname_r='$d_gethostbyname_r'
19853 d_gethostent_r='$d_gethostent_r'
19854 d_gethostprotos='$d_gethostprotos'
19855 d_getitimer='$d_getitimer'
19856 d_getlogin='$d_getlogin'
19857 d_getlogin_r='$d_getlogin_r'
19858 d_getmnt='$d_getmnt'
19859 d_getmntent='$d_getmntent'
19860 d_getnbyaddr='$d_getnbyaddr'
19861 d_getnbyname='$d_getnbyname'
19862 d_getnent='$d_getnent'
19863 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19864 d_getnetbyname_r='$d_getnetbyname_r'
19865 d_getnetent_r='$d_getnetent_r'
19866 d_getnetprotos='$d_getnetprotos'
19867 d_getpagsz='$d_getpagsz'
19868 d_getpbyname='$d_getpbyname'
19869 d_getpbynumber='$d_getpbynumber'
19870 d_getpent='$d_getpent'
19871 d_getpgid='$d_getpgid'
19872 d_getpgrp2='$d_getpgrp2'
19873 d_getpgrp='$d_getpgrp'
19874 d_getppid='$d_getppid'
19875 d_getprior='$d_getprior'
19876 d_getprotobyname_r='$d_getprotobyname_r'
19877 d_getprotobynumber_r='$d_getprotobynumber_r'
19878 d_getprotoent_r='$d_getprotoent_r'
19879 d_getprotoprotos='$d_getprotoprotos'
19880 d_getprpwnam='$d_getprpwnam'
19881 d_getpwent='$d_getpwent'
19882 d_getpwent_r='$d_getpwent_r'
19883 d_getpwnam_r='$d_getpwnam_r'
19884 d_getpwuid_r='$d_getpwuid_r'
19885 d_getsbyname='$d_getsbyname'
19886 d_getsbyport='$d_getsbyport'
19887 d_getsent='$d_getsent'
19888 d_getservbyname_r='$d_getservbyname_r'
19889 d_getservbyport_r='$d_getservbyport_r'
19890 d_getservent_r='$d_getservent_r'
19891 d_getservprotos='$d_getservprotos'
19892 d_getspnam='$d_getspnam'
19893 d_getspnam_r='$d_getspnam_r'
19894 d_gettimeod='$d_gettimeod'
19895 d_gmtime_r='$d_gmtime_r'
19896 d_gnulibc='$d_gnulibc'
19897 d_grpasswd='$d_grpasswd'
19898 d_hasmntopt='$d_hasmntopt'
19899 d_htonl='$d_htonl'
19900 d_index='$d_index'
19901 d_inetaton='$d_inetaton'
19902 d_int64_t='$d_int64_t'
19903 d_isascii='$d_isascii'
19904 d_isfinite='$d_isfinite'
19905 d_isinf='$d_isinf'
19906 d_isnan='$d_isnan'
19907 d_isnanl='$d_isnanl'
19908 d_killpg='$d_killpg'
19909 d_lchown='$d_lchown'
19910 d_ldbl_dig='$d_ldbl_dig'
19911 d_link='$d_link'
19912 d_localtime_r='$d_localtime_r'
19913 d_locconv='$d_locconv'
19914 d_lockf='$d_lockf'
19915 d_longdbl='$d_longdbl'
19916 d_longlong='$d_longlong'
19917 d_lseekproto='$d_lseekproto'
19918 d_lstat='$d_lstat'
19919 d_madvise='$d_madvise'
19920 d_mblen='$d_mblen'
19921 d_mbstowcs='$d_mbstowcs'
19922 d_mbtowc='$d_mbtowc'
19923 d_memchr='$d_memchr'
19924 d_memcmp='$d_memcmp'
19925 d_memcpy='$d_memcpy'
19926 d_memmove='$d_memmove'
19927 d_memset='$d_memset'
19928 d_mkdir='$d_mkdir'
19929 d_mkdtemp='$d_mkdtemp'
19930 d_mkfifo='$d_mkfifo'
19931 d_mkstemp='$d_mkstemp'
19932 d_mkstemps='$d_mkstemps'
19933 d_mktime='$d_mktime'
19934 d_mmap='$d_mmap'
19935 d_modfl='$d_modfl'
19936 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19937 d_modflproto='$d_modflproto'
19938 d_mprotect='$d_mprotect'
19939 d_msg='$d_msg'
19940 d_msg_ctrunc='$d_msg_ctrunc'
19941 d_msg_dontroute='$d_msg_dontroute'
19942 d_msg_oob='$d_msg_oob'
19943 d_msg_peek='$d_msg_peek'
19944 d_msg_proxy='$d_msg_proxy'
19945 d_msgctl='$d_msgctl'
19946 d_msgget='$d_msgget'
19947 d_msghdr_s='$d_msghdr_s'
19948 d_msgrcv='$d_msgrcv'
19949 d_msgsnd='$d_msgsnd'
19950 d_msync='$d_msync'
19951 d_munmap='$d_munmap'
19952 d_mymalloc='$d_mymalloc'
19953 d_nice='$d_nice'
19954 d_nl_langinfo='$d_nl_langinfo'
19955 d_nv_preserves_uv='$d_nv_preserves_uv'
19956 d_off64_t='$d_off64_t'
19957 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19958 d_oldpthreads='$d_oldpthreads'
19959 d_oldsock='$d_oldsock'
19960 d_open3='$d_open3'
19961 d_pathconf='$d_pathconf'
19962 d_pause='$d_pause'
19963 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19964 d_phostname='$d_phostname'
19965 d_pipe='$d_pipe'
19966 d_poll='$d_poll'
19967 d_portable='$d_portable'
19968 d_procselfexe='$d_procselfexe'
19969 d_pthread_atfork='$d_pthread_atfork'
19970 d_pthread_yield='$d_pthread_yield'
19971 d_pwage='$d_pwage'
19972 d_pwchange='$d_pwchange'
19973 d_pwclass='$d_pwclass'
19974 d_pwcomment='$d_pwcomment'
19975 d_pwexpire='$d_pwexpire'
19976 d_pwgecos='$d_pwgecos'
19977 d_pwpasswd='$d_pwpasswd'
19978 d_pwquota='$d_pwquota'
19979 d_qgcvt='$d_qgcvt'
19980 d_quad='$d_quad'
19981 d_random_r='$d_random_r'
19982 d_readdir64_r='$d_readdir64_r'
19983 d_readdir='$d_readdir'
19984 d_readdir_r='$d_readdir_r'
19985 d_readlink='$d_readlink'
19986 d_readv='$d_readv'
19987 d_recvmsg='$d_recvmsg'
19988 d_rename='$d_rename'
19989 d_rewinddir='$d_rewinddir'
19990 d_rmdir='$d_rmdir'
19991 d_safebcpy='$d_safebcpy'
19992 d_safemcpy='$d_safemcpy'
19993 d_sanemcmp='$d_sanemcmp'
19994 d_sbrkproto='$d_sbrkproto'
19995 d_sched_yield='$d_sched_yield'
19996 d_scm_rights='$d_scm_rights'
19997 d_seekdir='$d_seekdir'
19998 d_select='$d_select'
19999 d_sem='$d_sem'
20000 d_semctl='$d_semctl'
20001 d_semctl_semid_ds='$d_semctl_semid_ds'
20002 d_semctl_semun='$d_semctl_semun'
20003 d_semget='$d_semget'
20004 d_semop='$d_semop'
20005 d_sendmsg='$d_sendmsg'
20006 d_setegid='$d_setegid'
20007 d_seteuid='$d_seteuid'
20008 d_setgrent='$d_setgrent'
20009 d_setgrent_r='$d_setgrent_r'
20010 d_setgrps='$d_setgrps'
20011 d_sethent='$d_sethent'
20012 d_sethostent_r='$d_sethostent_r'
20013 d_setitimer='$d_setitimer'
20014 d_setlinebuf='$d_setlinebuf'
20015 d_setlocale='$d_setlocale'
20016 d_setlocale_r='$d_setlocale_r'
20017 d_setnent='$d_setnent'
20018 d_setnetent_r='$d_setnetent_r'
20019 d_setpent='$d_setpent'
20020 d_setpgid='$d_setpgid'
20021 d_setpgrp2='$d_setpgrp2'
20022 d_setpgrp='$d_setpgrp'
20023 d_setprior='$d_setprior'
20024 d_setproctitle='$d_setproctitle'
20025 d_setprotoent_r='$d_setprotoent_r'
20026 d_setpwent='$d_setpwent'
20027 d_setpwent_r='$d_setpwent_r'
20028 d_setregid='$d_setregid'
20029 d_setresgid='$d_setresgid'
20030 d_setresuid='$d_setresuid'
20031 d_setreuid='$d_setreuid'
20032 d_setrgid='$d_setrgid'
20033 d_setruid='$d_setruid'
20034 d_setsent='$d_setsent'
20035 d_setservent_r='$d_setservent_r'
20036 d_setsid='$d_setsid'
20037 d_setvbuf='$d_setvbuf'
20038 d_sfio='$d_sfio'
20039 d_shm='$d_shm'
20040 d_shmat='$d_shmat'
20041 d_shmatprototype='$d_shmatprototype'
20042 d_shmctl='$d_shmctl'
20043 d_shmdt='$d_shmdt'
20044 d_shmget='$d_shmget'
20045 d_sigaction='$d_sigaction'
20046 d_sigprocmask='$d_sigprocmask'
20047 d_sigsetjmp='$d_sigsetjmp'
20048 d_sockatmark='$d_sockatmark'
20049 d_sockatmarkproto='$d_sockatmarkproto'
20050 d_socket='$d_socket'
20051 d_socklen_t='$d_socklen_t'
20052 d_sockpair='$d_sockpair'
20053 d_socks5_init='$d_socks5_init'
20054 d_sqrtl='$d_sqrtl'
20055 d_srand48_r='$d_srand48_r'
20056 d_srandom_r='$d_srandom_r'
20057 d_sresgproto='$d_sresgproto'
20058 d_sresuproto='$d_sresuproto'
20059 d_statblks='$d_statblks'
20060 d_statfs_f_flags='$d_statfs_f_flags'
20061 d_statfs_s='$d_statfs_s'
20062 d_statvfs='$d_statvfs'
20063 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20064 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20065 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20066 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20067 d_stdio_stream_array='$d_stdio_stream_array'
20068 d_stdiobase='$d_stdiobase'
20069 d_stdstdio='$d_stdstdio'
20070 d_strchr='$d_strchr'
20071 d_strcoll='$d_strcoll'
20072 d_strctcpy='$d_strctcpy'
20073 d_strerrm='$d_strerrm'
20074 d_strerror='$d_strerror'
20075 d_strerror_r='$d_strerror_r'
20076 d_strftime='$d_strftime'
20077 d_strtod='$d_strtod'
20078 d_strtol='$d_strtol'
20079 d_strtold='$d_strtold'
20080 d_strtoll='$d_strtoll'
20081 d_strtoq='$d_strtoq'
20082 d_strtoul='$d_strtoul'
20083 d_strtoull='$d_strtoull'
20084 d_strtouq='$d_strtouq'
20085 d_strxfrm='$d_strxfrm'
20086 d_suidsafe='$d_suidsafe'
20087 d_symlink='$d_symlink'
20088 d_syscall='$d_syscall'
20089 d_syscallproto='$d_syscallproto'
20090 d_sysconf='$d_sysconf'
20091 d_sysernlst='$d_sysernlst'
20092 d_syserrlst='$d_syserrlst'
20093 d_system='$d_system'
20094 d_tcgetpgrp='$d_tcgetpgrp'
20095 d_tcsetpgrp='$d_tcsetpgrp'
20096 d_telldir='$d_telldir'
20097 d_telldirproto='$d_telldirproto'
20098 d_time='$d_time'
20099 d_times='$d_times'
20100 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20101 d_tm_tm_zone='$d_tm_tm_zone'
20102 d_tmpnam_r='$d_tmpnam_r'
20103 d_truncate='$d_truncate'
20104 d_ttyname_r='$d_ttyname_r'
20105 d_tzname='$d_tzname'
20106 d_u32align='$d_u32align'
20107 d_ualarm='$d_ualarm'
20108 d_umask='$d_umask'
20109 d_uname='$d_uname'
20110 d_union_semun='$d_union_semun'
20111 d_unordered='$d_unordered'
20112 d_usleep='$d_usleep'
20113 d_usleepproto='$d_usleepproto'
20114 d_ustat='$d_ustat'
20115 d_vendorarch='$d_vendorarch'
20116 d_vendorbin='$d_vendorbin'
20117 d_vendorlib='$d_vendorlib'
20118 d_vfork='$d_vfork'
20119 d_void_closedir='$d_void_closedir'
20120 d_voidsig='$d_voidsig'
20121 d_voidtty='$d_voidtty'
20122 d_volatile='$d_volatile'
20123 d_vprintf='$d_vprintf'
20124 d_wait4='$d_wait4'
20125 d_waitpid='$d_waitpid'
20126 d_wcstombs='$d_wcstombs'
20127 d_wctomb='$d_wctomb'
20128 d_writev='$d_writev'
20129 d_xenix='$d_xenix'
20130 date='$date'
20131 db_hashtype='$db_hashtype'
20132 db_prefixtype='$db_prefixtype'
20133 db_version_major='$db_version_major'
20134 db_version_minor='$db_version_minor'
20135 db_version_patch='$db_version_patch'
20136 defvoidused='$defvoidused'
20137 direntrytype='$direntrytype'
20138 dlext='$dlext'
20139 dlsrc='$dlsrc'
20140 doublesize='$doublesize'
20141 drand01='$drand01'
20142 drand48_r_proto='$drand48_r_proto'
20143 dynamic_ext='$dynamic_ext'
20144 eagain='$eagain'
20145 ebcdic='$ebcdic'
20146 echo='$echo'
20147 egrep='$egrep'
20148 emacs='$emacs'
20149 endgrent_r_proto='$endgrent_r_proto'
20150 endhostent_r_proto='$endhostent_r_proto'
20151 endnetent_r_proto='$endnetent_r_proto'
20152 endprotoent_r_proto='$endprotoent_r_proto'
20153 endpwent_r_proto='$endpwent_r_proto'
20154 endservent_r_proto='$endservent_r_proto'
20155 eunicefix='$eunicefix'
20156 exe_ext='$exe_ext'
20157 expr='$expr'
20158 extensions='$extensions'
20159 extras='$extras'
20160 fflushNULL='$fflushNULL'
20161 fflushall='$fflushall'
20162 find='$find'
20163 firstmakefile='$firstmakefile'
20164 flex='$flex'
20165 fpossize='$fpossize'
20166 fpostype='$fpostype'
20167 freetype='$freetype'
20168 from='$from'
20169 full_ar='$full_ar'
20170 full_csh='$full_csh'
20171 full_sed='$full_sed'
20172 gccosandvers='$gccosandvers'
20173 gccversion='$gccversion'
20174 getgrent_r_proto='$getgrent_r_proto'
20175 getgrgid_r_proto='$getgrgid_r_proto'
20176 getgrnam_r_proto='$getgrnam_r_proto'
20177 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20178 gethostbyname_r_proto='$gethostbyname_r_proto'
20179 gethostent_r_proto='$gethostent_r_proto'
20180 getlogin_r_proto='$getlogin_r_proto'
20181 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20182 getnetbyname_r_proto='$getnetbyname_r_proto'
20183 getnetent_r_proto='$getnetent_r_proto'
20184 getprotobyname_r_proto='$getprotobyname_r_proto'
20185 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20186 getprotoent_r_proto='$getprotoent_r_proto'
20187 getpwent_r_proto='$getpwent_r_proto'
20188 getpwnam_r_proto='$getpwnam_r_proto'
20189 getpwuid_r_proto='$getpwuid_r_proto'
20190 getservbyname_r_proto='$getservbyname_r_proto'
20191 getservbyport_r_proto='$getservbyport_r_proto'
20192 getservent_r_proto='$getservent_r_proto'
20193 getspnam_r_proto='$getspnam_r_proto'
20194 gidformat='$gidformat'
20195 gidsign='$gidsign'
20196 gidsize='$gidsize'
20197 gidtype='$gidtype'
20198 glibpth='$glibpth'
20199 gmake='$gmake'
20200 gmtime_r_proto='$gmtime_r_proto'
20201 gnulibc_version='$gnulibc_version'
20202 grep='$grep'
20203 groupcat='$groupcat'
20204 groupstype='$groupstype'
20205 gzip='$gzip'
20206 h_fcntl='$h_fcntl'
20207 h_sysfile='$h_sysfile'
20208 hint='$hint'
20209 hostcat='$hostcat'
20210 i16size='$i16size'
20211 i16type='$i16type'
20212 i32size='$i32size'
20213 i32type='$i32type'
20214 i64size='$i64size'
20215 i64type='$i64type'
20216 i8size='$i8size'
20217 i8type='$i8type'
20218 i_arpainet='$i_arpainet'
20219 i_bsdioctl='$i_bsdioctl'
20220 i_crypt='$i_crypt'
20221 i_db='$i_db'
20222 i_dbm='$i_dbm'
20223 i_dirent='$i_dirent'
20224 i_dld='$i_dld'
20225 i_dlfcn='$i_dlfcn'
20226 i_fcntl='$i_fcntl'
20227 i_float='$i_float'
20228 i_fp='$i_fp'
20229 i_fp_class='$i_fp_class'
20230 i_gdbm='$i_gdbm'
20231 i_grp='$i_grp'
20232 i_ieeefp='$i_ieeefp'
20233 i_inttypes='$i_inttypes'
20234 i_langinfo='$i_langinfo'
20235 i_libutil='$i_libutil'
20236 i_limits='$i_limits'
20237 i_locale='$i_locale'
20238 i_machcthr='$i_machcthr'
20239 i_malloc='$i_malloc'
20240 i_math='$i_math'
20241 i_memory='$i_memory'
20242 i_mntent='$i_mntent'
20243 i_ndbm='$i_ndbm'
20244 i_netdb='$i_netdb'
20245 i_neterrno='$i_neterrno'
20246 i_netinettcp='$i_netinettcp'
20247 i_niin='$i_niin'
20248 i_poll='$i_poll'
20249 i_prot='$i_prot'
20250 i_pthread='$i_pthread'
20251 i_pwd='$i_pwd'
20252 i_rpcsvcdbm='$i_rpcsvcdbm'
20253 i_sfio='$i_sfio'
20254 i_sgtty='$i_sgtty'
20255 i_shadow='$i_shadow'
20256 i_socks='$i_socks'
20257 i_stdarg='$i_stdarg'
20258 i_stddef='$i_stddef'
20259 i_stdlib='$i_stdlib'
20260 i_string='$i_string'
20261 i_sunmath='$i_sunmath'
20262 i_sysaccess='$i_sysaccess'
20263 i_sysdir='$i_sysdir'
20264 i_sysfile='$i_sysfile'
20265 i_sysfilio='$i_sysfilio'
20266 i_sysin='$i_sysin'
20267 i_sysioctl='$i_sysioctl'
20268 i_syslog='$i_syslog'
20269 i_sysmman='$i_sysmman'
20270 i_sysmode='$i_sysmode'
20271 i_sysmount='$i_sysmount'
20272 i_sysndir='$i_sysndir'
20273 i_sysparam='$i_sysparam'
20274 i_sysresrc='$i_sysresrc'
20275 i_syssecrt='$i_syssecrt'
20276 i_sysselct='$i_sysselct'
20277 i_syssockio='$i_syssockio'
20278 i_sysstat='$i_sysstat'
20279 i_sysstatfs='$i_sysstatfs'
20280 i_sysstatvfs='$i_sysstatvfs'
20281 i_systime='$i_systime'
20282 i_systimek='$i_systimek'
20283 i_systimes='$i_systimes'
20284 i_systypes='$i_systypes'
20285 i_sysuio='$i_sysuio'
20286 i_sysun='$i_sysun'
20287 i_sysutsname='$i_sysutsname'
20288 i_sysvfs='$i_sysvfs'
20289 i_syswait='$i_syswait'
20290 i_termio='$i_termio'
20291 i_termios='$i_termios'
20292 i_time='$i_time'
20293 i_unistd='$i_unistd'
20294 i_ustat='$i_ustat'
20295 i_utime='$i_utime'
20296 i_values='$i_values'
20297 i_varargs='$i_varargs'
20298 i_varhdr='$i_varhdr'
20299 i_vfork='$i_vfork'
20300 ignore_versioned_solibs='$ignore_versioned_solibs'
20301 inc_version_list='$inc_version_list'
20302 inc_version_list_init='$inc_version_list_init'
20303 incpath='$incpath'
20304 inews='$inews'
20305 installarchlib='$installarchlib'
20306 installbin='$installbin'
20307 installman1dir='$installman1dir'
20308 installman3dir='$installman3dir'
20309 installprefix='$installprefix'
20310 installprefixexp='$installprefixexp'
20311 installprivlib='$installprivlib'
20312 installscript='$installscript'
20313 installsitearch='$installsitearch'
20314 installsitebin='$installsitebin'
20315 installsitelib='$installsitelib'
20316 installstyle='$installstyle'
20317 installusrbinperl='$installusrbinperl'
20318 installvendorarch='$installvendorarch'
20319 installvendorbin='$installvendorbin'
20320 installvendorlib='$installvendorlib'
20321 intsize='$intsize'
20322 issymlink='$issymlink'
20323 ivdformat='$ivdformat'
20324 ivsize='$ivsize'
20325 ivtype='$ivtype'
20326 known_extensions='$known_extensions'
20327 ksh='$ksh'
20328 ld='$ld'
20329 lddlflags='$lddlflags'
20330 ldflags='$ldflags'
20331 ldflags_uselargefiles='$ldflags_uselargefiles'
20332 ldlibpthname='$ldlibpthname'
20333 less='$less'
20334 lib_ext='$lib_ext'
20335 libc='$libc'
20336 libperl='$libperl'
20337 libpth='$libpth'
20338 libs='$libs'
20339 libsdirs='$libsdirs'
20340 libsfiles='$libsfiles'
20341 libsfound='$libsfound'
20342 libspath='$libspath'
20343 libswanted='$libswanted'
20344 libswanted_uselargefiles='$libswanted_uselargefiles'
20345 line='$line'
20346 lint='$lint'
20347 lkflags='$lkflags'
20348 ln='$ln'
20349 lns='$lns'
20350 localtime_r_proto='$localtime_r_proto'
20351 locincpth='$locincpth'
20352 loclibpth='$loclibpth'
20353 longdblsize='$longdblsize'
20354 longlongsize='$longlongsize'
20355 longsize='$longsize'
20356 lp='$lp'
20357 lpr='$lpr'
20358 ls='$ls'
20359 lseeksize='$lseeksize'
20360 lseektype='$lseektype'
20361 mail='$mail'
20362 mailx='$mailx'
20363 make='$make'
20364 make_set_make='$make_set_make'
20365 mallocobj='$mallocobj'
20366 mallocsrc='$mallocsrc'
20367 malloctype='$malloctype'
20368 man1dir='$man1dir'
20369 man1direxp='$man1direxp'
20370 man1ext='$man1ext'
20371 man3dir='$man3dir'
20372 man3direxp='$man3direxp'
20373 man3ext='$man3ext'
20374 mips_type='$mips_type'
20375 mkdir='$mkdir'
20376 mmaptype='$mmaptype'
20377 modetype='$modetype'
20378 more='$more'
20379 multiarch='$multiarch'
20380 mv='$mv'
20381 myarchname='$myarchname'
20382 mydomain='$mydomain'
20383 myhostname='$myhostname'
20384 myuname='$myuname'
20385 n='$n'
20386 need_va_copy='$need_va_copy'
20387 netdb_hlen_type='$netdb_hlen_type'
20388 netdb_host_type='$netdb_host_type'
20389 netdb_name_type='$netdb_name_type'
20390 netdb_net_type='$netdb_net_type'
20391 nm='$nm'
20392 nm_opt='$nm_opt'
20393 nm_so_opt='$nm_so_opt'
20394 nonxs_ext='$nonxs_ext'
20395 nroff='$nroff'
20396 nvEUformat='$nvEUformat'
20397 nvFUformat='$nvFUformat'
20398 nvGUformat='$nvGUformat'
20399 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20400 nveformat='$nveformat'
20401 nvfformat='$nvfformat'
20402 nvgformat='$nvgformat'
20403 nvsize='$nvsize'
20404 nvtype='$nvtype'
20405 o_nonblock='$o_nonblock'
20406 obj_ext='$obj_ext'
20407 old_pthread_create_joinable='$old_pthread_create_joinable'
20408 optimize='$optimize'
20409 orderlib='$orderlib'
20410 osname='$osname'
20411 osvers='$osvers'
20412 otherlibdirs='$otherlibdirs'
20413 package='$package'
20414 pager='$pager'
20415 passcat='$passcat'
20416 patchlevel='$patchlevel'
20417 path_sep='$path_sep'
20418 perl5='$perl5'
20419 perl='$perl'
20420 perl_patchlevel='$perl_patchlevel'
20421 perladmin='$perladmin'
20422 perllibs='$perllibs'
20423 perlpath='$perlpath'
20424 pg='$pg'
20425 phostname='$phostname'
20426 pidtype='$pidtype'
20427 plibpth='$plibpth'
20428 pm_apiversion='$pm_apiversion'
20429 pmake='$pmake'
20430 pr='$pr'
20431 prefix='$prefix'
20432 prefixexp='$prefixexp'
20433 privlib='$privlib'
20434 privlibexp='$privlibexp'
20435 procselfexe='$procselfexe'
20436 prototype='$prototype'
20437 ptrsize='$ptrsize'
20438 quadkind='$quadkind'
20439 quadtype='$quadtype'
20440 randbits='$randbits'
20441 randfunc='$randfunc'
20442 random_r_proto='$random_r_proto'
20443 randseedtype='$randseedtype'
20444 ranlib='$ranlib'
20445 rd_nodata='$rd_nodata'
20446 readdir64_r_proto='$readdir64_r_proto'
20447 readdir_r_proto='$readdir_r_proto'
20448 revision='$revision'
20449 rm='$rm'
20450 rmail='$rmail'
20451 run='$run'
20452 runnm='$runnm'
20453 sPRIEUldbl='$sPRIEUldbl'
20454 sPRIFUldbl='$sPRIFUldbl'
20455 sPRIGUldbl='$sPRIGUldbl'
20456 sPRIXU64='$sPRIXU64'
20457 sPRId64='$sPRId64'
20458 sPRIeldbl='$sPRIeldbl'
20459 sPRIfldbl='$sPRIfldbl'
20460 sPRIgldbl='$sPRIgldbl'
20461 sPRIi64='$sPRIi64'
20462 sPRIo64='$sPRIo64'
20463 sPRIu64='$sPRIu64'
20464 sPRIx64='$sPRIx64'
20465 sSCNfldbl='$sSCNfldbl'
20466 sched_yield='$sched_yield'
20467 scriptdir='$scriptdir'
20468 scriptdirexp='$scriptdirexp'
20469 sed='$sed'
20470 seedfunc='$seedfunc'
20471 selectminbits='$selectminbits'
20472 selecttype='$selecttype'
20473 sendmail='$sendmail'
20474 setgrent_r_proto='$setgrent_r_proto'
20475 sethostent_r_proto='$sethostent_r_proto'
20476 setlocale_r_proto='$setlocale_r_proto'
20477 setnetent_r_proto='$setnetent_r_proto'
20478 setprotoent_r_proto='$setprotoent_r_proto'
20479 setpwent_r_proto='$setpwent_r_proto'
20480 setservent_r_proto='$setservent_r_proto'
20481 sh='$sh'
20482 shar='$shar'
20483 sharpbang='$sharpbang'
20484 shmattype='$shmattype'
20485 shortsize='$shortsize'
20486 shrpenv='$shrpenv'
20487 shsharp='$shsharp'
20488 sig_count='$sig_count'
20489 sig_name='$sig_name'
20490 sig_name_init='$sig_name_init'
20491 sig_num='$sig_num'
20492 sig_num_init='$sig_num_init'
20493 sig_size='$sig_size'
20494 signal_t='$signal_t'
20495 sitearch='$sitearch'
20496 sitearchexp='$sitearchexp'
20497 sitebin='$sitebin'
20498 sitebinexp='$sitebinexp'
20499 sitelib='$sitelib'
20500 sitelib_stem='$sitelib_stem'
20501 sitelibexp='$sitelibexp'
20502 siteprefix='$siteprefix'
20503 siteprefixexp='$siteprefixexp'
20504 sizesize='$sizesize'
20505 sizetype='$sizetype'
20506 sleep='$sleep'
20507 smail='$smail'
20508 so='$so'
20509 sockethdr='$sockethdr'
20510 socketlib='$socketlib'
20511 socksizetype='$socksizetype'
20512 sort='$sort'
20513 spackage='$spackage'
20514 spitshell='$spitshell'
20515 srand48_r_proto='$srand48_r_proto'
20516 srandom_r_proto='$srandom_r_proto'
20517 src='$src'
20518 ssizetype='$ssizetype'
20519 startperl='$startperl'
20520 startsh='$startsh'
20521 static_ext='$static_ext'
20522 stdchar='$stdchar'
20523 stdio_base='$stdio_base'
20524 stdio_bufsiz='$stdio_bufsiz'
20525 stdio_cnt='$stdio_cnt'
20526 stdio_filbuf='$stdio_filbuf'
20527 stdio_ptr='$stdio_ptr'
20528 stdio_stream_array='$stdio_stream_array'
20529 strerror_r_proto='$strerror_r_proto'
20530 strings='$strings'
20531 submit='$submit'
20532 subversion='$subversion'
20533 sysman='$sysman'
20534 tail='$tail'
20535 tar='$tar'
20536 targetarch='$targetarch'
20537 tbl='$tbl'
20538 tee='$tee'
20539 test='$test'
20540 timeincl='$timeincl'
20541 timetype='$timetype'
20542 tmpnam_r_proto='$tmpnam_r_proto'
20543 to='$to'
20544 touch='$touch'
20545 tr='$tr'
20546 trnl='$trnl'
20547 troff='$troff'
20548 ttyname_r_proto='$ttyname_r_proto'
20549 u16size='$u16size'
20550 u16type='$u16type'
20551 u32size='$u32size'
20552 u32type='$u32type'
20553 u64size='$u64size'
20554 u64type='$u64type'
20555 u8size='$u8size'
20556 u8type='$u8type'
20557 uidformat='$uidformat'
20558 uidsign='$uidsign'
20559 uidsize='$uidsize'
20560 uidtype='$uidtype'
20561 uname='$uname'
20562 uniq='$uniq'
20563 uquadtype='$uquadtype'
20564 use5005threads='$use5005threads'
20565 use64bitall='$use64bitall'
20566 use64bitint='$use64bitint'
20567 usecrosscompile='$usecrosscompile'
20568 usedl='$usedl'
20569 useithreads='$useithreads'
20570 uselargefiles='$uselargefiles'
20571 uselongdouble='$uselongdouble'
20572 usemorebits='$usemorebits'
20573 usemultiplicity='$usemultiplicity'
20574 usemymalloc='$usemymalloc'
20575 usenm='$usenm'
20576 useopcode='$useopcode'
20577 useperlio='$useperlio'
20578 useposix='$useposix'
20579 usereentrant='$usereentrant'
20580 usesfio='$usesfio'
20581 useshrplib='$useshrplib'
20582 usesocks='$usesocks'
20583 usethreads='$usethreads'
20584 usevendorprefix='$usevendorprefix'
20585 usevfork='$usevfork'
20586 usrinc='$usrinc'
20587 uuname='$uuname'
20588 uvXUformat='$uvXUformat'
20589 uvoformat='$uvoformat'
20590 uvsize='$uvsize'
20591 uvtype='$uvtype'
20592 uvuformat='$uvuformat'
20593 uvxformat='$uvxformat'
20594 vendorarch='$vendorarch'
20595 vendorarchexp='$vendorarchexp'
20596 vendorbin='$vendorbin'
20597 vendorbinexp='$vendorbinexp'
20598 vendorlib='$vendorlib'
20599 vendorlib_stem='$vendorlib_stem'
20600 vendorlibexp='$vendorlibexp'
20601 vendorprefix='$vendorprefix'
20602 vendorprefixexp='$vendorprefixexp'
20603 version='$version'
20604 version_patchlevel_string='$version_patchlevel_string'
20605 versiononly='$versiononly'
20606 vi='$vi'
20607 voidflags='$voidflags'
20608 xlibpth='$xlibpth'
20609 xs_apiversion='$xs_apiversion'
20610 yacc='$yacc'
20611 yaccflags='$yaccflags'
20612 zcat='$zcat'
20613 zip='$zip'
20614 EOT
20615
20616 : Add in command line options if available
20617 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20618
20619 : add special variables
20620 $test -f $src/patchlevel.h && \
20621 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20622 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20623 echo "PERL_CONFIG_SH=true" >>config.sh
20624
20625 : propagate old symbols
20626 if $test -f UU/config.sh; then
20627         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20628         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20629         $sort | $uniq -u >UU/oldsyms
20630         set X `cat UU/oldsyms`
20631         shift
20632         case $# in
20633         0) ;;
20634         *)
20635                 cat <<EOM
20636 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20637 EOM
20638                 echo "# Variables propagated from previous config.sh file." >>config.sh
20639                 for sym in `cat UU/oldsyms`; do
20640                         echo "    Propagating $hint variable "'$'"$sym..."
20641                         eval 'tmp="$'"${sym}"'"'
20642                         echo "$tmp" | \
20643                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20644                 done
20645                 ;;
20646         esac
20647 fi
20648
20649 : Finish up by extracting the .SH files
20650 case "$alldone" in
20651 exit)
20652         $rm -rf UU
20653         echo "Extraction done."
20654         exit 0
20655         ;;
20656 cont)
20657         ;;
20658 '')
20659         dflt=''
20660         nostick=true
20661         $cat <<EOM
20662
20663 If you'd like to make any changes to the config.sh file before I begin
20664 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20665
20666 EOM
20667         rp="Press return or use a shell escape to edit config.sh:"
20668         . UU/myread
20669         nostick=''
20670         case "$ans" in
20671         '') ;;
20672         *) : in case they cannot read
20673                 sh 1>&4 -c "$ans";;
20674         esac
20675         ;;
20676 esac
20677
20678 : if this fails, just run all the .SH files by hand
20679 . ./config.sh
20680
20681 echo " "
20682 exec 1>&4
20683 pwd=`pwd`
20684 . ./UU/extract
20685 cd "$pwd"
20686
20687 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20688         dflt=y
20689         case "$silent" in
20690         true) ;;
20691         *)
20692                 $cat <<EOM
20693
20694 Now you need to generate make dependencies by running "$make depend".
20695 You might prefer to run it in background: "$make depend > makedepend.out &"
20696 It can take a while, so you might not want to run it right now.
20697
20698 EOM
20699                 ;;
20700         esac
20701         rp="Run $make depend now?"
20702         . UU/myread
20703         case "$ans" in
20704         y*)
20705                 $make depend && echo "Now you must run '$make'."
20706                 ;;
20707         *)
20708                 echo "You must run '$make depend' then '$make'."
20709                 ;;
20710         esac
20711 elif test -f [Mm]akefile; then
20712         echo " "
20713         echo "Now you must run a $make."
20714 else
20715         echo "Configure done."
20716 fi
20717
20718 if $test -f Policy.sh; then
20719     $cat <<EOM
20720
20721 If you compile $package on a different machine or from a different object
20722 directory, copy the Policy.sh file from this object directory to the
20723 new one before you run Configure -- this will help you with most of
20724 the policy defaults.
20725
20726 EOM
20727 fi
20728 if $test -f config.msg; then
20729     echo "Hmm.  I also noted the following information while running:"
20730     echo " "
20731     $cat config.msg >&4
20732     $rm -f config.msg
20733 fi
20734 $rm -f kit*isdone ark*isdone
20735 $rm -rf UU
20736
20737 : End of Configure
20738