Re: [PATCH@8545] [ID 20000808.005] OP_REFGEN as an lvalue
[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_mprotect=''
542 d_msg=''
543 d_msgctl=''
544 d_msgget=''
545 d_msghdr_s=''
546 d_msgrcv=''
547 d_msgsnd=''
548 d_msync=''
549 d_munmap=''
550 d_nice=''
551 d_nl_langinfo=''
552 d_off64_t=''
553 d_open3=''
554 d_fpathconf=''
555 d_pathconf=''
556 d_pause=''
557 d_pipe=''
558 d_poll=''
559 d_portable=''
560 d_procselfexe=''
561 procselfexe=''
562 d_old_pthread_create_joinable=''
563 old_pthread_create_joinable=''
564 d_pthread_atfork=''
565 d_pthread_yield=''
566 d_sched_yield=''
567 sched_yield=''
568 d_qgcvt=''
569 d_random_r=''
570 random_r_proto=''
571 d_readdir64_r=''
572 readdir64_r_proto=''
573 d_readdir=''
574 d_rewinddir=''
575 d_seekdir=''
576 d_telldir=''
577 d_readdir_r=''
578 readdir_r_proto=''
579 d_readlink=''
580 d_readv=''
581 d_recvmsg=''
582 d_rename=''
583 d_rmdir=''
584 d_safebcpy=''
585 d_safemcpy=''
586 d_sanemcmp=''
587 d_sbrkproto=''
588 d_select=''
589 d_sem=''
590 d_semctl=''
591 d_semget=''
592 d_semop=''
593 d_sendmsg=''
594 d_setegid=''
595 d_seteuid=''
596 d_setgrent=''
597 d_setgrent_r=''
598 setgrent_r_proto=''
599 d_setgrps=''
600 d_sethent=''
601 d_sethostent_r=''
602 sethostent_r_proto=''
603 d_setitimer=''
604 d_setlinebuf=''
605 d_setlocale=''
606 d_setlocale_r=''
607 setlocale_r_proto=''
608 d_setnent=''
609 d_setnetent_r=''
610 setnetent_r_proto=''
611 d_setpent=''
612 d_setpgid=''
613 d_setpgrp2=''
614 d_bsdsetpgrp=''
615 d_setpgrp=''
616 d_setprior=''
617 d_setproctitle=''
618 d_setprotoent_r=''
619 setprotoent_r_proto=''
620 d_setpwent=''
621 d_setpwent_r=''
622 setpwent_r_proto=''
623 d_setregid=''
624 d_setresgid=''
625 d_setresuid=''
626 d_setreuid=''
627 d_setrgid=''
628 d_setruid=''
629 d_setsent=''
630 d_setservent_r=''
631 setservent_r_proto=''
632 d_setsid=''
633 d_setvbuf=''
634 d_sfio=''
635 usesfio=''
636 d_shm=''
637 d_shmat=''
638 d_shmatprototype=''
639 shmattype=''
640 d_shmctl=''
641 d_shmdt=''
642 d_shmget=''
643 d_sigaction=''
644 d_sigprocmask=''
645 d_sigsetjmp=''
646 d_sockatmark=''
647 d_sockatmarkproto=''
648 d_msg_ctrunc=''
649 d_msg_dontroute=''
650 d_msg_oob=''
651 d_msg_peek=''
652 d_msg_proxy=''
653 d_oldsock=''
654 d_scm_rights=''
655 d_socket=''
656 d_sockpair=''
657 sockethdr=''
658 socketlib=''
659 d_socklen_t=''
660 d_socks5_init=''
661 d_sqrtl=''
662 d_srand48_r=''
663 srand48_r_proto=''
664 d_srandom_r=''
665 srandom_r_proto=''
666 d_sresgproto=''
667 d_sresuproto=''
668 d_statblks=''
669 d_statfs_f_flags=''
670 d_statfs_s=''
671 d_fstatvfs=''
672 d_statvfs=''
673 d_stdio_cnt_lval=''
674 d_stdio_ptr_lval=''
675 d_stdio_ptr_lval_nochange_cnt=''
676 d_stdio_ptr_lval_sets_cnt=''
677 d_stdiobase=''
678 d_stdstdio=''
679 stdio_base=''
680 stdio_bufsiz=''
681 stdio_cnt=''
682 stdio_filbuf=''
683 stdio_ptr=''
684 d_index=''
685 d_strchr=''
686 d_strcoll=''
687 d_strctcpy=''
688 d_strerrm=''
689 d_strerror=''
690 d_sysernlst=''
691 d_syserrlst=''
692 d_strerror_r=''
693 strerror_r_proto=''
694 d_strftime=''
695 d_strtod=''
696 d_strtol=''
697 d_strtold=''
698 d_strtoll=''
699 d_strtoq=''
700 d_strtoul=''
701 d_strtoull=''
702 d_strtouq=''
703 d_strxfrm=''
704 d_symlink=''
705 d_syscall=''
706 d_syscallproto=''
707 d_sysconf=''
708 d_system=''
709 d_tcgetpgrp=''
710 d_tcsetpgrp=''
711 d_telldirproto=''
712 d_time=''
713 timetype=''
714 clocktype=''
715 d_times=''
716 d_tmpnam_r=''
717 tmpnam_r_proto=''
718 d_truncate=''
719 d_ttyname_r=''
720 ttyname_r_proto=''
721 d_tzname=''
722 d_u32align=''
723 d_ualarm=''
724 d_umask=''
725 d_semctl_semid_ds=''
726 d_semctl_semun=''
727 d_union_semun=''
728 d_unordered=''
729 d_usleep=''
730 d_usleepproto=''
731 d_ustat=''
732 d_vfork=''
733 usevfork=''
734 d_voidsig=''
735 signal_t=''
736 d_volatile=''
737 d_charvspr=''
738 d_vprintf=''
739 d_wait4=''
740 d_waitpid=''
741 d_wcstombs=''
742 d_wctomb=''
743 d_writev=''
744 dlext=''
745 cccdlflags=''
746 ccdlflags=''
747 dlsrc=''
748 ld=''
749 lddlflags=''
750 usedl=''
751 doublesize=''
752 ebcdic=''
753 fflushNULL=''
754 fflushall=''
755 fpossize=''
756 fpostype=''
757 gccosandvers=''
758 gccversion=''
759 gidformat=''
760 gidsign=''
761 gidsize=''
762 gidtype=''
763 groupstype=''
764 h_fcntl=''
765 h_sysfile=''
766 i_arpainet=''
767 i_crypt=''
768 db_hashtype=''
769 db_prefixtype=''
770 db_version_major=''
771 db_version_minor=''
772 db_version_patch=''
773 i_db=''
774 i_dbm=''
775 i_rpcsvcdbm=''
776 d_dirnamlen=''
777 direntrytype=''
778 i_dirent=''
779 i_dld=''
780 i_dlfcn=''
781 i_fcntl=''
782 i_float=''
783 i_fp=''
784 i_fp_class=''
785 i_gdbm=''
786 d_grpasswd=''
787 i_grp=''
788 i_ieeefp=''
789 i_inttypes=''
790 i_langinfo=''
791 i_libutil=''
792 i_limits=''
793 i_locale=''
794 i_machcthr=''
795 i_malloc=''
796 i_math=''
797 i_memory=''
798 i_mntent=''
799 i_ndbm=''
800 i_netdb=''
801 i_neterrno=''
802 i_netinettcp=''
803 i_niin=''
804 i_sysin=''
805 i_poll=''
806 i_prot=''
807 i_pthread=''
808 d_pwage=''
809 d_pwchange=''
810 d_pwclass=''
811 d_pwcomment=''
812 d_pwexpire=''
813 d_pwgecos=''
814 d_pwpasswd=''
815 d_pwquota=''
816 i_pwd=''
817 i_sfio=''
818 i_shadow=''
819 i_socks=''
820 i_stddef=''
821 i_stdlib=''
822 i_string=''
823 strings=''
824 i_sunmath=''
825 i_sysaccess=''
826 i_sysdir=''
827 i_sysfile=''
828 d_voidtty=''
829 i_bsdioctl=''
830 i_sysfilio=''
831 i_sysioctl=''
832 i_syssockio=''
833 i_syslog=''
834 i_sysmman=''
835 i_sysmode=''
836 i_sysmount=''
837 i_sysndir=''
838 i_sysparam=''
839 i_sysresrc=''
840 i_syssecrt=''
841 i_sysselct=''
842 i_sysstat=''
843 i_sysstatfs=''
844 i_sysstatvfs=''
845 i_systimes=''
846 i_systypes=''
847 i_sysuio=''
848 i_sysun=''
849 i_sysutsname=''
850 i_sysvfs=''
851 i_syswait=''
852 i_sgtty=''
853 i_termio=''
854 i_termios=''
855 d_tm_tm_gmtoff=''
856 d_tm_tm_zone=''
857 i_systime=''
858 i_systimek=''
859 i_time=''
860 timeincl=''
861 i_unistd=''
862 i_ustat=''
863 i_utime=''
864 i_values=''
865 i_stdarg=''
866 i_varargs=''
867 i_varhdr=''
868 i_vfork=''
869 inc_version_list=''
870 inc_version_list_init=''
871 installprefix=''
872 installprefixexp=''
873 installstyle=''
874 installusrbinperl=''
875 intsize=''
876 longsize=''
877 shortsize=''
878 issymlink=''
879 libc=''
880 ldlibpthname=''
881 libperl=''
882 shrpenv=''
883 useshrplib=''
884 glibpth=''
885 libpth=''
886 loclibpth=''
887 plibpth=''
888 xlibpth=''
889 ignore_versioned_solibs=''
890 libs=''
891 libsdirs=''
892 libsfiles=''
893 libsfound=''
894 libspath=''
895 lns=''
896 d_PRIEUldbl=''
897 d_PRIFUldbl=''
898 d_PRIGUldbl=''
899 d_PRIeldbl=''
900 d_PRIfldbl=''
901 d_PRIgldbl=''
902 d_SCNfldbl=''
903 sPRIEUldbl=''
904 sPRIFUldbl=''
905 sPRIGUldbl=''
906 sPRIeldbl=''
907 sPRIfldbl=''
908 sPRIgldbl=''
909 sSCNfldbl=''
910 lseeksize=''
911 lseektype=''
912 make_set_make=''
913 d_mymalloc=''
914 freetype=''
915 mallocobj=''
916 mallocsrc=''
917 malloctype=''
918 usemymalloc=''
919 installman1dir=''
920 man1dir=''
921 man1direxp=''
922 man1ext=''
923 installman3dir=''
924 man3dir=''
925 man3direxp=''
926 man3ext=''
927 modetype=''
928 multiarch=''
929 mydomain=''
930 myhostname=''
931 phostname=''
932 c=''
933 n=''
934 d_eofnblk=''
935 eagain=''
936 o_nonblock=''
937 rd_nodata=''
938 need_va_copy=''
939 netdb_hlen_type=''
940 netdb_host_type=''
941 netdb_name_type=''
942 netdb_net_type=''
943 groupcat=''
944 hostcat=''
945 passcat=''
946 orderlib=''
947 ranlib=''
948 d_perl_otherlibdirs=''
949 otherlibdirs=''
950 package=''
951 spackage=''
952 pager=''
953 api_revision=''
954 api_subversion=''
955 api_version=''
956 api_versionstring=''
957 patchlevel=''
958 perl_patchlevel=''
959 revision=''
960 subversion=''
961 version=''
962 version_patchlevel_string=''
963 perl5=''
964 perladmin=''
965 perlpath=''
966 d_nv_preserves_uv=''
967 i16size=''
968 i16type=''
969 i32size=''
970 i32type=''
971 i64size=''
972 i64type=''
973 i8size=''
974 i8type=''
975 ivsize=''
976 ivtype=''
977 nv_preserves_uv_bits=''
978 nvsize=''
979 nvtype=''
980 u16size=''
981 u16type=''
982 u32size=''
983 u32type=''
984 u64size=''
985 u64type=''
986 u8size=''
987 u8type=''
988 uvsize=''
989 uvtype=''
990 ivdformat=''
991 nvEUformat=''
992 nvFUformat=''
993 nvGUformat=''
994 nveformat=''
995 nvfformat=''
996 nvgformat=''
997 uvXUformat=''
998 uvoformat=''
999 uvuformat=''
1000 uvxformat=''
1001 pidtype=''
1002 prefix=''
1003 prefixexp=''
1004 installprivlib=''
1005 privlib=''
1006 privlibexp=''
1007 prototype=''
1008 ptrsize=''
1009 d_PRIXU64=''
1010 d_PRId64=''
1011 d_PRIi64=''
1012 d_PRIo64=''
1013 d_PRIu64=''
1014 d_PRIx64=''
1015 sPRIXU64=''
1016 sPRId64=''
1017 sPRIi64=''
1018 sPRIo64=''
1019 sPRIu64=''
1020 sPRIx64=''
1021 d_quad=''
1022 quadkind=''
1023 quadtype=''
1024 uquadtype=''
1025 drand01=''
1026 randbits=''
1027 randfunc=''
1028 randseedtype=''
1029 seedfunc=''
1030 installscript=''
1031 scriptdir=''
1032 scriptdirexp=''
1033 selectminbits=''
1034 selecttype=''
1035 sh=''
1036 sig_count=''
1037 sig_name=''
1038 sig_name_init=''
1039 sig_num=''
1040 sig_num_init=''
1041 sig_size=''
1042 installsitearch=''
1043 sitearch=''
1044 sitearchexp=''
1045 installsitebin=''
1046 sitebin=''
1047 sitebinexp=''
1048 installsitelib=''
1049 sitelib=''
1050 sitelib_stem=''
1051 sitelibexp=''
1052 siteprefix=''
1053 siteprefixexp=''
1054 sizesize=''
1055 sizetype=''
1056 so=''
1057 socksizetype=''
1058 sharpbang=''
1059 shsharp=''
1060 spitshell=''
1061 src=''
1062 ssizetype=''
1063 startperl=''
1064 startsh=''
1065 stdchar=''
1066 d_stdio_stream_array=''
1067 stdio_stream_array=''
1068 sysman=''
1069 trnl=''
1070 uidformat=''
1071 uidsign=''
1072 uidsize=''
1073 uidtype=''
1074 archname64=''
1075 use64bitall=''
1076 use64bitint=''
1077 ccflags_uselargefiles=''
1078 ldflags_uselargefiles=''
1079 libswanted_uselargefiles=''
1080 uselargefiles=''
1081 uselongdouble=''
1082 usemorebits=''
1083 usemultiplicity=''
1084 nm_opt=''
1085 nm_so_opt=''
1086 runnm=''
1087 usenm=''
1088 useperlio=''
1089 usesocks=''
1090 d_oldpthreads=''
1091 use5005threads=''
1092 useithreads=''
1093 usereentrant=''
1094 usethreads=''
1095 incpath=''
1096 mips_type=''
1097 usrinc=''
1098 d_vendorarch=''
1099 installvendorarch=''
1100 vendorarch=''
1101 vendorarchexp=''
1102 d_vendorbin=''
1103 installvendorbin=''
1104 vendorbin=''
1105 vendorbinexp=''
1106 d_vendorlib=''
1107 installvendorlib=''
1108 vendorlib=''
1109 vendorlib_stem=''
1110 vendorlibexp=''
1111 usevendorprefix=''
1112 vendorprefix=''
1113 vendorprefixexp=''
1114 versiononly=''
1115 defvoidused=''
1116 voidflags=''
1117 pm_apiversion=''
1118 xs_apiversion=''
1119 yacc=''
1120 yaccflags=''
1121 CONFIG=''
1122
1123 define='define'
1124 undef='undef'
1125 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1126 rmlist=''
1127
1128 : We must find out about Eunice early
1129 eunicefix=':'
1130 if test -f /etc/unixtovms; then
1131         eunicefix=/etc/unixtovms
1132 fi
1133 if test -f /etc/unixtovms.exe; then
1134         eunicefix=/etc/unixtovms.exe
1135 fi
1136
1137 : Set executable suffix now -- needed before hints available
1138 if test -f "/libs/version.library"; then
1139 : Amiga OS
1140     _exe=""
1141 elif test -f "/system/gnu_library/bin/ar.pm"; then
1142 : Stratus VOS
1143     _exe=".pm"
1144 elif test -n "$DJGPP"; then
1145 : DOS DJGPP
1146     _exe=".exe"
1147 elif test -d c:/. ; then
1148 : OS/2 or cygwin
1149     _exe=".exe"
1150 fi
1151
1152 i_whoami=''
1153 : Possible local include directories to search.
1154 : Set locincpth to "" in a hint file to defeat local include searches.
1155 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1156 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1157 :
1158 : no include file wanted by default
1159 inclwanted=''
1160
1161 : Trailing extension.  Override this in a hint file, if needed.
1162 : Extra object files, if any, needed on this platform.
1163 archobjs=''
1164 groupstype=''
1165 libnames=''
1166 : change the next line if compiling for Xenix/286 on Xenix/386
1167 xlibpth='/usr/lib/386 /lib/386'
1168 : Possible local library directories to search.
1169 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1170 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1171
1172 : general looking path for locating libraries
1173 glibpth="/lib /usr/lib $xlibpth"
1174 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1175 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1176 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1177
1178 : Private path used by Configure to find libraries.  Its value
1179 : is prepended to libpth. This variable takes care of special
1180 : machines, like the mips.  Usually, it should be empty.
1181 plibpth=''
1182
1183 : default library list
1184 libswanted=''
1185 : some systems want to use only the non-versioned libso:s
1186 ignore_versioned_solibs=''
1187 : full support for void wanted by default
1188 defvoidused=15
1189
1190 ccname=''
1191 ccversion=''
1192 perllibs=''
1193 : set useposix=false in your hint file to disable the POSIX extension.
1194 useposix=true
1195 : set useopcode=false in your hint file to disable the Opcode extension.
1196 useopcode=true
1197 archname64=''
1198 ccflags_uselargefiles=''
1199 ldflags_uselargefiles=''
1200 libswanted_uselargefiles=''
1201 : set usemultiplicity on the Configure command line to enable multiplicity.
1202 : set usesocks on the Configure command line to enable socks.
1203 archname=''
1204 : set usethreads on the Configure command line to enable threads.
1205 usereentrant='undef'
1206 : List of libraries we want.
1207 : If anyone needs -lnet, put it in a hint file.
1208 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1209 libswanted="$libswanted dld ld sun m c cposix posix"
1210 libswanted="$libswanted ndir dir crypt sec"
1211 libswanted="$libswanted ucb bsd BSD PW x util"
1212 : We probably want to search /usr/shlib before most other libraries.
1213 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1214 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1215 glibpth="/usr/shlib $glibpth"
1216 : Do not use vfork unless overridden by a hint file.
1217 usevfork=false
1218
1219 : Find the basic shell for Bourne shell scripts
1220 case "$sh" in
1221 '')
1222         case "$SYSTYPE" in
1223         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1224         *) xxx='/bin/sh';;
1225         esac
1226         if test -f "$xxx"; then
1227                 sh="$xxx"
1228         else
1229                 : Build up a list and do a single loop so we can 'break' out.
1230                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1231                 for xxx in sh bash ksh pdksh ash; do
1232                         for p in $pth; do
1233                                 try="$try ${p}/${xxx}"
1234                         done
1235                 done
1236                 for xxx in $try; do
1237                         if test -f "$xxx"; then
1238                                 sh="$xxx";
1239                                 break
1240                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1241                                 sh="$xxx";
1242                                 break
1243                         elif test -f "$xxx.exe"; then
1244                                 sh="$xxx";
1245                                 break
1246                         fi
1247                 done
1248         fi
1249         ;;
1250 esac
1251
1252 case "$sh" in
1253 '')     cat >&2 <<EOM
1254 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1255
1256 Usually it's in /bin/sh.  How did you even get this far?
1257 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1258 we'll try to straighten this all out.
1259 EOM
1260         exit 1
1261         ;;
1262 esac
1263
1264 : see if sh knows # comments
1265 if `$sh -c '#' >/dev/null 2>&1`; then
1266         shsharp=true
1267         spitshell=cat
1268         xcat=/bin/cat
1269         test -f $xcat$_exe || xcat=/usr/bin/cat
1270         if test ! -f $xcat$_exe; then
1271                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1272                         if test -f $p/cat$_exe; then
1273                                 xcat=$p/cat
1274                                 break
1275                         fi
1276                 done
1277                 if test ! -f $xcat$_exe; then
1278                         echo "Can't find cat anywhere!"
1279                         exit 1
1280                 fi
1281         fi
1282         echo "#!$xcat" >sharp
1283         $eunicefix sharp
1284         chmod +x sharp
1285         ./sharp > today
1286         if test -s today; then
1287                 sharpbang='#!'
1288         else
1289                 echo "#! $xcat" > sharp
1290                 $eunicefix sharp
1291                 chmod +x sharp
1292                 ./sharp > today
1293                 if test -s today; then
1294                         sharpbang='#! '
1295                 else
1296                         sharpbang=': use '
1297                 fi
1298         fi
1299 else
1300         echo " "
1301         echo "Your $sh doesn't grok # comments--I will strip them later on."
1302         shsharp=false
1303         cd ..
1304         echo "exec grep -v '^[  ]*#'" >spitshell
1305         chmod +x spitshell
1306         $eunicefix spitshell
1307         spitshell=`pwd`/spitshell
1308         cd UU
1309         echo "I presume that if # doesn't work, #! won't work either!"
1310         sharpbang=': use '
1311 fi
1312 rm -f sharp today
1313
1314 : figure out how to guarantee sh startup
1315 case "$startsh" in
1316 '') startsh=${sharpbang}${sh} ;;
1317 *)
1318 esac
1319 cat >sharp <<EOSS
1320 $startsh
1321 set abc
1322 test "$?abc" != 1
1323 EOSS
1324
1325 chmod +x sharp
1326 $eunicefix sharp
1327 if ./sharp; then
1328         : echo "Yup, it does."
1329 else
1330         echo "Hmm... '$startsh' does not guarantee sh startup..."
1331         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1332 fi
1333 rm -f sharp
1334
1335
1336 : Save command line options in file UU/cmdline.opt for later use in
1337 : generating config.sh.
1338 cat > cmdline.opt <<EOSH
1339 # Configure command line arguments.
1340 config_arg0='$0'
1341 config_args='$*'
1342 config_argc=$#
1343 EOSH
1344 argn=1
1345 args_exp=''
1346 args_sep=''
1347 for arg in "$@"; do
1348         cat >>cmdline.opt <<EOSH
1349 config_arg$argn='$arg'
1350 EOSH
1351         # Extreme backslashitis: replace each ' by '"'"'
1352         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1353 $arg
1354 EOC
1355         arg_exp=`cat cmdl.opt`
1356         args_exp="$args_exp$args_sep'$arg_exp'"
1357         argn=`expr $argn + 1`
1358         args_sep=' '
1359 done
1360 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1361 # used by ./hints/os2.sh
1362 rm -f cmdl.opt
1363
1364 : produce awk script to parse command line options
1365 cat >options.awk <<'EOF'
1366 BEGIN {
1367         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1368
1369         len = length(optstr);
1370         for (i = 1; i <= len; i++) {
1371                 c = substr(optstr, i, 1);
1372                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1373                 if (a == ":") {
1374                         arg[c] = 1;
1375                         i++;
1376                 }
1377                 opt[c] = 1;
1378         }
1379 }
1380 {
1381         expect = 0;
1382         str = $0;
1383         if (substr(str, 1, 1) != "-") {
1384                 printf("'%s'\n", str);
1385                 next;
1386         }
1387         len = length($0);
1388         for (i = 2; i <= len; i++) {
1389                 c = substr(str, i, 1);
1390                 if (!opt[c]) {
1391                         printf("-%s\n", substr(str, i));
1392                         next;
1393                 }
1394                 printf("-%s\n", c);
1395                 if (arg[c]) {
1396                         if (i < len)
1397                                 printf("'%s'\n", substr(str, i + 1));
1398                         else
1399                                 expect = 1;
1400                         next;
1401                 }
1402         }
1403 }
1404 END {
1405         if (expect)
1406                 print "?";
1407 }
1408 EOF
1409
1410 : process the command line options
1411 set X `for arg in "$@"; do echo "X$arg"; done |
1412         sed -e s/X// | awk -f options.awk`
1413 eval "set $*"
1414 shift
1415 rm -f options.awk
1416
1417 : set up default values
1418 fastread=''
1419 reuseval=false
1420 config_sh=''
1421 alldone=''
1422 error=''
1423 silent=''
1424 extractsh=''
1425 override=''
1426 knowitall=''
1427 rm -f optdef.sh posthint.sh
1428 cat >optdef.sh <<EOS
1429 $startsh
1430 EOS
1431
1432
1433 : option parsing
1434 while test $# -gt 0; do
1435         case "$1" in
1436         -d) shift; fastread=yes;;
1437         -e) shift; alldone=cont;;
1438         -f)
1439                 shift
1440                 cd ..
1441                 if test -r "$1"; then
1442                         config_sh="$1"
1443                 else
1444                         echo "$me: cannot read config file $1." >&2
1445                         error=true
1446                 fi
1447                 cd UU
1448                 shift;;
1449         -h) shift; error=true;;
1450         -r) shift; reuseval=true;;
1451         -s) shift; silent=true; realsilent=true;;
1452         -E) shift; alldone=exit;;
1453         -K) shift; knowitall=true;;
1454         -O) shift; override=true;;
1455         -S) shift; silent=true; extractsh=true;;
1456         -D)
1457                 shift
1458                 case "$1" in
1459                 *=)
1460                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1461                         echo "$me: ignoring -D $1" >&2
1462                         ;;
1463                 *=*) echo "$1" | \
1464                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1465                 *) echo "$1='define'" >> optdef.sh;;
1466                 esac
1467                 shift
1468                 ;;
1469         -U)
1470                 shift
1471                 case "$1" in
1472                 *=) echo "$1" >> optdef.sh;;
1473                 *=*)
1474                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1475                         echo "$me: ignoring -U $1" >&2
1476                         ;;
1477                 *) echo "$1='undef'" >> optdef.sh;;
1478                 esac
1479                 shift
1480                 ;;
1481         -A)
1482             shift
1483             xxx=''
1484             yyy="$1"
1485             zzz=''
1486             uuu=undef
1487             case "$yyy" in
1488             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1489                  case "$zzz" in
1490                  *:*) zzz='' ;;
1491                  *)   xxx=append
1492                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1493                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1494                  esac
1495                  ;;
1496             esac
1497             case "$xxx" in
1498             '')  case "$yyy" in
1499                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1500                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1501                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1502                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1503                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1504                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1505                  esac
1506                  ;;       
1507             esac
1508             case "$xxx" in
1509             append)
1510                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1511             clear)
1512                 echo "$yyy=''"                  >> posthint.sh ;;
1513             define)
1514                 case "$zzz" in
1515                 '') zzz=define ;;
1516                 esac
1517                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1518             eval)
1519                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1520             prepend)
1521                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1522             undef)
1523                 case "$zzz" in
1524                 '') zzz="$uuu" ;;
1525                 esac
1526                 echo "$yyy=$zzz"                >> posthint.sh ;;
1527             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1528             esac
1529             shift
1530             ;;
1531         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1532             exit 0;;
1533         --) break;;
1534         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1535         *) break;;
1536         esac
1537 done
1538
1539 case "$error" in
1540 true)
1541         cat >&2 <<EOM
1542 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1543                  [-U symbol] [-U symbol=] [-A command:symbol...]
1544   -d : use defaults for all answers.
1545   -e : go on without questioning past the production of config.sh.
1546   -f : specify an alternate default configuration file.
1547   -h : print this help message and exit (with an error status).
1548   -r : reuse C symbols value if possible (skips costly nm extraction).
1549   -s : silent mode, only echoes questions and essential information.
1550   -D : define symbol to have some value:
1551          -D symbol         symbol gets the value 'define'
1552          -D symbol=value   symbol gets the value 'value'
1553   -E : stop at the end of questions, after having produced config.sh.
1554   -K : do not use unless you know what you are doing.
1555   -O : let -D and -U override definitions from loaded configuration file.
1556   -S : perform variable substitutions on all .SH files (can mix with -f)
1557   -U : undefine symbol:
1558          -U symbol    symbol gets the value 'undef'
1559          -U symbol=   symbol gets completely empty
1560   -A : manipulate symbol after the platform specific hints have been applied:
1561          -A symbol=value                append " "value to symbol
1562          -A append:symbol=value         append value to symbol
1563          -A define:symbol=value         define symbol to have value
1564          -A clear:symbol                define symbol to be ''
1565          -A define:symbol               define symbol to be 'define'
1566          -A eval:symbol=value           define symbol to be eval of value
1567          -A prepend:symbol=value        prepend value to symbol
1568          -A undef:symbol                define symbol to be 'undef'
1569          -A undef:symbol=               define symbol to be ''
1570   -V : print version number and exit (with a zero status).
1571 EOM
1572         exit 1
1573         ;;
1574 esac
1575
1576 : Sanity checks
1577 case "$fastread$alldone" in
1578 yescont|yesexit) ;;
1579 *)
1580         case "$extractsh" in
1581         true) ;;
1582         *)
1583                 if test ! -t 0; then
1584                         echo "Say 'sh Configure', not 'sh <Configure'"
1585                         exit 1
1586                 fi
1587                 ;;
1588         esac
1589         ;;
1590 esac
1591
1592 exec 4>&1
1593 case "$silent" in
1594 true) exec 1>/dev/null;;
1595 esac
1596
1597 : run the defines and the undefines, if any, but leave the file out there...
1598 touch optdef.sh
1599 . ./optdef.sh
1600 : create the posthint manipulation script and leave the file out there...
1601 touch posthint.sh
1602
1603 : set package name
1604 package=perl5
1605 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1606 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1607 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1608 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1609 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1610 esac
1611
1612 : Some greps do not return status, grrr.
1613 echo "grimblepritz" >grimble
1614 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1615         contains=contains
1616 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1617         contains=grep
1618 else
1619         contains=contains
1620 fi
1621 rm -f grimble
1622 : the following should work in any shell
1623 case "$contains" in
1624 contains*)
1625         echo " "
1626         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1627         cat >contains <<'EOSS'
1628 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1629 EOSS
1630 chmod +x contains
1631 esac
1632
1633 : Find the path to the source tree
1634 case "$src" in
1635 '') case "$0" in
1636     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1637          case "$src" in
1638          /*)    ;;
1639          .)     ;;
1640          *)     src=`cd ../$src && pwd` ;;
1641          esac
1642          ;;
1643     *)   src='.';;
1644     esac;;
1645 esac
1646 case "$src" in
1647 '')     src=/
1648         rsrc=/
1649         ;;
1650 /*) rsrc="$src";;
1651 *) rsrc="../$src";;
1652 esac
1653 if test -f $rsrc/Configure && \
1654         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1655 then
1656    : found it, so we are ok.
1657 else
1658         rsrc=''
1659         for src in . .. ../.. ../../.. ../../../..; do
1660                 if test -f ../$src/Configure && \
1661                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1662                 then
1663                         rsrc=../$src
1664                         break
1665                 fi
1666         done
1667 fi
1668 case "$rsrc" in
1669 '')
1670         cat <<EOM >&4
1671
1672 Sorry, I can't seem to locate the source dir for $package.  Please start
1673 Configure with an explicit path -- i.e. /some/path/Configure.
1674
1675 EOM
1676         exit 1
1677         ;;
1678 ../.)   rsrc='..';;
1679 *)
1680         echo " "
1681         echo "Sources for $package found in \"$src\"." >&4
1682         ;;
1683 esac
1684
1685 : script used to extract .SH files with variable substitutions
1686 cat >extract <<'EOS'
1687 PERL_CONFIG_SH=true
1688 echo "Doing variable substitutions on .SH files..."
1689 if test -f MANIFEST; then
1690         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1691 else
1692         echo "(Looking for .SH files under the source directory.)"
1693         set x `(cd "$src"; find . -name "*.SH" -print)`
1694 fi
1695 shift
1696 case $# in
1697 0) set x `(cd "$src"; echo *.SH)`; shift;;
1698 esac
1699 if test ! -f "$src/$1"; then
1700         shift
1701 fi
1702 mkdir_p='
1703 name=$1;
1704 create="";
1705 while test $name; do
1706         if test ! -d "$name"; then
1707                 create="$name $create";
1708                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1709                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1710         else
1711                 name="";
1712         fi;
1713 done;
1714 for file in $create; do
1715         mkdir $file;
1716 done
1717 '
1718 for file in $*; do
1719         case "$src" in
1720         ".")
1721                 case "$file" in
1722                 */*)
1723                         dir=`expr X$file : 'X\(.*\)/'`
1724                         file=`expr X$file : 'X.*/\(.*\)'`
1725                         (cd "$dir" && . ./$file)
1726                         ;;
1727                 *)
1728                         . ./$file
1729                         ;;
1730                 esac
1731                 ;;
1732         *)
1733                 case "$file" in
1734                 */*)
1735                         dir=`expr X$file : 'X\(.*\)/'`
1736                         file=`expr X$file : 'X.*/\(.*\)'`
1737                         (set x $dir; shift; eval $mkdir_p)
1738                         sh <"$src/$dir/$file"
1739                         ;;
1740                 *)
1741                         sh <"$src/$file"
1742                         ;;
1743                 esac
1744                 ;;
1745         esac
1746 done
1747 if test -f "$src/config_h.SH"; then
1748         if test ! -f config.h; then
1749         : oops, they left it out of MANIFEST, probably, so do it anyway.
1750         . "$src/config_h.SH"
1751         fi
1752 fi
1753 EOS
1754
1755 : extract files and exit if asked to do so
1756 case "$extractsh" in
1757 true)
1758         case "$realsilent" in
1759         true) ;;
1760         *) exec 1>&4;;
1761         esac
1762         case "$config_sh" in
1763         '') config_sh='config.sh';;
1764         esac
1765         echo " "
1766         echo "Fetching answers from $config_sh..."
1767         cd ..
1768         . $config_sh
1769         test "$override" && . ./optdef.sh
1770         echo " "
1771         . UU/extract
1772         rm -rf UU
1773         echo "Extraction done."
1774         exit 0
1775         ;;
1776 esac
1777
1778 : Eunice requires " " instead of "", can you believe it
1779 echo " "
1780 : Here we go...
1781 echo "Beginning of configuration questions for $package."
1782
1783 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1784
1785 : first determine how to suppress newline on echo command
1786 echo " "
1787 echo "Checking echo to see how to suppress newlines..."
1788 (echo "hi there\c" ; echo " ") >.echotmp
1789 if $contains c .echotmp >/dev/null 2>&1 ; then
1790         echo "...using -n."
1791         n='-n'
1792         c=''
1793 else
1794         cat <<'EOM'
1795 ...using \c
1796 EOM
1797         n=''
1798         c='\c'
1799 fi
1800 echo $n "The star should be here-->$c"
1801 echo '*'
1802 rm -f .echotmp
1803
1804 : Now test for existence of everything in MANIFEST
1805 echo " "
1806 if test -f "$rsrc/MANIFEST"; then
1807         echo "First let's make sure your kit is complete.  Checking..." >&4
1808         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1809         rm -f missing
1810         tmppwd=`pwd`
1811         for filelist in x??; do
1812                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1813         done
1814         if test -s missing; then
1815                 cat missing >&4
1816                 cat >&4 <<'EOM'
1817
1818 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1819
1820 You have the option of continuing the configuration process, despite the
1821 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1822 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1823 and contact the author (perlbug@perl.org).
1824
1825 EOM
1826                 echo $n "Continue? [n] $c" >&4
1827                 read ans
1828                 case "$ans" in
1829                 y*)
1830                         echo "Continuing..." >&4
1831                         rm -f missing
1832                         ;;
1833                 *)
1834                         echo "ABORTING..." >&4
1835                         kill $$
1836                         ;;
1837                 esac
1838         else
1839                 echo "Looks good..."
1840         fi
1841 else
1842         echo "There is no MANIFEST file.  I hope your kit is complete !"
1843 fi
1844 rm -f missing x??
1845
1846 echo " "
1847 : Find the appropriate value for a newline for tr
1848 if test -n "$DJGPP"; then
1849        trnl='\012'
1850 fi
1851 if test X"$trnl" = X; then
1852         case "`echo foo|tr '\n' x 2>/dev/null`" in
1853         foox) trnl='\n' ;;
1854         esac
1855 fi
1856 if test X"$trnl" = X; then
1857         case "`echo foo|tr '\012' x 2>/dev/null`" in
1858         foox) trnl='\012' ;;
1859         esac
1860 fi
1861 if test X"$trnl" = X; then
1862        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1863        fooxy) trnl='\n\r' ;;
1864        esac
1865 fi
1866 if test X"$trnl" = X; then
1867         cat <<EOM >&2
1868
1869 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1870
1871 EOM
1872         exit 1
1873 fi
1874
1875 : compute the number of columns on the terminal for proper question formatting
1876 case "$COLUMNS" in
1877 '') COLUMNS='80';;
1878 esac
1879
1880 : set up the echo used in my read
1881 myecho="case \"\$xxxm\" in
1882 '') echo $n \"\$rp $c\" >&4;;
1883 *) case \"\$rp\" in
1884         '') echo $n \"[\$xxxm] $c\";;
1885         *)
1886                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1887                         echo \"\$rp\" >&4
1888                         echo $n \"[\$xxxm] $c\" >&4
1889                 else
1890                         echo $n \"\$rp [\$xxxm] $c\" >&4
1891                 fi
1892                 ;;
1893         esac;;
1894 esac"
1895
1896 : now set up to do reads with possible shell escape and default assignment
1897 cat <<EOSC >myread
1898 $startsh
1899 xxxm=\$dflt
1900 $myecho
1901 ans='!'
1902 case "\$fastread" in
1903 yes) case "\$dflt" in
1904         '') ;;
1905         *) ans='';
1906                 case "\$silent-\$rp" in
1907                 true-) ;;
1908                 *) echo " " >&4;;
1909                 esac;;
1910         esac;;
1911 *) case "\$silent" in
1912         true) case "\$rp" in
1913                 '') ans='';;
1914                 esac;;
1915         esac;;
1916 esac
1917 while expr "X\$ans" : "X!" >/dev/null; do
1918         read answ
1919         set x \$xxxm
1920         shift
1921         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1922         case  "\$answ" in
1923         "!")
1924                 sh 1>&4
1925                 echo " "
1926                 $myecho
1927                 ;;
1928         !*)
1929                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1930                 shift
1931                 sh 1>&4 -c "\$*"
1932                 echo " "
1933                 $myecho
1934                 ;;
1935         "\$ans")
1936                 case "\$ans" in
1937                 \\&*)
1938                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1939                         shift
1940                         case "\$1" in
1941                         -d)
1942                                 fastread=yes
1943                                 echo "(OK, I'll run with -d after this question.)" >&4
1944                                 ;;
1945                         -*)
1946                                 echo "*** Sorry, \$1 not supported yet." >&4
1947                                 ;;
1948                         esac
1949                         $myecho
1950                         ans=!
1951                         ;;
1952                 esac;;
1953         *)
1954                 case "\$aok" in
1955                 y)
1956                         echo "*** Substitution done -- please confirm."
1957                         xxxm="\$ans"
1958                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1959                         xxxm="\$ans"
1960                         ans=!
1961                         ;;
1962                 *)
1963                         echo "*** Error -- try again."
1964                         ans=!
1965                         ;;
1966                 esac
1967                 $myecho
1968                 ;;
1969         esac
1970         case "\$ans\$xxxm\$nostick" in
1971         '')
1972                 ans=!
1973                 $myecho
1974                 ;;
1975         esac
1976 done
1977 case "\$ans" in
1978 '') ans="\$xxxm";;
1979 esac
1980 EOSC
1981
1982 : create .config dir to save info across Configure sessions
1983 test -d ../.config || mkdir ../.config
1984 cat >../.config/README <<EOF
1985 This directory created by Configure to save information that should
1986 persist across sessions for $package.
1987
1988 You may safely delete it if you wish.
1989 EOF
1990
1991 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1992 case "$usedevel" in
1993 $define|true|[yY]*) ;;
1994 *) case "$xversion" in
1995    *[13579])
1996         cat >&4 <<EOH
1997 *** WHOA THERE!!! ***
1998
1999     This is an UNSTABLE DEVELOPMENT release.
2000     The version of this $package distribution is $xversion, that is, odd,
2001     (as opposed to even) and that signifies a development release.
2002     If you want a maintenance release, you want an even-numbered version.
2003
2004     Do ***NOT*** install this into production use.
2005     Data corruption and crashes are possible.
2006
2007     It is most seriously suggested that you do not continue any further
2008     unless you want to help in developing and debugging Perl.
2009
2010     If you *still* want to build perl, you can answer 'y' now,
2011     or pass -Dusedevel to Configure.
2012
2013 EOH
2014         rp='Do you really want to continue?'
2015         dflt='n'
2016         . ./myread
2017         case "$ans" in
2018         [yY]) echo >&4 "Okay, continuing."
2019               usedevel="$define" ;;
2020         *) echo >&4 "Okay, bye."
2021            exit 1
2022            ;;
2023         esac
2024         ;;
2025     esac
2026     ;;
2027 esac
2028 case "$usedevel" in
2029 $define|true|[yY]*)
2030         case "$versiononly" in
2031         '') versiononly="$define" ;;
2032         esac
2033         case "$installusrbinperl" in
2034         '') installusrbinperl="$undef" ;;
2035         esac
2036         ;;
2037 esac
2038
2039 : general instructions
2040 needman=true
2041 firsttime=true
2042 user=`(logname) 2>/dev/null`
2043 case "$user" in
2044 '') user=`whoami 2>&1`;;
2045 esac
2046 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2047         firsttime=false
2048         echo " "
2049         rp='Would you like to see the instructions?'
2050         dflt=n
2051         . ./myread
2052         case "$ans" in
2053         [yY]*) ;;
2054         *) needman=false;;
2055         esac
2056 fi
2057 if $needman; then
2058         cat <<EOH
2059
2060 This installation shell script will examine your system and ask you questions
2061 to determine how the perl5 package should be installed. If you get
2062 stuck on a question, you may use a ! shell escape to start a subshell or
2063 execute a command.  Many of the questions will have default answers in square
2064 brackets; typing carriage return will give you the default.
2065
2066 On some of the questions which ask for file or directory names you are allowed
2067 to use the ~name construct to specify the login directory belonging to "name",
2068 even if you don't have a shell which knows about that.  Questions where this is
2069 allowed will be marked "(~name ok)".
2070
2071 EOH
2072         rp=''
2073         dflt='Type carriage return to continue'
2074         . ./myread
2075         cat <<'EOH'
2076
2077 The prompter used in this script allows you to use shell variables and
2078 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2079 in the default answer, as if the default line was a set of arguments given to a
2080 script shell.  This means you may also use $* to repeat the whole default line,
2081 so you do not have to re-type everything to add something to the default.
2082
2083 Everytime there is a substitution, you will have to confirm.  If there is an
2084 error (e.g. an unmatched backtick), the default answer will remain unchanged
2085 and you will be prompted again.
2086
2087 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2088 the questions and use the computed defaults (or the previous answers if there
2089 was already a config.sh file). Type 'Configure -h' for a list of options.
2090 You may also start interactively and then answer '& -d' at any prompt to turn
2091 on the non-interactive behaviour for the remainder of the execution.
2092
2093 EOH
2094         . ./myread
2095         cat <<EOH
2096
2097 Much effort has been expended to ensure that this shell script will run on any
2098 Unix system.  If despite that it blows up on yours, your best bet is to edit
2099 Configure and run it again.  If you can't run Configure for some reason,
2100 you'll have to generate a config.sh file by hand.  Whatever problems you
2101 have, let me (perlbug@perl.org) know how I blew it.
2102
2103 This installation script affects things in two ways:
2104
2105 1) it may do direct variable substitutions on some of the files included
2106    in this kit.
2107 2) it builds a config.h file for inclusion in C programs.  You may edit
2108    any of these files as the need arises after running this script.
2109
2110 If you make a mistake on a question, there is no easy way to back up to it
2111 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2112 files.  Configure will offer to let you do this before it runs the SH files.
2113
2114 EOH
2115         dflt='Type carriage return to continue'
2116         . ./myread
2117         case "$firsttime" in
2118         true) echo $user >>../.config/instruct;;
2119         esac
2120 fi
2121
2122 : find out where common programs are
2123 echo " "
2124 echo "Locating common programs..." >&4
2125 cat <<EOSC >loc
2126 $startsh
2127 case \$# in
2128 0) exit 1;;
2129 esac
2130 thing=\$1
2131 shift
2132 dflt=\$1
2133 shift
2134 for dir in \$*; do
2135         case "\$thing" in
2136         .)
2137         if test -d \$dir/\$thing; then
2138                 echo \$dir
2139                 exit 0
2140         fi
2141         ;;
2142         *)
2143         for thisthing in \$dir/\$thing; do
2144                 : just loop through to pick last item
2145         done
2146         if test -f \$thisthing; then
2147                 echo \$thisthing
2148                 exit 0
2149         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2150                 echo \$thisthing
2151                 exit 0
2152         elif test -f \$dir/\$thing.exe; then
2153                 if test -n "$DJGPP"; then
2154                         echo \$dir/\$thing.exe
2155                 else
2156                         : on Eunice apparently
2157                         echo \$dir/\$thing
2158                 fi
2159                 exit 0
2160         fi
2161         ;;
2162         esac
2163 done
2164 echo \$dflt
2165 exit 1
2166 EOSC
2167 chmod +x loc
2168 $eunicefix loc
2169 loclist="
2170 awk
2171 cat
2172 chmod
2173 comm
2174 cp
2175 echo
2176 expr
2177 grep
2178 ls
2179 mkdir
2180 rm
2181 sed
2182 sort
2183 touch
2184 tr
2185 uniq
2186 "
2187 trylist="
2188 Mcc
2189 ar
2190 bison
2191 byacc
2192 cpp
2193 csh
2194 date
2195 egrep
2196 gmake
2197 gzip
2198 less
2199 ln
2200 make
2201 more
2202 nm
2203 nroff
2204 pg
2205 test
2206 uname
2207 zip
2208 "
2209 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2210 pth="$pth /lib /usr/lib"
2211 for file in $loclist; do
2212         eval xxx=\$$file
2213         case "$xxx" in
2214         /*|?:[\\/]*)
2215                 if test -f "$xxx"; then
2216                         : ok
2217                 else
2218                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2219                         xxx=`./loc $file $file $pth`
2220                 fi
2221                 ;;
2222         '') xxx=`./loc $file $file $pth`;;
2223         *) xxx=`./loc $xxx $xxx $pth`;;
2224         esac
2225         eval $file=$xxx$_exe
2226         eval _$file=$xxx
2227         case "$xxx" in
2228         /*)
2229                 echo $file is in $xxx.
2230                 ;;
2231         ?:[\\/]*)
2232                 echo $file is in $xxx.
2233                 ;;
2234         *)
2235                 echo "I don't know where '$file' is, and my life depends on it." >&4
2236                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2237                 exit 1
2238                 ;;
2239         esac
2240 done
2241 echo " "
2242 echo "Don't worry if any of the following aren't found..."
2243 say=offhand
2244 for file in $trylist; do
2245         eval xxx=\$$file
2246         case "$xxx" in
2247         /*|?:[\\/]*)
2248                 if test -f "$xxx"; then
2249                         : ok
2250                 else
2251                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2252                         xxx=`./loc $file $file $pth`
2253                 fi
2254                 ;;
2255         '') xxx=`./loc $file $file $pth`;;
2256         *) xxx=`./loc $xxx $xxx $pth`;;
2257         esac
2258         eval $file=$xxx$_exe
2259         eval _$file=$xxx
2260         case "$xxx" in
2261         /*)
2262                 echo $file is in $xxx.
2263                 ;;
2264         ?:[\\/]*)
2265                 echo $file is in $xxx.
2266                 ;;
2267         *)
2268                 echo "I don't see $file out there, $say."
2269                 say=either
2270                 ;;
2271         esac
2272 done
2273 case "$egrep" in
2274 egrep)
2275         echo "Substituting grep for egrep."
2276         egrep=$grep
2277         _egrep=$grep
2278         ;;
2279 esac
2280 case "$ln" in
2281 ln)
2282         echo "Substituting cp for ln."
2283         ln=$cp
2284         _ln=$cp
2285         ;;
2286 esac
2287 case "$make" in
2288 make)   
2289         case "$gmake" in
2290         gmake)
2291         echo "I can't find make or gmake, and my life depends on it." >&4
2292         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2293         exit 1
2294         ;;
2295         esac
2296         ;;
2297 esac    
2298 case "$gmake" in
2299 gmake)  ;;
2300 *)      # We can't have osname yet.
2301         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2302                 # Assume that gmake, if found, is definitely GNU make
2303                 # and prefer it over the system make.
2304                 echo "Substituting gmake for make."
2305                 make=$gmake
2306                 _make=$gmake
2307         fi
2308         ;;
2309 esac
2310 case "$test" in
2311 test)
2312         echo "Hopefully test is built into your sh."
2313         ;;
2314 *)
2315         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2316                 echo "Using the test built into your sh."
2317                 test=test
2318                 _test=test
2319         fi
2320         ;;
2321 esac
2322 case "$echo" in
2323 echo)
2324         echo "Hopefully echo is built into your sh."
2325         ;;
2326 '') ;;
2327 *)
2328         echo " "
2329 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2330         $echo $n "hi there$c" >foo1
2331         echo $n "hi there$c" >foo2
2332         if cmp foo1 foo2 >/dev/null 2>&1; then
2333                 echo "They are compatible.  In fact, they may be identical."
2334         else
2335                 case "$n" in
2336                 '-n') n='' c='\c';;
2337                 *) n='-n' c='';;
2338                 esac
2339                 cat <<FOO
2340 They are not compatible!  You are probably running ksh on a non-USG system.
2341 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2342 have echo built in and we may have to run some Bourne shell scripts.  That
2343 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2344
2345 FOO
2346                 $echo $n "The star should be here-->$c"
2347                 $echo "*"
2348         fi
2349         $rm -f foo1 foo2
2350         ;;
2351 esac
2352
2353 cat <<EOS >trygcc
2354 $startsh
2355 EOS
2356 cat <<'EOSC' >>trygcc
2357 case "$cc" in
2358 '') ;;
2359 *)  $rm -f try try.*
2360     $cat >try.c <<EOM
2361 int main(int argc, char *argv[]) {
2362   return 0;
2363 }
2364 EOM
2365     if $cc -o try $ccflags $ldflags try.c; then
2366        :
2367     else
2368         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2369         despair=yes
2370         trygcc=yes
2371         case "$cc" in
2372         *gcc*) trygcc=no ;;
2373         esac
2374         case "`$cc -v -c try.c 2>&1`" in
2375         *gcc*) trygcc=no ;;
2376         esac
2377         if $test X"$trygcc" = Xyes; then
2378             if gcc -o try -c try.c; then
2379                 echo " "
2380                 echo "You seem to have a working gcc, though." >&4
2381                 rp="Would you like to use it?"
2382                 dflt=y
2383                 if $test -f myread; then
2384                     . ./myread
2385                 else
2386                     if $test -f UU/myread; then
2387                         . ./UU/myread
2388                     else
2389                         echo "Cannot find myread, sorry.  Aborting." >&2
2390                         exit 1
2391                     fi
2392                 fi  
2393                 case "$ans" in
2394                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2395                        if $test -f usethreads.cbu; then
2396                            $cat >&4 <<EOM 
2397
2398 *** However, any setting of the C compiler flags (e.g. for thread support)
2399 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2400 *** (together with e.g. -Dusethreads).
2401
2402 EOM
2403                        fi;;
2404                 esac
2405             fi
2406         fi
2407     fi
2408     $rm -f try try.*
2409     ;;
2410 esac
2411 EOSC
2412
2413 cat <<EOS >checkcc
2414 $startsh
2415 EOS
2416 cat <<'EOSC' >>checkcc
2417 case "$cc" in        
2418 '') ;;
2419 *)  $rm -f try try.*              
2420     $cat >try.c <<EOM
2421 int main(int argc, char *argv[]) {
2422   return 0;
2423 }
2424 EOM
2425     if $cc -o try $ccflags $ldflags try.c; then
2426        :
2427     else
2428         if $test X"$despair" = Xyes; then
2429            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2430         fi
2431         $cat >&4 <<EOM         
2432 You need to find a working C compiler.
2433 Either (purchase and) install the C compiler supplied by your OS vendor,
2434 or for a free C compiler try http://gcc.gnu.org/
2435 I cannot continue any further, aborting.
2436 EOM
2437         exit 1
2438     fi
2439     $rm -f try try.*
2440     ;;
2441 esac
2442 EOSC
2443
2444 : determine whether symbolic links are supported
2445 echo " "
2446 $touch blurfl
2447 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2448         echo "Symbolic links are supported." >&4
2449         lns="$ln -s"
2450 else
2451         echo "Symbolic links are NOT supported." >&4
2452         lns="$ln"
2453 fi
2454 $rm -f blurfl sym
2455
2456 : determine whether symbolic links are supported
2457 echo " "
2458 case "$lns" in
2459 *"ln"*" -s")
2460         echo "Checking how to test for symbolic links..." >&4
2461         $lns blurfl sym
2462         if $test "X$issymlink" = X; then
2463                 case "$newsh" in
2464                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2465                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2466                 esac
2467                 if test $? = 0; then
2468                         issymlink="test -h"
2469                 else
2470                         echo "Your builtin 'test -h' may be broken." >&4
2471                         case "$test" in
2472                         /*)     ;;
2473                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2474                                 for p in $pth
2475                                 do
2476                                         if test -f "$p/$test"; then
2477                                                 test="$p/$test"
2478                                                 break
2479                                         fi
2480                                 done
2481                                 ;;
2482                         esac
2483                         case "$test" in
2484                         /*)
2485                                 echo "Trying external '$test -h'." >&4
2486                                 issymlink="$test -h"
2487                                 if $test ! -h sym >/dev/null 2>&1; then
2488                                         echo "External '$test -h' is broken, too." >&4
2489                                         issymlink=''
2490                                 fi
2491                                 ;;
2492                         *)      issymlink='' ;;
2493                         esac
2494                 fi              
2495         fi
2496         if $test "X$issymlink" = X; then
2497                 if $test -L sym 2>/dev/null; then
2498                         issymlink="$test -L"
2499                         echo "The builtin '$test -L' worked." >&4
2500                 fi
2501         fi
2502         if $test "X$issymlink" != X; then
2503                 echo "You can test for symbolic links with '$issymlink'." >&4
2504         else
2505                 echo "I do not know how you can test for symbolic links." >&4
2506         fi
2507         $rm -f blurfl sym
2508         ;;
2509 *)      echo "No symbolic links, so not testing for their testing..." >&4
2510         ;;
2511 esac
2512 echo " "
2513
2514
2515 case "$mksymlinks" in
2516 $define|true|[yY]*)
2517         case "$src" in
2518         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2519                 exit 1
2520                 ;;
2521         *)      case "$lns:$issymlink" in
2522                 *"ln"*" -s:"*"test -"?)
2523                         echo "Creating the symbolic links..." >&4
2524                         echo "(First creating the subdirectories...)" >&4
2525                         cd ..
2526                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2527                                 read directory
2528                                 test -z "$directory" && break
2529                                 mkdir -p $directory
2530                         done
2531                         # Sanity check 1.
2532                         if test ! -d t/base; then
2533                                 echo "Failed to create the subdirectories.  Aborting." >&4
2534                                 exit 1
2535                         fi
2536                         echo "(Then creating the symlinks...)" >&4
2537                         awk '{print $1}' $src/MANIFEST | while true; do
2538                                 read filename
2539                                 test -z "$filename" && break
2540                                 if test -f $filename; then
2541                                         if $issymlink $filename; then
2542                                                 rm -f $filename
2543                                         fi
2544                                 fi
2545                                 if test -f $filename; then
2546                                         echo "$filename already exists, not symlinking."
2547                                 else
2548                                         ln -s $src/$filename $filename
2549                                 fi
2550                         done
2551                         # Sanity check 2.
2552                         if test ! -f t/base/lex.t; then
2553                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2554                                 exit 1
2555                         fi
2556                         cd UU
2557                         ;;
2558                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2559                         ;;
2560                 esac
2561                 ;;
2562         esac
2563         ;;
2564 esac
2565
2566
2567 case "$usecrosscompile" in
2568 $define|true|[yY]*)
2569         $echo "Cross-compiling..."
2570         croak=''
2571         case "$cc" in
2572         *-*-gcc) # A cross-compiling gcc, probably.
2573             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2574             ar=$targetarch-ar
2575             # leave out ld, choosing it is more complex
2576             nm=$targetarch-nm
2577             ranlib=$targetarch-ranlib
2578             $echo 'extern int foo;' > try.c
2579             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2580             shift
2581             if $test $# -gt 0; then
2582                 incpth="$incpth $*"
2583                 incpth="`$echo $incpth|$sed 's/^ //'`"
2584                 echo "Guessing incpth '$incpth'." >&4
2585                 for i in $*; do
2586                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2587                     if $test -d $j; then
2588                         libpth="$libpth $j"
2589                     fi
2590                 done   
2591                 libpth="`$echo $libpth|$sed 's/^ //'`"
2592                 echo "Guessing libpth '$libpth'." >&4
2593             fi
2594             $rm -f try.c
2595             ;;
2596         esac
2597         case "$targetarch" in
2598         '') echo "Targetarch not defined." >&4; croak=y ;;
2599         *)  echo "Using targetarch $targetarch." >&4 ;;
2600         esac
2601         case "$incpth" in
2602         '') echo "Incpth not defined." >&4; croak=y ;;
2603         *)  echo "Using incpth '$incpth'." >&4 ;;
2604         esac
2605         case "$libpth" in
2606         '') echo "Libpth not defined." >&4; croak=y ;;
2607         *)  echo "Using libpth '$libpth'." >&4 ;;
2608         esac
2609         case "$usrinc" in
2610         '') for i in $incpth; do
2611                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2612                     usrinc=$i
2613                     echo "Guessing usrinc $usrinc." >&4
2614                     break
2615                 fi
2616             done
2617             case "$usrinc" in
2618             '') echo "Usrinc not defined." >&4; croak=y ;;
2619             esac
2620             ;;
2621         *)  echo "Using usrinc $usrinc." >&4 ;;
2622         esac
2623         case "$targethost" in
2624         '') echo "Targethost not defined." >&4; croak=y ;;
2625         *)  echo "Using targethost $targethost." >&4
2626         esac
2627         locincpth=' '
2628         loclibpth=' '
2629         case "$croak" in
2630         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2631         esac
2632         case "$src" in
2633         /*) run=$src/Cross/run
2634             targetmkdir=$src/Cross/mkdir
2635             to=$src/Cross/to
2636             from=$src/Cross/from
2637             ;;
2638         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2639             run=$pwd/Cross/run
2640             targetmkdir=$pwd/Cross/mkdir
2641             to=$pwd/Cross/to
2642             from=$pwd/Cross/from
2643             ;;
2644         esac
2645         case "$targetrun" in
2646         '') targetrun=ssh ;;
2647         esac
2648         case "$targetto" in
2649         '') targetto=scp ;;
2650         esac
2651         case "$targetfrom" in
2652         '') targetfrom=scp ;;
2653         esac
2654         run=$run-$targetrun
2655         to=$to-$targetto
2656         from=$from-$targetfrom
2657         case "$targetdir" in
2658         '')  targetdir=/tmp
2659              echo "Guessing targetdir $targetdir." >&4
2660              ;;
2661         esac
2662         case "$targetuser" in
2663         '')  targetuser=root
2664              echo "Guessing targetuser $targetuser." >&4
2665              ;;
2666         esac
2667         case "$targetfrom" in
2668         scp)    q=-q ;;
2669         *)      q='' ;;
2670         esac
2671         case "$targetrun" in
2672         ssh|rsh)
2673             cat >$run <<EOF
2674 #!/bin/sh
2675 case "\$1" in
2676 -cwd)
2677   shift
2678   cwd=\$1
2679   shift
2680   ;;
2681 esac
2682 case "\$cwd" in
2683 '') cwd=$targetdir ;;
2684 esac
2685 exe=\$1
2686 shift
2687 if $test ! -f \$exe.xok; then
2688   $to \$exe
2689   $touch \$exe.xok
2690 fi
2691 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2692 EOF
2693             ;;
2694         *)  echo "Unknown targetrun '$targetrun'" >&4
2695             exit 1
2696             ;;
2697         esac
2698         case "$targetmkdir" in
2699         */Cross/mkdir)
2700             cat >$targetmkdir <<EOF
2701 #!/bin/sh
2702 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2703 EOF
2704             $chmod a+rx $targetmkdir
2705             ;;
2706         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2707             exit 1
2708             ;;
2709         esac
2710         case "$targetto" in
2711         scp|rcp)
2712             cat >$to <<EOF
2713 #!/bin/sh
2714 for f in \$@
2715 do
2716   case "\$f" in
2717   /*)
2718     $targetmkdir \`dirname \$f\`
2719     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2720     ;;
2721   *)
2722     $targetmkdir $targetdir/\`dirname \$f\`
2723     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2724     ;;
2725   esac
2726 done
2727 exit 0
2728 EOF
2729             ;;
2730         cp) cat >$to <<EOF
2731 #!/bin/sh
2732 for f in \$@
2733 do
2734   case "\$f" in
2735   /*)
2736     $mkdir -p $targetdir/\`dirname \$f\`
2737     $cp \$f $targetdir/\$f || exit 1
2738     ;;
2739   *)
2740     $targetmkdir $targetdir/\`dirname \$f\`
2741     $cp \$f $targetdir/\$f || exit 1
2742     ;;
2743   esac
2744 done
2745 exit 0
2746 EOF
2747             ;;
2748         *)  echo "Unknown targetto '$targetto'" >&4
2749             exit 1
2750             ;;
2751         esac
2752         case "$targetfrom" in
2753         scp|rcp)
2754           cat >$from <<EOF
2755 #!/bin/sh
2756 for f in \$@
2757 do
2758   $rm -f \$f
2759   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2760 done
2761 exit 0
2762 EOF
2763             ;;
2764         cp) cat >$from <<EOF
2765 #!/bin/sh
2766 for f in \$@
2767 do
2768   $rm -f \$f
2769   cp $targetdir/\$f . || exit 1
2770 done
2771 exit 0
2772 EOF
2773             ;;
2774         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2775             exit 1
2776             ;;
2777         esac
2778         if $test ! -f $run; then
2779             echo "Target 'run' script '$run' not found." >&4
2780         else
2781             $chmod a+rx $run
2782         fi
2783         if $test ! -f $to; then
2784             echo "Target 'to' script '$to' not found." >&4
2785         else
2786             $chmod a+rx $to
2787         fi
2788         if $test ! -f $from; then
2789             echo "Target 'from' script '$from' not found." >&4
2790         else
2791             $chmod a+rx $from
2792         fi
2793         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2794             exit 1
2795         fi
2796         cat >&4 <<EOF
2797 Using '$run' for remote execution,
2798 and '$from' and '$to'
2799 for remote file transfer.
2800 EOF
2801         ;;
2802 *)      run=''
2803         to=:
2804         from=:
2805         usecrosscompile='undef'
2806         targetarch=''
2807         ;;
2808 esac
2809
2810 : see whether [:lower:] and [:upper:] are supported character classes
2811 echo " "
2812 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2813 ABYZ)
2814         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2815         up='[:upper:]'
2816         low='[:lower:]'
2817         ;;
2818 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2819         # (0xc9 and 0xd1), therefore that is a nice testing point.
2820         if test "X$up" = X -o "X$low" = X; then
2821             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2822             ij) up='[A-Z]'
2823                 low='[a-z]'
2824                 ;;
2825             esac
2826         fi
2827         if test "X$up" = X -o "X$low" = X; then
2828             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2829             ij) up='A-Z'
2830                 low='a-z'
2831                 ;;
2832             esac
2833         fi
2834         if test "X$up" = X -o "X$low" = X; then
2835             case "`echo IJ | od -x 2>/dev/null`" in
2836             *C9D1*|*c9d1*)
2837                 echo "Hey, this might be EBCDIC." >&4
2838                 if test "X$up" = X -o "X$low" = X; then
2839                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2840                     ij) up='[A-IJ-RS-Z]'
2841                         low='[a-ij-rs-z]'
2842                         ;;
2843                     esac
2844                 fi
2845                 if test "X$up" = X -o "X$low" = X; then
2846                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2847                     ij) up='A-IJ-RS-Z'
2848                         low='a-ij-rs-z'
2849                         ;;
2850                     esac
2851                 fi
2852                 ;;
2853             esac
2854         fi
2855 esac
2856 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2857 ij)
2858     echo "Using $up and $low to convert case." >&4
2859     ;;
2860 *)
2861     echo "I don't know how to translate letters from upper to lower case." >&4
2862     echo "Your tr is not acting any way I know of." >&4
2863     exit 1
2864     ;;
2865 esac
2866 : set up the translation script tr, must be called with ./tr of course
2867 cat >tr <<EOSC
2868 $startsh
2869 case "\$1\$2" in
2870 '[A-Z][a-z]') exec $tr '$up' '$low';;
2871 '[a-z][A-Z]') exec $tr '$low' '$up';;
2872 esac
2873 exec $tr "\$@"
2874 EOSC
2875 chmod +x tr
2876 $eunicefix tr
2877
2878 : Try to determine whether config.sh was made on this system
2879 case "$config_sh" in
2880 '')
2881 myuname=`$uname -a 2>/dev/null`
2882 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2883 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2884 # because the A-Z/a-z are not consecutive.
2885 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2886         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2887 newmyuname="$myuname"
2888 dflt=n
2889 case "$knowitall" in
2890 '')
2891         if test -f ../config.sh; then
2892                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2893                         eval "`grep myuname= ../config.sh`"
2894                 fi
2895                 if test "X$myuname" = "X$newmyuname"; then
2896                         dflt=y
2897                 fi
2898         fi
2899         ;;
2900 *) dflt=y;;
2901 esac
2902
2903 : Get old answers from old config file if Configure was run on the
2904 : same system, otherwise use the hints.
2905 hint=default
2906 cd ..
2907 if test -f config.sh; then
2908         echo " "
2909         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2910         . UU/myread
2911         case "$ans" in
2912         n*|N*) echo "OK, I'll ignore it."
2913                 mv config.sh config.sh.old
2914                 myuname="$newmyuname"
2915                 ;;
2916         *)  echo "Fetching default answers from your old config.sh file..." >&4
2917                 tmp_n="$n"
2918                 tmp_c="$c"
2919                 tmp_sh="$sh"
2920                 . ./config.sh
2921                 cp config.sh UU
2922                 n="$tmp_n"
2923                 c="$tmp_c"
2924                 : Older versions did not always set $sh.  Catch re-use of such
2925                 : an old config.sh.
2926                 case "$sh" in
2927                 '') sh="$tmp_sh" ;;
2928                 esac
2929                 hint=previous
2930                 ;;
2931         esac
2932 fi
2933 . ./UU/checkcc
2934 if test ! -f config.sh; then
2935         $cat <<EOM
2936
2937 First time through, eh?  I have some defaults handy for some systems
2938 that need some extra help getting the Configure answers right:
2939
2940 EOM
2941         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2942         dflt=''
2943         : Half the following guesses are probably wrong... If you have better
2944         : tests or hints, please send them to perlbug@perl.org
2945         : The metaconfig authors would also appreciate a copy...
2946         $test -f /irix && osname=irix
2947         $test -f /xenix && osname=sco_xenix
2948         $test -f /dynix && osname=dynix
2949         $test -f /dnix && osname=dnix
2950         $test -f /lynx.os && osname=lynxos
2951         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2952         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2953         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2954         $test -f /bin/mips && /bin/mips && osname=mips
2955         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2956                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2957         $test -d /usr/apollo/bin && osname=apollo
2958         $test -f /etc/saf/_sactab && osname=svr4
2959         $test -d /usr/include/minix && osname=minix
2960         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2961         if $test -d /MachTen -o -d /MachTen_Folder; then
2962                 osname=machten
2963                 if $test -x /sbin/version; then
2964                         osvers=`/sbin/version | $awk '{print $2}' |
2965                         $sed -e 's/[A-Za-z]$//'`
2966                 elif $test -x /usr/etc/version; then
2967                         osvers=`/usr/etc/version | $awk '{print $2}' |
2968                         $sed -e 's/[A-Za-z]$//'`
2969                 else
2970                         osvers="$2.$3"
2971                 fi
2972         fi
2973
2974         $test -f /sys/posix.dll &&
2975                 $test -f /usr/bin/what &&
2976                 set X `/usr/bin/what /sys/posix.dll` &&
2977                 $test "$3" = UWIN &&
2978                 osname=uwin &&
2979                 osvers="$5"
2980
2981         if $test -f $uname; then
2982                 set X $myuname
2983                 shift
2984
2985                 case "$5" in
2986                 fps*) osname=fps ;;
2987                 mips*)
2988                         case "$4" in
2989                         umips) osname=umips ;;
2990                         *) osname=mips ;;
2991                         esac;;
2992                 [23]100) osname=mips ;;
2993                 next*) osname=next ;;
2994                 i386*)
2995                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2996                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2997                                 osname='sco'
2998                                 osvers=$tmp
2999                         elif $test -f /etc/kconfig; then
3000                                 osname=isc
3001                                 if test "$lns" = "$ln -s"; then
3002                                         osvers=4
3003                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3004                                         osvers=3
3005                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3006                                         osvers=2
3007                                 fi
3008                         fi
3009                         tmp=''
3010                         ;;
3011                 pc*)
3012                         if test -n "$DJGPP"; then
3013                                 osname=dos
3014                                 osvers=djgpp
3015                         fi
3016                         ;;
3017                 esac
3018
3019                 case "$1" in
3020                 aix) osname=aix
3021                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3022                         case "$tmp" in
3023                         'not found') osvers="$4"."$3" ;;
3024                         '<3240'|'<>3240') osvers=3.2.0 ;;
3025                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3026                         '=3250'|'>3250') osvers=3.2.5 ;;
3027                         *) osvers=$tmp;;
3028                         esac
3029                         ;;
3030                 bsd386) osname=bsd386
3031                         osvers=`$uname -r`
3032                         ;;
3033                 cygwin*) osname=cygwin
3034                         osvers="$3"
3035                         ;;
3036                 *dc.osx) osname=dcosx
3037                         osvers="$3"
3038                         ;;
3039                 dnix) osname=dnix
3040                         osvers="$3"
3041                         ;;
3042                 domainos) osname=apollo
3043                         osvers="$3"
3044                         ;;
3045                 dgux) osname=dgux 
3046                         osvers="$3"
3047                         ;;
3048                 dynixptx*) osname=dynixptx
3049                         osvers=`echo "$4"|sed 's/^v//'`
3050                         ;;
3051                 freebsd) osname=freebsd 
3052                         osvers="$3" ;;
3053                 genix) osname=genix ;;
3054                 hp*) osname=hpux 
3055                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3056                         ;;
3057                 irix*) osname=irix
3058                         case "$3" in
3059                         4*) osvers=4 ;;
3060                         5*) osvers=5 ;;
3061                         *)      osvers="$3" ;;
3062                         esac
3063                         ;;
3064                 linux) osname=linux
3065                         case "$3" in
3066                         *)      osvers="$3" ;;
3067                         esac
3068                         ;;
3069                 MiNT) osname=mint
3070                         ;;
3071                 netbsd*) osname=netbsd
3072                         osvers="$3"
3073                         ;;
3074                 news-os) osvers="$3"
3075                         case "$3" in
3076                         4*) osname=newsos4 ;;
3077                         *) osname=newsos ;;
3078                         esac
3079                         ;;
3080                 next*) osname=next ;;
3081                 nonstop-ux) osname=nonstopux ;;
3082                 openbsd) osname=openbsd
3083                         osvers="$3"
3084                         ;;
3085                 POSIX-BC | posix-bc ) osname=posix-bc
3086                         osvers="$3"
3087                         ;;
3088                 powerux | power_ux | powermax_os | powermaxos | \
3089                 powerunix | power_unix) osname=powerux
3090                         osvers="$3"
3091                         ;;
3092                 qnx) osname=qnx
3093                         osvers="$4"
3094                         ;;
3095                 solaris) osname=solaris
3096                         case "$3" in
3097                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3098                         *)      osvers="$3" ;;
3099                         esac
3100                         ;;
3101                 sunos) osname=sunos
3102                         case "$3" in
3103                         5*) osname=solaris
3104                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3105                         *)      osvers="$3" ;;
3106                         esac
3107                         ;;
3108                 titanos) osname=titanos
3109                         case "$3" in
3110                         1*) osvers=1 ;;
3111                         2*) osvers=2 ;;
3112                         3*) osvers=3 ;;
3113                         4*) osvers=4 ;;
3114                         *)      osvers="$3" ;;
3115                         esac
3116                         ;;
3117                 ultrix) osname=ultrix
3118                         osvers="$3"
3119                         ;;
3120                 osf1|mls+)      case "$5" in
3121                                 alpha)
3122                                         osname=dec_osf
3123                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3124                                         case "$osvers" in
3125                                         [1-9].[0-9]*) ;;
3126                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3127                                         esac
3128                                         ;;
3129                         hp*)    osname=hp_osf1  ;;
3130                         mips)   osname=mips_osf1 ;;
3131                         esac
3132                         ;;
3133                 unixware) osname=svr5
3134                         osvers="$4"
3135                         ;;
3136                 uts)    osname=uts
3137                         osvers="$3"
3138                         ;;
3139                 vos) osvers="$3"
3140                         ;;
3141                 $2) case "$osname" in
3142                         *isc*) ;;
3143                         *freebsd*) ;;
3144                         svr*)
3145                                 : svr4.x or possibly later
3146                                 case "svr$3" in 
3147                                 ${osname}*)
3148                                         osname=svr$3
3149                                         osvers=$4
3150                                         ;;
3151                                 esac
3152                                 case "$osname" in
3153                                 svr4.0)
3154                                         : Check for ESIX
3155                                         if test -f /stand/boot ; then
3156                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3157                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3158                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3159                                                         if test -n "$isesix"; then
3160                                                                 osname=esix4
3161                                                         fi
3162                                                 fi
3163                                         fi
3164                                         ;;
3165                                 esac
3166                                 ;;
3167                         *)      if test -f /etc/systemid; then
3168                                         osname=sco
3169                                         set `echo $3 | $sed 's/\./ /g'` $4
3170                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3171                                                 osvers=$1.$2.$3
3172                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3173                                                 osvers=$1.$2
3174                                         elif $test -f $src/hints/sco_$1.sh; then
3175                                                 osvers=$1
3176                                         fi
3177                                 else
3178                                         case "$osname" in
3179                                         '') : Still unknown.  Probably a generic Sys V.
3180                                                 osname="sysv"
3181                                                 osvers="$3"
3182                                                 ;;
3183                                         esac
3184                                 fi
3185                                 ;;
3186                         esac
3187                         ;;
3188                 *)      case "$osname" in
3189                         '') : Still unknown.  Probably a generic BSD.
3190                                 osname="$1"
3191                                 osvers="$3"
3192                                 ;;
3193                         esac
3194                         ;;
3195                 esac
3196         else
3197                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3198                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3199                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3200                                 osname=news_os
3201                         fi
3202                         $rm -f UU/kernel.what
3203                 elif test -d c:/.; then
3204                         set X $myuname
3205                         osname=os2
3206                         osvers="$5"
3207                 fi
3208         fi
3209         
3210         case "$targetarch" in
3211         '') ;;
3212         *)  hostarch=$osname
3213             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3214             osvers=''
3215             ;;
3216         esac
3217
3218         : Now look for a hint file osname_osvers, unless one has been
3219         : specified already.
3220         case "$hintfile" in
3221         ''|' ')
3222                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3223                 : Also try without trailing minor version numbers.
3224                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3225                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3226                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3227                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3228                 case "$file" in
3229                 '') dflt=none ;;
3230                 *)  case "$osvers" in
3231                         '') dflt=$file
3232                                 ;;
3233                         *)  if $test -f $src/hints/$file.sh ; then
3234                                         dflt=$file
3235                                 elif $test -f $src/hints/$xfile.sh ; then
3236                                         dflt=$xfile
3237                                 elif $test -f $src/hints/$xxfile.sh ; then
3238                                         dflt=$xxfile
3239                                 elif $test -f $src/hints/$xxxfile.sh ; then
3240                                         dflt=$xxxfile
3241                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3242                                         dflt=$xxxxfile
3243                                 elif $test -f "$src/hints/${osname}.sh" ; then
3244                                         dflt="${osname}"
3245                                 else
3246                                         dflt=none
3247                                 fi
3248                                 ;;
3249                         esac
3250                         ;;
3251                 esac
3252                 if $test -f Policy.sh ; then
3253                         case "$dflt" in
3254                         *Policy*) ;;
3255                         none) dflt="Policy" ;;
3256                         *) dflt="Policy $dflt" ;;
3257                         esac
3258                 fi
3259                 ;;
3260         *)
3261                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3262                 ;;
3263         esac
3264
3265         if $test -f Policy.sh ; then
3266                 $cat <<EOM
3267
3268 There's also a Policy hint file available, which should make the
3269 site-specific (policy) questions easier to answer.
3270 EOM
3271
3272         fi
3273
3274         $cat <<EOM
3275
3276 You may give one or more space-separated answers, or "none" if appropriate.
3277 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3278 is a good thing.  DO NOT give a wrong version or a wrong OS.
3279
3280 EOM
3281
3282         rp="Which of these apply, if any?"
3283         . UU/myread
3284         tans=$ans
3285         for file in $tans; do
3286                 if $test X$file = XPolicy -a -f Policy.sh; then
3287                         . Policy.sh
3288                         $cat Policy.sh >> UU/config.sh
3289                 elif $test -f $src/hints/$file.sh; then
3290                         . $src/hints/$file.sh
3291                         $cat $src/hints/$file.sh >> UU/config.sh
3292                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3293                         : nothing
3294                 else
3295                         : Give one chance to correct a possible typo.
3296                         echo "$file.sh does not exist"
3297                         dflt=$file
3298                         rp="hint to use instead?"
3299                         . UU/myread
3300                         for file in $ans; do
3301                                 if $test -f "$src/hints/$file.sh"; then
3302                                         . $src/hints/$file.sh
3303                                         $cat $src/hints/$file.sh >> UU/config.sh
3304                                 elif $test X$ans = X -o X$ans = Xnone ; then
3305                                         : nothing
3306                                 else
3307                                         echo "$file.sh does not exist -- ignored."
3308                                 fi
3309                         done
3310                 fi
3311         done
3312
3313         hint=recommended
3314         : Remember our hint file for later.
3315         if $test -f "$src/hints/$file.sh" ; then
3316                 hintfile="$file"
3317         else
3318                 hintfile=''
3319         fi
3320 fi
3321 cd UU
3322 ;;
3323 *)
3324         echo " "
3325         echo "Fetching default answers from $config_sh..." >&4
3326         tmp_n="$n"
3327         tmp_c="$c"
3328         cd ..
3329         cp $config_sh config.sh 2>/dev/null
3330         chmod +w config.sh
3331         . ./config.sh
3332         cd UU
3333         cp ../config.sh .
3334         n="$tmp_n"
3335         c="$tmp_c"
3336         hint=previous
3337         ;;
3338 esac
3339 test "$override" && . ./optdef.sh
3340
3341 : Restore computed paths
3342 for file in $loclist $trylist; do
3343         eval $file="\$_$file"
3344 done
3345
3346 cat << EOM
3347
3348 Configure uses the operating system name and version to set some defaults.
3349 The default value is probably right if the name rings a bell. Otherwise,
3350 since spelling matters for me, either accept the default or answer "none"
3351 to leave it blank.
3352
3353 EOM
3354 case "$osname" in
3355         ''|' ')
3356                 case "$hintfile" in
3357                 ''|' '|none) dflt=none ;;
3358                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3359                 esac
3360                 ;;
3361         *) dflt="$osname" ;;
3362 esac
3363 rp="Operating system name?"
3364 . ./myread
3365 case "$ans" in
3366 none)  osname='' ;;
3367 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3368 esac
3369 echo " "
3370 case "$osvers" in
3371         ''|' ')
3372                 case "$hintfile" in
3373                 ''|' '|none) dflt=none ;;
3374                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3375                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3376                         case "$dflt" in
3377                         ''|' ') dflt=none ;;
3378                         esac
3379                         ;;
3380                 esac
3381                 ;;
3382         *) dflt="$osvers" ;;
3383 esac
3384 rp="Operating system version?"
3385 . ./myread
3386 case "$ans" in
3387 none)  osvers='' ;;
3388 *) osvers="$ans" ;;
3389 esac
3390
3391
3392 . ./posthint.sh
3393
3394 : who configured the system
3395 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3396 cf_by=`(logname) 2>/dev/null`
3397 case "$cf_by" in
3398 "")
3399         cf_by=`(whoami) 2>/dev/null`
3400         case "$cf_by" in
3401         "") cf_by=unknown ;;
3402         esac ;;
3403 esac
3404
3405 : set up the script used to warn in case of inconsistency
3406 cat <<EOS >whoa
3407 $startsh
3408 EOS
3409 cat <<'EOSC' >>whoa
3410 dflt=y
3411 echo " "
3412 echo "*** WHOA THERE!!! ***" >&4
3413 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3414 rp="    Keep the $hint value?"
3415 . ./myread
3416 case "$ans" in
3417 y) td=$was; tu=$was;;
3418 esac
3419 EOSC
3420
3421 : function used to set $1 to $val
3422 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3423 case "$val$was" in
3424 $define$undef) . ./whoa; eval "$var=\$td";;
3425 $undef$define) . ./whoa; eval "$var=\$tu";;
3426 *) eval "$var=$val";;
3427 esac'
3428
3429 case "$usesocks" in
3430 $define|true|[yY]*)     dflt='y';;
3431 *) dflt='n';;
3432 esac
3433 cat <<EOM
3434
3435 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3436 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3437 to use the PerlIO abstraction layer, this will be implicitly selected.
3438
3439 If this doesn't make any sense to you, just accept the default '$dflt'.
3440 EOM
3441 rp='Build Perl for SOCKS?'
3442 . ./myread
3443 case "$ans" in
3444 y|Y)    val="$define" ;;     
3445 *)      val="$undef" ;;
3446 esac
3447 set usesocks
3448 eval $setvar
3449
3450 case "$usesocks" in
3451 $define|true|[yY]*) useperlio="$define";;
3452 esac
3453
3454 case "$useperlio" in
3455 $define|true|[yY]*|'')  dflt='y';;
3456 *) dflt='n';;
3457 esac
3458 cat <<EOM
3459
3460 Previous version of $package used the standard IO mechanisms as
3461 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3462 alternate IO mechanisms via the PerlIO abstraction layer, but the
3463 stdio mechanism is still available if needed.  The abstraction layer
3464 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3465 Using PerlIO with sfio may cause problems with some extension modules.
3466
3467 If this doesn't make any sense to you, just accept the default '$dflt'.
3468 EOM
3469 rp='Use the PerlIO abstraction layer?'
3470 . ./myread
3471 case "$ans" in
3472 y|Y) 
3473         val="$define"
3474         ;;
3475 *)      
3476         echo "Ok, doing things the stdio way."
3477         val="$undef"
3478         ;;
3479 esac
3480 set useperlio
3481 eval $setvar 
3482
3483 case "$usesocks" in
3484 $define|true|[yY]*)
3485         case "$useperlio" in
3486         $define|true|[yY]*) ;;
3487         *)      cat >&4 <<EOM
3488
3489 You are using the SOCKS proxy protocol library which means that you
3490 should also use the PerlIO layer.  You may be headed for trouble.
3491
3492 EOM
3493                 ;;
3494         esac
3495         ;;
3496 esac
3497
3498         
3499 case "$usethreads" in
3500 $define|true|[yY]*)     dflt='y';;
3501 *)     # Catch case where user specified ithreads or 5005threads but
3502        # forgot -Dusethreads (A.D. 4/2002)
3503        case "$useithreads$use5005threads" in
3504        *$define*)      
3505                 case "$useperlio" in
3506                 "$define")      dflt='y' ;;
3507                 *)              dflt='n' ;;
3508                 esac
3509                 ;;
3510        *)       dflt='n';;
3511        esac
3512        ;;
3513 esac
3514 cat <<EOM
3515
3516 Perl can be built to take advantage of threads on some systems.
3517 To do so, Configure can be run with -Dusethreads.
3518
3519 Note that Perl built with threading support runs slightly slower
3520 and uses more memory than plain Perl. The current implementation
3521 is believed to be stable, but it is fairly new, and so should be
3522 treated with caution.
3523
3524 If this doesn't make any sense to you, just accept the default '$dflt'.
3525 EOM
3526 rp='Build a threading Perl?'
3527 . ./myread
3528 case "$ans" in
3529 y|Y)    val="$define" ;;
3530 *)      val="$undef" ;;
3531 esac
3532 set usethreads
3533 eval $setvar
3534
3535 case "$usethreads" in
3536 $define)
3537         $cat <<EOM
3538
3539 Since release 5.6, Perl has had two different threading implementations,
3540 the newer interpreter-based version (ithreads) with one interpreter per
3541 thread, and the older 5.005 version (5005threads).
3542 The 5005threads version is effectively unmaintained and will probably be
3543 removed in Perl 5.10, so there should be no need to build a Perl using it
3544 unless needed for backwards compatibility with some existing 5.005threads
3545 code.
3546
3547 EOM
3548         : Default to ithreads unless overridden on command line or with
3549         : old config.sh
3550         dflt='y'
3551         case "$use5005threads" in
3552                 $define|true|[yY]*) dflt='n';;
3553         esac
3554         case "$useithreads" in
3555                 $undef|false|[nN]*) dflt='n';;
3556         esac
3557         rp='Use the newer interpreter-based ithreads?'
3558         . ./myread
3559         case "$ans" in
3560         y|Y)    val="$define" ;;
3561         *)      val="$undef" ;;
3562         esac
3563         set useithreads
3564         eval $setvar
3565         : Now set use5005threads to the opposite value.
3566         case "$useithreads" in
3567         $define) val="$undef" ;;
3568         *) val="$define" ;;
3569         esac
3570         set use5005threads
3571         eval $setvar
3572         ;;
3573 *)
3574         useithreads="$undef"
3575         use5005threads="$undef"
3576         ;;
3577 esac
3578
3579 case "$useithreads$use5005threads" in
3580 "$define$define")
3581         $cat >&4 <<EOM
3582
3583 You cannot have both the ithreads and the 5.005 threads enabled
3584 at the same time.  Disabling the 5.005 threads since they are
3585 much less stable than the ithreads.
3586
3587 EOM
3588         use5005threads="$undef"
3589         ;;
3590 esac
3591
3592 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3593         cat >&4 <<EOF
3594 ***
3595 *** To build with ithreads you must also use the PerlIO layer.
3596 *** Cannot continue, aborting.
3597 ***
3598 EOF
3599         exit 1
3600 fi
3601
3602 case "$d_oldpthreads" in
3603 '')     : Configure tests would be welcome here.  For now, assume undef.
3604         val="$undef" ;;
3605 *)      val="$d_oldpthreads" ;;
3606 esac
3607 set d_oldpthreads
3608 eval $setvar
3609
3610
3611 case "$usethreads" in
3612 "$define"|true|[yY]*)
3613 : Look for a hint-file generated 'call-back-unit'.  If the
3614 : user has specified that a threading perl is to be built,
3615 : we may need to set or change some other defaults.
3616         if $test -f usethreads.cbu; then
3617                 echo "Your platform has some specific hints for threaded builds, using them..."
3618                 . ./usethreads.cbu
3619         else
3620                 $cat <<EOM
3621 (Your platform doesn't have any specific hints for threaded builds.
3622  Assuming POSIX threads, then.)
3623 EOM
3624         fi
3625         ;;
3626 esac
3627
3628 cat <<EOM
3629
3630 Perl can be built so that multiple Perl interpreters can coexist
3631 within the same Perl executable.
3632 EOM
3633
3634 case "$useithreads" in
3635 $define)
3636         cat <<EOM
3637 This multiple interpreter support is required for interpreter-based threads.
3638 EOM
3639         val="$define"
3640         ;;
3641 *)      case "$usemultiplicity" in
3642         $define|true|[yY]*)     dflt='y';;
3643         *) dflt='n';;
3644         esac
3645         echo " "
3646         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3647         rp='Build Perl for multiplicity?'
3648         . ./myread
3649         case "$ans" in
3650         y|Y)    val="$define" ;;
3651         *)      val="$undef" ;;
3652         esac
3653         ;;
3654 esac
3655 set usemultiplicity
3656 eval $setvar
3657
3658
3659 case "$usemorebits" in
3660 "$define"|true|[yY]*)
3661         use64bitint="$define"
3662         uselongdouble="$define"
3663         usemorebits="$define"
3664         ;;
3665 *)      usemorebits="$undef"
3666         ;;
3667 esac
3668
3669 : make some quick guesses about what we are up against
3670 echo " "
3671 $echo $n "Hmm...  $c"
3672 echo exit 1 >bsd
3673 echo exit 1 >usg
3674 echo exit 1 >v7
3675 echo exit 1 >osf1
3676 echo exit 1 >eunice
3677 echo exit 1 >xenix
3678 echo exit 1 >venix
3679 echo exit 1 >os2
3680 d_bsd="$undef"
3681 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3682 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3683 then
3684         echo "Looks kind of like an OSF/1 system, but we'll see..."
3685         echo exit 0 >osf1
3686 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3687         xxx=`./loc addbib blurfl $pth`
3688         if $test -f $xxx; then
3689         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3690                 echo exit 0 >bsd
3691                 echo exit 0 >usg
3692         else
3693                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3694                         echo "Looks kind of like an extended USG system, but we'll see..."
3695                 else
3696                         echo "Looks kind of like a USG system, but we'll see..."
3697                 fi
3698                 echo exit 0 >usg
3699         fi
3700 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3701         echo "Looks kind of like a BSD system, but we'll see..."
3702         d_bsd="$define"
3703         echo exit 0 >bsd
3704 else
3705         echo "Looks kind of like a Version 7 system, but we'll see..."
3706         echo exit 0 >v7
3707 fi
3708 case "$eunicefix" in
3709 *unixtovms*)
3710         $cat <<'EOI'
3711 There is, however, a strange, musty smell in the air that reminds me of
3712 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3713 EOI
3714         echo exit 0 >eunice
3715         d_eunice="$define"
3716 : it so happens the Eunice I know will not run shell scripts in Unix format
3717         ;;
3718 *)
3719         echo " "
3720         echo "Congratulations.  You aren't running Eunice."
3721         d_eunice="$undef"
3722         ;;
3723 esac
3724 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3725 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3726 : semicolon as a patch separator
3727 case "$p_" in
3728 :) ;;
3729 *)
3730         $cat <<'EOI'
3731 I have the feeling something is not exactly right, however...don't tell me...
3732 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3733 (Or you may be running DOS with DJGPP.)
3734 EOI
3735         echo exit 0 >os2
3736         ;;
3737 esac
3738 if test -f /xenix; then
3739         echo "Actually, this looks more like a XENIX system..."
3740         echo exit 0 >xenix
3741         d_xenix="$define"
3742 else
3743         echo " "
3744         echo "It's not Xenix..."
3745         d_xenix="$undef"
3746 fi
3747 chmod +x xenix
3748 $eunicefix xenix
3749 if test -f /venix; then
3750         echo "Actually, this looks more like a VENIX system..."
3751         echo exit 0 >venix
3752 else
3753         echo " "
3754         if ./xenix; then
3755                 : null
3756         else
3757                 echo "Nor is it Venix..."
3758         fi
3759 fi
3760 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3761 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3762 $rm -f foo
3763
3764 case "$cc" in
3765 '') dflt=cc;;
3766 *) dflt="$cc";;
3767 esac
3768 rp="Use which C compiler?"
3769 . ./myread
3770 cc="$ans"
3771
3772 : See if they have not cc but they do have gcc
3773 . ./trygcc
3774 : Look for a hint-file generated 'call-back-unit'.  Now that the
3775 : user has specified the compiler, we may need to set or change some
3776 : other defaults.
3777 if $test -f cc.cbu; then
3778     . ./cc.cbu
3779 fi
3780 . ./checkcc
3781
3782 echo " "
3783 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3784 $cat >try.c <<EOM
3785 #include <stdio.h>
3786 int main() {
3787 #ifdef __GNUC__
3788 #ifdef __VERSION__
3789         printf("%s\n", __VERSION__);
3790 #else
3791         printf("%s\n", "1");
3792 #endif
3793 #endif
3794         exit(0);
3795 }
3796 EOM
3797 if $cc -o try $ccflags $ldflags try.c; then
3798         gccversion=`$run ./try`
3799         case "$gccversion" in
3800         '') echo "You are not using GNU cc." ;;
3801         *)  echo "You are using GNU cc $gccversion."
3802             ccname=gcc  
3803             ;;
3804         esac
3805 else
3806         echo " "
3807         echo "*** WHOA THERE!!! ***" >&4
3808         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3809         case "$knowitall" in
3810         '')
3811         echo "    You'd better start hunting for one and let me know about it." >&4
3812                 exit 1
3813                 ;;
3814         esac
3815 fi
3816 $rm -f try try.*
3817 case "$gccversion" in
3818 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3819 esac
3820 case "$gccversion" in
3821 '') gccosandvers='' ;;
3822 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3823    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3824    gccshortvers=''
3825    case "$gccosandvers" in
3826    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3827    $osname$osvers) ;; # looking good
3828    $osname*) cat <<EOM >&4
3829
3830 *** WHOA THERE!!! ***
3831
3832     Your gcc has not been compiled for the exact release of
3833     your operating system ($gccosandvers versus $osname$osvers).
3834
3835     In general it is a good idea to keep gcc synchronized with
3836     the operating system because otherwise serious problems
3837     may ensue when trying to compile software, like Perl.
3838
3839     I'm trying to be optimistic here, though, and will continue.
3840     If later during the configuration and build icky compilation
3841     problems appear (headerfile conflicts being the most common
3842     manifestation), I suggest reinstalling the gcc to match
3843     your operating system release.
3844
3845 EOM
3846       ;;
3847    *) gccosandvers='' ;; # failed to parse, better be silent
3848    esac
3849    ;;
3850 esac
3851 case "$ccname" in
3852 '') ccname="$cc" ;;
3853 esac
3854
3855 # gcc 3.1 complains about adding -Idirectories that it already knows about,
3856 # so we will take those off from locincpth.
3857 case "$gccversion" in
3858 3*)
3859     echo "main(){}">try.c
3860     for incdir in `$cc -v -c try.c 2>&1 | \
3861        sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
3862        locincpth=`echo $locincpth | sed s!$incdir!!`
3863     done
3864     $rm -f try try.*
3865 esac
3866
3867 : decide how portable to be.  Allow command line overrides.
3868 case "$d_portable" in
3869 "$undef") ;;
3870 *)      d_portable="$define" ;;
3871 esac
3872
3873 : set up shell script to do ~ expansion
3874 cat >filexp <<EOSS
3875 $startsh
3876 : expand filename
3877 case "\$1" in
3878  ~/*|~)
3879         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3880         ;;
3881  ~*)
3882         if $test -f /bin/csh; then
3883                 /bin/csh -f -c "glob \$1"
3884                 failed=\$?
3885                 echo ""
3886                 exit \$failed
3887         else
3888                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3889                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3890                 if $test ! -d "\$dir"; then
3891                         me=\`basename \$0\`
3892                         echo "\$me: can't locate home directory for: \$name" >&2
3893                         exit 1
3894                 fi
3895                 case "\$1" in
3896                 */*)
3897                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3898                         ;;
3899                 *)
3900                         echo \$dir
3901                         ;;
3902                 esac
3903         fi
3904         ;;
3905 *)
3906         echo \$1
3907         ;;
3908 esac
3909 EOSS
3910 chmod +x filexp
3911 $eunicefix filexp
3912
3913 : now set up to get a file name
3914 cat <<EOS >getfile
3915 $startsh
3916 EOS
3917 cat <<'EOSC' >>getfile
3918 tilde=''
3919 fullpath=''
3920 already=''
3921 skip=''
3922 none_ok=''
3923 exp_file=''
3924 nopath_ok=''
3925 orig_rp="$rp"
3926 orig_dflt="$dflt"
3927 case "$gfpth" in
3928 '') gfpth='.' ;;
3929 esac
3930
3931 case "$fn" in
3932 *\(*)
3933         : getfile will accept an answer from the comma-separated list
3934         : enclosed in parentheses even if it does not meet other criteria.
3935         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3936         fn=`echo $fn | sed 's/(.*)//'`
3937         ;;
3938 esac
3939
3940 case "$fn" in
3941 *:*)
3942         loc_file=`expr $fn : '.*:\(.*\)'`
3943         fn=`expr $fn : '\(.*\):.*'`
3944         ;;
3945 esac
3946
3947 case "$fn" in
3948 *~*) tilde=true;;
3949 esac
3950 case "$fn" in
3951 */*) fullpath=true;;
3952 esac
3953 case "$fn" in
3954 *+*) skip=true;;
3955 esac
3956 case "$fn" in
3957 *n*) none_ok=true;;
3958 esac
3959 case "$fn" in
3960 *e*) exp_file=true;;
3961 esac
3962 case "$fn" in
3963 *p*) nopath_ok=true;;
3964 esac
3965
3966 case "$fn" in
3967 *f*) type='File';;
3968 *d*) type='Directory';;
3969 *l*) type='Locate';;
3970 esac
3971
3972 what="$type"
3973 case "$what" in
3974 Locate) what='File';;
3975 esac
3976
3977 case "$exp_file" in
3978 '')
3979         case "$d_portable" in
3980         "$define") ;;
3981         *) exp_file=true;;
3982         esac
3983         ;;
3984 esac
3985
3986 cd ..
3987 while test "$type"; do
3988         redo=''
3989         rp="$orig_rp"
3990         dflt="$orig_dflt"
3991         case "$tilde" in
3992         true) rp="$rp (~name ok)";;
3993         esac
3994         . UU/myread
3995         if test -f UU/getfile.ok && \
3996                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3997         then
3998                 value="$ans"
3999                 ansexp="$ans"
4000                 break
4001         fi
4002         case "$ans" in
4003         none)
4004                 value=''
4005                 ansexp=''
4006                 case "$none_ok" in
4007                 true) type='';;
4008                 esac
4009                 ;;
4010         *)
4011                 case "$tilde" in
4012                 '') value="$ans"
4013                         ansexp="$ans";;
4014                 *)
4015                         value=`UU/filexp $ans`
4016                         case $? in
4017                         0)
4018                                 if test "$ans" != "$value"; then
4019                                         echo "(That expands to $value on this system.)"
4020                                 fi
4021                                 ;;
4022                         *) value="$ans";;
4023                         esac
4024                         ansexp="$value"
4025                         case "$exp_file" in
4026                         '') value="$ans";;
4027                         esac
4028                         ;;
4029                 esac
4030                 case "$fullpath" in
4031                 true)
4032                         case "$ansexp" in
4033                         /*) value="$ansexp" ;;
4034                         [a-zA-Z]:/*) value="$ansexp" ;;
4035                         *)
4036                                 redo=true
4037                                 case "$already" in
4038                                 true)
4039                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4040                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4041                                         ;;
4042                                 *)
4043                                 echo "Please give a full path name, starting with slash." >&4
4044                                         case "$tilde" in
4045                                         true)
4046                                 echo "Note that using ~name is ok provided it expands well." >&4
4047                                                 already=true
4048                                                 ;;
4049                                         esac
4050                                 esac
4051                                 ;;
4052                         esac
4053                         ;;
4054                 esac
4055                 case "$redo" in
4056                 '')
4057                         case "$type" in
4058                         File)
4059                                 for fp in $gfpth; do
4060                                         if test "X$fp" = X.; then
4061                                             pf="$ansexp"
4062                                         else    
4063                                             pf="$fp/$ansexp"
4064                                         fi
4065                                         if test -f "$pf"; then
4066                                                 type=''
4067                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4068                                         then
4069                                                 echo "($value is not a plain file, but that's ok.)"
4070                                                 type=''
4071                                         fi
4072                                         if test X"$type" = X; then
4073                                             value="$pf"
4074                                             break
4075                                         fi
4076                                 done
4077                                 ;;
4078                         Directory)
4079                                 for fp in $gfpth; do
4080                                         if test "X$fp" = X.; then
4081                                             dir="$ans"
4082                                             direxp="$ansexp"
4083                                         else    
4084                                             dir="$fp/$ansexp"
4085                                             direxp="$fp/$ansexp"
4086                                         fi
4087                                         if test -d "$direxp"; then
4088                                                 type=''
4089                                                 value="$dir"
4090                                                 break
4091                                         fi
4092                                 done
4093                                 ;;
4094                         Locate)
4095                                 if test -d "$ansexp"; then
4096                                         echo "(Looking for $loc_file in directory $value.)"
4097                                         value="$value/$loc_file"
4098                                         ansexp="$ansexp/$loc_file"
4099                                 fi
4100                                 if test -f "$ansexp"; then
4101                                         type=''
4102                                 fi
4103                                 case "$nopath_ok" in
4104                                 true)   case "$value" in
4105                                         */*) ;;
4106                                         *)      echo "Assuming $value will be in people's path."
4107                                                 type=''
4108                                                 ;;
4109                                         esac
4110                                         ;;
4111                                 esac
4112                                 ;;
4113                         esac
4114
4115                         case "$skip" in
4116                         true) type='';
4117                         esac
4118
4119                         case "$type" in
4120                         '') ;;
4121                         *)
4122                                 if test "$fastread" = yes; then
4123                                         dflt=y
4124                                 else
4125                                         dflt=n
4126                                 fi
4127                                 rp="$what $value doesn't exist.  Use that name anyway?"
4128                                 . UU/myread
4129                                 dflt=''
4130                                 case "$ans" in
4131                                 y*) type='';;
4132                                 *) echo " ";;
4133                                 esac
4134                                 ;;
4135                         esac
4136                         ;;
4137                 esac
4138                 ;;
4139         esac
4140 done
4141 cd UU
4142 ans="$value"
4143 rp="$orig_rp"
4144 dflt="$orig_dflt"
4145 rm -f getfile.ok
4146 test "X$gfpthkeep" != Xy && gfpth=""
4147 EOSC
4148
4149 : What should the include directory be ?
4150 echo " "
4151 $echo $n "Hmm...  $c"
4152 dflt='/usr/include'
4153 incpath=''
4154 mips_type=''
4155 if $test -f /bin/mips && /bin/mips; then
4156         echo "Looks like a MIPS system..."
4157         $cat >usr.c <<'EOCP'
4158 #ifdef SYSTYPE_BSD43
4159 /bsd43
4160 #endif
4161 EOCP
4162         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4163                 dflt='/bsd43/usr/include'
4164                 incpath='/bsd43'
4165                 mips_type='BSD 4.3'
4166         else
4167                 mips_type='System V'
4168         fi
4169         $rm -f usr.c usr.out
4170         echo "and you're compiling with the $mips_type compiler and libraries."
4171         xxx_prompt=y
4172         echo "exit 0" >mips
4173 else
4174         echo "Doesn't look like a MIPS system."
4175         xxx_prompt=n
4176         echo "exit 1" >mips
4177 fi
4178 chmod +x mips
4179 $eunicefix mips
4180 case "$usrinc" in
4181 '') ;;
4182 *) dflt="$usrinc";;
4183 esac
4184 case "$xxx_prompt" in
4185 y)      fn=d/
4186         echo " "
4187         rp='Where are the include files you want to use?'
4188         . ./getfile
4189         usrinc="$ans"
4190         ;;
4191 *)      usrinc="$dflt"
4192         ;;
4193 esac
4194
4195 : see how we invoke the C preprocessor
4196 echo " "
4197 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4198 cat <<'EOT' >testcpp.c
4199 #define ABC abc
4200 #define XYZ xyz
4201 ABC.XYZ
4202 EOT
4203 cd ..
4204 if test ! -f cppstdin; then
4205         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4206                 # AIX cc -E doesn't show the absolute headerfile
4207                 # locations but we'll cheat by using the -M flag.
4208                 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
4209         else
4210                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4211         fi
4212 else
4213         echo "Keeping your $hint cppstdin wrapper."
4214 fi
4215 chmod 755 cppstdin
4216 wrapper=`pwd`/cppstdin
4217 ok='false'
4218 cd UU
4219
4220 if $test "X$cppstdin" != "X" && \
4221         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4222         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4223 then
4224         echo "You used to use $cppstdin $cppminus so we'll use that again."
4225         case "$cpprun" in
4226         '') echo "But let's see if we can live without a wrapper..." ;;
4227         *)
4228                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4229                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4230                 then
4231                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4232                         ok='true'
4233                 else
4234                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4235                 fi
4236                 ;;
4237         esac
4238 else
4239         case "$cppstdin" in
4240         '') ;;
4241         *)
4242                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4243                 ;;
4244         esac
4245 fi
4246
4247 if $ok; then
4248         : nothing
4249 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4250         $cc -E <testcpp.c >testcpp.out 2>&1; \
4251         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4252         echo "Yup, it does."
4253         x_cpp="$cc -E"
4254         x_minus='';
4255 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4256         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4257         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4258         echo "Yup, it does."
4259         x_cpp="$cc -E"
4260         x_minus='-';
4261 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4262         $cc -P <testcpp.c >testcpp.out 2>&1; \
4263         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4264         echo "Yipee, that works!"
4265         x_cpp="$cc -P"
4266         x_minus='';
4267 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4268         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4270         echo "At long last!"
4271         x_cpp="$cc -P"
4272         x_minus='-';
4273 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4274         $cpp <testcpp.c >testcpp.out 2>&1; \
4275         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4276         echo "It works!"
4277         x_cpp="$cpp"
4278         x_minus='';
4279 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4280         $cpp - <testcpp.c >testcpp.out 2>&1; \
4281         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4282         echo "Hooray, it works!  I was beginning to wonder."
4283         x_cpp="$cpp"
4284         x_minus='-';
4285 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4286         $wrapper <testcpp.c >testcpp.out 2>&1; \
4287         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4288         x_cpp="$wrapper"
4289         x_minus=''
4290         echo "Eureka!"
4291 else
4292         dflt=''
4293         rp="No dice.  I can't find a C preprocessor.  Name one:"
4294         . ./myread
4295         x_cpp="$ans"
4296         x_minus=''
4297         $x_cpp <testcpp.c >testcpp.out 2>&1
4298         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4299                 echo "OK, that will do." >&4
4300         else
4301 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4302                 exit 1
4303         fi
4304 fi
4305
4306 case "$ok" in
4307 false)
4308         cppstdin="$x_cpp"
4309         cppminus="$x_minus"
4310         cpprun="$x_cpp"
4311         cpplast="$x_minus"
4312         set X $x_cpp
4313         shift
4314         case "$1" in
4315         "$cpp")
4316                 echo "Perhaps can we force $cc -E using a wrapper..."
4317                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4318                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4319                 then
4320                         echo "Yup, we can."
4321                         cppstdin="$wrapper"
4322                         cppminus='';
4323                 else
4324                         echo "Nope, we'll have to live without it..."
4325                 fi
4326                 ;;
4327         esac
4328         case "$cpprun" in
4329         "$wrapper")
4330                 cpprun=''
4331                 cpplast=''
4332                 ;;
4333         esac
4334         ;;
4335 esac
4336
4337 case "$cppstdin" in
4338 "$wrapper"|'cppstdin') ;;
4339 *) $rm -f $wrapper;;
4340 esac
4341 $rm -f testcpp.c testcpp.out
4342
4343 : Set private lib path
4344 case "$plibpth" in
4345 '') if ./mips; then
4346                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4347         fi;;
4348 esac
4349 case "$libpth" in
4350 ' ') dlist='';;
4351 '') dlist="$loclibpth $plibpth $glibpth";;
4352 *) dlist="$libpth";;
4353 esac
4354
4355 : Now check and see which directories actually exist, avoiding duplicates
4356 libpth=''
4357 for xxx in $dlist
4358 do
4359     if $test -d $xxx; then
4360                 case " $libpth " in
4361                 *" $xxx "*) ;;
4362                 *) libpth="$libpth $xxx";;
4363                 esac
4364     fi
4365 done
4366 $cat <<'EOM'
4367
4368 Some systems have incompatible or broken versions of libraries.  Among
4369 the directories listed in the question below, please remove any you
4370 know not to be holding relevant libraries, and add any that are needed.
4371 Say "none" for none.
4372
4373 EOM
4374 case "$libpth" in
4375 '') dflt='none';;
4376 *)
4377         set X $libpth
4378         shift
4379         dflt=${1+"$@"}
4380         ;;
4381 esac
4382 rp="Directories to use for library searches?"
4383 . ./myread
4384 case "$ans" in
4385 none) libpth=' ';;
4386 *) libpth="$ans";;
4387 esac
4388
4389 : compute shared library extension
4390 case "$so" in
4391 '')
4392         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4393                 dflt='sl'
4394         else
4395                 dflt='so'
4396         fi
4397         ;;
4398 *) dflt="$so";;
4399 esac
4400 $cat <<EOM
4401
4402 On some systems, shared libraries may be available.  Answer 'none' if
4403 you want to suppress searching of shared libraries for the remainder
4404 of this configuration.
4405
4406 EOM
4407 rp='What is the file extension used for shared libraries?'
4408 . ./myread
4409 so="$ans"
4410
4411 : Define several unixisms.
4412 : Hints files or command line option can be used to override them.
4413 : The convoluted testing is in case hints files set either the old
4414 : or the new name.
4415 case "$_exe" in
4416 '')     case "$exe_ext" in
4417         '')     ;;
4418         *)      _exe="$exe_ext" ;;
4419         esac
4420         ;;
4421 esac
4422 case "$_a" in
4423 '')     case "$lib_ext" in
4424     '') _a='.a';;
4425         *)      _a="$lib_ext" ;;
4426         esac
4427         ;;
4428 esac
4429 case "$_o" in
4430 '') case "$obj_ext" in
4431         '')     _o='.o';;
4432         *)      _o="$obj_ext";;
4433         esac
4434         ;;
4435 esac
4436 case "$p_" in
4437 '') case "$path_sep" in
4438         '')     p_=':';;
4439         *)      p_="$path_sep";;
4440         esac
4441         ;;
4442 esac
4443 exe_ext=$_exe
4444 lib_ext=$_a
4445 obj_ext=$_o
4446 path_sep=$p_
4447
4448 : Which makefile gets called first.  This is used by make depend.
4449 case "$firstmakefile" in
4450 '') firstmakefile='makefile';;
4451 esac
4452
4453 : Looking for optional libraries
4454 echo " "
4455 echo "Checking for optional libraries..." >&4
4456 case "$libs" in
4457 ' '|'') dflt='';;
4458 *) dflt="$libs";;
4459 esac
4460 case "$libswanted" in
4461 '') libswanted='c_s';;
4462 esac
4463 case "$usesocks" in
4464 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4465 esac
4466 libsfound=''
4467 libsfiles=''
4468 libsdirs=''
4469 libspath=''
4470 for thisdir in $libpth $xlibpth; do
4471   test -d $thisdir && libspath="$libspath $thisdir"
4472 done
4473 for thislib in $libswanted; do
4474         for thisdir in $libspath; do
4475             xxx=''
4476             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4477                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4478                 $test -f "$xxx" && eval $libscheck
4479                 $test -f "$xxx" && libstyle=shared
4480             fi
4481             if test ! -f "$xxx"; then
4482                 xxx=$thisdir/lib$thislib.$so
4483                 $test -f "$xxx" && eval $libscheck
4484                 $test -f "$xxx" && libstyle=shared
4485             fi  
4486             if test ! -f "$xxx"; then
4487                 xxx=$thisdir/lib$thislib$_a
4488                 $test -f "$xxx" && eval $libscheck
4489                 $test -f "$xxx" && libstyle=static
4490             fi
4491             if test ! -f "$xxx"; then
4492                 xxx=$thisdir/$thislib$_a
4493                 $test -f "$xxx" && eval $libscheck
4494                 $test -f "$xxx" && libstyle=static
4495             fi
4496             if test ! -f "$xxx"; then
4497                 xxx=$thisdir/lib${thislib}_s$_a
4498                 $test -f "$xxx" && eval $libscheck
4499                 $test -f "$xxx" && libstyle=static
4500                 $test -f "$xxx" && thislib=${thislib}_s
4501             fi
4502             if test ! -f "$xxx"; then
4503                 xxx=$thisdir/Slib$thislib$_a
4504                 $test -f "$xxx" && eval $libscheck
4505                 $test -f "$xxx" && libstyle=static
4506             fi
4507             if $test -f "$xxx"; then
4508                 case "$libstyle" in
4509                 shared) echo "Found -l$thislib (shared)." ;;
4510                 static) echo "Found -l$thislib." ;;
4511                 *)      echo "Found -l$thislib ($libstyle)." ;;
4512                 esac
4513                 case " $dflt " in
4514                 *"-l$thislib "*);;
4515                 *) dflt="$dflt -l$thislib"
4516                    libsfound="$libsfound $xxx"
4517                    yyy=`basename $xxx`
4518                    libsfiles="$libsfiles $yyy"
4519                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4520                    case " $libsdirs " in
4521                    *" $yyy "*) ;;
4522                    *) libsdirs="$libsdirs $yyy" ;;
4523                    esac
4524                    ;;
4525                 esac
4526                 break
4527             fi  
4528         done
4529         if $test ! -f "$xxx"; then
4530             echo "No -l$thislib."
4531         fi
4532 done
4533 set X $dflt
4534 shift
4535 dflt="$*"
4536 case "$libs" in
4537 '') dflt="$dflt";;
4538 *) dflt="$libs";;
4539 esac
4540 case "$dflt" in
4541 ' '|'') dflt='none';;
4542 esac
4543
4544 $cat <<EOM
4545
4546 In order to compile $package on your machine, a number of libraries
4547 are usually needed.  Include any other special libraries here as well.
4548 Say "none" for none.  The default list is almost always right.
4549 EOM
4550
4551 echo " "
4552 rp="What libraries to use?"
4553 . ./myread
4554 case "$ans" in
4555 none) libs=' ';;
4556 *) libs="$ans";;
4557 esac
4558
4559 : determine optimization, if desired, or use for debug flag also
4560 case "$optimize" in
4561 ' '|$undef) dflt='none';;
4562 '') dflt='-O';;
4563 *) dflt="$optimize";;
4564 esac
4565 $cat <<EOH
4566
4567 By default, $package compiles with the -O flag to use the optimizer.
4568 Alternately, you might want to use the symbolic debugger, which uses
4569 the -g flag (on traditional Unix systems).  Either flag can be
4570 specified here.  To use neither flag, specify the word "none".
4571
4572 EOH
4573 rp="What optimizer/debugger flag should be used?"
4574 . ./myread
4575 optimize="$ans"
4576 case "$optimize" in
4577 'none') optimize=" ";;
4578 esac
4579
4580 dflt=''
4581 : We will not override a previous value, but we might want to
4582 : augment a hint file
4583 case "$hint" in
4584 default|recommended)
4585         case "$gccversion" in
4586         1*) dflt='-fpcc-struct-return' ;;
4587         esac
4588         case "$optimize" in
4589         *-g*) dflt="$dflt -DDEBUGGING";;
4590         esac
4591         case "$gccversion" in
4592         2*) if test -d /etc/conf/kconfig.d &&
4593                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4594                 then
4595                         dflt="$dflt -posix"
4596                 fi
4597                 ;;
4598         esac
4599         case "$gccversion" in
4600         1*) ;;
4601         2.[0-8]*) ;;
4602         ?*)     echo " "
4603                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4604                 echo 'int main(void) { return 0; }' > gcctest.c
4605                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4606                         echo "Yes, it does." 2>&1
4607                         case "$ccflags" in
4608                         *strict-aliasing*) 
4609                                 echo "Leaving current flags $ccflags alone." 2>&1
4610                                 ;;
4611                         *) dflt="$dflt -fno-strict-aliasing" ;;
4612                         esac
4613                 else
4614                         echo "Nope, it doesn't, but that's ok." 2>&1
4615                 fi
4616                 ;;
4617         esac
4618         ;;
4619 esac
4620
4621 case "$mips_type" in
4622 *BSD*|'') inclwanted="$locincpth $usrinc";;
4623 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4624 esac
4625 for thisincl in $inclwanted; do
4626         if $test -d $thisincl; then
4627                 if $test x$thisincl != x$usrinc; then
4628                         case "$dflt" in
4629                         *" -I$thisincl "*);;
4630                         *) dflt="$dflt -I$thisincl ";;
4631                         esac
4632                 fi
4633         fi
4634 done
4635
4636 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4637         xxx=true;
4638 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4639         xxx=true;
4640 else
4641         xxx=false;
4642 fi;
4643 if $xxx; then
4644         case "$dflt" in
4645         *$2*);;
4646         *) dflt="$dflt -D$2";;
4647         esac;
4648 fi'
4649
4650 set signal.h LANGUAGE_C; eval $inctest
4651
4652 case "$usesocks" in
4653 $define)
4654         ccflags="$ccflags -DSOCKS"
4655         ;;
4656 esac
4657
4658 case "$hint" in
4659 default|recommended) dflt="$ccflags $dflt" ;;
4660 *) dflt="$ccflags";;
4661 esac
4662
4663 case "$dflt" in
4664 ''|' ') dflt=none;;
4665 esac
4666
4667 $cat <<EOH
4668
4669 Your C compiler may want other flags.  For this question you should include
4670 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4671 but you should NOT include libraries or ld flags like -lwhatever.  If you
4672 want $package to honor its debug switch, you should include -DDEBUGGING here.
4673 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4674
4675 To use no flags, specify the word "none".
4676
4677 EOH
4678 set X $dflt
4679 shift
4680 dflt=${1+"$@"}
4681 rp="Any additional cc flags?"
4682 . ./myread
4683 case "$ans" in
4684 none) ccflags='';;
4685 *) ccflags="$ans";;
4686 esac
4687
4688 : the following weeds options from ccflags that are of no interest to cpp
4689 case "$cppflags" in
4690 '') cppflags="$ccflags" ;;
4691 *)  cppflags="$cppflags $ccflags" ;;
4692 esac
4693 case "$gccversion" in
4694 1*) cppflags="$cppflags -D__GNUC__"
4695 esac
4696 case "$mips_type" in
4697 '');;
4698 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4699 esac
4700 case "$cppflags" in
4701 '');;
4702 *)
4703         echo " "
4704         echo "Let me guess what the preprocessor flags are..." >&4
4705         set X $cppflags
4706         shift
4707         cppflags=''
4708         $cat >cpp.c <<'EOM'
4709 #define BLURFL foo
4710
4711 BLURFL xx LFRULB
4712 EOM
4713         previous=''
4714         for flag in $*
4715         do
4716                 case "$flag" in
4717                 -*) ftry="$flag";;
4718                 *) ftry="$previous $flag";;
4719                 esac
4720                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4721                         >cpp1.out 2>/dev/null && \
4722                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4723                         >cpp2.out 2>/dev/null && \
4724                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4725                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4726                 then
4727                         cppflags="$cppflags $ftry"
4728                         previous=''
4729                 else
4730                         previous="$flag"
4731                 fi
4732         done
4733         set X $cppflags
4734         shift
4735         cppflags=${1+"$@"}
4736         case "$cppflags" in
4737         *-*)  echo "They appear to be: $cppflags";;
4738         esac
4739         $rm -f cpp.c cpp?.out
4740         ;;
4741 esac
4742
4743 : flags used in final linking phase
4744 case "$ldflags" in
4745 '') if ./venix; then
4746                 dflt='-i -z'
4747         else
4748                 dflt=''
4749         fi
4750         case "$ccflags" in
4751         *-posix*) dflt="$dflt -posix" ;;
4752         esac
4753         ;;
4754 *) dflt="$ldflags";;
4755 esac
4756
4757 : Try to guess additional flags to pick up local libraries.
4758 for thislibdir in $libpth; do
4759         case " $loclibpth " in
4760         *" $thislibdir "*)
4761                 case "$dflt " in 
4762                 *"-L$thislibdir "*) ;;
4763                 *)  dflt="$dflt -L$thislibdir" ;;
4764                 esac
4765                 ;;
4766         esac
4767 done
4768
4769 case "$dflt" in
4770 '') dflt='none' ;;
4771 esac
4772
4773 $cat <<EOH
4774
4775 Your C linker may need flags.  For this question you should
4776 include -L/whatever and any other flags used by the C linker, but you
4777 should NOT include libraries like -lwhatever.
4778
4779 Make sure you include the appropriate -L/path flags if your C linker
4780 does not normally search all of the directories you specified above,
4781 namely
4782         $libpth
4783 To use no flags, specify the word "none".
4784
4785 EOH
4786
4787 rp="Any additional ld flags (NOT including libraries)?"
4788 . ./myread
4789 case "$ans" in
4790 none) ldflags='';;
4791 *) ldflags="$ans";;
4792 esac
4793 rmlist="$rmlist pdp11"
4794
4795 : coherency check
4796 echo " "
4797 echo "Checking your choice of C compiler and flags for coherency..." >&4
4798 $cat > try.c <<'EOF'
4799 #include <stdio.h>
4800 int main() { printf("Ok\n"); exit(0); }
4801 EOF
4802 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4803 shift
4804 $cat >try.msg <<'EOM'
4805 I've tried to compile and run the following simple program:
4806
4807 EOM
4808 $cat try.c >> try.msg
4809
4810 $cat >> try.msg <<EOM
4811
4812 I used the command:
4813
4814         $*
4815         $run ./try
4816
4817 and I got the following output:
4818
4819 EOM
4820 dflt=y
4821 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4822         if $sh -c "$run ./try" >>try.msg 2>&1; then
4823                 xxx=`$run ./try`
4824                 case "$xxx" in
4825                 "Ok") dflt=n ;;
4826                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4827                         case " $libs " in
4828                         *" -lsfio "*)
4829                                 cat >> try.msg <<'EOQS'
4830 If $libs contains -lsfio, and sfio is mis-configured, then it
4831 sometimes (apparently) runs and exits with a 0 status, but with no
4832 output!  It may have to do with sfio's use of _exit vs. exit.
4833
4834 EOQS
4835                                 rp="You have a big problem.  Shall I abort Configure"
4836                                 dflt=y
4837                                 ;;
4838                         esac
4839                         ;;
4840                 esac
4841         else
4842                 echo "The program compiled OK, but exited with status $?." >>try.msg
4843                 rp="You have a problem.  Shall I abort Configure"
4844                 dflt=y
4845         fi
4846 else
4847         echo "I can't compile the test program." >>try.msg
4848         rp="You have a BIG problem.  Shall I abort Configure"
4849         dflt=y
4850 fi
4851 case "$dflt" in
4852 y)
4853         $cat try.msg >&4
4854         case "$knowitall" in
4855         '')
4856                 echo "(The supplied flags or libraries might be incorrect.)"
4857                 ;;
4858         *) dflt=n;;
4859         esac
4860         echo " "
4861         . ./myread
4862         case "$ans" in
4863         n*|N*) ;;
4864         *)      echo "Ok.  Stopping Configure." >&4
4865                 exit 1
4866                 ;;
4867         esac
4868         ;;
4869 n) echo "OK, that should do.";;
4870 esac
4871 $rm -f try try.* core
4872
4873 : define a shorthand compile call
4874 compile='
4875 mc_file=$1;
4876 shift;
4877 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4878 : define a shorthand compile call for compilations that should be ok.
4879 compile_ok='
4880 mc_file=$1;
4881 shift;
4882 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4883
4884 : check for lengths of integral types
4885 echo " "
4886 case "$intsize" in
4887 '')
4888         echo "Checking to see how big your integers are..." >&4
4889         $cat >try.c <<'EOCP'
4890 #include <stdio.h>
4891 int main()
4892 {
4893         printf("intsize=%d;\n", (int)sizeof(int));
4894         printf("longsize=%d;\n", (int)sizeof(long));
4895         printf("shortsize=%d;\n", (int)sizeof(short));
4896         exit(0);
4897 }
4898 EOCP
4899         set try
4900         if eval $compile_ok && $run ./try > /dev/null; then
4901                 eval `$run ./try`
4902                 echo "Your integers are $intsize bytes long."
4903                 echo "Your long integers are $longsize bytes long."
4904                 echo "Your short integers are $shortsize bytes long."
4905         else
4906                 $cat >&4 <<EOM
4907 !
4908 Help! I can't compile and run the intsize test program: please enlighten me!
4909 (This is probably a misconfiguration in your system or libraries, and
4910 you really ought to fix it.  Still, I'll try anyway.)
4911 !
4912 EOM
4913                 dflt=4
4914                 rp="What is the size of an integer (in bytes)?"
4915                 . ./myread
4916                 intsize="$ans"
4917                 dflt=$intsize
4918                 rp="What is the size of a long integer (in bytes)?"
4919                 . ./myread
4920                 longsize="$ans"
4921                 dflt=2
4922                 rp="What is the size of a short integer (in bytes)?"
4923                 . ./myread
4924                 shortsize="$ans"
4925         fi
4926         ;;
4927 esac
4928 $rm -f try try.*
4929
4930 : check for long long
4931 echo " "
4932 echo "Checking to see if you have long long..." >&4
4933 echo 'int main() { long long x = 7; return 0; }' > try.c
4934 set try
4935 if eval $compile; then
4936         val="$define"
4937         echo "You have long long."
4938 else
4939         val="$undef"
4940         echo "You do not have long long."
4941 fi
4942 $rm try.*
4943 set d_longlong
4944 eval $setvar
4945
4946 : check for length of long long
4947 case "${d_longlong}${longlongsize}" in
4948 $define)
4949         echo " "
4950         echo "Checking to see how big your long longs are..." >&4
4951         $cat >try.c <<'EOCP'
4952 #include <stdio.h>
4953 int main()
4954 {
4955     printf("%d\n", (int)sizeof(long long));
4956     return(0);
4957 }
4958 EOCP
4959         set try
4960         if eval $compile_ok; then
4961                 longlongsize=`$run ./try`
4962                 echo "Your long longs are $longlongsize bytes long."
4963         else
4964                 dflt='8'
4965                 echo " "
4966                 echo "(I can't seem to compile the test program.  Guessing...)"
4967                 rp="What is the size of a long long (in bytes)?"
4968                 . ./myread
4969                 longlongsize="$ans"
4970         fi
4971         if $test "X$longsize" = "X$longlongsize"; then
4972                 echo "(That isn't any different from an ordinary long.)"
4973         fi      
4974         ;;
4975 esac
4976 $rm -f try.* try
4977
4978 : determine filename position in cpp output
4979 echo " "
4980 echo "Computing filename position in cpp output for #include directives..." >&4
4981 case "$osname" in
4982 vos) testaccess=-e ;;
4983 *)   testaccess=-r ;;
4984 esac
4985 echo '#include <stdio.h>' > foo.c
4986 $cat >fieldn <<EOF
4987 $startsh
4988 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4989 $grep '^[       ]*#.*stdio\.h' | \
4990 while read cline; do
4991         pos=1
4992         set \$cline
4993         while $test \$# -gt 0; do
4994                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4995                         echo "\$pos"
4996                         exit 0
4997                 fi
4998                 shift
4999                 pos=\`expr \$pos + 1\`
5000         done
5001 done
5002 EOF
5003 chmod +x fieldn
5004 fieldn=`./fieldn`
5005 $rm -f foo.c fieldn
5006 case $fieldn in
5007 '') pos='???';;
5008 1) pos=first;;
5009 2) pos=second;;
5010 3) pos=third;;
5011 *) pos="${fieldn}th";;
5012 esac
5013 echo "Your cpp writes the filename in the $pos field of the line."
5014
5015 case "$osname" in
5016 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5017 *)   cppfilter='' ;;
5018 esac
5019 : locate header file
5020 $cat >findhdr <<EOF
5021 $startsh
5022 wanted=\$1
5023 name=''
5024 for usrincdir in $usrinc
5025 do
5026         if test -f \$usrincdir/\$wanted; then
5027                 echo "\$usrincdir/\$wanted"
5028                 exit 0
5029         fi
5030 done
5031 awkprg='{ print \$$fieldn }'
5032 echo "#include <\$wanted>" > foo\$\$.c
5033 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5034 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5035 while read cline; do
5036         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5037         case "\$name" in
5038         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5039         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5040         *) exit 2;;
5041         esac;
5042 done;
5043 #
5044 # status = 0: grep returned 0 lines, case statement not executed
5045 # status = 1: headerfile found
5046 # status = 2: while loop executed, no headerfile found
5047 #
5048 status=\$?
5049 $rm -f foo\$\$.c;
5050 if test \$status -eq 1; then
5051         exit 0;
5052 fi
5053 exit 1
5054 EOF
5055 chmod +x findhdr
5056
5057 : define an alternate in-header-list? function
5058 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5059 cont=true; xxf="echo \"<\$1> found.\" >&4";
5060 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5061 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5062 esac;
5063 case $# in 4) instead=instead;; *) instead="at last";; esac;
5064 while $test "$cont"; do
5065         xxx=`./findhdr $1`
5066         var=$2; eval "was=\$$2";
5067         if $test "$xxx" && $test -r "$xxx";
5068         then eval $xxf;
5069         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5070                 cont="";
5071         else eval $xxnf;
5072         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5073         set $yyy; shift; shift; yyy=$@;
5074         case $# in 0) cont="";;
5075         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5076                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5077         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5078                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5079         esac;
5080 done;
5081 while $test "$yyy";
5082 do set $yyy; var=$2; eval "was=\$$2";
5083         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5084         set $yyy; shift; shift; yyy=$@;
5085 done'
5086
5087 : see if inttypes.h is available
5088 : we want a real compile instead of Inhdr because some systems
5089 : have an inttypes.h which includes non-existent headers
5090 echo " "
5091 $cat >try.c <<EOCP
5092 #include <inttypes.h>
5093 int main() {
5094         static int32_t foo32 = 0x12345678;
5095 }
5096 EOCP
5097 set try
5098 if eval $compile; then
5099         echo "<inttypes.h> found." >&4
5100         val="$define"
5101 else
5102         echo "<inttypes.h> NOT found." >&4
5103         val="$undef"
5104 fi
5105 $rm -f try.c try
5106 set i_inttypes
5107 eval $setvar
5108
5109 : check for int64_t
5110 echo " "
5111 echo "Checking to see if you have int64_t..." >&4
5112 $cat >try.c <<EOCP
5113 #include <sys/types.h>
5114 #$i_inttypes I_INTTYPES
5115 #ifdef I_INTTYPES
5116 #include <inttypes.h>
5117 #endif
5118 int main() { int64_t x = 7; }
5119 EOCP
5120 set try
5121 if eval $compile; then
5122         val="$define"
5123         echo "You have int64_t."
5124 else
5125         val="$undef"
5126         echo "You do not have int64_t."
5127 fi
5128 $rm -f try try.*
5129 set d_int64_t
5130 eval $setvar
5131
5132
5133 echo " "
5134 echo "Checking which 64-bit integer type we could use..." >&4
5135
5136 case "$intsize" in
5137 8) val=int
5138    set quadtype
5139    eval $setvar
5140    val='"unsigned int"'
5141    set uquadtype
5142    eval $setvar
5143    quadkind=1
5144    ;;
5145 *) case "$longsize" in
5146    8) val=long
5147       set quadtype
5148       eval $setvar
5149       val='"unsigned long"'
5150       set uquadtype
5151       eval $setvar
5152       quadkind=2
5153       ;;
5154    *) case "$d_longlong:$longlongsize" in
5155       define:8)
5156         val='"long long"'
5157         set quadtype
5158         eval $setvar
5159         val='"unsigned long long"'
5160         set uquadtype
5161         eval $setvar
5162         quadkind=3
5163         ;;
5164       *) case "$d_int64_t" in
5165          define)
5166            val=int64_t
5167            set quadtype
5168            eval $setvar
5169            val=uint64_t
5170            set uquadtype
5171            eval $setvar
5172            quadkind=4
5173            ;;
5174          esac
5175          ;;
5176       esac
5177       ;;
5178    esac
5179    ;;
5180 esac
5181
5182 case "$quadtype" in
5183 '')     echo "Alas, no 64-bit integer types in sight." >&4
5184         d_quad="$undef"
5185         ;;
5186 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5187         d_quad="$define"
5188         ;;
5189 esac
5190
5191
5192 case "$uselonglong" in
5193 "$define"|true|[yY]*)
5194         cat <<EOM >&4
5195
5196 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5197 EOM
5198         use64bitint="$define"
5199         ;;
5200 esac                          
5201 case "$use64bits" in
5202 "$define"|true|[yY]*)
5203         cat <<EOM >&4
5204
5205 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5206 EOM
5207         use64bitint="$define"
5208         ;;
5209 esac                          
5210 case "$use64bitints" in
5211 "$define"|true|[yY]*)
5212         cat <<EOM >&4
5213
5214 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5215 EOM
5216         use64bitint="$define"
5217         ;;
5218 esac                          
5219 case "$use64bitsint" in
5220 "$define"|true|[yY]*)
5221         cat <<EOM >&4
5222
5223 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5224 EOM
5225         use64bitint="$define"
5226         ;;
5227 esac                          
5228 case "$uselonglongs" in
5229 "$define"|true|[yY]*)
5230         cat <<EOM >&4
5231
5232 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5233 EOM
5234         use64bitint="$define"
5235         ;;
5236 esac                          
5237 case "$use64bitsall" in
5238 "$define"|true|[yY]*)
5239         cat <<EOM >&4
5240
5241 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5242 EOM
5243         use64bitall="$define"
5244         ;;
5245 esac                          
5246
5247 case "$ccflags" in
5248 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5249 esac
5250 case "$use64bitall" in
5251 "$define"|true|[yY]*) use64bitint="$define" ;;
5252 esac
5253
5254 case "$longsize" in
5255 8) cat <<EOM
5256
5257 You have natively 64-bit long integers.
5258 EOM
5259    val="$define"
5260    ;;
5261 *) case "$use64bitint" in
5262    "$define"|true|[yY]*) dflt='y';;
5263    *) dflt='n';;
5264    esac
5265    case "$d_quad" in
5266    "$define") ;;
5267    *) dflt='n' ;;
5268    esac
5269    cat <<EOM
5270
5271 Perl can be built to take advantage of 64-bit integer types
5272 on some systems.  To do so, Configure can be run with -Duse64bitint.
5273 Choosing this option will most probably introduce binary incompatibilities.
5274
5275 If this doesn't make any sense to you, just accept the default '$dflt'.
5276 (The default has been chosen based on your configuration.)
5277 EOM
5278    rp='Try to use 64-bit integers, if available?'
5279    . ./myread
5280    case "$ans" in
5281    [yY]*) val="$define" ;;
5282    *)     val="$undef"  ;;
5283    esac
5284    ;;
5285 esac
5286 set use64bitint
5287 eval $setvar
5288
5289 case "$use64bitall" in
5290 "$define"|true|[yY]*) dflt='y' ;;
5291 *) case "$longsize" in
5292    8) dflt='y' ;;
5293    *) dflt='n' ;;
5294    esac
5295    ;;
5296 esac    
5297 cat <<EOM
5298
5299 You may also choose to try maximal 64-bitness.  It means using as much
5300 64-bitness as possible on the platform.  This in turn means even more
5301 binary incompatibilities.  On the other hand, your platform may not
5302 have any more 64-bitness available than what you already have chosen.
5303
5304 If this doesn't make any sense to you, just accept the default '$dflt'.
5305 (The default has been chosen based on your configuration.)
5306 EOM
5307 rp='Try to use maximal 64-bit support, if available?'
5308 . ./myread
5309 case "$ans" in
5310 [yY]*) val="$define" ;;
5311 *)     val="$undef"  ;;
5312 esac
5313 set use64bitall
5314 eval $setvar
5315 case "$use64bitall" in
5316 "$define")
5317         case "$use64bitint" in
5318         "$undef")
5319                 cat <<EOM
5320
5321 Since you have chosen a maximally 64-bit build, I'm also turning on
5322 the use of 64-bit integers.
5323 EOM
5324                 use64bitint="$define" ;;
5325         esac
5326         ;;
5327 esac
5328
5329 case "$use64bitint" in
5330 "$define"|true|[yY]*)
5331 : Look for a hint-file generated 'call-back-unit'.  If the
5332 : user has specified that a 64-bit perl is to be built,
5333 : we may need to set or change some other defaults.
5334         if $test -f use64bitint.cbu; then
5335                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5336                 . ./use64bitint.cbu
5337         fi
5338         case "$longsize" in
5339         4) case "$archname64" in
5340            '') archname64=64int ;;
5341            esac
5342            ;;
5343         esac
5344         ;;
5345 esac
5346
5347 case "$use64bitall" in
5348 "$define"|true|[yY]*)
5349 : Look for a hint-file generated 'call-back-unit'.  If the
5350 : user has specified that a maximally 64-bit perl is to be built,
5351 : we may need to set or change some other defaults.
5352         if $test -f use64bitall.cbu; then
5353                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5354                 . ./use64bitall.cbu
5355         fi
5356         case "$longsize" in
5357         4) case "$archname64" in
5358            ''|64int) archname64=64all ;;
5359            esac
5360            ;;
5361         esac
5362         ;;
5363 esac
5364
5365 echo " "
5366 echo "Checking for GNU C Library..." >&4
5367 cat >try.c <<'EOCP'
5368 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5369    alone are insufficient to distinguish different versions, such as
5370    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5371    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5372 */
5373 #include <stdio.h>
5374 int main(void)
5375 {
5376 #ifdef __GLIBC__
5377 #   ifdef __GLIBC_MINOR__
5378 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5379 #           include <gnu/libc-version.h>
5380             printf("%s\n",  gnu_get_libc_version());
5381 #       else
5382             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5383 #       endif
5384 #   else
5385         printf("%d\n",  __GLIBC__);
5386 #   endif
5387     return 0;
5388 #else
5389     return 1;
5390 #endif
5391 }
5392 EOCP
5393 set try
5394 if eval $compile_ok && $run ./try > glibc.ver; then
5395         val="$define"
5396         gnulibc_version=`$cat glibc.ver`
5397         echo "You are using the GNU C Library version $gnulibc_version"
5398 else
5399         val="$undef"
5400         gnulibc_version=''
5401         echo "You are not using the GNU C Library"
5402 fi
5403 $rm -f try try.* glibc.ver
5404 set d_gnulibc
5405 eval $setvar
5406
5407 : see if nm is to be used to determine whether a symbol is defined or not
5408 case "$usenm" in
5409 '')
5410         dflt=''
5411         case "$d_gnulibc" in
5412         "$define")
5413                 echo " "
5414                 echo "nm probably won't work on the GNU C Library." >&4
5415                 dflt=n
5416                 ;;
5417         esac
5418         case "$dflt" in
5419         '') 
5420                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5421                         echo " "
5422                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5423                         echo "'nm' won't be sufficient on this sytem." >&4
5424                         dflt=n
5425                 fi
5426                 ;;
5427         esac
5428         case "$dflt" in
5429         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5430                 if $test $dflt -gt 20; then
5431                         dflt=y
5432                 else
5433                         dflt=n
5434                 fi
5435                 ;;
5436         esac
5437         ;;
5438 *)
5439         case "$usenm" in
5440         true|$define) dflt=y;;
5441         *) dflt=n;;
5442         esac
5443         ;;
5444 esac
5445 $cat <<EOM
5446
5447 I can use $nm to extract the symbols from your C libraries. This
5448 is a time consuming task which may generate huge output on the disk (up
5449 to 3 megabytes) but that should make the symbols extraction faster. The
5450 alternative is to skip the 'nm' extraction part and to compile a small
5451 test program instead to determine whether each symbol is present. If
5452 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5453 this may be the best solution.
5454
5455 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5456
5457 EOM
5458 rp="Shall I use $nm to extract C symbols from the libraries?"
5459 . ./myread
5460 case "$ans" in
5461 [Nn]*) usenm=false;;
5462 *) usenm=true;;
5463 esac
5464
5465 runnm=$usenm
5466 case "$reuseval" in
5467 true) runnm=false;;
5468 esac
5469
5470 : nm options which may be necessary
5471 case "$nm_opt" in
5472 '') if $test -f /mach_boot; then
5473                 nm_opt=''       # Mach
5474         elif $test -d /usr/ccs/lib; then
5475                 nm_opt='-p'     # Solaris (and SunOS?)
5476         elif $test -f /dgux; then
5477                 nm_opt='-p'     # DG-UX
5478         elif $test -f /lib64/rld; then
5479                 nm_opt='-p'     # 64-bit Irix
5480         else
5481                 nm_opt=''
5482         fi;;
5483 esac
5484
5485 : nm options which may be necessary for shared libraries but illegal
5486 : for archive libraries.  Thank you, Linux.
5487 case "$nm_so_opt" in
5488 '')     case "$myuname" in
5489         *linux*)
5490                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5491                         nm_so_opt='--dynamic'
5492                 fi
5493                 ;;
5494         esac
5495         ;;
5496 esac
5497
5498 case "$runnm" in
5499 true)
5500 : get list of predefined functions in a handy place
5501 echo " "
5502 case "$libc" in
5503 '') libc=unknown
5504         case "$libs" in
5505         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5506         esac
5507         ;;
5508 esac
5509 case "$libs" in
5510 '') ;;
5511 *)  for thislib in $libs; do
5512         case "$thislib" in
5513         -lc|-lc_s)
5514                 : Handle C library specially below.
5515                 ;;
5516         -l*)
5517                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5518                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5519                         :
5520                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5521                         :
5522                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5523                         :
5524                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5525                         :
5526                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5527                         :
5528                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5529                         :
5530                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5531                         :
5532                 else
5533                         try=''
5534                 fi
5535                 libnames="$libnames $try"
5536                 ;;
5537         *) libnames="$libnames $thislib" ;;
5538         esac
5539         done
5540         ;;
5541 esac
5542 xxx=normal
5543 case "$libc" in
5544 unknown)
5545         set /lib/libc.$so
5546         for xxx in $libpth; do
5547                 $test -r $1 || set $xxx/libc.$so
5548                 : The messy sed command sorts on library version numbers.
5549                 $test -r $1 || \
5550                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5551                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5552                                 h
5553                                 s/[0-9][0-9]*/0000&/g
5554                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5555                                 G
5556                                 s/\n/ /' | \
5557                          $sort | $sed -e 's/^.* //'`
5558                 eval set \$$#
5559         done
5560         $test -r $1 || set /usr/ccs/lib/libc.$so
5561         $test -r $1 || set /lib/libsys_s$_a
5562         ;;
5563 *)
5564         set blurfl
5565         ;;
5566 esac
5567 if $test -r "$1"; then
5568         echo "Your (shared) C library seems to be in $1."
5569         libc="$1"
5570 elif $test -r /lib/libc && $test -r /lib/clib; then
5571         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5572         xxx=apollo
5573         libc='/lib/clib /lib/libc'
5574         if $test -r /lib/syslib; then
5575                 echo "(Your math library is in /lib/syslib.)"
5576                 libc="$libc /lib/syslib"
5577         fi
5578 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5579         echo "Your C library seems to be in $libc, as you said before."
5580 elif $test -r $incpath/usr/lib/libc$_a; then
5581         libc=$incpath/usr/lib/libc$_a;
5582         echo "Your C library seems to be in $libc.  That's fine."
5583 elif $test -r /lib/libc$_a; then
5584         libc=/lib/libc$_a;
5585         echo "Your C library seems to be in $libc.  You're normal."
5586 else
5587         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5588                 :
5589         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5590                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5591         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5592                 :
5593         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5594                 :
5595         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5596                 :
5597         else
5598                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5599         fi
5600         if $test -r "$tans"; then
5601                 echo "Your C library seems to be in $tans, of all places."
5602                 libc=$tans
5603         else
5604                 libc='blurfl'
5605         fi
5606 fi
5607 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5608         dflt="$libc"
5609         cat <<EOM
5610
5611 If the guess above is wrong (which it might be if you're using a strange
5612 compiler, or your machine supports multiple models), you can override it here.
5613
5614 EOM
5615 else
5616         dflt=''
5617         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5618         cat >&4 <<EOM
5619 I can't seem to find your C library.  I've looked in the following places:
5620
5621 EOM
5622         $sed 's/^/      /' libpath
5623         cat <<EOM
5624
5625 None of these seems to contain your C library. I need to get its name...
5626
5627 EOM
5628 fi
5629 fn=f
5630 rp='Where is your C library?'
5631 . ./getfile
5632 libc="$ans"
5633
5634 echo " "
5635 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5636 set X `cat libnames`
5637 shift
5638 xxx=files
5639 case $# in 1) xxx=file; esac
5640 echo "Extracting names from the following $xxx for later perusal:" >&4
5641 echo " "
5642 $sed 's/^/      /' libnames >&4
5643 echo " "
5644 $echo $n "This may take a while...$c" >&4
5645
5646 for file in $*; do
5647         case $file in
5648         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5649         *) $nm $nm_opt $file 2>/dev/null;;
5650         esac
5651 done >libc.tmp
5652
5653 $echo $n ".$c"
5654 $grep fprintf libc.tmp > libc.ptf
5655 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5656 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5657 xxx='[ADTSIW]'
5658 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5659         eval $xscan;\
5660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5661                 eval $xrun
5662 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5663         eval $xscan;\
5664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5665                 eval $xrun
5666 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5667         eval $xscan;\
5668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5669                 eval $xrun
5670 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5671         eval $xscan;\
5672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5673                 eval $xrun
5674 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5675         eval $xscan;\
5676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5677                 eval $xrun
5678 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5679         eval $xscan;\
5680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5681                 eval $xrun
5682 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5683                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5684         eval $xscan;\
5685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5686                 eval $xrun
5687 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5688         eval $xscan;\
5689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5690                 eval $xrun
5691 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5692         eval $xscan;\
5693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5694                 eval $xrun
5695 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5696         eval $xscan;\
5697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5698                 eval $xrun
5699 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5700         eval $xscan;\
5701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5702                 eval $xrun
5703 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5704         eval $xscan;\
5705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5706                 eval $xrun
5707 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5708         eval $xscan;\
5709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5710                 eval $xrun
5711 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 else
5716         $nm -p $* 2>/dev/null >libc.tmp
5717         $grep fprintf libc.tmp > libc.ptf
5718         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5719                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5720         then
5721                 nm_opt='-p'
5722                 eval $xrun
5723         else
5724                 echo " "
5725                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5726                 com=''
5727                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5728                         for thisname in $libnames $libc; do
5729                                 $ar t $thisname >>libc.tmp
5730                         done
5731                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5732                         echo "Ok." >&4
5733                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5734                         # Repeat libc to extract forwarders to DLL entries too
5735                         for thisname in $libnames $libc; do
5736                                 $ar tv $thisname >>libc.tmp
5737                                 # Revision 50 of EMX has bug in $ar.
5738                                 # it will not extract forwarders to DLL entries
5739                                 # Use emximp which will extract exactly them.
5740                                 emximp -o tmp.imp $thisname \
5741                                     2>/dev/null && \
5742                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5743                                     < tmp.imp >>libc.tmp
5744                                 $rm tmp.imp
5745                         done
5746                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5747                         echo "Ok." >&4
5748                 else
5749                         echo "$ar didn't seem to work right." >&4
5750                         echo "Maybe this is a Cray...trying bld instead..." >&4
5751                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5752                         then
5753                                 for thisname in $libnames; do
5754                                         bld t $libnames | \
5755                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5756                                         $ar t $thisname >>libc.tmp
5757                                 done
5758                                 echo "Ok." >&4
5759                         else
5760                                 echo "That didn't work either.  Giving up." >&4
5761                                 exit 1
5762                         fi
5763                 fi
5764         fi
5765 fi
5766 nm_extract="$com"
5767 if $test -f /lib/syscalls.exp; then
5768         echo " "
5769         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5770         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5771 fi
5772 ;;
5773 esac
5774 $rm -f libnames libpath
5775
5776 : is a C symbol defined?
5777 csym='tlook=$1;
5778 case "$3" in
5779 -v) tf=libc.tmp; tc=""; tdc="";;
5780 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5781 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5782 esac;
5783 tx=yes;
5784 case "$reuseval-$4" in
5785 true-) ;;
5786 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5787 esac;
5788 case "$tx" in
5789 yes)
5790         case "$runnm" in
5791         true)
5792                 if $contains $tlook $tf >/dev/null 2>&1;
5793                 then tval=true;
5794                 else tval=false;
5795                 fi;;
5796         *)
5797                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5798                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5799                 then tval=true;
5800                 else tval=false;
5801                 fi;
5802                 $rm -f t t.c;;
5803         esac;;
5804 *)
5805         case "$tval" in
5806         $define) tval=true;;
5807         *) tval=false;;
5808         esac;;
5809 esac;
5810 eval "$2=$tval"'
5811
5812 : define an is-in-libc? function
5813 inlibc='echo " "; td=$define; tu=$undef;
5814 sym=$1; var=$2; eval "was=\$$2";
5815 tx=yes;
5816 case "$reuseval$was" in
5817 true) ;;
5818 true*) tx=no;;
5819 esac;
5820 case "$tx" in
5821 yes)
5822         set $sym tres -f;
5823         eval $csym;
5824         case "$tres" in
5825         true)
5826                 echo "$sym() found." >&4;
5827                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5828         *)
5829                 echo "$sym() NOT found." >&4;
5830                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5831         esac;;
5832 *)
5833         case "$was" in
5834         $define) echo "$sym() found." >&4;;
5835         *) echo "$sym() NOT found." >&4;;
5836         esac;;
5837 esac'
5838
5839 : see if sqrtl exists
5840 set sqrtl d_sqrtl
5841 eval $inlibc
5842
5843 : check for length of double
5844 echo " "
5845 case "$doublesize" in
5846 '')
5847         echo "Checking to see how big your double precision numbers are..." >&4
5848         $cat >try.c <<'EOCP'
5849 #include <stdio.h>
5850 int main()
5851 {
5852     printf("%d\n", (int)sizeof(double));
5853     exit(0);
5854 }
5855 EOCP
5856         set try
5857         if eval $compile_ok; then
5858                 doublesize=`$run ./try`
5859                 echo "Your double is $doublesize bytes long."
5860         else
5861                 dflt='8'
5862                 echo "(I can't seem to compile the test program.  Guessing...)"
5863                 rp="What is the size of a double precision number (in bytes)?"
5864                 . ./myread
5865                 doublesize="$ans"
5866         fi
5867         ;;
5868 esac
5869 $rm -f try.c try
5870
5871 : check for long doubles
5872 echo " "
5873 echo "Checking to see if you have long double..." >&4
5874 echo 'int main() { long double x = 7.0; }' > try.c
5875 set try
5876 if eval $compile; then
5877         val="$define"
5878         echo "You have long double."
5879 else
5880         val="$undef"
5881         echo "You do not have long double."
5882 fi
5883 $rm try.*
5884 set d_longdbl
5885 eval $setvar
5886
5887 : check for length of long double
5888 case "${d_longdbl}${longdblsize}" in
5889 $define)
5890         echo " "
5891         echo "Checking to see how big your long doubles are..." >&4
5892         $cat >try.c <<'EOCP'
5893 #include <stdio.h>
5894 int main()
5895 {
5896         printf("%d\n", sizeof(long double));
5897 }
5898 EOCP
5899         set try
5900         set try
5901         if eval $compile; then
5902                 longdblsize=`$run ./try`
5903                 echo "Your long doubles are $longdblsize bytes long."
5904         else
5905                 dflt='8'
5906                 echo " "
5907                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5908                 rp="What is the size of a long double (in bytes)?"
5909                 . ./myread
5910                 longdblsize="$ans"
5911         fi
5912         if $test "X$doublesize" = "X$longdblsize"; then
5913                 echo "(That isn't any different from an ordinary double.)"
5914         fi      
5915         ;;
5916 esac
5917 $rm -f try.* try
5918
5919 echo " "
5920
5921 if $test X"$d_longdbl" = X"$define"; then
5922
5923 echo "Checking how to print long doubles..." >&4
5924
5925 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5926         $cat >try.c <<'EOCP'
5927 #include <sys/types.h>
5928 #include <stdio.h>
5929 int main() {
5930   double d = 123.456;
5931   printf("%.3f\n", d);
5932 }
5933 EOCP
5934         set try
5935         if eval $compile; then
5936                 yyy=`$run ./try`
5937                 case "$yyy" in
5938                 123.456)
5939                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5940                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5941                         echo "We will use %f."
5942                         ;;
5943                 esac
5944         fi
5945 fi
5946
5947 if $test X"$sPRIfldbl" = X; then
5948         $cat >try.c <<'EOCP'
5949 #include <sys/types.h>
5950 #include <stdio.h>
5951 int main() {
5952   long double d = 123.456;
5953   printf("%.3Lf\n", d);
5954 }
5955 EOCP
5956         set try
5957         if eval $compile; then
5958                 yyy=`$run ./try`
5959                 case "$yyy" in
5960                 123.456)
5961                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5962                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5963                         echo "We will use %Lf."
5964                         ;;
5965                 esac
5966         fi
5967 fi
5968
5969 if $test X"$sPRIfldbl" = X; then
5970         $cat >try.c <<'EOCP'
5971 #include <sys/types.h>
5972 #include <stdio.h>
5973 int main() {
5974   long double d = 123.456;
5975   printf("%.3llf\n", d);
5976 }
5977 EOCP
5978         set try
5979         if eval $compile; then
5980                 yyy=`$run ./try`
5981                 case "$yyy" in
5982                 123.456)
5983                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5984                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5985                         echo "We will use %llf."
5986                         ;;
5987                 esac
5988         fi
5989 fi
5990
5991 if $test X"$sPRIfldbl" = X; then
5992         $cat >try.c <<'EOCP'
5993 #include <sys/types.h>
5994 #include <stdio.h>
5995 int main() {
5996   long double d = 123.456;
5997   printf("%.3lf\n", d);
5998 }
5999 EOCP
6000         set try
6001         if eval $compile; then
6002                 yyy=`$run ./try`
6003                 case "$yyy" in
6004                 123.456)
6005                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6006                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6007                         echo "We will use %lf."
6008                         ;;
6009                 esac
6010         fi
6011 fi
6012
6013 if $test X"$sPRIfldbl" = X; then
6014         echo "Cannot figure out how to print long doubles." >&4
6015 else
6016         sSCNfldbl=$sPRIfldbl    # expect consistency
6017 fi
6018
6019 $rm -f try try.*
6020
6021 fi # d_longdbl
6022
6023 case "$sPRIfldbl" in
6024 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6025         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6026         d_SCNfldbl="$undef";
6027         ;;
6028 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6029         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6030         d_SCNfldbl="$define";
6031         ;;
6032 esac
6033
6034 : see if modfl exists
6035 set modfl d_modfl
6036 eval $inlibc
6037
6038
6039 hasproto='varname=$1; func=$2; shift; shift;
6040 while $test $# -ge 2; do
6041         case "$1" in
6042         $define) echo "#include <$2>";;
6043         esac ;
6044     shift 2;
6045 done > try.c;
6046 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
6047 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
6048         echo "$func() prototype found.";
6049         val="$define";
6050 else
6051         echo "$func() prototype NOT found.";
6052         val="$undef";
6053 fi;
6054 set $varname;
6055 eval $setvar;
6056 $rm -f try.c tryout.c'
6057
6058 : see if prototype for modfl is available
6059 echo " "
6060 set d_modflproto modfl math.h
6061 eval $hasproto
6062
6063 d_modfl_pow32_bug="$undef"
6064
6065 case "$d_longdbl$d_modfl" in
6066 $define$define)
6067         $cat <<EOM
6068 Checking to see whether your modfl() is okay for large values...
6069 EOM
6070 $cat >try.c <<EOCP
6071 #include <math.h> 
6072 #include <stdio.h>
6073 EOCP
6074 if $test "X$d_modflproto" != "X$define"; then
6075         $cat >>try.c <<EOCP
6076 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6077 long double modfl (long double, long double *);
6078 EOCP
6079 fi
6080 $cat >>try.c <<EOCP
6081 int main() {
6082     long double nv = 4294967303.15;
6083     long double v, w;
6084     v = modfl(nv, &w);         
6085 #ifdef __GLIBC__
6086     printf("glibc");
6087 #endif
6088     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6089     return 0;
6090 }
6091 EOCP
6092         case "$osname:$gccversion" in
6093         aix:)   saveccflags="$ccflags"
6094                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6095         esac
6096         set try
6097         if eval $compile; then
6098                 foo=`$run ./try`
6099                 case "$foo" in
6100                 *" 4294967303.150000 1.150000 4294967302.000000")
6101                         echo >&4 "Your modfl() is broken for large values."
6102                         d_modfl_pow32_bug="$define"
6103                         case "$foo" in
6104                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6105                         ;;
6106                         esac
6107                         ;;
6108                 *" 4294967303.150000 0.150000 4294967303.000000")
6109                         echo >&4 "Your modfl() seems okay for large values."
6110                         ;;
6111                 *)      echo >&4 "I don't understand your modfl() at all."
6112                         d_modfl="$undef"
6113                         ;;
6114                 esac
6115                 $rm -f try.* try core core.try.*
6116         else
6117                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6118                 d_modfl="$undef"
6119         fi
6120         case "$osname:$gccversion" in
6121         aix:)   ccflags="$saveccflags" ;; # restore
6122         esac
6123         ;;
6124 esac
6125
6126 case "$ccflags" in
6127 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6128 esac
6129
6130 case "$uselongdouble" in
6131 $define|true|[yY]*)     dflt='y';;
6132 *) dflt='n';;
6133 esac
6134 cat <<EOM
6135
6136 Perl can be built to take advantage of long doubles which
6137 (if available) may give more accuracy and range for floating point numbers.
6138
6139 If this doesn't make any sense to you, just accept the default '$dflt'.
6140 EOM
6141 rp='Try to use long doubles if available?'
6142 . ./myread
6143 case "$ans" in
6144 y|Y)    val="$define"   ;;
6145 *)      val="$undef"    ;;
6146 esac
6147 set uselongdouble
6148 eval $setvar
6149
6150 case "$uselongdouble" in
6151 true|[yY]*) uselongdouble="$define" ;;
6152 esac
6153
6154 case "$uselongdouble" in
6155 $define)
6156 : Look for a hint-file generated 'call-back-unit'.  If the
6157 : user has specified that long doubles should be used,
6158 : we may need to set or change some other defaults.
6159         if $test -f uselongdouble.cbu; then
6160                 echo "Your platform has some specific hints for long doubles, using them..."
6161                 . ./uselongdouble.cbu
6162         else
6163                 $cat <<EOM
6164 (Your platform doesn't have any specific hints for long doubles.)
6165 EOM
6166         fi
6167         ;;
6168 esac
6169
6170 message=X
6171 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6172 $define:$define:$define)
6173         : You have both
6174         ;;
6175 $define:$define:$undef)
6176         message="I could not find modfl"
6177         ;;
6178 $define:$undef:$define)
6179         message="I could not find sqrtl"
6180         ;;
6181 $define:$undef:$undef)
6182         message="I found neither sqrtl nor modfl"
6183         ;;
6184 esac
6185
6186 if $test "$message" != X; then
6187         $cat <<EOM >&4
6188
6189 *** You requested the use of long doubles but you do not seem to have
6190 *** the mathematic functions for long doubles.
6191 *** ($message)
6192 *** I'm disabling the use of long doubles.
6193
6194 EOM
6195
6196         uselongdouble=$undef
6197 fi
6198
6199 : determine the architecture name
6200 echo " "
6201 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6202         tarch=`arch`"-$osname"
6203 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6204         if uname -m > tmparch 2>&1 ; then
6205                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6206                         -e 's/$/'"-$osname/" tmparch`
6207         else
6208                 tarch="$osname"
6209         fi
6210         $rm -f tmparch
6211 else
6212         tarch="$osname"
6213 fi
6214 case "$myarchname" in
6215 ''|"$tarch") ;;
6216 *)
6217         echo "(Your architecture name used to be $myarchname.)"
6218         archname=''
6219         ;;
6220 esac
6221 case "$targetarch" in
6222 '') ;;
6223 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6224 esac
6225 myarchname="$tarch"
6226 case "$archname" in
6227 '') dflt="$tarch";;
6228 *) dflt="$archname";;
6229 esac
6230 rp='What is your architecture name'
6231 . ./myread
6232 archname="$ans"
6233 case "$usethreads" in
6234 $define)
6235         echo "Threads selected." >&4
6236         case "$archname" in
6237         *-thread*) echo "...and architecture name already has -thread." >&4
6238                 ;;
6239         *)      archname="$archname-thread"
6240                 echo "...setting architecture name to $archname." >&4
6241                 ;;
6242         esac
6243         ;;
6244 esac
6245 case "$usemultiplicity" in
6246 $define)
6247         echo "Multiplicity selected." >&4
6248         case "$archname" in
6249         *-multi*) echo "...and architecture name already has -multi." >&4
6250                 ;;
6251         *)      archname="$archname-multi"
6252                 echo "...setting architecture name to $archname." >&4
6253                 ;;
6254         esac
6255         ;;
6256 esac
6257 case "$use64bitint$use64bitall" in
6258 *"$define"*)
6259         case "$archname64" in
6260         '')
6261                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6262                 ;;
6263         *)
6264                 case "$use64bitint" in
6265                 "$define") echo "64 bit integers selected." >&4 ;;
6266                 esac
6267                 case "$use64bitall" in
6268                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6269                 esac
6270                 case "$archname" in
6271                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6272                         ;;
6273                 *)      archname="$archname-$archname64"
6274                         echo "...setting architecture name to $archname." >&4
6275                         ;;
6276                 esac
6277                 ;;
6278         esac
6279 esac
6280 case "$uselongdouble" in
6281 $define)
6282         echo "Long doubles selected." >&4
6283         case "$longdblsize" in
6284         $doublesize)
6285                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6286                 ;;
6287         *)
6288                 case "$archname" in
6289                 *-ld*) echo "...and architecture name already has -ld." >&4
6290                         ;;
6291                 *)      archname="$archname-ld"
6292                         echo "...setting architecture name to $archname." >&4
6293                         ;;
6294                 esac
6295                 ;;
6296         esac
6297         ;;
6298 esac
6299 case "$useperlio" in
6300 $define)
6301         echo "Perlio selected." >&4
6302         ;;
6303 *)
6304         echo "Perlio not selected, using stdio." >&4
6305         case "$archname" in
6306         *-stdio*) echo "...and architecture name already has -stdio." >&4
6307                 ;;
6308         *)      archname="$archname-stdio"
6309                 echo "...setting architecture name to $archname." >&4
6310                 ;;
6311         esac
6312         ;;
6313 esac
6314
6315 : determine root of directory hierarchy where package will be installed.
6316 case "$prefix" in
6317 '')
6318         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6319         ;;
6320 *)
6321         dflt="$prefix"
6322         ;;
6323 esac
6324 $cat <<EOM
6325
6326 By default, $package will be installed in $dflt/bin, manual pages
6327 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6328 installation directories. Typically this is something like /usr/local.
6329 If you wish to have binaries under /usr/bin but other parts of the
6330 installation under /usr/local, that's ok: you will be prompted
6331 separately for each of the installation directories, the prefix being
6332 only used to set the defaults.
6333
6334 EOM
6335 fn=d~
6336 rp='Installation prefix to use?'
6337 . ./getfile
6338 oldprefix=''
6339 case "$prefix" in
6340 '') ;;
6341 *)
6342         case "$ans" in
6343         "$prefix") ;;
6344         *) oldprefix="$prefix";;
6345         esac
6346         ;;
6347 esac
6348 prefix="$ans"
6349 prefixexp="$ansexp"
6350
6351 case "$afsroot" in
6352 '')     afsroot=/afs ;;
6353 *)      afsroot=$afsroot ;;
6354 esac
6355
6356 : is AFS running?
6357 echo " "
6358 case "$afs" in
6359 $define|true)   afs=true ;;
6360 $undef|false)   afs=false ;;
6361 *)      if test -d $afsroot; then
6362                 afs=true
6363         else
6364                 afs=false
6365         fi
6366         ;;
6367 esac
6368 if $afs; then
6369         echo "AFS may be running... I'll be extra cautious then..." >&4
6370 else
6371         echo "AFS does not seem to be running..." >&4
6372 fi
6373
6374 : determine installation prefix for where package is to be installed.
6375 if $afs; then 
6376 $cat <<EOM
6377
6378 Since you are running AFS, I need to distinguish the directory in which
6379 files will reside from the directory in which they are installed (and from
6380 which they are presumably copied to the former directory by occult means).
6381
6382 EOM
6383         case "$installprefix" in
6384         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6385         *) dflt="$installprefix";;
6386         esac
6387 else
6388 $cat <<EOM
6389
6390 In some special cases, particularly when building $package for distribution,
6391 it is convenient to distinguish between the directory in which files should 
6392 be installed from the directory ($prefix) in which they 
6393 will eventually reside.  For most users, these two directories are the same.
6394
6395 EOM
6396         case "$installprefix" in
6397         '') dflt=$prefix ;;
6398         *) dflt=$installprefix;;
6399         esac
6400 fi
6401 fn=d~
6402 rp='What installation prefix should I use for installing files?'
6403 . ./getfile
6404 installprefix="$ans"
6405 installprefixexp="$ansexp"
6406
6407 : set the prefixit variable, to compute a suitable default value
6408 prefixit='case "$3" in
6409 ""|none)
6410         case "$oldprefix" in
6411         "") eval "$1=\"\$$2\"";;
6412         *)
6413                 case "$3" in
6414                 "") eval "$1=";;
6415                 none)
6416                         eval "tp=\"\$$2\"";
6417                         case "$tp" in
6418                         ""|" ") eval "$1=\"\$$2\"";;
6419                         *) eval "$1=";;
6420                         esac;;
6421                 esac;;
6422         esac;;
6423 *)
6424         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6425         case "$tp" in
6426         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6427         /*-$oldprefix/*|\~*-$oldprefix/*)
6428                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6429         *) eval "$1=\"\$$2\"";;
6430         esac;;
6431 esac'
6432
6433 : get the patchlevel
6434 echo " "
6435 echo "Getting the current patchlevel..." >&4
6436 if $test -r $rsrc/patchlevel.h;then
6437         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6438         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6439         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6440         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6441         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6442         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6443        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6444 else
6445         revision=0
6446         patchlevel=0
6447         subversion=0
6448         api_revision=0
6449         api_version=0
6450         api_subversion=0
6451         perl_patchlevel=0
6452         $echo "(You do not have patchlevel.h.  Eek.)"
6453 fi
6454 if $test -r $rsrc/.patch ; then  
6455         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6456                 perl_patchlevel=`cat $rsrc/.patch`
6457         fi
6458 fi
6459 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6460 version_patchlevel_string="version $patchlevel subversion $subversion"
6461 case "$perl_patchlevel" in
6462 0|'') ;;
6463 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6464 esac
6465
6466 $echo "(You have $package $version_patchlevel_string.)"
6467
6468 case "$osname" in
6469 dos|vms)
6470         : XXX Should be a Configure test for double-dots in filenames.
6471         version=`echo $revision $patchlevel $subversion | \
6472                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6473         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6474                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6475         ;;
6476 *)
6477         version=`echo $revision $patchlevel $subversion | \
6478                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6479         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6480                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6481         ;;
6482 esac
6483 : Special case the 5.005_xx maintenance series, which used 5.005
6484 : without any subversion label as a subdirectory in $sitelib
6485 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6486         api_versionstring='5.005'
6487 fi
6488
6489 : determine installation style
6490 : For now, try to deduce it from prefix unless it is already set.
6491 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6492 case "$installstyle" in
6493 '')     case "$prefix" in
6494                 *perl*) dflt='lib';;
6495                 *) dflt='lib/perl5' ;;
6496         esac
6497         ;;
6498 *)      dflt="$installstyle" ;;
6499 esac
6500 : Probably not worth prompting for this since we prompt for all
6501 : the directories individually, and the prompt would be too long and
6502 : confusing anyway.
6503 installstyle=$dflt
6504
6505 : determine where private library files go
6506 : Usual default is /usr/local/lib/perl5/$version.
6507 : Also allow things like /opt/perl/lib/$version, since 
6508 : /opt/perl/lib/perl5... would be redundant.
6509 : The default "style" setting is made in installstyle.U
6510 case "$installstyle" in
6511 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6512 *)       set dflt privlib lib/$version ;;
6513 esac
6514 eval $prefixit
6515 $cat <<EOM
6516
6517 There are some auxiliary files for $package that need to be put into a
6518 private library directory that is accessible by everyone.
6519
6520 EOM
6521 fn=d~+
6522 rp='Pathname where the private library files will reside?'
6523 . ./getfile
6524 privlib="$ans"
6525 privlibexp="$ansexp"
6526 : Change installation prefix, if necessary.
6527 if $test X"$prefix" != X"$installprefix"; then
6528         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6529 else
6530         installprivlib="$privlibexp"
6531 fi
6532
6533 : set the prefixup variable, to restore leading tilda escape
6534 prefixup='case "$prefixexp" in
6535 "$prefix") ;;
6536 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6537 esac'
6538
6539 : determine where public architecture dependent libraries go
6540 set archlib archlib
6541 eval $prefixit
6542 : privlib default is /usr/local/lib/$package/$version
6543 : archlib default is /usr/local/lib/$package/$version/$archname
6544 : privlib may have an optional trailing /share.
6545 tdflt=`echo $privlib | $sed 's,/share$,,'`
6546 tdflt=$tdflt/$archname
6547 case "$archlib" in
6548 '')     dflt=$tdflt
6549         ;;
6550 *)      dflt="$archlib"
6551     ;;
6552 esac
6553 $cat <<EOM
6554
6555 $spackage contains architecture-dependent library files.  If you are
6556 sharing libraries in a heterogeneous environment, you might store
6557 these files in a separate location.  Otherwise, you can just include
6558 them with the rest of the public library files.
6559
6560 EOM
6561 fn=d+~
6562 rp='Where do you want to put the public architecture-dependent libraries?'
6563 . ./getfile
6564 archlib="$ans"
6565 archlibexp="$ansexp"
6566 if $test X"$archlib" = X"$privlib"; then
6567         d_archlib="$undef"
6568 else
6569         d_archlib="$define"
6570 fi
6571 : Change installation prefix, if necessary.
6572 if $test X"$prefix" != X"$installprefix"; then
6573         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6574 else
6575         installarchlib="$archlibexp"
6576 fi
6577
6578 : see if setuid scripts can be secure
6579 $cat <<EOM
6580
6581 Some kernels have a bug that prevents setuid #! scripts from being
6582 secure.  Some sites have disabled setuid #! scripts because of this.
6583
6584 First let's decide if your kernel supports secure setuid #! scripts.
6585 (If setuid #! scripts would be secure but have been disabled anyway,
6586 don't say that they are secure if asked.)
6587
6588 EOM
6589
6590 val="$undef"
6591 if $test -d /dev/fd; then
6592         echo "#!$ls" >reflect
6593         chmod +x,u+s reflect
6594         ./reflect >flect 2>&1
6595         if $contains "/dev/fd" flect >/dev/null; then
6596                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6597                 val="$define"
6598         else
6599                 $cat <<EOM
6600 If you are not sure if they are secure, I can check but I'll need a
6601 username and password different from the one you are using right now.
6602 If you don't have such a username or don't want me to test, simply
6603 enter 'none'.
6604
6605 EOM
6606                 rp='Other username to test security of setuid scripts with?'
6607                 dflt='none'
6608                 . ./myread
6609                 case "$ans" in
6610                 n|none)
6611                         case "$d_suidsafe" in
6612                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6613                                 dflt=n;;
6614                         "$undef")
6615                                 echo "Well, the $hint value is *not* secure." >&4
6616                                 dflt=n;;
6617                         *)      echo "Well, the $hint value *is* secure." >&4
6618                                 dflt=y;;
6619                         esac
6620                         ;;
6621                 *)
6622                         $rm -f reflect flect
6623                         echo "#!$ls" >reflect
6624                         chmod +x,u+s reflect
6625                         echo >flect
6626                         chmod a+w flect
6627                         echo '"su" will (probably) prompt you for '"$ans's password."
6628                         su $ans -c './reflect >flect'
6629                         if $contains "/dev/fd" flect >/dev/null; then
6630                                 echo "Okay, it looks like setuid scripts are secure." >&4
6631                                 dflt=y
6632                         else
6633                                 echo "I don't think setuid scripts are secure." >&4
6634                                 dflt=n
6635                         fi
6636                         ;;
6637                 esac
6638                 rp='Does your kernel have *secure* setuid scripts?'
6639                 . ./myread
6640                 case "$ans" in
6641                 [yY]*)  val="$define";;
6642                 *)      val="$undef";;
6643                 esac
6644         fi
6645 else
6646         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6647         echo "(That's for file descriptors, not floppy disks.)"
6648         val="$undef"
6649 fi
6650 set d_suidsafe
6651 eval $setvar
6652
6653 $rm -f reflect flect
6654
6655 : now see if they want to do setuid emulation
6656 echo " "
6657 val="$undef"
6658 case "$d_suidsafe" in
6659 "$define")
6660         val="$undef"
6661         echo "No need to emulate SUID scripts since they are secure here." >&4
6662         ;;
6663 *)
6664         $cat <<EOM
6665 Some systems have disabled setuid scripts, especially systems where
6666 setuid scripts cannot be secure.  On systems where setuid scripts have
6667 been disabled, the setuid/setgid bits on scripts are currently
6668 useless.  It is possible for $package to detect those bits and emulate
6669 setuid/setgid in a secure fashion.  This emulation will only work if
6670 setuid scripts have been disabled in your kernel.
6671
6672 EOM
6673         case "$d_dosuid" in
6674         "$define") dflt=y ;;
6675         *) dflt=n ;;
6676         esac
6677         rp="Do you want to do setuid/setgid emulation?"
6678         . ./myread
6679         case "$ans" in
6680         [yY]*)  val="$define";;
6681         *)      val="$undef";;
6682         esac
6683         ;;
6684 esac
6685 set d_dosuid
6686 eval $setvar
6687
6688 : see if this is a malloc.h system
6689 set malloc.h i_malloc
6690 eval $inhdr
6691
6692 : see if stdlib is available
6693 set stdlib.h i_stdlib
6694 eval $inhdr
6695
6696 : check for void type
6697 echo " "
6698 echo "Checking to see how well your C compiler groks the void type..." >&4
6699 case "$voidflags" in
6700 '')
6701         $cat >try.c <<'EOCP'
6702 #if TRY & 1
6703 void sub() {
6704 #else
6705 sub() {
6706 #endif
6707         extern void moo();      /* function returning void */
6708         void (*goo)();          /* ptr to func returning void */
6709 #if TRY & 8
6710         void *hue;              /* generic ptr */
6711 #endif
6712 #if TRY & 2
6713         void (*foo[10])();
6714 #endif
6715
6716 #if TRY & 4
6717         if(goo == moo) {
6718                 exit(0);
6719         }
6720 #endif
6721         exit(0);
6722 }
6723 int main() { sub(); }
6724 EOCP
6725         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6726                 voidflags=$defvoidused
6727         echo "Good.  It appears to support void to the level $package wants.">&4
6728                 if $contains warning .out >/dev/null 2>&1; then
6729                         echo "However, you might get some warnings that look like this:"
6730                         $cat .out
6731                 fi
6732         else
6733 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6734                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6735                         echo "It supports 1..."
6736                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6737                                 echo "It also supports 2..."
6738                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6739                                         voidflags=7
6740                                         echo "And it supports 4 but not 8 definitely."
6741                                 else
6742                                         echo "It doesn't support 4..."
6743                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6744                                                 voidflags=11
6745                                                 echo "But it supports 8."
6746                                         else
6747                                                 voidflags=3
6748                                                 echo "Neither does it support 8."
6749                                         fi
6750                                 fi
6751                         else
6752                                 echo "It does not support 2..."
6753                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6754                                         voidflags=13
6755                                         echo "But it supports 4 and 8."
6756                                 else
6757                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6758                                                 voidflags=5
6759                                                 echo "And it supports 4 but has not heard about 8."
6760                                         else
6761                                                 echo "However it supports 8 but not 4."
6762                                         fi
6763                                 fi
6764                         fi
6765                 else
6766                         echo "There is no support at all for void."
6767                         voidflags=0
6768                 fi
6769         fi
6770 esac
6771 case "$voidflags" in
6772 "$defvoidused") ;;
6773 *)      $cat >&4 <<'EOM'
6774   Support flag bits are:
6775     1: basic void declarations.
6776     2: arrays of pointers to functions returning void.
6777     4: operations between pointers to and addresses of void functions.
6778     8: generic void pointers.
6779 EOM
6780         dflt="$voidflags";
6781         rp="Your void support flags add up to what?"
6782         . ./myread
6783         voidflags="$ans"
6784         ;;
6785 esac
6786 $rm -f try.* .out
6787
6788 : check for length of pointer
6789 echo " "
6790 case "$ptrsize" in
6791 '')
6792         echo "Checking to see how big your pointers are..." >&4
6793         if test "$voidflags" -gt 7; then
6794                 echo '#define VOID_PTR char *' > try.c
6795         else
6796                 echo '#define VOID_PTR void *' > try.c
6797         fi
6798         $cat >>try.c <<'EOCP'
6799 #include <stdio.h>
6800 int main()
6801 {
6802     printf("%d\n", (int)sizeof(VOID_PTR));
6803     exit(0);
6804 }
6805 EOCP
6806         set try
6807         if eval $compile_ok; then
6808                 ptrsize=`$run ./try`
6809                 echo "Your pointers are $ptrsize bytes long."
6810         else
6811                 dflt='4'
6812                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6813                 rp="What is the size of a pointer (in bytes)?"
6814                 . ./myread
6815                 ptrsize="$ans"
6816         fi
6817         ;;
6818 esac
6819 $rm -f try.c try
6820 case "$use64bitall" in
6821 "$define"|true|[yY]*)
6822         case "$ptrsize" in
6823         4)      cat <<EOM >&4
6824
6825 *** You have chosen a maximally 64-bit build, but your pointers
6826 *** are only 4 bytes wide, disabling maximal 64-bitness.
6827
6828 EOM
6829                 use64bitall="$undef"
6830                 case "$use64bitint" in
6831                 "$define"|true|[yY]*) ;;
6832                 *)      cat <<EOM >&4
6833
6834 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6835
6836 EOM
6837                         use64bitint="$define"
6838                         ;;
6839                 esac
6840                 ;;
6841         esac
6842         ;;
6843 esac
6844
6845
6846 : determine which malloc to compile in
6847 echo " "
6848 case "$usemymalloc" in
6849 [yY]*|true|$define)     dflt='y' ;;
6850 [nN]*|false|$undef)     dflt='n' ;;
6851 *)      case "$ptrsize" in
6852         4) dflt='y' ;;
6853         *) dflt='n' ;;
6854         esac
6855         ;;
6856 esac
6857 rp="Do you wish to attempt to use the malloc that comes with $package?"
6858 . ./myread
6859 usemymalloc="$ans"
6860 case "$ans" in
6861 y*|true)
6862         usemymalloc='y'
6863         mallocsrc='malloc.c'
6864         mallocobj="malloc$_o"
6865         d_mymalloc="$define"
6866         case "$libs" in
6867         *-lmalloc*)
6868                 : Remove malloc from list of libraries to use
6869                 echo "Removing unneeded -lmalloc from library list" >&4
6870                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6871                 shift
6872                 libs="$*"
6873                 echo "libs = $libs" >&4
6874                 ;;
6875         esac
6876         ;;
6877 *)
6878         usemymalloc='n'
6879         mallocsrc=''
6880         mallocobj=''
6881         d_mymalloc="$undef"
6882         ;;
6883 esac
6884
6885 : compute the return types of malloc and free
6886 echo " "
6887 $cat >malloc.c <<END
6888 #$i_malloc I_MALLOC
6889 #$i_stdlib I_STDLIB
6890 #include <stdio.h>
6891 #include <sys/types.h>
6892 #ifdef I_MALLOC
6893 #include <malloc.h>
6894 #endif
6895 #ifdef I_STDLIB
6896 #include <stdlib.h>
6897 #endif
6898 #ifdef TRY_MALLOC
6899 void *malloc();
6900 #endif
6901 #ifdef TRY_FREE
6902 void free();
6903 #endif
6904 END
6905 case "$malloctype" in
6906 '')
6907         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6908                 malloctype='void *'
6909         else
6910                 malloctype='char *'
6911         fi
6912         ;;
6913 esac
6914 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6915
6916 case "$freetype" in
6917 '')
6918         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6919                 freetype='void'
6920         else
6921                 freetype='int'
6922         fi
6923         ;;
6924 esac
6925 echo "Your system uses $freetype free(), it would seem." >&4
6926 $rm -f malloc.[co]
6927 $cat <<EOM
6928
6929 After $package is installed, you may wish to install various
6930 add-on modules and utilities.  Typically, these add-ons will
6931 be installed under $prefix with the rest
6932 of this package.  However, you may wish to install such add-ons
6933 elsewhere under a different prefix.
6934
6935 If you do not wish to put everything under a single prefix, that's
6936 ok.  You will be prompted for the individual locations; this siteprefix
6937 is only used to suggest the defaults.
6938
6939 The default should be fine for most people.
6940
6941 EOM
6942 fn=d~+
6943 rp='Installation prefix to use for add-on modules and utilities?'
6944 : XXX Here might be another good place for an installstyle setting.
6945 case "$siteprefix" in
6946 '') dflt=$prefix ;;
6947 *)  dflt=$siteprefix ;;
6948 esac
6949 . ./getfile
6950 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6951 oldsiteprefix=''
6952 case "$siteprefix" in
6953 '') ;;
6954 *)      case "$ans" in
6955         "$prefix") ;;
6956         *) oldsiteprefix="$prefix";;
6957         esac
6958         ;;
6959 esac
6960 siteprefix="$ans"
6961 siteprefixexp="$ansexp"
6962
6963 : determine where site specific libraries go.
6964 : Usual default is /usr/local/lib/perl5/site_perl/$version
6965 : The default "style" setting is made in installstyle.U
6966 : XXX No longer works with Prefixit stuff.
6967 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6968 case "$sitelib" in
6969 '') case "$installstyle" in
6970         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6971         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6972         esac
6973         ;;
6974 *)      dflt="$sitelib"
6975         ;;
6976 esac
6977 $cat <<EOM
6978
6979 The installation process will create a directory for
6980 site-specific extensions and modules.  Most users find it convenient
6981 to place all site-specific files in this directory rather than in the
6982 main distribution directory.
6983
6984 EOM
6985 fn=d~+
6986 rp='Pathname for the site-specific library files?'
6987 . ./getfile
6988 sitelib="$ans"
6989 sitelibexp="$ansexp"
6990 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6991 : Change installation prefix, if necessary.
6992 if $test X"$prefix" != X"$installprefix"; then
6993         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6994 else
6995         installsitelib="$sitelibexp"
6996 fi
6997
6998 : determine where site specific architecture-dependent libraries go.
6999 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7000 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7001 : sitelib may have an optional trailing /share.
7002 case "$sitearch" in
7003 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7004         dflt="$dflt/$archname"
7005         ;;
7006 *)      dflt="$sitearch"
7007         ;;
7008 esac
7009 set sitearch sitearch none
7010 eval $prefixit
7011 $cat <<EOM
7012
7013 The installation process will also create a directory for
7014 architecture-dependent site-specific extensions and modules.
7015
7016 EOM
7017 fn=d~+
7018 rp='Pathname for the site-specific architecture-dependent library files?'
7019 . ./getfile
7020 sitearch="$ans"
7021 sitearchexp="$ansexp"
7022 : Change installation prefix, if necessary.
7023 if $test X"$prefix" != X"$installprefix"; then
7024         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7025 else
7026         installsitearch="$sitearchexp"
7027 fi
7028
7029 $cat <<EOM
7030
7031 The installation process will also create a directory for
7032 vendor-supplied add-ons.  Vendors who supply perl with their system
7033 may find it convenient to place all vendor-supplied files in this
7034 directory rather than in the main distribution directory.  This will
7035 ease upgrades between binary-compatible maintenance versions of perl.
7036
7037 Of course you may also use these directories in whatever way you see
7038 fit.  For example, you might use them to access modules shared over a
7039 company-wide network.
7040
7041 The default answer should be fine for most people.
7042 This causes further questions about vendor add-ons to be skipped
7043 and no vendor-specific directories will be configured for perl.
7044
7045 EOM
7046 rp='Do you want to configure vendor-specific add-on directories?'
7047 case "$usevendorprefix" in
7048 define|true|[yY]*) dflt=y ;;
7049 *)      : User may have set vendorprefix directly on Configure command line.
7050         case "$vendorprefix" in
7051         ''|' ') dflt=n ;;
7052         *)      dflt=y ;;
7053         esac
7054         ;;
7055 esac
7056 . ./myread
7057 case "$ans" in
7058 [yY]*)  fn=d~+
7059         rp='Installation prefix to use for vendor-supplied add-ons?'
7060         case "$vendorprefix" in
7061         '') dflt='' ;;
7062         *)  dflt=$vendorprefix ;;
7063         esac
7064         . ./getfile
7065         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7066         oldvendorprefix=''
7067         case "$vendorprefix" in
7068         '') ;;
7069         *)      case "$ans" in
7070                 "$prefix") ;;
7071                 *) oldvendorprefix="$prefix";;
7072                 esac
7073                 ;;
7074         esac
7075         usevendorprefix="$define"
7076         vendorprefix="$ans"
7077         vendorprefixexp="$ansexp"
7078         ;;
7079 *)      usevendorprefix="$undef"
7080         vendorprefix=''
7081         vendorprefixexp=''
7082         ;;
7083 esac
7084
7085 case "$vendorprefix" in
7086 '')     d_vendorlib="$undef"
7087         vendorlib=''
7088         vendorlibexp=''
7089         ;;
7090 *)      d_vendorlib="$define"
7091         : determine where vendor-supplied modules go.
7092         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7093         case "$vendorlib" in
7094         '')
7095                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7096                 case "$installstyle" in
7097                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7098                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7099                 esac
7100                 ;;
7101         *)      dflt="$vendorlib"
7102                 ;;
7103         esac
7104         fn=d~+
7105         rp='Pathname for the vendor-supplied library files?'
7106         . ./getfile
7107         vendorlib="$ans"
7108         vendorlibexp="$ansexp"
7109         ;;
7110 esac
7111 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7112 : Change installation prefix, if necessary.
7113 if $test X"$prefix" != X"$installprefix"; then
7114         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7115 else
7116         installvendorlib="$vendorlibexp"
7117 fi
7118
7119 case "$vendorprefix" in
7120 '')     d_vendorarch="$undef"
7121         vendorarch=''
7122         vendorarchexp=''
7123         ;;
7124 *)      d_vendorarch="$define"
7125         : determine where vendor-supplied architecture-dependent libraries go.
7126         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7127         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7128         : vendorlib may have an optional trailing /share.
7129         case "$vendorarch" in
7130         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7131                 dflt="$dflt/$archname"
7132                 ;;
7133         *)      dflt="$vendorarch" ;;
7134         esac
7135         fn=d~+
7136         rp='Pathname for vendor-supplied architecture-dependent files?'
7137         . ./getfile
7138         vendorarch="$ans"
7139         vendorarchexp="$ansexp"
7140         ;;
7141 esac
7142 : Change installation prefix, if necessary.
7143 if $test X"$prefix" != X"$installprefix"; then
7144         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7145 else
7146         installvendorarch="$vendorarchexp"
7147 fi
7148
7149 : Final catch-all directories to search
7150 $cat <<EOM
7151
7152 Lastly, you can have perl look in other directories for extensions and
7153 modules in addition to those already specified.
7154 These directories will be searched after 
7155         $sitearch 
7156         $sitelib 
7157 EOM
7158 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7159 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7160 echo ' '
7161 case "$otherlibdirs" in
7162 ''|' ') dflt='none' ;;
7163 *)      dflt="$otherlibdirs" ;;
7164 esac
7165 $cat <<EOM
7166 Enter a colon-separated set of extra paths to include in perl's @INC
7167 search path, or enter 'none' for no extra paths.
7168
7169 EOM
7170
7171 rp='Colon-separated list of additional directories for perl to search?'
7172 . ./myread
7173 case "$ans" in
7174 ' '|''|none)    otherlibdirs=' ' ;;     
7175 *)      otherlibdirs="$ans" ;;
7176 esac
7177 case "$otherlibdirs" in
7178 ' ') val=$undef ;;
7179 *)      val=$define ;;
7180 esac
7181 set d_perl_otherlibdirs
7182 eval $setvar
7183
7184 : Cruising for prototypes
7185 echo " "
7186 echo "Checking out function prototypes..." >&4
7187 $cat >prototype.c <<'EOCP'
7188 int main(int argc, char *argv[]) {
7189         exit(0);}
7190 EOCP
7191 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7192         echo "Your C compiler appears to support function prototypes."
7193         val="$define"
7194 else
7195         echo "Your C compiler doesn't seem to understand function prototypes."
7196         val="$undef"
7197 fi
7198 set prototype
7199 eval $setvar
7200 $rm -f prototype*
7201
7202 case "$prototype" in
7203 "$define") ;;
7204 *)      ansi2knr='ansi2knr'
7205         echo " "
7206         cat <<EOM >&4
7207
7208 $me:  FATAL ERROR:
7209 This version of $package can only be compiled by a compiler that 
7210 understands function prototypes.  Unfortunately, your C compiler 
7211         $cc $ccflags
7212 doesn't seem to understand them.  Sorry about that.
7213
7214 If GNU cc is available for your system, perhaps you could try that instead.  
7215
7216 Eventually, we hope to support building Perl with pre-ANSI compilers.
7217 If you would like to help in that effort, please contact <perlbug@perl.org>.
7218
7219 Aborting Configure now.
7220 EOM
7221         exit 2
7222         ;;
7223 esac
7224
7225 : determine where public executables go
7226 echo " "
7227 set dflt bin bin
7228 eval $prefixit
7229 fn=d~
7230 rp='Pathname where the public executables will reside?'
7231 . ./getfile
7232 if $test "X$ansexp" != "X$binexp"; then
7233         installbin=''
7234 fi
7235 bin="$ans"
7236 binexp="$ansexp"
7237 : Change installation prefix, if necessary.
7238 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7239 if $test X"$prefix" != X"$installprefix"; then
7240         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7241 else
7242         installbin="$binexp"
7243 fi
7244
7245 echo " "
7246 case "$extras" in
7247 '') dflt='n';;
7248 *) dflt='y';;
7249 esac
7250 cat <<EOM
7251 Perl can be built with extra modules or bundles of modules which
7252 will be fetched from the CPAN and installed alongside Perl.
7253
7254 Notice that you will need access to the CPAN; either via the Internet,
7255 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7256 be asked later to configure the CPAN.pm module which will in turn do
7257 the installation of the rest of the extra modules or bundles.)
7258
7259 Notice also that if the modules require any external software such as
7260 libraries and headers (the libz library and the zlib.h header for the
7261 Compress::Zlib module, for example) you MUST have any such software
7262 already installed, this configuration process will NOT install such
7263 things for you.
7264
7265 If this doesn't make any sense to you, just accept the default '$dflt'.
7266 EOM
7267 rp='Install any extra modules (y or n)?'
7268 . ./myread
7269 case "$ans" in
7270 y|Y)
7271         cat <<EOM
7272
7273 Please list any extra modules or bundles to be installed from CPAN,
7274 with spaces between the names.  The names can be in any format the
7275 'install' command of CPAN.pm will understand.  (Answer 'none',
7276 without the quotes, to install no extra modules or bundles.)
7277 EOM
7278         rp='Extras?'
7279         dflt="$extras"
7280         . ./myread
7281         extras="$ans"
7282 esac
7283 case "$extras" in
7284 ''|'none')
7285         val=''
7286         $rm -f ../extras.lst
7287         ;;
7288 *)      echo "(Saving the list of extras for later...)"
7289         echo "$extras" > ../extras.lst
7290         val="'$extras'"
7291         ;;
7292 esac
7293 set extras
7294 eval $setvar
7295 echo " "
7296
7297 : Find perl5.005 or later.
7298 echo "Looking for a previously installed perl5.005 or later... "
7299 case "$perl5" in
7300 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7301                 : Check if this perl is recent and can load a simple module
7302                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7303                         perl5=$tdir/perl
7304                         break;
7305                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7306                         perl5=$tdir/perl5
7307                         break;
7308                 fi
7309         done
7310         ;;
7311 *)      perl5="$perl5"
7312         ;;
7313 esac
7314 case "$perl5" in
7315 '')     echo "None found.  That's ok.";;
7316 *)      echo "Using $perl5." ;;
7317 esac
7318
7319 : Determine list of previous versions to include in @INC
7320 $cat > getverlist <<EOPL
7321 #!$perl5 -w
7322 use File::Basename;
7323 \$api_versionstring = "$api_versionstring";
7324 \$version = "$version";
7325 \$stem = "$sitelib_stem";
7326 \$archname = "$archname";
7327 EOPL
7328         $cat >> getverlist <<'EOPL'
7329 # Can't have leading @ because metaconfig interprets it as a command!
7330 ;@inc_version_list=();
7331 # XXX Redo to do opendir/readdir? 
7332 if (-d $stem) {
7333     chdir($stem);
7334     ;@candidates = glob("5.*");
7335 }
7336 else {
7337     ;@candidates = ();
7338 }
7339
7340 # XXX ToDo:  These comparisons must be reworked when two-digit
7341 # subversions come along, so that 5.7.10 compares as greater than
7342 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7343 # widespread that we can use the built-in version vectors rather
7344 # than reinventing them here.  For 5.6.0, however, we must
7345 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7346 foreach $d (@candidates) {
7347     if ($d lt $version) {
7348         if ($d ge $api_versionstring) {
7349             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7350         }
7351         elsif ($d ge "5.005") {
7352             unshift(@inc_version_list, grep { -d } $d);
7353         }
7354     }
7355     else {
7356         # Skip newer version.  I.e. don't look in
7357         # 5.7.0 if we're installing 5.6.1.
7358     }
7359 }
7360
7361 if (@inc_version_list) {
7362     print join(' ', @inc_version_list);
7363 }
7364 else {
7365     # Blank space to preserve value for next Configure run.
7366     print " ";
7367 }
7368 EOPL
7369 chmod +x getverlist
7370 case "$inc_version_list" in
7371 '')     if test -x "$perl5$exe_ext"; then
7372                 dflt=`$perl5 getverlist`
7373         else
7374                 dflt='none'
7375         fi
7376         ;;
7377 $undef) dflt='none' ;;
7378 *)  eval dflt=\"$inc_version_list\" ;;
7379 esac
7380 case "$dflt" in
7381 ''|' ') dflt=none ;;
7382 esac
7383 case "$dflt" in
7384 5.005) dflt=none ;;
7385 esac
7386 $cat <<EOM
7387
7388 In order to ease the process of upgrading, this version of perl 
7389 can be configured to use modules built and installed with earlier 
7390 versions of perl that were installed under $prefix.  Specify here
7391 the list of earlier versions that this version of perl should check.
7392 If Configure detected no earlier versions of perl installed under
7393 $prefix, then the list will be empty.  Answer 'none' to tell perl
7394 to not search earlier versions.
7395
7396 The default should almost always be sensible, so if you're not sure,
7397 just accept the default.
7398 EOM
7399
7400 rp='List of earlier versions to include in @INC?'
7401 . ./myread
7402 case "$ans" in
7403 [Nn]one|''|' ') inc_version_list=' ' ;;
7404 *) inc_version_list="$ans" ;;
7405 esac
7406 case "$inc_version_list" in
7407 ''|' ') 
7408         inc_version_list_init='0';;
7409 *)      inc_version_list_init=`echo $inc_version_list |
7410                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7411         ;;
7412 esac
7413 $rm -f getverlist
7414
7415 : determine whether to install perl also as /usr/bin/perl
7416
7417 echo " "
7418 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7419         $cat <<EOM
7420 Many scripts expect perl to be installed as /usr/bin/perl.
7421 I can install the perl you are about to compile also as /usr/bin/perl
7422 (in addition to $installbin/perl).
7423 EOM
7424         case "$installusrbinperl" in
7425         "$undef"|[nN]*) dflt='n';;
7426         *)              dflt='y';;
7427         esac
7428         rp="Do you want to install perl as /usr/bin/perl?"
7429         . ./myread
7430         case "$ans" in
7431         [yY]*)  val="$define";;
7432         *)      val="$undef" ;;
7433         esac
7434 else
7435         val="$undef"
7436 fi
7437 set installusrbinperl
7438 eval $setvar
7439
7440 : see if dld is available
7441 set dld.h i_dld
7442 eval $inhdr
7443
7444 : see if dlopen exists
7445 xxx_runnm="$runnm"
7446 runnm=false
7447 set dlopen d_dlopen
7448 eval $inlibc
7449 runnm="$xxx_runnm"
7450
7451 : determine which dynamic loading, if any, to compile in
7452 echo " "
7453 dldir="ext/DynaLoader"
7454 case "$usedl" in
7455 $define|y|true)
7456         dflt='y'
7457         usedl="$define"
7458         ;;
7459 $undef|n|false)
7460         dflt='n'
7461         usedl="$undef"
7462         ;;
7463 *) 
7464         dflt='n'
7465         case "$d_dlopen" in
7466             $define) dflt='y' ;;
7467         esac
7468         case "$i_dld" in
7469             $define) dflt='y' ;;
7470         esac
7471         : Does a dl_xxx.xs file exist for this operating system
7472         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7473         ;;
7474 esac
7475 rp="Do you wish to use dynamic loading?"
7476 . ./myread
7477 usedl="$ans"
7478 case "$ans" in
7479 y*) usedl="$define"
7480         case "$dlsrc" in
7481         '')
7482                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7483                         dflt="$dldir/dl_${osname}.xs"
7484                 elif $test "$d_dlopen" = "$define" ; then
7485                         dflt="$dldir/dl_dlopen.xs"
7486                 elif $test "$i_dld" = "$define" ; then
7487                         dflt="$dldir/dl_dld.xs"
7488                 else
7489                         dflt=''
7490                 fi
7491                 ;;
7492         *)      dflt="$dldir/$dlsrc"
7493                 ;;
7494         esac
7495     echo "The following dynamic loading files are available:"
7496         : Can not go over to $dldir because getfile has path hard-coded in.
7497         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7498         rp="Source file to use for dynamic loading"
7499         fn="fne"
7500         gfpth="$src"
7501         . ./getfile
7502         usedl="$define"
7503         : emulate basename
7504         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7505
7506         $cat << EOM
7507
7508 Some systems may require passing special flags to $cc -c to
7509 compile modules that will be used to create a shared library.
7510 To use no flags, say "none".
7511
7512 EOM
7513     case "$cccdlflags" in
7514     '') case "$gccversion" in
7515                 '') case "$osname" in
7516                         hpux)   dflt='+z' ;;
7517                         next)   dflt='none' ;;
7518                         irix*)  dflt='-KPIC' ;;
7519                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7520                         sunos)  dflt='-pic' ;;
7521                         *)      dflt='none' ;;
7522                     esac
7523                         ;;
7524                 *)  case "$osname" in
7525                         darwin) dflt='none' ;;
7526                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7527                         *)      dflt='-fpic' ;;
7528                     esac ;;
7529             esac ;;
7530         ' ') dflt='none' ;;
7531     *)  dflt="$cccdlflags" ;;
7532     esac
7533     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7534     . ./myread
7535     case "$ans" in
7536     none) cccdlflags=' ' ;;
7537     *) cccdlflags="$ans" ;;
7538     esac
7539
7540     cat << EOM
7541
7542 Some systems use ld to create libraries that can be dynamically loaded,
7543 while other systems (such as those using ELF) use $cc.
7544
7545 EOM
7546         case "$ld" in
7547         '')     $cat >try.c <<'EOM'
7548 /* Test for whether ELF binaries are produced */
7549 #include <fcntl.h>
7550 #include <stdlib.h>
7551 int main() {
7552         char b[4];
7553         int i = open("a.out",O_RDONLY);
7554         if(i == -1) 
7555                 exit(1); /* fail */
7556         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7557                 exit(0); /* succeed (yes, it's ELF) */
7558         else
7559                 exit(1); /* fail */
7560 }
7561 EOM
7562                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7563                         cat <<EOM
7564 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7565 EOM
7566                         dflt="$cc"
7567                 else
7568                         echo "I'll use ld to build dynamic libraries."
7569                         dflt='ld'
7570                 fi
7571                 rm -f try.c a.out
7572                 ;;
7573         *)      dflt="$ld"
7574                 ;;
7575         esac
7576
7577     rp="What command should be used to create dynamic libraries?"
7578     . ./myread
7579         ld="$ans"
7580
7581     cat << EOM
7582
7583 Some systems may require passing special flags to $ld to create a
7584 library that can be dynamically loaded.  If your ld flags include
7585 -L/other/path options to locate libraries outside your loader's normal
7586 search path, you may need to specify those -L options here as well.  To
7587 use no flags, say "none".
7588
7589 EOM
7590     case "$lddlflags" in
7591     '') case "$osname" in
7592                         beos) dflt='-nostart' ;;
7593                         hpux) dflt='-b';
7594                               case "$gccversion" in
7595                               '') dflt="$dflt +vnocompatwarnings" ;;
7596                               esac
7597                               ;;        
7598                         linux|irix*)    dflt='-shared' ;;
7599                         next)  dflt='none' ;;
7600                         solaris) dflt='-G' ;;
7601                         sunos) dflt='-assert nodefinitions' ;;
7602                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7603                 *)     dflt='none' ;;
7604                         esac
7605                         ;;
7606     *) dflt="$lddlflags" ;;
7607     esac
7608
7609         : Try to guess additional flags to pick up local libraries.
7610         : Be careful not to append to a plain 'none'
7611         case "$dflt" in
7612         none) dflt='' ;;
7613         esac
7614         for thisflag in $ldflags; do
7615                 case "$thisflag" in
7616                 -L*|-R*|-Wl,-R*)
7617                         case " $dflt " in
7618                         *" $thisflag "*) ;;
7619                         *) dflt="$dflt $thisflag" ;;
7620                         esac
7621                         ;;
7622                 esac
7623         done
7624
7625         case "$dflt" in
7626         ''|' ') dflt='none' ;;
7627         esac
7628
7629     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7630     . ./myread
7631     case "$ans" in
7632     none) lddlflags=' ' ;;
7633     *) lddlflags="$ans" ;;
7634     esac
7635
7636         cat <<EOM
7637
7638 Some systems may require passing special flags to $cc to indicate that
7639 the resulting executable will use dynamic linking.  To use no flags,
7640 say "none".
7641
7642 EOM
7643     case "$ccdlflags" in
7644     '') case "$osname" in
7645                 hpux)   dflt='-Wl,-E' ;;
7646                 linux)  dflt='-rdynamic' ;;
7647                 next)   dflt='none' ;;
7648                 sunos)  dflt='none' ;;
7649                 *)      dflt='none' ;;
7650             esac ;;
7651     ' ')  dflt='none' ;;
7652     *)  dflt="$ccdlflags" ;;
7653     esac
7654     rp="Any special flags to pass to $cc to use dynamic linking?"
7655     . ./myread
7656     case "$ans" in
7657     none) ccdlflags=' ' ;;
7658     *) ccdlflags="$ans" ;;
7659     esac
7660     ;;
7661 *)  usedl="$undef"
7662         ld='ld'
7663     dlsrc='dl_none.xs'
7664     lddlflags=''
7665     ccdlflags=''
7666     ;;
7667 esac
7668
7669 also=''
7670 case "$usedl" in
7671 $undef)
7672         # No dynamic loading being used, so don't bother even to prompt.
7673         useshrplib='false'
7674         ;;
7675 *)      case "$useshrplib" in
7676         '')     case "$osname" in
7677                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7678                         dflt=y
7679                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7680                         ;;
7681                 next*)
7682                         case "$osvers" in
7683                         4*)     dflt=y
7684                                 also='Building a shared libperl is needed for MAB support.'
7685                                 ;;
7686                         *)      dflt=n
7687                                 ;;
7688                         esac
7689                         ;;
7690                 *)      dflt=n
7691                         ;;
7692                 esac
7693                 ;;
7694         $define|true|[Yy]*)
7695                 dflt=y
7696                 ;;
7697         *)      dflt=n
7698                 ;;
7699         esac
7700         $cat << EOM
7701
7702 The perl executable is normally obtained by linking perlmain.c with
7703 libperl${_a}, any static extensions (usually just DynaLoader), and
7704 any other libraries needed on this system (such as -lm, etc.).  Since
7705 your system supports dynamic loading, it is probably possible to build
7706 a shared libperl.$so.  If you will have more than one executable linked
7707 to libperl.$so, this will significantly reduce the size of each
7708 executable, but it may have a noticeable affect on performance.  The
7709 default is probably sensible for your system.
7710 $also
7711
7712 EOM
7713         rp="Build a shared libperl.$so (y/n)"
7714         . ./myread
7715         case "$ans" in
7716         true|$define|[Yy]*)
7717                 useshrplib='true'  ;;
7718         *)      useshrplib='false' ;;
7719         esac
7720         ;;
7721 esac
7722
7723 case "$useshrplib" in
7724 true)
7725         case "$libperl" in
7726         '')
7727                 # Figure out a good name for libperl.so.  Since it gets stored in
7728                 # a version-specific architecture-dependent library, the version
7729                 # number isn't really that important, except for making cc/ld happy.
7730                 #
7731                 # A name such as libperl.so.3.1
7732                 majmin="libperl.$so.$patchlevel.$subversion"
7733                 # A name such as libperl.so.301
7734                 majonly=`echo $patchlevel $subversion |
7735                         $awk '{printf "%d%02d", $1, $2}'`
7736                 majonly=libperl.$so.$majonly
7737                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7738                 # rely on figuring it out from the naming of libc.
7739                 case "${osname}${osvers}" in
7740                 next4*)
7741                         dflt=libperl.5.$so
7742                         # XXX How handle the --version stuff for MAB?
7743                         ;;
7744                 linux*)  # ld won't link with a bare -lperl otherwise.
7745                         dflt=libperl.$so
7746                         ;;
7747                 cygwin*) # ld links against an importlib
7748                         dflt=libperl$lib_ext
7749                         ;;
7750                 *)      # Try to guess based on whether libc has major.minor.
7751                         case "$libc" in
7752                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7753                         *libc.$so.[0-9]*) dflt=$majonly ;;
7754                         *)      dflt=libperl.$so ;;
7755                         esac
7756                         ;;
7757                 esac
7758                 ;;
7759         *)      dflt=$libperl
7760                 ;;
7761         esac
7762         cat << EOM
7763
7764 I need to select a good name for the shared libperl.  If your system uses
7765 library names with major and minor numbers, then you might want something
7766 like $majmin.  Alternatively, if your system uses a single version
7767 number for shared libraries, then you might want to use $majonly.
7768 Or, your system might be quite happy with a simple libperl.$so.
7769
7770 Since the shared libperl will get installed into a version-specific
7771 architecture-dependent directory, the version number of the shared perl
7772 library probably isn't important, so the default should be o.k.
7773
7774 EOM
7775         rp='What name do you want to give to the shared libperl?'
7776         . ./myread
7777         libperl=$ans
7778         echo "Ok, I'll use $libperl"
7779         ;;
7780 *)
7781         libperl="libperl${_a}"
7782         ;;
7783 esac
7784
7785 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7786 case "$shrpdir" in
7787 '') ;;
7788 *)      $cat >&4 <<EOM
7789 WARNING:  Use of the shrpdir variable for the installation location of
7790 the shared $libperl is not supported.  It was never documented and
7791 will not work in this version.  Let me (perlbug@perl.org)
7792 know of any problems this may cause.
7793
7794 EOM
7795         case "$shrpdir" in
7796         "$archlibexp/CORE")
7797                 $cat >&4 <<EOM
7798 But your current setting of $shrpdir is
7799 the default anyway, so it's harmless.
7800 EOM
7801                 ;;
7802         *)
7803                 $cat >&4 <<EOM
7804 Further, your current attempted setting of $shrpdir
7805 conflicts with the value of $archlibexp/CORE
7806 that installperl will use.
7807 EOM
7808                 ;;
7809         esac
7810         ;;
7811 esac
7812
7813 # How will the perl executable find the installed shared $libperl?
7814 # Add $xxx to ccdlflags.
7815 # If we can't figure out a command-line option, use $shrpenv to
7816 # set env LD_RUN_PATH.  The main perl makefile uses this.
7817 shrpdir=$archlibexp/CORE
7818 xxx=''
7819 tmp_shrpenv=''
7820 if "$useshrplib"; then
7821     case "$osname" in 
7822         aix)
7823                 # We'll set it in Makefile.SH...
7824                 ;;
7825         solaris)
7826                 xxx="-R $shrpdir"
7827                 ;;
7828         freebsd|netbsd)
7829                 xxx="-Wl,-R$shrpdir"
7830                 ;;
7831         bsdos|linux|irix*|dec_osf)
7832                 xxx="-Wl,-rpath,$shrpdir"
7833                 ;;
7834         next)
7835                 # next doesn't like the default...
7836                 ;;
7837         beos)
7838                 # beos doesn't like the default, either.
7839                 ;;
7840         hpux*)
7841                 # hpux doesn't like the default, either.
7842                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7843                 ;;
7844         *)
7845                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7846                 ;;
7847         esac
7848         case "$xxx" in
7849         '') ;;
7850         *)      
7851                 # Only add $xxx if it isn't already in ccdlflags.
7852                 case " $ccdlflags " in
7853                 *" $xxx "*)     ;;
7854                 *)      ccdlflags="$ccdlflags $xxx"
7855                         cat <<EOM >&4
7856
7857 Adding $xxx to the flags
7858 passed to $ld so that the perl executable will find the 
7859 installed shared $libperl.
7860
7861 EOM
7862                         ;;
7863                 esac
7864                 ;;
7865         esac
7866 fi
7867 # Fix ccdlflags in AIX for building external extensions.
7868 # (For building Perl itself bare -bE:perl.exp is needed,
7869 #  Makefile.SH takes care of this.)
7870 case "$osname" in
7871 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7872 esac
7873 # Respect a hint or command-line value.
7874 case "$shrpenv" in
7875 '') shrpenv="$tmp_shrpenv" ;;
7876 esac
7877 case "$ldlibpthname" in
7878 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7879 none)   ldlibpthname='' ;;
7880 esac
7881
7882 : determine where manual pages are on this system
7883 echo " "
7884 case "$sysman" in
7885 '') 
7886         syspath='/usr/share/man/man1 /usr/man/man1'
7887         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7888         syspath="$syspath /usr/man/u_man/man1"
7889         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7890         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7891         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7892         sysman=`./loc . /usr/man/man1 $syspath`
7893         ;;
7894 esac
7895 if $test -d "$sysman"; then
7896         echo "System manual is in $sysman." >&4
7897 else
7898         echo "Could not find manual pages in source form." >&4
7899 fi
7900
7901 : determine where manual pages go
7902 set man1dir man1dir none
7903 eval $prefixit
7904 $cat <<EOM
7905
7906 $spackage has manual pages available in source form.
7907 EOM
7908 case "$nroff" in
7909 nroff)
7910         echo "However, you don't have nroff, so they're probably useless to you."
7911         case "$man1dir" in
7912         '') man1dir="none";;
7913         esac;;
7914 esac
7915 echo "If you don't want the manual sources installed, answer 'none'."
7916 case "$man1dir" in
7917 ' ') dflt=none
7918         ;;
7919 '')
7920         lookpath="$prefixexp/share/man/man1"
7921         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7922         lookpath="$lookpath $prefixexp/man/p_man/man1"
7923         lookpath="$lookpath $prefixexp/man/u_man/man1"
7924         lookpath="$lookpath $prefixexp/man/man.1"
7925         case "$sysman" in
7926         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7927         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7928         esac
7929         set dflt
7930         eval $prefixup
7931         ;;
7932 *)  dflt="$man1dir"
7933         ;;
7934 esac
7935 echo " "
7936 fn=dn+~
7937 rp="Where do the main $spackage manual pages (source) go?"
7938 . ./getfile
7939 if $test "X$man1direxp" != "X$ansexp"; then
7940         installman1dir=''
7941 fi
7942 man1dir="$ans"
7943 man1direxp="$ansexp"
7944 case "$man1dir" in
7945 '')     man1dir=' '
7946         installman1dir='';;
7947 esac
7948
7949 : Change installation prefix, if necessary.
7950 if $test X"$prefix" != X"$installprefix"; then
7951         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7952 else
7953         installman1dir="$man1direxp"
7954 fi
7955
7956 : What suffix to use on installed man pages
7957
7958 case "$man1dir" in
7959 ' ')
7960         man1ext='0'
7961         ;;
7962 *)
7963         rp="What suffix should be used for the main $spackage man pages?"
7964         case "$man1ext" in
7965         '')     case "$man1dir" in
7966                 *1)  dflt=1 ;;
7967                 *1p) dflt=1p ;;
7968                 *1pm) dflt=1pm ;;
7969                 *l) dflt=l;;
7970                 *n) dflt=n;;
7971                 *o) dflt=o;;
7972                 *p) dflt=p;;
7973                 *C) dflt=C;;
7974                 *L) dflt=L;;
7975                 *L1) dflt=L1;;
7976                 *) dflt=1;;
7977                 esac
7978                 ;;
7979         *)      dflt="$man1ext";;
7980         esac
7981         . ./myread
7982         man1ext="$ans"
7983         ;;
7984 esac
7985
7986 : see if we can have long filenames
7987 echo " "
7988 first=123456789abcdef
7989 $rm -f $first
7990 if (echo hi >$first) 2>/dev/null; then
7991         if $test -f 123456789abcde; then
7992                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7993                 val="$undef"
7994         else
7995                 echo 'You can have filenames longer than 14 characters.'>&4
7996                 val="$define"
7997         fi
7998 else
7999         $cat <<'EOM'
8000 You can't have filenames longer than 14 chars.
8001 You can't even think about them!
8002 EOM
8003         val="$undef"
8004 fi 
8005 set d_flexfnam
8006 eval $setvar
8007 $rm -rf 123456789abcde*
8008
8009 : determine where library module manual pages go
8010 set man3dir man3dir none
8011 eval $prefixit
8012 $cat <<EOM
8013
8014 $spackage has manual pages for many of the library modules.
8015 EOM
8016
8017 case "$nroff" in
8018 nroff)
8019         $cat <<'EOM'
8020 However, you don't have nroff, so they're probably useless to you.
8021 EOM
8022         case "$man3dir" in
8023         '') man3dir="none";;
8024         esac;;
8025 esac
8026
8027 case "$d_flexfnam" in
8028 undef)
8029         $cat <<'EOM'
8030 However, your system can't handle the long file names like File::Basename.3. 
8031 EOM
8032         case "$man3dir" in
8033         '') man3dir="none";;
8034         esac;;
8035 esac
8036
8037 echo "If you don't want the manual sources installed, answer 'none'."
8038 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8039 case "$man3dir" in
8040 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8041         if $test -d "$privlib/man/man3"; then
8042                 cat <<EOM >&4
8043
8044 WARNING:  Previous versions of perl installed man3 pages into
8045 $privlib/man/man3.  This version will suggest a 
8046 new default of $dflt.  
8047 EOM
8048                 tdflt=$dflt
8049                 dflt='n'
8050                 rp='Do you wish to preserve the old behavior?(y/n)'
8051                 . ./myread
8052                 case "$ans" in
8053                 y*) dflt="$privlib/man/man3" ;;
8054                 *)  dflt=$tdflt ;;
8055                 esac
8056     fi
8057         ;;
8058 *)      dflt="$man3dir" ;;
8059 esac
8060 case "$dflt" in
8061 ' ') dflt=none ;;
8062 esac
8063 echo " "
8064 fn=dn+~
8065 rp="Where do the $package library man pages (source) go?"
8066 . ./getfile
8067 man3dir="$ans"
8068 man3direxp="$ansexp"
8069 case "$man3dir" in
8070 '')     man3dir=' '
8071         installman3dir='';;
8072 esac
8073
8074 : Change installation prefix, if necessary.
8075 if $test X"$prefix" != X"$installprefix"; then
8076         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8077 else
8078         installman3dir="$man3direxp"
8079 fi
8080
8081 : What suffix to use on installed man pages
8082 case "$man3dir" in
8083 ' ')
8084         man3ext='0'
8085         ;;
8086 *)
8087         rp="What suffix should be used for the $package library man pages?"
8088         case "$man3ext" in
8089         '')     case "$man3dir" in
8090                 *3)  dflt=3 ;;
8091                 *3p) dflt=3p ;;
8092                 *3pm) dflt=3pm ;;
8093                 *l) dflt=l;;
8094                 *n) dflt=n;;
8095                 *o) dflt=o;;
8096                 *p) dflt=p;;
8097                 *C) dflt=C;;
8098                 *L) dflt=L;;
8099                 *L3) dflt=L3;;
8100                 *) dflt=3;;
8101                 esac
8102                 ;;
8103         *)      dflt="$man3ext";;
8104         esac
8105         . ./myread
8106         man3ext="$ans"
8107         ;;
8108 esac
8109
8110 : see if we have to deal with yellow pages, now NIS.
8111 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8112         if $test -f /usr/etc/nibindd; then
8113                 echo " "
8114                 echo "I'm fairly confident you're on a NeXT."
8115                 echo " "
8116                 rp='Do you get the hosts file via NetInfo?'
8117                 dflt=y
8118                 case "$hostcat" in
8119                 nidump*) ;;
8120                 '') ;;
8121                 *) dflt=n;;
8122                 esac
8123                 . ./myread
8124                 case "$ans" in
8125                 y*) hostcat='nidump hosts .';;
8126                 *)      case "$hostcat" in
8127                         nidump*) hostcat='';;
8128                         esac
8129                         ;;
8130                 esac
8131         fi
8132         case "$hostcat" in
8133         nidump*) ;;
8134         *)
8135                 case "$hostcat" in
8136                 *ypcat*) dflt=y;;
8137                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8138                                 dflt=y
8139                         else
8140                                 dflt=n
8141                         fi;;
8142                 *) dflt=n;;
8143                 esac
8144                 echo " "
8145                 rp='Are you getting the hosts file via yellow pages?'
8146                 . ./myread
8147                 case "$ans" in
8148                 y*) hostcat='ypcat hosts';;
8149                 *) hostcat='cat /etc/hosts';;
8150                 esac
8151                 ;;
8152         esac
8153 fi
8154 case "$hostcat" in
8155 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8156 esac
8157 case "$groupcat" in
8158 '') test -f /etc/group && groupcat='cat /etc/group';;
8159 esac
8160 case "$passcat" in
8161 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8162 esac
8163
8164 : now get the host name
8165 echo " "
8166 echo "Figuring out host name..." >&4
8167 case "$myhostname" in
8168 '') cont=true
8169         echo 'Maybe "hostname" will work...'
8170         if tans=`sh -c hostname 2>&1` ; then
8171                 myhostname=$tans
8172                 phostname=hostname
8173                 cont=''
8174         fi
8175         ;;
8176 *) cont='';;
8177 esac
8178 if $test "$cont"; then
8179         if ./xenix; then
8180                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8181                 if tans=`cat /etc/systemid 2>&1` ; then
8182                         myhostname=$tans
8183                         phostname='cat /etc/systemid'
8184                         echo "Whadyaknow.  Xenix always was a bit strange..."
8185                         cont=''
8186                 fi
8187         elif $test -r /etc/systemid; then
8188                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8189         fi
8190 fi
8191 if $test "$cont"; then
8192         echo 'No, maybe "uuname -l" will work...'
8193         if tans=`sh -c 'uuname -l' 2>&1` ; then
8194                 myhostname=$tans
8195                 phostname='uuname -l'
8196         else
8197                 echo 'Strange.  Maybe "uname -n" will work...'
8198                 if tans=`sh -c 'uname -n' 2>&1` ; then
8199                         myhostname=$tans
8200                         phostname='uname -n'
8201                 else
8202                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8203                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8204                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8205                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8206                         else
8207                                 case "$myhostname" in
8208                                 '') echo "Does this machine have an identity crisis or something?"
8209                                         phostname='';;
8210                                 *)
8211                                         echo "Well, you said $myhostname before..."
8212                                         phostname='echo $myhostname';;
8213                                 esac
8214                         fi
8215                 fi
8216         fi
8217 fi
8218 case "$myhostname" in
8219 '') myhostname=noname ;;
8220 esac
8221 : you do not want to know about this
8222 set $myhostname
8223 myhostname=$1
8224
8225 : verify guess
8226 if $test "$myhostname" ; then
8227         dflt=y
8228         rp='Your host name appears to be "'$myhostname'".'" Right?"
8229         . ./myread
8230         case "$ans" in
8231         y*) ;;
8232         *) myhostname='';;
8233         esac
8234 fi
8235
8236 : bad guess or no guess
8237 while $test "X$myhostname" = X ; do
8238         dflt=''
8239         rp="Please type the (one word) name of your host:"
8240         . ./myread
8241         myhostname="$ans"
8242 done
8243
8244 : translate upper to lower if necessary
8245 case "$myhostname" in
8246 *[A-Z]*)
8247         echo "(Normalizing case in your host name)"
8248         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8249         ;;
8250 esac
8251
8252 case "$myhostname" in
8253 *.*)
8254         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8255         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8256         echo "(Trimming domain name from host name--host name is now $myhostname)"
8257         ;;
8258 *) case "$mydomain" in
8259         '')
8260                 {
8261                         test "X$hostcat" = "Xypcat hosts" &&
8262                         ypmatch "$myhostname" hosts 2>/dev/null |\
8263                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8264                         $test -s hosts
8265                 } || {
8266                         test "X$hostcat" != "X" &&
8267                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8268                                         /[       ]$myhostname[  . ]/p" > hosts
8269                 }
8270                 tmp_re="[       . ]"
8271                 if $test -f hosts; then
8272                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8273                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8274                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8275                                 hosts | $sort | $uniq | \
8276                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8277                         case `$echo X$dflt` in
8278                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8279                                 dflt=.
8280                                 ;;
8281                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8282                                 ;;
8283                         esac
8284                 else
8285                         echo "(I cannot locate a hosts database anywhere)"
8286                         dflt=.
8287                 fi
8288                 case "$dflt" in
8289                 .)
8290                         tans=`./loc resolv.conf X /etc /usr/etc`
8291                         if $test -f "$tans"; then
8292                                 echo "(Attempting domain name extraction from $tans)"
8293                                 dflt=.`$sed -n -e 's/   / /g' \
8294                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8295                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8296                                 case "$dflt" in
8297                                 .) dflt=.`$sed -n -e 's/        / /g' \
8298                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8299                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8300                                         ;;
8301                                 esac
8302                         fi
8303                         ;;
8304                 esac
8305                 case "$dflt" in
8306                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8307                         dflt=.`sh -c domainname 2>/dev/null`
8308                         case "$dflt" in
8309                         '') dflt='.';;
8310                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8311                         esac
8312                         ;;
8313                 esac
8314                 case "$dflt$osname" in
8315                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8316                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8317                         ;;
8318                 esac
8319                 case "$dflt" in
8320                 .) echo "(Lost all hope -- silly guess then)"
8321                         dflt='.nonet'
8322                         ;;
8323                 esac
8324                 $rm -f hosts
8325                 ;;
8326         *) dflt="$mydomain";;
8327         esac;;
8328 esac
8329 echo " "
8330 rp="What is your domain name?"
8331 . ./myread
8332 tans="$ans"
8333 case "$ans" in
8334 '') ;;
8335 .*) ;;
8336 *) tans=".$tans";;
8337 esac
8338 mydomain="$tans"
8339
8340 : translate upper to lower if necessary
8341 case "$mydomain" in
8342 *[A-Z]*)
8343         echo "(Normalizing case in your domain name)"
8344         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8345         ;;
8346 esac
8347
8348 : a little sanity check here
8349 case "$phostname" in
8350 '') ;;
8351 *)
8352         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8353         $myhostname$mydomain|$myhostname) ;;
8354         *)
8355                 case "$phostname" in
8356                 sed*)
8357                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8358                         ;;
8359                 *)
8360                         echo "(That doesn't agree with your $phostname command, by the way.)"
8361                         ;;
8362                 esac
8363         ;;
8364         esac
8365         ;;
8366 esac
8367
8368 $cat <<EOM
8369
8370 I need to get your e-mail address in Internet format if possible, i.e.
8371 something like user@host.domain. Please answer accurately since I have
8372 no easy means to double check it. The default value provided below
8373 is most probably close to reality but may not be valid from outside
8374 your organization...
8375
8376 EOM
8377 cont=x
8378 while test "$cont"; do
8379         case "$cf_email" in
8380         '') dflt="$cf_by@$myhostname$mydomain";;
8381         *) dflt="$cf_email";;
8382         esac
8383         rp='What is your e-mail address?'
8384         . ./myread
8385         cf_email="$ans"
8386         case "$cf_email" in
8387         *@*.*) cont='' ;;
8388         *)
8389                 rp='Address does not look like an Internet one.  Use it anyway?'
8390                 case "$fastread" in
8391                 yes) dflt=y ;;
8392                 *) dflt=n ;;
8393                 esac
8394                 . ./myread
8395                 case "$ans" in
8396                 y*) cont='' ;;
8397                 *) echo " " ;;
8398                 esac
8399                 ;;
8400         esac
8401 done
8402
8403 $cat <<EOM
8404
8405 If you or somebody else will be maintaining perl at your site, please
8406 fill in the correct e-mail address here so that they may be contacted
8407 if necessary. Currently, the "perlbug" program included with perl
8408 will send mail to this address in addition to perlbug@perl.org. You may
8409 enter "none" for no administrator.
8410
8411 EOM
8412 case "$perladmin" in
8413 '') dflt="$cf_email";;
8414 *) dflt="$perladmin";;
8415 esac
8416 rp='Perl administrator e-mail address'
8417 . ./myread
8418 perladmin="$ans"
8419
8420 : determine whether to only install version-specific parts.
8421 echo " "
8422 $cat <<EOM
8423 Do you want to install only the version-specific parts of the perl
8424 distribution?  Usually you do *not* want to do this.
8425 EOM
8426 case "$versiononly" in
8427 "$define"|[Yy]*|true) dflt='y' ;;
8428 *) dflt='n';
8429 esac
8430 rp="Do you want to install only the version-specific parts of perl?"
8431 . ./myread
8432 case "$ans" in
8433 [yY]*)  val="$define";;
8434 *)      val="$undef" ;;
8435 esac
8436 set versiononly
8437 eval $setvar
8438
8439 case "$versiononly" in
8440 "$define") inc_version_list=''
8441            inc_version_list_init=0
8442            ;;
8443 esac
8444
8445 : figure out how to guarantee perl startup
8446 case "$startperl" in
8447 '')
8448         case "$sharpbang" in
8449         *!)
8450                 $cat <<EOH
8451
8452 I can use the #! construct to start perl on your system. This will
8453 make startup of perl scripts faster, but may cause problems if you
8454 want to share those scripts and perl is not in a standard place
8455 ($binexp/perl) on all your platforms. The alternative is to force
8456 a shell by starting the script with a single ':' character.
8457
8458 EOH
8459                 case "$versiononly" in
8460                 "$define")      dflt="$binexp/perl$version";;  
8461                 *)              dflt="$binexp/perl";;
8462                 esac
8463                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8464                 . ./myread
8465                 case "$ans" in
8466                 none)   startperl=": # use perl";;
8467                 *)      startperl="#!$ans"
8468                         if $test 30 -lt `echo "$ans" | wc -c`; then
8469                                 $cat >&4 <<EOM
8470
8471 WARNING:  Some systems limit the #! command to 32 characters.
8472 If you experience difficulty running Perl scripts with #!, try
8473 installing Perl in a directory with a shorter pathname.
8474
8475 EOM
8476                         fi ;;
8477                 esac
8478                 ;;
8479         *) startperl=": # use perl"
8480                 ;;
8481         esac
8482         ;;
8483 esac
8484 echo "I'll use $startperl to start perl scripts."
8485
8486 : figure best path for perl in scripts
8487 case "$perlpath" in
8488 '')
8489         case "$versiononly" in
8490         "$define")      perlpath="$binexp/perl$version";;
8491         *)              perlpath="$binexp/perl";;
8492         esac
8493         case "$startperl" in
8494         *!*) ;;
8495         *)
8496                 $cat <<EOH
8497
8498 I will use the "eval 'exec'" idiom to start Perl on your system.
8499 I can use the full path of your Perl binary for this purpose, but
8500 doing so may cause problems if you want to share those scripts and
8501 Perl is not always in a standard place ($binexp/perl).
8502
8503 EOH
8504                 dflt="$binexp/perl"
8505                 rp="What path shall I use in \"eval 'exec'\"?"
8506                 . ./myread
8507                 perlpath="$ans"
8508                 ;;
8509         esac
8510         ;;
8511 esac
8512 case "$startperl" in
8513 *!*)    ;;
8514 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8515 esac
8516
8517 : determine where public executable scripts go
8518 set scriptdir scriptdir
8519 eval $prefixit
8520 case "$scriptdir" in
8521 '')
8522         dflt="$bin"
8523         : guess some guesses
8524         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8525         $test -d /usr/share/bin     && dflt=/usr/share/bin
8526         $test -d /usr/local/script  && dflt=/usr/local/script
8527         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8528         $test -d $prefixexp/script  && dflt=$prefixexp/script
8529         set dflt
8530         eval $prefixup
8531         ;;
8532 *)  dflt="$scriptdir"
8533         ;;
8534 esac
8535 $cat <<EOM
8536  
8537 Some installations have a separate directory just for executable scripts so
8538 that they can mount it across multiple architectures but keep the scripts in
8539 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8540 Or you might just lump your scripts in with all your other executables.
8541  
8542 EOM
8543 fn=d~
8544 rp='Where do you keep publicly executable scripts?'
8545 . ./getfile
8546 if $test "X$ansexp" != "X$scriptdirexp"; then
8547         installscript=''
8548 fi
8549 scriptdir="$ans"
8550 scriptdirexp="$ansexp"
8551 : Change installation prefix, if necessary.
8552 if $test X"$prefix" != X"$installprefix"; then
8553         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8554 else
8555         installscript="$scriptdirexp"
8556 fi
8557
8558 : determine where add-on public executables go
8559 case "$sitebin" in
8560 '')     dflt=$siteprefix/bin ;;
8561 *)      dflt=$sitebin ;;
8562 esac
8563 fn=d~
8564 rp='Pathname where the add-on public executables should be installed?'
8565 . ./getfile
8566 sitebin="$ans"
8567 sitebinexp="$ansexp"
8568 : Change installation prefix, if necessary.
8569 if $test X"$prefix" != X"$installprefix"; then
8570         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8571 else
8572         installsitebin="$sitebinexp"
8573 fi
8574
8575 : define an is-a-typedef? function
8576 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8577 case "$inclist" in
8578 "") inclist="sys/types.h";;
8579 esac;
8580 eval "varval=\$$var";
8581 case "$varval" in
8582 "")
8583         $rm -f temp.c;
8584         for inc in $inclist; do
8585                 echo "#include <$inc>" >>temp.c;
8586         done;
8587         echo "#ifdef $type" >> temp.c;
8588         echo "printf(\"We have $type\");" >> temp.c;
8589         echo "#endif" >> temp.c;
8590         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8591         if $contains $type temp.E >/dev/null 2>&1; then
8592                 eval "$var=\$type";
8593         else
8594                 eval "$var=\$def";
8595         fi;
8596         $rm -f temp.?;;
8597 *) eval "$var=\$varval";;
8598 esac'
8599
8600 : define an is-a-typedef? function that prompts if the type is not available.
8601 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8602 case "$inclist" in
8603 "") inclist="sys/types.h";;
8604 esac;
8605 eval "varval=\$$var";
8606 case "$varval" in
8607 "")
8608         $rm -f temp.c;
8609         for inc in $inclist; do
8610                 echo "#include <$inc>" >>temp.c;
8611         done;
8612         echo "#ifdef $type" >> temp.c;
8613         echo "printf(\"We have $type\");" >> temp.c;
8614         echo "#endif" >> temp.c;
8615         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8616         echo " " ;
8617         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8618         if $contains $type temp.E >/dev/null 2>&1; then
8619                 echo "$type found." >&4;
8620                 eval "$var=\$type";
8621         else
8622                 echo "$type NOT found." >&4;
8623                 dflt="$def";
8624                 . ./myread ;
8625                 eval "$var=\$ans";
8626         fi;
8627         $rm -f temp.?;;
8628 *) eval "$var=\$varval";;
8629 esac'
8630
8631 : see what type lseek is declared as in the kernel
8632 rp="What is the type used for lseek's offset on this system?"
8633 set off_t lseektype long stdio.h sys/types.h
8634 eval $typedef_ask
8635
8636 echo " "
8637 echo "Checking to see how big your file offsets are..." >&4
8638 $cat >try.c <<EOCP
8639 #include <sys/types.h>
8640 #include <stdio.h>
8641 int main()
8642 {
8643     printf("%d\n", (int)sizeof($lseektype));
8644     return(0); 
8645 }
8646 EOCP
8647 set try
8648 if eval $compile_ok; then
8649         lseeksize=`$run ./try`
8650         echo "Your file offsets are $lseeksize bytes long."
8651 else
8652         dflt=$longsize
8653         echo " "
8654         echo "(I can't seem to compile the test program.  Guessing...)"
8655         rp="What is the size of your file offsets (in bytes)?"
8656         . ./myread
8657         lseeksize="$ans"
8658 fi
8659 $rm -f try.c try
8660
8661 : see what type file positions are declared as in the library
8662 rp="What is the type for file position used by fsetpos()?"
8663 set fpos_t fpostype long stdio.h sys/types.h
8664 eval $typedef_ask
8665
8666 echo " "
8667 case "$fpostype" in
8668 *_t) zzz="$fpostype"    ;;
8669 *)   zzz="fpos_t"       ;;
8670 esac
8671 echo "Checking the size of $zzz..." >&4 
8672 cat > try.c <<EOCP
8673 #include <sys/types.h>
8674 #include <stdio.h>
8675 int main() {
8676     printf("%d\n", (int)sizeof($fpostype));
8677     exit(0);
8678 }
8679 EOCP
8680 set try
8681 if eval $compile_ok; then
8682         yyy=`$run ./try`
8683         case "$yyy" in
8684         '')     fpossize=4
8685                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8686                 ;;
8687         *)      fpossize=$yyy
8688                 echo "Your $zzz is $fpossize bytes long."
8689                 ;;
8690         esac
8691 else
8692         dflt="$longsize"
8693         echo " " >&4
8694         echo "(I can't compile the test program.  Guessing...)" >&4
8695         rp="What is the size of your file positions (in bytes)?"
8696         . ./myread
8697         fpossize="$ans"
8698 fi
8699
8700
8701
8702 # Backward compatibility (uselfs is deprecated).
8703 case "$uselfs" in
8704 "$define"|true|[yY]*)
8705         cat <<EOM >&4
8706
8707 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8708 EOM
8709         uselargefiles="$define"
8710         ;;
8711 esac                          
8712
8713 case "$lseeksize:$fpossize" in
8714 8:8) cat <<EOM
8715
8716 You can have files larger than 2 gigabytes.
8717 EOM
8718    val="$define" ;;
8719 *)    case "$uselargefiles" in
8720    "$undef"|false|[nN]*) dflt='n' ;;
8721    *)   dflt='y' ;;
8722    esac
8723    cat <<EOM
8724
8725 Perl can be built to understand large files (files larger than 2 gigabytes)
8726 on some systems.  To do so, Configure can be run with -Duselargefiles.
8727
8728 If this doesn't make any sense to you, just accept the default '$dflt'.
8729 EOM
8730    rp='Try to understand large files, if available?'
8731    . ./myread
8732    case "$ans" in
8733    y|Y)         val="$define" ;;
8734    *)           val="$undef"  ;;
8735    esac
8736    ;;
8737 esac
8738 set uselargefiles
8739 eval $setvar
8740 case "$uselargefiles" in
8741 "$define")
8742 : Look for a hint-file generated 'call-back-unit'.  If the
8743 : user has specified that a large files perl is to be built,
8744 : we may need to set or change some other defaults.
8745         if $test -f uselargefiles.cbu; then
8746                 echo "Your platform has some specific hints for large file builds, using them..."
8747                 . ./uselargefiles.cbu
8748                 echo " "
8749                 echo "Rechecking to see how big your file offsets are..." >&4
8750                 $cat >try.c <<EOCP
8751 #include <sys/types.h>
8752 #include <stdio.h>
8753 int main()
8754 {
8755     printf("%d\n", (int)sizeof($lseektype));
8756     return(0); 
8757 }
8758 EOCP
8759                 set try
8760                 if eval $compile_ok; then
8761                         lseeksize=`$run ./try`
8762                         $echo "Your file offsets are now $lseeksize bytes long."
8763                 else
8764                         dflt="$lseeksize"
8765                         echo " "
8766                         echo "(I can't seem to compile the test program.  Guessing...)"
8767                         rp="What is the size of your file offsets (in bytes)?"
8768                         . ./myread
8769                         lseeksize="$ans"
8770                 fi
8771                 case "$fpostype" in
8772                 *_t) zzz="$fpostype"    ;;
8773                 *)   zzz="fpos_t"       ;;
8774                 esac
8775                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8776                 $cat > try.c <<EOCP
8777 #include <sys/types.h>
8778 #include <stdio.h>
8779 int main() {
8780     printf("%d\n", (int)sizeof($fpostype));
8781     exit(0);
8782 }
8783 EOCP
8784                 set try
8785                 if eval $compile_ok; then
8786                         yyy=`$run ./try`
8787                         dflt="$lseeksize"
8788                         case "$yyy" in
8789                         '')     echo " "
8790                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8791                                 ;;
8792                         *)      fpossize=$yyy
8793                                 echo " $fpossize bytes." >&4
8794                                 ;;
8795                         esac
8796                 else
8797                         dflt="$fpossize"
8798                         echo " "
8799                         echo "(I can't compile the test program.  Guessing...)" >&4
8800                         rp="What is the size of your file positions (in bytes)?"
8801                         . ./myread
8802                         fpossize="$ans"
8803                 fi
8804                 $rm -f try.c try
8805         fi
8806         ;;
8807 esac
8808
8809 case "$vendorprefix" in
8810 '')     d_vendorbin="$undef"
8811         vendorbin=''
8812         vendorbinexp=''
8813         ;;
8814 *)      d_vendorbin="$define"
8815         : determine where vendor-supplied executables go.
8816         case "$vendorbin" in
8817         '') dflt=$vendorprefix/bin ;;
8818         *)      dflt="$vendorbin" ;;
8819         esac
8820         fn=d~+
8821         rp='Pathname for the vendor-supplied executables directory?'
8822         . ./getfile
8823         vendorbin="$ans"
8824         vendorbinexp="$ansexp"
8825         ;;
8826 esac
8827 : Change installation prefix, if necessary.
8828 if $test X"$prefix" != X"$installprefix"; then
8829         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8830 else
8831         installvendorbin="$vendorbinexp"
8832 fi
8833
8834 : see if qgcvt exists
8835 set qgcvt d_qgcvt
8836 eval $inlibc
8837
8838 : Check how to convert floats to strings.
8839
8840 if test "X$d_Gconvert" = X; then
8841
8842 echo " "
8843 echo "Checking for an efficient way to convert floats to strings."
8844 echo " " > try.c
8845 case "$uselongdouble" in
8846 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8847 esac
8848 case "$d_longdbl" in
8849 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8850 esac
8851 case "$d_PRIgldbl" in
8852 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8853 esac
8854 $cat >>try.c <<EOP
8855 #ifdef TRY_gconvert
8856 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8857 char *myname = "gconvert";
8858 #endif
8859 #ifdef TRY_gcvt
8860 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8861 char *myname = "gcvt";
8862 #endif
8863 #ifdef TRY_qgcvt
8864 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8865 char *myname = "qgcvt";
8866 #define DOUBLETYPE long double
8867 #endif
8868 #ifdef TRY_sprintf
8869 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8870 #ifdef HAS_PRIgldbl
8871 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8872 #else
8873 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8874 #endif
8875 #else
8876 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8877 #endif
8878 char *myname = "sprintf";
8879 #endif
8880
8881 #ifndef DOUBLETYPE
8882 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8883 #define DOUBLETYPE long double
8884 #else
8885 #define DOUBLETYPE double
8886 #endif
8887 #endif
8888
8889 #include <stdio.h>
8890
8891 #define I_STDLIB $i_stdlib
8892 #ifdef I_STDLIB
8893 #include <stdlib.h>
8894 #endif
8895
8896 int
8897 checkit(expect, got)
8898 char *expect;
8899 char *got;
8900 {
8901     if (strcmp(expect, got)) {
8902                 printf("%s oddity:  Expected %s, got %s\n",
8903                         myname, expect, got);
8904                 exit(1);
8905         }
8906 }
8907
8908 int main()
8909
8910         char buf[64]; 
8911         buf[63] = '\0';
8912
8913         /* This must be 1st test on (which?) platform */
8914         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8915         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8916         checkit("0.1", buf);
8917
8918         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8919         checkit("0.01", buf);
8920
8921         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8922         checkit("0.001", buf);
8923
8924         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8925         checkit("0.0001", buf);
8926
8927         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8928         if (strlen(buf) > 5)
8929             checkit("9e-005", buf); /* for Microsoft ?? */
8930         else
8931             checkit("9e-05", buf);
8932
8933         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8934         checkit("1", buf);
8935
8936         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8937         checkit("1.1", buf);
8938
8939         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8940         checkit("1.01", buf);
8941
8942         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8943         checkit("1.001", buf);
8944
8945         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8946         checkit("1.0001", buf);
8947
8948         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8949         checkit("1.00001", buf);
8950
8951         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8952         checkit("1.000001", buf);
8953
8954         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8955         checkit("0", buf);
8956
8957         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8958         checkit("-1", buf);
8959
8960         /* Some Linux gcvt's give 1.e+5 here. */
8961         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8962         checkit("100000", buf);
8963         
8964         /* Some Linux gcvt's give -1.e+5 here. */
8965         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8966         checkit("-100000", buf);
8967
8968         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8969         checkit("123.456", buf);
8970
8971         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8972         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8973         /* 34 should be enough to scare even long double
8974          * places into using the e notation. */
8975         if (strlen(buf) > 5)
8976             checkit("1e+034", buf); /* for Microsoft */
8977         else
8978             checkit("1e+34", buf);
8979
8980         /* For Perl, if you add additional tests here, also add them to
8981          * t/base/num.t for benefit of platforms not using Configure or
8982          * overriding d_Gconvert */
8983
8984         exit(0);
8985 }
8986 EOP
8987 : first add preferred functions to our list
8988 xxx_list=""
8989 for xxx_convert in $gconvert_preference; do
8990     case $xxx_convert in
8991     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8992     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8993     esac 
8994 done
8995 : then add any others
8996 for xxx_convert in gconvert gcvt sprintf; do
8997     case "$xxx_list" in
8998     *$xxx_convert*) ;;
8999     *) xxx_list="$xxx_list $xxx_convert" ;;
9000     esac 
9001 done
9002
9003 case "$d_longdbl$uselongdouble" in
9004 "$define$define")
9005     : again, add prefered functions to our list first
9006     xxx_ld_list=""
9007     for xxx_convert in $gconvert_ld_preference; do
9008         case $xxx_convert in
9009         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9010         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9011         esac
9012     done
9013     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9014     for xxx_convert in qgcvt sprintf $xxx_list; do
9015         case "$xxx_ld_list" in
9016         $xxx_convert*|*" $xxx_convert"*) ;;
9017         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9018         esac
9019     done
9020     : if sprintf cannot do long doubles, move it to the end
9021     if test "$d_PRIgldbl" != "$define"; then
9022         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9023     fi
9024     : if no qgcvt, remove it
9025     if test "$d_qgcvt" != "$define"; then
9026         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9027     fi
9028     : use the ld_list
9029     xxx_list="$xxx_ld_list"
9030     ;;
9031 esac
9032
9033 for xxx_convert in $xxx_list; do
9034         echo "Trying $xxx_convert..."
9035         $rm -f try try$_o
9036         set try -DTRY_$xxx_convert
9037         if eval $compile; then
9038                 echo "$xxx_convert() found." >&4
9039                 if $run ./try; then
9040                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9041                         break;
9042                 else
9043                         echo "...But $xxx_convert didn't work as I expected."
9044                         xxx_convert=''
9045                 fi
9046         else
9047                 echo "$xxx_convert NOT found." >&4
9048         fi
9049 done
9050
9051 if test X$xxx_convert = X; then
9052     echo "*** WHOA THERE!!! ***" >&4
9053     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9054     xxx_convert=sprintf
9055 fi
9056
9057 case "$xxx_convert" in
9058 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9059 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9060 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9061 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9062    "$define$define$define")
9063       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9064    "$define$define$undef")
9065       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9066    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9067    esac
9068    ;;  
9069 esac
9070
9071 fi
9072
9073 : see if _fwalk exists
9074 set fwalk d__fwalk
9075 eval $inlibc
9076
9077 : Initialize h_fcntl
9078 h_fcntl=false
9079
9080 : Initialize h_sysfile
9081 h_sysfile=false
9082
9083 : access call always available on UNIX
9084 set access d_access
9085 eval $inlibc
9086
9087 : locate the flags for 'access()'
9088 case "$d_access" in
9089 "$define")
9090         echo " "
9091         $cat >access.c <<'EOCP'
9092 #include <sys/types.h>
9093 #ifdef I_FCNTL
9094 #include <fcntl.h>
9095 #endif
9096 #ifdef I_SYS_FILE
9097 #include <sys/file.h>
9098 #endif
9099 #ifdef I_UNISTD
9100 #include <unistd.h>
9101 #endif
9102 int main() {
9103         exit(R_OK);
9104 }
9105 EOCP
9106         : check sys/file.h first, no particular reason here
9107         if $test `./findhdr sys/file.h` && \
9108                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9109                 h_sysfile=true;
9110                 echo "<sys/file.h> defines the *_OK access constants." >&4
9111         elif $test `./findhdr fcntl.h` && \
9112                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9113                 h_fcntl=true;
9114                 echo "<fcntl.h> defines the *_OK access constants." >&4
9115         elif $test `./findhdr unistd.h` && \
9116                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9117                 echo "<unistd.h> defines the *_OK access constants." >&4
9118         else
9119                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9120         fi
9121         ;;
9122 esac
9123 $rm -f access*
9124
9125 : see if accessx exists
9126 set accessx d_accessx
9127 eval $inlibc
9128
9129 : see if alarm exists
9130 set alarm d_alarm
9131 eval $inlibc
9132
9133 : see if POSIX threads are available
9134 set pthread.h i_pthread
9135 eval $inhdr
9136
9137 : define a fucntion to check prototypes
9138 $cat > protochk <<EOSH
9139 $startsh
9140 cc="$cc"
9141 optimize="$optimize"
9142 ccflags="$ccflags"
9143 prototype="$prototype"
9144 define="$define"
9145 rm=$rm
9146 usethreads=$usethreads
9147 i_pthread=$i_pthread
9148 pthread_h_first=$pthread_h_first
9149 EOSH
9150
9151 $cat >> protochk <<'EOSH'
9152
9153 $rm -f try.c
9154 foo="$1"
9155 shift
9156 while test $# -ge 2; do
9157         case "$1" in
9158                 $define) echo "#include <$2>" >> try.c ;;
9159                 literal) echo "$2" >> try.c ;;
9160         esac
9161     # Extra magic for the benefit of systems that need pthread.h
9162     # to be included early to correctly detect threadsafe functions.
9163     # Such functions must guarantee themselves, though, that the usethreads
9164     # and i_pthread have been defined, before calling protochk.
9165     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9166         echo "#include <pthread.h>" >> try.c
9167         pthread_h_done=yes
9168     fi
9169     shift 2
9170 done
9171 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9172 cat >> try.c <<'EOCP'
9173 #ifdef CAN_PROTOTYPE
9174 #define _(args) args
9175 #else
9176 #define _(args) ()
9177 #endif
9178 EOCP
9179 echo "$foo" >> try.c
9180 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9181 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9182 status=$?
9183 $rm -f try.[co]
9184 exit $status
9185 EOSH
9186 chmod +x protochk
9187 $eunicefix protochk
9188
9189 : see if sys/types.h has to be included
9190 set sys/types.h i_systypes
9191 eval $inhdr
9192
9193 : see if sys/select.h has to be included
9194 set sys/select.h i_sysselct
9195 eval $inhdr
9196
9197 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9198 while $test $# -ge 2; do
9199         case "$1" in
9200         $define) echo "#include <$2>";;
9201         esac ;
9202     shift 2;
9203 done > try.c;
9204 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9205 set try;
9206 if eval $compile; then
9207         val="$define";
9208 else
9209         val="$undef";
9210 fi;
9211 set $varname;
9212 eval $setvar;
9213 $rm -f try.c try.o'
9214
9215 : see if we should include time.h, sys/time.h, or both
9216 echo " "
9217 if test "X$timeincl" = X; then
9218         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9219         $echo $n "I'm now running the test program...$c"
9220         $cat >try.c <<'EOCP'
9221 #include <sys/types.h>
9222 #ifdef I_TIME
9223 #include <time.h>
9224 #endif
9225 #ifdef I_SYSTIME
9226 #ifdef SYSTIMEKERNEL
9227 #define KERNEL
9228 #endif
9229 #include <sys/time.h>
9230 #endif
9231 #ifdef I_SYSSELECT
9232 #include <sys/select.h>
9233 #endif
9234 int main()
9235 {
9236         struct tm foo;
9237 #ifdef S_TIMEVAL
9238         struct timeval bar;
9239 #endif
9240 #ifdef S_TIMEZONE
9241         struct timezone tzp;
9242 #endif
9243         if (foo.tm_sec == foo.tm_sec)
9244                 exit(0);
9245 #ifdef S_TIMEVAL
9246         if (bar.tv_sec == bar.tv_sec)
9247                 exit(0);
9248 #endif
9249         exit(1);
9250 }
9251 EOCP
9252         flags=''
9253         for s_timezone in '-DS_TIMEZONE' ''; do
9254         sysselect=''
9255         for s_timeval in '-DS_TIMEVAL' ''; do
9256         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9257         for i_time in '' '-DI_TIME'; do
9258         for i_systime in '-DI_SYSTIME' ''; do
9259                 case "$flags" in
9260                 '') $echo $n ".$c"
9261                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9262                         if eval $compile; then
9263                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9264                                 shift
9265                                 flags="$*"
9266                                 echo " "
9267                                 $echo $n "Succeeded with $flags$c"
9268                         fi
9269                         ;;
9270                 esac
9271         done
9272         done
9273         done
9274         done
9275         done
9276         timeincl=''
9277         echo " "
9278         case "$flags" in
9279         *SYSTIMEKERNEL*) i_systimek="$define"
9280                 timeincl=`./findhdr sys/time.h`
9281                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9282         *) i_systimek="$undef";;
9283         esac
9284         case "$flags" in
9285         *I_TIME*) i_time="$define"
9286                 timeincl=`./findhdr time.h`" $timeincl"
9287                 echo "We'll include <time.h>." >&4;;
9288         *) i_time="$undef";;
9289         esac
9290         case "$flags" in
9291         *I_SYSTIME*) i_systime="$define"
9292                 timeincl=`./findhdr sys/time.h`" $timeincl"
9293                 echo "We'll include <sys/time.h>." >&4;;
9294         *) i_systime="$undef";;
9295         esac
9296         $rm -f try.c try
9297 fi
9298 : see if struct tm knows about tm_zone
9299 case "$i_systime$i_time" in
9300 *$define*) 
9301         echo " "
9302         echo "Checking to see if your struct tm has tm_zone field..." >&4
9303         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9304         eval $hasfield
9305         ;;
9306 *)      val="$undef"
9307         set d_tm_tm_zone
9308         eval $setvar
9309         ;;
9310 esac
9311 case "$d_tm_tm_zone" in
9312 "$define")      echo "Yes, it does."   ;;
9313 *)              echo "No, it doesn't." ;;
9314 esac
9315 : see if struct tm knows about tm_gmtoff
9316 case "$i_systime$i_time" in
9317 *$define*) 
9318         echo " "
9319         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9320         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9321         eval $hasfield
9322         ;;
9323 *)      val="$undef"
9324         set d_tm_tm_gmtoff
9325         eval $setvar
9326         ;;
9327 esac
9328 case "$d_tm_tm_gmtoff" in
9329 "$define")      echo "Yes, it does."   ;;
9330 *)              echo "No, it doesn't." ;;
9331 esac
9332
9333 : see if asctime_r exists
9334 set asctime_r d_asctime_r
9335 eval $inlibc
9336 case "$d_asctime_r" in
9337 "$define")
9338         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9339         case "$d_asctime_r_proto:$usethreads" in
9340         ":define")      d_asctime_r_proto=define
9341                 set d_asctime_r_proto asctime_r $hdrs
9342                 eval $hasproto ;;
9343         *)      ;;
9344         esac
9345         case "$d_asctime_r_proto" in
9346         define)
9347         case "$asctime_r_proto" in
9348         ''|0) try='char* asctime_r(const struct tm*, char*);'
9349         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9350         esac
9351         case "$asctime_r_proto" in
9352         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9353         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9354         esac
9355         case "$asctime_r_proto" in
9356         ''|0) try='int asctime_r(const struct tm*, char*);'
9357         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9358         esac
9359         case "$asctime_r_proto" in
9360         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9361         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9362         esac
9363         case "$asctime_r_proto" in
9364         ''|0)   d_asctime_r=undef
9365                 asctime_r_proto=0
9366                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9367         * )     case "$asctime_r_proto" in
9368                 REENTRANT_PROTO*) ;;
9369                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9370                 esac
9371                 echo "Prototype: $try" ;;
9372         esac
9373         ;;
9374         *)      case "$usethreads" in
9375                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9376                 esac
9377                 d_asctime_r=undef
9378                 asctime_r_proto=0
9379                 ;;
9380         esac
9381         ;;
9382 *)      asctime_r_proto=0
9383         ;;
9384 esac
9385
9386 : see if atolf exists
9387 set atolf d_atolf
9388 eval $inlibc
9389
9390 : see if atoll exists
9391 set atoll d_atoll
9392 eval $inlibc
9393
9394 : Look for GNU-cc style attribute checking
9395 echo " "
9396 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9397 $cat >attrib.c <<'EOCP'
9398 #include <stdio.h>
9399 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9400 EOCP
9401 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9402         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9403                 echo "Your C compiler doesn't fully support __attribute__."
9404                 val="$undef"
9405         else
9406                 echo "Your C compiler supports __attribute__."
9407                 val="$define"
9408         fi
9409 else
9410         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9411         val="$undef"
9412 fi
9413 set d_attribut
9414 eval $setvar
9415 $rm -f attrib*
9416
9417 : see if bcmp exists
9418 set bcmp d_bcmp
9419 eval $inlibc
9420
9421 : see if bcopy exists
9422 set bcopy d_bcopy
9423 eval $inlibc
9424
9425 : see if this is a unistd.h system
9426 set unistd.h i_unistd
9427 eval $inhdr
9428
9429 : see if getpgrp exists
9430 set getpgrp d_getpgrp
9431 eval $inlibc
9432
9433 case "$d_getpgrp" in
9434 "$define")
9435         echo " "
9436         echo "Checking to see which flavor of getpgrp is in use..."
9437         $cat >try.c <<EOP
9438 #$i_unistd I_UNISTD
9439 #include <sys/types.h>
9440 #ifdef I_UNISTD
9441 #  include <unistd.h>
9442 #endif
9443 int main()
9444 {
9445         if (getuid() == 0) {
9446                 printf("(I see you are running Configure as super-user...)\n");
9447                 setuid(1);
9448         }
9449 #ifdef TRY_BSD_PGRP
9450         if (getpgrp(1) == 0)
9451                 exit(0);
9452 #else
9453         if (getpgrp() > 0)
9454                 exit(0);
9455 #endif
9456         exit(1);
9457 }
9458 EOP
9459         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9460                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9461                 val="$define"
9462         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9463                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9464                 val="$undef"
9465         else
9466                 echo "I can't seem to compile and run the test program."
9467                 if ./usg; then
9468                         xxx="a USG one, i.e. you use getpgrp()."
9469                 else
9470                         # SVR4 systems can appear rather BSD-ish.
9471                         case "$i_unistd" in
9472                         $undef)
9473                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9474                                 val="$define"
9475                                 ;;
9476                         $define)
9477                                 xxx="probably a USG one, i.e. you use getpgrp()."
9478                                 val="$undef"
9479                                 ;;
9480                         esac
9481                 fi
9482                 echo "Assuming your getpgrp is $xxx" >&4
9483         fi
9484         ;;
9485 *) val="$undef";;
9486 esac
9487 set d_bsdgetpgrp
9488 eval $setvar
9489 $rm -f try try.*
9490
9491 : see if setpgrp exists
9492 set setpgrp d_setpgrp
9493 eval $inlibc
9494
9495 case "$d_setpgrp" in
9496 "$define")
9497         echo " "
9498         echo "Checking to see which flavor of setpgrp is in use..."
9499         $cat >try.c <<EOP
9500 #$i_unistd I_UNISTD
9501 #include <sys/types.h>
9502 #ifdef I_UNISTD
9503 #  include <unistd.h>
9504 #endif
9505 int main()
9506 {
9507         if (getuid() == 0) {
9508                 printf("(I see you are running Configure as super-user...)\n");
9509                 setuid(1);
9510         }
9511 #ifdef TRY_BSD_PGRP
9512         if (-1 == setpgrp(1, 1))
9513                 exit(0);
9514 #else
9515         if (setpgrp() != -1)
9516                 exit(0);
9517 #endif
9518         exit(1);
9519 }
9520 EOP
9521         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9522                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9523                 val="$define"
9524         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9525                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9526                 val="$undef"
9527         else
9528                 echo "(I can't seem to compile and run the test program.)"
9529                 if ./usg; then
9530                         xxx="a USG one, i.e. you use setpgrp()."
9531                 else
9532                         # SVR4 systems can appear rather BSD-ish.
9533                         case "$i_unistd" in
9534                         $undef)
9535                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9536                                 val="$define"
9537                                 ;;
9538                         $define)
9539                                 xxx="probably a USG one, i.e. you use setpgrp()."
9540                                 val="$undef"
9541                                 ;;
9542                         esac
9543                 fi
9544                 echo "Assuming your setpgrp is $xxx" >&4
9545         fi
9546         ;;
9547 *) val="$undef";;
9548 esac
9549 set d_bsdsetpgrp
9550 eval $setvar
9551 $rm -f try try.*
9552 : see if bzero exists
9553 set bzero d_bzero
9554 eval $inlibc
9555
9556 : see if signal is declared as pointer to function returning int or void
9557 echo " "
9558 xxx=`./findhdr signal.h`
9559 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9560 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9561         echo "You have int (*signal())() instead of void." >&4
9562         val="$undef"
9563 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9564         echo "You have void (*signal())()." >&4
9565         val="$define"
9566 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9567         echo "You have int (*signal())() instead of void." >&4
9568         val="$undef"
9569 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9570         echo "You have void (*signal())()." >&4
9571         val="$define"
9572 else
9573         case "$d_voidsig" in
9574         '')
9575         echo "I can't determine whether signal handler returns void or int..." >&4
9576                 dflt=void
9577                 rp="What type does your signal handler return?"
9578                 . ./myread
9579                 case "$ans" in
9580                 v*) val="$define";;
9581                 *) val="$undef";;
9582                 esac;;
9583         "$define")
9584                 echo "As you already told me, signal handler returns void." >&4
9585                 val="$define"
9586                 ;;
9587         *)      echo "As you already told me, signal handler returns int." >&4
9588                 val="$undef"
9589                 ;;
9590         esac
9591 fi
9592 set d_voidsig
9593 eval $setvar
9594 case "$d_voidsig" in
9595 "$define") signal_t="void";;
9596 *) signal_t="int";;
9597 esac
9598 $rm -f $$.tmp
9599
9600 : check for ability to cast large floats to 32-bit ints.
9601 echo " "
9602 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9603 if $test "$intsize" -ge 4; then
9604         xxx=int
9605 else
9606         xxx=long
9607 fi
9608 $cat >try.c <<EOCP
9609 #include <stdio.h>
9610 #include <sys/types.h>
9611 #include <signal.h>
9612 $signal_t blech(s) int s; { exit(3); }
9613 int main()
9614 {
9615         $xxx i32;
9616         double f, g;
9617         int result = 0;
9618         char str[16];
9619         signal(SIGFPE, blech);
9620
9621         /* Don't let compiler optimize the test away.  Store the number 
9622            in a writable string for gcc to pass to sscanf under HP/UX.
9623         */
9624         sprintf(str, "2147483647");
9625         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9626         g = 10 * f;
9627         i32  = ($xxx) g;
9628
9629         /* x86 processors will probably give 0x8000 0000, which is a
9630        sign change.  We don't want that.  We want to mimic SPARC
9631            behavior here, which is to preserve the sign and give
9632            back 0x7fff ffff.
9633         */
9634         if (i32 != ($xxx) f)
9635                 result |= 1;
9636         exit(result);
9637 }
9638 EOCP
9639 set try
9640 if eval $compile_ok; then
9641         $run ./try
9642         yyy=$?
9643 else
9644         echo "(I can't seem to compile the test program--assuming it can't)"
9645         yyy=1
9646 fi
9647 case "$yyy" in
9648 0)      val="$define"
9649         echo "Yup, it can."
9650         ;;
9651 *)      val="$undef"
9652         echo "Nope, it can't."
9653         ;;
9654 esac
9655 set d_casti32
9656 eval $setvar
9657 $rm -f try try.*
9658
9659 : check for ability to cast negative floats to unsigned
9660 echo " "
9661 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9662 $cat >try.c <<EOCP
9663 #include <stdio.h>
9664 #include <sys/types.h>
9665 #include <signal.h>
9666 $signal_t blech(s) int s; { exit(7); }
9667 $signal_t blech_in_list(s) int s; { exit(4); }
9668 unsigned long dummy_long(p) unsigned long p; { return p; }
9669 unsigned int dummy_int(p) unsigned int p; { return p; }
9670 unsigned short dummy_short(p) unsigned short p; { return p; }
9671 int main()
9672 {
9673         double f;
9674         unsigned long along;
9675         unsigned int aint;
9676         unsigned short ashort;
9677         int result = 0;
9678         char str[16];
9679         
9680         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9681            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9682            optimized the whole file away
9683         */
9684         /* Store the number in a writable string for gcc to pass to 
9685            sscanf under HP/UX.
9686         */
9687         sprintf(str, "-123");
9688         sscanf(str, "%lf", &f);  /* f = -123.; */
9689
9690         signal(SIGFPE, blech);
9691         along = (unsigned long)f;
9692         aint = (unsigned int)f;
9693         ashort = (unsigned short)f;
9694         if (along != (unsigned long)-123)
9695                 result |= 1;
9696         if (aint != (unsigned int)-123)
9697                 result |= 1;
9698         if (ashort != (unsigned short)-123)
9699                 result |= 1;
9700         sprintf(str, "1073741824.");
9701         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9702         f = f + f;
9703         along = 0;
9704         along = (unsigned long)f;
9705         if (along != 0x80000000)
9706                 result |= 2;
9707         f -= 1.;
9708         along = 0;
9709         along = (unsigned long)f;
9710         if (along != 0x7fffffff)
9711                 result |= 1;
9712         f += 2.;
9713         along = 0;
9714         along = (unsigned long)f;
9715         if (along != 0x80000001)
9716                 result |= 2;
9717         if (result)
9718                 exit(result);
9719         signal(SIGFPE, blech_in_list);
9720         sprintf(str, "123.");
9721         sscanf(str, "%lf", &f);  /* f = 123.; */
9722         along = dummy_long((unsigned long)f);
9723         aint = dummy_int((unsigned int)f);
9724         ashort = dummy_short((unsigned short)f);
9725         if (along != (unsigned long)123)
9726                 result |= 4;
9727         if (aint != (unsigned int)123)
9728                 result |= 4;
9729         if (ashort != (unsigned short)123)
9730                 result |= 4;
9731         exit(result);
9732
9733 }
9734 EOCP
9735 set try
9736 if eval $compile_ok; then
9737         $run ./try
9738         castflags=$?
9739 else
9740         echo "(I can't seem to compile the test program--assuming it can't)"
9741         castflags=7
9742 fi
9743 case "$castflags" in
9744 0)      val="$define"
9745         echo "Yup, it can."
9746         ;;
9747 *)      val="$undef"
9748         echo "Nope, it can't."
9749         ;;
9750 esac
9751 set d_castneg
9752 eval $setvar
9753 $rm -f try.*
9754
9755 : see if vprintf exists
9756 echo " "
9757 if set vprintf val -f d_vprintf; eval $csym; $val; then
9758         echo 'vprintf() found.' >&4
9759         val="$define"
9760         $cat >try.c <<'EOF'
9761 #include <varargs.h>
9762
9763 int main() { xxx("foo"); }
9764
9765 xxx(va_alist)
9766 va_dcl
9767 {
9768         va_list args;
9769         char buf[10];
9770
9771         va_start(args);
9772         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9773 }
9774 EOF
9775         set try
9776         if eval $compile && $run ./try; then
9777                 echo "Your vsprintf() returns (int)." >&4
9778                 val2="$undef"
9779         else
9780                 echo "Your vsprintf() returns (char*)." >&4
9781                 val2="$define"
9782         fi
9783 else
9784         echo 'vprintf() NOT found.' >&4
9785                 val="$undef"
9786                 val2="$undef"
9787 fi
9788 $rm -f try try.*
9789 set d_vprintf
9790 eval $setvar
9791 val=$val2
9792 set d_charvspr
9793 eval $setvar
9794
9795 : see if chown exists
9796 set chown d_chown
9797 eval $inlibc
9798
9799 : see if chroot exists
9800 set chroot d_chroot
9801 eval $inlibc
9802
9803 : see if chsize exists
9804 set chsize d_chsize
9805 eval $inlibc
9806
9807 : see if class exists
9808 set class d_class
9809 eval $inlibc
9810
9811 hasstruct='varname=$1; struct=$2; shift; shift;
9812 while $test $# -ge 2; do
9813         case "$1" in
9814         $define) echo "#include <$2>";;
9815         esac ;
9816     shift 2;
9817 done > try.c;
9818 echo "int main () { struct $struct foo; }" >> try.c;
9819 set try;
9820 if eval $compile; then
9821         val="$define";
9822 else
9823         val="$undef";
9824 fi;
9825 set $varname;
9826 eval $setvar;
9827 $rm -f try.c try.o'
9828
9829 socketlib=''
9830 sockethdr=''
9831 : see whether socket exists
9832 echo " "
9833 $echo $n "Hmm... $c" >&4
9834 if set socket val -f d_socket; eval $csym; $val; then
9835         echo "Looks like you have Berkeley networking support." >&4
9836         d_socket="$define"
9837         if set setsockopt val -f; eval $csym; $val; then
9838                 d_oldsock="$undef"
9839         else
9840                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9841                 d_oldsock="$define"
9842         fi
9843 else
9844         if $contains socklib libc.list >/dev/null 2>&1; then
9845                 echo "Looks like you have Berkeley networking support." >&4
9846                 d_socket="$define"
9847                 : we will have to assume that it supports the 4.2 BSD interface
9848                 d_oldsock="$undef"
9849         else
9850                 echo "You don't have Berkeley networking in libc$_a..." >&4
9851                 if test "X$d_socket" = "X$define"; then
9852                    echo "...but you seem to believe that you have sockets." >&4
9853                 else
9854                         for net in net socket
9855                         do
9856                                 if test -f /usr/lib/lib$net$_a; then
9857                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9858                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9859                                         if $contains socket libc.list >/dev/null 2>&1; then
9860                                                 d_socket="$define"
9861                                                 socketlib="-l$net"
9862                                                 case "$net" in
9863                                                 net)
9864                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9865                                                         sockethdr="-I/usr/netinclude"
9866                                                         ;;
9867                                                 esac
9868                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9869                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9870                                                         d_oldsock="$undef"
9871                                                 else
9872                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9873                                                         d_oldsock="$define"
9874                                                 fi
9875                                                 break
9876                                         fi
9877                                 fi
9878                         done
9879                         if test "X$d_socket" != "X$define"; then
9880                            echo "or anywhere else I see." >&4
9881                            d_socket="$undef"
9882                            d_oldsock="$undef"
9883                         fi
9884                 fi
9885         fi
9886 fi
9887
9888 : see if socketpair exists
9889 set socketpair d_sockpair
9890 eval $inlibc
9891
9892
9893 echo " "
9894 echo "Checking the availability of certain socket constants..." >&4
9895 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9896         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9897         $cat >try.c <<EOF
9898 #include <sys/types.h>
9899 #include <sys/socket.h>
9900 int main() {
9901     int i = $ENUM;
9902 }
9903 EOF
9904         val="$undef"
9905         set try; if eval $compile; then
9906                 val="$define"
9907         fi
9908         set d_${enum}; eval $setvar
9909         $rm -f try.c try
9910 done
9911
9912 : see if this is a sys/uio.h system
9913 set sys/uio.h i_sysuio
9914 eval $inhdr
9915
9916
9917 echo " "
9918 echo "Checking to see if your system supports struct cmsghdr..." >&4
9919 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9920 eval $hasstruct
9921 case "$d_cmsghdr_s" in
9922 "$define")      echo "Yes, it does."   ;;
9923 *)              echo "No, it doesn't." ;;
9924 esac
9925
9926
9927 : check for const keyword
9928 echo " "
9929 echo 'Checking to see if your C compiler knows about "const"...' >&4
9930 $cat >const.c <<'EOCP'
9931 typedef struct spug { int drokk; } spug;
9932 main()
9933 {
9934         const char *foo;
9935         const spug y;
9936 }
9937 EOCP
9938 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9939         val="$define"
9940         echo "Yup, it does."
9941 else
9942         val="$undef"
9943         echo "Nope, it doesn't."
9944 fi
9945 set d_const
9946 eval $setvar
9947
9948 : see if crypt exists
9949 echo " "
9950 set crypt d_crypt
9951 eval $inlibc
9952 case "$d_crypt" in
9953 $define) cryptlib='' ;;
9954 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9955                 echo 'crypt() found.' >&4
9956                 val="$define"
9957                 cryptlib=''
9958         else
9959                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9960                 if $test -z "$cryptlib"; then
9961                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9962                 else
9963                         cryptlib=-lcrypt
9964                 fi
9965                 if $test -z "$cryptlib"; then
9966                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9967                 else
9968                         cryptlib=-lcrypt
9969                 fi
9970                 if $test -z "$cryptlib"; then
9971                         cryptlib=`./loc libcrypt$_a "" $libpth`
9972                 else
9973                         cryptlib=-lcrypt
9974                 fi
9975                 if $test -z "$cryptlib"; then
9976                         echo 'crypt() NOT found.' >&4
9977                         val="$undef"
9978                 else
9979                         val="$define"
9980                 fi
9981         fi
9982         set d_crypt
9983         eval $setvar
9984         ;;
9985 esac
9986
9987 : see if this is a crypt.h system
9988 set crypt.h i_crypt
9989 eval $inhdr
9990
9991 : see if crypt_r exists
9992 set crypt_r d_crypt_r
9993 eval $inlibc
9994 case "$d_crypt_r" in
9995 "$define")
9996         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9997         case "$d_crypt_r_proto:$usethreads" in
9998         ":define")      d_crypt_r_proto=define
9999                 set d_crypt_r_proto crypt_r $hdrs
10000                 eval $hasproto ;;
10001         *)      ;;
10002         esac
10003         case "$d_crypt_r_proto" in
10004         define)
10005         case "$crypt_r_proto" in
10006         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10007         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10008         esac
10009         case "$crypt_r_proto" in
10010         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10011         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10012         esac
10013         case "$crypt_r_proto" in
10014         ''|0)   d_crypt_r=undef
10015                 crypt_r_proto=0
10016                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10017         * )     case "$crypt_r_proto" in
10018                 REENTRANT_PROTO*) ;;
10019                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10020                 esac
10021                 echo "Prototype: $try" ;;
10022         esac
10023         ;;
10024         *)      case "$usethreads" in
10025                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10026                 esac
10027                 d_crypt_r=undef
10028                 crypt_r_proto=0
10029                 ;;
10030         esac
10031         ;;
10032 *)      crypt_r_proto=0
10033         ;;
10034 esac
10035
10036 : get csh whereabouts
10037 case "$csh" in
10038 'csh') val="$undef" ;;
10039 *) val="$define" ;;
10040 esac
10041 set d_csh
10042 eval $setvar
10043 : Respect a hint or command line value for full_csh.
10044 case "$full_csh" in
10045 '') full_csh=$csh ;;
10046 esac
10047
10048 : see if ctermid_r exists
10049 set ctermid_r d_ctermid_r
10050 eval $inlibc
10051 case "$d_ctermid_r" in
10052 "$define")
10053         hdrs="$i_systypes sys/types.h define stdio.h "
10054         case "$d_ctermid_r_proto:$usethreads" in
10055         ":define")      d_ctermid_r_proto=define
10056                 set d_ctermid_r_proto ctermid_r $hdrs
10057                 eval $hasproto ;;
10058         *)      ;;
10059         esac
10060         case "$d_ctermid_r_proto" in
10061         define)
10062         case "$ctermid_r_proto" in
10063         ''|0) try='char* ctermid_r(char*);'
10064         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10065         esac
10066         case "$ctermid_r_proto" in
10067         ''|0)   d_ctermid_r=undef
10068                 ctermid_r_proto=0
10069                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10070         * )     case "$ctermid_r_proto" in
10071                 REENTRANT_PROTO*) ;;
10072                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10073                 esac
10074                 echo "Prototype: $try" ;;
10075         esac
10076         ;;
10077         *)      case "$usethreads" in
10078                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10079                 esac
10080                 d_ctermid_r=undef
10081                 ctermid_r_proto=0
10082                 ;;
10083         esac
10084         ;;
10085 *)      ctermid_r_proto=0
10086         ;;
10087 esac
10088
10089 : see if ctime_r exists
10090 set ctime_r d_ctime_r
10091 eval $inlibc
10092 case "$d_ctime_r" in
10093 "$define")
10094         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10095         case "$d_ctime_r_proto:$usethreads" in
10096         ":define")      d_ctime_r_proto=define
10097                 set d_ctime_r_proto ctime_r $hdrs
10098                 eval $hasproto ;;
10099         *)      ;;
10100         esac
10101         case "$d_ctime_r_proto" in
10102         define)
10103         case "$ctime_r_proto" in
10104         ''|0) try='char* ctime_r(const time_t*, char*);'
10105         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10106         esac
10107         case "$ctime_r_proto" in
10108         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10109         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10110         esac
10111         case "$ctime_r_proto" in
10112         ''|0) try='int ctime_r(const time_t*, char*);'
10113         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10114         esac
10115         case "$ctime_r_proto" in
10116         ''|0) try='int ctime_r(const time_t*, char*, int);'
10117         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10118         esac
10119         case "$ctime_r_proto" in
10120         ''|0)   d_ctime_r=undef
10121                 ctime_r_proto=0
10122                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10123         * )     case "$ctime_r_proto" in
10124                 REENTRANT_PROTO*) ;;
10125                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10126                 esac
10127                 echo "Prototype: $try" ;;
10128         esac
10129         ;;
10130         *)      case "$usethreads" in
10131                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10132                 esac
10133                 d_ctime_r=undef
10134                 ctime_r_proto=0
10135                 ;;
10136         esac
10137         ;;
10138 *)      ctime_r_proto=0
10139         ;;
10140 esac
10141
10142 : see if cuserid exists
10143 set cuserid d_cuserid
10144 eval $inlibc
10145
10146 : see if this is a limits.h system
10147 set limits.h i_limits
10148 eval $inhdr
10149
10150 : see if this is a float.h system
10151 set float.h i_float
10152 eval $inhdr
10153
10154 : See if number of significant digits in a double precision number is known
10155 echo " "
10156 $cat >dbl_dig.c <<EOM
10157 #$i_limits I_LIMITS
10158 #$i_float I_FLOAT
10159 #ifdef I_LIMITS
10160 #include <limits.h>
10161 #endif
10162 #ifdef I_FLOAT
10163 #include <float.h>
10164 #endif
10165 #ifdef DBL_DIG
10166 printf("Contains DBL_DIG");
10167 #endif
10168 EOM
10169 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10170 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10171         echo "DBL_DIG found." >&4
10172         val="$define"
10173 else
10174         echo "DBL_DIG NOT found." >&4
10175         val="$undef"
10176 fi
10177 $rm -f dbl_dig.?
10178 set d_dbl_dig
10179 eval $setvar
10180
10181 : see if dbm.h is available
10182 : see if dbmclose exists
10183 set dbmclose d_dbmclose
10184 eval $inlibc
10185
10186 case "$d_dbmclose" in
10187 $define)
10188         set dbm.h i_dbm
10189         eval $inhdr
10190         case "$i_dbm" in
10191         $define)
10192                 val="$undef"
10193                 set i_rpcsvcdbm
10194                 eval $setvar
10195                 ;;
10196         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10197                 eval $inhdr
10198                 ;;
10199         esac
10200         ;;
10201 *)      echo "We won't be including <dbm.h>"
10202         val="$undef"
10203         set i_dbm
10204         eval $setvar
10205         val="$undef"
10206         set i_rpcsvcdbm
10207         eval $setvar
10208         ;;
10209 esac
10210
10211 : see if prototype for dbminit is available
10212 echo " "
10213 set d_dbminitproto dbminit $i_dbm dbm.h
10214 eval $hasproto
10215
10216 : see if difftime exists
10217 set difftime d_difftime
10218 eval $inlibc
10219
10220 : see if this is a dirent system
10221 echo " "
10222 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10223         val="$define"
10224         echo "<dirent.h> found." >&4
10225 else
10226         val="$undef"
10227         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10228                 echo "<sys/dir.h> found." >&4
10229                 echo " "
10230         else
10231                 xinc=`./findhdr sys/ndir.h`
10232         fi
10233         echo "<dirent.h> NOT found." >&4
10234 fi
10235 set i_dirent
10236 eval $setvar
10237
10238 : Look for type of directory structure.
10239 echo " "
10240 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10241
10242 case "$direntrytype" in
10243 ''|' ')
10244         case "$i_dirent" in
10245         $define) guess1='struct dirent' ;;
10246         *) guess1='struct direct'  ;;
10247         esac
10248         ;;
10249 *)      guess1="$direntrytype"
10250         ;;
10251 esac
10252
10253 case "$guess1" in
10254 'struct dirent') guess2='struct direct' ;;
10255 *) guess2='struct dirent' ;;
10256 esac
10257                 
10258 if $contains "$guess1" try.c >/dev/null 2>&1; then
10259         direntrytype="$guess1"
10260         echo "Your directory entries are $direntrytype." >&4
10261 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10262         direntrytype="$guess2"
10263         echo "Your directory entries seem to be $direntrytype." >&4
10264 else
10265         echo "I don't recognize your system's directory entries." >&4
10266         rp="What type is used for directory entries on this system?"
10267         dflt="$guess1"
10268         . ./myread
10269         direntrytype="$ans"
10270 fi
10271 $rm -f try.c
10272
10273
10274 : see if the directory entry stores field length
10275 echo " "
10276 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10277 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10278         echo "Good, your directory entry keeps length information in d_namlen." >&4
10279         val="$define"
10280 else
10281         echo "Your directory entry does not know about the d_namlen field." >&4
10282         val="$undef"
10283 fi
10284 set d_dirnamlen
10285 eval $setvar
10286 $rm -f try.c
10287
10288 : see if this is an sysdir system
10289 set sys/dir.h i_sysdir
10290 eval $inhdr
10291
10292 : see if this is an sysndir system
10293 set sys/ndir.h i_sysndir
10294 eval $inhdr
10295
10296 : Look for dirfd
10297 echo " "
10298 $cat >dirfd.c <<EOM
10299 #include <stdio.h>
10300 #$i_dirent I_DIRENT             /**/
10301 #$i_sysdir I_SYS_DIR            /**/
10302 #$i_sysndir I_SYS_NDIR          /**/
10303 #$i_systypes I_SYS_TYPES        /**/
10304 #if defined(I_SYS_TYPES)
10305 #include <sys/types.h>
10306 #endif
10307 #if defined(I_DIRENT)
10308 #include <dirent.h>
10309 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10310 #include <sys/dir.h>
10311 #endif
10312 #else
10313 #ifdef I_SYS_NDIR
10314 #include <sys/ndir.h>
10315 #else
10316 #ifdef I_SYS_DIR
10317 #ifdef hp9000s500
10318 #include <ndir.h>       /* may be wrong in the future */
10319 #else
10320 #include <sys/dir.h>
10321 #endif
10322 #endif
10323 #endif
10324 #endif 
10325 int main() {
10326         DIR *dirp = opendir(".");
10327         if (dirfd(dirp) >= 0)
10328                 exit(0);
10329         else
10330                 exit(1);
10331 }
10332 EOM
10333 set dirfd
10334 if eval $compile; then
10335         val="$define"
10336 fi
10337 case "$val" in
10338 $define)        echo "dirfd() found." >&4       ;;
10339 *)              echo "dirfd() NOT found." >&4   ;;
10340 esac
10341 set d_dirfd
10342 eval $setvar
10343 $rm -f dirfd*
10344
10345 : see if dlerror exists
10346 xxx_runnm="$runnm"
10347 runnm=false
10348 set dlerror d_dlerror
10349 eval $inlibc
10350 runnm="$xxx_runnm"
10351
10352 : see if dlfcn is available
10353 set dlfcn.h i_dlfcn
10354 eval $inhdr
10355
10356 case "$usedl" in
10357 $define|y|true)
10358         $cat << EOM
10359
10360 On a few systems, the dynamically loaded modules that perl generates and uses
10361 will need a different extension than shared libs. The default will probably
10362 be appropriate.
10363
10364 EOM
10365         case "$dlext" in
10366         '')     dflt="$so" ;;
10367         *)      dflt="$dlext" ;;
10368         esac
10369         rp='What is the extension of dynamically loaded modules'
10370         . ./myread
10371         dlext="$ans"
10372         ;;
10373 *)
10374         dlext="none"
10375         ;;
10376 esac
10377
10378 : Check if dlsym need a leading underscore
10379 echo " "
10380 val="$undef"
10381
10382 case "$dlsrc" in
10383 dl_dlopen.xs)
10384         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10385         $cat >dyna.c <<'EOM'
10386 fred () { }
10387 EOM
10388
10389 $cat >fred.c<<EOM
10390
10391 #include <stdio.h>
10392 #$i_dlfcn I_DLFCN
10393 #ifdef I_DLFCN
10394 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10395 #else
10396 #include <sys/types.h>
10397 #include <nlist.h>
10398 #include <link.h>
10399 #endif
10400
10401 extern int fred() ;
10402
10403 int main()
10404 {
10405     void * handle ;
10406     void * symbol ;
10407 #ifndef RTLD_LAZY
10408     int mode = 1 ;
10409 #else
10410     int mode = RTLD_LAZY ;
10411 #endif
10412     handle = dlopen("./dyna.$dlext", mode) ;
10413     if (handle == NULL) {
10414         printf ("1\n") ;
10415         fflush (stdout) ;
10416         exit(0);
10417     }
10418     symbol = dlsym(handle, "fred") ;
10419     if (symbol == NULL) {
10420         /* try putting a leading underscore */
10421         symbol = dlsym(handle, "_fred") ;
10422         if (symbol == NULL) {
10423             printf ("2\n") ;
10424             fflush (stdout) ;
10425             exit(0);
10426         }
10427         printf ("3\n") ;
10428     }
10429     else
10430         printf ("4\n") ;
10431     fflush (stdout) ;
10432     exit(0);
10433 }
10434 EOM
10435         : Call the object file tmp-dyna.o in case dlext=o.
10436         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10437                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10438                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10439                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10440                 xxx=`$run ./fred`
10441                 case $xxx in
10442                 1)      echo "Test program failed using dlopen." >&4
10443                         echo "Perhaps you should not use dynamic loading." >&4;;
10444                 2)      echo "Test program failed using dlsym." >&4
10445                         echo "Perhaps you should not use dynamic loading." >&4;;
10446                 3)      echo "dlsym needs a leading underscore" >&4
10447                         val="$define" ;;
10448                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10449                 esac
10450         else
10451                 echo "I can't compile and run the test program." >&4
10452                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10453         fi
10454         ;;
10455 esac
10456                 
10457 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10458
10459 set d_dlsymun
10460 eval $setvar
10461
10462 : see if drand48_r exists
10463 set drand48_r d_drand48_r
10464 eval $inlibc
10465 case "$d_drand48_r" in
10466 "$define")
10467         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10468         case "$d_drand48_r_proto:$usethreads" in
10469         ":define")      d_drand48_r_proto=define
10470                 set d_drand48_r_proto drand48_r $hdrs
10471                 eval $hasproto ;;
10472         *)      ;;
10473         esac
10474         case "$d_drand48_r_proto" in
10475         define)
10476         case "$drand48_r_proto" in
10477         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10478         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10479         esac
10480         case "$drand48_r_proto" in
10481         ''|0)   d_drand48_r=undef
10482                 drand48_r_proto=0
10483                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10484         * )     case "$drand48_r_proto" in
10485                 REENTRANT_PROTO*) ;;
10486                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10487                 esac
10488                 echo "Prototype: $try" ;;
10489         esac
10490         ;;
10491         *)      case "$usethreads" in
10492                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10493                 esac
10494                 d_drand48_r=undef
10495                 drand48_r_proto=0
10496                 ;;
10497         esac
10498         ;;
10499 *)      drand48_r_proto=0
10500         ;;
10501 esac
10502
10503 : see if prototype for drand48 is available
10504 echo " "
10505 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10506 eval $hasproto
10507
10508 : see if dup2 exists
10509 set dup2 d_dup2
10510 eval $inlibc
10511
10512 : see if eaccess exists
10513 set eaccess d_eaccess
10514 eval $inlibc
10515
10516 : see if endgrent exists
10517 set endgrent d_endgrent
10518 eval $inlibc
10519
10520 : see if this is an grp system
10521 set grp.h i_grp
10522 eval $inhdr
10523
10524 case "$i_grp" in
10525 $define)
10526         xxx=`./findhdr grp.h`
10527         $cppstdin $cppflags $cppminus < $xxx >$$.h
10528
10529         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10530                 val="$define"
10531         else
10532                 val="$undef"
10533         fi
10534         set d_grpasswd
10535         eval $setvar
10536
10537         $rm -f $$.h
10538         ;;
10539 *)
10540         val="$undef";
10541         set d_grpasswd; eval $setvar
10542         ;;
10543 esac
10544
10545 : see if endgrent_r exists
10546 set endgrent_r d_endgrent_r
10547 eval $inlibc
10548 case "$d_endgrent_r" in
10549 "$define")
10550         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10551         case "$d_endgrent_r_proto:$usethreads" in
10552         ":define")      d_endgrent_r_proto=define
10553                 set d_endgrent_r_proto endgrent_r $hdrs
10554                 eval $hasproto ;;
10555         *)      ;;
10556         esac
10557         case "$d_endgrent_r_proto" in
10558         define)
10559         case "$endgrent_r_proto" in
10560         ''|0) try='int endgrent_r(FILE**);'
10561         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10562         esac
10563         case "$endgrent_r_proto" in
10564         ''|0) try='void endgrent_r(FILE**);'
10565         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10566         esac
10567         case "$endgrent_r_proto" in
10568         ''|0)   d_endgrent_r=undef
10569                 endgrent_r_proto=0
10570                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10571         * )     case "$endgrent_r_proto" in
10572                 REENTRANT_PROTO*) ;;
10573                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10574                 esac
10575                 echo "Prototype: $try" ;;
10576         esac
10577         ;;
10578         *)      case "$usethreads" in
10579                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10580                 esac
10581                 d_endgrent_r=undef
10582                 endgrent_r_proto=0
10583                 ;;
10584         esac
10585         ;;
10586 *)      endgrent_r_proto=0
10587         ;;
10588 esac
10589
10590 : see if endhostent exists
10591 set endhostent d_endhent
10592 eval $inlibc
10593
10594 : see if this is a netdb.h system
10595 set netdb.h i_netdb
10596 eval $inhdr
10597
10598 : see if endhostent_r exists
10599 set endhostent_r d_endhostent_r
10600 eval $inlibc
10601 case "$d_endhostent_r" in
10602 "$define")
10603         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10604         case "$d_endhostent_r_proto:$usethreads" in
10605         ":define")      d_endhostent_r_proto=define
10606                 set d_endhostent_r_proto endhostent_r $hdrs
10607                 eval $hasproto ;;
10608         *)      ;;
10609         esac
10610         case "$d_endhostent_r_proto" in
10611         define)
10612         case "$endhostent_r_proto" in
10613         ''|0) try='int endhostent_r(struct hostent_data*);'
10614         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10615         esac
10616         case "$endhostent_r_proto" in
10617         ''|0) try='void endhostent_r(struct hostent_data*);'
10618         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10619         esac
10620         case "$endhostent_r_proto" in
10621         ''|0)   d_endhostent_r=undef
10622                 endhostent_r_proto=0
10623                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10624         * )     case "$endhostent_r_proto" in
10625                 REENTRANT_PROTO*) ;;
10626                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10627                 esac
10628                 echo "Prototype: $try" ;;
10629         esac
10630         ;;
10631         *)      case "$usethreads" in
10632                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10633                 esac
10634                 d_endhostent_r=undef
10635                 endhostent_r_proto=0
10636                 ;;
10637         esac
10638         ;;
10639 *)      endhostent_r_proto=0
10640         ;;
10641 esac
10642
10643 : see if endnetent exists
10644 set endnetent d_endnent
10645 eval $inlibc
10646
10647 : see if endnetent_r exists
10648 set endnetent_r d_endnetent_r
10649 eval $inlibc
10650 case "$d_endnetent_r" in
10651 "$define")
10652         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10653         case "$d_endnetent_r_proto:$usethreads" in
10654         ":define")      d_endnetent_r_proto=define
10655                 set d_endnetent_r_proto endnetent_r $hdrs
10656                 eval $hasproto ;;
10657         *)      ;;
10658         esac
10659         case "$d_endnetent_r_proto" in
10660         define)
10661         case "$endnetent_r_proto" in
10662         ''|0) try='int endnetent_r(struct netent_data*);'
10663         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10664         esac
10665         case "$endnetent_r_proto" in
10666         ''|0) try='void endnetent_r(struct netent_data*);'
10667         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10668         esac
10669         case "$endnetent_r_proto" in
10670         ''|0)   d_endnetent_r=undef
10671                 endnetent_r_proto=0
10672                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10673         * )     case "$endnetent_r_proto" in
10674                 REENTRANT_PROTO*) ;;
10675                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10676                 esac
10677                 echo "Prototype: $try" ;;
10678         esac
10679         ;;
10680         *)      case "$usethreads" in
10681                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10682                 esac
10683                 d_endnetent_r=undef
10684                 endnetent_r_proto=0
10685                 ;;
10686         esac
10687         ;;
10688 *)      endnetent_r_proto=0
10689         ;;
10690 esac
10691
10692 : see if endprotoent exists
10693 set endprotoent d_endpent
10694 eval $inlibc
10695
10696 : see if endprotoent_r exists
10697 set endprotoent_r d_endprotoent_r
10698 eval $inlibc
10699 case "$d_endprotoent_r" in
10700 "$define")
10701         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10702         case "$d_endprotoent_r_proto:$usethreads" in
10703         ":define")      d_endprotoent_r_proto=define
10704                 set d_endprotoent_r_proto endprotoent_r $hdrs
10705                 eval $hasproto ;;
10706         *)      ;;
10707         esac
10708         case "$d_endprotoent_r_proto" in
10709         define)
10710         case "$endprotoent_r_proto" in
10711         ''|0) try='int endprotoent_r(struct protoent_data*);'
10712         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10713         esac
10714         case "$endprotoent_r_proto" in
10715         ''|0) try='void endprotoent_r(struct protoent_data*);'
10716         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10717         esac
10718         case "$endprotoent_r_proto" in
10719         ''|0)   d_endprotoent_r=undef
10720                 endprotoent_r_proto=0
10721                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10722         * )     case "$endprotoent_r_proto" in
10723                 REENTRANT_PROTO*) ;;
10724                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10725                 esac
10726                 echo "Prototype: $try" ;;
10727         esac
10728         ;;
10729         *)      case "$usethreads" in
10730                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10731                 esac
10732                 d_endprotoent_r=undef
10733                 endprotoent_r_proto=0
10734                 ;;
10735         esac
10736         ;;
10737 *)      endprotoent_r_proto=0
10738         ;;
10739 esac
10740
10741 : see if endpwent exists
10742 set endpwent d_endpwent
10743 eval $inlibc
10744
10745 : see if this is a pwd.h system
10746 set pwd.h i_pwd
10747 eval $inhdr
10748
10749 case "$i_pwd" in
10750 $define)
10751         xxx=`./findhdr pwd.h`
10752         $cppstdin $cppflags $cppminus < $xxx >$$.h
10753
10754         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10755                 val="$define"
10756         else
10757                 val="$undef"
10758         fi
10759         set d_pwquota
10760         eval $setvar
10761
10762         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10763                 val="$define"
10764         else
10765                 val="$undef"
10766         fi
10767         set d_pwage
10768         eval $setvar
10769
10770         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10771                 val="$define"
10772         else
10773                 val="$undef"
10774         fi
10775         set d_pwchange
10776         eval $setvar
10777
10778         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10779                 val="$define"
10780         else
10781                 val="$undef"
10782         fi
10783         set d_pwclass
10784         eval $setvar
10785
10786         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10787                 val="$define"
10788         else
10789                 val="$undef"
10790         fi
10791         set d_pwexpire
10792         eval $setvar
10793
10794         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10795                 val="$define"
10796         else
10797                 val="$undef"
10798         fi
10799         set d_pwcomment
10800         eval $setvar
10801
10802         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10803                 val="$define"
10804         else
10805                 val="$undef"
10806         fi
10807         set d_pwgecos
10808         eval $setvar
10809
10810         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10811                 val="$define"
10812         else
10813                 val="$undef"
10814         fi
10815         set d_pwpasswd
10816         eval $setvar
10817
10818         $rm -f $$.h
10819         ;;
10820 *)
10821         val="$undef"; 
10822         set d_pwquota; eval $setvar
10823         set d_pwage; eval $setvar
10824         set d_pwchange; eval $setvar
10825         set d_pwclass; eval $setvar
10826         set d_pwexpire; eval $setvar
10827         set d_pwcomment; eval $setvar
10828         set d_pwgecos; eval $setvar
10829         set d_pwpasswd; eval $setvar
10830         ;;
10831 esac
10832
10833 : see if endpwent_r exists
10834 set endpwent_r d_endpwent_r
10835 eval $inlibc
10836 case "$d_endpwent_r" in
10837 "$define")
10838         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10839         case "$d_endpwent_r_proto:$usethreads" in
10840         ":define")      d_endpwent_r_proto=define
10841                 set d_endpwent_r_proto endpwent_r $hdrs
10842                 eval $hasproto ;;
10843         *)      ;;
10844         esac
10845         case "$d_endpwent_r_proto" in
10846         define)
10847         case "$endpwent_r_proto" in
10848         ''|0) try='int endpwent_r(FILE**);'
10849         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10850         esac
10851         case "$endpwent_r_proto" in
10852         ''|0) try='void endpwent_r(FILE**);'
10853         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10854         esac
10855         case "$endpwent_r_proto" in
10856         ''|0)   d_endpwent_r=undef
10857                 endpwent_r_proto=0
10858                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10859         * )     case "$endpwent_r_proto" in
10860                 REENTRANT_PROTO*) ;;
10861                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10862                 esac
10863                 echo "Prototype: $try" ;;
10864         esac
10865         ;;
10866         *)      case "$usethreads" in
10867                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10868                 esac
10869                 d_endpwent_r=undef
10870                 endpwent_r_proto=0
10871                 ;;
10872         esac
10873         ;;
10874 *)      endpwent_r_proto=0
10875         ;;
10876 esac
10877
10878 : see if endservent exists
10879 set endservent d_endsent
10880 eval $inlibc
10881
10882 : see if endservent_r exists
10883 set endservent_r d_endservent_r
10884 eval $inlibc
10885 case "$d_endservent_r" in
10886 "$define")
10887         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10888         case "$d_endservent_r_proto:$usethreads" in
10889         ":define")      d_endservent_r_proto=define
10890                 set d_endservent_r_proto endservent_r $hdrs
10891                 eval $hasproto ;;
10892         *)      ;;
10893         esac
10894         case "$d_endservent_r_proto" in
10895         define)
10896         case "$endservent_r_proto" in
10897         ''|0) try='int endservent_r(struct servent_data*);'
10898         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10899         esac
10900         case "$endservent_r_proto" in
10901         ''|0) try='void endservent_r(struct servent_data*);'
10902         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10903         esac
10904         case "$endservent_r_proto" in
10905         ''|0)   d_endservent_r=undef
10906                 endservent_r_proto=0
10907                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10908         * )     case "$endservent_r_proto" in
10909                 REENTRANT_PROTO*) ;;
10910                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10911                 esac
10912                 echo "Prototype: $try" ;;
10913         esac
10914         ;;
10915         *)      case "$usethreads" in
10916                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10917                 esac
10918                 d_endservent_r=undef
10919                 endservent_r_proto=0
10920                 ;;
10921         esac
10922         ;;
10923 *)      endservent_r_proto=0
10924         ;;
10925 esac
10926
10927 : Locate the flags for 'open()'
10928 echo " "
10929 $cat >try.c <<'EOCP'
10930 #include <sys/types.h>
10931 #ifdef I_FCNTL
10932 #include <fcntl.h>
10933 #endif
10934 #ifdef I_SYS_FILE
10935 #include <sys/file.h>
10936 #endif
10937 int main() {
10938         if(O_RDONLY);
10939 #ifdef O_TRUNC
10940         exit(0);
10941 #else
10942         exit(1);
10943 #endif
10944 }
10945 EOCP
10946 : check sys/file.h first to get FREAD on Sun
10947 if $test `./findhdr sys/file.h` && \
10948                 set try -DI_SYS_FILE && eval $compile; then
10949         h_sysfile=true;
10950         echo "<sys/file.h> defines the O_* constants..." >&4
10951         if $run ./try; then
10952                 echo "and you have the 3 argument form of open()." >&4
10953                 val="$define"
10954         else
10955                 echo "but not the 3 argument form of open().  Oh, well." >&4
10956                 val="$undef"
10957         fi
10958 elif $test `./findhdr fcntl.h` && \
10959                 set try -DI_FCNTL && eval $compile; then
10960         h_fcntl=true;
10961         echo "<fcntl.h> defines the O_* constants..." >&4
10962         if $run ./try; then
10963                 echo "and you have the 3 argument form of open()." >&4
10964                 val="$define"
10965         else
10966                 echo "but not the 3 argument form of open().  Oh, well." >&4
10967                 val="$undef"
10968         fi
10969 else
10970         val="$undef"
10971         echo "I can't find the O_* constant definitions!  You got problems." >&4
10972 fi
10973 set d_open3
10974 eval $setvar
10975 $rm -f try try.*
10976
10977 : see which of string.h or strings.h is needed
10978 echo " "
10979 strings=`./findhdr string.h`
10980 if $test "$strings" && $test -r "$strings"; then
10981         echo "Using <string.h> instead of <strings.h>." >&4
10982         val="$define"
10983 else
10984         val="$undef"
10985         strings=`./findhdr strings.h`
10986         if $test "$strings" && $test -r "$strings"; then
10987                 echo "Using <strings.h> instead of <string.h>." >&4
10988         else
10989                 echo "No string header found -- You'll surely have problems." >&4
10990         fi
10991 fi
10992 set i_string
10993 eval $setvar
10994 case "$i_string" in
10995 "$undef") strings=`./findhdr strings.h`;;
10996 *)        strings=`./findhdr string.h`;;
10997 esac
10998
10999 : see if this is a sys/file.h system
11000 val=''
11001 set sys/file.h val
11002 eval $inhdr
11003
11004 : do we need to include sys/file.h ?
11005 case "$val" in
11006 "$define")
11007         echo " "
11008         if $h_sysfile; then
11009                 val="$define"
11010                 echo "We'll be including <sys/file.h>." >&4
11011         else
11012                 val="$undef"
11013                 echo "We won't be including <sys/file.h>." >&4
11014         fi
11015         ;;
11016 *)
11017         h_sysfile=false
11018         ;;
11019 esac
11020 set i_sysfile
11021 eval $setvar
11022
11023 : see if fcntl.h is there
11024 val=''
11025 set fcntl.h val
11026 eval $inhdr
11027
11028 : see if we can include fcntl.h
11029 case "$val" in
11030 "$define")
11031         echo " "
11032         if $h_fcntl; then
11033                 val="$define"
11034                 echo "We'll be including <fcntl.h>." >&4
11035         else
11036                 val="$undef"
11037                 if $h_sysfile; then
11038         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11039                 else
11040                         echo "We won't be including <fcntl.h>." >&4
11041                 fi
11042         fi
11043         ;;
11044 *)
11045         h_fcntl=false
11046         val="$undef"
11047         ;;
11048 esac
11049 set i_fcntl
11050 eval $setvar
11051
11052 : check for non-blocking I/O stuff
11053 case "$h_sysfile" in
11054 true) echo "#include <sys/file.h>" > head.c;;
11055 *)
11056        case "$h_fcntl" in
11057        true) echo "#include <fcntl.h>" > head.c;;
11058        *) echo "#include <sys/fcntl.h>" > head.c;;
11059        esac
11060        ;;
11061 esac
11062 echo " "
11063 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11064 case "$o_nonblock" in
11065 '')
11066         $cat head.c > try.c
11067         $cat >>try.c <<EOCP
11068 #include <stdio.h>
11069 #include <stdlib.h>
11070 #$i_fcntl I_FCNTL
11071 #ifdef I_FCNTL
11072 #include <fcntl.h>
11073 #endif
11074 int main() {
11075 #ifdef O_NONBLOCK
11076         printf("O_NONBLOCK\n");
11077         exit(0);
11078 #endif
11079 #ifdef O_NDELAY
11080         printf("O_NDELAY\n");
11081         exit(0);
11082 #endif
11083 #ifdef FNDELAY
11084         printf("FNDELAY\n");
11085         exit(0);
11086 #endif
11087         exit(0);
11088 }
11089 EOCP
11090         set try
11091         if eval $compile_ok; then
11092                 o_nonblock=`$run ./try`
11093                 case "$o_nonblock" in
11094                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11095                 *) echo "Seems like we can use $o_nonblock.";;
11096                 esac
11097         else
11098                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11099         fi
11100         ;;
11101 *) echo "Using $hint value $o_nonblock.";;
11102 esac
11103 $rm -f try try.* .out core
11104
11105 echo " "
11106 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11107 case "$eagain" in
11108 '')
11109         $cat head.c > try.c
11110         $cat >>try.c <<EOCP
11111 #include <errno.h>
11112 #include <sys/types.h>
11113 #include <signal.h>
11114 #include <stdio.h> 
11115 #include <stdlib.h> 
11116 #$i_fcntl I_FCNTL
11117 #ifdef I_FCNTL
11118 #include <fcntl.h>
11119 #endif
11120 #define MY_O_NONBLOCK $o_nonblock
11121 #ifndef errno  /* XXX need better Configure test */
11122 extern int errno;
11123 #endif
11124 #$i_unistd I_UNISTD
11125 #ifdef I_UNISTD
11126 #include <unistd.h>
11127 #endif
11128 #$i_string I_STRING
11129 #ifdef I_STRING
11130 #include <string.h>
11131 #else
11132 #include <strings.h>
11133 #endif
11134 $signal_t blech(x) int x; { exit(3); }
11135 EOCP
11136         $cat >> try.c <<'EOCP'
11137 int main()
11138 {
11139         int pd[2];
11140         int pu[2];
11141         char buf[1];
11142         char string[100];
11143
11144         pipe(pd);       /* Down: child -> parent */
11145         pipe(pu);       /* Up: parent -> child */
11146         if (0 != fork()) {
11147                 int ret;
11148                 close(pd[1]);   /* Parent reads from pd[0] */
11149                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11150 #ifdef F_SETFL
11151                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11152                         exit(1);
11153 #else
11154                 exit(4);
11155 #endif
11156                 signal(SIGALRM, blech);
11157                 alarm(5);
11158                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11159                         exit(2);
11160                 sprintf(string, "%d\n", ret);
11161                 write(2, string, strlen(string));
11162                 alarm(0);
11163 #ifdef EAGAIN
11164                 if (errno == EAGAIN) {
11165                         printf("EAGAIN\n");
11166                         goto ok;
11167                 }
11168 #endif
11169 #ifdef EWOULDBLOCK
11170                 if (errno == EWOULDBLOCK)
11171                         printf("EWOULDBLOCK\n");
11172 #endif
11173         ok:
11174                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11175                 sleep(2);                               /* Give it time to close our pipe */
11176                 alarm(5);
11177                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11178                 alarm(0);
11179                 sprintf(string, "%d\n", ret);
11180                 write(4, string, strlen(string));
11181                 exit(0);
11182         }
11183
11184         close(pd[0]);                   /* We write to pd[1] */
11185         close(pu[1]);                   /* We read from pu[0] */
11186         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11187         close(pd[1]);                   /* Pipe pd is now fully closed! */
11188         exit(0);                                /* Bye bye, thank you for playing! */
11189 }
11190 EOCP
11191         set try
11192         if eval $compile_ok; then
11193                 echo "$startsh" >mtry
11194                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11195                 chmod +x mtry
11196                 ./mtry >/dev/null 2>&1
11197                 case $? in
11198                 0) eagain=`$cat try.out`;;
11199                 1) echo "Could not perform non-blocking setting!";;
11200                 2) echo "I did a successful read() for something that was not there!";;
11201                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11202                 4) echo "Could not find F_SETFL!";;
11203                 *) echo "Something terribly wrong happened during testing.";;
11204                 esac
11205                 rd_nodata=`$cat try.ret`
11206                 echo "A read() system call with no data present returns $rd_nodata."
11207                 case "$rd_nodata" in
11208                 0|-1) ;;
11209                 *)
11210                         echo "(That's peculiar, fixing that to be -1.)"
11211                         rd_nodata=-1
11212                         ;;
11213                 esac
11214                 case "$eagain" in
11215                 '')
11216                         echo "Forcing errno EAGAIN on read() with no data available."
11217                         eagain=EAGAIN
11218                         ;;
11219                 *)
11220                         echo "Your read() sets errno to $eagain when no data is available."
11221                         ;;
11222                 esac
11223                 status=`$cat try.err`
11224                 case "$status" in
11225                 0) echo "And it correctly returns 0 to signal EOF.";;
11226                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11227                 *) echo "However, your read() returns '$status' on EOF??";;
11228                 esac
11229                 val="$define"
11230                 if test "$status" = "$rd_nodata"; then
11231                         echo "WARNING: you can't distinguish between EOF and no data!"
11232                         val="$undef"
11233                 fi
11234         else
11235                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11236                 eagain=EAGAIN
11237         fi
11238         set d_eofnblk
11239         eval $setvar
11240         ;;
11241 *)
11242         echo "Using $hint value $eagain."
11243         echo "Your read() returns $rd_nodata when no data is present."
11244         case "$d_eofnblk" in
11245         "$define") echo "And you can see EOF because read() returns 0.";;
11246         "$undef") echo "But you can't see EOF status from read() returned value.";;
11247         *)
11248                 echo "(Assuming you can't see EOF status from read anyway.)"
11249                 d_eofnblk=$undef
11250                 ;;
11251         esac
11252         ;;
11253 esac
11254 $rm -f try try.* .out core head.c mtry
11255
11256 : see if fchdir exists
11257 set fchdir d_fchdir
11258 eval $inlibc
11259
11260 : see if fchmod exists
11261 set fchmod d_fchmod
11262 eval $inlibc
11263
11264 : see if fchown exists
11265 set fchown d_fchown
11266 eval $inlibc
11267
11268 : see if this is an fcntl system
11269 set fcntl d_fcntl
11270 eval $inlibc
11271
11272 echo " "
11273 : See if fcntl-based locking works.
11274 $cat >try.c <<EOCP
11275 #include <stdlib.h>
11276 #include <unistd.h>
11277 #include <fcntl.h>
11278 #include <signal.h>
11279 $signal_t blech(x) int x; { exit(3); }
11280 int main() {
11281 #if defined(F_SETLK) && defined(F_SETLKW)
11282      struct flock flock;
11283      int retval, fd;
11284      fd = open("try.c", O_RDONLY);
11285      flock.l_type = F_RDLCK;
11286      flock.l_whence = SEEK_SET;
11287      flock.l_start = flock.l_len = 0;
11288      signal(SIGALRM, blech);
11289      alarm(10);
11290      retval = fcntl(fd, F_SETLK, &flock);
11291      close(fd);
11292      (retval < 0 ? exit(2) : exit(0));
11293 #else
11294      exit(2);
11295 #endif
11296 }
11297 EOCP
11298 echo "Checking if fcntl-based file locking works... "
11299 case "$d_fcntl" in
11300 "$define")
11301         set try
11302         if eval $compile_ok; then
11303                 if $run ./try; then
11304                         echo "Yes, it seems to work."
11305                         val="$define"
11306                 else
11307                         echo "Nope, it didn't work."
11308                         val="$undef"
11309                         case "$?" in
11310                         3) $cat >&4 <<EOM
11311 ***
11312 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11313 *** This is (almost) impossible.
11314 *** If your NFS lock daemons are not feeling well, something like
11315 *** this may happen, please investigate.  Cannot continue, aborting.
11316 ***
11317 EOM
11318                                 exit 1
11319                                 ;;
11320                         esac
11321                 fi
11322         else
11323                 echo "I'm unable to compile the test program, so I'll assume not."
11324                 val="$undef"
11325         fi
11326         ;;
11327 *) val="$undef";
11328         echo "Nope, since you don't even have fcntl()."
11329         ;;
11330 esac
11331 set d_fcntl_can_lock
11332 eval $setvar
11333 $rm -f try*
11334
11335
11336 : check for fd_set items
11337 $cat <<EOM
11338
11339 Checking to see how well your C compiler handles fd_set and friends ...
11340 EOM
11341 $cat >try.c <<EOCP
11342 #$i_systime I_SYS_TIME
11343 #$i_sysselct I_SYS_SELECT
11344 #$d_socket HAS_SOCKET
11345 #include <sys/types.h>
11346 #ifdef HAS_SOCKET
11347 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11348 #endif
11349 #ifdef I_SYS_TIME
11350 #include <sys/time.h>
11351 #endif
11352 #ifdef I_SYS_SELECT
11353 #include <sys/select.h>
11354 #endif
11355 int main() {
11356         fd_set fds;
11357
11358 #ifdef TRYBITS
11359         if(fds.fds_bits);
11360 #endif
11361
11362 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11363         exit(0);
11364 #else
11365         exit(1);
11366 #endif
11367 }
11368 EOCP
11369 set try -DTRYBITS
11370 if eval $compile; then
11371         d_fds_bits="$define"
11372         d_fd_set="$define"
11373         echo "Well, your system knows about the normal fd_set typedef..." >&4
11374         if $run ./try; then
11375                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11376                 d_fd_macros="$define"
11377         else
11378                 $cat >&4 <<'EOM'
11379 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11380 EOM
11381                 d_fd_macros="$undef"
11382         fi
11383 else
11384         $cat <<'EOM'
11385 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11386 EOM
11387         set try
11388         if eval $compile; then
11389                 d_fds_bits="$undef"
11390                 d_fd_set="$define"
11391                 echo "Well, your system has some sort of fd_set available..." >&4
11392                 if $run ./try; then
11393                         echo "and you have the normal fd_set macros." >&4
11394                         d_fd_macros="$define"
11395                 else
11396                         $cat <<'EOM'
11397 but not the normal fd_set macros!  Gross!  More work for me...
11398 EOM
11399                         d_fd_macros="$undef"
11400                 fi
11401         else
11402         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11403                 d_fd_set="$undef"
11404                 d_fds_bits="$undef"
11405                 d_fd_macros="$undef"
11406         fi
11407 fi
11408 $rm -f try try.*
11409
11410 : see if fgetpos exists
11411 set fgetpos d_fgetpos
11412 eval $inlibc
11413
11414 : see if finite exists
11415 set finite d_finite
11416 eval $inlibc
11417
11418 : see if finitel exists
11419 set finitel d_finitel
11420 eval $inlibc
11421
11422 : see if flock exists
11423 set flock d_flock
11424 eval $inlibc
11425
11426 : see if prototype for flock is available
11427 echo " "
11428 set d_flockproto flock $i_sysfile sys/file.h
11429 eval $hasproto
11430
11431 : see if fork exists
11432 set fork d_fork
11433 eval $inlibc
11434
11435 : see if fp_class exists
11436 set fp_class d_fp_class
11437 eval $inlibc
11438
11439 : see if pathconf exists
11440 set pathconf d_pathconf
11441 eval $inlibc
11442
11443 : see if fpathconf exists
11444 set fpathconf d_fpathconf
11445 eval $inlibc
11446
11447 : see if fpclass exists
11448 set fpclass d_fpclass
11449 eval $inlibc
11450
11451 : see if fpclassify exists
11452 set fpclassify d_fpclassify
11453 eval $inlibc
11454
11455 : see if fpclassl exists
11456 set fpclassl d_fpclassl
11457 eval $inlibc
11458
11459
11460 : check for fpos64_t
11461 echo " "
11462 echo "Checking to see if you have fpos64_t..." >&4
11463 $cat >try.c <<EOCP
11464 #include <stdio.h>
11465 int main() { fpos64_t x = 7; }
11466 EOCP
11467 set try
11468 if eval $compile; then
11469         val="$define"
11470         echo "You have fpos64_t."
11471 else
11472         val="$undef"
11473         echo "You do not have fpos64_t."
11474         case "$fpossize" in
11475         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11476         esac
11477 fi
11478 $rm -f try.* try
11479 set d_fpos64_t
11480 eval $setvar
11481
11482 : see if frexpl exists
11483 set frexpl d_frexpl
11484 eval $inlibc
11485
11486 : see if this is a sys/param system
11487 set sys/param.h i_sysparam
11488 eval $inhdr
11489
11490 : see if this is a sys/mount.h system
11491 set sys/mount.h i_sysmount
11492 eval $inhdr
11493
11494
11495 echo " "
11496 echo "Checking to see if your system supports struct fs_data..." >&4
11497 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11498 eval $hasstruct
11499 case "$d_fs_data_s" in
11500 "$define")      echo "Yes, it does."   ;;
11501 *)              echo "No, it doesn't." ;;
11502 esac
11503
11504 : see if fseeko exists
11505 set fseeko d_fseeko
11506 eval $inlibc
11507 case "$longsize" in
11508 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11509 esac
11510
11511 : see if fsetpos exists
11512 set fsetpos d_fsetpos
11513 eval $inlibc
11514
11515
11516 : see if fstatfs exists
11517 set fstatfs d_fstatfs
11518 eval $inlibc
11519
11520
11521 : see if statvfs exists
11522 set statvfs d_statvfs
11523 eval $inlibc
11524
11525 : see if fstatvfs exists
11526 set fstatvfs d_fstatvfs
11527 eval $inlibc
11528
11529
11530 : see if fsync exists
11531 set fsync d_fsync
11532 eval $inlibc
11533
11534 : see if ftello exists
11535 set ftello d_ftello
11536 eval $inlibc
11537 case "$longsize" in
11538 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11539 esac
11540
11541 : see if getcwd exists
11542 set getcwd d_getcwd
11543 eval $inlibc
11544
11545 : see if getespwnam exists
11546 set getespwnam d_getespwnam
11547 eval $inlibc
11548
11549
11550 : see if getfsstat exists
11551 set getfsstat d_getfsstat
11552 eval $inlibc
11553
11554 : see if getgrent exists
11555 set getgrent d_getgrent
11556 eval $inlibc
11557
11558 : see if getgrent_r exists
11559 set getgrent_r d_getgrent_r
11560 eval $inlibc
11561 case "$d_getgrent_r" in
11562 "$define")
11563         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11564         case "$d_getgrent_r_proto:$usethreads" in
11565         ":define")      d_getgrent_r_proto=define
11566                 set d_getgrent_r_proto getgrent_r $hdrs
11567                 eval $hasproto ;;
11568         *)      ;;
11569         esac
11570         case "$d_getgrent_r_proto" in
11571         define)
11572         case "$getgrent_r_proto" in
11573         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11574         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11575         esac
11576         case "$getgrent_r_proto" in
11577         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11578         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11579         esac
11580         case "$getgrent_r_proto" in
11581         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11582         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11583         esac
11584         case "$getgrent_r_proto" in
11585         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11586         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11587         esac
11588         case "$getgrent_r_proto" in
11589         ''|0) try='int getgrent_r(struct group*, char*, int);'
11590         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11591         esac
11592         case "$getgrent_r_proto" in
11593         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11594         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11595         esac
11596         case "$getgrent_r_proto" in
11597         ''|0)   d_getgrent_r=undef
11598                 getgrent_r_proto=0
11599                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11600         * )     case "$getgrent_r_proto" in
11601                 REENTRANT_PROTO*) ;;
11602                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11603                 esac
11604                 echo "Prototype: $try" ;;
11605         esac
11606         ;;
11607         *)      case "$usethreads" in
11608                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11609                 esac
11610                 d_getgrent_r=undef
11611                 getgrent_r_proto=0
11612                 ;;
11613         esac
11614         ;;
11615 *)      getgrent_r_proto=0
11616         ;;
11617 esac
11618
11619 : see if getgrgid_r exists
11620 set getgrgid_r d_getgrgid_r
11621 eval $inlibc
11622 case "$d_getgrgid_r" in
11623 "$define")
11624         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11625         case "$d_getgrgid_r_proto:$usethreads" in
11626         ":define")      d_getgrgid_r_proto=define
11627                 set d_getgrgid_r_proto getgrgid_r $hdrs
11628                 eval $hasproto ;;
11629         *)      ;;
11630         esac
11631         case "$d_getgrgid_r_proto" in
11632         define)
11633         case "$getgrgid_r_proto" in
11634         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11635         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11636         esac
11637         case "$getgrgid_r_proto" in
11638         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11639         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11640         esac
11641         case "$getgrgid_r_proto" in
11642         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11643         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11644         esac
11645         case "$getgrgid_r_proto" in
11646         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11647         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11648         esac
11649         case "$getgrgid_r_proto" in
11650         ''|0)   d_getgrgid_r=undef
11651                 getgrgid_r_proto=0
11652                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11653         * )     case "$getgrgid_r_proto" in
11654                 REENTRANT_PROTO*) ;;
11655                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11656                 esac
11657                 echo "Prototype: $try" ;;
11658         esac
11659         ;;
11660         *)      case "$usethreads" in
11661                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11662                 esac
11663                 d_getgrgid_r=undef
11664                 getgrgid_r_proto=0
11665                 ;;
11666         esac
11667         ;;
11668 *)      getgrgid_r_proto=0
11669         ;;
11670 esac
11671
11672 : see if getgrnam_r exists
11673 set getgrnam_r d_getgrnam_r
11674 eval $inlibc
11675 case "$d_getgrnam_r" in
11676 "$define")
11677         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11678         case "$d_getgrnam_r_proto:$usethreads" in
11679         ":define")      d_getgrnam_r_proto=define
11680                 set d_getgrnam_r_proto getgrnam_r $hdrs
11681                 eval $hasproto ;;
11682         *)      ;;
11683         esac
11684         case "$d_getgrnam_r_proto" in
11685         define)
11686         case "$getgrnam_r_proto" in
11687         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11688         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11689         esac
11690         case "$getgrnam_r_proto" in
11691         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11692         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11693         esac
11694         case "$getgrnam_r_proto" in
11695         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11696         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11697         esac
11698         case "$getgrnam_r_proto" in
11699         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11700         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11701         esac
11702         case "$getgrnam_r_proto" in
11703         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11704         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11705         esac
11706         case "$getgrnam_r_proto" in
11707         ''|0)   d_getgrnam_r=undef
11708                 getgrnam_r_proto=0
11709                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11710         * )     case "$getgrnam_r_proto" in
11711                 REENTRANT_PROTO*) ;;
11712                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11713                 esac
11714                 echo "Prototype: $try" ;;
11715         esac
11716         ;;
11717         *)      case "$usethreads" in
11718                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11719                 esac
11720                 d_getgrnam_r=undef
11721                 getgrnam_r_proto=0
11722                 ;;
11723         esac
11724         ;;
11725 *)      getgrnam_r_proto=0
11726         ;;
11727 esac
11728
11729 : see if gethostbyaddr exists
11730 set gethostbyaddr d_gethbyaddr
11731 eval $inlibc
11732
11733 : see if gethostbyname exists
11734 set gethostbyname d_gethbyname
11735 eval $inlibc
11736
11737 : see if gethostent exists
11738 set gethostent d_gethent
11739 eval $inlibc
11740
11741 : see how we will look up host name
11742 echo " "
11743 call=''
11744 if set gethostname val -f d_gethname; eval $csym; $val; then
11745         echo 'gethostname() found.' >&4
11746         d_gethname="$define"
11747         call=gethostname
11748 fi
11749 if set uname val -f d_uname; eval $csym; $val; then
11750         if ./xenix; then
11751                 $cat <<'EOM'
11752 uname() was found, but you're running xenix, and older versions of xenix
11753 have a broken uname(). If you don't really know whether your xenix is old
11754 enough to have a broken system call, use the default answer.
11755
11756 EOM
11757                 dflt=y
11758                 case "$d_uname" in
11759                 "$define") dflt=n;;
11760                 esac
11761                 rp='Is your uname() broken?'
11762                 . ./myread
11763                 case "$ans" in
11764                 n*) d_uname="$define"; call=uname;;
11765                 esac
11766         else
11767                 echo 'uname() found.' >&4
11768                 d_uname="$define"
11769                 case "$call" in
11770                 '') call=uname ;;
11771                 esac
11772         fi
11773 fi
11774 case "$d_gethname" in
11775 '') d_gethname="$undef";;
11776 esac
11777 case "$d_uname" in
11778 '') d_uname="$undef";;
11779 esac
11780 case "$d_uname$d_gethname" in
11781 *define*)
11782         dflt=n
11783         cat <<EOM
11784  
11785 Every now and then someone has a $call() that lies about the hostname
11786 but can't be fixed for political or economic reasons.  If you wish, I can
11787 pretend $call() isn't there and maybe compute hostname at run-time
11788 thanks to the '$phostname' command.
11789
11790 EOM
11791         rp="Shall I ignore $call() from now on?"
11792         . ./myread
11793         case "$ans" in
11794         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11795         esac;;
11796 esac
11797 case "$phostname" in
11798 '') aphostname='';;
11799 *) case "$aphostname" in
11800         /*) ;;
11801         *) set X $phostname
11802                 shift
11803                 file=$1
11804                 shift
11805                 file=`./loc $file $file $pth`
11806                 aphostname=`echo $file $*`
11807                 ;;
11808         esac
11809         ;;
11810 esac
11811 case "$d_uname$d_gethname" in
11812 *define*) ;;
11813 *)
11814         case "$phostname" in
11815         '')
11816                 echo "There will be no way for $package to get your hostname." >&4;;
11817         *)
11818         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11819                 ;;
11820         esac;;
11821 esac
11822 case "$d_phostname" in
11823 '') d_phostname="$undef";;
11824 esac
11825
11826 : see if gethostbyaddr_r exists
11827 set gethostbyaddr_r d_gethostbyaddr_r
11828 eval $inlibc
11829 case "$d_gethostbyaddr_r" in
11830 "$define")
11831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11832         case "$d_gethostbyaddr_r_proto:$usethreads" in
11833         ":define")      d_gethostbyaddr_r_proto=define
11834                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11835                 eval $hasproto ;;
11836         *)      ;;
11837         esac
11838         case "$d_gethostbyaddr_r_proto" in
11839         define)
11840         case "$gethostbyaddr_r_proto" in
11841         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11842         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11843         esac
11844         case "$gethostbyaddr_r_proto" in
11845         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11846         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11847         esac
11848         case "$gethostbyaddr_r_proto" in
11849         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11850         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11851         esac
11852         case "$gethostbyaddr_r_proto" in
11853         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11854         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11855         esac
11856         case "$gethostbyaddr_r_proto" in
11857         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11858         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11859         esac
11860         case "$gethostbyaddr_r_proto" in
11861         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11862         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11863         esac
11864         case "$gethostbyaddr_r_proto" in
11865         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11866         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11867         esac
11868         case "$gethostbyaddr_r_proto" in
11869         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11870         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11871         esac
11872         case "$gethostbyaddr_r_proto" in
11873         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11874         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11875         esac
11876         case "$gethostbyaddr_r_proto" in
11877         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11878         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11879         esac
11880         case "$gethostbyaddr_r_proto" in
11881         ''|0)   d_gethostbyaddr_r=undef
11882                 gethostbyaddr_r_proto=0
11883                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11884         * )     case "$gethostbyaddr_r_proto" in
11885                 REENTRANT_PROTO*) ;;
11886                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11887                 esac
11888                 echo "Prototype: $try" ;;
11889         esac
11890         ;;
11891         *)      case "$usethreads" in
11892                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11893                 esac
11894                 d_gethostbyaddr_r=undef
11895                 gethostbyaddr_r_proto=0
11896                 ;;
11897         esac
11898         ;;
11899 *)      gethostbyaddr_r_proto=0
11900         ;;
11901 esac
11902
11903 : see if gethostbyname_r exists
11904 set gethostbyname_r d_gethostbyname_r
11905 eval $inlibc
11906 case "$d_gethostbyname_r" in
11907 "$define")
11908         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11909         case "$d_gethostbyname_r_proto:$usethreads" in
11910         ":define")      d_gethostbyname_r_proto=define
11911                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11912                 eval $hasproto ;;
11913         *)      ;;
11914         esac
11915         case "$d_gethostbyname_r_proto" in
11916         define)
11917         case "$gethostbyname_r_proto" in
11918         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11919         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11920         esac
11921         case "$gethostbyname_r_proto" in
11922         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11923         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11924         esac
11925         case "$gethostbyname_r_proto" in
11926         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11927         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11928         esac
11929         case "$gethostbyname_r_proto" in
11930         ''|0)   d_gethostbyname_r=undef
11931                 gethostbyname_r_proto=0
11932                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11933         * )     case "$gethostbyname_r_proto" in
11934                 REENTRANT_PROTO*) ;;
11935                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11936                 esac
11937                 echo "Prototype: $try" ;;
11938         esac
11939         ;;
11940         *)      case "$usethreads" in
11941                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11942                 esac
11943                 d_gethostbyname_r=undef
11944                 gethostbyname_r_proto=0
11945                 ;;
11946         esac
11947         ;;
11948 *)      gethostbyname_r_proto=0
11949         ;;
11950 esac
11951
11952 : see if gethostent_r exists
11953 set gethostent_r d_gethostent_r
11954 eval $inlibc
11955 case "$d_gethostent_r" in
11956 "$define")
11957         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11958         case "$d_gethostent_r_proto:$usethreads" in
11959         ":define")      d_gethostent_r_proto=define
11960                 set d_gethostent_r_proto gethostent_r $hdrs
11961                 eval $hasproto ;;
11962         *)      ;;
11963         esac
11964         case "$d_gethostent_r_proto" in
11965         define)
11966         case "$gethostent_r_proto" in
11967         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11968         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11969         esac
11970         case "$gethostent_r_proto" in
11971         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11972         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11973         esac
11974         case "$gethostent_r_proto" in
11975         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11976         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11977         esac
11978         case "$gethostent_r_proto" in
11979         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11980         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11981         esac
11982         case "$gethostent_r_proto" in
11983         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11984         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11985         esac
11986         case "$gethostent_r_proto" in
11987         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11988         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11989         esac
11990         case "$gethostent_r_proto" in
11991         ''|0)   d_gethostent_r=undef
11992                 gethostent_r_proto=0
11993                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11994         * )     case "$gethostent_r_proto" in
11995                 REENTRANT_PROTO*) ;;
11996                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11997                 esac
11998                 echo "Prototype: $try" ;;
11999         esac
12000         ;;
12001         *)      case "$usethreads" in
12002                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12003                 esac
12004                 d_gethostent_r=undef
12005                 gethostent_r_proto=0
12006                 ;;
12007         esac
12008         ;;
12009 *)      gethostent_r_proto=0
12010         ;;
12011 esac
12012
12013 : see if prototypes for various gethostxxx netdb.h functions are available
12014 echo " "
12015 set d_gethostprotos gethostent $i_netdb netdb.h
12016 eval $hasproto
12017
12018 : see if getitimer exists
12019 set getitimer d_getitimer
12020 eval $inlibc
12021
12022 : see if getlogin exists
12023 set getlogin d_getlogin
12024 eval $inlibc
12025
12026 : see if getlogin_r exists
12027 set getlogin_r d_getlogin_r
12028 eval $inlibc
12029 case "$d_getlogin_r" in
12030 "$define")
12031         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12032         case "$d_getlogin_r_proto:$usethreads" in
12033         ":define")      d_getlogin_r_proto=define
12034                 set d_getlogin_r_proto getlogin_r $hdrs
12035                 eval $hasproto ;;
12036         *)      ;;
12037         esac
12038         case "$d_getlogin_r_proto" in
12039         define)
12040         case "$getlogin_r_proto" in
12041         ''|0) try='int getlogin_r(char*, size_t);'
12042         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12043         esac
12044         case "$getlogin_r_proto" in
12045         ''|0) try='int getlogin_r(char*, int);'
12046         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12047         esac
12048         case "$getlogin_r_proto" in
12049         ''|0) try='char* getlogin_r(char*, size_t);'
12050         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12051         esac
12052         case "$getlogin_r_proto" in
12053         ''|0) try='char* getlogin_r(char*, int);'
12054         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12055         esac
12056         case "$getlogin_r_proto" in
12057         ''|0)   d_getlogin_r=undef
12058                 getlogin_r_proto=0
12059                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12060         * )     case "$getlogin_r_proto" in
12061                 REENTRANT_PROTO*) ;;
12062                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12063                 esac
12064                 echo "Prototype: $try" ;;
12065         esac
12066         ;;
12067         *)      case "$usethreads" in
12068                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12069                 esac
12070                 d_getlogin_r=undef
12071                 getlogin_r_proto=0
12072                 ;;
12073         esac
12074         ;;
12075 *)      getlogin_r_proto=0
12076         ;;
12077 esac
12078
12079 : see if getmnt exists
12080 set getmnt d_getmnt
12081 eval $inlibc
12082
12083 : see if getmntent exists
12084 set getmntent d_getmntent
12085 eval $inlibc
12086
12087 : see if getnetbyaddr exists
12088 set getnetbyaddr d_getnbyaddr
12089 eval $inlibc
12090
12091 : see if getnetbyname exists
12092 set getnetbyname d_getnbyname
12093 eval $inlibc
12094
12095 : see if getnetent exists
12096 set getnetent d_getnent
12097 eval $inlibc
12098
12099 : see if getnetbyaddr_r exists
12100 set getnetbyaddr_r d_getnetbyaddr_r
12101 eval $inlibc
12102 case "$d_getnetbyaddr_r" in
12103 "$define")
12104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12105         case "$d_getnetbyaddr_r_proto:$usethreads" in
12106         ":define")      d_getnetbyaddr_r_proto=define
12107                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12108                 eval $hasproto ;;
12109         *)      ;;
12110         esac
12111         case "$d_getnetbyaddr_r_proto" in
12112         define)
12113         case "$getnetbyaddr_r_proto" in
12114         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12115         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12116         esac
12117         case "$getnetbyaddr_r_proto" in
12118         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12119         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12120         esac
12121         case "$getnetbyaddr_r_proto" in
12122         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12123         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12124         esac
12125         case "$getnetbyaddr_r_proto" in
12126         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12127         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12128         esac
12129         case "$getnetbyaddr_r_proto" in
12130         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12131         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12132         esac
12133         case "$getnetbyaddr_r_proto" in
12134         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12135         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12136         esac
12137         case "$getnetbyaddr_r_proto" in
12138         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12139         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12140         esac
12141         case "$getnetbyaddr_r_proto" in
12142         ''|0)   d_getnetbyaddr_r=undef
12143                 getnetbyaddr_r_proto=0
12144                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12145         * )     case "$getnetbyaddr_r_proto" in
12146                 REENTRANT_PROTO*) ;;
12147                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12148                 esac
12149                 echo "Prototype: $try" ;;
12150         esac
12151         ;;
12152         *)      case "$usethreads" in
12153                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12154                 esac
12155                 d_getnetbyaddr_r=undef
12156                 getnetbyaddr_r_proto=0
12157                 ;;
12158         esac
12159         ;;
12160 *)      getnetbyaddr_r_proto=0
12161         ;;
12162 esac
12163
12164 : see if getnetbyname_r exists
12165 set getnetbyname_r d_getnetbyname_r
12166 eval $inlibc
12167 case "$d_getnetbyname_r" in
12168 "$define")
12169         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12170         case "$d_getnetbyname_r_proto:$usethreads" in
12171         ":define")      d_getnetbyname_r_proto=define
12172                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12173                 eval $hasproto ;;
12174         *)      ;;
12175         esac
12176         case "$d_getnetbyname_r_proto" in
12177         define)
12178         case "$getnetbyname_r_proto" in
12179         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12180         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12181         esac
12182         case "$getnetbyname_r_proto" in
12183         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12184         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12185         esac
12186         case "$getnetbyname_r_proto" in
12187         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12188         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12189         esac
12190         case "$getnetbyname_r_proto" in
12191         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12192         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12193         esac
12194         case "$getnetbyname_r_proto" in
12195         ''|0)   d_getnetbyname_r=undef
12196                 getnetbyname_r_proto=0
12197                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12198         * )     case "$getnetbyname_r_proto" in
12199                 REENTRANT_PROTO*) ;;
12200                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12201                 esac
12202                 echo "Prototype: $try" ;;
12203         esac
12204         ;;
12205         *)      case "$usethreads" in
12206                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12207                 esac
12208                 d_getnetbyname_r=undef
12209                 getnetbyname_r_proto=0
12210                 ;;
12211         esac
12212         ;;
12213 *)      getnetbyname_r_proto=0
12214         ;;
12215 esac
12216
12217 : see if getnetent_r exists
12218 set getnetent_r d_getnetent_r
12219 eval $inlibc
12220 case "$d_getnetent_r" in
12221 "$define")
12222         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12223         case "$d_getnetent_r_proto:$usethreads" in
12224         ":define")      d_getnetent_r_proto=define
12225                 set d_getnetent_r_proto getnetent_r $hdrs
12226                 eval $hasproto ;;
12227         *)      ;;
12228         esac
12229         case "$d_getnetent_r_proto" in
12230         define)
12231         case "$getnetent_r_proto" in
12232         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12233         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12234         esac
12235         case "$getnetent_r_proto" in
12236         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12237         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12238         esac
12239         case "$getnetent_r_proto" in
12240         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12241         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12242         esac
12243         case "$getnetent_r_proto" in
12244         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12245         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12246         esac
12247         case "$getnetent_r_proto" in
12248         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12249         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12250         esac
12251         case "$getnetent_r_proto" in
12252         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12253         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12254         esac
12255         case "$getnetent_r_proto" in
12256         ''|0)   d_getnetent_r=undef
12257                 getnetent_r_proto=0
12258                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12259         * )     case "$getnetent_r_proto" in
12260                 REENTRANT_PROTO*) ;;
12261                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12262                 esac
12263                 echo "Prototype: $try" ;;
12264         esac
12265         ;;
12266         *)      case "$usethreads" in
12267                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12268                 esac
12269                 d_getnetent_r=undef
12270                 getnetent_r_proto=0
12271                 ;;
12272         esac
12273         ;;
12274 *)      getnetent_r_proto=0
12275         ;;
12276 esac
12277
12278 : see if prototypes for various getnetxxx netdb.h functions are available
12279 echo " "
12280 set d_getnetprotos getnetent $i_netdb netdb.h
12281 eval $hasproto
12282
12283 : see if getpagesize exists
12284 set getpagesize d_getpagsz
12285 eval $inlibc
12286
12287
12288 : see if getprotobyname exists
12289 set getprotobyname d_getpbyname
12290 eval $inlibc
12291
12292 : see if getprotobynumber exists
12293 set getprotobynumber d_getpbynumber
12294 eval $inlibc
12295
12296 : see if getprotoent exists
12297 set getprotoent d_getpent
12298 eval $inlibc
12299
12300 : see if getpgid exists
12301 set getpgid d_getpgid
12302 eval $inlibc
12303
12304 : see if getpgrp2 exists
12305 set getpgrp2 d_getpgrp2
12306 eval $inlibc
12307
12308 : see if getppid exists
12309 set getppid d_getppid
12310 eval $inlibc
12311
12312 : see if getpriority exists
12313 set getpriority d_getprior
12314 eval $inlibc
12315
12316 : see if getprotobyname_r exists
12317 set getprotobyname_r d_getprotobyname_r
12318 eval $inlibc
12319 case "$d_getprotobyname_r" in
12320 "$define")
12321         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12322         case "$d_getprotobyname_r_proto:$usethreads" in
12323         ":define")      d_getprotobyname_r_proto=define
12324                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12325                 eval $hasproto ;;
12326         *)      ;;
12327         esac
12328         case "$d_getprotobyname_r_proto" in
12329         define)
12330         case "$getprotobyname_r_proto" in
12331         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12332         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12333         esac
12334         case "$getprotobyname_r_proto" in
12335         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12336         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12337         esac
12338         case "$getprotobyname_r_proto" in
12339         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12340         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12341         esac
12342         case "$getprotobyname_r_proto" in
12343         ''|0)   d_getprotobyname_r=undef
12344                 getprotobyname_r_proto=0
12345                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12346         * )     case "$getprotobyname_r_proto" in
12347                 REENTRANT_PROTO*) ;;
12348                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12349                 esac
12350                 echo "Prototype: $try" ;;
12351         esac
12352         ;;
12353         *)      case "$usethreads" in
12354                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12355                 esac
12356                 d_getprotobyname_r=undef
12357                 getprotobyname_r_proto=0
12358                 ;;
12359         esac
12360         ;;
12361 *)      getprotobyname_r_proto=0
12362         ;;
12363 esac
12364
12365 : see if getprotobynumber_r exists
12366 set getprotobynumber_r d_getprotobynumber_r
12367 eval $inlibc
12368 case "$d_getprotobynumber_r" in
12369 "$define")
12370         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12371         case "$d_getprotobynumber_r_proto:$usethreads" in
12372         ":define")      d_getprotobynumber_r_proto=define
12373                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12374                 eval $hasproto ;;
12375         *)      ;;
12376         esac
12377         case "$d_getprotobynumber_r_proto" in
12378         define)
12379         case "$getprotobynumber_r_proto" in
12380         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12381         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12382         esac
12383         case "$getprotobynumber_r_proto" in
12384         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12385         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12386         esac
12387         case "$getprotobynumber_r_proto" in
12388         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12389         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12390         esac
12391         case "$getprotobynumber_r_proto" in
12392         ''|0)   d_getprotobynumber_r=undef
12393                 getprotobynumber_r_proto=0
12394                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12395         * )     case "$getprotobynumber_r_proto" in
12396                 REENTRANT_PROTO*) ;;
12397                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12398                 esac
12399                 echo "Prototype: $try" ;;
12400         esac
12401         ;;
12402         *)      case "$usethreads" in
12403                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12404                 esac
12405                 d_getprotobynumber_r=undef
12406                 getprotobynumber_r_proto=0
12407                 ;;
12408         esac
12409         ;;
12410 *)      getprotobynumber_r_proto=0
12411         ;;
12412 esac
12413
12414 : see if getprotoent_r exists
12415 set getprotoent_r d_getprotoent_r
12416 eval $inlibc
12417 case "$d_getprotoent_r" in
12418 "$define")
12419         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12420         case "$d_getprotoent_r_proto:$usethreads" in
12421         ":define")      d_getprotoent_r_proto=define
12422                 set d_getprotoent_r_proto getprotoent_r $hdrs
12423                 eval $hasproto ;;
12424         *)      ;;
12425         esac
12426         case "$d_getprotoent_r_proto" in
12427         define)
12428         case "$getprotoent_r_proto" in
12429         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12430         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12431         esac
12432         case "$getprotoent_r_proto" in
12433         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12434         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12435         esac
12436         case "$getprotoent_r_proto" in
12437         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12438         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12439         esac
12440         case "$getprotoent_r_proto" in
12441         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12442         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12443         esac
12444         case "$getprotoent_r_proto" in
12445         ''|0)   d_getprotoent_r=undef
12446                 getprotoent_r_proto=0
12447                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12448         * )     case "$getprotoent_r_proto" in
12449                 REENTRANT_PROTO*) ;;
12450                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12451                 esac
12452                 echo "Prototype: $try" ;;
12453         esac
12454         ;;
12455         *)      case "$usethreads" in
12456                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12457                 esac
12458                 d_getprotoent_r=undef
12459                 getprotoent_r_proto=0
12460                 ;;
12461         esac
12462         ;;
12463 *)      getprotoent_r_proto=0
12464         ;;
12465 esac
12466
12467 : see if prototypes for various getprotoxxx netdb.h functions are available
12468 echo " "
12469 set d_getprotoprotos getprotoent $i_netdb netdb.h
12470 eval $hasproto
12471
12472 : see if getprpwnam exists
12473 set getprpwnam d_getprpwnam
12474 eval $inlibc
12475
12476 : see if getpwent exists
12477 set getpwent d_getpwent
12478 eval $inlibc
12479
12480 : see if getpwent_r exists
12481 set getpwent_r d_getpwent_r
12482 eval $inlibc
12483 case "$d_getpwent_r" in
12484 "$define")
12485         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12486         case "$d_getpwent_r_proto:$usethreads" in
12487         ":define")      d_getpwent_r_proto=define
12488                 set d_getpwent_r_proto getpwent_r $hdrs
12489                 eval $hasproto ;;
12490         *)      ;;
12491         esac
12492         case "$d_getpwent_r_proto" in
12493         define)
12494         case "$getpwent_r_proto" in
12495         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12496         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12497         esac
12498         case "$getpwent_r_proto" in
12499         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12500         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12501         esac
12502         case "$getpwent_r_proto" in
12503         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12504         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12505         esac
12506         case "$getpwent_r_proto" in
12507         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12508         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12509         esac
12510         case "$getpwent_r_proto" in
12511         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12512         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12513         esac
12514         case "$getpwent_r_proto" in
12515         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12516         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12517         esac
12518         case "$getpwent_r_proto" in
12519         ''|0)   d_getpwent_r=undef
12520                 getpwent_r_proto=0
12521                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12522         * )     case "$getpwent_r_proto" in
12523                 REENTRANT_PROTO*) ;;
12524                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12525                 esac
12526                 echo "Prototype: $try" ;;
12527         esac
12528         ;;
12529         *)      case "$usethreads" in
12530                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12531                 esac
12532                 d_getpwent_r=undef
12533                 getpwent_r_proto=0
12534                 ;;
12535         esac
12536         ;;
12537 *)      getpwent_r_proto=0
12538         ;;
12539 esac
12540
12541 : see if getpwnam_r exists
12542 set getpwnam_r d_getpwnam_r
12543 eval $inlibc
12544 case "$d_getpwnam_r" in
12545 "$define")
12546         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12547         case "$d_getpwnam_r_proto:$usethreads" in
12548         ":define")      d_getpwnam_r_proto=define
12549                 set d_getpwnam_r_proto getpwnam_r $hdrs
12550                 eval $hasproto ;;
12551         *)      ;;
12552         esac
12553         case "$d_getpwnam_r_proto" in
12554         define)
12555         case "$getpwnam_r_proto" in
12556         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12557         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12558         esac
12559         case "$getpwnam_r_proto" in
12560         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12561         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12562         esac
12563         case "$getpwnam_r_proto" in
12564         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12565         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12566         esac
12567         case "$getpwnam_r_proto" in
12568         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12569         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12570         esac
12571         case "$getpwnam_r_proto" in
12572         ''|0)   d_getpwnam_r=undef
12573                 getpwnam_r_proto=0
12574                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12575         * )     case "$getpwnam_r_proto" in
12576                 REENTRANT_PROTO*) ;;
12577                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12578                 esac
12579                 echo "Prototype: $try" ;;
12580         esac
12581         ;;
12582         *)      case "$usethreads" in
12583                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12584                 esac
12585                 d_getpwnam_r=undef
12586                 getpwnam_r_proto=0
12587                 ;;
12588         esac
12589         ;;
12590 *)      getpwnam_r_proto=0
12591         ;;
12592 esac
12593
12594 : see if getpwuid_r exists
12595 set getpwuid_r d_getpwuid_r
12596 eval $inlibc
12597 case "$d_getpwuid_r" in
12598 "$define")
12599         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12600         case "$d_getpwuid_r_proto:$usethreads" in
12601         ":define")      d_getpwuid_r_proto=define
12602                 set d_getpwuid_r_proto getpwuid_r $hdrs
12603                 eval $hasproto ;;
12604         *)      ;;
12605         esac
12606         case "$d_getpwuid_r_proto" in
12607         define)
12608         case "$getpwuid_r_proto" in
12609         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12610         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12611         esac
12612         case "$getpwuid_r_proto" in
12613         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12614         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12615         esac
12616         case "$getpwuid_r_proto" in
12617         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12618         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12619         esac
12620         case "$getpwuid_r_proto" in
12621         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12622         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12623         esac
12624         case "$getpwuid_r_proto" in
12625         ''|0)   d_getpwuid_r=undef
12626                 getpwuid_r_proto=0
12627                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12628         * )     case "$getpwuid_r_proto" in
12629                 REENTRANT_PROTO*) ;;
12630                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12631                 esac
12632                 echo "Prototype: $try" ;;
12633         esac
12634         ;;
12635         *)      case "$usethreads" in
12636                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12637                 esac
12638                 d_getpwuid_r=undef
12639                 getpwuid_r_proto=0
12640                 ;;
12641         esac
12642         ;;
12643 *)      getpwuid_r_proto=0
12644         ;;
12645 esac
12646
12647
12648 : see if getservbyname exists
12649 set getservbyname d_getsbyname
12650 eval $inlibc
12651
12652 : see if getservbyport exists
12653 set getservbyport d_getsbyport
12654 eval $inlibc
12655
12656 : see if getservent exists
12657 set getservent d_getsent
12658 eval $inlibc
12659
12660 : see if getservbyname_r exists
12661 set getservbyname_r d_getservbyname_r
12662 eval $inlibc
12663 case "$d_getservbyname_r" in
12664 "$define")
12665         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12666         case "$d_getservbyname_r_proto:$usethreads" in
12667         ":define")      d_getservbyname_r_proto=define
12668                 set d_getservbyname_r_proto getservbyname_r $hdrs
12669                 eval $hasproto ;;
12670         *)      ;;
12671         esac
12672         case "$d_getservbyname_r_proto" in
12673         define)
12674         case "$getservbyname_r_proto" in
12675         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12676         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12677         esac
12678         case "$getservbyname_r_proto" in
12679         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12680         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12681         esac
12682         case "$getservbyname_r_proto" in
12683         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12684         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12685         esac
12686         case "$getservbyname_r_proto" in
12687         ''|0)   d_getservbyname_r=undef
12688                 getservbyname_r_proto=0
12689                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12690         * )     case "$getservbyname_r_proto" in
12691                 REENTRANT_PROTO*) ;;
12692                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12693                 esac
12694                 echo "Prototype: $try" ;;
12695         esac
12696         ;;
12697         *)      case "$usethreads" in
12698                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12699                 esac
12700                 d_getservbyname_r=undef
12701                 getservbyname_r_proto=0
12702                 ;;
12703         esac
12704         ;;
12705 *)      getservbyname_r_proto=0
12706         ;;
12707 esac
12708
12709 : see if getservbyport_r exists
12710 set getservbyport_r d_getservbyport_r
12711 eval $inlibc
12712 case "$d_getservbyport_r" in
12713 "$define")
12714         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12715         case "$d_getservbyport_r_proto:$usethreads" in
12716         ":define")      d_getservbyport_r_proto=define
12717                 set d_getservbyport_r_proto getservbyport_r $hdrs
12718                 eval $hasproto ;;
12719         *)      ;;
12720         esac
12721         case "$d_getservbyport_r_proto" in
12722         define)
12723         case "$getservbyport_r_proto" in
12724         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12725         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12726         esac
12727         case "$getservbyport_r_proto" in
12728         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12729         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12730         esac
12731         case "$getservbyport_r_proto" in
12732         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12733         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12734         esac
12735         case "$getservbyport_r_proto" in
12736         ''|0)   d_getservbyport_r=undef
12737                 getservbyport_r_proto=0
12738                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12739         * )     case "$getservbyport_r_proto" in
12740                 REENTRANT_PROTO*) ;;
12741                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12742                 esac
12743                 echo "Prototype: $try" ;;
12744         esac
12745         ;;
12746         *)      case "$usethreads" in
12747                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12748                 esac
12749                 d_getservbyport_r=undef
12750                 getservbyport_r_proto=0
12751                 ;;
12752         esac
12753         ;;
12754 *)      getservbyport_r_proto=0
12755         ;;
12756 esac
12757
12758 : see if getservent_r exists
12759 set getservent_r d_getservent_r
12760 eval $inlibc
12761 case "$d_getservent_r" in
12762 "$define")
12763         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12764         case "$d_getservent_r_proto:$usethreads" in
12765         ":define")      d_getservent_r_proto=define
12766                 set d_getservent_r_proto getservent_r $hdrs
12767                 eval $hasproto ;;
12768         *)      ;;
12769         esac
12770         case "$d_getservent_r_proto" in
12771         define)
12772         case "$getservent_r_proto" in
12773         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12774         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12775         esac
12776         case "$getservent_r_proto" in
12777         ''|0) try='int getservent_r(struct servent*, char*, int);'
12778         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12779         esac
12780         case "$getservent_r_proto" in
12781         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12782         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12783         esac
12784         case "$getservent_r_proto" in
12785         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12786         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12787         esac
12788         case "$getservent_r_proto" in
12789         ''|0)   d_getservent_r=undef
12790                 getservent_r_proto=0
12791                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12792         * )     case "$getservent_r_proto" in
12793                 REENTRANT_PROTO*) ;;
12794                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12795                 esac
12796                 echo "Prototype: $try" ;;
12797         esac
12798         ;;
12799         *)      case "$usethreads" in
12800                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12801                 esac
12802                 d_getservent_r=undef
12803                 getservent_r_proto=0
12804                 ;;
12805         esac
12806         ;;
12807 *)      getservent_r_proto=0
12808         ;;
12809 esac
12810
12811 : see if prototypes for various getservxxx netdb.h functions are available
12812 echo " "
12813 set d_getservprotos getservent $i_netdb netdb.h
12814 eval $hasproto
12815
12816 : see if getspnam exists
12817 set getspnam d_getspnam
12818 eval $inlibc
12819
12820 : see if this is a shadow.h system
12821 set shadow.h i_shadow
12822 eval $inhdr
12823
12824 : see if getspnam_r exists
12825 set getspnam_r d_getspnam_r
12826 eval $inlibc
12827 case "$d_getspnam_r" in
12828 "$define")
12829         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12830         case "$d_getspnam_r_proto:$usethreads" in
12831         ":define")      d_getspnam_r_proto=define
12832                 set d_getspnam_r_proto getspnam_r $hdrs
12833                 eval $hasproto ;;
12834         *)      ;;
12835         esac
12836         case "$d_getspnam_r_proto" in
12837         define)
12838         case "$getspnam_r_proto" in
12839         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12840         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12841         esac
12842         case "$getspnam_r_proto" in
12843         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12844         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12845         esac
12846         case "$getspnam_r_proto" in
12847         ''|0)   d_getspnam_r=undef
12848                 getspnam_r_proto=0
12849                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12850         * )     case "$getspnam_r_proto" in
12851                 REENTRANT_PROTO*) ;;
12852                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12853                 esac
12854                 echo "Prototype: $try" ;;
12855         esac
12856         ;;
12857         *)      case "$usethreads" in
12858                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12859                 esac
12860                 d_getspnam_r=undef
12861                 getspnam_r_proto=0
12862                 ;;
12863         esac
12864         ;;
12865 *)      getspnam_r_proto=0
12866         ;;
12867 esac
12868
12869 : see if gettimeofday or ftime exists
12870 set gettimeofday d_gettimeod
12871 eval $inlibc
12872 case "$d_gettimeod" in
12873 "$undef")
12874         set ftime d_ftime 
12875         eval $inlibc
12876         ;;
12877 *)
12878         val="$undef"; set d_ftime; eval $setvar
12879         ;;
12880 esac
12881 case "$d_gettimeod$d_ftime" in
12882 "$undef$undef")
12883         echo " "
12884         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12885         ;;
12886 esac
12887
12888 : see if gmtime_r exists
12889 set gmtime_r d_gmtime_r
12890 eval $inlibc
12891 case "$d_gmtime_r" in
12892 "$define")
12893         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12894         case "$d_gmtime_r_proto:$usethreads" in
12895         ":define")      d_gmtime_r_proto=define
12896                 set d_gmtime_r_proto gmtime_r $hdrs
12897                 eval $hasproto ;;
12898         *)      ;;
12899         esac
12900         case "$d_gmtime_r_proto" in
12901         define)
12902         case "$gmtime_r_proto" in
12903         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12904         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12905         esac
12906         case "$gmtime_r_proto" in
12907         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12908         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12909         esac
12910         case "$gmtime_r_proto" in
12911         ''|0)   d_gmtime_r=undef
12912                 gmtime_r_proto=0
12913                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12914         * )     case "$gmtime_r_proto" in
12915                 REENTRANT_PROTO*) ;;
12916                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12917                 esac
12918                 echo "Prototype: $try" ;;
12919         esac
12920         ;;
12921         *)      case "$usethreads" in
12922                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12923                 esac
12924                 d_gmtime_r=undef
12925                 gmtime_r_proto=0
12926                 ;;
12927         esac
12928         ;;
12929 *)      gmtime_r_proto=0
12930         ;;
12931 esac
12932
12933 : see if hasmntopt exists
12934 set hasmntopt d_hasmntopt
12935 eval $inlibc
12936
12937 : see if this is a netinet/in.h or sys/in.h system
12938 set netinet/in.h i_niin sys/in.h i_sysin
12939 eval $inhdr
12940
12941 : see if arpa/inet.h has to be included
12942 set arpa/inet.h i_arpainet
12943 eval $inhdr
12944
12945 : see if htonl --and friends-- exists
12946 val=''
12947 set htonl val
12948 eval $inlibc
12949
12950 : Maybe they are macros.
12951 case "$val" in
12952 $undef)
12953         $cat >htonl.c <<EOM
12954 #include <stdio.h>
12955 #include <sys/types.h>
12956 #$i_niin I_NETINET_IN
12957 #$i_sysin I_SYS_IN
12958 #$i_arpainet I_ARPA_INET
12959 #ifdef I_NETINET_IN
12960 #include <netinet/in.h>
12961 #endif
12962 #ifdef I_SYS_IN
12963 #include <sys/in.h>
12964 #endif
12965 #ifdef I_ARPA_INET
12966 #include <arpa/inet.h>
12967 #endif
12968 #ifdef htonl
12969 printf("Defined as a macro.");
12970 #endif
12971 EOM
12972         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12973         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12974                 val="$define"
12975                 echo "But it seems to be defined as a macro." >&4
12976         fi
12977         $rm -f htonl.?
12978         ;;
12979 esac
12980 set d_htonl
12981 eval $setvar
12982
12983 : index or strchr
12984 echo " "
12985 if set index val -f; eval $csym; $val; then
12986         if set strchr val -f d_strchr; eval $csym; $val; then
12987                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12988                         val="$define"
12989                         vali="$undef"
12990                         echo "strchr() found." >&4
12991                 else
12992                         val="$undef"
12993                         vali="$define"
12994                         echo "index() found." >&4
12995                 fi
12996         else
12997                 val="$undef"
12998                 vali="$define"
12999                 echo "index() found." >&4
13000         fi
13001 else
13002         if set strchr val -f d_strchr; eval $csym; $val; then
13003                 val="$define"
13004                 vali="$undef"
13005                 echo "strchr() found." >&4
13006         else
13007                 echo "No index() or strchr() found!" >&4
13008                 val="$undef"
13009                 vali="$undef"
13010         fi
13011 fi
13012 set d_strchr; eval $setvar
13013 val="$vali"
13014 set d_index; eval $setvar
13015
13016 : check whether inet_aton exists
13017 set inet_aton d_inetaton
13018 eval $inlibc
13019
13020 : Look for isascii
13021 echo " "
13022 $cat >isascii.c <<'EOCP'
13023 #include <stdio.h>
13024 #include <ctype.h>
13025 int main() {
13026         int c = 'A';
13027         if (isascii(c))
13028                 exit(0);
13029         else
13030                 exit(1);
13031 }
13032 EOCP
13033 set isascii
13034 if eval $compile; then
13035         echo "isascii() found." >&4
13036         val="$define"
13037 else
13038         echo "isascii() NOT found." >&4
13039         val="$undef"
13040 fi
13041 set d_isascii
13042 eval $setvar
13043 $rm -f isascii*
13044
13045 : see if isfinite exists
13046 set isfinite d_isfinite
13047 eval $inlibc
13048
13049 : see if isinf exists
13050 set isinf d_isinf
13051 eval $inlibc
13052
13053 : see if isnan exists
13054 set isnan d_isnan
13055 eval $inlibc
13056
13057 : see if isnanl exists
13058 set isnanl d_isnanl
13059 eval $inlibc
13060
13061 : see if killpg exists
13062 set killpg d_killpg
13063 eval $inlibc
13064
13065 : see if lchown exists
13066 echo " "
13067 $cat > try.c <<'EOCP'
13068 /* System header to define __stub macros and hopefully few prototypes,
13069     which can conflict with char lchown(); below.  */
13070 #include <assert.h>
13071 /* Override any gcc2 internal prototype to avoid an error.  */
13072 /* We use char because int might match the return type of a gcc2
13073    builtin and then its argument prototype would still apply.  */
13074 char lchown();
13075 int main() {
13076     /*  The GNU C library defines this for functions which it implements
13077         to always fail with ENOSYS.  Some functions are actually named
13078         something starting with __ and the normal name is an alias.  */
13079 #if defined (__stub_lchown) || defined (__stub___lchown)
13080 choke me
13081 #else
13082 lchown();
13083 #endif
13084 ; return 0; }
13085 EOCP
13086 set try
13087 if eval $compile; then
13088     $echo "lchown() found." >&4
13089     val="$define"
13090 else
13091     $echo "lchown() NOT found." >&4
13092     val="$undef"
13093 fi
13094 set d_lchown
13095 eval $setvar
13096
13097 : See if number of significant digits in a double precision number is known
13098 echo " "
13099 $cat >ldbl_dig.c <<EOM
13100 #$i_limits I_LIMITS
13101 #$i_float I_FLOAT
13102 #ifdef I_LIMITS
13103 #include <limits.h>
13104 #endif
13105 #ifdef I_FLOAT
13106 #include <float.h>
13107 #endif
13108 #ifdef LDBL_DIG
13109 printf("Contains LDBL_DIG");
13110 #endif
13111 EOM
13112 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13113 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13114         echo "LDBL_DIG found." >&4
13115         val="$define"
13116 else
13117         echo "LDBL_DIG NOT found." >&4
13118         val="$undef"
13119 fi
13120 $rm -f ldbl_dig.?
13121 set d_ldbl_dig
13122 eval $setvar
13123
13124 : see if link exists
13125 set link d_link
13126 eval $inlibc
13127
13128 : see if localtime_r exists
13129 set localtime_r d_localtime_r
13130 eval $inlibc
13131 case "$d_localtime_r" in
13132 "$define")
13133         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13134         case "$d_localtime_r_proto:$usethreads" in
13135         ":define")      d_localtime_r_proto=define
13136                 set d_localtime_r_proto localtime_r $hdrs
13137                 eval $hasproto ;;
13138         *)      ;;
13139         esac
13140         case "$d_localtime_r_proto" in
13141         define)
13142         case "$localtime_r_proto" in
13143         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13144         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13145         esac
13146         case "$localtime_r_proto" in
13147         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13148         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13149         esac
13150         case "$localtime_r_proto" in
13151         ''|0)   d_localtime_r=undef
13152                 localtime_r_proto=0
13153                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13154         * )     case "$localtime_r_proto" in
13155                 REENTRANT_PROTO*) ;;
13156                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13157                 esac
13158                 echo "Prototype: $try" ;;
13159         esac
13160         ;;
13161         *)      case "$usethreads" in
13162                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13163                 esac
13164                 d_localtime_r=undef
13165                 localtime_r_proto=0
13166                 ;;
13167         esac
13168         ;;
13169 *)      localtime_r_proto=0
13170         ;;
13171 esac
13172
13173 : see if localeconv exists
13174 set localeconv d_locconv
13175 eval $inlibc
13176
13177 : see if lockf exists
13178 set lockf d_lockf
13179 eval $inlibc
13180
13181 : see if prototype for lseek is available
13182 echo " "
13183 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13184 eval $hasproto
13185
13186 : see if lstat exists
13187 set lstat d_lstat
13188 eval $inlibc
13189
13190 : see if madvise exists
13191 set madvise d_madvise
13192 eval $inlibc
13193
13194 : see if mblen exists
13195 set mblen d_mblen
13196 eval $inlibc
13197
13198 : see if mbstowcs exists
13199 set mbstowcs d_mbstowcs
13200 eval $inlibc
13201
13202 : see if mbtowc exists
13203 set mbtowc d_mbtowc
13204 eval $inlibc
13205
13206 : see if memchr exists
13207 set memchr d_memchr
13208 eval $inlibc
13209
13210 : see if memcmp exists
13211 set memcmp d_memcmp
13212 eval $inlibc
13213
13214 : see if memcpy exists
13215 set memcpy d_memcpy
13216 eval $inlibc
13217
13218 : see if memmove exists
13219 set memmove d_memmove
13220 eval $inlibc
13221
13222 : see if memset exists
13223 set memset d_memset
13224 eval $inlibc
13225
13226 : see if mkdir exists
13227 set mkdir d_mkdir
13228 eval $inlibc
13229
13230 : see if mkdtemp exists
13231 set mkdtemp d_mkdtemp
13232 eval $inlibc
13233
13234 : see if mkfifo exists
13235 set mkfifo d_mkfifo
13236 eval $inlibc
13237
13238 : see if mkstemp exists
13239 set mkstemp d_mkstemp
13240 eval $inlibc
13241
13242 : see if mkstemps exists
13243 set mkstemps d_mkstemps
13244 eval $inlibc
13245
13246 : see if mktime exists
13247 set mktime d_mktime
13248 eval $inlibc
13249
13250 : see if this is a sys/mman.h system
13251 set sys/mman.h i_sysmman
13252 eval $inhdr
13253
13254 : see if mmap exists
13255 set mmap d_mmap
13256 eval $inlibc
13257 : see what shmat returns
13258 : default to something harmless
13259 mmaptype='void *'
13260 case "$i_sysmman$d_mmap" in
13261 "$define$define")
13262         $cat >mmap.c <<'END'
13263 #include <sys/mman.h>
13264 void *mmap();
13265 END
13266         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13267                 mmaptype='void *'
13268         else
13269                 mmaptype='caddr_t'
13270         fi
13271         echo "and it returns ($mmaptype)." >&4
13272         ;;
13273 esac
13274
13275
13276
13277 : see if mprotect exists
13278 set mprotect d_mprotect
13279 eval $inlibc
13280
13281 : see if msgctl exists
13282 set msgctl d_msgctl
13283 eval $inlibc
13284
13285 : see if msgget exists
13286 set msgget d_msgget
13287 eval $inlibc
13288
13289 : see if msgsnd exists
13290 set msgsnd d_msgsnd
13291 eval $inlibc
13292
13293 : see if msgrcv exists
13294 set msgrcv d_msgrcv
13295 eval $inlibc
13296
13297 : see how much of the 'msg*(2)' library is present.
13298 h_msg=true
13299 echo " "
13300 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13301 *"$undef"*) h_msg=false;;
13302 esac
13303 case "$osname" in
13304 freebsd)
13305     case "`ipcs 2>&1`" in
13306     "SVID messages"*"not configured"*)
13307         echo "Your $osname does not have the msg*(2) configured." >&4
13308         h_msg=false
13309         val="$undef"
13310         set msgctl d_msgctl
13311         eval $setvar
13312         set msgget d_msgget
13313         eval $setvar
13314         set msgsnd d_msgsnd
13315         eval $setvar
13316         set msgrcv d_msgrcv
13317         eval $setvar
13318         ;;
13319     esac
13320     ;;
13321 esac
13322 : we could also check for sys/ipc.h ...
13323 if $h_msg && $test `./findhdr sys/msg.h`; then
13324         echo "You have the full msg*(2) library." >&4
13325         val="$define"
13326 else
13327         echo "You don't have the full msg*(2) library." >&4
13328         val="$undef"
13329 fi
13330 set d_msg
13331 eval $setvar
13332
13333
13334 echo " "
13335 echo "Checking to see if your system supports struct msghdr..." >&4
13336 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13337 eval $hasstruct
13338 case "$d_msghdr_s" in
13339 "$define")      echo "Yes, it does."   ;;
13340 *)              echo "No, it doesn't." ;;
13341 esac
13342
13343
13344 : see if msync exists
13345 set msync d_msync
13346 eval $inlibc
13347
13348 : see if munmap exists
13349 set munmap d_munmap
13350 eval $inlibc
13351
13352 : see if nice exists
13353 set nice d_nice
13354 eval $inlibc
13355
13356 : see if this is a langinfo.h system
13357 set langinfo.h i_langinfo
13358 eval $inhdr
13359
13360 : see if nl_langinfo exists
13361 set nl_langinfo d_nl_langinfo
13362 eval $inlibc
13363
13364 : check for length of character
13365 echo " "
13366 case "$charsize" in
13367 '')
13368         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13369         $cat >try.c <<'EOCP'
13370 #include <stdio.h>
13371 int main()
13372 {
13373     printf("%d\n", (int)sizeof(char));
13374     exit(0);
13375 }
13376 EOCP
13377         set try
13378         if eval $compile_ok; then
13379                 dflt=`$run ./try`
13380         else
13381                 dflt='1'
13382                 echo "(I can't seem to compile the test program.  Guessing...)"
13383         fi
13384         ;;
13385 *)
13386         dflt="$charsize"
13387         ;;
13388 esac
13389 rp="What is the size of a character (in bytes)?"
13390 . ./myread
13391 charsize="$ans"
13392 $rm -f try.c try
13393
13394 : check for volatile keyword
13395 echo " "
13396 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13397 $cat >try.c <<'EOCP'
13398 main()
13399 {
13400         typedef struct _goo_struct goo_struct;
13401         goo_struct * volatile goo = ((goo_struct *)0);
13402         struct _goo_struct {
13403                 long long_int;
13404                 int reg_int;
13405                 char char_var;
13406         };
13407         typedef unsigned short foo_t;
13408         char *volatile foo;
13409         volatile int bar;
13410         volatile foo_t blech;
13411         foo = foo;
13412 }
13413 EOCP
13414 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13415         val="$define"
13416         echo "Yup, it does."
13417 else
13418         val="$undef"
13419         echo "Nope, it doesn't."
13420 fi
13421 set d_volatile
13422 eval $setvar
13423 $rm -f try.*
13424
13425
13426 echo " "
13427 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13428
13429 case "$use64bitint:$d_quad:$quadtype" in
13430 define:define:?*)
13431         ivtype="$quadtype"
13432         uvtype="$uquadtype"
13433         ivsize=8
13434         uvsize=8
13435         ;;
13436 *)      ivtype="long"
13437         uvtype="unsigned long"
13438         ivsize=$longsize
13439         uvsize=$longsize
13440         ;;
13441 esac
13442
13443 case "$uselongdouble:$d_longdbl" in
13444 define:define)
13445         nvtype="long double"
13446         nvsize=$longdblsize
13447         ;;
13448 *)      nvtype=double
13449         nvsize=$doublesize
13450         ;;
13451 esac
13452
13453 $echo "(IV will be "$ivtype", $ivsize bytes)"
13454 $echo "(UV will be "$uvtype", $uvsize bytes)"
13455 $echo "(NV will be "$nvtype", $nvsize bytes)"
13456
13457 $cat >try.c <<EOCP
13458 #$i_inttypes I_INTTYPES
13459 #ifdef I_INTTYPES
13460 #include <inttypes.h>
13461 #endif
13462 #include <stdio.h>
13463 int main() {
13464 #ifdef INT8
13465    int8_t i =  INT8_MAX;
13466   uint8_t u = UINT8_MAX;
13467   printf("int8_t\n");
13468 #endif
13469 #ifdef INT16
13470    int16_t i =  INT16_MAX;
13471   uint16_t i = UINT16_MAX;
13472   printf("int16_t\n");
13473 #endif
13474 #ifdef INT32
13475    int32_t i =  INT32_MAX;
13476   uint32_t u = UINT32_MAX;
13477   printf("int32_t\n");
13478 #endif
13479 }
13480 EOCP
13481
13482 case "$i8type" in
13483 '')     case "$charsize" in
13484         1)      i8type=char
13485                 u8type="unsigned char"
13486                 i8size=$charsize
13487                 u8size=$charsize
13488                 ;;
13489         esac
13490         ;;
13491 esac
13492 case "$i8type" in
13493 '')     set try -DINT8
13494         if eval $compile; then
13495                 case "`$run ./try`" in
13496                 int8_t) i8type=int8_t
13497                         u8type=uint8_t
13498                         i8size=1
13499                         u8size=1
13500                         ;;
13501                 esac
13502         fi
13503         ;;
13504 esac
13505 case "$i8type" in
13506 '')     if $test $charsize -ge 1; then
13507                 i8type=char
13508                 u8type="unsigned char"
13509                 i8size=$charsize
13510                 u8size=$charsize
13511         fi
13512         ;;
13513 esac
13514
13515 case "$i16type" in
13516 '')     case "$shortsize" in
13517         2)      i16type=short
13518                 u16type="unsigned short"
13519                 i16size=$shortsize
13520                 u16size=$shortsize
13521                 ;;
13522         esac
13523         ;;
13524 esac
13525 case "$i16type" in
13526 '')     set try -DINT16
13527         if eval $compile; then
13528                 case "`$run ./try`" in
13529                 int16_t)
13530                         i16type=int16_t
13531                         u16type=uint16_t
13532                         i16size=2
13533                         u16size=2
13534                         ;;
13535                 esac
13536         fi
13537         ;;
13538 esac
13539 case "$i16type" in
13540 '')     if $test $shortsize -ge 2; then
13541                 i16type=short
13542                 u16type="unsigned short"
13543                 i16size=$shortsize
13544                 u16size=$shortsize
13545         fi
13546         ;;
13547 esac
13548
13549 case "$i32type" in
13550 '')     case "$longsize" in
13551         4)      i32type=long
13552                 u32type="unsigned long"
13553                 i32size=$longsize
13554                 u32size=$longsize
13555                 ;;
13556         *)      case "$intsize" in
13557                 4)      i32type=int
13558                         u32type="unsigned int"
13559                         i32size=$intsize
13560                         u32size=$intsize
13561                         ;;
13562                 esac
13563                 ;;
13564         esac
13565         ;;
13566 esac
13567 case "$i32type" in
13568 '')     set try -DINT32
13569         if eval $compile; then
13570                 case "`$run ./try`" in
13571                 int32_t)
13572                         i32type=int32_t
13573                         u32type=uint32_t
13574                         i32size=4
13575                         u32size=4
13576                         ;;
13577                 esac
13578         fi
13579         ;;
13580 esac
13581 case "$i32type" in
13582 '')     if $test $intsize -ge 4; then
13583                 i32type=int
13584                 u32type="unsigned int"
13585                 i32size=$intsize
13586                 u32size=$intsize
13587         fi
13588         ;;
13589 esac
13590
13591 case "$i64type" in
13592 '')     case "$d_quad:$quadtype" in
13593         define:?*)
13594                 i64type="$quadtype"
13595                 u64type="$uquadtype"
13596                 i64size=8
13597                 u64size=8
13598                 ;;
13599         esac
13600         ;;
13601 esac
13602
13603 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13604 : volatile so that the compiler has to store it out to memory.
13605 if test X"$d_volatile" = X"$define"; then
13606         volatile=volatile
13607 fi
13608 $cat <<EOP >try.c
13609 #include <stdio.h>
13610 #include <sys/types.h>
13611 #include <signal.h>
13612 #ifdef SIGFPE
13613 $volatile int bletched = 0;
13614 $signal_t blech(s) int s; { bletched = 1; }
13615 #endif
13616 int main() {
13617     $uvtype u = 0;
13618     $nvtype d;
13619     int     n = 8 * $uvsize;
13620     int     i;
13621 #ifdef SIGFPE
13622     signal(SIGFPE, blech);
13623 #endif
13624
13625     for (i = 0; i < n; i++) {
13626       u = u << 1 | ($uvtype)1;
13627       d = ($nvtype)u;
13628       if (($uvtype)d != u)
13629         break;
13630       if (d <= 0)
13631         break;
13632       d = ($nvtype)(u - 1);
13633       if (($uvtype)d != (u - 1))
13634         break;
13635 #ifdef SIGFPE
13636       if (bletched) {
13637         break;
13638 #endif
13639       } 
13640     }
13641     printf("%d\n", ((i == n) ? -n : i));
13642     exit(0);
13643 }
13644 EOP
13645 set try
13646
13647 d_nv_preserves_uv="$undef"
13648 if eval $compile; then
13649         nv_preserves_uv_bits="`$run ./try`"
13650 fi
13651 case "$nv_preserves_uv_bits" in
13652 \-[1-9]*)       
13653         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13654         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13655         d_nv_preserves_uv="$define"
13656         ;;
13657 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13658         d_nv_preserves_uv="$undef" ;;
13659 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13660         nv_preserves_uv_bits="$undef" ;;
13661 esac
13662
13663 $rm -f try.* try
13664
13665
13666 : check for off64_t
13667 echo " "
13668 echo "Checking to see if you have off64_t..." >&4
13669 $cat >try.c <<EOCP
13670 #include <sys/types.h>
13671 #include <unistd.h>
13672 int main() { off64_t x = 7; }
13673 EOCP
13674 set try
13675 if eval $compile; then
13676         val="$define"
13677         echo "You have off64_t."
13678 else
13679         val="$undef"
13680         echo "You do not have off64_t."
13681         case "$lseeksize" in
13682         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13683         esac
13684 fi
13685 $rm -f try.* try
13686 set d_off64_t
13687 eval $setvar
13688
13689 : how to create joinable pthreads
13690 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13691         echo " "
13692         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13693         $cat >try.c <<'EOCP'
13694 #include <pthread.h>
13695 int main() {
13696     int detachstate = JOINABLE;
13697 }
13698 EOCP
13699         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13700         if eval $compile; then
13701                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13702                 val="$undef" # Yes, undef.
13703                 set d_old_pthread_create_joinable
13704                 eval $setvar
13705                 val=""
13706                 set old_pthread_create_joinable
13707                 eval $setvar
13708         else
13709                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13710                 if eval $compile; then
13711                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13712                         val="$define"
13713                         set d_old_pthread_create_joinable
13714                         eval $setvar
13715                         val=PTHREAD_CREATE_UNDETACHED
13716                         set old_pthread_create_joinable
13717                         eval $setvar
13718                 else            
13719                         set try -DJOINABLE=__UNDETACHED
13720                         if eval $compile; then
13721                                 echo "You seem to use __UNDETACHED." >&4
13722                                 val="$define"
13723                                 set d_old_pthread_create_joinable
13724                                 eval $setvar
13725                                 val=__UNDETACHED
13726                                 set old_pthread_create_joinable
13727                                 eval $setvar
13728                         else
13729                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13730                                 val="$define"
13731                                 set d_old_pthread_create_joinable
13732                                 eval $setvar
13733                                 val=0
13734                                 set old_pthread_create_joinable
13735                                 eval $setvar
13736                         fi
13737                 fi
13738         fi
13739         $rm -f try try.*
13740 else
13741     d_old_pthread_create_joinable="$undef"
13742     old_pthread_create_joinable=""
13743 fi
13744
13745 : see if pause exists
13746 set pause d_pause
13747 eval $inlibc
13748
13749 : see if pipe exists
13750 set pipe d_pipe
13751 eval $inlibc
13752
13753 : see if poll exists
13754 set poll d_poll
13755 eval $inlibc
13756
13757 : see if readlink exists
13758 set readlink d_readlink
13759 eval $inlibc
13760
13761 echo " "
13762 procselfexe=''
13763 val="$undef"
13764 case "$d_readlink" in
13765 "$define")
13766         if $issymlink /proc/self/exe ; then
13767                 $ls -l /proc/self/exe > reflect
13768                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13769                         echo "You have Linux-like /proc/self/exe."
13770                         procselfexe='"/proc/self/exe"'
13771                         val="$define"
13772                 fi
13773         fi
13774         if $issymlink /proc/curproc/file ; then
13775                 $ls -l /proc/curproc/file > reflect
13776                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13777                         echo "You have BSD-like /proc/curproc/file."
13778                         procselfexe='"/proc/curproc/file"'
13779                         val="$define"
13780                 fi
13781         fi
13782         ;;
13783 esac
13784 $rm -f reflect
13785 set d_procselfexe
13786 eval $setvar
13787
13788 : see whether the pthread_atfork exists
13789 $cat >try.c <<EOP
13790 #include <pthread.h>
13791 #include <stdio.h>
13792 int main() {
13793 #ifdef  PTHREAD_ATFORK
13794         pthread_atfork(NULL,NULL,NULL);
13795 #endif
13796 }
13797 EOP
13798
13799 : see if pthread_atfork exists
13800 set try -DPTHREAD_ATFORK
13801 if eval $compile; then
13802     val="$define"
13803 else
13804     val="$undef"
13805 fi
13806 case "$usethreads" in
13807 $define)
13808         case "$val" in
13809         $define) echo 'pthread_atfork found.' >&4        ;;
13810         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13811         esac
13812 esac
13813 set d_pthread_atfork
13814 eval $setvar
13815
13816
13817 : see whether the various POSIXish _yields exist
13818 $cat >try.c <<EOP
13819 #include <pthread.h>
13820 #include <stdio.h>
13821 int main() {
13822 #ifdef SCHED_YIELD
13823         sched_yield();
13824 #else
13825 #ifdef PTHREAD_YIELD
13826         pthread_yield();
13827 #else
13828 #ifdef PTHREAD_YIELD_NULL
13829         pthread_yield(NULL);
13830 #endif
13831 #endif
13832 #endif
13833 }
13834 EOP
13835 : see if sched_yield exists
13836 set try -DSCHED_YIELD
13837 if eval $compile; then
13838     val="$define"
13839     sched_yield='sched_yield()'
13840 else
13841     val="$undef"
13842 fi
13843 case "$usethreads" in
13844 $define)
13845         case "$val" in
13846         $define) echo 'sched_yield() found.' >&4        ;;
13847         *)       echo 'sched_yield() NOT found.' >&4    ;;
13848         esac
13849 esac
13850 set d_sched_yield
13851 eval $setvar
13852
13853 : see if pthread_yield exists
13854 set try -DPTHREAD_YIELD
13855 if eval $compile; then
13856     val="$define"
13857     case "$sched_yield" in
13858     '') sched_yield='pthread_yield()' ;;
13859     esac
13860 else
13861     set try -DPTHREAD_YIELD_NULL
13862     if eval $compile; then
13863         val="$define"
13864         case "$sched_yield" in
13865         '') sched_yield='pthread_yield(NULL)' ;;
13866         esac
13867     else
13868         val="$undef"
13869     fi
13870 fi
13871 case "$usethreads" in
13872 $define)
13873         case "$val" in
13874         $define) echo 'pthread_yield() found.' >&4      ;;
13875         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13876         esac
13877         ;;
13878 esac
13879 set d_pthread_yield
13880 eval $setvar
13881
13882 case "$sched_yield" in
13883 '') sched_yield=undef ;;
13884 esac
13885
13886 $rm -f try try.*
13887
13888 : see if random_r exists
13889 set random_r d_random_r
13890 eval $inlibc
13891 case "$d_random_r" in
13892 "$define")
13893         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13894         case "$d_random_r_proto:$usethreads" in
13895         ":define")      d_random_r_proto=define
13896                 set d_random_r_proto random_r $hdrs
13897                 eval $hasproto ;;
13898         *)      ;;
13899         esac
13900         case "$d_random_r_proto" in
13901         define)
13902         case "$random_r_proto" in
13903         ''|0) try='int random_r(int*, struct random_data*);'
13904         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13905         esac
13906         case "$random_r_proto" in
13907         ''|0)   d_random_r=undef
13908                 random_r_proto=0
13909                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13910         * )     case "$random_r_proto" in
13911                 REENTRANT_PROTO*) ;;
13912                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13913                 esac
13914                 echo "Prototype: $try" ;;
13915         esac
13916         ;;
13917         *)      case "$usethreads" in
13918                 define) echo "random_r has no prototype, not using it." >&4 ;;
13919                 esac
13920                 d_random_r=undef
13921                 random_r_proto=0
13922                 ;;
13923         esac
13924         ;;
13925 *)      random_r_proto=0
13926         ;;
13927 esac
13928
13929 : see if readdir and friends exist
13930 set readdir d_readdir
13931 eval $inlibc
13932 set seekdir d_seekdir
13933 eval $inlibc
13934 set telldir d_telldir
13935 eval $inlibc
13936 set rewinddir d_rewinddir
13937 eval $inlibc
13938
13939 : see if readdir64_r exists
13940 set readdir64_r d_readdir64_r
13941 eval $inlibc
13942 case "$d_readdir64_r" in
13943 "$define")
13944         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13945         case "$d_readdir64_r_proto:$usethreads" in
13946         ":define")      d_readdir64_r_proto=define
13947                 set d_readdir64_r_proto readdir64_r $hdrs
13948                 eval $hasproto ;;
13949         *)      ;;
13950         esac
13951         case "$d_readdir64_r_proto" in
13952         define)
13953         case "$readdir64_r_proto" in
13954         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13955         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13956         esac
13957         case "$readdir64_r_proto" in
13958         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13959         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13960         esac
13961         case "$readdir64_r_proto" in
13962         ''|0)   d_readdir64_r=undef
13963                 readdir64_r_proto=0
13964                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13965         * )     case "$readdir64_r_proto" in
13966                 REENTRANT_PROTO*) ;;
13967                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13968                 esac
13969                 echo "Prototype: $try" ;;
13970         esac
13971         ;;
13972         *)      case "$usethreads" in
13973                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13974                 esac
13975                 d_readdir64_r=undef
13976                 readdir64_r_proto=0
13977                 ;;
13978         esac
13979         ;;
13980 *)      readdir64_r_proto=0
13981         ;;
13982 esac
13983
13984 : see if readdir_r exists
13985 set readdir_r d_readdir_r
13986 eval $inlibc
13987 case "$d_readdir_r" in
13988 "$define")
13989         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13990         case "$d_readdir_r_proto:$usethreads" in
13991         ":define")      d_readdir_r_proto=define
13992                 set d_readdir_r_proto readdir_r $hdrs
13993                 eval $hasproto ;;
13994         *)      ;;
13995         esac
13996         case "$d_readdir_r_proto" in
13997         define)
13998         case "$readdir_r_proto" in
13999         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14000         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14001         esac
14002         case "$readdir_r_proto" in
14003         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14004         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14005         esac
14006         case "$readdir_r_proto" in
14007         ''|0)   d_readdir_r=undef
14008                 readdir_r_proto=0
14009                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14010         * )     case "$readdir_r_proto" in
14011                 REENTRANT_PROTO*) ;;
14012                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14013                 esac
14014                 echo "Prototype: $try" ;;
14015         esac
14016         ;;
14017         *)      case "$usethreads" in
14018                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14019                 esac
14020                 d_readdir_r=undef
14021                 readdir_r_proto=0
14022                 ;;
14023         esac
14024         ;;
14025 *)      readdir_r_proto=0
14026         ;;
14027 esac
14028
14029 : see if readv exists
14030 set readv d_readv
14031 eval $inlibc
14032
14033 : see if recvmsg exists
14034 set recvmsg d_recvmsg
14035 eval $inlibc
14036
14037 : see if rename exists
14038 set rename d_rename
14039 eval $inlibc
14040
14041 : see if rmdir exists
14042 set rmdir d_rmdir
14043 eval $inlibc
14044
14045 : see if memory.h is available.
14046 val=''
14047 set memory.h val
14048 eval $inhdr
14049
14050 : See if it conflicts with string.h
14051 case "$val" in
14052 $define)
14053         case "$strings" in
14054         '') ;;
14055         *)
14056                 $cppstdin $cppflags $cppminus < $strings > mem.h
14057                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14058                         echo " "
14059                         echo "We won't be including <memory.h>."
14060                         val="$undef"
14061                 fi
14062                 $rm -f mem.h
14063                 ;;
14064         esac
14065 esac
14066 set i_memory
14067 eval $setvar
14068
14069 : can bcopy handle overlapping blocks?
14070 echo " "
14071 val="$undef"
14072 case "$d_memmove" in
14073 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14074 *)      case "$d_bcopy" in
14075         "$define")
14076                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14077                 $cat >try.c <<EOCP
14078 #$i_memory I_MEMORY
14079 #$i_stdlib I_STDLIB
14080 #$i_string I_STRING
14081 #$i_unistd I_UNISTD
14082 EOCP
14083         $cat >>try.c <<'EOCP'
14084 #include <stdio.h>
14085 #ifdef I_MEMORY
14086 #  include <memory.h>
14087 #endif
14088 #ifdef I_STDLIB
14089 #  include <stdlib.h>
14090 #endif
14091 #ifdef I_STRING
14092 #  include <string.h>
14093 #else
14094 #  include <strings.h>
14095 #endif
14096 #ifdef I_UNISTD
14097 #  include <unistd.h>  /* Needed for NetBSD */
14098 #endif
14099 int main()
14100 {
14101 char buf[128], abc[128];
14102 char *b;
14103 int len;
14104 int off;
14105 int align;
14106
14107 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14108    try to store the string in read-only memory. */
14109 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14110
14111 for (align = 7; align >= 0; align--) {
14112         for (len = 36; len; len--) {
14113                 b = buf+align;
14114                 bcopy(abc, b, len);
14115                 for (off = 1; off <= len; off++) {
14116                         bcopy(b, b+off, len);
14117                         bcopy(b+off, b, len);
14118                         if (bcmp(b, abc, len))
14119                                 exit(1);
14120                 }
14121         }
14122 }
14123 exit(0);
14124 }
14125 EOCP
14126                 set try
14127                 if eval $compile_ok; then
14128                         if ./try 2>/dev/null; then
14129                                 echo "Yes, it can."
14130                                 val="$define"
14131                         else
14132                                 echo "It can't, sorry."
14133                         fi
14134                 else
14135                         echo "(I can't compile the test program, so we'll assume not...)"
14136                 fi
14137                 ;;
14138         esac
14139         $rm -f try.* try core
14140         ;;
14141 esac
14142 set d_safebcpy
14143 eval $setvar
14144
14145 : can memcpy handle overlapping blocks?
14146 echo " "
14147 val="$undef"
14148 case "$d_memmove" in
14149 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14150 *)      case "$d_memcpy" in
14151         "$define")
14152                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14153                 $cat >try.c <<EOCP
14154 #$i_memory I_MEMORY
14155 #$i_stdlib I_STDLIB
14156 #$i_string I_STRING
14157 #$i_unistd I_UNISTD
14158 EOCP
14159         $cat >>try.c <<'EOCP'
14160 #include <stdio.h>
14161 #ifdef I_MEMORY
14162 #  include <memory.h>
14163 #endif
14164 #ifdef I_STDLIB
14165 #  include <stdlib.h>
14166 #endif
14167 #ifdef I_STRING
14168 #  include <string.h>
14169 #else
14170 #  include <strings.h>
14171 #endif
14172 #ifdef I_UNISTD
14173 #  include <unistd.h>  /* Needed for NetBSD */
14174 #endif
14175 int main()
14176 {
14177 char buf[128], abc[128];
14178 char *b;
14179 int len;
14180 int off;
14181 int align;
14182
14183 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14184    try to store the string in read-only memory. */
14185 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14186
14187 for (align = 7; align >= 0; align--) {
14188         for (len = 36; len; len--) {
14189                 b = buf+align;
14190                 memcpy(b, abc, len);
14191                 for (off = 1; off <= len; off++) {
14192                         memcpy(b+off, b, len);
14193                         memcpy(b, b+off, len);
14194                         if (memcmp(b, abc, len))
14195                                 exit(1);
14196                 }
14197         }
14198 }
14199 exit(0);
14200 }
14201 EOCP
14202                 set try
14203                 if eval $compile_ok; then
14204                         if ./try 2>/dev/null; then
14205                                 echo "Yes, it can."
14206                                 val="$define"
14207                         else
14208                                 echo "It can't, sorry."
14209                         fi
14210                 else
14211                         echo "(I can't compile the test program, so we'll assume not...)"
14212                 fi
14213                 ;;
14214         esac
14215         $rm -f try.* try core
14216         ;;
14217 esac
14218 set d_safemcpy
14219 eval $setvar
14220
14221 : can memcmp be trusted to compare relative magnitude?
14222 val="$undef"
14223 case "$d_memcmp" in
14224 "$define")
14225         echo " "
14226         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14227         $cat >try.c <<EOCP
14228 #$i_memory I_MEMORY
14229 #$i_stdlib I_STDLIB
14230 #$i_string I_STRING
14231 #$i_unistd I_UNISTD
14232 EOCP
14233         $cat >>try.c <<'EOCP'
14234 #include <stdio.h>
14235 #ifdef I_MEMORY
14236 #  include <memory.h>
14237 #endif
14238 #ifdef I_STDLIB
14239 #  include <stdlib.h>
14240 #endif
14241 #ifdef I_STRING
14242 #  include <string.h>
14243 #else
14244 #  include <strings.h>
14245 #endif
14246 #ifdef I_UNISTD
14247 #  include <unistd.h>  /* Needed for NetBSD */
14248 #endif
14249 int main()
14250 {
14251 char a = -1;
14252 char b = 0;
14253 if ((a < b) && memcmp(&a, &b, 1) < 0)
14254         exit(1);
14255 exit(0);
14256 }
14257 EOCP
14258         set try
14259         if eval $compile_ok; then
14260                 if $run ./try 2>/dev/null; then
14261                         echo "Yes, it can."
14262                         val="$define"
14263                 else
14264                         echo "No, it can't (it uses signed chars)."
14265                 fi
14266         else
14267                 echo "(I can't compile the test program, so we'll assume not...)"
14268         fi
14269         ;;
14270 esac
14271 $rm -f try.* try core
14272 set d_sanemcmp
14273 eval $setvar
14274
14275 : see if prototype for sbrk is available
14276 echo " "
14277 set d_sbrkproto sbrk $i_unistd unistd.h
14278 eval $hasproto
14279
14280 : see if select exists
14281 set select d_select
14282 eval $inlibc
14283
14284 : see if semctl exists
14285 set semctl d_semctl
14286 eval $inlibc
14287
14288 : see if semget exists
14289 set semget d_semget
14290 eval $inlibc
14291
14292 : see if semop exists
14293 set semop d_semop
14294 eval $inlibc
14295
14296 : see how much of the 'sem*(2)' library is present.
14297 h_sem=true
14298 echo " "
14299 case "$d_semctl$d_semget$d_semop" in
14300 *"$undef"*) h_sem=false;;
14301 esac
14302 case "$osname" in
14303 freebsd)
14304     case "`ipcs 2>&1`" in
14305     "SVID messages"*"not configured"*)
14306         echo "Your $osname does not have the sem*(2) configured." >&4
14307         h_sem=false
14308         val="$undef"
14309         set semctl d_semctl
14310         eval $setvar
14311         set semget d_semget
14312         eval $setvar
14313         set semop d_semop
14314         eval $setvar
14315         ;;
14316     esac
14317     ;;
14318 esac
14319 : we could also check for sys/ipc.h ...
14320 if $h_sem && $test `./findhdr sys/sem.h`; then
14321         echo "You have the full sem*(2) library." >&4
14322         val="$define"
14323 else
14324         echo "You don't have the full sem*(2) library." >&4
14325         val="$undef"
14326 fi
14327 set d_sem
14328 eval $setvar
14329
14330 : see whether sys/sem.h defines union semun
14331 echo " "
14332 $cat > try.c <<'END'
14333 #include <sys/types.h>
14334 #include <sys/ipc.h>
14335 #include <sys/sem.h>
14336 int main () { union semun semun; semun.buf = 0; }
14337 END
14338 set try
14339 if eval $compile; then
14340     echo "You have union semun in <sys/sem.h>." >&4
14341     val="$define"
14342 else
14343     echo "You do not have union semun in <sys/sem.h>." >&4
14344     val="$undef"
14345 fi
14346 $rm -f try try.c try.h
14347 set d_union_semun
14348 eval $setvar
14349
14350 : see how to do semctl IPC_STAT
14351 case "$d_sem" in
14352 $define)
14353     : see whether semctl IPC_STAT can use union semun
14354     echo " "
14355     $cat > try.h <<END
14356 #ifndef S_IRUSR
14357 #   ifdef S_IREAD
14358 #       define S_IRUSR S_IREAD
14359 #       define S_IWUSR S_IWRITE
14360 #       define S_IXUSR S_IEXEC
14361 #   else
14362 #       define S_IRUSR 0400
14363 #       define S_IWUSR 0200
14364 #       define S_IXUSR 0100
14365 #   endif
14366 #   define S_IRGRP (S_IRUSR>>3)
14367 #   define S_IWGRP (S_IWUSR>>3)
14368 #   define S_IXGRP (S_IXUSR>>3)
14369 #   define S_IROTH (S_IRUSR>>6)
14370 #   define S_IWOTH (S_IWUSR>>6)
14371 #   define S_IXOTH (S_IXUSR>>6)
14372 #endif
14373 #ifndef S_IRWXU
14374 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14375 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14376 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14377 #endif
14378 END
14379
14380     $cat > try.c <<END
14381 #include <sys/types.h>
14382 #include <sys/ipc.h>
14383 #include <sys/sem.h>
14384 #include <sys/stat.h>
14385 #include <stdio.h>
14386 #include <errno.h>
14387 #include "try.h"
14388 #ifndef errno
14389 extern int errno;
14390 #endif
14391 #$d_union_semun HAS_UNION_SEMUN
14392 int main() {
14393     union semun
14394 #ifndef HAS_UNION_SEMUN
14395     {
14396         int val;
14397         struct semid_ds *buf;
14398         unsigned short *array;
14399     }
14400 #endif
14401     arg;
14402     int sem, st;
14403
14404 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14405     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14406     if (sem > -1) {
14407         struct semid_ds argbuf;
14408         arg.buf = &argbuf;
14409 #       ifdef IPC_STAT
14410         st = semctl(sem, 0, IPC_STAT, arg);
14411         if (st == 0)
14412             printf("semun\n");
14413         else
14414 #       endif /* IPC_STAT */
14415             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14416 #       ifdef IPC_RMID
14417         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14418 #       endif /* IPC_RMID */
14419             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14420     } else
14421 #endif /* IPC_PRIVATE && ... */
14422         printf("semget failed: errno = %d\n", errno);
14423   return 0;
14424 }
14425 END
14426     val="$undef"
14427     set try
14428     if eval $compile; then
14429         xxx=`$run ./try`
14430         case "$xxx" in
14431         semun) val="$define" ;;
14432         esac
14433     fi
14434     $rm -f try try.c
14435     set d_semctl_semun
14436     eval $setvar
14437     case "$d_semctl_semun" in
14438     $define)
14439         echo "You can use union semun for semctl IPC_STAT." >&4
14440         also='also'
14441         ;;
14442     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14443         also=''
14444         ;;
14445     esac
14446
14447     : see whether semctl IPC_STAT can use struct semid_ds pointer
14448     $cat > try.c <<'END'
14449 #include <sys/types.h>
14450 #include <sys/ipc.h>
14451 #include <sys/sem.h>
14452 #include <sys/stat.h>
14453 #include "try.h"
14454 #include <stdio.h>
14455 #include <errno.h>
14456 #ifndef errno
14457 extern int errno;
14458 #endif
14459 int main() {
14460     struct semid_ds arg;
14461     int sem, st;
14462
14463 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14464     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14465     if (sem > -1) {
14466 #       ifdef IPC_STAT
14467         st = semctl(sem, 0, IPC_STAT, &arg);
14468         if (st == 0)
14469             printf("semid_ds\n");
14470         else
14471 #       endif /* IPC_STAT */
14472             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14473 #       ifdef IPC_RMID
14474         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14475 #       endif /* IPC_RMID */
14476             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14477     } else
14478 #endif /* IPC_PRIVATE && ... */
14479         printf("semget failed: errno = %d\n", errno);
14480
14481     return 0;
14482 }
14483 END
14484     val="$undef"
14485     set try
14486     if eval $compile; then
14487         xxx=`$run ./try`
14488         case "$xxx" in
14489         semid_ds) val="$define" ;;
14490         esac
14491     fi
14492     $rm -f try try.c
14493     set d_semctl_semid_ds
14494     eval $setvar
14495     case "$d_semctl_semid_ds" in
14496     $define)
14497         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14498         ;;
14499     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14500         ;;
14501     esac
14502     $rm -f try.h
14503     ;;
14504 *)  val="$undef"
14505
14506     # We do not have the full sem*(2) library, so assume we can not
14507     # use either.
14508
14509     set d_semctl_semun
14510     eval $setvar
14511
14512     set d_semctl_semid_ds
14513     eval $setvar
14514     ;;
14515 esac
14516
14517 : see if sendmsg exists
14518 set sendmsg d_sendmsg
14519 eval $inlibc
14520
14521 : see if setegid exists
14522 set setegid d_setegid
14523 eval $inlibc
14524
14525 : see if seteuid exists
14526 set seteuid d_seteuid
14527 eval $inlibc
14528
14529 : see if setgrent exists
14530 set setgrent d_setgrent
14531 eval $inlibc
14532
14533 : see if setgrent_r exists
14534 set setgrent_r d_setgrent_r
14535 eval $inlibc
14536 case "$d_setgrent_r" in
14537 "$define")
14538         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14539         case "$d_setgrent_r_proto:$usethreads" in
14540         ":define")      d_setgrent_r_proto=define
14541                 set d_setgrent_r_proto setgrent_r $hdrs
14542                 eval $hasproto ;;
14543         *)      ;;
14544         esac
14545         case "$d_setgrent_r_proto" in
14546         define)
14547         case "$setgrent_r_proto" in
14548         ''|0) try='int setgrent_r(FILE**);'
14549         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14550         esac
14551         case "$setgrent_r_proto" in
14552         ''|0) try='void setgrent_r(FILE**);'
14553         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14554         esac
14555         case "$setgrent_r_proto" in
14556         ''|0)   d_setgrent_r=undef
14557                 setgrent_r_proto=0
14558                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14559         * )     case "$setgrent_r_proto" in
14560                 REENTRANT_PROTO*) ;;
14561                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14562                 esac
14563                 echo "Prototype: $try" ;;
14564         esac
14565         ;;
14566         *)      case "$usethreads" in
14567                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14568                 esac
14569                 d_setgrent_r=undef
14570                 setgrent_r_proto=0
14571                 ;;
14572         esac
14573         ;;
14574 *)      setgrent_r_proto=0
14575         ;;
14576 esac
14577
14578 : see if sethostent exists
14579 set sethostent d_sethent
14580 eval $inlibc
14581
14582 : see if sethostent_r exists
14583 set sethostent_r d_sethostent_r
14584 eval $inlibc
14585 case "$d_sethostent_r" in
14586 "$define")
14587         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14588         case "$d_sethostent_r_proto:$usethreads" in
14589         ":define")      d_sethostent_r_proto=define
14590                 set d_sethostent_r_proto sethostent_r $hdrs
14591                 eval $hasproto ;;
14592         *)      ;;
14593         esac
14594         case "$d_sethostent_r_proto" in
14595         define)
14596         case "$sethostent_r_proto" in
14597         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14598         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14599         esac
14600         case "$sethostent_r_proto" in
14601         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14602         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14603         esac
14604         case "$sethostent_r_proto" in
14605         ''|0)   d_sethostent_r=undef
14606                 sethostent_r_proto=0
14607                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14608         * )     case "$sethostent_r_proto" in
14609                 REENTRANT_PROTO*) ;;
14610                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14611                 esac
14612                 echo "Prototype: $try" ;;
14613         esac
14614         ;;
14615         *)      case "$usethreads" in
14616                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14617                 esac
14618                 d_sethostent_r=undef
14619                 sethostent_r_proto=0
14620                 ;;
14621         esac
14622         ;;
14623 *)      sethostent_r_proto=0
14624         ;;
14625 esac
14626
14627 : see if setitimer exists
14628 set setitimer d_setitimer
14629 eval $inlibc
14630
14631 : see if setlinebuf exists
14632 set setlinebuf d_setlinebuf
14633 eval $inlibc
14634
14635 : see if setlocale exists
14636 set setlocale d_setlocale
14637 eval $inlibc
14638
14639 : see if locale.h is available
14640 set locale.h i_locale
14641 eval $inhdr
14642
14643 : see if setlocale_r exists
14644 set setlocale_r d_setlocale_r
14645 eval $inlibc
14646 case "$d_setlocale_r" in
14647 "$define")
14648         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14649         case "$d_setlocale_r_proto:$usethreads" in
14650         ":define")      d_setlocale_r_proto=define
14651                 set d_setlocale_r_proto setlocale_r $hdrs
14652                 eval $hasproto ;;
14653         *)      ;;
14654         esac
14655         case "$d_setlocale_r_proto" in
14656         define)
14657         case "$setlocale_r_proto" in
14658         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14659         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14660         esac
14661         case "$setlocale_r_proto" in
14662         ''|0)   d_setlocale_r=undef
14663                 setlocale_r_proto=0
14664                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14665         * )     case "$setlocale_r_proto" in
14666                 REENTRANT_PROTO*) ;;
14667                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14668                 esac
14669                 echo "Prototype: $try" ;;
14670         esac
14671         ;;
14672         *)      case "$usethreads" in
14673                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14674                 esac
14675                 d_setlocale_r=undef
14676                 setlocale_r_proto=0
14677                 ;;
14678         esac
14679         ;;
14680 *)      setlocale_r_proto=0
14681         ;;
14682 esac
14683
14684 : see if setnetent exists
14685 set setnetent d_setnent
14686 eval $inlibc
14687
14688 : see if setnetent_r exists
14689 set setnetent_r d_setnetent_r
14690 eval $inlibc
14691 case "$d_setnetent_r" in
14692 "$define")
14693         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14694         case "$d_setnetent_r_proto:$usethreads" in
14695         ":define")      d_setnetent_r_proto=define
14696                 set d_setnetent_r_proto setnetent_r $hdrs
14697                 eval $hasproto ;;
14698         *)      ;;
14699         esac
14700         case "$d_setnetent_r_proto" in
14701         define)
14702         case "$setnetent_r_proto" in
14703         ''|0) try='int setnetent_r(int, struct netent_data*);'
14704         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14705         esac
14706         case "$setnetent_r_proto" in
14707         ''|0) try='void setnetent_r(int, struct netent_data*);'
14708         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14709         esac
14710         case "$setnetent_r_proto" in
14711         ''|0)   d_setnetent_r=undef
14712                 setnetent_r_proto=0
14713                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14714         * )     case "$setnetent_r_proto" in
14715                 REENTRANT_PROTO*) ;;
14716                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14717                 esac
14718                 echo "Prototype: $try" ;;
14719         esac
14720         ;;
14721         *)      case "$usethreads" in
14722                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14723                 esac
14724                 d_setnetent_r=undef
14725                 setnetent_r_proto=0
14726                 ;;
14727         esac
14728         ;;
14729 *)      setnetent_r_proto=0
14730         ;;
14731 esac
14732
14733 : see if setprotoent exists
14734 set setprotoent d_setpent
14735 eval $inlibc
14736
14737 : see if setpgid exists
14738 set setpgid d_setpgid
14739 eval $inlibc
14740
14741 : see if setpgrp2 exists
14742 set setpgrp2 d_setpgrp2
14743 eval $inlibc
14744
14745 : see if setpriority exists
14746 set setpriority d_setprior
14747 eval $inlibc
14748
14749 : see if setproctitle exists
14750 set setproctitle d_setproctitle
14751 eval $inlibc
14752
14753 : see if setprotoent_r exists
14754 set setprotoent_r d_setprotoent_r
14755 eval $inlibc
14756 case "$d_setprotoent_r" in
14757 "$define")
14758         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14759         case "$d_setprotoent_r_proto:$usethreads" in
14760         ":define")      d_setprotoent_r_proto=define
14761                 set d_setprotoent_r_proto setprotoent_r $hdrs
14762                 eval $hasproto ;;
14763         *)      ;;
14764         esac
14765         case "$d_setprotoent_r_proto" in
14766         define)
14767         case "$setprotoent_r_proto" in
14768         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14769         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14770         esac
14771         case "$setprotoent_r_proto" in
14772         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14773         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14774         esac
14775         case "$setprotoent_r_proto" in
14776         ''|0)   d_setprotoent_r=undef
14777                 setprotoent_r_proto=0
14778                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14779         * )     case "$setprotoent_r_proto" in
14780                 REENTRANT_PROTO*) ;;
14781                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14782                 esac
14783                 echo "Prototype: $try" ;;
14784         esac
14785         ;;
14786         *)      case "$usethreads" in
14787                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14788                 esac
14789                 d_setprotoent_r=undef
14790                 setprotoent_r_proto=0
14791                 ;;
14792         esac
14793         ;;
14794 *)      setprotoent_r_proto=0
14795         ;;
14796 esac
14797
14798 : see if setpwent exists
14799 set setpwent d_setpwent
14800 eval $inlibc
14801
14802 : see if setpwent_r exists
14803 set setpwent_r d_setpwent_r
14804 eval $inlibc
14805 case "$d_setpwent_r" in
14806 "$define")
14807         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14808         case "$d_setpwent_r_proto:$usethreads" in
14809         ":define")      d_setpwent_r_proto=define
14810                 set d_setpwent_r_proto setpwent_r $hdrs
14811                 eval $hasproto ;;
14812         *)      ;;
14813         esac
14814         case "$d_setpwent_r_proto" in
14815         define)
14816         case "$setpwent_r_proto" in
14817         ''|0) try='int setpwent_r(FILE**);'
14818         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14819         esac
14820         case "$setpwent_r_proto" in
14821         ''|0) try='void setpwent_r(FILE**);'
14822         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14823         esac
14824         case "$setpwent_r_proto" in
14825         ''|0)   d_setpwent_r=undef
14826                 setpwent_r_proto=0
14827                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14828         * )     case "$setpwent_r_proto" in
14829                 REENTRANT_PROTO*) ;;
14830                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14831                 esac
14832                 echo "Prototype: $try" ;;
14833         esac
14834         ;;
14835         *)      case "$usethreads" in
14836                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14837                 esac
14838                 d_setpwent_r=undef
14839                 setpwent_r_proto=0
14840                 ;;
14841         esac
14842         ;;
14843 *)      setpwent_r_proto=0
14844         ;;
14845 esac
14846
14847 : see if setregid exists
14848 set setregid d_setregid
14849 eval $inlibc
14850 set setresgid d_setresgid
14851 eval $inlibc
14852
14853 : see if setreuid exists
14854 set setreuid d_setreuid
14855 eval $inlibc
14856 set setresuid d_setresuid
14857 eval $inlibc
14858
14859 : see if setrgid exists
14860 set setrgid d_setrgid
14861 eval $inlibc
14862
14863 : see if setruid exists
14864 set setruid d_setruid
14865 eval $inlibc
14866
14867 : see if setservent exists
14868 set setservent d_setsent
14869 eval $inlibc
14870
14871 : see if setservent_r exists
14872 set setservent_r d_setservent_r
14873 eval $inlibc
14874 case "$d_setservent_r" in
14875 "$define")
14876         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14877         case "$d_setservent_r_proto:$usethreads" in
14878         ":define")      d_setservent_r_proto=define
14879                 set d_setservent_r_proto setservent_r $hdrs
14880                 eval $hasproto ;;
14881         *)      ;;
14882         esac
14883         case "$d_setservent_r_proto" in
14884         define)
14885         case "$setservent_r_proto" in
14886         ''|0) try='int setservent_r(int, struct servent_data*);'
14887         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14888         esac
14889         case "$setservent_r_proto" in
14890         ''|0) try='void setservent_r(int, struct servent_data*);'
14891         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14892         esac
14893         case "$setservent_r_proto" in
14894         ''|0)   d_setservent_r=undef
14895                 setservent_r_proto=0
14896                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14897         * )     case "$setservent_r_proto" in
14898                 REENTRANT_PROTO*) ;;
14899                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14900                 esac
14901                 echo "Prototype: $try" ;;
14902         esac
14903         ;;
14904         *)      case "$usethreads" in
14905                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14906                 esac
14907                 d_setservent_r=undef
14908                 setservent_r_proto=0
14909                 ;;
14910         esac
14911         ;;
14912 *)      setservent_r_proto=0
14913         ;;
14914 esac
14915
14916 : see if setsid exists
14917 set setsid d_setsid
14918 eval $inlibc
14919
14920 : see if setvbuf exists
14921 set setvbuf d_setvbuf
14922 eval $inlibc
14923
14924 : see if sfio.h is available
14925 set sfio.h i_sfio
14926 eval $inhdr
14927
14928
14929 : see if sfio library is available
14930 case "$i_sfio" in
14931 $define)
14932         val=''
14933         set sfreserve val
14934         eval $inlibc
14935         ;;
14936 *)
14937         val="$undef"
14938         ;;
14939 esac
14940 : Ok, but do we want to use it.
14941 case "$val" in
14942 $define)
14943         case "$usesfio" in
14944         true|$define|[yY]*) dflt='y';;
14945         *) dflt='n';;
14946         esac
14947         echo "$package can use the sfio library, but it is experimental."
14948         case "$useperlio" in
14949         "$undef")
14950             echo "For sfio also the PerlIO abstraction layer is needed."
14951             echo "Earlier you said you wouldn't want that."
14952             ;;
14953         esac
14954         rp="You seem to have sfio available, do you want to try using it?"
14955         . ./myread
14956         case "$ans" in
14957         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14958                 useperlio="$define"
14959                 val="$define"
14960                 ;;
14961         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14962                 val="$undef"
14963                 ;;
14964         esac
14965         ;;
14966 *)      case "$usesfio" in
14967         true|$define|[yY]*)
14968                 echo "Sorry, cannot find sfio on this machine." >&4
14969                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14970                 val="$undef"
14971                 ;;
14972         esac
14973         ;;
14974 esac
14975 set d_sfio
14976 eval $setvar
14977 case "$d_sfio" in
14978 $define) usesfio='true';;
14979 *) usesfio='false';;
14980 esac
14981 case "$d_sfio" in
14982 $define) ;;
14983 *)      : Remove sfio from list of libraries to use
14984         case "$libs" in
14985         *-lsfio*)
14986                 echo "Removing unneeded -lsfio from library list" >&4
14987                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14988                 shift
14989                 libs="$*"
14990                 echo "libs = $libs" >&4
14991                 ;;
14992         esac
14993 ;;
14994 esac
14995
14996
14997 : see if shmctl exists
14998 set shmctl d_shmctl
14999 eval $inlibc
15000
15001 : see if shmget exists
15002 set shmget d_shmget
15003 eval $inlibc
15004
15005 : see if shmat exists
15006 set shmat d_shmat
15007 eval $inlibc
15008 : see what shmat returns
15009 case "$d_shmat" in
15010 "$define")
15011         $cat >shmat.c <<'END'
15012 #include <sys/shm.h>
15013 void *shmat();
15014 END
15015         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15016                 shmattype='void *'
15017         else
15018                 shmattype='char *'
15019         fi
15020         echo "and it returns ($shmattype)." >&4
15021         : see if a prototype for shmat is available
15022         xxx=`./findhdr sys/shm.h`
15023         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15024         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15025                 val="$define"
15026         else
15027                 val="$undef"
15028         fi
15029         $rm -f shmat.[co]
15030         ;;
15031 *)
15032         val="$undef"
15033         ;;
15034 esac
15035 set d_shmatprototype
15036 eval $setvar
15037
15038 : see if shmdt exists
15039 set shmdt d_shmdt
15040 eval $inlibc
15041
15042 : see how much of the 'shm*(2)' library is present.
15043 h_shm=true
15044 echo " "
15045 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15046 *"$undef"*) h_shm=false;;
15047 esac
15048 case "$osname" in
15049 freebsd)
15050     case "`ipcs 2>&1`" in
15051     "SVID shared memory"*"not configured"*)
15052         echo "Your $osname does not have the shm*(2) configured." >&4
15053         h_shm=false
15054         val="$undef"
15055         set shmctl d_shmctl
15056         evat $setvar
15057         set shmget d_shmget
15058         evat $setvar
15059         set shmat d_shmat
15060         evat $setvar
15061         set shmdt d_shmdt
15062         evat $setvar
15063         ;;
15064     esac
15065     ;;
15066 esac
15067 : we could also check for sys/ipc.h ...
15068 if $h_shm && $test `./findhdr sys/shm.h`; then
15069         echo "You have the full shm*(2) library." >&4
15070         val="$define"
15071 else
15072         echo "You don't have the full shm*(2) library." >&4
15073         val="$undef"
15074 fi
15075 set d_shm
15076 eval $setvar
15077
15078 echo " "
15079 : see if we have sigaction
15080 if set sigaction val -f d_sigaction; eval $csym; $val; then
15081         echo 'sigaction() found.' >&4
15082         $cat > try.c <<'EOP'
15083 #include <stdio.h>
15084 #include <sys/types.h>
15085 #include <signal.h>
15086 int main()
15087 {
15088     struct sigaction act, oact;
15089     act.sa_flags = 0;
15090     oact.sa_handler = 0;
15091     /* so that act and oact are used */
15092     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15093 }
15094 EOP
15095         set try
15096         if eval $compile_ok; then
15097                 val="$define"
15098         else
15099                 echo "But you don't seem to have a useable struct sigaction." >&4
15100                 val="$undef"
15101         fi
15102 else
15103         echo 'sigaction NOT found.' >&4
15104         val="$undef"
15105 fi
15106 set d_sigaction; eval $setvar
15107 $rm -f try try$_o try.c
15108
15109 : see if sigprocmask exists
15110 set sigprocmask d_sigprocmask
15111 eval $inlibc
15112
15113 : see if sigsetjmp exists
15114 echo " "
15115 case "$d_sigsetjmp" in
15116 '')
15117         $cat >try.c <<'EOP'
15118 #include <setjmp.h>
15119 sigjmp_buf env;
15120 int set = 1;
15121 int main()
15122 {
15123         if (sigsetjmp(env,1))
15124                 exit(set);
15125         set = 0;
15126         siglongjmp(env, 1);
15127         exit(1);
15128 }
15129 EOP
15130         set try
15131         if eval $compile; then
15132                 if $run ./try >/dev/null 2>&1; then
15133                         echo "POSIX sigsetjmp found." >&4
15134                         val="$define"
15135                 else
15136                         $cat >&4 <<EOM
15137 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15138 I'll ignore them.
15139 EOM
15140                         val="$undef"
15141                 fi
15142         else
15143                 echo "sigsetjmp not found." >&4
15144                 val="$undef"
15145         fi
15146         ;;
15147 *) val="$d_sigsetjmp"
15148         case "$d_sigsetjmp" in
15149         $define) echo "POSIX sigsetjmp found." >&4;;
15150         $undef) echo "sigsetjmp not found." >&4;;
15151         esac
15152         ;;
15153 esac
15154 set d_sigsetjmp
15155 eval $setvar
15156 $rm -f try.c try
15157
15158 : see if sockatmark exists
15159 set sockatmark d_sockatmark
15160 eval $inlibc
15161
15162 : see if prototype for sockatmark is available
15163 echo " "
15164 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15165 eval $hasproto
15166
15167 : see if socks5_init exists
15168 set socks5_init d_socks5_init
15169 eval $inlibc
15170
15171 : see if srand48_r exists
15172 set srand48_r d_srand48_r
15173 eval $inlibc
15174 case "$d_srand48_r" in
15175 "$define")
15176         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15177         case "$d_srand48_r_proto:$usethreads" in
15178         ":define")      d_srand48_r_proto=define
15179                 set d_srand48_r_proto srand48_r $hdrs
15180                 eval $hasproto ;;
15181         *)      ;;
15182         esac
15183         case "$d_srand48_r_proto" in
15184         define)
15185         case "$srand48_r_proto" in
15186         ''|0) try='int srand48_r(long, struct drand48_data*);'
15187         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15188         esac
15189         case "$srand48_r_proto" in
15190         ''|0)   d_srand48_r=undef
15191                 srand48_r_proto=0
15192                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15193         * )     case "$srand48_r_proto" in
15194                 REENTRANT_PROTO*) ;;
15195                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15196                 esac
15197                 echo "Prototype: $try" ;;
15198         esac
15199         ;;
15200         *)      case "$usethreads" in
15201                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15202                 esac
15203                 d_srand48_r=undef
15204                 srand48_r_proto=0
15205                 ;;
15206         esac
15207         ;;
15208 *)      srand48_r_proto=0
15209         ;;
15210 esac
15211
15212 : see if srandom_r exists
15213 set srandom_r d_srandom_r
15214 eval $inlibc
15215 case "$d_srandom_r" in
15216 "$define")
15217         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15218         case "$d_srandom_r_proto:$usethreads" in
15219         ":define")      d_srandom_r_proto=define
15220                 set d_srandom_r_proto srandom_r $hdrs
15221                 eval $hasproto ;;
15222         *)      ;;
15223         esac
15224         case "$d_srandom_r_proto" in
15225         define)
15226         case "$srandom_r_proto" in
15227         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15228         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15229         esac
15230         case "$srandom_r_proto" in
15231         ''|0)   d_srandom_r=undef
15232                 srandom_r_proto=0
15233                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15234         * )     case "$srandom_r_proto" in
15235                 REENTRANT_PROTO*) ;;
15236                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15237                 esac
15238                 echo "Prototype: $try" ;;
15239         esac
15240         ;;
15241         *)      case "$usethreads" in
15242                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15243                 esac
15244                 d_srandom_r=undef
15245                 srandom_r_proto=0
15246                 ;;
15247         esac
15248         ;;
15249 *)      srandom_r_proto=0
15250         ;;
15251 esac
15252
15253 : see if prototype for setresgid is available
15254 echo " "
15255 set d_sresgproto setresgid $i_unistd unistd.h
15256 eval $hasproto
15257
15258 : see if prototype for setresuid is available
15259 echo " "
15260 set d_sresuproto setresuid $i_unistd unistd.h
15261 eval $hasproto
15262
15263 : see if sys/stat.h is available
15264 set sys/stat.h i_sysstat
15265 eval $inhdr
15266
15267
15268 : see if stat knows about block sizes
15269 echo " "
15270 echo "Checking to see if your struct stat has st_blocks field..." >&4
15271 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15272 eval $hasfield
15273
15274
15275 : see if this is a sys/vfs.h system
15276 set sys/vfs.h i_sysvfs
15277 eval $inhdr
15278
15279
15280 : see if this is a sys/statfs.h system
15281 set sys/statfs.h i_sysstatfs
15282 eval $inhdr
15283
15284
15285 echo " "
15286 echo "Checking to see if your system supports struct statfs..." >&4
15287 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
15288 eval $hasstruct
15289 case "$d_statfs_s" in
15290 "$define")      echo "Yes, it does."   ;;
15291 *)              echo "No, it doesn't." ;;
15292 esac
15293
15294
15295
15296 : see if struct statfs knows about f_flags
15297 case "$d_statfs_s" in
15298 define) 
15299         echo " "
15300         echo "Checking to see if your struct statfs has f_flags field..." >&4
15301         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
15302         eval $hasfield
15303         ;;
15304 *)      val="$undef"
15305         set d_statfs_f_flags
15306         eval $setvar
15307         ;;
15308 esac
15309 case "$d_statfs_f_flags" in
15310 "$define")      echo "Yes, it does."   ;;
15311 *)              echo "No, it doesn't." ;;
15312 esac
15313
15314 : see if _ptr and _cnt from stdio act std
15315 echo " "
15316
15317 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15318         echo "(Looks like you have stdio.h from BSD.)"
15319         case "$stdio_ptr" in
15320         '') stdio_ptr='((fp)->_p)'
15321                 ptr_lval=$define
15322                 ;;
15323         *)      ptr_lval=$d_stdio_ptr_lval;;
15324         esac
15325         case "$stdio_cnt" in
15326         '') stdio_cnt='((fp)->_r)'
15327                 cnt_lval=$define
15328                 ;;
15329         *)      cnt_lval=$d_stdio_cnt_lval;;
15330         esac
15331         case "$stdio_base" in
15332         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15333         esac
15334         case "$stdio_bufsiz" in
15335         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15336         esac
15337 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15338         echo "(Looks like you have stdio.h from Linux.)"
15339         case "$stdio_ptr" in
15340         '') stdio_ptr='((fp)->_IO_read_ptr)'
15341                 ptr_lval=$define
15342                 ;;
15343         *)      ptr_lval=$d_stdio_ptr_lval;;
15344         esac
15345         case "$stdio_cnt" in
15346         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15347                 cnt_lval=$undef
15348                 ;;
15349         *)      cnt_lval=$d_stdio_cnt_lval;;
15350         esac
15351         case "$stdio_base" in
15352         '') stdio_base='((fp)->_IO_read_base)';;
15353         esac
15354         case "$stdio_bufsiz" in
15355         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15356         esac
15357 else
15358         case "$stdio_ptr" in
15359         '') stdio_ptr='((fp)->_ptr)'
15360                 ptr_lval=$define
15361                 ;;
15362         *)      ptr_lval=$d_stdio_ptr_lval;;
15363         esac
15364         case "$stdio_cnt" in
15365         '') stdio_cnt='((fp)->_cnt)'
15366                 cnt_lval=$define
15367                 ;;
15368         *)      cnt_lval=$d_stdio_cnt_lval;;
15369         esac
15370         case "$stdio_base" in
15371         '') stdio_base='((fp)->_base)';;
15372         esac
15373         case "$stdio_bufsiz" in
15374         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15375         esac
15376 fi
15377
15378 : test whether _ptr and _cnt really work
15379 echo "Checking how std your stdio is..." >&4
15380 $cat >try.c <<EOP
15381 #include <stdio.h>
15382 #define FILE_ptr(fp)    $stdio_ptr
15383 #define FILE_cnt(fp)    $stdio_cnt
15384 int main() {
15385         FILE *fp = fopen("try.c", "r");
15386         char c = getc(fp);
15387         if (
15388                 18 <= FILE_cnt(fp) &&
15389                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15390         )
15391                 exit(0);
15392         exit(1);
15393 }
15394 EOP
15395 val="$undef"
15396 set try
15397 if eval $compile && $to try.c; then
15398         if $run ./try; then
15399                 echo "Your stdio acts pretty std."
15400                 val="$define"
15401         else
15402                 echo "Your stdio isn't very std."
15403         fi
15404 else
15405         echo "Your stdio doesn't appear very std."
15406 fi
15407 $rm -f try.c try
15408
15409 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15410 # direct buffer manipulation no longer works.  The Configure tests
15411 # should be changed to correctly detect this, but until then,
15412 # the following check should at least let perl compile and run.
15413 # (This quick fix should be updated before 5.8.1.)
15414 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15415 # A. Dougherty, June 3, 2002.
15416 case "$d_gnulibc" in
15417 $define)
15418         case "$gnulibc_version" in
15419         2.[01]*)  ;;
15420         2.2) ;;
15421         2.2.[0-9]) ;;
15422         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15423                 val="$undef"
15424                 ;;
15425         esac
15426         ;;
15427 esac
15428 set d_stdstdio
15429 eval $setvar
15430
15431 : Can _ptr be used as an lvalue?
15432 case "$d_stdstdio$ptr_lval" in
15433 $define$define) val=$define ;;
15434 *) val=$undef ;;
15435 esac
15436 set d_stdio_ptr_lval
15437 eval $setvar
15438
15439 : Can _cnt be used as an lvalue?
15440 case "$d_stdstdio$cnt_lval" in
15441 $define$define) val=$define ;;
15442 *) val=$undef ;;
15443 esac
15444 set d_stdio_cnt_lval
15445 eval $setvar
15446
15447
15448 : test whether setting _ptr sets _cnt as a side effect
15449 d_stdio_ptr_lval_sets_cnt="$undef"
15450 d_stdio_ptr_lval_nochange_cnt="$undef"
15451 case "$d_stdio_ptr_lval$d_stdstdio" in
15452 $define$define)
15453         echo "Checking to see what happens if we set the stdio ptr..." >&4
15454 $cat >try.c <<EOP
15455 #include <stdio.h>
15456 /* Can we scream? */
15457 /* Eat dust sed :-) */
15458 /* In the buffer space, no one can hear you scream. */
15459 #define FILE_ptr(fp)    $stdio_ptr
15460 #define FILE_cnt(fp)    $stdio_cnt
15461 #include <sys/types.h>
15462 int main() {
15463         FILE *fp = fopen("try.c", "r");
15464         int c;
15465         char *ptr;
15466         size_t cnt;
15467         if (!fp) {
15468             puts("Fail even to read");
15469             exit(1);
15470         }
15471         c = getc(fp); /* Read away the first # */
15472         if (c == EOF) {
15473             puts("Fail even to read");
15474             exit(1);
15475         }
15476         if (!(
15477                 18 <= FILE_cnt(fp) &&
15478                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15479         )) {
15480                 puts("Fail even to read");
15481                 exit (1);
15482         }
15483         ptr = (char*) FILE_ptr(fp);
15484         cnt = (size_t)FILE_cnt(fp);
15485
15486         FILE_ptr(fp) += 42;
15487
15488         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15489                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15490                 exit (1);
15491         }
15492         if (FILE_cnt(fp) <= 20) {
15493                 printf ("Fail (<20 chars to test)");
15494                 exit (1);
15495         }
15496         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15497                 puts("Fail compare");
15498                 exit (1);
15499         }
15500         if (cnt == FILE_cnt(fp)) {
15501                 puts("Pass_unchanged");
15502                 exit (0);
15503         }       
15504         if (FILE_cnt(fp) == (cnt - 42)) {
15505                 puts("Pass_changed");
15506                 exit (0);
15507         }
15508         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15509         return 1;
15510
15511 }
15512 EOP
15513         set try
15514         if eval $compile && $to try.c; then
15515                 case `$run ./try` in
15516                 Pass_changed)
15517                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15518                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15519                 Pass_unchanged)
15520                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15521                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15522                 Fail*)
15523                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15524                 *)
15525                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15526         esac
15527         else
15528                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15529         fi
15530         $rm -f try.c try
15531         ;;
15532 esac
15533
15534 : see if _base is also standard
15535 val="$undef"
15536 case "$d_stdstdio" in
15537 $define)
15538         $cat >try.c <<EOP
15539 #include <stdio.h>
15540 #define FILE_base(fp)   $stdio_base
15541 #define FILE_bufsiz(fp) $stdio_bufsiz
15542 int main() {
15543         FILE *fp = fopen("try.c", "r");
15544         char c = getc(fp);
15545         if (
15546                 19 <= FILE_bufsiz(fp) &&
15547                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15548         )
15549                 exit(0);
15550         exit(1);
15551 }
15552 EOP
15553         set try
15554         if eval $compile && $to try.c; then
15555                 if $run ./try; then
15556                         echo "And its _base field acts std."
15557                         val="$define"
15558                 else
15559                         echo "But its _base field isn't std."
15560                 fi
15561         else
15562                 echo "However, it seems to be lacking the _base field."
15563         fi
15564         $rm -f try.c try
15565         ;;
15566 esac
15567 set d_stdiobase
15568 eval $setvar
15569
15570 $cat >&4 <<EOM
15571 Checking how to access stdio streams by file descriptor number...
15572 EOM
15573 case "$stdio_stream_array" in
15574 '')     $cat >try.c <<EOCP
15575 #include <stdio.h>
15576 int main() {
15577   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15578     printf("yes\n");
15579 }
15580 EOCP
15581         for s in _iob __iob __sF
15582         do
15583                 set try -DSTDIO_STREAM_ARRAY=$s
15584                 if eval $compile; then
15585                         case "`$run ./try`" in
15586                         yes)    stdio_stream_array=$s; break ;;
15587                         esac
15588                 fi
15589         done
15590         $rm -f try.* try$exe_ext
15591 esac
15592 case "$stdio_stream_array" in
15593 '')     $cat >&4 <<EOM
15594 I can't figure out how to access stdio streams by file descriptor number.
15595 EOM
15596         d_stdio_stream_array="$undef"
15597         ;;
15598 *)      $cat >&4 <<EOM
15599 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15600 EOM
15601         d_stdio_stream_array="$define"
15602         ;;
15603 esac
15604
15605 : see if strcoll exists
15606 set strcoll d_strcoll
15607 eval $inlibc
15608
15609 : check for structure copying
15610 echo " "
15611 echo "Checking to see if your C compiler can copy structs..." >&4
15612 $cat >try.c <<'EOCP'
15613 main()
15614 {
15615         struct blurfl {
15616                 int dyick;
15617         } foo, bar;
15618
15619         foo = bar;
15620 }
15621 EOCP
15622 if $cc -c try.c >/dev/null 2>&1 ; then
15623         val="$define"
15624         echo "Yup, it can."
15625 else
15626         val="$undef"
15627         echo "Nope, it can't."
15628 fi
15629 set d_strctcpy
15630 eval $setvar
15631 $rm -f try.*
15632
15633 : see if strerror and/or sys_errlist[] exist
15634 echo " "
15635 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15636     if set strerror val -f d_strerror; eval $csym; $val; then
15637                 echo 'strerror() found.' >&4
15638                 d_strerror="$define"
15639                 d_strerrm='strerror(e)'
15640                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15641                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15642                         d_syserrlst="$define"
15643                 else
15644                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15645                         d_syserrlst="$undef"
15646                 fi
15647     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15648                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15649                 echo 'strerror() found in string header.' >&4
15650                 d_strerror="$define"
15651                 d_strerrm='strerror(e)'
15652                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15653                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15654                                 d_syserrlst="$define"
15655                 else
15656                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15657                         d_syserrlst="$undef"
15658                 fi
15659     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15660                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15661                 d_strerror="$undef"
15662                 d_syserrlst="$define"
15663                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15664     else
15665                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15666                 d_strerror="$undef"
15667                 d_syserrlst="$undef"
15668                 d_strerrm='"unknown"'
15669     fi
15670 fi
15671
15672 : see if strerror_r exists
15673 set strerror_r d_strerror_r
15674 eval $inlibc
15675 case "$d_strerror_r" in
15676 "$define")
15677         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15678         case "$d_strerror_r_proto:$usethreads" in
15679         ":define")      d_strerror_r_proto=define
15680                 set d_strerror_r_proto strerror_r $hdrs
15681                 eval $hasproto ;;
15682         *)      ;;
15683         esac
15684         case "$d_strerror_r_proto" in
15685         define)
15686         case "$strerror_r_proto" in
15687         ''|0) try='int strerror_r(int, char*, size_t);'
15688         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15689         esac
15690         case "$strerror_r_proto" in
15691         ''|0) try='int strerror_r(int, char*, int);'
15692         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15693         esac
15694         case "$strerror_r_proto" in
15695         ''|0) try='char* strerror_r(int, char*, size_t);'
15696         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15697         esac
15698         case "$strerror_r_proto" in
15699         ''|0)   d_strerror_r=undef
15700                 strerror_r_proto=0
15701                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15702         * )     case "$strerror_r_proto" in
15703                 REENTRANT_PROTO*) ;;
15704                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15705                 esac
15706                 echo "Prototype: $try" ;;
15707         esac
15708         ;;
15709         *)      case "$usethreads" in
15710                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15711                 esac
15712                 d_strerror_r=undef
15713                 strerror_r_proto=0
15714                 ;;
15715         esac
15716         ;;
15717 *)      strerror_r_proto=0
15718         ;;
15719 esac
15720
15721 : see if strftime exists
15722 set strftime d_strftime
15723 eval $inlibc
15724
15725 : see if strtod exists
15726 set strtod d_strtod
15727 eval $inlibc
15728
15729 : see if strtol exists
15730 set strtol d_strtol
15731 eval $inlibc
15732
15733 : see if strtold exists
15734 set strtold d_strtold
15735 eval $inlibc
15736
15737 : see if strtoll exists
15738 set strtoll d_strtoll
15739 eval $inlibc
15740
15741 case "$d_longlong-$d_strtoll" in
15742 "$define-$define")
15743         $cat <<EOM
15744 Checking whether your strtoll() works okay...
15745 EOM
15746         $cat >try.c <<'EOCP'
15747 #include <errno.h>
15748 #ifdef __hpux
15749 #define strtoll __strtoll
15750 #endif
15751 #ifdef __EMX__
15752 #define strtoll _strtoll
15753 #endif
15754 #include <stdio.h>
15755 extern long long int strtoll(char *s, char **, int); 
15756 static int bad = 0;
15757 int check(char *s, long long ell, int een) {
15758         long long gll;
15759         errno = 0;
15760         gll = strtoll(s, 0, 10);
15761         if (!((gll == ell) && (errno == een)))
15762                 bad++;
15763 }
15764 int main() {
15765         check(" 1",                                      1LL, 0);
15766         check(" 0",                                      0LL, 0);
15767         check("-1",                                     -1LL, 0);
15768         check("-9223372036854775808", -9223372036854775808LL, 0);
15769         check("-9223372036854775808", -9223372036854775808LL, 0);
15770         check(" 9223372036854775807",  9223372036854775807LL, 0);
15771         check("-9223372036854775808", -9223372036854775808LL, 0);
15772         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15773         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15774         if (!bad)
15775                 printf("ok\n");
15776 }
15777 EOCP
15778         set try
15779         if eval $compile; then
15780                 yyy=`$run ./try`
15781                 case "$yyy" in
15782                 ok) echo "Your strtoll() seems to be working okay." ;;
15783                 *) cat <<EOM >&4
15784 Your strtoll() doesn't seem to be working okay.
15785 EOM
15786                    d_strtoll="$undef"
15787                    ;;
15788                 esac
15789         else
15790                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15791                 d_strtoll="$undef"
15792         fi
15793         ;;
15794 esac
15795
15796 : see if strtoq exists
15797 set strtoq d_strtoq
15798 eval $inlibc
15799
15800 : see if strtoul exists
15801 set strtoul d_strtoul
15802 eval $inlibc
15803
15804 case "$d_strtoul" in
15805 "$define")
15806         $cat <<EOM
15807 Checking whether your strtoul() works okay...
15808 EOM
15809         $cat >try.c <<'EOCP'
15810 #include <errno.h>
15811 #include <stdio.h>
15812 extern unsigned long int strtoul(char *s, char **, int); 
15813 static int bad = 0;
15814 void check(char *s, unsigned long eul, int een) {
15815         unsigned long gul;
15816         errno = 0;
15817         gul = strtoul(s, 0, 10);
15818         if (!((gul == eul) && (errno == een)))
15819                 bad++;
15820 }
15821 int main() {
15822         check(" 1", 1L, 0);
15823         check(" 0", 0L, 0);
15824 EOCP
15825         case "$longsize" in
15826         8)
15827             $cat >>try.c <<'EOCP'
15828         check("18446744073709551615", 18446744073709551615UL, 0);
15829         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15830 #if 0 /* strtoul() for /^-/ strings is undefined. */
15831         check("-1", 18446744073709551615UL, 0);
15832         check("-18446744073709551614", 2, 0);
15833         check("-18446744073709551615", 1, 0);
15834         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15835         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15836 #endif
15837 EOCP
15838                 ;;
15839         4)
15840                     $cat >>try.c <<'EOCP'
15841         check("4294967295", 4294967295UL, 0);
15842         check("4294967296", 4294967295UL, ERANGE);
15843 #if 0 /* strtoul() for /^-/ strings is undefined. */
15844         check("-1", 4294967295UL, 0);
15845         check("-4294967294", 2, 0);
15846         check("-4294967295", 1, 0);
15847         check("-4294967296", 4294967295UL, ERANGE);
15848         check("-4294967297", 4294967295UL, ERANGE);
15849 #endif
15850 EOCP
15851                 ;;
15852         *)
15853 : Should we write these tests to be more portable by sprintf-ing
15854 : ~0 and then manipulating that char string as input for strtol?
15855                 ;;
15856         esac
15857         $cat >>try.c <<'EOCP'
15858         if (!bad)
15859                 printf("ok\n");
15860         return 0;
15861 }
15862 EOCP
15863         set try
15864         if eval $compile; then
15865                 case "`$run ./try`" in
15866                 ok) echo "Your strtoul() seems to be working okay." ;;
15867                 *) cat <<EOM >&4
15868 Your strtoul() doesn't seem to be working okay.
15869 EOM
15870                    d_strtoul="$undef"
15871                    ;;
15872                 esac
15873         fi
15874         ;;
15875 esac
15876
15877 : see if strtoull exists
15878 set strtoull d_strtoull
15879 eval $inlibc
15880
15881 case "$d_longlong-$d_strtoull" in
15882 "$define-$define")
15883         $cat <<EOM
15884 Checking whether your strtoull() works okay...
15885 EOM
15886         $cat >try.c <<'EOCP'
15887 #include <errno.h>
15888 #ifdef __hpux
15889 #define strtoull __strtoull
15890 #endif
15891 #include <stdio.h>
15892 extern unsigned long long int strtoull(char *s, char **, int); 
15893 static int bad = 0;
15894 int check(char *s, long long eull, int een) {
15895         long long gull;
15896         errno = 0;
15897         gull = strtoull(s, 0, 10);
15898         if (!((gull == eull) && (errno == een)))
15899                 bad++;
15900 }
15901 int main() {
15902         check(" 1",                                        1LL, 0);
15903         check(" 0",                                        0LL, 0);
15904         check("18446744073709551615",  18446744073709551615ULL, 0);
15905         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15906 #if 0 /* strtoull() for /^-/ strings is undefined. */
15907         check("-1",                    18446744073709551615ULL, 0);
15908         check("-18446744073709551614",                     2LL, 0);
15909         check("-18446744073709551615",                     1LL, 0);
15910         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15911         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15912 #endif
15913         if (!bad)
15914                 printf("ok\n");
15915 }
15916 EOCP
15917         set try
15918         if eval $compile; then
15919                 case "`$run ./try`" in
15920                 ok) echo "Your strtoull() seems to be working okay." ;;
15921                 *) cat <<EOM >&4
15922 Your strtoull() doesn't seem to be working okay.
15923 EOM
15924                    d_strtoull="$undef"
15925                    ;;
15926                 esac
15927         fi
15928         ;;
15929 esac
15930
15931 : see if strtouq exists
15932 set strtouq d_strtouq
15933 eval $inlibc
15934
15935 case "$d_strtouq" in
15936 "$define")
15937         $cat <<EOM
15938 Checking whether your strtouq() works okay...
15939 EOM
15940         $cat >try.c <<'EOCP'
15941 #include <errno.h>
15942 #include <stdio.h>
15943 extern unsigned long long int strtouq(char *s, char **, int); 
15944 static int bad = 0;
15945 void check(char *s, unsigned long long eull, int een) {
15946         unsigned long long gull;
15947         errno = 0;
15948         gull = strtouq(s, 0, 10);
15949         if (!((gull == eull) && (errno == een)))
15950                 bad++;
15951 }
15952 int main() {
15953         check(" 1",                                        1LL, 0);
15954         check(" 0",                                        0LL, 0);
15955         check("18446744073709551615",  18446744073709551615ULL, 0);
15956         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15957 #if 0 /* strtouq() for /^-/ strings is undefined. */
15958         check("-1",                    18446744073709551615ULL, 0);
15959         check("-18446744073709551614",                     2LL, 0);
15960         check("-18446744073709551615",                     1LL, 0);
15961         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15962         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15963 #endif
15964         if (!bad)
15965                 printf("ok\n");
15966         return 0;
15967 }
15968 EOCP
15969         set try
15970         if eval $compile; then
15971                 case "`$run ./try`" in
15972                 ok) echo "Your strtouq() seems to be working okay." ;;
15973                 *) cat <<EOM >&4
15974 Your strtouq() doesn't seem to be working okay.
15975 EOM
15976                    d_strtouq="$undef"
15977                    ;;
15978                 esac
15979         fi
15980         ;;
15981 esac
15982
15983 : see if strxfrm exists
15984 set strxfrm d_strxfrm
15985 eval $inlibc
15986
15987 : see if symlink exists
15988 set symlink d_symlink
15989 eval $inlibc
15990
15991 : see if syscall exists
15992 set syscall d_syscall
15993 eval $inlibc
15994
15995 : see if prototype for syscall is available
15996 echo " "
15997 set d_syscallproto syscall $i_unistd unistd.h
15998 eval $hasproto
15999
16000 : see if sysconf exists
16001 set sysconf d_sysconf
16002 eval $inlibc
16003
16004 : see if system exists
16005 set system d_system
16006 eval $inlibc
16007
16008 : see if tcgetpgrp exists
16009 set tcgetpgrp d_tcgetpgrp
16010 eval $inlibc
16011
16012 : see if tcsetpgrp exists
16013 set tcsetpgrp d_tcsetpgrp
16014 eval $inlibc
16015
16016 : see if prototype for telldir is available
16017 echo " "
16018 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16019 eval $hasproto
16020
16021 : see if time exists
16022 echo " "
16023 if test "X$d_time" = X -o X"$timetype" = X; then
16024     if set time val -f d_time; eval $csym; $val; then
16025                 echo 'time() found.' >&4
16026                 val="$define"
16027                 rp="What is the type returned by time() on this system?"
16028                 set time_t timetype long stdio.h sys/types.h
16029                 eval $typedef_ask
16030     else
16031                 echo 'time() not found, hope that will do.' >&4
16032                 val="$undef"
16033                 timetype='int';
16034     fi
16035     set d_time
16036     eval $setvar
16037 fi
16038
16039 : see if this is a sys/times.h system
16040 set sys/times.h i_systimes
16041 eval $inhdr
16042
16043 : see if times exists
16044 echo " "
16045 if set times val -f d_times; eval $csym; $val; then
16046         echo 'times() found.' >&4
16047         d_times="$define"
16048         inc=''
16049         case "$i_systimes" in
16050         "$define") inc='sys/times.h';;
16051         esac
16052         rp="What is the type returned by times() on this system?"
16053         set clock_t clocktype long stdio.h sys/types.h $inc
16054         eval $typedef_ask
16055 else
16056         echo 'times() NOT found, hope that will do.' >&4
16057         d_times="$undef"
16058         clocktype='int'
16059 fi
16060
16061 : see if tmpnam_r exists
16062 set tmpnam_r d_tmpnam_r
16063 eval $inlibc
16064 case "$d_tmpnam_r" in
16065 "$define")
16066         hdrs="$i_systypes sys/types.h define stdio.h "
16067         case "$d_tmpnam_r_proto:$usethreads" in
16068         ":define")      d_tmpnam_r_proto=define
16069                 set d_tmpnam_r_proto tmpnam_r $hdrs
16070                 eval $hasproto ;;
16071         *)      ;;
16072         esac
16073         case "$d_tmpnam_r_proto" in
16074         define)
16075         case "$tmpnam_r_proto" in
16076         ''|0) try='char* tmpnam_r(char*);'
16077         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16078         esac
16079         case "$tmpnam_r_proto" in
16080         ''|0)   d_tmpnam_r=undef
16081                 tmpnam_r_proto=0
16082                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16083         * )     case "$tmpnam_r_proto" in
16084                 REENTRANT_PROTO*) ;;
16085                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16086                 esac
16087                 echo "Prototype: $try" ;;
16088         esac
16089         ;;
16090         *)      case "$usethreads" in
16091                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16092                 esac
16093                 d_tmpnam_r=undef
16094                 tmpnam_r_proto=0
16095                 ;;
16096         esac
16097         ;;
16098 *)      tmpnam_r_proto=0
16099         ;;
16100 esac
16101
16102 : see if truncate exists
16103 set truncate d_truncate
16104 eval $inlibc
16105
16106 : see if ttyname_r exists
16107 set ttyname_r d_ttyname_r
16108 eval $inlibc
16109 case "$d_ttyname_r" in
16110 "$define")
16111         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16112         case "$d_ttyname_r_proto:$usethreads" in
16113         ":define")      d_ttyname_r_proto=define
16114                 set d_ttyname_r_proto ttyname_r $hdrs
16115                 eval $hasproto ;;
16116         *)      ;;
16117         esac
16118         case "$d_ttyname_r_proto" in
16119         define)
16120         case "$ttyname_r_proto" in
16121         ''|0) try='int ttyname_r(int, char*, size_t);'
16122         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16123         esac
16124         case "$ttyname_r_proto" in
16125         ''|0) try='int ttyname_r(int, char*, int);'
16126         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16127         esac
16128         case "$ttyname_r_proto" in
16129         ''|0) try='char* ttyname_r(int, char*, int);'
16130         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16131         esac
16132         case "$ttyname_r_proto" in
16133         ''|0)   d_ttyname_r=undef
16134                 ttyname_r_proto=0
16135                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16136         * )     case "$ttyname_r_proto" in
16137                 REENTRANT_PROTO*) ;;
16138                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16139                 esac
16140                 echo "Prototype: $try" ;;
16141         esac
16142         ;;
16143         *)      case "$usethreads" in
16144                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16145                 esac
16146                 d_ttyname_r=undef
16147                 ttyname_r_proto=0
16148                 ;;
16149         esac
16150         ;;
16151 *)      ttyname_r_proto=0
16152         ;;
16153 esac
16154
16155 : see if tzname[] exists
16156 echo " "
16157 if set tzname val -a d_tzname; eval $csym; $val; then
16158         val="$define"
16159         echo 'tzname[] found.' >&4
16160 else
16161         val="$undef"
16162         echo 'tzname[] NOT found.' >&4
16163 fi
16164 set d_tzname
16165 eval $setvar
16166
16167 case "$osname" in
16168 next|rhapsody|darwin) multiarch="$define" ;;
16169 esac
16170 case "$multiarch" in
16171 ''|[nN]*) multiarch="$undef" ;;
16172 esac
16173
16174 : check for ordering of bytes in a UV
16175 echo " "
16176 case "$usecrosscompile$multiarch" in
16177 *$define*)
16178         $cat <<EOM
16179 You seem to be either cross-compiling or doing a multiarchitecture build,
16180 skipping the byteorder check.
16181
16182 EOM
16183         byteorder='ffff'
16184         ;;
16185 *)
16186         case "$byteorder" in
16187         '')
16188                 $cat <<'EOM'
16189 In the following, larger digits indicate more significance.  A big-endian
16190 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16191 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16192 machines may have weird orders like 3412.  A Cray will report 87654321,
16193 an Alpha will report 12345678. If the test program works the default is
16194 probably right.
16195 I'm now running the test program...
16196 EOM
16197                 $cat >try.c <<EOCP
16198 #include <stdio.h>
16199 #include <sys/types.h>
16200 typedef $uvtype UV;
16201 int main()
16202 {
16203         int i;
16204         union {
16205                 UV l;
16206                 char c[$uvsize];
16207         } u;
16208
16209         if ($uvsize > 4)
16210                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16211         else
16212                 u.l = (UV)0x04030201;
16213         for (i = 0; i < $uvsize; i++)
16214                 printf("%c", u.c[i]+'0');
16215         printf("\n");
16216         exit(0);
16217 }
16218 EOCP
16219                 xxx_prompt=y
16220                 set try
16221                 if eval $compile && ./try > /dev/null; then
16222                         dflt=`$run ./try`
16223                         case "$dflt" in
16224                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16225                                 echo "(The test program ran ok.)"
16226                                 echo "byteorder=$dflt"
16227                                 xxx_prompt=n
16228                         ;;
16229                         ????|????????) echo "(The test program ran ok.)" ;;
16230                         *) echo "(The test program didn't run right for some reason.)" ;;
16231                         esac
16232                 else
16233                         dflt='4321'
16234                         cat <<'EOM'
16235 (I can't seem to compile the test program.  Guessing big-endian...)
16236 EOM
16237                 fi
16238                 case "$xxx_prompt" in
16239                 y)
16240                         rp="What is the order of bytes in $uvtype?"
16241                         . ./myread
16242                         byteorder="$ans"
16243                         ;;
16244                 *)      byteorder=$dflt
16245                         ;;
16246                 esac
16247                 ;;
16248         esac
16249         $rm -f try.c try
16250         ;;
16251 esac
16252
16253
16254 $cat <<EOM
16255
16256 Checking to see whether you can access character data unalignedly...
16257 EOM
16258 case "$d_u32align" in
16259 '')   $cat >try.c <<EOCP
16260 #include <stdio.h>
16261 #define U32 $u32type
16262 #define BYTEORDER 0x$byteorder
16263 #define U8 $u8type
16264 #include <signal.h>
16265 #ifdef SIGBUS
16266 $signal_t bletch(s) int s; { exit(4); }
16267 #endif
16268 int main() {
16269 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16270     U8 buf[8];
16271     U32 *up;
16272     int i;
16273
16274     if (sizeof(U32) != 4) {
16275         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16276         exit(1);
16277     }
16278
16279     fflush(stdout);
16280
16281 #ifdef SIGBUS
16282     signal(SIGBUS, bletch);
16283 #endif
16284
16285     buf[0] = 0;
16286     buf[1] = 0;
16287     buf[2] = 0;
16288     buf[3] = 1;
16289     buf[5] = 0;
16290     buf[6] = 0;
16291     buf[7] = 0;
16292     buf[8] = 1;
16293
16294     for (i = 0; i < 4; i++) {
16295         up = (U32*)(buf + i);
16296         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16297                (*up == 1 << (8*(3-i)))  /* little-endian */
16298               )
16299            )
16300         {
16301             printf("read failed (%x)\n", *up);
16302             exit(2);
16303         }
16304     }
16305
16306     /* write test */
16307     for (i = 0; i < 4; i++) {
16308         up = (U32*)(buf + i);
16309         *up = 0xBeef;
16310         if (*up != 0xBeef) {
16311             printf("write failed (%x)\n", *up);
16312             exit(3);
16313         }
16314     }
16315
16316     exit(0);
16317 #else
16318     printf("1\n");
16319     exit(1);
16320 #endif
16321     return 0;
16322 }
16323 EOCP
16324 set try
16325 if eval $compile_ok; then
16326         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16327         $run ./try 2>&1 >/dev/null
16328         case "$?" in
16329         0)      cat >&4 <<EOM
16330 You can access character data pretty unalignedly.
16331 EOM
16332                 d_u32align="$undef"
16333                 ;;
16334         *)      cat >&4 <<EOM
16335 It seems that you must access character data in an aligned manner.
16336 EOM
16337                 d_u32align="$define"
16338                 ;;
16339         esac
16340 else
16341         rp='Can you access character data at unaligned addresses?'
16342         dflt='n'
16343         . ./myread
16344         case "$ans" in
16345         [yY]*)  d_u32align="$undef"  ;;
16346         *)      d_u32align="$define" ;;
16347         esac
16348 fi
16349 $rm -f core core.try.* try.core
16350 ;;
16351 esac
16352
16353 : see if ualarm exists
16354 set ualarm d_ualarm
16355 eval $inlibc
16356
16357 : see if umask exists
16358 set umask d_umask
16359 eval $inlibc
16360
16361 : see if unordered exists
16362 set unordered d_unordered
16363 eval $inlibc
16364
16365 : see if usleep exists
16366 set usleep d_usleep
16367 eval $inlibc
16368
16369 : see if prototype for usleep is available
16370 echo " "
16371 set d_usleepproto usleep $i_unistd unistd.h
16372 eval $hasproto
16373
16374 : see if ustat exists
16375 set ustat d_ustat
16376 eval $inlibc
16377
16378 : backward compatibility for d_hvfork
16379 if test X$d_hvfork != X; then
16380         d_vfork="$d_hvfork"
16381         d_hvfork=''
16382 fi
16383 : see if there is a vfork
16384 val=''
16385 set vfork val
16386 eval $inlibc
16387
16388 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16389 : perl on Solaris 2.x, and probably elsewhere.
16390 case "$val" in
16391 $define)
16392         echo " "
16393         case "$usevfork" in
16394         false) dflt='n';;
16395         *) dflt='y';;
16396         esac
16397         cat <<'EOM'
16398  
16399 Perl can only use a vfork() that doesn't suffer from strict
16400 restrictions on calling functions or modifying global data in
16401 the child.  For example, glibc-2.1 contains such a vfork()
16402 that is unsuitable.  If your system provides a proper fork()
16403 call, chances are that you do NOT want perl to use vfork().
16404
16405 EOM
16406         rp="Do you still want to use vfork()?"
16407         . ./myread
16408         case "$ans" in
16409         y|Y) ;;
16410         *)
16411                 echo "Ok, we won't use vfork()."
16412                 val="$undef"
16413                 ;;
16414         esac
16415         ;;
16416 esac
16417 set d_vfork
16418 eval $setvar
16419 case "$d_vfork" in
16420 $define) usevfork='true';;
16421 *) usevfork='false';;
16422 esac
16423
16424 : see if closedir exists
16425 set closedir d_closedir
16426 eval $inlibc
16427
16428 case "$d_closedir" in
16429 "$define")
16430         echo " "
16431         echo "Checking whether closedir() returns a status..." >&4
16432         cat > try.c <<EOM
16433 #$i_dirent I_DIRENT             /**/
16434 #$i_sysdir I_SYS_DIR            /**/
16435 #$i_sysndir I_SYS_NDIR          /**/
16436 #$i_systypes I_SYS_TYPES        /**/
16437
16438 #if defined(I_SYS_TYPES)
16439 #include <sys/types.h>
16440 #endif
16441 #if defined(I_DIRENT)
16442 #include <dirent.h>
16443 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16444 #include <sys/dir.h>
16445 #endif
16446 #else
16447 #ifdef I_SYS_NDIR
16448 #include <sys/ndir.h>
16449 #else
16450 #ifdef I_SYS_DIR
16451 #ifdef hp9000s500
16452 #include <ndir.h>       /* may be wrong in the future */
16453 #else
16454 #include <sys/dir.h>
16455 #endif
16456 #endif
16457 #endif
16458 #endif 
16459 int main() { return closedir(opendir(".")); }
16460 EOM
16461         set try
16462         if eval $compile_ok; then
16463                 if $run ./try > /dev/null 2>&1 ; then
16464                         echo "Yes, it does."
16465                         val="$undef"
16466                 else
16467                         echo "No, it doesn't."
16468                         val="$define"
16469                 fi
16470         else
16471                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16472                 val="$define"
16473         fi
16474         ;;
16475 *)
16476         val="$undef";
16477         ;;
16478 esac
16479 set d_void_closedir
16480 eval $setvar
16481 $rm -f try try.*
16482 : see if there is a wait4
16483 set wait4 d_wait4
16484 eval $inlibc
16485
16486 : see if waitpid exists
16487 set waitpid d_waitpid
16488 eval $inlibc
16489
16490 : see if wcstombs exists
16491 set wcstombs d_wcstombs
16492 eval $inlibc
16493
16494 : see if wctomb exists
16495 set wctomb d_wctomb
16496 eval $inlibc
16497
16498 : see if writev exists
16499 set writev d_writev
16500 eval $inlibc
16501
16502 : preserve RCS keywords in files with variable substitution, grrr
16503 Date='$Date'
16504 Id='$Id'
16505 Log='$Log'
16506 RCSfile='$RCSfile'
16507 Revision='$Revision'
16508
16509 : check for alignment requirements
16510 echo " "
16511 case "$usecrosscompile$multiarch" in
16512 *$define*)
16513         $cat <<EOM
16514 You seem to be either cross-compiling or doing a multiarchitecture build,
16515 skipping the memory alignment check.
16516
16517 EOM
16518         case "$alignbytes" in
16519         '') alignbytes=8 ;;
16520         esac
16521         ;;
16522 *)
16523         case "$alignbytes" in
16524         '') echo "Checking alignment constraints..." >&4
16525                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16526                         $cat >try.c <<'EOCP'
16527 typedef long double NV;
16528 EOCP
16529                 else
16530                         $cat >try.c <<'EOCP'
16531 typedef double NV;
16532 EOCP
16533                 fi
16534                 $cat >>try.c <<'EOCP'
16535 #include <stdio.h>
16536 struct foobar {
16537         char foo;
16538         NV bar;
16539 } try_algn;
16540 int main()
16541 {
16542     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16543     return(0);
16544 }
16545 EOCP
16546                 set try
16547                 if eval $compile_ok; then
16548                         dflt=`$run ./try`
16549                 else
16550                         dflt='8'
16551                         echo "(I can't seem to compile the test program...)"
16552                 fi
16553                 ;;
16554         *) dflt="$alignbytes"
16555                 ;;
16556         esac
16557         rp="Doubles must be aligned on a how-many-byte boundary?"
16558         . ./myread
16559         alignbytes="$ans"
16560         $rm -f try.c try
16561         ;;
16562 esac
16563
16564
16565 : set the base revision
16566 baserev=5.0
16567
16568 : how do we catenate cpp tokens here?
16569 echo " "
16570 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16571 $cat >cpp_stuff.c <<'EOCP'
16572 #define RCAT(a,b)a/**/b
16573 #define ACAT(a,b)a ## b
16574 RCAT(Rei,ser)
16575 ACAT(Cir,cus)
16576 EOCP
16577 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16578 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16579         echo "Oh!  Smells like ANSI's been here." >&4
16580         echo "We can catify or stringify, separately or together!"
16581         cpp_stuff=42
16582 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16583         echo "Ah, yes!  The good old days!" >&4
16584         echo "However, in the good old days we don't know how to stringify and"
16585         echo "catify at the same time."
16586         cpp_stuff=1
16587 else
16588         $cat >&4 <<EOM
16589 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16590 to have to edit the values of CAT[2-5] in config.h...
16591 EOM
16592         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16593 fi
16594 $rm -f cpp_stuff.*
16595
16596 : see if this is a db.h system
16597 set db.h i_db
16598 eval $inhdr
16599
16600 case "$i_db" in
16601 $define)
16602         : Check db version.
16603         echo " "
16604         echo "Checking Berkeley DB version ..." >&4
16605         $cat >try.c <<EOCP
16606 #$d_const HASCONST
16607 #ifndef HASCONST
16608 #define const
16609 #endif
16610 #include <sys/types.h>
16611 #include <stdio.h>
16612 #include <db.h>
16613 int main(int argc, char *argv[])
16614 {
16615 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16616     int Major, Minor, Patch ;
16617     unsigned long Version ;
16618     (void)db_version(&Major, &Minor, &Patch) ;
16619     if (argc == 2) {
16620         printf("%d %d %d %d %d %d\n",
16621                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16622                Major, Minor, Patch);
16623         exit(0);
16624     }
16625     printf("You have Berkeley DB Version 2 or greater.\n");
16626
16627     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16628                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16629     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16630                 Major, Minor, Patch) ;
16631
16632     /* check that db.h & libdb are compatible */
16633     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16634         printf("db.h and libdb are incompatible.\n") ;
16635         exit(3);        
16636     }
16637
16638     printf("db.h and libdb are compatible.\n") ;
16639
16640     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16641                 + DB_VERSION_PATCH ;
16642
16643     /* needs to be >= 2.3.4 */
16644     if (Version < 2003004) {
16645     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16646         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16647         exit(2);        
16648     }
16649
16650     exit(0);
16651 #else
16652 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16653     if (argc == 2) {
16654         printf("1 0 0\n");
16655         exit(0);
16656     }
16657     printf("You have Berkeley DB Version 1.\n");
16658     exit(0);    /* DB version < 2: the coast is clear. */
16659 #else
16660     exit(1);    /* <db.h> not Berkeley DB? */
16661 #endif
16662 #endif
16663 }
16664 EOCP
16665         set try
16666         if eval $compile_ok && $run ./try; then
16667                 echo 'Looks OK.' >&4
16668                 set `$run ./try 1`
16669                 db_version_major=$1
16670                 db_version_minor=$2
16671                 db_version_patch=$3
16672         else
16673                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16674                 i_db=$undef
16675                 case " $libs " in
16676                 *"-ldb "*)
16677                         : Remove db from list of libraries to use
16678                         echo "Removing unusable -ldb from library list" >&4
16679                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16680                         shift
16681                         libs="$*"
16682                         echo "libs = $libs" >&4
16683                         ;;
16684                 esac
16685         fi
16686         $rm -f try.*
16687         ;;
16688 esac
16689
16690 case "$i_db" in
16691 define)
16692         : Check the return type needed for hash 
16693         echo " "
16694         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16695         $cat >try.c <<EOCP
16696 #$d_const HASCONST
16697 #ifndef HASCONST
16698 #define const
16699 #endif
16700 #include <sys/types.h>
16701 #include <db.h>
16702
16703 #ifndef DB_VERSION_MAJOR
16704 u_int32_t hash_cb (ptr, size)
16705 const void *ptr;
16706 size_t size;
16707 {
16708 }
16709 HASHINFO info;
16710 int main()
16711 {
16712         info.hash = hash_cb;
16713 }
16714 #endif
16715 EOCP
16716         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16717                 if $contains warning try.out >>/dev/null 2>&1 ; then
16718                         db_hashtype='int'
16719                 else
16720                         db_hashtype='u_int32_t'
16721                 fi
16722         else
16723                 : XXX Maybe we should just give up here.
16724                 db_hashtype=u_int32_t
16725                 $cat try.out >&4
16726                 echo "Help:  I can't seem to compile the db test program." >&4
16727                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16728         fi
16729         $rm -f try.*
16730         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16731         ;;
16732 *)      db_hashtype=u_int32_t
16733         ;;
16734 esac
16735 case "$i_db" in
16736 define)
16737         : Check the return type needed for prefix 
16738         echo " "
16739         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16740         cat >try.c <<EOCP
16741 #$d_const HASCONST
16742 #ifndef HASCONST
16743 #define const
16744 #endif
16745 #include <sys/types.h>
16746 #include <db.h>
16747
16748 #ifndef DB_VERSION_MAJOR
16749 size_t prefix_cb (key1, key2)
16750 const DBT *key1;
16751 const DBT *key2;
16752 {
16753 }
16754 BTREEINFO info;
16755 int main()
16756 {
16757         info.prefix = prefix_cb;
16758 }
16759 #endif
16760 EOCP
16761         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16762                 if $contains warning try.out >>/dev/null 2>&1 ; then
16763                         db_prefixtype='int'
16764                 else
16765                         db_prefixtype='size_t'
16766                 fi
16767         else
16768                 db_prefixtype='size_t'
16769                 : XXX Maybe we should just give up here.
16770                 $cat try.out >&4
16771                 echo "Help:  I can't seem to compile the db test program." >&4
16772                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16773         fi
16774         $rm -f try.*
16775         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16776         ;;
16777 *)      db_prefixtype='size_t'
16778         ;;
16779 esac
16780
16781
16782 : How can we generate normalized random numbers ?
16783 echo " "
16784 echo "Looking for a random number function..." >&4
16785 case "$randfunc" in
16786 '')
16787         if set drand48 val -f; eval $csym; $val; then
16788                 dflt="drand48"
16789                 echo "Good, found drand48()." >&4
16790         elif set random val -f; eval $csym; $val; then
16791                 dflt="random"
16792                 echo "OK, found random()." >&4
16793         else
16794                 dflt="rand"
16795                 echo "Yick, looks like I have to use rand()." >&4
16796         fi
16797         echo " "
16798         ;;
16799 *)
16800         dflt="$randfunc"
16801         ;;
16802 esac
16803 cont=true
16804
16805 case "$ccflags" in
16806 *-Dmy_rand=*|*-Dmy_srand=*)
16807         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16808         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16809         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16810         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16811         ;;
16812 esac
16813
16814 while $test "$cont"; do
16815         rp="Use which function to generate random numbers?"
16816         . ./myread
16817         if $test "$ans" = "$dflt"; then
16818                 : null
16819         else
16820                 randbits=''
16821         fi
16822         randfunc="$ans"
16823         if set $ans val -f; eval $csym; $val; then
16824                 cont=''
16825         else
16826                 dflt=y
16827                 rp="I cannot find function $ans. Use that name anyway?"
16828                 . ./myread
16829                 dflt=rand
16830                 case "$ans" in
16831                         [yY]*) cont='';;
16832                 esac
16833         fi
16834         case "$cont" in
16835         '')
16836                 case "$randfunc" in
16837                 drand48)
16838                         drand01="drand48()"
16839                         seedfunc="srand48"
16840                         randbits=48
16841                         randseedtype=long
16842                         ;;
16843                 rand|random)
16844                         case "$randbits" in
16845                         '')
16846 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16847                                 $cat >try.c <<EOCP
16848 #$i_unistd I_UNISTD
16849 #$i_stdlib I_STDLIB
16850 #include <stdio.h>
16851 #ifdef I_UNISTD
16852 #  include <unistd.h>
16853 #endif
16854 #ifdef I_STDLIB
16855 #  include <stdlib.h>
16856 #endif
16857 int main()
16858 {
16859         register int i;
16860         register unsigned long tmp;
16861         register unsigned long max = 0L;
16862
16863         for (i = 1000; i; i--) {
16864                 tmp = (unsigned long) $randfunc();
16865                 if (tmp > max) max = tmp;
16866         }
16867         for (i = 0; max; i++)
16868                 max /= 2;
16869         printf("%d\n",i);
16870 }
16871 EOCP
16872                                 set try
16873                                 if eval $compile_ok; then
16874                                         dflt=`try`
16875                                 else
16876                                         dflt='?'
16877                                         echo "(I can't seem to compile the test program...)"
16878                                 fi
16879                                 ;;
16880                         *)
16881                                 dflt="$randbits"
16882                                 ;;
16883                         esac
16884                         rp="How many bits does your $randfunc() function produce?"
16885                         . ./myread
16886                         randbits="$ans"
16887                         $rm -f try.c try
16888                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16889                         seedfunc="s$randfunc"
16890                         randseedtype=unsigned
16891                         ;;
16892                 *)
16893                         dflt="31"
16894                         rp="How many bits does your $randfunc() function produce?"
16895                         . ./myread
16896                         randbits="$ans"
16897                         seedfunc="s$randfunc"
16898                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16899                         if set $seedfunc val -f; eval $csym; $val; then
16900                                 echo "(Using $seedfunc() to seed random generator)"
16901                         else
16902                                 echo "(Warning: no $seedfunc() to seed random generator)"
16903                                 seedfunc=rand
16904                         fi
16905                         randseedtype=unsigned
16906                         ;;
16907                 esac
16908                 ;;
16909         esac
16910 done
16911
16912 echo " "
16913 echo "Determining whether or not we are on an EBCDIC system..." >&4
16914 $cat >try.c <<'EOM'
16915 int main()
16916 {
16917   if ('M'==0xd4) return 0;
16918   return 1;
16919 }
16920 EOM
16921
16922 val=$undef
16923 set try
16924 if eval $compile_ok; then
16925         if $run ./try; then
16926                 echo "You seem to speak EBCDIC." >&4
16927                 val="$define"
16928         else
16929                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16930         fi
16931 else
16932         echo "I'm unable to compile the test program." >&4
16933         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16934 fi
16935 $rm -f try try.*
16936 set ebcdic
16937 eval $setvar
16938
16939 echo " "
16940 $cat >&4 <<EOM
16941 Checking how to flush all pending stdio output...
16942 EOM
16943 # I only know how to find the first 32 possibly open files on SunOS.
16944 # See also hints/sunos_4_1.sh and util.c  --AD
16945 case "$osname" in
16946 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16947 esac
16948 $cat >>try.c <<EOCP
16949 #include <stdio.h>
16950 #$i_unistd I_UNISTD
16951 #ifdef I_UNISTD
16952 # include <unistd.h>
16953 #endif
16954 #$d_sysconf HAS_SYSCONF
16955 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16956 #ifdef HAS_STDIO_STREAM_ARRAY
16957 # define STDIO_STREAM_ARRAY $stdio_stream_array
16958 #endif
16959 int main() {
16960   FILE* p;
16961   unlink("try.out");
16962   p = fopen("try.out", "w");
16963 #ifdef TRY_FPUTC
16964   fputc('x', p);
16965 #else
16966 # ifdef TRY_FPRINTF
16967   fprintf(p, "x");
16968 # endif
16969 #endif
16970 #ifdef TRY_FFLUSH_NULL
16971   fflush(NULL);
16972 #endif
16973 #ifdef TRY_FFLUSH_ALL
16974   {
16975     long open_max = -1;
16976 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16977     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16978 # else
16979 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16980     open_max = sysconf(_SC_OPEN_MAX);
16981 #  else
16982 #   ifdef FOPEN_MAX
16983     open_max = FOPEN_MAX;
16984 #   else
16985 #    ifdef OPEN_MAX
16986     open_max = OPEN_MAX;
16987 #    else
16988 #     ifdef _NFILE
16989     open_max = _NFILE;
16990 #     endif
16991 #    endif
16992 #   endif
16993 #  endif
16994 # endif 
16995 # ifdef HAS_STDIO_STREAM_ARRAY
16996     if (open_max > 0) {
16997       long i;
16998       for (i = 0; i < open_max; i++)
16999             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17000                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17001                 STDIO_STREAM_ARRAY[i]._flag)
17002                 fflush(&STDIO_STREAM_ARRAY[i]);
17003     }   
17004   }
17005 # endif
17006 #endif
17007   _exit(42);
17008 }
17009 EOCP
17010 : first we have to find out how _not_ to flush
17011 $to try.c
17012 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17013     output=''
17014     set try -DTRY_FPUTC
17015     if eval $compile; then
17016             $run ./try 2>/dev/null
17017             code="$?"
17018             $from try.out
17019             if $test ! -s try.out -a "X$code" = X42; then
17020                 output=-DTRY_FPUTC
17021             fi
17022     fi
17023     case "$output" in
17024     '')
17025             set try -DTRY_FPRINTF
17026             if eval $compile; then
17027                     $run ./try 2>/dev/null
17028                     code="$?"
17029                     $from try.out
17030                     if $test ! -s try.out -a "X$code" = X42; then
17031                         output=-DTRY_FPRINTF
17032                     fi
17033             fi
17034         ;;
17035     esac
17036 fi
17037 : check for fflush NULL behaviour
17038 case "$fflushNULL" in
17039 '')     set try -DTRY_FFLUSH_NULL $output
17040         if eval $compile; then
17041                 $run ./try 2>/dev/null
17042                 code="$?"
17043                 $from try.out
17044                 if $test -s try.out -a "X$code" = X42; then
17045                         fflushNULL="`$cat try.out`"
17046                 else
17047                         if $test "X$code" != X42; then
17048                                 $cat >&4 <<EOM
17049 (If this test failed, don't worry, we'll try another method shortly.)
17050 EOM
17051                         fi
17052                 fi
17053         fi
17054         $rm -f core try.core core.try.*
17055         case "$fflushNULL" in
17056         x)      $cat >&4 <<EOM
17057 Your fflush(NULL) works okay for output streams.
17058 Let's see if it clobbers input pipes...
17059 EOM
17060 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17061 # bug that improperly flushes the input end of pipes.  So we avoid the
17062 # autoflush on fork/system/exec support for now. :-(
17063 $cat >tryp.c <<EOCP
17064 #include <stdio.h>
17065 int
17066 main(int argc, char **argv)
17067 {
17068     char buf[1024];
17069     int i;
17070     char *bp = buf;
17071     while (1) {
17072         while ((i = getc(stdin)) != -1
17073                && (*bp++ = i) != '\n'
17074                && bp < &buf[1024])
17075         /* DO NOTHING */ ;
17076         *bp = '\0';
17077         fprintf(stdout, "%s", buf);
17078         fflush(NULL);
17079         if (i == -1)
17080             return 0;
17081         bp = buf;
17082     }
17083 }
17084 EOCP
17085                 fflushNULL="$define"
17086                 set tryp
17087                 if eval $compile; then
17088                     $rm -f tryp.out
17089                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17090                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17091                        $cat >&4 <<EOM
17092 fflush(NULL) seems to behave okay with input streams.
17093 EOM
17094                         fflushNULL="$define"
17095                     else
17096                         $cat >&4 <<EOM
17097 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17098 EOM
17099                         fflushNULL="$undef"
17100                     fi
17101                 fi
17102                 $rm -f core tryp.c tryp.core core.tryp.*
17103                 ;;
17104         '')     $cat >&4 <<EOM
17105 Your fflush(NULL) isn't working (contrary to ANSI C).
17106 EOM
17107                 fflushNULL="$undef"
17108                 ;;
17109         *)      $cat >&4 <<EOM
17110 Cannot figure out whether your fflush(NULL) works or not.
17111 I'm assuming it doesn't (contrary to ANSI C).
17112 EOM
17113                 fflushNULL="$undef"
17114                 ;;
17115         esac
17116         ;;
17117 $define|true|[yY]*)
17118         fflushNULL="$define"
17119         ;;
17120 *)
17121         fflushNULL="$undef"
17122         ;;
17123 esac
17124 : check explicit looping only if NULL did not work, and if the pipe
17125 : bug does not show up on an explicit flush too
17126 case "$fflushNULL" in
17127 "$undef")
17128         $cat >tryp.c <<EOCP
17129 #include <stdio.h>
17130 int
17131 main(int argc, char **argv)
17132 {
17133     char buf[1024];
17134     int i;
17135     char *bp = buf;
17136     while (1) {
17137         while ((i = getc(stdin)) != -1
17138                && (*bp++ = i) != '\n'
17139                && bp < &buf[1024])
17140         /* DO NOTHING */ ;
17141         *bp = '\0';
17142         fprintf(stdout, "%s", buf);
17143         fflush(stdin);
17144         if (i == -1)
17145             return 0;
17146         bp = buf;
17147     }
17148 }
17149 EOCP
17150         set tryp
17151         if eval $compile; then
17152             $rm -f tryp.out
17153             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17154             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17155                $cat >&4 <<EOM
17156 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17157 EOM
17158                 : now check for fflushall behaviour
17159                 case "$fflushall" in
17160                 '')     set try -DTRY_FFLUSH_ALL $output
17161                         if eval $compile; then
17162                                 $cat >&4 <<EOM
17163 (Now testing the other method--but note that this also may fail.)
17164 EOM
17165                                 $run ./try 2>/dev/null
17166                                 code=$?
17167                                 $from try.out
17168                                 if $test -s try.out -a "X$code" = X42; then
17169                                         fflushall="`$cat try.out`"
17170                                 fi
17171                         fi
17172                         $rm -f core try.core core.try.*
17173                         case "$fflushall" in
17174                         x)      $cat >&4 <<EOM
17175 Whew. Flushing explicitly all the stdio streams works.
17176 EOM
17177                                 fflushall="$define"
17178                                 ;;
17179                         '')     $cat >&4 <<EOM
17180 Sigh. Flushing explicitly all the stdio streams doesn't work.
17181 EOM
17182                                 fflushall="$undef"
17183                                 ;;
17184                         *)      $cat >&4 <<EOM
17185 Cannot figure out whether flushing stdio streams explicitly works or not.
17186 I'm assuming it doesn't.
17187 EOM
17188                                 fflushall="$undef"
17189                                 ;;
17190                         esac
17191                         ;;
17192                 "$define"|true|[yY]*)
17193                         fflushall="$define"
17194                         ;;
17195                 *)
17196                         fflushall="$undef"
17197                         ;;
17198                 esac
17199             else
17200                 $cat >&4 <<EOM
17201 All is futile.  Even fflush(stdin) clobbers input pipes!
17202 EOM
17203                 fflushall="$undef"
17204             fi
17205         else
17206             fflushall="$undef"
17207         fi
17208         $rm -f core tryp.c tryp.core core.tryp.*
17209         ;;
17210 *)      fflushall="$undef"
17211         ;;
17212 esac
17213
17214 case "$fflushNULL$fflushall" in
17215 undefundef)
17216         $cat <<EOM
17217 OK, I give up.  I cannot figure out how to flush pending stdio output.
17218 We won't be flushing handles at all before fork/exec/popen.
17219 EOM
17220         ;;
17221 esac
17222 $rm -f try.* try$exe_ext
17223
17224 : Store the full pathname to the ar program for use in the C program
17225 : Respect a hint or command line value for full_ar.
17226 case "$full_ar" in
17227 '') full_ar=$ar ;;
17228 esac
17229
17230 : Store the full pathname to the sed program for use in the C program
17231 full_sed=$sed
17232
17233 : see what type gids are declared as in the kernel
17234 echo " "
17235 echo "Looking for the type for group ids returned by getgid()."
17236 set gid_t gidtype xxx stdio.h sys/types.h
17237 eval $typedef
17238 case "$gidtype" in
17239 xxx)
17240         xxx=`./findhdr sys/user.h`
17241         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17242         case $1 in
17243         unsigned) dflt="$1 $2" ;;
17244         *) dflt="$1" ;;
17245         esac
17246         ;;
17247 *) dflt="$gidtype";;
17248 esac
17249 case "$gidtype" in
17250 gid_t) echo "gid_t found." ;;
17251 *)      rp="What is the type for group ids returned by getgid()?"
17252         . ./myread
17253         gidtype="$ans"
17254         ;;
17255 esac
17256
17257 echo " "
17258 case "$gidtype" in
17259 *_t) zzz="$gidtype"     ;;
17260 *)   zzz="gid"          ;;
17261 esac
17262 echo "Checking the size of $zzz..." >&4 
17263 cat > try.c <<EOCP
17264 #include <sys/types.h>
17265 #include <stdio.h>
17266 int main() {
17267     printf("%d\n", (int)sizeof($gidtype));
17268     exit(0);
17269 }
17270 EOCP
17271 set try
17272 if eval $compile_ok; then
17273         yyy=`$run ./try`
17274         case "$yyy" in
17275         '')     gidsize=4
17276                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17277                 ;;
17278         *)      gidsize=$yyy
17279                 echo "Your $zzz is $gidsize bytes long."
17280                 ;;
17281         esac
17282 else
17283         gidsize=4
17284         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17285 fi
17286
17287
17288 echo " "
17289 case "$gidtype" in
17290 *_t) zzz="$gidtype"     ;;
17291 *)   zzz="gid"          ;;
17292 esac
17293 echo "Checking the sign of $zzz..." >&4 
17294 cat > try.c <<EOCP
17295 #include <sys/types.h>
17296 #include <stdio.h>
17297 int main() {
17298         $gidtype foo = -1;
17299         if (foo < 0)
17300                 printf("-1\n");
17301         else
17302                 printf("1\n");
17303 }
17304 EOCP
17305 set try
17306 if eval $compile; then
17307         yyy=`$run ./try`
17308         case "$yyy" in
17309         '')     gidsign=1
17310                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17311                 ;;
17312         *)      gidsign=$yyy
17313                 case "$gidsign" in
17314                  1) echo "Your $zzz is unsigned." ;;
17315                 -1) echo "Your $zzz is signed."   ;;
17316                 esac
17317                 ;;
17318         esac
17319 else
17320         gidsign=1
17321         echo "(I can't compile the test program--guessing unsigned.)" >&4
17322 fi
17323
17324
17325 echo " "
17326
17327 if $test X"$quadtype" != X; then
17328
17329 echo "Checking how to print 64-bit integers..." >&4
17330
17331 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17332         $cat >try.c <<'EOCP'
17333 #include <sys/types.h>
17334 #include <stdio.h>
17335 int main() {
17336   int q = 12345678901;
17337   printf("%ld\n", q);
17338 }
17339 EOCP
17340         set try
17341         if eval $compile; then
17342                 yyy=`$run ./try`
17343                 case "$yyy" in
17344                 12345678901)
17345                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17346                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17347                         echo "We will use %d."
17348                         ;;
17349                 esac
17350         fi
17351 fi
17352
17353 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17354         $cat >try.c <<'EOCP'
17355 #include <sys/types.h>
17356 #include <stdio.h>
17357 int main() {
17358   long q = 12345678901;
17359   printf("%ld\n", q);
17360 }
17361 EOCP
17362         set try
17363         if eval $compile; then
17364                 yyy=`$run ./try`
17365                 case "$yyy" in
17366                 12345678901)
17367                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17368                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17369                         echo "We will use %ld."
17370                         ;;
17371                 esac
17372         fi
17373 fi
17374
17375 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17376         $cat >try.c <<'EOCP'
17377 #include <sys/types.h>
17378 #include <inttypes.h>
17379 #include <stdio.h>
17380 int main() {
17381   int64_t q = 12345678901;
17382   printf("%" PRId64 "\n", q);
17383 }
17384 EOCP
17385         set try
17386         if eval $compile; then
17387                 yyy=`$run ./try`
17388                 case "$yyy" in
17389                 12345678901)
17390                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17391                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17392                         echo "We will use the C9X style."
17393                         ;;
17394                 esac
17395         fi
17396 fi
17397
17398 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17399         $cat >try.c <<EOCP
17400 #include <sys/types.h>
17401 #include <stdio.h>
17402 int main() {
17403   $quadtype q = 12345678901;
17404   printf("%Ld\n", q);
17405 }
17406 EOCP
17407         set try
17408         if eval $compile; then
17409                 yyy=`$run ./try`
17410                 case "$yyy" in
17411                 12345678901)
17412                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17413                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17414                         echo "We will use %Ld."
17415                         ;;
17416                 esac
17417         fi
17418 fi
17419
17420 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17421         $cat >try.c <<'EOCP'
17422 #include <sys/types.h>
17423 #include <stdio.h>
17424 int main() {
17425   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17426   printf("%lld\n", q);
17427 }
17428 EOCP
17429         set try
17430         if eval $compile; then
17431                 yyy=`$run ./try`
17432                 case "$yyy" in
17433                 12345678901)
17434                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17435                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17436                         echo "We will use the %lld style."
17437                         ;;
17438                 esac
17439         fi
17440 fi
17441
17442 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17443         $cat >try.c <<EOCP
17444 #include <sys/types.h>
17445 #include <stdio.h>
17446 int main() {
17447   $quadtype q = 12345678901;
17448   printf("%qd\n", q);
17449 }
17450 EOCP
17451         set try
17452         if eval $compile; then
17453                 yyy=`$run ./try`
17454                 case "$yyy" in
17455                 12345678901)
17456                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17457                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17458                         echo "We will use %qd."
17459                         ;;
17460                 esac
17461         fi
17462 fi
17463
17464 if $test X"$sPRId64" = X; then
17465         echo "Cannot figure out how to print 64-bit integers." >&4
17466 fi
17467
17468 $rm -f try try.*
17469
17470 fi
17471
17472 case "$sPRId64" in
17473 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17474         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17475         ;;
17476 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17477         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17478         ;;
17479 esac
17480
17481
17482 echo " "
17483 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17484
17485 if $test X"$ivsize" = X8; then
17486         ivdformat="$sPRId64"
17487         uvuformat="$sPRIu64"
17488         uvoformat="$sPRIo64"
17489         uvxformat="$sPRIx64"
17490         uvXUformat="$sPRIXU64"
17491 else
17492         if $test X"$ivsize" = X"$longsize"; then
17493                 ivdformat='"ld"'
17494                 uvuformat='"lu"'
17495                 uvoformat='"lo"'
17496                 uvxformat='"lx"'
17497                 uvXUformat='"lX"'
17498         else
17499                 if $test X"$ivsize" = X"$intsize"; then
17500                         ivdformat='"d"'
17501                         uvuformat='"u"'
17502                         uvoformat='"o"'
17503                         uvxformat='"x"'
17504                         uvXUformat='"X"'
17505                 else
17506                         : far out
17507                         if $test X"$ivsize" = X"$shortsize"; then
17508                                 ivdformat='"hd"'
17509                                 uvuformat='"hu"'
17510                                 uvoformat='"ho"'
17511                                 uvxformat='"hx"'
17512                                 uvXUformat='"hX"'
17513                         fi
17514                 fi
17515         fi
17516 fi
17517
17518 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17519         nveformat="$sPRIeldbl"
17520         nvfformat="$sPRIfldbl"
17521         nvgformat="$sPRIgldbl"
17522         nvEUformat="$sPRIEUldbl"
17523         nvFUformat="$sPRIFUldbl"
17524         nvGUformat="$sPRIGUldbl"
17525 else
17526         nveformat='"e"'
17527         nvfformat='"f"'
17528         nvgformat='"g"'
17529         nvEUformat='"E"'
17530         nvFUformat='"F"'
17531         nvGUformat='"G"'
17532 fi
17533
17534 case "$ivdformat" in
17535 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17536     exit 1
17537     ;;
17538 esac
17539
17540
17541 echo " "
17542 $echo "Checking the format string to be used for gids..." >&4
17543
17544 case "$gidsign" in
17545 -1)     if $test X"$gidsize" = X"$ivsize"; then
17546                 gidformat="$ivdformat"
17547         else
17548                 if $test X"$gidsize" = X"$longsize"; then
17549                         gidformat='"ld"'
17550                 else
17551                         if $test X"$gidsize" = X"$intsize"; then
17552                                 gidformat='"d"'
17553                         else
17554                                 if $test X"$gidsize" = X"$shortsize"; then
17555                                         gidformat='"hd"'
17556                                 fi
17557                         fi
17558                 fi
17559         fi
17560         ;;
17561 *)      if $test X"$gidsize" = X"$uvsize"; then
17562                 gidformat="$uvuformat"
17563         else
17564                 if $test X"$gidsize" = X"$longsize"; then
17565                         gidformat='"lu"'
17566                 else
17567                         if $test X"$gidsize" = X"$intsize"; then
17568                                 gidformat='"u"'
17569                         else
17570                                 if $test X"$gidsize" = X"$shortsize"; then
17571                                         gidformat='"hu"'
17572                                 fi
17573                         fi
17574                 fi
17575         fi
17576         ;;
17577 esac
17578
17579 : see if getgroups exists
17580 set getgroups d_getgrps
17581 eval $inlibc
17582
17583 : see if setgroups exists
17584 set setgroups d_setgrps
17585 eval $inlibc
17586
17587
17588 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17589 echo " "
17590 case "$d_getgrps$d_setgrps" in
17591 *define*)
17592         case "$groupstype" in
17593         '') dflt="$gidtype" ;;
17594         *)  dflt="$groupstype" ;;
17595         esac
17596         $cat <<EOM
17597 What type of pointer is the second argument to getgroups() and setgroups()?
17598 Usually this is the same as group ids, $gidtype, but not always.
17599
17600 EOM
17601         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17602         . ./myread
17603         groupstype="$ans"
17604         ;;
17605 *)  groupstype="$gidtype";;
17606 esac
17607
17608 echo " "
17609 echo "Checking if your $make program sets \$(MAKE)..." >&4
17610 case "$make_set_make" in
17611 '')
17612         $sed 's/^X //' > testmake.mak << 'EOF'
17613 Xall:
17614 X       @echo 'maketemp="$(MAKE)"'
17615 EOF
17616         case "`$make -f testmake.mak 2>/dev/null`" in
17617         *maketemp=*) make_set_make='#' ;;
17618         *)      make_set_make="MAKE=$make" ;;
17619         esac
17620         $rm -f testmake.mak
17621         ;;
17622 esac
17623 case "$make_set_make" in
17624 '#') echo "Yup, it does.";;
17625 *) echo "Nope, it doesn't.";;
17626 esac
17627
17628 : see what type is used for mode_t
17629 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17630 set mode_t modetype int stdio.h sys/types.h
17631 eval $typedef_ask
17632
17633 : see if stdarg is available
17634 echo " "
17635 if $test `./findhdr stdarg.h`; then
17636         echo "<stdarg.h> found." >&4
17637         valstd="$define"
17638 else
17639         echo "<stdarg.h> NOT found." >&4
17640         valstd="$undef"
17641 fi
17642
17643 : see if varags is available
17644 echo " "
17645 if $test `./findhdr varargs.h`; then
17646         echo "<varargs.h> found." >&4
17647 else
17648         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17649 fi
17650
17651 : set up the varargs testing programs
17652 $cat > varargs.c <<EOP
17653 #ifdef I_STDARG
17654 #include <stdarg.h>
17655 #endif
17656 #ifdef I_VARARGS
17657 #include <varargs.h>
17658 #endif
17659
17660 #ifdef I_STDARG
17661 int f(char *p, ...)
17662 #else
17663 int f(va_alist)
17664 va_dcl
17665 #endif
17666 {
17667         va_list ap;
17668 #ifndef I_STDARG
17669         char *p;
17670 #endif
17671 #ifdef I_STDARG
17672         va_start(ap,p);
17673 #else
17674         va_start(ap);
17675         p = va_arg(ap, char *);
17676 #endif
17677         va_end(ap);
17678 }
17679 EOP
17680 $cat > varargs <<EOP
17681 $startsh
17682 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17683         echo "true"
17684 else
17685         echo "false"
17686 fi
17687 $rm -f varargs$_o
17688 EOP
17689 chmod +x varargs
17690
17691 : now check which varargs header should be included
17692 echo " "
17693 i_varhdr=''
17694 case "$valstd" in
17695 "$define")
17696         if `./varargs I_STDARG`; then
17697                 val='stdarg.h'
17698         elif `./varargs I_VARARGS`; then
17699                 val='varargs.h'
17700         fi
17701         ;;
17702 *)
17703         if `./varargs I_VARARGS`; then
17704                 val='varargs.h'
17705         fi
17706         ;;
17707 esac
17708 case "$val" in
17709 '')
17710 echo "I could not find the definition for va_dcl... You have problems..." >&4
17711         val="$undef"; set i_stdarg; eval $setvar
17712         val="$undef"; set i_varargs; eval $setvar
17713         ;;
17714 *) 
17715         set i_varhdr
17716         eval $setvar
17717         case "$i_varhdr" in
17718         stdarg.h)
17719                 val="$define"; set i_stdarg; eval $setvar
17720                 val="$undef"; set i_varargs; eval $setvar
17721                 ;;
17722         varargs.h)
17723                 val="$undef"; set i_stdarg; eval $setvar
17724                 val="$define"; set i_varargs; eval $setvar
17725                 ;;
17726         esac
17727         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17728 esac
17729 $rm -f varargs*
17730
17731 : see if we need va_copy
17732 echo " "
17733 case "$i_stdarg" in
17734 "$define")
17735         $cat >try.c <<EOCP
17736 #include <stdarg.h>
17737 #include <stdio.h>
17738 #$i_stdlib I_STDLIB
17739 #ifdef I_STDLIB
17740 #include <stdlib.h>
17741 #endif
17742 #include <signal.h>
17743
17744 int
17745 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17746 {
17747   return vfprintf(f, fmt, *valp);
17748 }
17749  
17750 int    
17751 myvfprintf(FILE *f, const  char *fmt, va_list val)
17752 {
17753   return ivfprintf(f, fmt, &val);
17754 }
17755       
17756 int
17757 myprintf(char *fmt, ...) 
17758 {
17759   va_list val;
17760   va_start(val, fmt);
17761   return myvfprintf(stdout, fmt, val); 
17762 }         
17763
17764 int
17765 main(int ac, char **av)
17766 {
17767   signal(SIGSEGV, exit);
17768
17769   myprintf("%s%cs all right, then\n", "that", '\'');                            
17770   exit(0);      
17771 }
17772 EOCP
17773         set try
17774         if eval $compile && $run ./try 2>&1 >/dev/null; then
17775                 case "`$run ./try`" in
17776                 "that's all right, then")
17777                         okay=yes
17778                         ;;
17779                 esac
17780         fi
17781         case "$okay" in
17782         yes)    echo "It seems that you don't need va_copy()." >&4
17783                 need_va_copy="$undef"
17784                 ;;
17785         *)      echo "It seems that va_copy() or similar will be needed." >&4
17786                 need_va_copy="$define"
17787                 ;;
17788         esac
17789         $rm -f try.* core core.* *.core *.core.*
17790         ;;
17791 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17792         ;;
17793 esac
17794
17795 : see what type is used for size_t
17796 rp="What is the type used for the length parameter for string functions?"
17797 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17798 eval $typedef_ask
17799
17800 : check for type of arguments to gethostbyaddr. 
17801 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17802         case "$d_gethbyaddr" in
17803         $define)
17804                 $cat <<EOM
17805
17806 Checking to see what type of arguments are accepted by gethostbyaddr().
17807 EOM
17808                 hdrs="$define sys/types.h
17809                         $d_socket sys/socket.h 
17810                         $i_niin netinet/in.h 
17811                         $i_netdb netdb.h
17812                         $i_unistd unistd.h"
17813                 : The first arg can 'char *' or 'void *'
17814                 : The second arg is some of integral type
17815                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17816                         for yyy in size_t long int; do
17817                                 case "$netdb_host_type" in
17818                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17819                                         if ./protochk "$try" $hdrs; then
17820                                                 echo "Your system accepts $xxx for the first arg."
17821                                                 echo "...and $yyy for the second arg."
17822                                                 netdb_host_type="$xxx"
17823                                                 netdb_hlen_type="$yyy"
17824                                         fi
17825                                         ;;
17826                                 esac
17827                         done
17828                 done
17829                 : In case none of those worked, prompt the user.
17830                 case "$netdb_host_type" in
17831                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17832                         dflt='char *'
17833                         . ./myread
17834                         netdb_host_type=$ans
17835                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17836                         dflt="$sizetype"
17837                         . ./myread
17838                         netdb_hlen_type=$ans
17839                         ;;
17840                 esac
17841                 ;;
17842         *)      : no gethostbyaddr, so pick harmless defaults
17843                 netdb_host_type='char *'
17844                 netdb_hlen_type="$sizetype"
17845                 ;;
17846         esac
17847         # Remove the "const" if needed. -- but then we'll have a 
17848         # prototype clash!
17849         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17850 fi
17851
17852 : check for type of argument to gethostbyname. 
17853 if test "X$netdb_name_type" = X ; then
17854         case "$d_gethbyname" in
17855         $define)
17856                 $cat <<EOM
17857
17858 Checking to see what type of argument is accepted by gethostbyname().
17859 EOM
17860                 hdrs="$define sys/types.h
17861                         $d_socket sys/socket.h 
17862                         $i_niin netinet/in.h 
17863                         $i_netdb netdb.h
17864                         $i_unistd unistd.h"
17865                 for xxx in "const char *" "char *"; do
17866                         case "$netdb_name_type" in
17867                         '')     try="extern struct hostent *gethostbyname($xxx);"
17868                                 if ./protochk "$try" $hdrs; then
17869                                         echo "Your system accepts $xxx."
17870                                         netdb_name_type="$xxx"
17871                                 fi
17872                                 ;;
17873                         esac
17874                 done
17875                 : In case none of those worked, prompt the user.
17876                 case "$netdb_name_type" in
17877                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17878                         dflt='char *'
17879                         . ./myread
17880                         netdb_name_type=$ans
17881                         ;;
17882                 esac
17883                 ;;
17884         *)      : no gethostbyname, so pick harmless default
17885                 netdb_name_type='char *'
17886                 ;;
17887         esac
17888 fi
17889
17890 : check for type of 1st argument to getnetbyaddr. 
17891 if test "X$netdb_net_type" = X ; then
17892         case "$d_getnbyaddr" in
17893         $define)
17894                 $cat <<EOM
17895
17896 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17897 EOM
17898                 hdrs="$define sys/types.h
17899                         $d_socket sys/socket.h 
17900                         $i_niin netinet/in.h 
17901                         $i_netdb netdb.h
17902                         $i_unistd unistd.h"
17903                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17904                         case "$netdb_net_type" in
17905                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17906                                 if ./protochk "$try" $hdrs; then
17907                                         echo "Your system accepts $xxx."
17908                                         netdb_net_type="$xxx"
17909                                 fi
17910                                 ;;
17911                         esac
17912                 done
17913                 : In case none of those worked, prompt the user.
17914                 case "$netdb_net_type" in
17915                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17916                         dflt='long'
17917                         . ./myread
17918                         netdb_net_type=$ans
17919                         ;;
17920                 esac
17921                 ;;
17922         *)      : no getnetbyaddr, so pick harmless default
17923                 netdb_net_type='long'
17924                 ;;
17925         esac
17926 fi
17927 : locate the preferred pager for this system
17928 fn=f/
17929 case "$pager" in
17930 '')
17931         dflt=''
17932         case "$pg" in
17933         /*) dflt=$pg;;
17934         [a-zA-Z]:/*) dflt=$pg;;
17935         esac
17936         case "$more" in
17937         /*) dflt=$more;;
17938         [a-zA-Z]:/*) dflt=$more;;
17939         esac
17940         case "$less" in
17941         /*) dflt=$less;;
17942         [a-zA-Z]:/*) dflt=$less;;
17943         esac
17944         case "$dflt" in
17945         '') dflt=/usr/ucb/more;;
17946         esac
17947         ;;
17948 *)      dflt="$pager"
17949         : Instruct ./getfile to trust the hinted or previous pager value,
17950         : even if it does not begin with a slash.  For example, on os2,
17951         : pager might be cmd /c more.  See comments in UU/getfile.
17952         fn="f/($pager)"
17953         ;;
17954 esac
17955 echo " "
17956 rp='What pager is used on your system?'
17957 . ./getfile
17958 pager="$ans"
17959
17960 : see what type pids are declared as in the kernel
17961 rp="What is the type of process ids on this system?"
17962 set pid_t pidtype int stdio.h sys/types.h
17963 eval $typedef_ask
17964
17965 : Find earliest binary compatible site_perl subdirectory perl can use.
17966 xs_apiversion=$version # The current site_perl version.
17967 : Find earliest pure perl site_perl subdirectory perl can use.
17968 : The versioned directories started at 5.005.
17969 pm_apiversion='5.005'
17970
17971 : see if ar generates random libraries by itself
17972 echo " "
17973 echo "Checking how to generate random libraries on your machine..." >&4
17974 echo 'int bar1() { return bar2(); }' > bar1.c
17975 echo 'int bar2() { return 2; }' > bar2.c
17976 $cat > foo.c <<'EOP'
17977 int main() { printf("%d\n", bar1()); exit(0); }
17978 EOP
17979 $cc $ccflags -c bar1.c >/dev/null 2>&1
17980 $cc $ccflags -c bar2.c >/dev/null 2>&1
17981 $cc $ccflags -c foo.c >/dev/null 2>&1
17982 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17983 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17984         $run ./foobar >/dev/null 2>&1; then
17985         echo "$ar appears to generate random libraries itself."
17986         orderlib=false
17987         ranlib=":"
17988 elif $ar ts bar$_a >/dev/null 2>&1 &&
17989         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17990         $run ./foobar >/dev/null 2>&1; then
17991                 echo "a table of contents needs to be added with '$ar ts'."
17992                 orderlib=false
17993                 ranlib="$ar ts"
17994 else
17995         case "$ranlib" in
17996         :) ranlib='';;
17997         '')
17998                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17999                 $test -f $ranlib || ranlib=''
18000                 ;;
18001         esac
18002         if $test -n "$ranlib"; then
18003                 echo "your system has '$ranlib'; we'll use that."
18004                 orderlib=false
18005         else
18006                 echo "your system doesn't seem to support random libraries"
18007                 echo "so we'll use lorder and tsort to order the libraries."
18008                 orderlib=true
18009                 ranlib=":"
18010         fi
18011 fi
18012 $rm -f foo* bar* 
18013
18014 : check for type of arguments to select. 
18015 case "$selecttype" in
18016 '') case "$d_select" in
18017         $define)
18018                 echo " "
18019                 $cat <<EOM
18020 Checking to see what type of arguments are accepted by select().
18021 EOM
18022                 hdrs="$define sys/types.h
18023                         $i_systime sys/time.h 
18024                         $i_sysselct sys/select.h
18025                         $d_socket sys/socket.h"
18026                 : The first arg can be int, unsigned, or size_t
18027                 : The last arg may or may not be 'const'
18028                 val=''
18029                 : void pointer has been seen but using that
18030                 : breaks the selectminbits test
18031                 for xxx in 'fd_set *' 'int *'; do
18032                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18033                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18034                                         case "$val" in
18035                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18036                                                 if ./protochk "$try" $hdrs; then
18037                                                         echo "Your system accepts $xxx."
18038                                                         val="$xxx"
18039                                                 fi
18040                                                 ;;
18041                                         esac
18042                                 done
18043                         done
18044                 done
18045                 case "$val" in
18046                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18047                         case "$d_fd_set" in
18048                                 $define) dflt="fd_set *" ;;
18049                                 *)              dflt="int *" ;;
18050                         esac
18051                         . ./myread
18052                         val=$ans
18053                         ;;
18054                 esac
18055                 selecttype="$val"
18056                 ;;
18057         *)      : no select, so pick a harmless default
18058                 selecttype='int *'
18059                 ;;
18060         esac
18061         ;;
18062 esac
18063
18064 : check for the select 'width'
18065 case "$selectminbits" in
18066 '') case "$d_select" in
18067         $define)
18068                 $cat <<EOM
18069
18070 Checking to see on how many bits at a time your select() operates...
18071 EOM
18072                 $cat >try.c <<EOCP
18073 #include <sys/types.h>
18074 #$i_time I_TIME
18075 #$i_systime I_SYS_TIME
18076 #$i_systimek I_SYS_TIME_KERNEL
18077 #ifdef I_TIME
18078 #   include <time.h>
18079 #endif
18080 #ifdef I_SYS_TIME
18081 #   ifdef I_SYS_TIME_KERNEL
18082 #       define KERNEL
18083 #   endif
18084 #   include <sys/time.h>
18085 #   ifdef I_SYS_TIME_KERNEL
18086 #       undef KERNEL
18087 #   endif
18088 #endif
18089 #$i_sysselct I_SYS_SELECT
18090 #ifdef I_SYS_SELECT
18091 #include <sys/select.h>
18092 #endif
18093 #$d_socket HAS_SOCKET
18094 #ifdef HAS_SOCKET
18095 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18096 #endif
18097 #include <stdio.h>
18098 $selecttype b;
18099 #define S sizeof(*(b))
18100 #define MINBITS 64
18101 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18102 #define NBITS  (NBYTES * 8)
18103 int main() {
18104     char s[NBYTES];
18105     struct timeval t;
18106     int i;
18107     FILE* fp;
18108     int fd;
18109
18110     fclose(stdin);
18111     fp = fopen("try.c", "r");
18112     if (fp == 0)
18113       exit(1);
18114     fd = fileno(fp);
18115     if (fd < 0)
18116       exit(2);
18117     b = ($selecttype)s;
18118     for (i = 0; i < NBITS; i++)
18119         FD_SET(i, b);
18120     t.tv_sec  = 0;
18121     t.tv_usec = 0;
18122     select(fd + 1, b, 0, 0, &t);
18123     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18124     printf("%d\n", i + 1);
18125     return 0;
18126 }
18127 EOCP
18128                 set try
18129                 if eval $compile_ok; then
18130                         selectminbits=`$run ./try`
18131                         case "$selectminbits" in
18132                         '')     cat >&4 <<EOM
18133 Cannot figure out on how many bits at a time your select() operates.
18134 I'll play safe and guess it is 32 bits.
18135 EOM
18136                                 selectminbits=32
18137                                 bits="32 bits"
18138                                 ;;
18139                         1)      bits="1 bit" ;;
18140                         *)      bits="$selectminbits bits" ;;
18141                         esac
18142                         echo "Your select() operates on $bits at a time." >&4
18143                 else
18144                         rp='What is the minimum number of bits your select() operates on?'
18145                         case "$byteorder" in
18146                         1234|12345678)  dflt=32 ;;
18147                         *)              dflt=1  ;;
18148                         esac
18149                         . ./myread
18150                         val=$ans
18151                         selectminbits="$val"
18152                 fi
18153                 $rm -f try.* try
18154                 ;;
18155         *)      : no select, so pick a harmless default
18156                 selectminbits='32'
18157                 ;;
18158         esac
18159         ;;
18160 esac
18161
18162 : Trace out the files included by signal.h, then look for SIGxxx names.
18163 : Remove SIGARRAYSIZE used by HPUX.
18164 : Remove SIGSTKSIZE used by Linux.
18165 : Remove SIGSTKSZ used by Posix.
18166 : Remove SIGTYP void lines used by OS2.
18167 : Some cpps, like os390, dont give the file name anywhere
18168 if [ "X$fieldn" = X ]; then
18169         : Just make some guesses.  We check them later.
18170         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18171 else
18172         xxx=`echo '#include <signal.h>' |
18173         $cppstdin $cppminus $cppflags 2>/dev/null |
18174         $grep '^[       ]*#.*include' | 
18175         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18176 fi
18177 : Check this list of files to be sure we have parsed the cpp output ok.
18178 : This will also avoid potentially non-existent files, such 
18179 : as ../foo/bar.h
18180 xxxfiles=''
18181 for xx in $xxx /dev/null ; do
18182         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18183 done
18184 : If we have found no files, at least try signal.h
18185 case "$xxxfiles" in
18186 '')     xxxfiles=`./findhdr signal.h` ;;
18187 esac
18188 xxx=`awk '
18189 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18190         print substr($2, 4, 20)
18191 }
18192 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18193         print substr($3, 4, 20)
18194 }' $xxxfiles`
18195 : Append some common names just in case the awk scan failed.
18196 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18197 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18198 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18199 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18200 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18201
18202 : generate a few handy files for later
18203 $cat > signal.c <<'EOCP'
18204 #include <sys/types.h>
18205 #include <signal.h>
18206 #include <stdio.h>
18207 int main() {
18208
18209 /* Strange style to avoid deeply-nested #if/#else/#endif */
18210 #ifndef NSIG
18211 #  ifdef _NSIG
18212 #    define NSIG (_NSIG)
18213 #  endif
18214 #endif
18215
18216 #ifndef NSIG
18217 #  ifdef SIGMAX
18218 #    define NSIG (SIGMAX+1)
18219 #  endif
18220 #endif
18221
18222 #ifndef NSIG
18223 #  ifdef SIG_MAX
18224 #    define NSIG (SIG_MAX+1)
18225 #  endif
18226 #endif
18227
18228 #ifndef NSIG
18229 #  ifdef MAXSIG
18230 #    define NSIG (MAXSIG+1)
18231 #  endif
18232 #endif
18233
18234 #ifndef NSIG
18235 #  ifdef MAX_SIG
18236 #    define NSIG (MAX_SIG+1)
18237 #  endif
18238 #endif
18239
18240 #ifndef NSIG
18241 #  ifdef SIGARRAYSIZE
18242 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18243 #  endif
18244 #endif
18245
18246 #ifndef NSIG
18247 #  ifdef _sys_nsig
18248 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18249 #  endif
18250 #endif
18251
18252 /* Default to some arbitrary number that's big enough to get most
18253    of the common signals.
18254 */
18255 #ifndef NSIG
18256 #    define NSIG 50
18257 #endif
18258
18259 printf("NSIG %d\n", NSIG);
18260
18261 #ifndef JUST_NSIG
18262
18263 EOCP
18264
18265 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18266 {
18267         printf "#ifdef SIG"; printf $1; printf "\n"
18268         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18269         printf $1; printf ");\n"
18270         printf "#endif\n"
18271 }
18272 END {
18273         printf "#endif /* JUST_NSIG */\n";
18274         printf "exit(0);\n}\n";
18275 }
18276 ' >>signal.c
18277 $cat >signal.awk <<'EOP'
18278 BEGIN { ndups = 0 }
18279 $1 ~ /^NSIG$/ { nsig = $2 }
18280 ($1 !~ /^NSIG$/) && (NF == 2) {
18281     if ($2 > maxsig) { maxsig = $2 }
18282     if (sig_name[$2]) {
18283         dup_name[ndups] = $1
18284         dup_num[ndups] = $2
18285         ndups++ 
18286     }
18287     else {
18288         sig_name[$2] = $1
18289         sig_num[$2] = $2
18290     }
18291 }
18292 END { 
18293     if (nsig == 0) {
18294         nsig = maxsig + 1
18295     }
18296     printf("NSIG %d\n", nsig);
18297     for (n = 1; n < nsig; n++) {
18298         if (sig_name[n]) {
18299             printf("%s %d\n", sig_name[n], sig_num[n])
18300         }
18301         else {
18302             printf("NUM%d %d\n", n, n) 
18303         }
18304     }
18305     for (n = 0; n < ndups; n++) {
18306         printf("%s %d\n", dup_name[n], dup_num[n])
18307     }
18308 }
18309 EOP
18310 $cat >signal_cmd <<EOS
18311 $startsh
18312 if $test -s signal.lst; then
18313     echo "Using your existing signal.lst file"
18314         exit 0
18315 fi
18316 xxx="$xxx"
18317 EOS
18318 $cat >>signal_cmd <<'EOS'
18319
18320 set signal
18321 if eval $compile_ok; then
18322         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18323 else
18324         echo "(I can't seem be able to compile the whole test program)" >&4
18325         echo "(I'll try it in little pieces.)" >&4
18326         set signal -DJUST_NSIG
18327         if eval $compile_ok; then
18328                 $run ./signal$_exe > signal.nsg
18329                 $cat signal.nsg
18330         else
18331                 echo "I can't seem to figure out how many signals you have." >&4
18332                 echo "Guessing 50." >&4
18333                 echo 'NSIG 50' > signal.nsg
18334         fi
18335         : Now look at all the signal names, one at a time.
18336         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18337                 $cat > signal.c <<EOCP
18338 #include <sys/types.h>
18339 #include <signal.h>
18340 #include <stdio.h>
18341 int main() {
18342 printf("$xx %d\n", SIG${xx});
18343 return 0;
18344 }
18345 EOCP
18346                 set signal
18347                 if eval $compile; then
18348                         echo "SIG${xx} found."
18349                         $run ./signal$_exe  >> signal.ls1
18350                 else
18351                         echo "SIG${xx} NOT found."
18352                 fi
18353         done
18354         if $test -s signal.ls1; then
18355                 $cat signal.nsg signal.ls1 |
18356                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18357         fi
18358
18359 fi
18360 if $test -s signal.lst; then
18361         :
18362 else
18363         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18364         echo 'kill -l' >signal
18365         set X `csh -f <signal`
18366         $rm -f signal
18367         shift
18368         case $# in
18369         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18370         esac
18371         echo $@ | $tr ' ' $trnl | \
18372             $awk '{ printf "%s %d\n", $1, ++s; }
18373                   END { printf "NSIG %d\n", ++s }' >signal.lst
18374 fi
18375 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18376 EOS
18377 chmod a+x signal_cmd
18378 $eunicefix signal_cmd
18379
18380 : generate list of signal names
18381 echo " "
18382 case "$sig_name_init" in
18383 '') doinit=yes ;;
18384 *)  case "$sig_num_init" in
18385     ''|*,*) doinit=yes ;;
18386     esac ;;
18387 esac
18388 case "$doinit" in
18389 yes)
18390         echo "Generating a list of signal names and numbers..." >&4
18391         . ./signal_cmd
18392         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18393         sig_name=`$awk 'BEGIN { printf "ZERO " }
18394                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18395         sig_num=`$awk  'BEGIN { printf "0 " }
18396                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18397         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18398                              !/^NSIG/   { printf "\"%s\", ", $1 }
18399                              END        { printf "0\n" }' signal.lst`
18400         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18401                              !/^NSIG/   { printf "%d, ", $2}
18402                              END        { printf "0\n"}' signal.lst`
18403         ;;
18404 esac
18405 echo "The following $sig_count signals are available:"
18406 echo " "
18407 echo $sig_name | $awk \
18408 'BEGIN { linelen = 0 }
18409 {
18410         for (i = 1; i <= NF; i++) {
18411                 name = "SIG" $i " "
18412                 linelen = linelen + length(name)
18413                 if (linelen > 70) {
18414                         printf "\n"
18415                         linelen = length(name)
18416                 }
18417                 printf "%s", name
18418         }
18419         printf "\n"
18420 }'
18421 sig_size=`echo $sig_name | awk '{print NF}'`
18422 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18423
18424 echo " "
18425 case "$sizetype" in
18426 *_t) zzz="$sizetype"    ;;
18427 *)   zzz="filesize"     ;;
18428 esac
18429 echo "Checking the size of $zzz..." >&4 
18430 cat > try.c <<EOCP
18431 #include <sys/types.h>
18432 #include <stdio.h>
18433 int main() {
18434     printf("%d\n", (int)sizeof($sizetype));
18435     exit(0);
18436 }
18437 EOCP
18438 set try
18439 if eval $compile_ok; then
18440         yyy=`$run ./try`
18441         case "$yyy" in
18442         '')     sizesize=4
18443                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18444                 ;;
18445         *)      sizesize=$yyy
18446                 echo "Your $zzz size is $sizesize bytes."
18447                 ;;
18448         esac
18449 else
18450         sizesize=4
18451         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18452 fi
18453
18454
18455 : check for socklen_t
18456 echo " "
18457 echo "Checking to see if you have socklen_t..." >&4
18458 $cat >try.c <<EOCP
18459 #include <sys/types.h>
18460 #$d_socket HAS_SOCKET
18461 #ifdef HAS_SOCKET
18462 #include <sys/socket.h>
18463 #endif
18464 int main() { socklen_t x = 16; }
18465 EOCP
18466 set try
18467 if eval $compile; then
18468         val="$define"
18469         echo "You have socklen_t."
18470 else
18471         val="$undef"
18472         echo "You do not have socklen_t."
18473         case "$sizetype" in
18474         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18475         esac
18476 fi
18477 $rm -f try try.*
18478 set d_socklen_t
18479 eval $setvar
18480
18481 : see if this is a socks.h system
18482 set socks.h i_socks
18483 eval $inhdr
18484
18485 : check for type of the size argument to socket calls
18486 case "$d_socket" in
18487 "$define")
18488         $cat <<EOM
18489
18490 Checking to see what type is the last argument of accept().
18491 EOM
18492         yyy=''
18493         case "$d_socklen_t" in
18494         "$define") yyy="$yyy socklen_t"
18495         esac
18496         yyy="$yyy $sizetype int long unsigned"
18497         for xxx in $yyy; do
18498                 case "$socksizetype" in
18499                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18500                         case "$usesocks" in
18501                         "$define")
18502                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18503                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18504                                         socksizetype="$xxx"
18505                                 fi
18506                                 ;;
18507                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18508                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18509                                         socksizetype="$xxx"
18510                                 fi
18511                                 ;;
18512                         esac
18513                         ;;
18514                 esac
18515         done
18516 : In case none of those worked, prompt the user.
18517         case "$socksizetype" in
18518         '')     rp='What is the type for socket address structure sizes?'
18519                 dflt='int'
18520                 . ./myread
18521                 socksizetype=$ans
18522                 ;;
18523         esac
18524         ;;
18525 *)      : no sockets, so pick relatively harmless default
18526         socksizetype='int'
18527         ;;
18528 esac
18529
18530 : see what type is used for signed size_t
18531 set ssize_t ssizetype int stdio.h sys/types.h
18532 eval $typedef
18533 dflt="$ssizetype"
18534 $cat > try.c <<EOM
18535 #include <stdio.h>
18536 #include <sys/types.h>
18537 #define Size_t $sizetype
18538 #define SSize_t $dflt
18539 int main()
18540 {
18541         if (sizeof(Size_t) == sizeof(SSize_t))
18542                 printf("$dflt\n");
18543         else if (sizeof(Size_t) == sizeof(int))
18544                 printf("int\n");
18545         else 
18546                 printf("long\n");
18547         exit(0);
18548 }
18549 EOM
18550 echo " "
18551 set try
18552 if eval $compile_ok && $run ./try > /dev/null; then
18553         ssizetype=`$run ./try`
18554         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18555 else
18556         $cat >&4 <<EOM
18557 Help! I can't compile and run the ssize_t test program: please enlighten me!
18558 (This is probably a misconfiguration in your system or libraries, and
18559 you really ought to fix it.  Still, I'll try anyway.)
18560
18561 I need a type that is the same size as $sizetype, but is guaranteed to
18562 be signed.  Common values are ssize_t, int and long.
18563
18564 EOM
18565         rp="What signed type is the same size as $sizetype?"
18566         . ./myread
18567         ssizetype="$ans"
18568 fi
18569 $rm -f try try.*
18570
18571 : see what type of char stdio uses.
18572 echo " "
18573 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18574 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18575         echo "Your stdio uses unsigned chars." >&4
18576         stdchar="unsigned char"
18577 else
18578         echo "Your stdio uses signed chars." >&4
18579         stdchar="char"
18580 fi
18581 $rm -f stdioh
18582
18583
18584
18585 : see what type uids are declared as in the kernel
18586 echo " "
18587 echo "Looking for the type for user ids returned by getuid()."
18588 set uid_t uidtype xxx stdio.h sys/types.h
18589 eval $typedef
18590 case "$uidtype" in
18591 xxx)
18592         xxx=`./findhdr sys/user.h`
18593         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18594         case $1 in
18595         unsigned) dflt="$1 $2" ;;
18596         *) dflt="$1" ;;
18597         esac
18598         ;;
18599 *) dflt="$uidtype";;
18600 esac
18601 case "$uidtype" in
18602 uid_t)  echo "uid_t found." ;;
18603 *)      rp="What is the type for user ids returned by getuid()?"
18604         . ./myread
18605         uidtype="$ans"
18606         ;;
18607 esac
18608
18609 echo " "
18610 case "$uidtype" in
18611 *_t) zzz="$uidtype"     ;;
18612 *)   zzz="uid"          ;;
18613 esac
18614 echo "Checking the size of $zzz..." >&4 
18615 cat > try.c <<EOCP
18616 #include <sys/types.h>
18617 #include <stdio.h>
18618 int main() {
18619     printf("%d\n", (int)sizeof($uidtype));
18620     exit(0);
18621 }
18622 EOCP
18623 set try
18624 if eval $compile_ok; then
18625         yyy=`$run ./try`
18626         case "$yyy" in
18627         '')     uidsize=4
18628                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18629                 ;;
18630         *)      uidsize=$yyy
18631                 echo "Your $zzz is $uidsize bytes long."
18632                 ;;
18633         esac
18634 else
18635         uidsize=4
18636         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18637 fi
18638
18639 echo " "
18640 case "$uidtype" in
18641 *_t) zzz="$uidtype"     ;;
18642 *)   zzz="uid"          ;;
18643 esac
18644 echo "Checking the sign of $zzz..." >&4
18645 cat > try.c <<EOCP
18646 #include <sys/types.h>
18647 #include <stdio.h>
18648 int main() {
18649         $uidtype foo = -1;
18650         if (foo < 0)
18651                 printf("-1\n");
18652         else
18653                 printf("1\n");
18654 }
18655 EOCP
18656 set try
18657 if eval $compile; then
18658         yyy=`$run ./try`
18659         case "$yyy" in
18660         '')     uidsign=1
18661                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18662                 ;;
18663         *)      uidsign=$yyy
18664                 case "$uidsign" in
18665                  1) echo "Your $zzz is unsigned." ;;
18666                 -1) echo "Your $zzz is signed."   ;;
18667                 esac
18668                 ;;
18669         esac
18670 else
18671         uidsign=1
18672         echo "(I can't compile the test program--guessing unsigned.)" >&4
18673 fi
18674
18675
18676
18677 echo " "
18678 $echo "Checking the format string to be used for uids..." >&4
18679
18680 case "$uidsign" in
18681 -1)     if $test X"$uidsize" = X"$ivsize"; then
18682                 uidformat="$ivdformat"
18683         else
18684                 if $test X"$uidsize" = X"$longsize"; then
18685                         uidformat='"ld"'
18686                 else
18687                         if $test X"$uidsize" = X"$intsize"; then
18688                                 uidformat='"d"'
18689                         else
18690                                 if $test X"$uidsize" = X"$shortsize"; then
18691                                         uidformat='"hd"'
18692                                 fi
18693                         fi
18694                 fi
18695         fi
18696         ;;
18697 *)      if $test X"$uidsize" = X"$uvsize"; then
18698                 uidformat="$uvuformat"
18699         else
18700                 if $test X"$uidsize" = X"$longsize"; then
18701                         uidformat='"lu"'
18702                 else
18703                         if $test X"$uidsize" = X"$intsize"; then
18704                                 uidformat='"u"'
18705                         else
18706                                 if $test X"$uidsize" = X"$shortsize"; then
18707                                         uidformat='"hu"'
18708                                 fi
18709                         fi
18710                 fi
18711         fi
18712         ;;
18713 esac
18714
18715 : determine compiler compiler
18716 case "$yacc" in
18717 '')
18718         dflt=yacc;;
18719 *)
18720         dflt="$yacc";;
18721 esac
18722 echo " "
18723 comp='yacc'
18724 if $test -f "$byacc$_exe"; then
18725         dflt="$byacc"
18726         comp="byacc or $comp"
18727 fi
18728 if $test -f "$bison$_exe"; then
18729         comp="$comp or bison -y"
18730 fi
18731 rp="Which compiler compiler ($comp) shall I use?"
18732 . ./myread
18733 yacc="$ans"
18734 case "$yacc" in
18735 *bis*)
18736         case "$yacc" in
18737         *-y*) ;;
18738         *)
18739                 yacc="$yacc -y"
18740                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18741                 ;;
18742         esac
18743         ;;
18744 esac
18745
18746 : see if this is a fp.h system
18747 set fp.h i_fp
18748 eval $inhdr
18749
18750 : see if this is a fp_class.h system
18751 set fp_class.h i_fp_class
18752 eval $inhdr
18753
18754 : see if this is a ieeefp.h system
18755 case "$i_ieeefp" in
18756 '' ) set ieeefp.h i_ieeefp
18757      eval $inhdr
18758      ;;
18759 esac
18760
18761 : see if this is a libutil.h system
18762 set libutil.h i_libutil
18763 eval $inhdr
18764
18765 : see if mach cthreads are available
18766 if test "X$usethreads" = "X$define"; then
18767         set mach/cthreads.h i_machcthr
18768         eval $inhdr
18769 else
18770         i_machcthr="$undef"
18771 fi
18772
18773
18774
18775 : see if this is a math.h system
18776 set math.h i_math
18777 eval $inhdr
18778
18779 : see if this is a mntent.h system
18780 set mntent.h i_mntent
18781 eval $inhdr
18782
18783 : see if ndbm.h is available
18784 set ndbm.h t_ndbm
18785 eval $inhdr
18786
18787 case "$t_ndbm" in
18788 $undef)
18789     # Some Linux distributions such as RedHat 7.1 put the
18790     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18791     if $test -f /usr/include/gdbm/ndbm.h; then
18792         echo '<gdbm/ndbm.h> found.'
18793         ccflags="$ccflags -I/usr/include/gdbm"
18794         cppflags="$cppflags -I/usr/include/gdbm"
18795         t_ndbm=$define
18796     fi
18797     ;;
18798 esac
18799
18800 case "$t_ndbm" in
18801 $define)
18802         : see if dbm_open exists
18803         set dbm_open d_dbm_open
18804         eval $inlibc
18805         case "$d_dbm_open" in
18806         $undef)
18807                 t_ndbm="$undef"
18808                 echo "We won't be including <ndbm.h>"
18809                 ;;
18810         esac
18811         ;;
18812 esac
18813 val="$t_ndbm"
18814 set i_ndbm
18815 eval $setvar
18816
18817 : see if net/errno.h is available
18818 val=''
18819 set net/errno.h val
18820 eval $inhdr
18821
18822 : Unfortunately, it causes problems on some systems.  Arrgh.
18823 case "$val" in
18824 $define)
18825         cat > try.c <<'EOM'
18826 #include <stdio.h>
18827 #include <errno.h>
18828 #include <net/errno.h>
18829 int func()
18830 {
18831         return ENOTSOCK;
18832 }
18833 EOM
18834         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18835                 echo "We'll be including <net/errno.h>." >&4
18836         else
18837                 echo "We won't be including <net/errno.h>." >&4
18838                 val="$undef"
18839         fi
18840         $rm -f try.* try
18841         ;;
18842 esac
18843 set i_neterrno
18844 eval $setvar
18845
18846 : see if netinet/tcp.h is available
18847 set netinet/tcp.h i_netinettcp
18848 eval $inhdr
18849
18850 : see if this is a poll.h system
18851 set poll.h i_poll
18852 eval $inhdr
18853
18854 : see if this is a prot.h system
18855 set prot.h i_prot
18856 eval $inhdr
18857
18858 echo " "
18859 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18860 $cat <<'EOSH' > Cppsym.know
18861 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18862 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18863 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18864 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18865 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18866 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18867 bull c cadmus clipper CMU COFF COMPILER_VERSION
18868 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18869 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18870 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18871 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18872 GLIBC GLIBC_MINOR
18873 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18874 H3050R H3050RX hbullx20 hcx host_mips
18875 hp200 hp300 hp700 HP700 hp800 hp9000
18876 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18877 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18878 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18879 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18880 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18881 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18882 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18883 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18884 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18885 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18886 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18887 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18888 MATH_HAS_NO_SIDE_EFFECTS
18889 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18890 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18891 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18892 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18893 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18894 NetBSD news1500 news1700 news1800 news1900 news3700
18895 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18896 ns32016 ns32332 ns32k nsc32000
18897 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18898 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18899 pc532 pdp11 PGC PIC plexus PORTAR posix
18900 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18901 POSIX_C_SOURCE POSIX_SOURCE POWER
18902 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18903 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18904 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18905 sony sony_news sonyrisc sparc sparclite spectrum
18906 stardent stdc STDC_EXT stratos sun sun3 sun386
18907 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18908 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18909 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18910 sysV68 sysV88 Tek4132 Tek4300 titan
18911 TM3200 TM5400 TM5600
18912 tower tower32 tower32_200 tower32_600 tower32_700
18913 tower32_800 tower32_850 tss
18914 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18915 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18916 unix UNIX95 UNIX99 unixpc unos
18917 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18918 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18919 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18920 USGr4 USGr4_2
18921 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18922 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18923 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18924 z8000
18925 EOSH
18926 # Maybe put other stuff here too.
18927 cat <<EOSH >>Cppsym.know
18928 $osname
18929 EOSH
18930 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18931 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18932 $cat Cppsym.know > Cppsym.c
18933 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18934 $rm -f Cppsym.a Cppsym.b Cppsym.c
18935 cat <<EOSH > Cppsym
18936 $startsh
18937 if $test \$# -gt 0; then
18938     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18939     if $test -s Cppsym.got; then
18940         $rm -f Cppsym.got
18941         exit 0
18942     fi
18943     $rm -f Cppsym.got
18944     exit 1
18945 else
18946     $tr " " "$trnl" | ./Cppsym.try
18947     exit 0
18948 fi
18949 EOSH
18950 chmod +x Cppsym
18951 $eunicefix Cppsym
18952 cat <<EOSH > Cppsym.try
18953 $startsh
18954 cat <<'EOCP' > try.c
18955 #include <stdio.h>
18956 int main() {
18957 EOCP
18958 $awk \\
18959 EOSH
18960 cat <<'EOSH' >> Cppsym.try
18961 'length($1) > 0 {
18962     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
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 }'       >> try.c
18967 echo 'return 0;}' >> try.c
18968 EOSH
18969 cat <<EOSH >> Cppsym.try
18970 ccflags="$ccflags"
18971 case "$osname-$gccversion" in
18972 irix-) ccflags="\$ccflags -woff 1178" ;;
18973 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18974 esac
18975 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18976 EOSH
18977 chmod +x Cppsym.try
18978 $eunicefix Cppsym.try
18979 ./Cppsym < Cppsym.know > Cppsym.true
18980 : now check the C compiler for additional symbols
18981 postprocess_cc_v=''
18982 case "$osname" in
18983 aix) postprocess_cc_v="|$tr , ' '" ;;
18984 esac
18985 $cat >ccsym <<EOS
18986 $startsh
18987 $cat >tmp.c <<EOF
18988 extern int foo;
18989 EOF
18990 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18991 do
18992         case "\$i" in
18993         -D*) echo "\$i" | $sed 's/^-D//';;
18994         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18995         esac
18996 done
18997 $rm -f try.c
18998 EOS
18999 postprocess_cc_v=''
19000 chmod +x ccsym
19001 $eunicefix ccsym
19002 ./ccsym > ccsym1.raw
19003 if $test -s ccsym1.raw; then
19004        $sort ccsym1.raw | $uniq >ccsym.raw
19005 else
19006        mv ccsym1.raw ccsym.raw
19007 fi
19008
19009 $awk '/\=/ { print $0; next }
19010         { print $0"=1" }' ccsym.raw >ccsym.list
19011 $awk '/\=/ { print $0; next }
19012         { print $0"=1" }' Cppsym.true >ccsym.true
19013 $comm -13 ccsym.true ccsym.list >ccsym.own
19014 $comm -12 ccsym.true ccsym.list >ccsym.com
19015 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19016 also=''
19017 if $test -z ccsym.raw; then
19018         echo "Your C compiler doesn't seem to define any symbols!" >&4
19019         echo " "
19020         echo "However, your C preprocessor defines the following symbols:"
19021         $cat Cppsym.true
19022         ccsymbols=''
19023         cppsymbols=`$cat Cppsym.true`
19024         cppsymbols=`echo $cppsymbols`
19025         cppccsymbols="$cppsymbols"
19026 else
19027         if $test -s ccsym.com; then
19028                 echo "Your C compiler and pre-processor define these symbols:"
19029                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19030                 also='also '
19031                 symbols='ones'
19032                 cppccsymbols=`$cat ccsym.com`
19033                 cppccsymbols=`echo $cppccsymbols`
19034                 $test "$silent" || sleep 1
19035         fi
19036         if $test -s ccsym.cpp; then
19037                 $test "$also" && echo " "
19038                 echo "Your C pre-processor ${also}defines the following symbols:"
19039                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19040                 also='further '
19041                 cppsymbols=`$cat ccsym.cpp`
19042                 cppsymbols=`echo $cppsymbols`
19043                 $test "$silent" || sleep 1
19044         fi
19045         if $test -s ccsym.own; then
19046                 $test "$also" && echo " "
19047                 echo "Your C compiler ${also}defines the following cpp symbols:"
19048                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19049                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19050                 ccsymbols=`$cat ccsym.own`
19051                 ccsymbols=`echo $ccsymbols`
19052                 $test "$silent" || sleep 1
19053         fi
19054 fi
19055
19056 : see if this is a termio system
19057 val="$undef"
19058 val2="$undef"
19059 val3="$undef"
19060 if $test `./findhdr termios.h`; then
19061         set tcsetattr i_termios
19062         eval $inlibc
19063         val3="$i_termios"
19064 fi
19065 echo " "
19066 case "$val3" in
19067 "$define") echo "You have POSIX termios.h... good!" >&4;;
19068 *) if ./Cppsym pyr; then
19069                 case "`/bin/universe`" in
19070                 ucb) if $test `./findhdr sgtty.h`; then
19071                                 val2="$define"
19072                                 echo "<sgtty.h> found." >&4
19073                         else
19074                                 echo "System is pyramid with BSD universe."
19075                                 echo "<sgtty.h> not found--you could have problems." >&4
19076                         fi;;
19077                 *) if $test `./findhdr termio.h`; then
19078                                 val="$define"
19079                                 echo "<termio.h> found." >&4
19080                         else
19081                                 echo "System is pyramid with USG universe."
19082                                 echo "<termio.h> not found--you could have problems." >&4
19083                         fi;;
19084                 esac
19085         elif ./usg; then
19086                 if $test `./findhdr termio.h`; then
19087                         echo "<termio.h> found." >&4
19088                         val="$define"
19089                 elif $test `./findhdr sgtty.h`; then
19090                         echo "<sgtty.h> found." >&4
19091                         val2="$define"
19092                 else
19093 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19094                 fi
19095         else
19096                 if $test `./findhdr sgtty.h`; then
19097                         echo "<sgtty.h> found." >&4
19098                         val2="$define"
19099                 elif $test `./findhdr termio.h`; then
19100                         echo "<termio.h> found." >&4
19101                         val="$define"
19102                 else
19103 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19104                 fi
19105         fi;;
19106 esac
19107 set i_termio; eval $setvar
19108 val=$val2; set i_sgtty; eval $setvar
19109 val=$val3; set i_termios; eval $setvar
19110
19111 : see if stddef is available
19112 set stddef.h i_stddef
19113 eval $inhdr
19114
19115 : see if this is a sunmath.h system
19116 set sunmath.h i_sunmath
19117 eval $inhdr
19118
19119 : see if sys/access.h is available
19120 set sys/access.h i_sysaccess
19121 eval $inhdr
19122
19123 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19124 set sys/filio.h i_sysfilio
19125 eval $inhdr
19126 echo " "
19127 if $test `./findhdr sys/ioctl.h`; then
19128         val="$define"
19129         echo '<sys/ioctl.h> found.' >&4
19130 else
19131         val="$undef"
19132         if $test $i_sysfilio = "$define"; then
19133             echo '<sys/ioctl.h> NOT found.' >&4
19134         else
19135                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19136                 $test $i_termio = "$define" && xxx="termio.h"
19137                 $test $i_termios = "$define" && xxx="termios.h"
19138 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19139         fi
19140 fi
19141 set i_sysioctl
19142 eval $setvar
19143
19144 : see if socket ioctl defs are in sys/sockio.h
19145 echo " "
19146 xxx=`./findhdr sys/sockio.h`
19147 if $test "$xxx"; then
19148         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19149                 val="$define"
19150                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19151         else
19152                 val="$undef"
19153                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19154         fi
19155 else
19156         val="$undef"
19157         $cat <<EOM
19158 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19159 EOM
19160 fi
19161 set i_syssockio
19162 eval $setvar
19163
19164
19165 : see if this is a syslog.h system
19166 set syslog.h i_syslog
19167 eval $inhdr
19168
19169
19170 : see if this is a sys/mode.h system
19171 set sys/mode.h i_sysmode
19172 eval $inhdr
19173
19174 : see if sys/resource.h has to be included
19175 set sys/resource.h i_sysresrc
19176 eval $inhdr
19177
19178 : see if sys/security.h is available
19179 set sys/security.h i_syssecrt
19180 eval $inhdr
19181
19182 : see if this is a sys/statvfs.h system
19183 set sys/statvfs.h i_sysstatvfs
19184 eval $inhdr
19185
19186 : see if this is a sys/un.h system
19187 set sys/un.h i_sysun
19188 eval $inhdr
19189
19190
19191 : see if this is a sys/utsname.h system
19192 set sys/utsname.h i_sysutsname
19193 eval $inhdr
19194
19195 : see if this is a syswait system
19196 set sys/wait.h i_syswait
19197 eval $inhdr
19198
19199 : see if this is a ustat.h system
19200 set ustat.h i_ustat
19201 eval $inhdr
19202
19203 : see if this is an utime system
19204 set utime.h i_utime
19205 eval $inhdr
19206
19207 : see if this is a values.h system
19208 set values.h i_values
19209 eval $inhdr
19210
19211 : see if this is a vfork system
19212 case "$d_vfork" in
19213 "$define")
19214         set vfork.h i_vfork
19215         eval $inhdr
19216         ;;
19217 *)
19218         i_vfork="$undef"
19219         ;;
19220 esac
19221
19222 : see if gdbm.h is available
19223 set gdbm.h t_gdbm
19224 eval $inhdr
19225 case "$t_gdbm" in
19226 $define)
19227         : see if gdbm_open exists
19228         set gdbm_open d_gdbm_open
19229         eval $inlibc
19230         case "$d_gdbm_open" in
19231         $undef)
19232                 t_gdbm="$undef"
19233                 echo "We won't be including <gdbm.h>"
19234                 ;;
19235         esac
19236         ;;
19237 esac
19238 val="$t_gdbm"
19239 set i_gdbm
19240 eval $setvar
19241
19242 echo " "
19243 echo "Looking for extensions..." >&4
19244 : If we are using the old config.sh, known_extensions may contain
19245 : old or inaccurate or duplicate values.
19246 known_extensions=''
19247 nonxs_extensions=''
19248 : We do not use find because it might not be available.
19249 : We do not just use MANIFEST because the user may have dropped
19250 : some additional extensions into the source tree and expect them
19251 : to be built.
19252
19253 : Function to recursively find available extensions, ignoring DynaLoader
19254 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19255 find_extensions='
19256     for xxx in *; do
19257        case "$xxx" in
19258            DynaLoader|dynaload) ;;
19259            *)
19260            if $test -f $xxx/$xxx.xs; then
19261                known_extensions="$known_extensions $1$xxx";
19262            elif $test -f $xxx/Makefile.PL; then
19263                nonxs_extensions="$nonxs_extensions $1$xxx";
19264            else
19265                if $test -d $xxx -a $# -lt 10; then
19266                    set $1$xxx/ $*;
19267                    cd "$xxx";
19268                    eval $find_extensions;
19269                    cd ..;
19270                    shift;
19271                fi;
19272            fi
19273            ;;
19274        esac;
19275     done'
19276 tdir=`pwd`
19277 cd "$rsrc/ext"
19278 set X
19279 shift
19280 eval $find_extensions
19281 # Special case:  Add in threads/shared since it is not picked up by the
19282 # recursive find above (and adding in general recursive finding breaks
19283 # SDBM_File/sdbm).  A.D.  10/25/2001.
19284 known_extensions="$known_extensions threads/shared"
19285 set X $nonxs_extensions
19286 shift
19287 nonxs_extensions="$*"
19288 set X $known_extensions
19289 shift
19290 known_extensions="$*"
19291 cd "$tdir"
19292
19293 : Now see which are supported on this system.
19294 avail_ext=''
19295 for xxx in $known_extensions ; do
19296         case "$xxx" in
19297         DB_File|db_file)
19298                 case "$i_db" in
19299                 $define) avail_ext="$avail_ext $xxx" ;;
19300                 esac
19301                 ;;
19302         GDBM_File|gdbm_fil)
19303                 case "$i_gdbm" in 
19304                 $define) avail_ext="$avail_ext $xxx" ;;
19305                 esac
19306                 ;;
19307         I18N/Langinfo|i18n_lan)
19308                 case "$i_langinfo$d_nl_langinfo" in 
19309                 $define$define) avail_ext="$avail_ext $xxx" ;;
19310                 esac
19311                 ;;
19312         NDBM_File|ndbm_fil)
19313                 case "$i_ndbm" in
19314                 $define)
19315                     case "$osname-$use64bitint" in
19316                     hpux-define)
19317                         case "$libs" in
19318                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19319                         esac
19320                         ;;
19321                     *) avail_ext="$avail_ext $xxx" ;;
19322                     esac
19323                     ;;
19324                 esac
19325                 ;;
19326         ODBM_File|odbm_fil) 
19327                 case "${i_dbm}${i_rpcsvcdbm}" in
19328                 *"${define}"*)
19329                     case "$osname-$use64bitint" in
19330                     hpux-define)
19331                         case "$libs" in
19332                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19333                         esac
19334                         ;;
19335                     *) avail_ext="$avail_ext $xxx" ;;
19336                     esac
19337                     ;;
19338                 esac
19339                 ;;
19340         POSIX|posix)
19341                 case "$useposix" in
19342                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19343                 esac
19344                 ;;
19345         Opcode|opcode)
19346                 case "$useopcode" in
19347                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19348                 esac
19349                 ;;
19350         Socket|socket)
19351                 case "$d_socket" in 
19352                 true|$define|y)
19353                     case "$osname" in
19354                     beos) ;; # not unless BONE
19355                     *) avail_ext="$avail_ext $xxx" ;;
19356                     esac
19357                     ;;
19358                 esac
19359                 ;;
19360         Sys/Syslog|sys/syslog)
19361                 : XXX syslog requires socket
19362                 case "$d_socket" in 
19363                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19364                 esac
19365                 ;;
19366         Thread|thread)
19367                 case "$usethreads" in
19368                 true|$define|y)
19369                         case "$useithreads" in
19370                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19371                         esac
19372                 esac
19373                 ;;
19374         XS/APItest|xs/apitest)
19375                 # This is just for testing.  Skip it unless we have dynamic loading.
19376
19377                 case "$usedl" in
19378                 $define) avail_ext="$avail_ext $xxx" ;;
19379                 esac
19380                 ;;
19381         XS/Typemap|xs/typemap)
19382                 # This is just for testing.  Skip it unless we have dynamic loading.
19383                 case "$usedl" in
19384                 $define) avail_ext="$avail_ext $xxx" ;;
19385                 esac
19386                 ;;
19387         threads|threads/shared)
19388                 # threads and threads::shared are special cases.
19389                 # To stop people from asking "Perl 5.8.0 was supposed
19390                 # to have this new fancy threads implementation but my
19391                 # perl doesn't have it" and from people trying to
19392                 # (re)install the threads module using CPAN.pm and
19393                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19394                 # the threads.pm and threads/shared.pm will always be
19395                 # there, croaking informatively ("you need to rebuild
19396                 # all of Perl with threads, sorry") when threads haven't
19397                 # been compiled in.
19398                 # --jhi
19399                 avail_ext="$avail_ext $xxx"
19400                 ;;
19401         IPC/SysV|ipc/sysv)
19402                 : XXX Do we need a useipcsysv variable here
19403                 case "${d_msg}${d_sem}${d_shm}" in 
19404                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19405                 esac
19406                 ;;
19407         *)      avail_ext="$avail_ext $xxx"
19408                 ;;
19409         esac
19410 done
19411
19412 set X $avail_ext
19413 shift
19414 avail_ext="$*"
19415
19416 : Now see which nonxs extensions are supported on this system.
19417 : For now assume all are.
19418 nonxs_ext=''
19419 for xxx in $nonxs_extensions ; do
19420         case "$xxx" in
19421         *)      nonxs_ext="$nonxs_ext $xxx"
19422                 ;;
19423         esac
19424 done
19425
19426 set X $nonxs_ext
19427 shift
19428 nonxs_ext="$*"
19429
19430 case $usedl in
19431 $define)
19432         $cat <<EOM
19433 A number of extensions are supplied with $package.  You may choose to
19434 compile these extensions for dynamic loading (the default), compile
19435 them into the $package executable (static loading), or not include
19436 them at all.  Answer "none" to include no extensions.
19437 Note that DynaLoader is always built and need not be mentioned here.
19438
19439 EOM
19440         case "$dynamic_ext" in
19441         '')
19442                 : Exclude those listed in static_ext
19443                 dflt=''
19444                 for xxx in $avail_ext; do
19445                         case " $static_ext " in
19446                         *" $xxx "*) ;;
19447                         *) dflt="$dflt $xxx" ;;
19448                         esac
19449                 done
19450                 set X $dflt
19451                 shift
19452                 dflt="$*"
19453                 ;;
19454         *)      dflt="$dynamic_ext"
19455                 # Perhaps we are reusing an old out-of-date config.sh.
19456                 case "$hint" in
19457                 previous)
19458                         if test X"$dynamic_ext" != X"$avail_ext"; then
19459                                 $cat <<EOM
19460 NOTICE:  Your previous config.sh list may be incorrect. 
19461 The extensions now available to you are 
19462         ${avail_ext}
19463 but the default list from your previous config.sh is
19464         ${dynamic_ext} 
19465
19466 EOM
19467                         fi
19468                         ;;
19469                 esac
19470                 ;;
19471         esac
19472         case "$dflt" in
19473         '')     dflt=none;;
19474         esac
19475         rp="What extensions do you wish to load dynamically?"
19476         . ./myread
19477         case "$ans" in
19478         none) dynamic_ext=' ' ;;
19479         *) dynamic_ext="$ans" ;;
19480         esac
19481
19482         case "$static_ext" in
19483         '')
19484                 : Exclude those already listed in dynamic linking
19485                 dflt=''
19486                 for xxx in $avail_ext; do
19487                         case " $dynamic_ext " in
19488                         *" $xxx "*) ;;
19489                         *) dflt="$dflt $xxx" ;;
19490                         esac
19491                 done
19492                 set X $dflt
19493                 shift
19494                 dflt="$*"
19495                 ;;
19496         *)  dflt="$static_ext" 
19497                 ;;
19498         esac
19499
19500         case "$dflt" in
19501         '')     dflt=none;;
19502         esac
19503         rp="What extensions do you wish to load statically?"
19504         . ./myread
19505         case "$ans" in
19506         none) static_ext=' ' ;;
19507         *) static_ext="$ans" ;;
19508         esac
19509         ;;
19510 *)
19511         $cat <<EOM
19512 A number of extensions are supplied with $package.  Answer "none" 
19513 to include no extensions. 
19514 Note that DynaLoader is always built and need not be mentioned here.
19515
19516 EOM
19517         case "$static_ext" in
19518         '') dflt="$avail_ext" ;;
19519         *)      dflt="$static_ext"
19520                 # Perhaps we are reusing an old out-of-date config.sh.
19521                 case "$hint" in
19522                 previous)
19523                         if test X"$static_ext" != X"$avail_ext"; then
19524                                 $cat <<EOM
19525 NOTICE:  Your previous config.sh list may be incorrect. 
19526 The extensions now available to you are 
19527         ${avail_ext}
19528 but the default list from your previous config.sh is
19529         ${static_ext} 
19530
19531 EOM
19532                         fi
19533                         ;;
19534                 esac
19535                 ;;
19536         esac
19537         : Exclude those that are not xs extensions
19538         case "$dflt" in
19539         '')     dflt=none;;
19540         esac
19541         rp="What extensions do you wish to include?"
19542         . ./myread
19543         case "$ans" in
19544         none) static_ext=' ' ;;
19545         *) static_ext="$ans" ;;
19546         esac
19547         ;;
19548 esac
19549 #        
19550 # Encode is a special case.  If we are building Encode as a static
19551 # extension, we need to explicitly list its subextensions as well.
19552 # For other nested extensions, this is handled automatically by
19553 # the appropriate Makefile.PL.
19554 case " $static_ext " in
19555         *" Encode "*) # Add the subextensions of Encode
19556         cd "$rsrc/ext"
19557         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19558                 static_ext="$static_ext Encode/$xxx"
19559         done
19560         cd "$tdir"
19561         ;;
19562 esac
19563
19564 set X $dynamic_ext $static_ext $nonxs_ext
19565 shift
19566 extensions="$*"
19567
19568 : Remove libraries needed only for extensions
19569 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19570 : The exception is SunOS 4.x, which needs them.
19571 case "${osname}X${osvers}" in
19572 sunos*X4*)
19573     perllibs="$libs"
19574     ;;
19575 *) case "$usedl" in
19576     $define|true|[yY]*)
19577             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19578             shift
19579             perllibs="$*"
19580             ;;
19581     *)  perllibs="$libs"
19582             ;;
19583     esac
19584     ;;
19585 esac
19586
19587 : Remove build directory name from cppstdin so it can be used from
19588 : either the present location or the final installed location.
19589 echo " "
19590 : Get out of the UU directory to get correct path name.
19591 cd ..
19592 case "$cppstdin" in
19593 `pwd`/cppstdin)
19594         echo "Stripping down cppstdin path name"
19595         cppstdin=cppstdin
19596         ;;
19597 esac
19598 cd UU
19599
19600 : end of configuration questions
19601 echo " "
19602 echo "End of configuration questions."
19603 echo " "
19604
19605 : back to where it started
19606 if test -d ../UU; then
19607         cd ..
19608 fi
19609
19610 : configuration may be patched via a 'config.arch' file
19611 if $test -f config.arch; then
19612         echo "I see a config.arch file, loading it."
19613         . ./config.arch
19614 fi
19615
19616 : configuration may be patched via a 'config.over' file
19617 if $test -f config.over; then
19618         echo " "
19619         dflt=y
19620         rp='I see a config.over file.  Do you wish to load it?'
19621         . UU/myread
19622         case "$ans" in
19623         n*) echo "OK, I'll ignore it.";;
19624         *)      . ./config.over
19625                 echo "Configuration override changes have been loaded."
19626                 ;;
19627         esac
19628 fi
19629
19630 : in case they want portability, strip down executable paths
19631 case "$d_portable" in
19632 "$define")
19633         echo " "
19634         echo "Stripping down executable paths..." >&4
19635         for file in $loclist $trylist; do
19636                 eval temp=\$$file
19637                 eval $file=`basename $temp`
19638         done
19639         ;;
19640 esac
19641
19642 : create config.sh file
19643 echo " "
19644 echo "Creating config.sh..." >&4
19645 $spitshell <<EOT >config.sh
19646 $startsh
19647 #
19648 # This file was produced by running the Configure script. It holds all the
19649 # definitions figured out by Configure. Should you modify one of these values,
19650 # do not forget to propagate your changes by running "Configure -der". You may
19651 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19652 #
19653
19654 # Package name      : $package
19655 # Source directory  : $src
19656 # Configuration time: $cf_time
19657 # Configured by     : $cf_by
19658 # Target system     : $myuname
19659
19660 Author='$Author'
19661 Date='$Date'
19662 Header='$Header'
19663 Id='$Id'
19664 Locker='$Locker'
19665 Log='$Log'
19666 Mcc='$Mcc'
19667 RCSfile='$RCSfile'
19668 Revision='$Revision'
19669 Source='$Source'
19670 State='$State'
19671 _a='$_a'
19672 _exe='$_exe'
19673 _o='$_o'
19674 afs='$afs'
19675 afsroot='$afsroot'
19676 alignbytes='$alignbytes'
19677 ansi2knr='$ansi2knr'
19678 aphostname='$aphostname'
19679 api_revision='$api_revision'
19680 api_subversion='$api_subversion'
19681 api_version='$api_version'
19682 api_versionstring='$api_versionstring'
19683 ar='$ar'
19684 archlib='$archlib'
19685 archlibexp='$archlibexp'
19686 archname64='$archname64'
19687 archname='$archname'
19688 archobjs='$archobjs'
19689 asctime_r_proto='$asctime_r_proto'
19690 awk='$awk'
19691 baserev='$baserev'
19692 bash='$bash'
19693 bin='$bin'
19694 binexp='$binexp'
19695 bison='$bison'
19696 byacc='$byacc'
19697 byteorder='$byteorder'
19698 c='$c'
19699 castflags='$castflags'
19700 cat='$cat'
19701 cc='$cc'
19702 cccdlflags='$cccdlflags'
19703 ccdlflags='$ccdlflags'
19704 ccflags='$ccflags'
19705 ccflags_uselargefiles='$ccflags_uselargefiles'
19706 ccname='$ccname'
19707 ccsymbols='$ccsymbols'
19708 ccversion='$ccversion'
19709 cf_by='$cf_by'
19710 cf_email='$cf_email'
19711 cf_time='$cf_time'
19712 charsize='$charsize'
19713 chgrp='$chgrp'
19714 chmod='$chmod'
19715 chown='$chown'
19716 clocktype='$clocktype'
19717 comm='$comm'
19718 compress='$compress'
19719 contains='$contains'
19720 cp='$cp'
19721 cpio='$cpio'
19722 cpp='$cpp'
19723 cpp_stuff='$cpp_stuff'
19724 cppccsymbols='$cppccsymbols'
19725 cppflags='$cppflags'
19726 cpplast='$cpplast'
19727 cppminus='$cppminus'
19728 cpprun='$cpprun'
19729 cppstdin='$cppstdin'
19730 cppsymbols='$cppsymbols'
19731 crypt_r_proto='$crypt_r_proto'
19732 cryptlib='$cryptlib'
19733 csh='$csh'
19734 ctermid_r_proto='$ctermid_r_proto'
19735 ctime_r_proto='$ctime_r_proto'
19736 d_Gconvert='$d_Gconvert'
19737 d_PRIEUldbl='$d_PRIEUldbl'
19738 d_PRIFUldbl='$d_PRIFUldbl'
19739 d_PRIGUldbl='$d_PRIGUldbl'
19740 d_PRIXU64='$d_PRIXU64'
19741 d_PRId64='$d_PRId64'
19742 d_PRIeldbl='$d_PRIeldbl'
19743 d_PRIfldbl='$d_PRIfldbl'
19744 d_PRIgldbl='$d_PRIgldbl'
19745 d_PRIi64='$d_PRIi64'
19746 d_PRIo64='$d_PRIo64'
19747 d_PRIu64='$d_PRIu64'
19748 d_PRIx64='$d_PRIx64'
19749 d_SCNfldbl='$d_SCNfldbl'
19750 d__fwalk='$d__fwalk'
19751 d_access='$d_access'
19752 d_accessx='$d_accessx'
19753 d_alarm='$d_alarm'
19754 d_archlib='$d_archlib'
19755 d_asctime_r='$d_asctime_r'
19756 d_atolf='$d_atolf'
19757 d_atoll='$d_atoll'
19758 d_attribut='$d_attribut'
19759 d_bcmp='$d_bcmp'
19760 d_bcopy='$d_bcopy'
19761 d_bsd='$d_bsd'
19762 d_bsdgetpgrp='$d_bsdgetpgrp'
19763 d_bsdsetpgrp='$d_bsdsetpgrp'
19764 d_bzero='$d_bzero'
19765 d_casti32='$d_casti32'
19766 d_castneg='$d_castneg'
19767 d_charvspr='$d_charvspr'
19768 d_chown='$d_chown'
19769 d_chroot='$d_chroot'
19770 d_chsize='$d_chsize'
19771 d_class='$d_class'
19772 d_closedir='$d_closedir'
19773 d_cmsghdr_s='$d_cmsghdr_s'
19774 d_const='$d_const'
19775 d_crypt='$d_crypt'
19776 d_crypt_r='$d_crypt_r'
19777 d_csh='$d_csh'
19778 d_ctermid_r='$d_ctermid_r'
19779 d_ctime_r='$d_ctime_r'
19780 d_cuserid='$d_cuserid'
19781 d_dbl_dig='$d_dbl_dig'
19782 d_dbminitproto='$d_dbminitproto'
19783 d_difftime='$d_difftime'
19784 d_dirfd='$d_dirfd'
19785 d_dirnamlen='$d_dirnamlen'
19786 d_dlerror='$d_dlerror'
19787 d_dlopen='$d_dlopen'
19788 d_dlsymun='$d_dlsymun'
19789 d_dosuid='$d_dosuid'
19790 d_drand48_r='$d_drand48_r'
19791 d_drand48proto='$d_drand48proto'
19792 d_dup2='$d_dup2'
19793 d_eaccess='$d_eaccess'
19794 d_endgrent='$d_endgrent'
19795 d_endgrent_r='$d_endgrent_r'
19796 d_endhent='$d_endhent'
19797 d_endhostent_r='$d_endhostent_r'
19798 d_endnent='$d_endnent'
19799 d_endnetent_r='$d_endnetent_r'
19800 d_endpent='$d_endpent'
19801 d_endprotoent_r='$d_endprotoent_r'
19802 d_endpwent='$d_endpwent'
19803 d_endpwent_r='$d_endpwent_r'
19804 d_endsent='$d_endsent'
19805 d_endservent_r='$d_endservent_r'
19806 d_eofnblk='$d_eofnblk'
19807 d_eunice='$d_eunice'
19808 d_fchdir='$d_fchdir'
19809 d_fchmod='$d_fchmod'
19810 d_fchown='$d_fchown'
19811 d_fcntl='$d_fcntl'
19812 d_fcntl_can_lock='$d_fcntl_can_lock'
19813 d_fd_macros='$d_fd_macros'
19814 d_fd_set='$d_fd_set'
19815 d_fds_bits='$d_fds_bits'
19816 d_fgetpos='$d_fgetpos'
19817 d_finite='$d_finite'
19818 d_finitel='$d_finitel'
19819 d_flexfnam='$d_flexfnam'
19820 d_flock='$d_flock'
19821 d_flockproto='$d_flockproto'
19822 d_fork='$d_fork'
19823 d_fp_class='$d_fp_class'
19824 d_fpathconf='$d_fpathconf'
19825 d_fpclass='$d_fpclass'
19826 d_fpclassify='$d_fpclassify'
19827 d_fpclassl='$d_fpclassl'
19828 d_fpos64_t='$d_fpos64_t'
19829 d_frexpl='$d_frexpl'
19830 d_fs_data_s='$d_fs_data_s'
19831 d_fseeko='$d_fseeko'
19832 d_fsetpos='$d_fsetpos'
19833 d_fstatfs='$d_fstatfs'
19834 d_fstatvfs='$d_fstatvfs'
19835 d_fsync='$d_fsync'
19836 d_ftello='$d_ftello'
19837 d_ftime='$d_ftime'
19838 d_getcwd='$d_getcwd'
19839 d_getespwnam='$d_getespwnam'
19840 d_getfsstat='$d_getfsstat'
19841 d_getgrent='$d_getgrent'
19842 d_getgrent_r='$d_getgrent_r'
19843 d_getgrgid_r='$d_getgrgid_r'
19844 d_getgrnam_r='$d_getgrnam_r'
19845 d_getgrps='$d_getgrps'
19846 d_gethbyaddr='$d_gethbyaddr'
19847 d_gethbyname='$d_gethbyname'
19848 d_gethent='$d_gethent'
19849 d_gethname='$d_gethname'
19850 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19851 d_gethostbyname_r='$d_gethostbyname_r'
19852 d_gethostent_r='$d_gethostent_r'
19853 d_gethostprotos='$d_gethostprotos'
19854 d_getitimer='$d_getitimer'
19855 d_getlogin='$d_getlogin'
19856 d_getlogin_r='$d_getlogin_r'
19857 d_getmnt='$d_getmnt'
19858 d_getmntent='$d_getmntent'
19859 d_getnbyaddr='$d_getnbyaddr'
19860 d_getnbyname='$d_getnbyname'
19861 d_getnent='$d_getnent'
19862 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19863 d_getnetbyname_r='$d_getnetbyname_r'
19864 d_getnetent_r='$d_getnetent_r'
19865 d_getnetprotos='$d_getnetprotos'
19866 d_getpagsz='$d_getpagsz'
19867 d_getpbyname='$d_getpbyname'
19868 d_getpbynumber='$d_getpbynumber'
19869 d_getpent='$d_getpent'
19870 d_getpgid='$d_getpgid'
19871 d_getpgrp2='$d_getpgrp2'
19872 d_getpgrp='$d_getpgrp'
19873 d_getppid='$d_getppid'
19874 d_getprior='$d_getprior'
19875 d_getprotobyname_r='$d_getprotobyname_r'
19876 d_getprotobynumber_r='$d_getprotobynumber_r'
19877 d_getprotoent_r='$d_getprotoent_r'
19878 d_getprotoprotos='$d_getprotoprotos'
19879 d_getprpwnam='$d_getprpwnam'
19880 d_getpwent='$d_getpwent'
19881 d_getpwent_r='$d_getpwent_r'
19882 d_getpwnam_r='$d_getpwnam_r'
19883 d_getpwuid_r='$d_getpwuid_r'
19884 d_getsbyname='$d_getsbyname'
19885 d_getsbyport='$d_getsbyport'
19886 d_getsent='$d_getsent'
19887 d_getservbyname_r='$d_getservbyname_r'
19888 d_getservbyport_r='$d_getservbyport_r'
19889 d_getservent_r='$d_getservent_r'
19890 d_getservprotos='$d_getservprotos'
19891 d_getspnam='$d_getspnam'
19892 d_getspnam_r='$d_getspnam_r'
19893 d_gettimeod='$d_gettimeod'
19894 d_gmtime_r='$d_gmtime_r'
19895 d_gnulibc='$d_gnulibc'
19896 d_grpasswd='$d_grpasswd'
19897 d_hasmntopt='$d_hasmntopt'
19898 d_htonl='$d_htonl'
19899 d_index='$d_index'
19900 d_inetaton='$d_inetaton'
19901 d_int64_t='$d_int64_t'
19902 d_isascii='$d_isascii'
19903 d_isfinite='$d_isfinite'
19904 d_isinf='$d_isinf'
19905 d_isnan='$d_isnan'
19906 d_isnanl='$d_isnanl'
19907 d_killpg='$d_killpg'
19908 d_lchown='$d_lchown'
19909 d_ldbl_dig='$d_ldbl_dig'
19910 d_link='$d_link'
19911 d_localtime_r='$d_localtime_r'
19912 d_locconv='$d_locconv'
19913 d_lockf='$d_lockf'
19914 d_longdbl='$d_longdbl'
19915 d_longlong='$d_longlong'
19916 d_lseekproto='$d_lseekproto'
19917 d_lstat='$d_lstat'
19918 d_madvise='$d_madvise'
19919 d_mblen='$d_mblen'
19920 d_mbstowcs='$d_mbstowcs'
19921 d_mbtowc='$d_mbtowc'
19922 d_memchr='$d_memchr'
19923 d_memcmp='$d_memcmp'
19924 d_memcpy='$d_memcpy'
19925 d_memmove='$d_memmove'
19926 d_memset='$d_memset'
19927 d_mkdir='$d_mkdir'
19928 d_mkdtemp='$d_mkdtemp'
19929 d_mkfifo='$d_mkfifo'
19930 d_mkstemp='$d_mkstemp'
19931 d_mkstemps='$d_mkstemps'
19932 d_mktime='$d_mktime'
19933 d_mmap='$d_mmap'
19934 d_modfl='$d_modfl'
19935 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19936 d_mprotect='$d_mprotect'
19937 d_msg='$d_msg'
19938 d_msg_ctrunc='$d_msg_ctrunc'
19939 d_msg_dontroute='$d_msg_dontroute'
19940 d_msg_oob='$d_msg_oob'
19941 d_msg_peek='$d_msg_peek'
19942 d_msg_proxy='$d_msg_proxy'
19943 d_msgctl='$d_msgctl'
19944 d_msgget='$d_msgget'
19945 d_msghdr_s='$d_msghdr_s'
19946 d_msgrcv='$d_msgrcv'
19947 d_msgsnd='$d_msgsnd'
19948 d_msync='$d_msync'
19949 d_munmap='$d_munmap'
19950 d_mymalloc='$d_mymalloc'
19951 d_nice='$d_nice'
19952 d_nl_langinfo='$d_nl_langinfo'
19953 d_nv_preserves_uv='$d_nv_preserves_uv'
19954 d_off64_t='$d_off64_t'
19955 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19956 d_oldpthreads='$d_oldpthreads'
19957 d_oldsock='$d_oldsock'
19958 d_open3='$d_open3'
19959 d_pathconf='$d_pathconf'
19960 d_pause='$d_pause'
19961 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19962 d_phostname='$d_phostname'
19963 d_pipe='$d_pipe'
19964 d_poll='$d_poll'
19965 d_portable='$d_portable'
19966 d_procselfexe='$d_procselfexe'
19967 d_pthread_atfork='$d_pthread_atfork'
19968 d_pthread_yield='$d_pthread_yield'
19969 d_pwage='$d_pwage'
19970 d_pwchange='$d_pwchange'
19971 d_pwclass='$d_pwclass'
19972 d_pwcomment='$d_pwcomment'
19973 d_pwexpire='$d_pwexpire'
19974 d_pwgecos='$d_pwgecos'
19975 d_pwpasswd='$d_pwpasswd'
19976 d_pwquota='$d_pwquota'
19977 d_qgcvt='$d_qgcvt'
19978 d_quad='$d_quad'
19979 d_random_r='$d_random_r'
19980 d_readdir64_r='$d_readdir64_r'
19981 d_readdir='$d_readdir'
19982 d_readdir_r='$d_readdir_r'
19983 d_readlink='$d_readlink'
19984 d_readv='$d_readv'
19985 d_recvmsg='$d_recvmsg'
19986 d_rename='$d_rename'
19987 d_rewinddir='$d_rewinddir'
19988 d_rmdir='$d_rmdir'
19989 d_safebcpy='$d_safebcpy'
19990 d_safemcpy='$d_safemcpy'
19991 d_sanemcmp='$d_sanemcmp'
19992 d_sbrkproto='$d_sbrkproto'
19993 d_sched_yield='$d_sched_yield'
19994 d_scm_rights='$d_scm_rights'
19995 d_seekdir='$d_seekdir'
19996 d_select='$d_select'
19997 d_sem='$d_sem'
19998 d_semctl='$d_semctl'
19999 d_semctl_semid_ds='$d_semctl_semid_ds'
20000 d_semctl_semun='$d_semctl_semun'
20001 d_semget='$d_semget'
20002 d_semop='$d_semop'
20003 d_sendmsg='$d_sendmsg'
20004 d_setegid='$d_setegid'
20005 d_seteuid='$d_seteuid'
20006 d_setgrent='$d_setgrent'
20007 d_setgrent_r='$d_setgrent_r'
20008 d_setgrps='$d_setgrps'
20009 d_sethent='$d_sethent'
20010 d_sethostent_r='$d_sethostent_r'
20011 d_setitimer='$d_setitimer'
20012 d_setlinebuf='$d_setlinebuf'
20013 d_setlocale='$d_setlocale'
20014 d_setlocale_r='$d_setlocale_r'
20015 d_setnent='$d_setnent'
20016 d_setnetent_r='$d_setnetent_r'
20017 d_setpent='$d_setpent'
20018 d_setpgid='$d_setpgid'
20019 d_setpgrp2='$d_setpgrp2'
20020 d_setpgrp='$d_setpgrp'
20021 d_setprior='$d_setprior'
20022 d_setproctitle='$d_setproctitle'
20023 d_setprotoent_r='$d_setprotoent_r'
20024 d_setpwent='$d_setpwent'
20025 d_setpwent_r='$d_setpwent_r'
20026 d_setregid='$d_setregid'
20027 d_setresgid='$d_setresgid'
20028 d_setresuid='$d_setresuid'
20029 d_setreuid='$d_setreuid'
20030 d_setrgid='$d_setrgid'
20031 d_setruid='$d_setruid'
20032 d_setsent='$d_setsent'
20033 d_setservent_r='$d_setservent_r'
20034 d_setsid='$d_setsid'
20035 d_setvbuf='$d_setvbuf'
20036 d_sfio='$d_sfio'
20037 d_shm='$d_shm'
20038 d_shmat='$d_shmat'
20039 d_shmatprototype='$d_shmatprototype'
20040 d_shmctl='$d_shmctl'
20041 d_shmdt='$d_shmdt'
20042 d_shmget='$d_shmget'
20043 d_sigaction='$d_sigaction'
20044 d_sigprocmask='$d_sigprocmask'
20045 d_sigsetjmp='$d_sigsetjmp'
20046 d_sockatmark='$d_sockatmark'
20047 d_sockatmarkproto='$d_sockatmarkproto'
20048 d_socket='$d_socket'
20049 d_socklen_t='$d_socklen_t'
20050 d_sockpair='$d_sockpair'
20051 d_socks5_init='$d_socks5_init'
20052 d_sqrtl='$d_sqrtl'
20053 d_srand48_r='$d_srand48_r'
20054 d_srandom_r='$d_srandom_r'
20055 d_sresgproto='$d_sresgproto'
20056 d_sresuproto='$d_sresuproto'
20057 d_statblks='$d_statblks'
20058 d_statfs_f_flags='$d_statfs_f_flags'
20059 d_statfs_s='$d_statfs_s'
20060 d_statvfs='$d_statvfs'
20061 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20062 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20063 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20064 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20065 d_stdio_stream_array='$d_stdio_stream_array'
20066 d_stdiobase='$d_stdiobase'
20067 d_stdstdio='$d_stdstdio'
20068 d_strchr='$d_strchr'
20069 d_strcoll='$d_strcoll'
20070 d_strctcpy='$d_strctcpy'
20071 d_strerrm='$d_strerrm'
20072 d_strerror='$d_strerror'
20073 d_strerror_r='$d_strerror_r'
20074 d_strftime='$d_strftime'
20075 d_strtod='$d_strtod'
20076 d_strtol='$d_strtol'
20077 d_strtold='$d_strtold'
20078 d_strtoll='$d_strtoll'
20079 d_strtoq='$d_strtoq'
20080 d_strtoul='$d_strtoul'
20081 d_strtoull='$d_strtoull'
20082 d_strtouq='$d_strtouq'
20083 d_strxfrm='$d_strxfrm'
20084 d_suidsafe='$d_suidsafe'
20085 d_symlink='$d_symlink'
20086 d_syscall='$d_syscall'
20087 d_syscallproto='$d_syscallproto'
20088 d_sysconf='$d_sysconf'
20089 d_sysernlst='$d_sysernlst'
20090 d_syserrlst='$d_syserrlst'
20091 d_system='$d_system'
20092 d_tcgetpgrp='$d_tcgetpgrp'
20093 d_tcsetpgrp='$d_tcsetpgrp'
20094 d_telldir='$d_telldir'
20095 d_telldirproto='$d_telldirproto'
20096 d_time='$d_time'
20097 d_times='$d_times'
20098 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20099 d_tm_tm_zone='$d_tm_tm_zone'
20100 d_tmpnam_r='$d_tmpnam_r'
20101 d_truncate='$d_truncate'
20102 d_ttyname_r='$d_ttyname_r'
20103 d_tzname='$d_tzname'
20104 d_u32align='$d_u32align'
20105 d_ualarm='$d_ualarm'
20106 d_umask='$d_umask'
20107 d_uname='$d_uname'
20108 d_union_semun='$d_union_semun'
20109 d_unordered='$d_unordered'
20110 d_usleep='$d_usleep'
20111 d_usleepproto='$d_usleepproto'
20112 d_ustat='$d_ustat'
20113 d_vendorarch='$d_vendorarch'
20114 d_vendorbin='$d_vendorbin'
20115 d_vendorlib='$d_vendorlib'
20116 d_vfork='$d_vfork'
20117 d_void_closedir='$d_void_closedir'
20118 d_voidsig='$d_voidsig'
20119 d_voidtty='$d_voidtty'
20120 d_volatile='$d_volatile'
20121 d_vprintf='$d_vprintf'
20122 d_wait4='$d_wait4'
20123 d_waitpid='$d_waitpid'
20124 d_wcstombs='$d_wcstombs'
20125 d_wctomb='$d_wctomb'
20126 d_writev='$d_writev'
20127 d_xenix='$d_xenix'
20128 date='$date'
20129 db_hashtype='$db_hashtype'
20130 db_prefixtype='$db_prefixtype'
20131 db_version_major='$db_version_major'
20132 db_version_minor='$db_version_minor'
20133 db_version_patch='$db_version_patch'
20134 defvoidused='$defvoidused'
20135 direntrytype='$direntrytype'
20136 dlext='$dlext'
20137 dlsrc='$dlsrc'
20138 doublesize='$doublesize'
20139 drand01='$drand01'
20140 drand48_r_proto='$drand48_r_proto'
20141 dynamic_ext='$dynamic_ext'
20142 eagain='$eagain'
20143 ebcdic='$ebcdic'
20144 echo='$echo'
20145 egrep='$egrep'
20146 emacs='$emacs'
20147 endgrent_r_proto='$endgrent_r_proto'
20148 endhostent_r_proto='$endhostent_r_proto'
20149 endnetent_r_proto='$endnetent_r_proto'
20150 endprotoent_r_proto='$endprotoent_r_proto'
20151 endpwent_r_proto='$endpwent_r_proto'
20152 endservent_r_proto='$endservent_r_proto'
20153 eunicefix='$eunicefix'
20154 exe_ext='$exe_ext'
20155 expr='$expr'
20156 extensions='$extensions'
20157 extras='$extras'
20158 fflushNULL='$fflushNULL'
20159 fflushall='$fflushall'
20160 find='$find'
20161 firstmakefile='$firstmakefile'
20162 flex='$flex'
20163 fpossize='$fpossize'
20164 fpostype='$fpostype'
20165 freetype='$freetype'
20166 from='$from'
20167 full_ar='$full_ar'
20168 full_csh='$full_csh'
20169 full_sed='$full_sed'
20170 gccosandvers='$gccosandvers'
20171 gccversion='$gccversion'
20172 getgrent_r_proto='$getgrent_r_proto'
20173 getgrgid_r_proto='$getgrgid_r_proto'
20174 getgrnam_r_proto='$getgrnam_r_proto'
20175 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20176 gethostbyname_r_proto='$gethostbyname_r_proto'
20177 gethostent_r_proto='$gethostent_r_proto'
20178 getlogin_r_proto='$getlogin_r_proto'
20179 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20180 getnetbyname_r_proto='$getnetbyname_r_proto'
20181 getnetent_r_proto='$getnetent_r_proto'
20182 getprotobyname_r_proto='$getprotobyname_r_proto'
20183 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20184 getprotoent_r_proto='$getprotoent_r_proto'
20185 getpwent_r_proto='$getpwent_r_proto'
20186 getpwnam_r_proto='$getpwnam_r_proto'
20187 getpwuid_r_proto='$getpwuid_r_proto'
20188 getservbyname_r_proto='$getservbyname_r_proto'
20189 getservbyport_r_proto='$getservbyport_r_proto'
20190 getservent_r_proto='$getservent_r_proto'
20191 getspnam_r_proto='$getspnam_r_proto'
20192 gidformat='$gidformat'
20193 gidsign='$gidsign'
20194 gidsize='$gidsize'
20195 gidtype='$gidtype'
20196 glibpth='$glibpth'
20197 gmake='$gmake'
20198 gmtime_r_proto='$gmtime_r_proto'
20199 gnulibc_version='$gnulibc_version'
20200 grep='$grep'
20201 groupcat='$groupcat'
20202 groupstype='$groupstype'
20203 gzip='$gzip'
20204 h_fcntl='$h_fcntl'
20205 h_sysfile='$h_sysfile'
20206 hint='$hint'
20207 hostcat='$hostcat'
20208 i16size='$i16size'
20209 i16type='$i16type'
20210 i32size='$i32size'
20211 i32type='$i32type'
20212 i64size='$i64size'
20213 i64type='$i64type'
20214 i8size='$i8size'
20215 i8type='$i8type'
20216 i_arpainet='$i_arpainet'
20217 i_bsdioctl='$i_bsdioctl'
20218 i_crypt='$i_crypt'
20219 i_db='$i_db'
20220 i_dbm='$i_dbm'
20221 i_dirent='$i_dirent'
20222 i_dld='$i_dld'
20223 i_dlfcn='$i_dlfcn'
20224 i_fcntl='$i_fcntl'
20225 i_float='$i_float'
20226 i_fp='$i_fp'
20227 i_fp_class='$i_fp_class'
20228 i_gdbm='$i_gdbm'
20229 i_grp='$i_grp'
20230 i_ieeefp='$i_ieeefp'
20231 i_inttypes='$i_inttypes'
20232 i_langinfo='$i_langinfo'
20233 i_libutil='$i_libutil'
20234 i_limits='$i_limits'
20235 i_locale='$i_locale'
20236 i_machcthr='$i_machcthr'
20237 i_malloc='$i_malloc'
20238 i_math='$i_math'
20239 i_memory='$i_memory'
20240 i_mntent='$i_mntent'
20241 i_ndbm='$i_ndbm'
20242 i_netdb='$i_netdb'
20243 i_neterrno='$i_neterrno'
20244 i_netinettcp='$i_netinettcp'
20245 i_niin='$i_niin'
20246 i_poll='$i_poll'
20247 i_prot='$i_prot'
20248 i_pthread='$i_pthread'
20249 i_pwd='$i_pwd'
20250 i_rpcsvcdbm='$i_rpcsvcdbm'
20251 i_sfio='$i_sfio'
20252 i_sgtty='$i_sgtty'
20253 i_shadow='$i_shadow'
20254 i_socks='$i_socks'
20255 i_stdarg='$i_stdarg'
20256 i_stddef='$i_stddef'
20257 i_stdlib='$i_stdlib'
20258 i_string='$i_string'
20259 i_sunmath='$i_sunmath'
20260 i_sysaccess='$i_sysaccess'
20261 i_sysdir='$i_sysdir'
20262 i_sysfile='$i_sysfile'
20263 i_sysfilio='$i_sysfilio'
20264 i_sysin='$i_sysin'
20265 i_sysioctl='$i_sysioctl'
20266 i_syslog='$i_syslog'
20267 i_sysmman='$i_sysmman'
20268 i_sysmode='$i_sysmode'
20269 i_sysmount='$i_sysmount'
20270 i_sysndir='$i_sysndir'
20271 i_sysparam='$i_sysparam'
20272 i_sysresrc='$i_sysresrc'
20273 i_syssecrt='$i_syssecrt'
20274 i_sysselct='$i_sysselct'
20275 i_syssockio='$i_syssockio'
20276 i_sysstat='$i_sysstat'
20277 i_sysstatfs='$i_sysstatfs'
20278 i_sysstatvfs='$i_sysstatvfs'
20279 i_systime='$i_systime'
20280 i_systimek='$i_systimek'
20281 i_systimes='$i_systimes'
20282 i_systypes='$i_systypes'
20283 i_sysuio='$i_sysuio'
20284 i_sysun='$i_sysun'
20285 i_sysutsname='$i_sysutsname'
20286 i_sysvfs='$i_sysvfs'
20287 i_syswait='$i_syswait'
20288 i_termio='$i_termio'
20289 i_termios='$i_termios'
20290 i_time='$i_time'
20291 i_unistd='$i_unistd'
20292 i_ustat='$i_ustat'
20293 i_utime='$i_utime'
20294 i_values='$i_values'
20295 i_varargs='$i_varargs'
20296 i_varhdr='$i_varhdr'
20297 i_vfork='$i_vfork'
20298 ignore_versioned_solibs='$ignore_versioned_solibs'
20299 inc_version_list='$inc_version_list'
20300 inc_version_list_init='$inc_version_list_init'
20301 incpath='$incpath'
20302 inews='$inews'
20303 installarchlib='$installarchlib'
20304 installbin='$installbin'
20305 installman1dir='$installman1dir'
20306 installman3dir='$installman3dir'
20307 installprefix='$installprefix'
20308 installprefixexp='$installprefixexp'
20309 installprivlib='$installprivlib'
20310 installscript='$installscript'
20311 installsitearch='$installsitearch'
20312 installsitebin='$installsitebin'
20313 installsitelib='$installsitelib'
20314 installstyle='$installstyle'
20315 installusrbinperl='$installusrbinperl'
20316 installvendorarch='$installvendorarch'
20317 installvendorbin='$installvendorbin'
20318 installvendorlib='$installvendorlib'
20319 intsize='$intsize'
20320 issymlink='$issymlink'
20321 ivdformat='$ivdformat'
20322 ivsize='$ivsize'
20323 ivtype='$ivtype'
20324 known_extensions='$known_extensions'
20325 ksh='$ksh'
20326 ld='$ld'
20327 lddlflags='$lddlflags'
20328 ldflags='$ldflags'
20329 ldflags_uselargefiles='$ldflags_uselargefiles'
20330 ldlibpthname='$ldlibpthname'
20331 less='$less'
20332 lib_ext='$lib_ext'
20333 libc='$libc'
20334 libperl='$libperl'
20335 libpth='$libpth'
20336 libs='$libs'
20337 libsdirs='$libsdirs'
20338 libsfiles='$libsfiles'
20339 libsfound='$libsfound'
20340 libspath='$libspath'
20341 libswanted='$libswanted'
20342 libswanted_uselargefiles='$libswanted_uselargefiles'
20343 line='$line'
20344 lint='$lint'
20345 lkflags='$lkflags'
20346 ln='$ln'
20347 lns='$lns'
20348 localtime_r_proto='$localtime_r_proto'
20349 locincpth='$locincpth'
20350 loclibpth='$loclibpth'
20351 longdblsize='$longdblsize'
20352 longlongsize='$longlongsize'
20353 longsize='$longsize'
20354 lp='$lp'
20355 lpr='$lpr'
20356 ls='$ls'
20357 lseeksize='$lseeksize'
20358 lseektype='$lseektype'
20359 mail='$mail'
20360 mailx='$mailx'
20361 make='$make'
20362 make_set_make='$make_set_make'
20363 mallocobj='$mallocobj'
20364 mallocsrc='$mallocsrc'
20365 malloctype='$malloctype'
20366 man1dir='$man1dir'
20367 man1direxp='$man1direxp'
20368 man1ext='$man1ext'
20369 man3dir='$man3dir'
20370 man3direxp='$man3direxp'
20371 man3ext='$man3ext'
20372 mips_type='$mips_type'
20373 mkdir='$mkdir'
20374 mmaptype='$mmaptype'
20375 modetype='$modetype'
20376 more='$more'
20377 multiarch='$multiarch'
20378 mv='$mv'
20379 myarchname='$myarchname'
20380 mydomain='$mydomain'
20381 myhostname='$myhostname'
20382 myuname='$myuname'
20383 n='$n'
20384 need_va_copy='$need_va_copy'
20385 netdb_hlen_type='$netdb_hlen_type'
20386 netdb_host_type='$netdb_host_type'
20387 netdb_name_type='$netdb_name_type'
20388 netdb_net_type='$netdb_net_type'
20389 nm='$nm'
20390 nm_opt='$nm_opt'
20391 nm_so_opt='$nm_so_opt'
20392 nonxs_ext='$nonxs_ext'
20393 nroff='$nroff'
20394 nvEUformat='$nvEUformat'
20395 nvFUformat='$nvFUformat'
20396 nvGUformat='$nvGUformat'
20397 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20398 nveformat='$nveformat'
20399 nvfformat='$nvfformat'
20400 nvgformat='$nvgformat'
20401 nvsize='$nvsize'
20402 nvtype='$nvtype'
20403 o_nonblock='$o_nonblock'
20404 obj_ext='$obj_ext'
20405 old_pthread_create_joinable='$old_pthread_create_joinable'
20406 optimize='$optimize'
20407 orderlib='$orderlib'
20408 osname='$osname'
20409 osvers='$osvers'
20410 otherlibdirs='$otherlibdirs'
20411 package='$package'
20412 pager='$pager'
20413 passcat='$passcat'
20414 patchlevel='$patchlevel'
20415 path_sep='$path_sep'
20416 perl5='$perl5'
20417 perl='$perl'
20418 perl_patchlevel='$perl_patchlevel'
20419 perladmin='$perladmin'
20420 perllibs='$perllibs'
20421 perlpath='$perlpath'
20422 pg='$pg'
20423 phostname='$phostname'
20424 pidtype='$pidtype'
20425 plibpth='$plibpth'
20426 pm_apiversion='$pm_apiversion'
20427 pmake='$pmake'
20428 pr='$pr'
20429 prefix='$prefix'
20430 prefixexp='$prefixexp'
20431 privlib='$privlib'
20432 privlibexp='$privlibexp'
20433 procselfexe='$procselfexe'
20434 prototype='$prototype'
20435 ptrsize='$ptrsize'
20436 quadkind='$quadkind'
20437 quadtype='$quadtype'
20438 randbits='$randbits'
20439 randfunc='$randfunc'
20440 random_r_proto='$random_r_proto'
20441 randseedtype='$randseedtype'
20442 ranlib='$ranlib'
20443 rd_nodata='$rd_nodata'
20444 readdir64_r_proto='$readdir64_r_proto'
20445 readdir_r_proto='$readdir_r_proto'
20446 revision='$revision'
20447 rm='$rm'
20448 rmail='$rmail'
20449 run='$run'
20450 runnm='$runnm'
20451 sPRIEUldbl='$sPRIEUldbl'
20452 sPRIFUldbl='$sPRIFUldbl'
20453 sPRIGUldbl='$sPRIGUldbl'
20454 sPRIXU64='$sPRIXU64'
20455 sPRId64='$sPRId64'
20456 sPRIeldbl='$sPRIeldbl'
20457 sPRIfldbl='$sPRIfldbl'
20458 sPRIgldbl='$sPRIgldbl'
20459 sPRIi64='$sPRIi64'
20460 sPRIo64='$sPRIo64'
20461 sPRIu64='$sPRIu64'
20462 sPRIx64='$sPRIx64'
20463 sSCNfldbl='$sSCNfldbl'
20464 sched_yield='$sched_yield'
20465 scriptdir='$scriptdir'
20466 scriptdirexp='$scriptdirexp'
20467 sed='$sed'
20468 seedfunc='$seedfunc'
20469 selectminbits='$selectminbits'
20470 selecttype='$selecttype'
20471 sendmail='$sendmail'
20472 setgrent_r_proto='$setgrent_r_proto'
20473 sethostent_r_proto='$sethostent_r_proto'
20474 setlocale_r_proto='$setlocale_r_proto'
20475 setnetent_r_proto='$setnetent_r_proto'
20476 setprotoent_r_proto='$setprotoent_r_proto'
20477 setpwent_r_proto='$setpwent_r_proto'
20478 setservent_r_proto='$setservent_r_proto'
20479 sh='$sh'
20480 shar='$shar'
20481 sharpbang='$sharpbang'
20482 shmattype='$shmattype'
20483 shortsize='$shortsize'
20484 shrpenv='$shrpenv'
20485 shsharp='$shsharp'
20486 sig_count='$sig_count'
20487 sig_name='$sig_name'
20488 sig_name_init='$sig_name_init'
20489 sig_num='$sig_num'
20490 sig_num_init='$sig_num_init'
20491 sig_size='$sig_size'
20492 signal_t='$signal_t'
20493 sitearch='$sitearch'
20494 sitearchexp='$sitearchexp'
20495 sitebin='$sitebin'
20496 sitebinexp='$sitebinexp'
20497 sitelib='$sitelib'
20498 sitelib_stem='$sitelib_stem'
20499 sitelibexp='$sitelibexp'
20500 siteprefix='$siteprefix'
20501 siteprefixexp='$siteprefixexp'
20502 sizesize='$sizesize'
20503 sizetype='$sizetype'
20504 sleep='$sleep'
20505 smail='$smail'
20506 so='$so'
20507 sockethdr='$sockethdr'
20508 socketlib='$socketlib'
20509 socksizetype='$socksizetype'
20510 sort='$sort'
20511 spackage='$spackage'
20512 spitshell='$spitshell'
20513 srand48_r_proto='$srand48_r_proto'
20514 srandom_r_proto='$srandom_r_proto'
20515 src='$src'
20516 ssizetype='$ssizetype'
20517 startperl='$startperl'
20518 startsh='$startsh'
20519 static_ext='$static_ext'
20520 stdchar='$stdchar'
20521 stdio_base='$stdio_base'
20522 stdio_bufsiz='$stdio_bufsiz'
20523 stdio_cnt='$stdio_cnt'
20524 stdio_filbuf='$stdio_filbuf'
20525 stdio_ptr='$stdio_ptr'
20526 stdio_stream_array='$stdio_stream_array'
20527 strerror_r_proto='$strerror_r_proto'
20528 strings='$strings'
20529 submit='$submit'
20530 subversion='$subversion'
20531 sysman='$sysman'
20532 tail='$tail'
20533 tar='$tar'
20534 targetarch='$targetarch'
20535 tbl='$tbl'
20536 tee='$tee'
20537 test='$test'
20538 timeincl='$timeincl'
20539 timetype='$timetype'
20540 tmpnam_r_proto='$tmpnam_r_proto'
20541 to='$to'
20542 touch='$touch'
20543 tr='$tr'
20544 trnl='$trnl'
20545 troff='$troff'
20546 ttyname_r_proto='$ttyname_r_proto'
20547 u16size='$u16size'
20548 u16type='$u16type'
20549 u32size='$u32size'
20550 u32type='$u32type'
20551 u64size='$u64size'
20552 u64type='$u64type'
20553 u8size='$u8size'
20554 u8type='$u8type'
20555 uidformat='$uidformat'
20556 uidsign='$uidsign'
20557 uidsize='$uidsize'
20558 uidtype='$uidtype'
20559 uname='$uname'
20560 uniq='$uniq'
20561 uquadtype='$uquadtype'
20562 use5005threads='$use5005threads'
20563 use64bitall='$use64bitall'
20564 use64bitint='$use64bitint'
20565 usecrosscompile='$usecrosscompile'
20566 usedl='$usedl'
20567 useithreads='$useithreads'
20568 uselargefiles='$uselargefiles'
20569 uselongdouble='$uselongdouble'
20570 usemorebits='$usemorebits'
20571 usemultiplicity='$usemultiplicity'
20572 usemymalloc='$usemymalloc'
20573 usenm='$usenm'
20574 useopcode='$useopcode'
20575 useperlio='$useperlio'
20576 useposix='$useposix'
20577 usereentrant='$usereentrant'
20578 usesfio='$usesfio'
20579 useshrplib='$useshrplib'
20580 usesocks='$usesocks'
20581 usethreads='$usethreads'
20582 usevendorprefix='$usevendorprefix'
20583 usevfork='$usevfork'
20584 usrinc='$usrinc'
20585 uuname='$uuname'
20586 uvXUformat='$uvXUformat'
20587 uvoformat='$uvoformat'
20588 uvsize='$uvsize'
20589 uvtype='$uvtype'
20590 uvuformat='$uvuformat'
20591 uvxformat='$uvxformat'
20592 vendorarch='$vendorarch'
20593 vendorarchexp='$vendorarchexp'
20594 vendorbin='$vendorbin'
20595 vendorbinexp='$vendorbinexp'
20596 vendorlib='$vendorlib'
20597 vendorlib_stem='$vendorlib_stem'
20598 vendorlibexp='$vendorlibexp'
20599 vendorprefix='$vendorprefix'
20600 vendorprefixexp='$vendorprefixexp'
20601 version='$version'
20602 version_patchlevel_string='$version_patchlevel_string'
20603 versiononly='$versiononly'
20604 vi='$vi'
20605 voidflags='$voidflags'
20606 xlibpth='$xlibpth'
20607 xs_apiversion='$xs_apiversion'
20608 yacc='$yacc'
20609 yaccflags='$yaccflags'
20610 zcat='$zcat'
20611 zip='$zip'
20612 EOT
20613
20614 : Add in command line options if available
20615 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20616
20617 : add special variables
20618 $test -f $src/patchlevel.h && \
20619 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20620 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20621 echo "PERL_CONFIG_SH=true" >>config.sh
20622
20623 : propagate old symbols
20624 if $test -f UU/config.sh; then
20625         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20626         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20627         $sort | $uniq -u >UU/oldsyms
20628         set X `cat UU/oldsyms`
20629         shift
20630         case $# in
20631         0) ;;
20632         *)
20633                 cat <<EOM
20634 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20635 EOM
20636                 echo "# Variables propagated from previous config.sh file." >>config.sh
20637                 for sym in `cat UU/oldsyms`; do
20638                         echo "    Propagating $hint variable "'$'"$sym..."
20639                         eval 'tmp="$'"${sym}"'"'
20640                         echo "$tmp" | \
20641                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20642                 done
20643                 ;;
20644         esac
20645 fi
20646
20647 : Finish up by extracting the .SH files
20648 case "$alldone" in
20649 exit)
20650         $rm -rf UU
20651         echo "Extraction done."
20652         exit 0
20653         ;;
20654 cont)
20655         ;;
20656 '')
20657         dflt=''
20658         nostick=true
20659         $cat <<EOM
20660
20661 If you'd like to make any changes to the config.sh file before I begin
20662 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20663
20664 EOM
20665         rp="Press return or use a shell escape to edit config.sh:"
20666         . UU/myread
20667         nostick=''
20668         case "$ans" in
20669         '') ;;
20670         *) : in case they cannot read
20671                 sh 1>&4 -c "$ans";;
20672         esac
20673         ;;
20674 esac
20675
20676 : if this fails, just run all the .SH files by hand
20677 . ./config.sh
20678
20679 echo " "
20680 exec 1>&4
20681 pwd=`pwd`
20682 . ./UU/extract
20683 cd "$pwd"
20684
20685 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20686         dflt=y
20687         case "$silent" in
20688         true) ;;
20689         *)
20690                 $cat <<EOM
20691
20692 Now you need to generate make dependencies by running "$make depend".
20693 You might prefer to run it in background: "$make depend > makedepend.out &"
20694 It can take a while, so you might not want to run it right now.
20695
20696 EOM
20697                 ;;
20698         esac
20699         rp="Run $make depend now?"
20700         . UU/myread
20701         case "$ans" in
20702         y*)
20703                 $make depend && echo "Now you must run '$make'."
20704                 ;;
20705         *)
20706                 echo "You must run '$make depend' then '$make'."
20707                 ;;
20708         esac
20709 elif test -f [Mm]akefile; then
20710         echo " "
20711         echo "Now you must run a $make."
20712 else
20713         echo "Configure done."
20714 fi
20715
20716 if $test -f Policy.sh; then
20717     $cat <<EOM
20718
20719 If you compile $package on a different machine or from a different object
20720 directory, copy the Policy.sh file from this object directory to the
20721 new one before you run Configure -- this will help you with most of
20722 the policy defaults.
20723
20724 EOM
20725 fi
20726 if $test -f config.msg; then
20727     echo "Hmm.  I also noted the following information while running:"
20728     echo " "
20729     $cat config.msg >&4
20730     $rm -f config.msg
20731 fi
20732 $rm -f kit*isdone ark*isdone
20733 $rm -rf UU
20734
20735 : End of Configure
20736