This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[patch] one more little step for WinCE
[perl5.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 May 16 17:03:39 EET DST 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 d_hasmntopt=''
499 d_htonl=''
500 d_inetaton=''
501 d_int64_t=''
502 d_isascii=''
503 d_isfinite=''
504 d_isinf=''
505 d_isnan=''
506 d_isnanl=''
507 d_killpg=''
508 d_lchown=''
509 d_ldbl_dig=''
510 d_link=''
511 d_localtime_r=''
512 localtime_r_proto=''
513 d_locconv=''
514 d_lockf=''
515 d_longdbl=''
516 longdblsize=''
517 d_longlong=''
518 longlongsize=''
519 d_lseekproto=''
520 d_lstat=''
521 d_madvise=''
522 d_mblen=''
523 d_mbstowcs=''
524 d_mbtowc=''
525 d_memchr=''
526 d_memcmp=''
527 d_memcpy=''
528 d_memmove=''
529 d_memset=''
530 d_mkdir=''
531 d_mkdtemp=''
532 d_mkfifo=''
533 d_mkstemp=''
534 d_mkstemps=''
535 d_mktime=''
536 d_mmap=''
537 mmaptype=''
538 d_modfl=''
539 d_modfl_pow32_bug=''
540 d_mprotect=''
541 d_msg=''
542 d_msgctl=''
543 d_msgget=''
544 d_msghdr_s=''
545 d_msgrcv=''
546 d_msgsnd=''
547 d_msync=''
548 d_munmap=''
549 d_nice=''
550 d_nl_langinfo=''
551 d_off64_t=''
552 d_open3=''
553 d_fpathconf=''
554 d_pathconf=''
555 d_pause=''
556 d_pipe=''
557 d_poll=''
558 d_portable=''
559 d_procselfexe=''
560 procselfexe=''
561 d_old_pthread_create_joinable=''
562 old_pthread_create_joinable=''
563 d_pthread_atfork=''
564 d_pthread_yield=''
565 d_sched_yield=''
566 sched_yield=''
567 d_qgcvt=''
568 d_random_r=''
569 random_r_proto=''
570 d_readdir64_r=''
571 readdir64_r_proto=''
572 d_readdir=''
573 d_rewinddir=''
574 d_seekdir=''
575 d_telldir=''
576 d_readdir_r=''
577 readdir_r_proto=''
578 d_readlink=''
579 d_readv=''
580 d_recvmsg=''
581 d_rename=''
582 d_rmdir=''
583 d_safebcpy=''
584 d_safemcpy=''
585 d_sanemcmp=''
586 d_sbrkproto=''
587 d_select=''
588 d_sem=''
589 d_semctl=''
590 d_semget=''
591 d_semop=''
592 d_sendmsg=''
593 d_setegid=''
594 d_seteuid=''
595 d_setgrent=''
596 d_setgrent_r=''
597 setgrent_r_proto=''
598 d_setgrps=''
599 d_sethent=''
600 d_sethostent_r=''
601 sethostent_r_proto=''
602 d_setitimer=''
603 d_setlinebuf=''
604 d_setlocale=''
605 d_setlocale_r=''
606 setlocale_r_proto=''
607 d_setnent=''
608 d_setnetent_r=''
609 setnetent_r_proto=''
610 d_setpent=''
611 d_setpgid=''
612 d_setpgrp2=''
613 d_bsdsetpgrp=''
614 d_setpgrp=''
615 d_setprior=''
616 d_setproctitle=''
617 d_setprotoent_r=''
618 setprotoent_r_proto=''
619 d_setpwent=''
620 d_setpwent_r=''
621 setpwent_r_proto=''
622 d_setregid=''
623 d_setresgid=''
624 d_setresuid=''
625 d_setreuid=''
626 d_setrgid=''
627 d_setruid=''
628 d_setsent=''
629 d_setservent_r=''
630 setservent_r_proto=''
631 d_setsid=''
632 d_setvbuf=''
633 d_sfio=''
634 usesfio=''
635 d_shm=''
636 d_shmat=''
637 d_shmatprototype=''
638 shmattype=''
639 d_shmctl=''
640 d_shmdt=''
641 d_shmget=''
642 d_sigaction=''
643 d_sigprocmask=''
644 d_sigsetjmp=''
645 d_sockatmark=''
646 d_sockatmarkproto=''
647 d_msg_ctrunc=''
648 d_msg_dontroute=''
649 d_msg_oob=''
650 d_msg_peek=''
651 d_msg_proxy=''
652 d_oldsock=''
653 d_scm_rights=''
654 d_socket=''
655 d_sockpair=''
656 sockethdr=''
657 socketlib=''
658 d_socklen_t=''
659 d_socks5_init=''
660 d_sqrtl=''
661 d_srand48_r=''
662 srand48_r_proto=''
663 d_srandom_r=''
664 srandom_r_proto=''
665 d_sresgproto=''
666 d_sresuproto=''
667 d_statblks=''
668 d_statfs_f_flags=''
669 d_statfs_s=''
670 d_fstatvfs=''
671 d_statvfs=''
672 d_stdio_cnt_lval=''
673 d_stdio_ptr_lval=''
674 d_stdio_ptr_lval_nochange_cnt=''
675 d_stdio_ptr_lval_sets_cnt=''
676 d_stdiobase=''
677 d_stdstdio=''
678 stdio_base=''
679 stdio_bufsiz=''
680 stdio_cnt=''
681 stdio_filbuf=''
682 stdio_ptr=''
683 d_index=''
684 d_strchr=''
685 d_strcoll=''
686 d_strctcpy=''
687 d_strerrm=''
688 d_strerror=''
689 d_sysernlst=''
690 d_syserrlst=''
691 d_strerror_r=''
692 strerror_r_proto=''
693 d_strftime=''
694 d_strtod=''
695 d_strtol=''
696 d_strtold=''
697 d_strtoll=''
698 d_strtoq=''
699 d_strtoul=''
700 d_strtoull=''
701 d_strtouq=''
702 d_strxfrm=''
703 d_symlink=''
704 d_syscall=''
705 d_syscallproto=''
706 d_sysconf=''
707 d_system=''
708 d_tcgetpgrp=''
709 d_tcsetpgrp=''
710 d_telldirproto=''
711 d_time=''
712 timetype=''
713 clocktype=''
714 d_times=''
715 d_tmpnam_r=''
716 tmpnam_r_proto=''
717 d_truncate=''
718 d_ttyname_r=''
719 ttyname_r_proto=''
720 d_tzname=''
721 d_u32align=''
722 d_ualarm=''
723 d_umask=''
724 d_semctl_semid_ds=''
725 d_semctl_semun=''
726 d_union_semun=''
727 d_unordered=''
728 d_usleep=''
729 d_usleepproto=''
730 d_ustat=''
731 d_vfork=''
732 usevfork=''
733 d_voidsig=''
734 signal_t=''
735 d_volatile=''
736 d_charvspr=''
737 d_vprintf=''
738 d_wait4=''
739 d_waitpid=''
740 d_wcstombs=''
741 d_wctomb=''
742 d_writev=''
743 dlext=''
744 cccdlflags=''
745 ccdlflags=''
746 dlsrc=''
747 ld=''
748 lddlflags=''
749 usedl=''
750 doublesize=''
751 ebcdic=''
752 fflushNULL=''
753 fflushall=''
754 fpossize=''
755 fpostype=''
756 gccosandvers=''
757 gccversion=''
758 gidformat=''
759 gidsign=''
760 gidsize=''
761 gidtype=''
762 groupstype=''
763 h_fcntl=''
764 h_sysfile=''
765 i_arpainet=''
766 i_crypt=''
767 db_hashtype=''
768 db_prefixtype=''
769 db_version_major=''
770 db_version_minor=''
771 db_version_patch=''
772 i_db=''
773 i_dbm=''
774 i_rpcsvcdbm=''
775 d_dirnamlen=''
776 direntrytype=''
777 i_dirent=''
778 i_dld=''
779 i_dlfcn=''
780 i_fcntl=''
781 i_float=''
782 i_fp=''
783 i_fp_class=''
784 i_gdbm=''
785 d_grpasswd=''
786 i_grp=''
787 i_ieeefp=''
788 i_inttypes=''
789 i_langinfo=''
790 i_libutil=''
791 i_limits=''
792 i_locale=''
793 i_machcthr=''
794 i_malloc=''
795 i_math=''
796 i_memory=''
797 i_mntent=''
798 i_ndbm=''
799 i_netdb=''
800 i_neterrno=''
801 i_netinettcp=''
802 i_niin=''
803 i_sysin=''
804 i_poll=''
805 i_prot=''
806 i_pthread=''
807 d_pwage=''
808 d_pwchange=''
809 d_pwclass=''
810 d_pwcomment=''
811 d_pwexpire=''
812 d_pwgecos=''
813 d_pwpasswd=''
814 d_pwquota=''
815 i_pwd=''
816 i_sfio=''
817 i_shadow=''
818 i_socks=''
819 i_stddef=''
820 i_stdlib=''
821 i_string=''
822 strings=''
823 i_sunmath=''
824 i_sysaccess=''
825 i_sysdir=''
826 i_sysfile=''
827 d_voidtty=''
828 i_bsdioctl=''
829 i_sysfilio=''
830 i_sysioctl=''
831 i_syssockio=''
832 i_syslog=''
833 i_sysmman=''
834 i_sysmode=''
835 i_sysmount=''
836 i_sysndir=''
837 i_sysparam=''
838 i_sysresrc=''
839 i_syssecrt=''
840 i_sysselct=''
841 i_sysstat=''
842 i_sysstatfs=''
843 i_sysstatvfs=''
844 i_systimes=''
845 i_systypes=''
846 i_sysuio=''
847 i_sysun=''
848 i_sysutsname=''
849 i_sysvfs=''
850 i_syswait=''
851 i_sgtty=''
852 i_termio=''
853 i_termios=''
854 d_tm_tm_gmtoff=''
855 d_tm_tm_zone=''
856 i_systime=''
857 i_systimek=''
858 i_time=''
859 timeincl=''
860 i_unistd=''
861 i_ustat=''
862 i_utime=''
863 i_values=''
864 i_stdarg=''
865 i_varargs=''
866 i_varhdr=''
867 i_vfork=''
868 inc_version_list=''
869 inc_version_list_init=''
870 installprefix=''
871 installprefixexp=''
872 installstyle=''
873 installusrbinperl=''
874 intsize=''
875 longsize=''
876 shortsize=''
877 issymlink=''
878 libc=''
879 ldlibpthname=''
880 libperl=''
881 shrpenv=''
882 useshrplib=''
883 glibpth=''
884 libpth=''
885 loclibpth=''
886 plibpth=''
887 xlibpth=''
888 ignore_versioned_solibs=''
889 libs=''
890 libsdirs=''
891 libsfiles=''
892 libsfound=''
893 libspath=''
894 lns=''
895 d_PRIEUldbl=''
896 d_PRIFUldbl=''
897 d_PRIGUldbl=''
898 d_PRIeldbl=''
899 d_PRIfldbl=''
900 d_PRIgldbl=''
901 d_SCNfldbl=''
902 sPRIEUldbl=''
903 sPRIFUldbl=''
904 sPRIGUldbl=''
905 sPRIeldbl=''
906 sPRIfldbl=''
907 sPRIgldbl=''
908 sSCNfldbl=''
909 lseeksize=''
910 lseektype=''
911 make_set_make=''
912 d_mymalloc=''
913 freetype=''
914 mallocobj=''
915 mallocsrc=''
916 malloctype=''
917 usemymalloc=''
918 installman1dir=''
919 man1dir=''
920 man1direxp=''
921 man1ext=''
922 installman3dir=''
923 man3dir=''
924 man3direxp=''
925 man3ext=''
926 modetype=''
927 multiarch=''
928 mydomain=''
929 myhostname=''
930 phostname=''
931 c=''
932 n=''
933 d_eofnblk=''
934 eagain=''
935 o_nonblock=''
936 rd_nodata=''
937 need_va_copy=''
938 netdb_hlen_type=''
939 netdb_host_type=''
940 netdb_name_type=''
941 netdb_net_type=''
942 groupcat=''
943 hostcat=''
944 passcat=''
945 orderlib=''
946 ranlib=''
947 d_perl_otherlibdirs=''
948 otherlibdirs=''
949 package=''
950 spackage=''
951 pager=''
952 api_revision=''
953 api_subversion=''
954 api_version=''
955 api_versionstring=''
956 patchlevel=''
957 perl_patchlevel=''
958 revision=''
959 subversion=''
960 version=''
961 version_patchlevel_string=''
962 perl5=''
963 perladmin=''
964 perlpath=''
965 d_nv_preserves_uv=''
966 i16size=''
967 i16type=''
968 i32size=''
969 i32type=''
970 i64size=''
971 i64type=''
972 i8size=''
973 i8type=''
974 ivsize=''
975 ivtype=''
976 nv_preserves_uv_bits=''
977 nvsize=''
978 nvtype=''
979 u16size=''
980 u16type=''
981 u32size=''
982 u32type=''
983 u64size=''
984 u64type=''
985 u8size=''
986 u8type=''
987 uvsize=''
988 uvtype=''
989 ivdformat=''
990 nvEUformat=''
991 nvFUformat=''
992 nvGUformat=''
993 nveformat=''
994 nvfformat=''
995 nvgformat=''
996 uvXUformat=''
997 uvoformat=''
998 uvuformat=''
999 uvxformat=''
1000 pidtype=''
1001 prefix=''
1002 prefixexp=''
1003 installprivlib=''
1004 privlib=''
1005 privlibexp=''
1006 prototype=''
1007 ptrsize=''
1008 d_PRIXU64=''
1009 d_PRId64=''
1010 d_PRIi64=''
1011 d_PRIo64=''
1012 d_PRIu64=''
1013 d_PRIx64=''
1014 sPRIXU64=''
1015 sPRId64=''
1016 sPRIi64=''
1017 sPRIo64=''
1018 sPRIu64=''
1019 sPRIx64=''
1020 d_quad=''
1021 quadkind=''
1022 quadtype=''
1023 uquadtype=''
1024 drand01=''
1025 randbits=''
1026 randfunc=''
1027 randseedtype=''
1028 seedfunc=''
1029 installscript=''
1030 scriptdir=''
1031 scriptdirexp=''
1032 selectminbits=''
1033 selecttype=''
1034 sh=''
1035 sig_count=''
1036 sig_name=''
1037 sig_name_init=''
1038 sig_num=''
1039 sig_num_init=''
1040 sig_size=''
1041 installsitearch=''
1042 sitearch=''
1043 sitearchexp=''
1044 installsitebin=''
1045 sitebin=''
1046 sitebinexp=''
1047 installsitelib=''
1048 sitelib=''
1049 sitelib_stem=''
1050 sitelibexp=''
1051 siteprefix=''
1052 siteprefixexp=''
1053 sizesize=''
1054 sizetype=''
1055 so=''
1056 socksizetype=''
1057 sharpbang=''
1058 shsharp=''
1059 spitshell=''
1060 src=''
1061 ssizetype=''
1062 startperl=''
1063 startsh=''
1064 stdchar=''
1065 d_stdio_stream_array=''
1066 stdio_stream_array=''
1067 sysman=''
1068 trnl=''
1069 uidformat=''
1070 uidsign=''
1071 uidsize=''
1072 uidtype=''
1073 archname64=''
1074 use64bitall=''
1075 use64bitint=''
1076 ccflags_uselargefiles=''
1077 ldflags_uselargefiles=''
1078 libswanted_uselargefiles=''
1079 uselargefiles=''
1080 uselongdouble=''
1081 usemorebits=''
1082 usemultiplicity=''
1083 nm_opt=''
1084 nm_so_opt=''
1085 runnm=''
1086 usenm=''
1087 useperlio=''
1088 usesocks=''
1089 d_oldpthreads=''
1090 use5005threads=''
1091 useithreads=''
1092 usereentrant=''
1093 usethreads=''
1094 incpath=''
1095 mips_type=''
1096 usrinc=''
1097 d_vendorarch=''
1098 installvendorarch=''
1099 vendorarch=''
1100 vendorarchexp=''
1101 d_vendorbin=''
1102 installvendorbin=''
1103 vendorbin=''
1104 vendorbinexp=''
1105 d_vendorlib=''
1106 installvendorlib=''
1107 vendorlib=''
1108 vendorlib_stem=''
1109 vendorlibexp=''
1110 usevendorprefix=''
1111 vendorprefix=''
1112 vendorprefixexp=''
1113 versiononly=''
1114 defvoidused=''
1115 voidflags=''
1116 pm_apiversion=''
1117 xs_apiversion=''
1118 yacc=''
1119 yaccflags=''
1120 CONFIG=''
1121
1122 define='define'
1123 undef='undef'
1124 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1125 rmlist=''
1126
1127 : We must find out about Eunice early
1128 eunicefix=':'
1129 if test -f /etc/unixtovms; then
1130         eunicefix=/etc/unixtovms
1131 fi
1132 if test -f /etc/unixtovms.exe; then
1133         eunicefix=/etc/unixtovms.exe
1134 fi
1135
1136 : Set executable suffix now -- needed before hints available
1137 if test -f "/libs/version.library"; then
1138 : Amiga OS
1139     _exe=""
1140 elif test -f "/system/gnu_library/bin/ar.pm"; then
1141 : Stratus VOS
1142     _exe=".pm"
1143 elif test -n "$DJGPP"; then
1144 : DOS DJGPP
1145     _exe=".exe"
1146 elif test -d c:/. ; then
1147 : OS/2 or cygwin
1148     _exe=".exe"
1149 fi
1150
1151 i_whoami=''
1152 ccname=''
1153 ccversion=''
1154 perllibs=''
1155 : set useposix=false in your hint file to disable the POSIX extension.
1156 useposix=true
1157 : set useopcode=false in your hint file to disable the Opcode extension.
1158 useopcode=true
1159 : Trailing extension.  Override this in a hint file, if needed.
1160 : Extra object files, if any, needed on this platform.
1161 archobjs=''
1162 archname=''
1163 : Possible local include directories to search.
1164 : Set locincpth to "" in a hint file to defeat local include searches.
1165 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1166 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1167 :
1168 : no include file wanted by default
1169 inclwanted=''
1170
1171 groupstype=''
1172 libnames=''
1173 : change the next line if compiling for Xenix/286 on Xenix/386
1174 xlibpth='/usr/lib/386 /lib/386'
1175 : Possible local library directories to search.
1176 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1177 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1178
1179 : general looking path for locating libraries
1180 glibpth="/lib /usr/lib $xlibpth"
1181 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1182 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1183 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1184
1185 : Private path used by Configure to find libraries.  Its value
1186 : is prepended to libpth. This variable takes care of special
1187 : machines, like the mips.  Usually, it should be empty.
1188 plibpth=''
1189
1190 : default library list
1191 libswanted=''
1192 : some systems want to use only the non-versioned libso:s
1193 ignore_versioned_solibs=''
1194 archname64=''
1195 ccflags_uselargefiles=''
1196 ldflags_uselargefiles=''
1197 libswanted_uselargefiles=''
1198 : set usemultiplicity on the Configure command line to enable multiplicity.
1199 : set usesocks on the Configure command line to enable socks.
1200 : set usethreads on the Configure command line to enable threads.
1201 usereentrant='undef'
1202 : full support for void wanted by default
1203 defvoidused=15
1204
1205 : List of libraries we want.
1206 : If anyone needs -lnet, put it in a hint file.
1207 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1208 libswanted="$libswanted dld ld sun m c cposix posix"
1209 libswanted="$libswanted ndir dir crypt sec"
1210 libswanted="$libswanted ucb bsd BSD PW x util"
1211 : We probably want to search /usr/shlib before most other libraries.
1212 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1213 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1214 glibpth="/usr/shlib $glibpth"
1215 : Do not use vfork unless overridden by a hint file.
1216 usevfork=false
1217
1218 : Find the basic shell for Bourne shell scripts
1219 case "$sh" in
1220 '')
1221         case "$SYSTYPE" in
1222         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1223         *) xxx='/bin/sh';;
1224         esac
1225         if test -f "$xxx"; then
1226                 sh="$xxx"
1227         else
1228                 : Build up a list and do a single loop so we can 'break' out.
1229                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1230                 for xxx in sh bash ksh pdksh ash; do
1231                         for p in $pth; do
1232                                 try="$try ${p}/${xxx}"
1233                         done
1234                 done
1235                 for xxx in $try; do
1236                         if test -f "$xxx"; then
1237                                 sh="$xxx";
1238                                 break
1239                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1240                                 sh="$xxx";
1241                                 break
1242                         elif test -f "$xxx.exe"; then
1243                                 sh="$xxx";
1244                                 break
1245                         fi
1246                 done
1247         fi
1248         ;;
1249 esac
1250
1251 case "$sh" in
1252 '')     cat >&2 <<EOM
1253 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1254
1255 Usually it's in /bin/sh.  How did you even get this far?
1256 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1257 we'll try to straighten this all out.
1258 EOM
1259         exit 1
1260         ;;
1261 esac
1262
1263 : see if sh knows # comments
1264 if `$sh -c '#' >/dev/null 2>&1`; then
1265         shsharp=true
1266         spitshell=cat
1267         xcat=/bin/cat
1268         test -f $xcat$_exe || xcat=/usr/bin/cat
1269         if test ! -f $xcat$_exe; then
1270                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1271                         if test -f $p/cat$_exe; then
1272                                 xcat=$p/cat
1273                                 break
1274                         fi
1275                 done
1276                 if test ! -f $xcat$_exe; then
1277                         echo "Can't find cat anywhere!"
1278                         exit 1
1279                 fi
1280         fi
1281         echo "#!$xcat" >sharp
1282         $eunicefix sharp
1283         chmod +x sharp
1284         ./sharp > today
1285         if test -s today; then
1286                 sharpbang='#!'
1287         else
1288                 echo "#! $xcat" > sharp
1289                 $eunicefix sharp
1290                 chmod +x sharp
1291                 ./sharp > today
1292                 if test -s today; then
1293                         sharpbang='#! '
1294                 else
1295                         sharpbang=': use '
1296                 fi
1297         fi
1298 else
1299         echo " "
1300         echo "Your $sh doesn't grok # comments--I will strip them later on."
1301         shsharp=false
1302         cd ..
1303         echo "exec grep -v '^[  ]*#'" >spitshell
1304         chmod +x spitshell
1305         $eunicefix spitshell
1306         spitshell=`pwd`/spitshell
1307         cd UU
1308         echo "I presume that if # doesn't work, #! won't work either!"
1309         sharpbang=': use '
1310 fi
1311 rm -f sharp today
1312
1313 : figure out how to guarantee sh startup
1314 case "$startsh" in
1315 '') startsh=${sharpbang}${sh} ;;
1316 *)
1317 esac
1318 cat >sharp <<EOSS
1319 $startsh
1320 set abc
1321 test "$?abc" != 1
1322 EOSS
1323
1324 chmod +x sharp
1325 $eunicefix sharp
1326 if ./sharp; then
1327         : echo "Yup, it does."
1328 else
1329         echo "Hmm... '$startsh' does not guarantee sh startup..."
1330         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1331 fi
1332 rm -f sharp
1333
1334
1335 : Save command line options in file UU/cmdline.opt for later use in
1336 : generating config.sh.
1337 cat > cmdline.opt <<EOSH
1338 # Configure command line arguments.
1339 config_arg0='$0'
1340 config_args='$*'
1341 config_argc=$#
1342 EOSH
1343 argn=1
1344 args_exp=''
1345 args_sep=''
1346 for arg in "$@"; do
1347         cat >>cmdline.opt <<EOSH
1348 config_arg$argn='$arg'
1349 EOSH
1350         # Extreme backslashitis: replace each ' by '"'"'
1351         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1352 $arg
1353 EOC
1354         arg_exp=`cat cmdl.opt`
1355         args_exp="$args_exp$args_sep'$arg_exp'"
1356         argn=`expr $argn + 1`
1357         args_sep=' '
1358 done
1359 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1360 # used by ./hints/os2.sh
1361 rm -f cmdl.opt
1362
1363 : produce awk script to parse command line options
1364 cat >options.awk <<'EOF'
1365 BEGIN {
1366         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1367
1368         len = length(optstr);
1369         for (i = 1; i <= len; i++) {
1370                 c = substr(optstr, i, 1);
1371                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1372                 if (a == ":") {
1373                         arg[c] = 1;
1374                         i++;
1375                 }
1376                 opt[c] = 1;
1377         }
1378 }
1379 {
1380         expect = 0;
1381         str = $0;
1382         if (substr(str, 1, 1) != "-") {
1383                 printf("'%s'\n", str);
1384                 next;
1385         }
1386         len = length($0);
1387         for (i = 2; i <= len; i++) {
1388                 c = substr(str, i, 1);
1389                 if (!opt[c]) {
1390                         printf("-%s\n", substr(str, i));
1391                         next;
1392                 }
1393                 printf("-%s\n", c);
1394                 if (arg[c]) {
1395                         if (i < len)
1396                                 printf("'%s'\n", substr(str, i + 1));
1397                         else
1398                                 expect = 1;
1399                         next;
1400                 }
1401         }
1402 }
1403 END {
1404         if (expect)
1405                 print "?";
1406 }
1407 EOF
1408
1409 : process the command line options
1410 set X `for arg in "$@"; do echo "X$arg"; done |
1411         sed -e s/X// | awk -f options.awk`
1412 eval "set $*"
1413 shift
1414 rm -f options.awk
1415
1416 : set up default values
1417 fastread=''
1418 reuseval=false
1419 config_sh=''
1420 alldone=''
1421 error=''
1422 silent=''
1423 extractsh=''
1424 override=''
1425 knowitall=''
1426 rm -f optdef.sh posthint.sh
1427 cat >optdef.sh <<EOS
1428 $startsh
1429 EOS
1430
1431
1432 : option parsing
1433 while test $# -gt 0; do
1434         case "$1" in
1435         -d) shift; fastread=yes;;
1436         -e) shift; alldone=cont;;
1437         -f)
1438                 shift
1439                 cd ..
1440                 if test -r "$1"; then
1441                         config_sh="$1"
1442                 else
1443                         echo "$me: cannot read config file $1." >&2
1444                         error=true
1445                 fi
1446                 cd UU
1447                 shift;;
1448         -h) shift; error=true;;
1449         -r) shift; reuseval=true;;
1450         -s) shift; silent=true; realsilent=true;;
1451         -E) shift; alldone=exit;;
1452         -K) shift; knowitall=true;;
1453         -O) shift; override=true;;
1454         -S) shift; silent=true; extractsh=true;;
1455         -D)
1456                 shift
1457                 case "$1" in
1458                 *=)
1459                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1460                         echo "$me: ignoring -D $1" >&2
1461                         ;;
1462                 *=*) echo "$1" | \
1463                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1464                 *) echo "$1='define'" >> optdef.sh;;
1465                 esac
1466                 shift
1467                 ;;
1468         -U)
1469                 shift
1470                 case "$1" in
1471                 *=) echo "$1" >> optdef.sh;;
1472                 *=*)
1473                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1474                         echo "$me: ignoring -U $1" >&2
1475                         ;;
1476                 *) echo "$1='undef'" >> optdef.sh;;
1477                 esac
1478                 shift
1479                 ;;
1480         -A)
1481             shift
1482             xxx=''
1483             yyy="$1"
1484             zzz=''
1485             uuu=undef
1486             case "$yyy" in
1487             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1488                  case "$zzz" in
1489                  *:*) zzz='' ;;
1490                  *)   xxx=append
1491                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1492                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1493                  esac
1494                  ;;
1495             esac
1496             case "$xxx" in
1497             '')  case "$yyy" in
1498                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1499                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1500                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1501                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1502                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1503                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1504                  esac
1505                  ;;       
1506             esac
1507             case "$xxx" in
1508             append)
1509                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1510             clear)
1511                 echo "$yyy=''"                  >> posthint.sh ;;
1512             define)
1513                 case "$zzz" in
1514                 '') zzz=define ;;
1515                 esac
1516                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1517             eval)
1518                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1519             prepend)
1520                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1521             undef)
1522                 case "$zzz" in
1523                 '') zzz="$uuu" ;;
1524                 esac
1525                 echo "$yyy=$zzz"                >> posthint.sh ;;
1526             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1527             esac
1528             shift
1529             ;;
1530         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1531             exit 0;;
1532         --) break;;
1533         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1534         *) break;;
1535         esac
1536 done
1537
1538 case "$error" in
1539 true)
1540         cat >&2 <<EOM
1541 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1542                  [-U symbol] [-U symbol=] [-A command:symbol...]
1543   -d : use defaults for all answers.
1544   -e : go on without questioning past the production of config.sh.
1545   -f : specify an alternate default configuration file.
1546   -h : print this help message and exit (with an error status).
1547   -r : reuse C symbols value if possible (skips costly nm extraction).
1548   -s : silent mode, only echoes questions and essential information.
1549   -D : define symbol to have some value:
1550          -D symbol         symbol gets the value 'define'
1551          -D symbol=value   symbol gets the value 'value'
1552   -E : stop at the end of questions, after having produced config.sh.
1553   -K : do not use unless you know what you are doing.
1554   -O : let -D and -U override definitions from loaded configuration file.
1555   -S : perform variable substitutions on all .SH files (can mix with -f)
1556   -U : undefine symbol:
1557          -U symbol    symbol gets the value 'undef'
1558          -U symbol=   symbol gets completely empty
1559   -A : manipulate symbol after the platform specific hints have been applied:
1560          -A symbol=value                append " "value to symbol
1561          -A append:symbol=value         append value to symbol
1562          -A define:symbol=value         define symbol to have value
1563          -A clear:symbol                define symbol to be ''
1564          -A define:symbol               define symbol to be 'define'
1565          -A eval:symbol=value           define symbol to be eval of value
1566          -A prepend:symbol=value        prepend value to symbol
1567          -A undef:symbol                define symbol to be 'undef'
1568          -A undef:symbol=               define symbol to be ''
1569   -V : print version number and exit (with a zero status).
1570 EOM
1571         exit 1
1572         ;;
1573 esac
1574
1575 : Sanity checks
1576 case "$fastread$alldone" in
1577 yescont|yesexit) ;;
1578 *)
1579         case "$extractsh" in
1580         true) ;;
1581         *)
1582                 if test ! -t 0; then
1583                         echo "Say 'sh Configure', not 'sh <Configure'"
1584                         exit 1
1585                 fi
1586                 ;;
1587         esac
1588         ;;
1589 esac
1590
1591 exec 4>&1
1592 case "$silent" in
1593 true) exec 1>/dev/null;;
1594 esac
1595
1596 : run the defines and the undefines, if any, but leave the file out there...
1597 touch optdef.sh
1598 . ./optdef.sh
1599 : create the posthint manipulation script and leave the file out there...
1600 touch posthint.sh
1601
1602 : set package name
1603 package=perl5
1604 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1605 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1606 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1607 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1608 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1609 esac
1610
1611 : Some greps do not return status, grrr.
1612 echo "grimblepritz" >grimble
1613 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1614         contains=contains
1615 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1616         contains=grep
1617 else
1618         contains=contains
1619 fi
1620 rm -f grimble
1621 : the following should work in any shell
1622 case "$contains" in
1623 contains*)
1624         echo " "
1625         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1626         cat >contains <<'EOSS'
1627 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1628 EOSS
1629 chmod +x contains
1630 esac
1631
1632 : Find the path to the source tree
1633 case "$src" in
1634 '') case "$0" in
1635     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1636          case "$src" in
1637          /*)    ;;
1638          .)     ;;
1639          *)     src=`cd ../$src && pwd` ;;
1640          esac
1641          ;;
1642     *)   src='.';;
1643     esac;;
1644 esac
1645 case "$src" in
1646 '')     src=/
1647         rsrc=/
1648         ;;
1649 /*) rsrc="$src";;
1650 *) rsrc="../$src";;
1651 esac
1652 if test -f $rsrc/Configure && \
1653         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1654 then
1655    : found it, so we are ok.
1656 else
1657         rsrc=''
1658         for src in . .. ../.. ../../.. ../../../..; do
1659                 if test -f ../$src/Configure && \
1660                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1661                 then
1662                         rsrc=../$src
1663                         break
1664                 fi
1665         done
1666 fi
1667 case "$rsrc" in
1668 '')
1669         cat <<EOM >&4
1670
1671 Sorry, I can't seem to locate the source dir for $package.  Please start
1672 Configure with an explicit path -- i.e. /some/path/Configure.
1673
1674 EOM
1675         exit 1
1676         ;;
1677 ../.)   rsrc='..';;
1678 *)
1679         echo " "
1680         echo "Sources for $package found in \"$src\"." >&4
1681         ;;
1682 esac
1683
1684 : script used to extract .SH files with variable substitutions
1685 cat >extract <<'EOS'
1686 PERL_CONFIG_SH=true
1687 echo "Doing variable substitutions on .SH files..."
1688 if test -f MANIFEST; then
1689         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1690 else
1691         echo "(Looking for .SH files under the source directory.)"
1692         set x `(cd "$src"; find . -name "*.SH" -print)`
1693 fi
1694 shift
1695 case $# in
1696 0) set x `(cd "$src"; echo *.SH)`; shift;;
1697 esac
1698 if test ! -f "$src/$1"; then
1699         shift
1700 fi
1701 mkdir_p='
1702 name=$1;
1703 create="";
1704 while test $name; do
1705         if test ! -d "$name"; then
1706                 create="$name $create";
1707                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1708                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1709         else
1710                 name="";
1711         fi;
1712 done;
1713 for file in $create; do
1714         mkdir $file;
1715 done
1716 '
1717 for file in $*; do
1718         case "$src" in
1719         ".")
1720                 case "$file" in
1721                 */*)
1722                         dir=`expr X$file : 'X\(.*\)/'`
1723                         file=`expr X$file : 'X.*/\(.*\)'`
1724                         (cd "$dir" && . ./$file)
1725                         ;;
1726                 *)
1727                         . ./$file
1728                         ;;
1729                 esac
1730                 ;;
1731         *)
1732                 case "$file" in
1733                 */*)
1734                         dir=`expr X$file : 'X\(.*\)/'`
1735                         file=`expr X$file : 'X.*/\(.*\)'`
1736                         (set x $dir; shift; eval $mkdir_p)
1737                         sh <"$src/$dir/$file"
1738                         ;;
1739                 *)
1740                         sh <"$src/$file"
1741                         ;;
1742                 esac
1743                 ;;
1744         esac
1745 done
1746 if test -f "$src/config_h.SH"; then
1747         if test ! -f config.h; then
1748         : oops, they left it out of MANIFEST, probably, so do it anyway.
1749         . "$src/config_h.SH"
1750         fi
1751 fi
1752 EOS
1753
1754 : extract files and exit if asked to do so
1755 case "$extractsh" in
1756 true)
1757         case "$realsilent" in
1758         true) ;;
1759         *) exec 1>&4;;
1760         esac
1761         case "$config_sh" in
1762         '') config_sh='config.sh';;
1763         esac
1764         echo " "
1765         echo "Fetching answers from $config_sh..."
1766         cd ..
1767         . $config_sh
1768         test "$override" && . ./optdef.sh
1769         echo " "
1770         . UU/extract
1771         rm -rf UU
1772         echo "Extraction done."
1773         exit 0
1774         ;;
1775 esac
1776
1777 : Eunice requires " " instead of "", can you believe it
1778 echo " "
1779 : Here we go...
1780 echo "Beginning of configuration questions for $package."
1781
1782 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1783
1784 : first determine how to suppress newline on echo command
1785 echo " "
1786 echo "Checking echo to see how to suppress newlines..."
1787 (echo "hi there\c" ; echo " ") >.echotmp
1788 if $contains c .echotmp >/dev/null 2>&1 ; then
1789         echo "...using -n."
1790         n='-n'
1791         c=''
1792 else
1793         cat <<'EOM'
1794 ...using \c
1795 EOM
1796         n=''
1797         c='\c'
1798 fi
1799 echo $n "The star should be here-->$c"
1800 echo '*'
1801 rm -f .echotmp
1802
1803 : Now test for existence of everything in MANIFEST
1804 echo " "
1805 if test -f "$rsrc/MANIFEST"; then
1806         echo "First let's make sure your kit is complete.  Checking..." >&4
1807         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1808         rm -f missing
1809         tmppwd=`pwd`
1810         for filelist in x??; do
1811                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1812         done
1813         if test -s missing; then
1814                 cat missing >&4
1815                 cat >&4 <<'EOM'
1816
1817 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1818
1819 You have the option of continuing the configuration process, despite the
1820 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1821 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1822 and contact the author (perlbug@perl.org).
1823
1824 EOM
1825                 echo $n "Continue? [n] $c" >&4
1826                 read ans
1827                 case "$ans" in
1828                 y*)
1829                         echo "Continuing..." >&4
1830                         rm -f missing
1831                         ;;
1832                 *)
1833                         echo "ABORTING..." >&4
1834                         kill $$
1835                         ;;
1836                 esac
1837         else
1838                 echo "Looks good..."
1839         fi
1840 else
1841         echo "There is no MANIFEST file.  I hope your kit is complete !"
1842 fi
1843 rm -f missing x??
1844
1845 echo " "
1846 : Find the appropriate value for a newline for tr
1847 if test -n "$DJGPP"; then
1848        trnl='\012'
1849 fi
1850 if test X"$trnl" = X; then
1851         case "`echo foo|tr '\n' x 2>/dev/null`" in
1852         foox) trnl='\n' ;;
1853         esac
1854 fi
1855 if test X"$trnl" = X; then
1856         case "`echo foo|tr '\012' x 2>/dev/null`" in
1857         foox) trnl='\012' ;;
1858         esac
1859 fi
1860 if test X"$trnl" = X; then
1861        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1862        fooxy) trnl='\n\r' ;;
1863        esac
1864 fi
1865 if test X"$trnl" = X; then
1866         cat <<EOM >&2
1867
1868 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1869
1870 EOM
1871         exit 1
1872 fi
1873
1874 : compute the number of columns on the terminal for proper question formatting
1875 case "$COLUMNS" in
1876 '') COLUMNS='80';;
1877 esac
1878
1879 : set up the echo used in my read
1880 myecho="case \"\$xxxm\" in
1881 '') echo $n \"\$rp $c\" >&4;;
1882 *) case \"\$rp\" in
1883         '') echo $n \"[\$xxxm] $c\";;
1884         *)
1885                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1886                         echo \"\$rp\" >&4
1887                         echo $n \"[\$xxxm] $c\" >&4
1888                 else
1889                         echo $n \"\$rp [\$xxxm] $c\" >&4
1890                 fi
1891                 ;;
1892         esac;;
1893 esac"
1894
1895 : now set up to do reads with possible shell escape and default assignment
1896 cat <<EOSC >myread
1897 $startsh
1898 xxxm=\$dflt
1899 $myecho
1900 ans='!'
1901 case "\$fastread" in
1902 yes) case "\$dflt" in
1903         '') ;;
1904         *) ans='';
1905                 case "\$silent-\$rp" in
1906                 true-) ;;
1907                 *) echo " " >&4;;
1908                 esac;;
1909         esac;;
1910 *) case "\$silent" in
1911         true) case "\$rp" in
1912                 '') ans='';;
1913                 esac;;
1914         esac;;
1915 esac
1916 while expr "X\$ans" : "X!" >/dev/null; do
1917         read answ
1918         set x \$xxxm
1919         shift
1920         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1921         case  "\$answ" in
1922         "!")
1923                 sh 1>&4
1924                 echo " "
1925                 $myecho
1926                 ;;
1927         !*)
1928                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1929                 shift
1930                 sh 1>&4 -c "\$*"
1931                 echo " "
1932                 $myecho
1933                 ;;
1934         "\$ans")
1935                 case "\$ans" in
1936                 \\&*)
1937                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1938                         shift
1939                         case "\$1" in
1940                         -d)
1941                                 fastread=yes
1942                                 echo "(OK, I'll run with -d after this question.)" >&4
1943                                 ;;
1944                         -*)
1945                                 echo "*** Sorry, \$1 not supported yet." >&4
1946                                 ;;
1947                         esac
1948                         $myecho
1949                         ans=!
1950                         ;;
1951                 esac;;
1952         *)
1953                 case "\$aok" in
1954                 y)
1955                         echo "*** Substitution done -- please confirm."
1956                         xxxm="\$ans"
1957                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1958                         xxxm="\$ans"
1959                         ans=!
1960                         ;;
1961                 *)
1962                         echo "*** Error -- try again."
1963                         ans=!
1964                         ;;
1965                 esac
1966                 $myecho
1967                 ;;
1968         esac
1969         case "\$ans\$xxxm\$nostick" in
1970         '')
1971                 ans=!
1972                 $myecho
1973                 ;;
1974         esac
1975 done
1976 case "\$ans" in
1977 '') ans="\$xxxm";;
1978 esac
1979 EOSC
1980
1981 : create .config dir to save info across Configure sessions
1982 test -d ../.config || mkdir ../.config
1983 cat >../.config/README <<EOF
1984 This directory created by Configure to save information that should
1985 persist across sessions for $package.
1986
1987 You may safely delete it if you wish.
1988 EOF
1989
1990 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1991 case "$usedevel" in
1992 $define|true|[yY]*) ;;
1993 *) case "$xversion" in
1994    *[13579])
1995         cat >&4 <<EOH
1996 *** WHOA THERE!!! ***
1997
1998     This is an UNSTABLE DEVELOPMENT release.
1999     The version of this $package distribution is $xversion, that is, odd,
2000     (as opposed to even) and that signifies a development release.
2001     If you want a maintenance release, you want an even-numbered version.
2002
2003     Do ***NOT*** install this into production use.
2004     Data corruption and crashes are possible.
2005
2006     It is most seriously suggested that you do not continue any further
2007     unless you want to help in developing and debugging Perl.
2008
2009     If you *still* want to build perl, you can answer 'y' now,
2010     or pass -Dusedevel to Configure.
2011
2012 EOH
2013         rp='Do you really want to continue?'
2014         dflt='n'
2015         . ./myread
2016         case "$ans" in
2017         [yY]) echo >&4 "Okay, continuing."
2018               usedevel="$define" ;;
2019         *) echo >&4 "Okay, bye."
2020            exit 1
2021            ;;
2022         esac
2023         ;;
2024     esac
2025     ;;
2026 esac
2027 case "$usedevel" in
2028 $define|true|[yY]*)
2029         case "$versiononly" in
2030         '') versiononly="$define" ;;
2031         esac
2032         case "$installusrbinperl" in
2033         '') installusrbinperl="$undef" ;;
2034         esac
2035         ;;
2036 esac
2037
2038 : general instructions
2039 needman=true
2040 firsttime=true
2041 user=`(logname) 2>/dev/null`
2042 case "$user" in
2043 '') user=`whoami 2>&1`;;
2044 esac
2045 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2046         firsttime=false
2047         echo " "
2048         rp='Would you like to see the instructions?'
2049         dflt=n
2050         . ./myread
2051         case "$ans" in
2052         [yY]*) ;;
2053         *) needman=false;;
2054         esac
2055 fi
2056 if $needman; then
2057         cat <<EOH
2058
2059 This installation shell script will examine your system and ask you questions
2060 to determine how the perl5 package should be installed. If you get
2061 stuck on a question, you may use a ! shell escape to start a subshell or
2062 execute a command.  Many of the questions will have default answers in square
2063 brackets; typing carriage return will give you the default.
2064
2065 On some of the questions which ask for file or directory names you are allowed
2066 to use the ~name construct to specify the login directory belonging to "name",
2067 even if you don't have a shell which knows about that.  Questions where this is
2068 allowed will be marked "(~name ok)".
2069
2070 EOH
2071         rp=''
2072         dflt='Type carriage return to continue'
2073         . ./myread
2074         cat <<'EOH'
2075
2076 The prompter used in this script allows you to use shell variables and
2077 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2078 in the default answer, as if the default line was a set of arguments given to a
2079 script shell.  This means you may also use $* to repeat the whole default line,
2080 so you do not have to re-type everything to add something to the default.
2081
2082 Everytime there is a substitution, you will have to confirm.  If there is an
2083 error (e.g. an unmatched backtick), the default answer will remain unchanged
2084 and you will be prompted again.
2085
2086 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2087 the questions and use the computed defaults (or the previous answers if there
2088 was already a config.sh file). Type 'Configure -h' for a list of options.
2089 You may also start interactively and then answer '& -d' at any prompt to turn
2090 on the non-interactive behaviour for the remainder of the execution.
2091
2092 EOH
2093         . ./myread
2094         cat <<EOH
2095
2096 Much effort has been expended to ensure that this shell script will run on any
2097 Unix system.  If despite that it blows up on yours, your best bet is to edit
2098 Configure and run it again.  If you can't run Configure for some reason,
2099 you'll have to generate a config.sh file by hand.  Whatever problems you
2100 have, let me (perlbug@perl.org) know how I blew it.
2101
2102 This installation script affects things in two ways:
2103
2104 1) it may do direct variable substitutions on some of the files included
2105    in this kit.
2106 2) it builds a config.h file for inclusion in C programs.  You may edit
2107    any of these files as the need arises after running this script.
2108
2109 If you make a mistake on a question, there is no easy way to back up to it
2110 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2111 files.  Configure will offer to let you do this before it runs the SH files.
2112
2113 EOH
2114         dflt='Type carriage return to continue'
2115         . ./myread
2116         case "$firsttime" in
2117         true) echo $user >>../.config/instruct;;
2118         esac
2119 fi
2120
2121 : find out where common programs are
2122 echo " "
2123 echo "Locating common programs..." >&4
2124 cat <<EOSC >loc
2125 $startsh
2126 case \$# in
2127 0) exit 1;;
2128 esac
2129 thing=\$1
2130 shift
2131 dflt=\$1
2132 shift
2133 for dir in \$*; do
2134         case "\$thing" in
2135         .)
2136         if test -d \$dir/\$thing; then
2137                 echo \$dir
2138                 exit 0
2139         fi
2140         ;;
2141         *)
2142         for thisthing in \$dir/\$thing; do
2143                 : just loop through to pick last item
2144         done
2145         if test -f \$thisthing; then
2146                 echo \$thisthing
2147                 exit 0
2148         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2149                 echo \$thisthing
2150                 exit 0
2151         elif test -f \$dir/\$thing.exe; then
2152                 if test -n "$DJGPP"; then
2153                         echo \$dir/\$thing.exe
2154                 else
2155                         : on Eunice apparently
2156                         echo \$dir/\$thing
2157                 fi
2158                 exit 0
2159         fi
2160         ;;
2161         esac
2162 done
2163 echo \$dflt
2164 exit 1
2165 EOSC
2166 chmod +x loc
2167 $eunicefix loc
2168 loclist="
2169 awk
2170 cat
2171 chmod
2172 comm
2173 cp
2174 echo
2175 expr
2176 grep
2177 ls
2178 mkdir
2179 rm
2180 sed
2181 sort
2182 touch
2183 tr
2184 uniq
2185 "
2186 trylist="
2187 Mcc
2188 ar
2189 bison
2190 byacc
2191 cpp
2192 csh
2193 date
2194 egrep
2195 gmake
2196 gzip
2197 less
2198 ln
2199 make
2200 more
2201 nm
2202 nroff
2203 pg
2204 test
2205 uname
2206 zip
2207 "
2208 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2209 pth="$pth /lib /usr/lib"
2210 for file in $loclist; do
2211         eval xxx=\$$file
2212         case "$xxx" in
2213         /*|?:[\\/]*)
2214                 if test -f "$xxx"; then
2215                         : ok
2216                 else
2217                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2218                         xxx=`./loc $file $file $pth`
2219                 fi
2220                 ;;
2221         '') xxx=`./loc $file $file $pth`;;
2222         *) xxx=`./loc $xxx $xxx $pth`;;
2223         esac
2224         eval $file=$xxx$_exe
2225         eval _$file=$xxx
2226         case "$xxx" in
2227         /*)
2228                 echo $file is in $xxx.
2229                 ;;
2230         ?:[\\/]*)
2231                 echo $file is in $xxx.
2232                 ;;
2233         *)
2234                 echo "I don't know where '$file' is, and my life depends on it." >&4
2235                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2236                 exit 1
2237                 ;;
2238         esac
2239 done
2240 echo " "
2241 echo "Don't worry if any of the following aren't found..."
2242 say=offhand
2243 for file in $trylist; do
2244         eval xxx=\$$file
2245         case "$xxx" in
2246         /*|?:[\\/]*)
2247                 if test -f "$xxx"; then
2248                         : ok
2249                 else
2250                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2251                         xxx=`./loc $file $file $pth`
2252                 fi
2253                 ;;
2254         '') xxx=`./loc $file $file $pth`;;
2255         *) xxx=`./loc $xxx $xxx $pth`;;
2256         esac
2257         eval $file=$xxx$_exe
2258         eval _$file=$xxx
2259         case "$xxx" in
2260         /*)
2261                 echo $file is in $xxx.
2262                 ;;
2263         ?:[\\/]*)
2264                 echo $file is in $xxx.
2265                 ;;
2266         *)
2267                 echo "I don't see $file out there, $say."
2268                 say=either
2269                 ;;
2270         esac
2271 done
2272 case "$egrep" in
2273 egrep)
2274         echo "Substituting grep for egrep."
2275         egrep=$grep
2276         _egrep=$grep
2277         ;;
2278 esac
2279 case "$ln" in
2280 ln)
2281         echo "Substituting cp for ln."
2282         ln=$cp
2283         _ln=$cp
2284         ;;
2285 esac
2286 case "$make" in
2287 make)   
2288         case "$gmake" in
2289         gmake)
2290         echo "I can't find make or gmake, and my life depends on it." >&4
2291         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2292         exit 1
2293         ;;
2294         esac
2295         ;;
2296 esac    
2297 case "$gmake" in
2298 gmake)  ;;
2299 *)      # We can't have osname yet.
2300         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2301                 # Assume that gmake, if found, is definitely GNU make
2302                 # and prefer it over the system make.
2303                 echo "Substituting gmake for make."
2304                 make=$gmake
2305                 _make=$gmake
2306         fi
2307         ;;
2308 esac
2309 case "$test" in
2310 test)
2311         echo "Hopefully test is built into your sh."
2312         ;;
2313 *)
2314         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2315                 echo "Using the test built into your sh."
2316                 test=test
2317                 _test=test
2318         fi
2319         ;;
2320 esac
2321 case "$echo" in
2322 echo)
2323         echo "Hopefully echo is built into your sh."
2324         ;;
2325 '') ;;
2326 *)
2327         echo " "
2328 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2329         $echo $n "hi there$c" >foo1
2330         echo $n "hi there$c" >foo2
2331         if cmp foo1 foo2 >/dev/null 2>&1; then
2332                 echo "They are compatible.  In fact, they may be identical."
2333         else
2334                 case "$n" in
2335                 '-n') n='' c='\c';;
2336                 *) n='-n' c='';;
2337                 esac
2338                 cat <<FOO
2339 They are not compatible!  You are probably running ksh on a non-USG system.
2340 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2341 have echo built in and we may have to run some Bourne shell scripts.  That
2342 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2343
2344 FOO
2345                 $echo $n "The star should be here-->$c"
2346                 $echo "*"
2347         fi
2348         $rm -f foo1 foo2
2349         ;;
2350 esac
2351
2352 cat <<EOS >trygcc
2353 $startsh
2354 EOS
2355 cat <<'EOSC' >>trygcc
2356 case "$cc" in
2357 '') ;;
2358 *)  $rm -f try try.*
2359     $cat >try.c <<EOM
2360 int main(int argc, char *argv[]) {
2361   return 0;
2362 }
2363 EOM
2364     if $cc -o try $ccflags $ldflags try.c; then
2365        :
2366     else
2367         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2368         despair=yes
2369         trygcc=yes
2370         case "$cc" in
2371         *gcc*) trygcc=no ;;
2372         esac
2373         case "`$cc -v -c try.c 2>&1`" in
2374         *gcc*) trygcc=no ;;
2375         esac
2376         if $test X"$trygcc" = Xyes; then
2377             if gcc -o try -c try.c; then
2378                 echo " "
2379                 echo "You seem to have a working gcc, though." >&4
2380                 rp="Would you like to use it?"
2381                 dflt=y
2382                 if $test -f myread; then
2383                     . ./myread
2384                 else
2385                     if $test -f UU/myread; then
2386                         . ./UU/myread
2387                     else
2388                         echo "Cannot find myread, sorry.  Aborting." >&2
2389                         exit 1
2390                     fi
2391                 fi  
2392                 case "$ans" in
2393                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2394                        if $test -f usethreads.cbu; then
2395                            $cat >&4 <<EOM 
2396
2397 *** However, any setting of the C compiler flags (e.g. for thread support)
2398 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2399 *** (together with e.g. -Dusethreads).
2400
2401 EOM
2402                        fi;;
2403                 esac
2404             fi
2405         fi
2406     fi
2407     $rm -f try try.*
2408     ;;
2409 esac
2410 EOSC
2411
2412 cat <<EOS >checkcc
2413 $startsh
2414 EOS
2415 cat <<'EOSC' >>checkcc
2416 case "$cc" in        
2417 '') ;;
2418 *)  $rm -f try try.*              
2419     $cat >try.c <<EOM
2420 int main(int argc, char *argv[]) {
2421   return 0;
2422 }
2423 EOM
2424     if $cc -o try $ccflags $ldflags try.c; then
2425        :
2426     else
2427         if $test X"$despair" = Xyes; then
2428            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2429         fi
2430         $cat >&4 <<EOM         
2431 You need to find a working C compiler.
2432 Either (purchase and) install the C compiler supplied by your OS vendor,
2433 or for a free C compiler try http://gcc.gnu.org/
2434 I cannot continue any further, aborting.
2435 EOM
2436         exit 1
2437     fi
2438     $rm -f try try.*
2439     ;;
2440 esac
2441 EOSC
2442
2443 : determine whether symbolic links are supported
2444 echo " "
2445 $touch blurfl
2446 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2447         echo "Symbolic links are supported." >&4
2448         lns="$ln -s"
2449 else
2450         echo "Symbolic links are NOT supported." >&4
2451         lns="$ln"
2452 fi
2453 $rm -f blurfl sym
2454
2455 : determine whether symbolic links are supported
2456 echo " "
2457 case "$lns" in
2458 *"ln"*" -s")
2459         echo "Checking how to test for symbolic links..." >&4
2460         $lns blurfl sym
2461         if $test "X$issymlink" = X; then
2462                 case "$newsh" in
2463                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2464                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2465                 esac
2466                 if test $? = 0; then
2467                         issymlink="test -h"
2468                 else
2469                         echo "Your builtin 'test -h' may be broken." >&4
2470                         case "$test" in
2471                         /*)     ;;
2472                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2473                                 for p in $pth
2474                                 do
2475                                         if test -f "$p/$test"; then
2476                                                 test="$p/$test"
2477                                                 break
2478                                         fi
2479                                 done
2480                                 ;;
2481                         esac
2482                         case "$test" in
2483                         /*)
2484                                 echo "Trying external '$test -h'." >&4
2485                                 issymlink="$test -h"
2486                                 if $test ! -h sym >/dev/null 2>&1; then
2487                                         echo "External '$test -h' is broken, too." >&4
2488                                         issymlink=''
2489                                 fi
2490                                 ;;
2491                         *)      issymlink='' ;;
2492                         esac
2493                 fi              
2494         fi
2495         if $test "X$issymlink" = X; then
2496                 if $test -L sym 2>/dev/null; then
2497                         issymlink="$test -L"
2498                         echo "The builtin '$test -L' worked." >&4
2499                 fi
2500         fi
2501         if $test "X$issymlink" != X; then
2502                 echo "You can test for symbolic links with '$issymlink'." >&4
2503         else
2504                 echo "I do not know how you can test for symbolic links." >&4
2505         fi
2506         $rm -f blurfl sym
2507         ;;
2508 *)      echo "No symbolic links, so not testing for their testing..." >&4
2509         ;;
2510 esac
2511 echo " "
2512
2513
2514 case "$mksymlinks" in
2515 $define|true|[yY]*)
2516         case "$src" in
2517         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2518                 exit 1
2519                 ;;
2520         *)      case "$lns:$issymlink" in
2521                 *"ln"*" -s:"*"test -"?)
2522                         echo "Creating the symbolic links..." >&4
2523                         echo "(First creating the subdirectories...)" >&4
2524                         cd ..
2525                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2526                                 read directory
2527                                 test -z "$directory" && break
2528                                 mkdir -p $directory
2529                         done
2530                         # Sanity check 1.
2531                         if test ! -d t/base; then
2532                                 echo "Failed to create the subdirectories.  Aborting." >&4
2533                                 exit 1
2534                         fi
2535                         echo "(Then creating the symlinks...)" >&4
2536                         awk '{print $1}' $src/MANIFEST | while true; do
2537                                 read filename
2538                                 test -z "$filename" && break
2539                                 if test -f $filename; then
2540                                         if $issymlink $filename; then
2541                                                 rm -f $filename
2542                                         fi
2543                                 fi
2544                                 if test -f $filename; then
2545                                         echo "$filename already exists, not symlinking."
2546                                 else
2547                                         ln -s $src/$filename $filename
2548                                 fi
2549                         done
2550                         # Sanity check 2.
2551                         if test ! -f t/base/lex.t; then
2552                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2553                                 exit 1
2554                         fi
2555                         cd UU
2556                         ;;
2557                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2558                         ;;
2559                 esac
2560                 ;;
2561         esac
2562         ;;
2563 esac
2564
2565
2566 case "$usecrosscompile" in
2567 $define|true|[yY]*)
2568         $echo "Cross-compiling..."
2569         croak=''
2570         case "$cc" in
2571         *-*-gcc) # A cross-compiling gcc, probably.
2572             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2573             ar=$targetarch-ar
2574             # leave out ld, choosing it is more complex
2575             nm=$targetarch-nm
2576             ranlib=$targetarch-ranlib
2577             $echo 'extern int foo;' > try.c
2578             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2579             shift
2580             if $test $# -gt 0; then
2581                 incpth="$incpth $*"
2582                 incpth="`$echo $incpth|$sed 's/^ //'`"
2583                 echo "Guessing incpth '$incpth'." >&4
2584                 for i in $*; do
2585                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2586                     if $test -d $j; then
2587                         libpth="$libpth $j"
2588                     fi
2589                 done   
2590                 libpth="`$echo $libpth|$sed 's/^ //'`"
2591                 echo "Guessing libpth '$libpth'." >&4
2592             fi
2593             $rm -f try.c
2594             ;;
2595         esac
2596         case "$targetarch" in
2597         '') echo "Targetarch not defined." >&4; croak=y ;;
2598         *)  echo "Using targetarch $targetarch." >&4 ;;
2599         esac
2600         case "$incpth" in
2601         '') echo "Incpth not defined." >&4; croak=y ;;
2602         *)  echo "Using incpth '$incpth'." >&4 ;;
2603         esac
2604         case "$libpth" in
2605         '') echo "Libpth not defined." >&4; croak=y ;;
2606         *)  echo "Using libpth '$libpth'." >&4 ;;
2607         esac
2608         case "$usrinc" in
2609         '') for i in $incpth; do
2610                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2611                     usrinc=$i
2612                     echo "Guessing usrinc $usrinc." >&4
2613                     break
2614                 fi
2615             done
2616             case "$usrinc" in
2617             '') echo "Usrinc not defined." >&4; croak=y ;;
2618             esac
2619             ;;
2620         *)  echo "Using usrinc $usrinc." >&4 ;;
2621         esac
2622         case "$targethost" in
2623         '') echo "Targethost not defined." >&4; croak=y ;;
2624         *)  echo "Using targethost $targethost." >&4
2625         esac
2626         locincpth=' '
2627         loclibpth=' '
2628         case "$croak" in
2629         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2630         esac
2631         case "$src" in
2632         /*) run=$src/Cross/run
2633             targetmkdir=$src/Cross/mkdir
2634             to=$src/Cross/to
2635             from=$src/Cross/from
2636             ;;
2637         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2638             run=$pwd/Cross/run
2639             targetmkdir=$pwd/Cross/mkdir
2640             to=$pwd/Cross/to
2641             from=$pwd/Cross/from
2642             ;;
2643         esac
2644         case "$targetrun" in
2645         '') targetrun=ssh ;;
2646         esac
2647         case "$targetto" in
2648         '') targetto=scp ;;
2649         esac
2650         case "$targetfrom" in
2651         '') targetfrom=scp ;;
2652         esac
2653         run=$run-$targetrun
2654         to=$to-$targetto
2655         from=$from-$targetfrom
2656         case "$targetdir" in
2657         '')  targetdir=/tmp
2658              echo "Guessing targetdir $targetdir." >&4
2659              ;;
2660         esac
2661         case "$targetuser" in
2662         '')  targetuser=root
2663              echo "Guessing targetuser $targetuser." >&4
2664              ;;
2665         esac
2666         case "$targetfrom" in
2667         scp)    q=-q ;;
2668         *)      q='' ;;
2669         esac
2670         case "$targetrun" in
2671         ssh|rsh)
2672             cat >$run <<EOF
2673 #!/bin/sh
2674 case "\$1" in
2675 -cwd)
2676   shift
2677   cwd=\$1
2678   shift
2679   ;;
2680 esac
2681 case "\$cwd" in
2682 '') cwd=$targetdir ;;
2683 esac
2684 exe=\$1
2685 shift
2686 if $test ! -f \$exe.xok; then
2687   $to \$exe
2688   $touch \$exe.xok
2689 fi
2690 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2691 EOF
2692             ;;
2693         *)  echo "Unknown targetrun '$targetrun'" >&4
2694             exit 1
2695             ;;
2696         esac
2697         case "$targetmkdir" in
2698         */Cross/mkdir)
2699             cat >$targetmkdir <<EOF
2700 #!/bin/sh
2701 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2702 EOF
2703             $chmod a+rx $targetmkdir
2704             ;;
2705         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2706             exit 1
2707             ;;
2708         esac
2709         case "$targetto" in
2710         scp|rcp)
2711             cat >$to <<EOF
2712 #!/bin/sh
2713 for f in \$@
2714 do
2715   case "\$f" in
2716   /*)
2717     $targetmkdir \`dirname \$f\`
2718     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2719     ;;
2720   *)
2721     $targetmkdir $targetdir/\`dirname \$f\`
2722     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2723     ;;
2724   esac
2725 done
2726 exit 0
2727 EOF
2728             ;;
2729         cp) cat >$to <<EOF
2730 #!/bin/sh
2731 for f in \$@
2732 do
2733   case "\$f" in
2734   /*)
2735     $mkdir -p $targetdir/\`dirname \$f\`
2736     $cp \$f $targetdir/\$f || exit 1
2737     ;;
2738   *)
2739     $targetmkdir $targetdir/\`dirname \$f\`
2740     $cp \$f $targetdir/\$f || exit 1
2741     ;;
2742   esac
2743 done
2744 exit 0
2745 EOF
2746             ;;
2747         *)  echo "Unknown targetto '$targetto'" >&4
2748             exit 1
2749             ;;
2750         esac
2751         case "$targetfrom" in
2752         scp|rcp)
2753           cat >$from <<EOF
2754 #!/bin/sh
2755 for f in \$@
2756 do
2757   $rm -f \$f
2758   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2759 done
2760 exit 0
2761 EOF
2762             ;;
2763         cp) cat >$from <<EOF
2764 #!/bin/sh
2765 for f in \$@
2766 do
2767   $rm -f \$f
2768   cp $targetdir/\$f . || exit 1
2769 done
2770 exit 0
2771 EOF
2772             ;;
2773         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2774             exit 1
2775             ;;
2776         esac
2777         if $test ! -f $run; then
2778             echo "Target 'run' script '$run' not found." >&4
2779         else
2780             $chmod a+rx $run
2781         fi
2782         if $test ! -f $to; then
2783             echo "Target 'to' script '$to' not found." >&4
2784         else
2785             $chmod a+rx $to
2786         fi
2787         if $test ! -f $from; then
2788             echo "Target 'from' script '$from' not found." >&4
2789         else
2790             $chmod a+rx $from
2791         fi
2792         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2793             exit 1
2794         fi
2795         cat >&4 <<EOF
2796 Using '$run' for remote execution,
2797 and '$from' and '$to'
2798 for remote file transfer.
2799 EOF
2800         ;;
2801 *)      run=''
2802         to=:
2803         from=:
2804         usecrosscompile='undef'
2805         targetarch=''
2806         ;;
2807 esac
2808
2809 : see whether [:lower:] and [:upper:] are supported character classes
2810 echo " "
2811 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2812 ABYZ)
2813         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2814         up='[:upper:]'
2815         low='[:lower:]'
2816         ;;
2817 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2818         # (0xc9 and 0xd1), therefore that is a nice testing point.
2819         if test "X$up" = X -o "X$low" = X; then
2820             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2821             ij) up='[A-Z]'
2822                 low='[a-z]'
2823                 ;;
2824             esac
2825         fi
2826         if test "X$up" = X -o "X$low" = X; then
2827             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2828             ij) up='A-Z'
2829                 low='a-z'
2830                 ;;
2831             esac
2832         fi
2833         if test "X$up" = X -o "X$low" = X; then
2834             case "`echo IJ | od -x 2>/dev/null`" in
2835             *C9D1*|*c9d1*)
2836                 echo "Hey, this might be EBCDIC." >&4
2837                 if test "X$up" = X -o "X$low" = X; then
2838                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2839                     ij) up='[A-IJ-RS-Z]'
2840                         low='[a-ij-rs-z]'
2841                         ;;
2842                     esac
2843                 fi
2844                 if test "X$up" = X -o "X$low" = X; then
2845                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2846                     ij) up='A-IJ-RS-Z'
2847                         low='a-ij-rs-z'
2848                         ;;
2849                     esac
2850                 fi
2851                 ;;
2852             esac
2853         fi
2854 esac
2855 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2856 ij)
2857     echo "Using $up and $low to convert case." >&4
2858     ;;
2859 *)
2860     echo "I don't know how to translate letters from upper to lower case." >&4
2861     echo "Your tr is not acting any way I know of." >&4
2862     exit 1
2863     ;;
2864 esac
2865 : set up the translation script tr, must be called with ./tr of course
2866 cat >tr <<EOSC
2867 $startsh
2868 case "\$1\$2" in
2869 '[A-Z][a-z]') exec $tr '$up' '$low';;
2870 '[a-z][A-Z]') exec $tr '$low' '$up';;
2871 esac
2872 exec $tr "\$@"
2873 EOSC
2874 chmod +x tr
2875 $eunicefix tr
2876
2877 : Try to determine whether config.sh was made on this system
2878 case "$config_sh" in
2879 '')
2880 myuname=`$uname -a 2>/dev/null`
2881 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2882 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2883 # because the A-Z/a-z are not consecutive.
2884 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2885         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2886 newmyuname="$myuname"
2887 dflt=n
2888 case "$knowitall" in
2889 '')
2890         if test -f ../config.sh; then
2891                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2892                         eval "`grep myuname= ../config.sh`"
2893                 fi
2894                 if test "X$myuname" = "X$newmyuname"; then
2895                         dflt=y
2896                 fi
2897         fi
2898         ;;
2899 *) dflt=y;;
2900 esac
2901
2902 : Get old answers from old config file if Configure was run on the
2903 : same system, otherwise use the hints.
2904 hint=default
2905 cd ..
2906 if test -f config.sh; then
2907         echo " "
2908         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2909         . UU/myread
2910         case "$ans" in
2911         n*|N*) echo "OK, I'll ignore it."
2912                 mv config.sh config.sh.old
2913                 myuname="$newmyuname"
2914                 ;;
2915         *)  echo "Fetching default answers from your old config.sh file..." >&4
2916                 tmp_n="$n"
2917                 tmp_c="$c"
2918                 tmp_sh="$sh"
2919                 . ./config.sh
2920                 cp config.sh UU
2921                 n="$tmp_n"
2922                 c="$tmp_c"
2923                 : Older versions did not always set $sh.  Catch re-use of such
2924                 : an old config.sh.
2925                 case "$sh" in
2926                 '') sh="$tmp_sh" ;;
2927                 esac
2928                 hint=previous
2929                 ;;
2930         esac
2931 fi
2932 . ./UU/checkcc
2933 if test ! -f config.sh; then
2934         $cat <<EOM
2935
2936 First time through, eh?  I have some defaults handy for some systems
2937 that need some extra help getting the Configure answers right:
2938
2939 EOM
2940         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2941         dflt=''
2942         : Half the following guesses are probably wrong... If you have better
2943         : tests or hints, please send them to perlbug@perl.org
2944         : The metaconfig authors would also appreciate a copy...
2945         $test -f /irix && osname=irix
2946         $test -f /xenix && osname=sco_xenix
2947         $test -f /dynix && osname=dynix
2948         $test -f /dnix && osname=dnix
2949         $test -f /lynx.os && osname=lynxos
2950         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2951         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2952         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2953         $test -f /bin/mips && /bin/mips && osname=mips
2954         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2955                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2956         $test -d /usr/apollo/bin && osname=apollo
2957         $test -f /etc/saf/_sactab && osname=svr4
2958         $test -d /usr/include/minix && osname=minix
2959         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2960         if $test -d /MachTen -o -d /MachTen_Folder; then
2961                 osname=machten
2962                 if $test -x /sbin/version; then
2963                         osvers=`/sbin/version | $awk '{print $2}' |
2964                         $sed -e 's/[A-Za-z]$//'`
2965                 elif $test -x /usr/etc/version; then
2966                         osvers=`/usr/etc/version | $awk '{print $2}' |
2967                         $sed -e 's/[A-Za-z]$//'`
2968                 else
2969                         osvers="$2.$3"
2970                 fi
2971         fi
2972
2973         $test -f /sys/posix.dll &&
2974                 $test -f /usr/bin/what &&
2975                 set X `/usr/bin/what /sys/posix.dll` &&
2976                 $test "$3" = UWIN &&
2977                 osname=uwin &&
2978                 osvers="$5"
2979
2980         if $test -f $uname; then
2981                 set X $myuname
2982                 shift
2983
2984                 case "$5" in
2985                 fps*) osname=fps ;;
2986                 mips*)
2987                         case "$4" in
2988                         umips) osname=umips ;;
2989                         *) osname=mips ;;
2990                         esac;;
2991                 [23]100) osname=mips ;;
2992                 next*) osname=next ;;
2993                 i386*)
2994                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2995                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2996                                 osname='sco'
2997                                 osvers=$tmp
2998                         elif $test -f /etc/kconfig; then
2999                                 osname=isc
3000                                 if test "$lns" = "$ln -s"; then
3001                                         osvers=4
3002                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3003                                         osvers=3
3004                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3005                                         osvers=2
3006                                 fi
3007                         fi
3008                         tmp=''
3009                         ;;
3010                 pc*)
3011                         if test -n "$DJGPP"; then
3012                                 osname=dos
3013                                 osvers=djgpp
3014                         fi
3015                         ;;
3016                 esac
3017
3018                 case "$1" in
3019                 aix) osname=aix
3020                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3021                         case "$tmp" in
3022                         'not found') osvers="$4"."$3" ;;
3023                         '<3240'|'<>3240') osvers=3.2.0 ;;
3024                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3025                         '=3250'|'>3250') osvers=3.2.5 ;;
3026                         *) osvers=$tmp;;
3027                         esac
3028                         ;;
3029                 bsd386) osname=bsd386
3030                         osvers=`$uname -r`
3031                         ;;
3032                 cygwin*) osname=cygwin
3033                         osvers="$3"
3034                         ;;
3035                 *dc.osx) osname=dcosx
3036                         osvers="$3"
3037                         ;;
3038                 dnix) osname=dnix
3039                         osvers="$3"
3040                         ;;
3041                 domainos) osname=apollo
3042                         osvers="$3"
3043                         ;;
3044                 dgux) osname=dgux 
3045                         osvers="$3"
3046                         ;;
3047                 dynixptx*) osname=dynixptx
3048                         osvers=`echo "$4"|sed 's/^v//'`
3049                         ;;
3050                 freebsd) osname=freebsd 
3051                         osvers="$3" ;;
3052                 genix) osname=genix ;;
3053                 hp*) osname=hpux 
3054                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3055                         ;;
3056                 irix*) osname=irix
3057                         case "$3" in
3058                         4*) osvers=4 ;;
3059                         5*) osvers=5 ;;
3060                         *)      osvers="$3" ;;
3061                         esac
3062                         ;;
3063                 linux) osname=linux
3064                         case "$3" in
3065                         *)      osvers="$3" ;;
3066                         esac
3067                         ;;
3068                 MiNT) osname=mint
3069                         ;;
3070                 netbsd*) osname=netbsd
3071                         osvers="$3"
3072                         ;;
3073                 news-os) osvers="$3"
3074                         case "$3" in
3075                         4*) osname=newsos4 ;;
3076                         *) osname=newsos ;;
3077                         esac
3078                         ;;
3079                 next*) osname=next ;;
3080                 nonstop-ux) osname=nonstopux ;;
3081                 openbsd) osname=openbsd
3082                         osvers="$3"
3083                         ;;
3084                 POSIX-BC | posix-bc ) osname=posix-bc
3085                         osvers="$3"
3086                         ;;
3087                 powerux | power_ux | powermax_os | powermaxos | \
3088                 powerunix | power_unix) osname=powerux
3089                         osvers="$3"
3090                         ;;
3091                 qnx) osname=qnx
3092                         osvers="$4"
3093                         ;;
3094                 solaris) osname=solaris
3095                         case "$3" in
3096                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3097                         *)      osvers="$3" ;;
3098                         esac
3099                         ;;
3100                 sunos) osname=sunos
3101                         case "$3" in
3102                         5*) osname=solaris
3103                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3104                         *)      osvers="$3" ;;
3105                         esac
3106                         ;;
3107                 titanos) osname=titanos
3108                         case "$3" in
3109                         1*) osvers=1 ;;
3110                         2*) osvers=2 ;;
3111                         3*) osvers=3 ;;
3112                         4*) osvers=4 ;;
3113                         *)      osvers="$3" ;;
3114                         esac
3115                         ;;
3116                 ultrix) osname=ultrix
3117                         osvers="$3"
3118                         ;;
3119                 osf1|mls+)      case "$5" in
3120                                 alpha)
3121                                         osname=dec_osf
3122                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3123                                         case "$osvers" in
3124                                         [1-9].[0-9]*) ;;
3125                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3126                                         esac
3127                                         ;;
3128                         hp*)    osname=hp_osf1  ;;
3129                         mips)   osname=mips_osf1 ;;
3130                         esac
3131                         ;;
3132                 unixware) osname=svr5
3133                         osvers="$4"
3134                         ;;
3135                 uts)    osname=uts
3136                         osvers="$3"
3137                         ;;
3138                 vos) osvers="$3"
3139                         ;;
3140                 $2) case "$osname" in
3141                         *isc*) ;;
3142                         *freebsd*) ;;
3143                         svr*)
3144                                 : svr4.x or possibly later
3145                                 case "svr$3" in 
3146                                 ${osname}*)
3147                                         osname=svr$3
3148                                         osvers=$4
3149                                         ;;
3150                                 esac
3151                                 case "$osname" in
3152                                 svr4.0)
3153                                         : Check for ESIX
3154                                         if test -f /stand/boot ; then
3155                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3156                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3157                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3158                                                         if test -n "$isesix"; then
3159                                                                 osname=esix4
3160                                                         fi
3161                                                 fi
3162                                         fi
3163                                         ;;
3164                                 esac
3165                                 ;;
3166                         *)      if test -f /etc/systemid; then
3167                                         osname=sco
3168                                         set `echo $3 | $sed 's/\./ /g'` $4
3169                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3170                                                 osvers=$1.$2.$3
3171                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3172                                                 osvers=$1.$2
3173                                         elif $test -f $src/hints/sco_$1.sh; then
3174                                                 osvers=$1
3175                                         fi
3176                                 else
3177                                         case "$osname" in
3178                                         '') : Still unknown.  Probably a generic Sys V.
3179                                                 osname="sysv"
3180                                                 osvers="$3"
3181                                                 ;;
3182                                         esac
3183                                 fi
3184                                 ;;
3185                         esac
3186                         ;;
3187                 *)      case "$osname" in
3188                         '') : Still unknown.  Probably a generic BSD.
3189                                 osname="$1"
3190                                 osvers="$3"
3191                                 ;;
3192                         esac
3193                         ;;
3194                 esac
3195         else
3196                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3197                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3198                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3199                                 osname=news_os
3200                         fi
3201                         $rm -f UU/kernel.what
3202                 elif test -d c:/.; then
3203                         set X $myuname
3204                         osname=os2
3205                         osvers="$5"
3206                 fi
3207         fi
3208         
3209         case "$targetarch" in
3210         '') ;;
3211         *)  hostarch=$osname
3212             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3213             osvers=''
3214             ;;
3215         esac
3216
3217         : Now look for a hint file osname_osvers, unless one has been
3218         : specified already.
3219         case "$hintfile" in
3220         ''|' ')
3221                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3222                 : Also try without trailing minor version numbers.
3223                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3224                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3225                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3226                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3227                 case "$file" in
3228                 '') dflt=none ;;
3229                 *)  case "$osvers" in
3230                         '') dflt=$file
3231                                 ;;
3232                         *)  if $test -f $src/hints/$file.sh ; then
3233                                         dflt=$file
3234                                 elif $test -f $src/hints/$xfile.sh ; then
3235                                         dflt=$xfile
3236                                 elif $test -f $src/hints/$xxfile.sh ; then
3237                                         dflt=$xxfile
3238                                 elif $test -f $src/hints/$xxxfile.sh ; then
3239                                         dflt=$xxxfile
3240                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3241                                         dflt=$xxxxfile
3242                                 elif $test -f "$src/hints/${osname}.sh" ; then
3243                                         dflt="${osname}"
3244                                 else
3245                                         dflt=none
3246                                 fi
3247                                 ;;
3248                         esac
3249                         ;;
3250                 esac
3251                 if $test -f Policy.sh ; then
3252                         case "$dflt" in
3253                         *Policy*) ;;
3254                         none) dflt="Policy" ;;
3255                         *) dflt="Policy $dflt" ;;
3256                         esac
3257                 fi
3258                 ;;
3259         *)
3260                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3261                 ;;
3262         esac
3263
3264         if $test -f Policy.sh ; then
3265                 $cat <<EOM
3266
3267 There's also a Policy hint file available, which should make the
3268 site-specific (policy) questions easier to answer.
3269 EOM
3270
3271         fi
3272
3273         $cat <<EOM
3274
3275 You may give one or more space-separated answers, or "none" if appropriate.
3276 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3277 is a good thing.  DO NOT give a wrong version or a wrong OS.
3278
3279 EOM
3280
3281         rp="Which of these apply, if any?"
3282         . UU/myread
3283         tans=$ans
3284         for file in $tans; do
3285                 if $test X$file = XPolicy -a -f Policy.sh; then
3286                         . Policy.sh
3287                         $cat Policy.sh >> UU/config.sh
3288                 elif $test -f $src/hints/$file.sh; then
3289                         . $src/hints/$file.sh
3290                         $cat $src/hints/$file.sh >> UU/config.sh
3291                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3292                         : nothing
3293                 else
3294                         : Give one chance to correct a possible typo.
3295                         echo "$file.sh does not exist"
3296                         dflt=$file
3297                         rp="hint to use instead?"
3298                         . UU/myread
3299                         for file in $ans; do
3300                                 if $test -f "$src/hints/$file.sh"; then
3301                                         . $src/hints/$file.sh
3302                                         $cat $src/hints/$file.sh >> UU/config.sh
3303                                 elif $test X$ans = X -o X$ans = Xnone ; then
3304                                         : nothing
3305                                 else
3306                                         echo "$file.sh does not exist -- ignored."
3307                                 fi
3308                         done
3309                 fi
3310         done
3311
3312         hint=recommended
3313         : Remember our hint file for later.
3314         if $test -f "$src/hints/$file.sh" ; then
3315                 hintfile="$file"
3316         else
3317                 hintfile=''
3318         fi
3319 fi
3320 cd UU
3321 ;;
3322 *)
3323         echo " "
3324         echo "Fetching default answers from $config_sh..." >&4
3325         tmp_n="$n"
3326         tmp_c="$c"
3327         cd ..
3328         cp $config_sh config.sh 2>/dev/null
3329         chmod +w config.sh
3330         . ./config.sh
3331         cd UU
3332         cp ../config.sh .
3333         n="$tmp_n"
3334         c="$tmp_c"
3335         hint=previous
3336         ;;
3337 esac
3338 test "$override" && . ./optdef.sh
3339
3340 : Restore computed paths
3341 for file in $loclist $trylist; do
3342         eval $file="\$_$file"
3343 done
3344
3345 cat << EOM
3346
3347 Configure uses the operating system name and version to set some defaults.
3348 The default value is probably right if the name rings a bell. Otherwise,
3349 since spelling matters for me, either accept the default or answer "none"
3350 to leave it blank.
3351
3352 EOM
3353 case "$osname" in
3354         ''|' ')
3355                 case "$hintfile" in
3356                 ''|' '|none) dflt=none ;;
3357                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3358                 esac
3359                 ;;
3360         *) dflt="$osname" ;;
3361 esac
3362 rp="Operating system name?"
3363 . ./myread
3364 case "$ans" in
3365 none)  osname='' ;;
3366 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3367 esac
3368 echo " "
3369 case "$osvers" in
3370         ''|' ')
3371                 case "$hintfile" in
3372                 ''|' '|none) dflt=none ;;
3373                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3374                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3375                         case "$dflt" in
3376                         ''|' ') dflt=none ;;
3377                         esac
3378                         ;;
3379                 esac
3380                 ;;
3381         *) dflt="$osvers" ;;
3382 esac
3383 rp="Operating system version?"
3384 . ./myread
3385 case "$ans" in
3386 none)  osvers='' ;;
3387 *) osvers="$ans" ;;
3388 esac
3389
3390
3391 . ./posthint.sh
3392
3393 : who configured the system
3394 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3395 cf_by=`(logname) 2>/dev/null`
3396 case "$cf_by" in
3397 "")
3398         cf_by=`(whoami) 2>/dev/null`
3399         case "$cf_by" in
3400         "") cf_by=unknown ;;
3401         esac ;;
3402 esac
3403
3404 : set up the script used to warn in case of inconsistency
3405 cat <<EOS >whoa
3406 $startsh
3407 EOS
3408 cat <<'EOSC' >>whoa
3409 dflt=y
3410 echo " "
3411 echo "*** WHOA THERE!!! ***" >&4
3412 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3413 rp="    Keep the $hint value?"
3414 . ./myread
3415 case "$ans" in
3416 y) td=$was; tu=$was;;
3417 esac
3418 EOSC
3419
3420 : function used to set $1 to $val
3421 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3422 case "$val$was" in
3423 $define$undef) . ./whoa; eval "$var=\$td";;
3424 $undef$define) . ./whoa; eval "$var=\$tu";;
3425 *) eval "$var=$val";;
3426 esac'
3427
3428 case "$usethreads" in
3429 $define|true|[yY]*)     dflt='y';;
3430 *)     # Catch case where user specified ithreads or 5005threads but
3431        # forgot -Dusethreads (A.D. 4/2002)
3432        case "$useithreads$use5005threads" in
3433        *$define*)      dflt='y' ;;
3434        *)      dflt='n';;
3435        esac
3436        ;;
3437 esac
3438 cat <<EOM
3439
3440 Perl can be built to take advantage of threads on some systems.
3441 To do so, Configure can be run with -Dusethreads.
3442
3443 Note that Perl built with threading support runs slightly slower
3444 and uses more memory than plain Perl. The current implementation
3445 is believed to be stable, but it is fairly new, and so should be
3446 treated with caution.
3447
3448 If this doesn't make any sense to you, just accept the default '$dflt'.
3449 EOM
3450 rp='Build a threading Perl?'
3451 . ./myread
3452 case "$ans" in
3453 y|Y)    val="$define" ;;
3454 *)      val="$undef" ;;
3455 esac
3456 set usethreads
3457 eval $setvar
3458
3459 case "$usethreads" in
3460 $define)
3461         $cat <<EOM
3462
3463 Since release 5.6, Perl has had two different threading implementations,
3464 the newer interpreter-based version (ithreads) with one interpreter per
3465 thread, and the older 5.005 version (5005threads).
3466 The 5005threads version is effectively unmaintained and will probably be
3467 removed in Perl 5.10, so there should be no need to build a Perl using it
3468 unless needed for backwards compatibility with some existing 5.005threads
3469 code.
3470
3471 EOM
3472         : Default to ithreads unless overridden on command line or with
3473         : old config.sh
3474         dflt='y'
3475         case "$use5005threads" in
3476                 $define|true|[yY]*) dflt='n';;
3477         esac
3478         case "$useithreads" in
3479                 $undef|false|[nN]*) dflt='n';;
3480         esac
3481         rp='Use the newer interpreter-based ithreads?'
3482         . ./myread
3483         case "$ans" in
3484         y|Y)    val="$define" ;;
3485         *)      val="$undef" ;;
3486         esac
3487         set useithreads
3488         eval $setvar
3489         : Now set use5005threads to the opposite value.
3490         case "$useithreads" in
3491         $define) val="$undef" ;;
3492         *) val="$define" ;;
3493         esac
3494         set use5005threads
3495         eval $setvar
3496         ;;
3497 *)
3498         useithreads="$undef"
3499         use5005threads="$undef"
3500         ;;
3501 esac
3502
3503 case "$useithreads$use5005threads" in
3504 "$define$define")
3505         $cat >&4 <<EOM
3506
3507 You cannot have both the ithreads and the 5.005 threads enabled
3508 at the same time.  Disabling the 5.005 threads since they are
3509 much less stable than the ithreads.
3510
3511 EOM
3512         use5005threads="$undef"
3513         ;;
3514 esac
3515
3516 case "$d_oldpthreads" in
3517 '')     : Configure tests would be welcome here.  For now, assume undef.
3518         val="$undef" ;;
3519 *)      val="$d_oldpthreads" ;;
3520 esac
3521 set d_oldpthreads
3522 eval $setvar
3523
3524
3525 case "$usethreads" in
3526 "$define"|true|[yY]*)
3527 : Look for a hint-file generated 'call-back-unit'.  If the
3528 : user has specified that a threading perl is to be built,
3529 : we may need to set or change some other defaults.
3530         if $test -f usethreads.cbu; then
3531                 echo "Your platform has some specific hints for threaded builds, using them..."
3532                 . ./usethreads.cbu
3533         else
3534                 $cat <<EOM
3535 (Your platform doesn't have any specific hints for threaded builds.
3536  Assuming POSIX threads, then.)
3537 EOM
3538         fi
3539         ;;
3540 esac
3541
3542 cat <<EOM
3543
3544 Perl can be built so that multiple Perl interpreters can coexist
3545 within the same Perl executable.
3546 EOM
3547
3548 case "$useithreads" in
3549 $define)
3550         cat <<EOM
3551 This multiple interpreter support is required for interpreter-based threads.
3552 EOM
3553         val="$define"
3554         ;;
3555 *)      case "$usemultiplicity" in
3556         $define|true|[yY]*)     dflt='y';;
3557         *) dflt='n';;
3558         esac
3559         echo " "
3560         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3561         rp='Build Perl for multiplicity?'
3562         . ./myread
3563         case "$ans" in
3564         y|Y)    val="$define" ;;
3565         *)      val="$undef" ;;
3566         esac
3567         ;;
3568 esac
3569 set usemultiplicity
3570 eval $setvar
3571
3572
3573 case "$usemorebits" in
3574 "$define"|true|[yY]*)
3575         use64bitint="$define"
3576         uselongdouble="$define"
3577         usemorebits="$define"
3578         ;;
3579 *)      usemorebits="$undef"
3580         ;;
3581 esac
3582
3583 : make some quick guesses about what we are up against
3584 echo " "
3585 $echo $n "Hmm...  $c"
3586 echo exit 1 >bsd
3587 echo exit 1 >usg
3588 echo exit 1 >v7
3589 echo exit 1 >osf1
3590 echo exit 1 >eunice
3591 echo exit 1 >xenix
3592 echo exit 1 >venix
3593 echo exit 1 >os2
3594 d_bsd="$undef"
3595 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3596 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3597 then
3598         echo "Looks kind of like an OSF/1 system, but we'll see..."
3599         echo exit 0 >osf1
3600 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3601         xxx=`./loc addbib blurfl $pth`
3602         if $test -f $xxx; then
3603         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3604                 echo exit 0 >bsd
3605                 echo exit 0 >usg
3606         else
3607                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3608                         echo "Looks kind of like an extended USG system, but we'll see..."
3609                 else
3610                         echo "Looks kind of like a USG system, but we'll see..."
3611                 fi
3612                 echo exit 0 >usg
3613         fi
3614 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3615         echo "Looks kind of like a BSD system, but we'll see..."
3616         d_bsd="$define"
3617         echo exit 0 >bsd
3618 else
3619         echo "Looks kind of like a Version 7 system, but we'll see..."
3620         echo exit 0 >v7
3621 fi
3622 case "$eunicefix" in
3623 *unixtovms*)
3624         $cat <<'EOI'
3625 There is, however, a strange, musty smell in the air that reminds me of
3626 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3627 EOI
3628         echo exit 0 >eunice
3629         d_eunice="$define"
3630 : it so happens the Eunice I know will not run shell scripts in Unix format
3631         ;;
3632 *)
3633         echo " "
3634         echo "Congratulations.  You aren't running Eunice."
3635         d_eunice="$undef"
3636         ;;
3637 esac
3638 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3639 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3640 : semicolon as a patch separator
3641 case "$p_" in
3642 :) ;;
3643 *)
3644         $cat <<'EOI'
3645 I have the feeling something is not exactly right, however...don't tell me...
3646 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3647 (Or you may be running DOS with DJGPP.)
3648 EOI
3649         echo exit 0 >os2
3650         ;;
3651 esac
3652 if test -f /xenix; then
3653         echo "Actually, this looks more like a XENIX system..."
3654         echo exit 0 >xenix
3655         d_xenix="$define"
3656 else
3657         echo " "
3658         echo "It's not Xenix..."
3659         d_xenix="$undef"
3660 fi
3661 chmod +x xenix
3662 $eunicefix xenix
3663 if test -f /venix; then
3664         echo "Actually, this looks more like a VENIX system..."
3665         echo exit 0 >venix
3666 else
3667         echo " "
3668         if ./xenix; then
3669                 : null
3670         else
3671                 echo "Nor is it Venix..."
3672         fi
3673 fi
3674 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3675 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3676 $rm -f foo
3677
3678 case "$cc" in
3679 '') dflt=cc;;
3680 *) dflt="$cc";;
3681 esac
3682 rp="Use which C compiler?"
3683 . ./myread
3684 cc="$ans"
3685
3686 : See if they have not cc but they do have gcc
3687 . ./trygcc
3688 : Look for a hint-file generated 'call-back-unit'.  Now that the
3689 : user has specified the compiler, we may need to set or change some
3690 : other defaults.
3691 if $test -f cc.cbu; then
3692     . ./cc.cbu
3693 fi
3694 . ./checkcc
3695
3696 echo " "
3697 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3698 $cat >try.c <<EOM
3699 #include <stdio.h>
3700 int main() {
3701 #ifdef __GNUC__
3702 #ifdef __VERSION__
3703         printf("%s\n", __VERSION__);
3704 #else
3705         printf("%s\n", "1");
3706 #endif
3707 #endif
3708         exit(0);
3709 }
3710 EOM
3711 if $cc -o try $ccflags $ldflags try.c; then
3712         gccversion=`$run ./try`
3713         case "$gccversion" in
3714         '') echo "You are not using GNU cc." ;;
3715         *)  echo "You are using GNU cc $gccversion."
3716             ccname=gcc  
3717             ;;
3718         esac
3719 else
3720         echo " "
3721         echo "*** WHOA THERE!!! ***" >&4
3722         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3723         case "$knowitall" in
3724         '')
3725         echo "    You'd better start hunting for one and let me know about it." >&4
3726                 exit 1
3727                 ;;
3728         esac
3729 fi
3730 $rm -f try try.*
3731 case "$gccversion" in
3732 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3733 esac
3734 case "$gccversion" in
3735 '') gccosandvers='' ;;
3736 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3737    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3738    gccshortvers=''
3739    case "$gccosandvers" in
3740    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3741    $osname$osvers) ;; # looking good
3742    $osname*) cat <<EOM >&4
3743
3744 *** WHOA THERE!!! ***
3745
3746     Your gcc has not been compiled for the exact release of
3747     your operating system ($gccosandvers versus $osname$osvers).
3748
3749     In general it is a good idea to keep gcc synchronized with
3750     the operating system because otherwise serious problems
3751     may ensue when trying to compile software, like Perl.
3752
3753     I'm trying to be optimistic here, though, and will continue.
3754     If later during the configuration and build icky compilation
3755     problems appear (headerfile conflicts being the most common
3756     manifestation), I suggest reinstalling the gcc to match
3757     your operating system release.
3758
3759 EOM
3760       ;;
3761    *) gccosandvers='' ;; # failed to parse, better be silent
3762    esac
3763    ;;
3764 esac
3765 case "$ccname" in
3766 '') ccname="$cc" ;;
3767 esac
3768
3769
3770 : decide how portable to be.  Allow command line overrides.
3771 case "$d_portable" in
3772 "$undef") ;;
3773 *)      d_portable="$define" ;;
3774 esac
3775
3776 : set up shell script to do ~ expansion
3777 cat >filexp <<EOSS
3778 $startsh
3779 : expand filename
3780 case "\$1" in
3781  ~/*|~)
3782         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3783         ;;
3784  ~*)
3785         if $test -f /bin/csh; then
3786                 /bin/csh -f -c "glob \$1"
3787                 failed=\$?
3788                 echo ""
3789                 exit \$failed
3790         else
3791                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3792                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3793                 if $test ! -d "\$dir"; then
3794                         me=\`basename \$0\`
3795                         echo "\$me: can't locate home directory for: \$name" >&2
3796                         exit 1
3797                 fi
3798                 case "\$1" in
3799                 */*)
3800                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3801                         ;;
3802                 *)
3803                         echo \$dir
3804                         ;;
3805                 esac
3806         fi
3807         ;;
3808 *)
3809         echo \$1
3810         ;;
3811 esac
3812 EOSS
3813 chmod +x filexp
3814 $eunicefix filexp
3815
3816 : now set up to get a file name
3817 cat <<EOS >getfile
3818 $startsh
3819 EOS
3820 cat <<'EOSC' >>getfile
3821 tilde=''
3822 fullpath=''
3823 already=''
3824 skip=''
3825 none_ok=''
3826 exp_file=''
3827 nopath_ok=''
3828 orig_rp="$rp"
3829 orig_dflt="$dflt"
3830 case "$gfpth" in
3831 '') gfpth='.' ;;
3832 esac
3833
3834 case "$fn" in
3835 *\(*)
3836         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3837         fn=`echo $fn | sed 's/(.*)//'`
3838         ;;
3839 esac
3840
3841 case "$fn" in
3842 *:*)
3843         loc_file=`expr $fn : '.*:\(.*\)'`
3844         fn=`expr $fn : '\(.*\):.*'`
3845         ;;
3846 esac
3847
3848 case "$fn" in
3849 *~*) tilde=true;;
3850 esac
3851 case "$fn" in
3852 */*) fullpath=true;;
3853 esac
3854 case "$fn" in
3855 *+*) skip=true;;
3856 esac
3857 case "$fn" in
3858 *n*) none_ok=true;;
3859 esac
3860 case "$fn" in
3861 *e*) exp_file=true;;
3862 esac
3863 case "$fn" in
3864 *p*) nopath_ok=true;;
3865 esac
3866
3867 case "$fn" in
3868 *f*) type='File';;
3869 *d*) type='Directory';;
3870 *l*) type='Locate';;
3871 esac
3872
3873 what="$type"
3874 case "$what" in
3875 Locate) what='File';;
3876 esac
3877
3878 case "$exp_file" in
3879 '')
3880         case "$d_portable" in
3881         "$define") ;;
3882         *) exp_file=true;;
3883         esac
3884         ;;
3885 esac
3886
3887 cd ..
3888 while test "$type"; do
3889         redo=''
3890         rp="$orig_rp"
3891         dflt="$orig_dflt"
3892         case "$tilde" in
3893         true) rp="$rp (~name ok)";;
3894         esac
3895         . UU/myread
3896         if test -f UU/getfile.ok && \
3897                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3898         then
3899                 value="$ans"
3900                 ansexp="$ans"
3901                 break
3902         fi
3903         case "$ans" in
3904         none)
3905                 value=''
3906                 ansexp=''
3907                 case "$none_ok" in
3908                 true) type='';;
3909                 esac
3910                 ;;
3911         *)
3912                 case "$tilde" in
3913                 '') value="$ans"
3914                         ansexp="$ans";;
3915                 *)
3916                         value=`UU/filexp $ans`
3917                         case $? in
3918                         0)
3919                                 if test "$ans" != "$value"; then
3920                                         echo "(That expands to $value on this system.)"
3921                                 fi
3922                                 ;;
3923                         *) value="$ans";;
3924                         esac
3925                         ansexp="$value"
3926                         case "$exp_file" in
3927                         '') value="$ans";;
3928                         esac
3929                         ;;
3930                 esac
3931                 case "$fullpath" in
3932                 true)
3933                         case "$ansexp" in
3934                         /*) value="$ansexp" ;;
3935                         [a-zA-Z]:/*) value="$ansexp" ;;
3936                         *)
3937                                 redo=true
3938                                 case "$already" in
3939                                 true)
3940                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3941                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3942                                         ;;
3943                                 *)
3944                                 echo "Please give a full path name, starting with slash." >&4
3945                                         case "$tilde" in
3946                                         true)
3947                                 echo "Note that using ~name is ok provided it expands well." >&4
3948                                                 already=true
3949                                                 ;;
3950                                         esac
3951                                 esac
3952                                 ;;
3953                         esac
3954                         ;;
3955                 esac
3956                 case "$redo" in
3957                 '')
3958                         case "$type" in
3959                         File)
3960                                 for fp in $gfpth; do
3961                                         if test "X$fp" = X.; then
3962                                             pf="$ansexp"
3963                                         else    
3964                                             pf="$fp/$ansexp"
3965                                         fi
3966                                         if test -f "$pf"; then
3967                                                 type=''
3968                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3969                                         then
3970                                                 echo "($value is not a plain file, but that's ok.)"
3971                                                 type=''
3972                                         fi
3973                                         if test X"$type" = X; then
3974                                             value="$pf"
3975                                             break
3976                                         fi
3977                                 done
3978                                 ;;
3979                         Directory)
3980                                 for fp in $gfpth; do
3981                                         if test "X$fp" = X.; then
3982                                             dir="$ans"
3983                                             direxp="$ansexp"
3984                                         else    
3985                                             dir="$fp/$ansexp"
3986                                             direxp="$fp/$ansexp"
3987                                         fi
3988                                         if test -d "$direxp"; then
3989                                                 type=''
3990                                                 value="$dir"
3991                                                 break
3992                                         fi
3993                                 done
3994                                 ;;
3995                         Locate)
3996                                 if test -d "$ansexp"; then
3997                                         echo "(Looking for $loc_file in directory $value.)"
3998                                         value="$value/$loc_file"
3999                                         ansexp="$ansexp/$loc_file"
4000                                 fi
4001                                 if test -f "$ansexp"; then
4002                                         type=''
4003                                 fi
4004                                 case "$nopath_ok" in
4005                                 true)   case "$value" in
4006                                         */*) ;;
4007                                         *)      echo "Assuming $value will be in people's path."
4008                                                 type=''
4009                                                 ;;
4010                                         esac
4011                                         ;;
4012                                 esac
4013                                 ;;
4014                         esac
4015
4016                         case "$skip" in
4017                         true) type='';
4018                         esac
4019
4020                         case "$type" in
4021                         '') ;;
4022                         *)
4023                                 if test "$fastread" = yes; then
4024                                         dflt=y
4025                                 else
4026                                         dflt=n
4027                                 fi
4028                                 rp="$what $value doesn't exist.  Use that name anyway?"
4029                                 . UU/myread
4030                                 dflt=''
4031                                 case "$ans" in
4032                                 y*) type='';;
4033                                 *) echo " ";;
4034                                 esac
4035                                 ;;
4036                         esac
4037                         ;;
4038                 esac
4039                 ;;
4040         esac
4041 done
4042 cd UU
4043 ans="$value"
4044 rp="$orig_rp"
4045 dflt="$orig_dflt"
4046 rm -f getfile.ok
4047 test "X$gfpthkeep" != Xy && gfpth=""
4048 EOSC
4049
4050 : What should the include directory be ?
4051 echo " "
4052 $echo $n "Hmm...  $c"
4053 dflt='/usr/include'
4054 incpath=''
4055 mips_type=''
4056 if $test -f /bin/mips && /bin/mips; then
4057         echo "Looks like a MIPS system..."
4058         $cat >usr.c <<'EOCP'
4059 #ifdef SYSTYPE_BSD43
4060 /bsd43
4061 #endif
4062 EOCP
4063         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4064                 dflt='/bsd43/usr/include'
4065                 incpath='/bsd43'
4066                 mips_type='BSD 4.3'
4067         else
4068                 mips_type='System V'
4069         fi
4070         $rm -f usr.c usr.out
4071         echo "and you're compiling with the $mips_type compiler and libraries."
4072         xxx_prompt=y
4073         echo "exit 0" >mips
4074 else
4075         echo "Doesn't look like a MIPS system."
4076         xxx_prompt=n
4077         echo "exit 1" >mips
4078 fi
4079 chmod +x mips
4080 $eunicefix mips
4081 case "$usrinc" in
4082 '') ;;
4083 *) dflt="$usrinc";;
4084 esac
4085 case "$xxx_prompt" in
4086 y)      fn=d/
4087         echo " "
4088         rp='Where are the include files you want to use?'
4089         . ./getfile
4090         usrinc="$ans"
4091         ;;
4092 *)      usrinc="$dflt"
4093         ;;
4094 esac
4095
4096 : see how we invoke the C preprocessor
4097 echo " "
4098 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4099 cat <<'EOT' >testcpp.c
4100 #define ABC abc
4101 #define XYZ xyz
4102 ABC.XYZ
4103 EOT
4104 cd ..
4105 if test ! -f cppstdin; then
4106         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4107                 # AIX cc -E doesn't show the absolute headerfile
4108                 # locations but we'll cheat by using the -M flag.
4109                 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
4110         else
4111                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4112         fi
4113 else
4114         echo "Keeping your $hint cppstdin wrapper."
4115 fi
4116 chmod 755 cppstdin
4117 wrapper=`pwd`/cppstdin
4118 ok='false'
4119 cd UU
4120
4121 if $test "X$cppstdin" != "X" && \
4122         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4123         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4124 then
4125         echo "You used to use $cppstdin $cppminus so we'll use that again."
4126         case "$cpprun" in
4127         '') echo "But let's see if we can live without a wrapper..." ;;
4128         *)
4129                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4130                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4131                 then
4132                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4133                         ok='true'
4134                 else
4135                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4136                 fi
4137                 ;;
4138         esac
4139 else
4140         case "$cppstdin" in
4141         '') ;;
4142         *)
4143                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4144                 ;;
4145         esac
4146 fi
4147
4148 if $ok; then
4149         : nothing
4150 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4151         $cc -E <testcpp.c >testcpp.out 2>&1; \
4152         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4153         echo "Yup, it does."
4154         x_cpp="$cc -E"
4155         x_minus='';
4156 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4157         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4158         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4159         echo "Yup, it does."
4160         x_cpp="$cc -E"
4161         x_minus='-';
4162 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4163         $cc -P <testcpp.c >testcpp.out 2>&1; \
4164         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4165         echo "Yipee, that works!"
4166         x_cpp="$cc -P"
4167         x_minus='';
4168 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4169         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4170         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4171         echo "At long last!"
4172         x_cpp="$cc -P"
4173         x_minus='-';
4174 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4175         $cpp <testcpp.c >testcpp.out 2>&1; \
4176         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4177         echo "It works!"
4178         x_cpp="$cpp"
4179         x_minus='';
4180 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4181         $cpp - <testcpp.c >testcpp.out 2>&1; \
4182         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4183         echo "Hooray, it works!  I was beginning to wonder."
4184         x_cpp="$cpp"
4185         x_minus='-';
4186 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4187         $wrapper <testcpp.c >testcpp.out 2>&1; \
4188         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4189         x_cpp="$wrapper"
4190         x_minus=''
4191         echo "Eureka!"
4192 else
4193         dflt=''
4194         rp="No dice.  I can't find a C preprocessor.  Name one:"
4195         . ./myread
4196         x_cpp="$ans"
4197         x_minus=''
4198         $x_cpp <testcpp.c >testcpp.out 2>&1
4199         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4200                 echo "OK, that will do." >&4
4201         else
4202 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4203                 exit 1
4204         fi
4205 fi
4206
4207 case "$ok" in
4208 false)
4209         cppstdin="$x_cpp"
4210         cppminus="$x_minus"
4211         cpprun="$x_cpp"
4212         cpplast="$x_minus"
4213         set X $x_cpp
4214         shift
4215         case "$1" in
4216         "$cpp")
4217                 echo "Perhaps can we force $cc -E using a wrapper..."
4218                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4219                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4220                 then
4221                         echo "Yup, we can."
4222                         cppstdin="$wrapper"
4223                         cppminus='';
4224                 else
4225                         echo "Nope, we'll have to live without it..."
4226                 fi
4227                 ;;
4228         esac
4229         case "$cpprun" in
4230         "$wrapper")
4231                 cpprun=''
4232                 cpplast=''
4233                 ;;
4234         esac
4235         ;;
4236 esac
4237
4238 case "$cppstdin" in
4239 "$wrapper"|'cppstdin') ;;
4240 *) $rm -f $wrapper;;
4241 esac
4242 $rm -f testcpp.c testcpp.out
4243
4244 : Set private lib path
4245 case "$plibpth" in
4246 '') if ./mips; then
4247                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4248         fi;;
4249 esac
4250 case "$libpth" in
4251 ' ') dlist='';;
4252 '') dlist="$loclibpth $plibpth $glibpth";;
4253 *) dlist="$libpth";;
4254 esac
4255
4256 : Now check and see which directories actually exist, avoiding duplicates
4257 libpth=''
4258 for xxx in $dlist
4259 do
4260     if $test -d $xxx; then
4261                 case " $libpth " in
4262                 *" $xxx "*) ;;
4263                 *) libpth="$libpth $xxx";;
4264                 esac
4265     fi
4266 done
4267 $cat <<'EOM'
4268
4269 Some systems have incompatible or broken versions of libraries.  Among
4270 the directories listed in the question below, please remove any you
4271 know not to be holding relevant libraries, and add any that are needed.
4272 Say "none" for none.
4273
4274 EOM
4275 case "$libpth" in
4276 '') dflt='none';;
4277 *)
4278         set X $libpth
4279         shift
4280         dflt=${1+"$@"}
4281         ;;
4282 esac
4283 rp="Directories to use for library searches?"
4284 . ./myread
4285 case "$ans" in
4286 none) libpth=' ';;
4287 *) libpth="$ans";;
4288 esac
4289
4290 : compute shared library extension
4291 case "$so" in
4292 '')
4293         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4294                 dflt='sl'
4295         else
4296                 dflt='so'
4297         fi
4298         ;;
4299 *) dflt="$so";;
4300 esac
4301 $cat <<EOM
4302
4303 On some systems, shared libraries may be available.  Answer 'none' if
4304 you want to suppress searching of shared libraries for the remainder
4305 of this configuration.
4306
4307 EOM
4308 rp='What is the file extension used for shared libraries?'
4309 . ./myread
4310 so="$ans"
4311
4312 : Define several unixisms.
4313 : Hints files or command line option can be used to override them.
4314 : The convoluted testing is in case hints files set either the old
4315 : or the new name.
4316 case "$_exe" in
4317 '')     case "$exe_ext" in
4318         '')     ;;
4319         *)      _exe="$exe_ext" ;;
4320         esac
4321         ;;
4322 esac
4323 case "$_a" in
4324 '')     case "$lib_ext" in
4325     '') _a='.a';;
4326         *)      _a="$lib_ext" ;;
4327         esac
4328         ;;
4329 esac
4330 case "$_o" in
4331 '') case "$obj_ext" in
4332         '')     _o='.o';;
4333         *)      _o="$obj_ext";;
4334         esac
4335         ;;
4336 esac
4337 case "$p_" in
4338 '') case "$path_sep" in
4339         '')     p_=':';;
4340         *)      p_="$path_sep";;
4341         esac
4342         ;;
4343 esac
4344 exe_ext=$_exe
4345 lib_ext=$_a
4346 obj_ext=$_o
4347 path_sep=$p_
4348
4349 : Which makefile gets called first.  This is used by make depend.
4350 case "$firstmakefile" in
4351 '') firstmakefile='makefile';;
4352 esac
4353
4354 case "$usesocks" in
4355 $define|true|[yY]*)     dflt='y';;
4356 *) dflt='n';;
4357 esac
4358 cat <<EOM
4359
4360 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4361 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4362 to use the PerlIO abstraction layer, this will be implicitly selected.
4363
4364 If this doesn't make any sense to you, just accept the default '$dflt'.
4365 EOM
4366 rp='Build Perl for SOCKS?'
4367 . ./myread
4368 case "$ans" in
4369 y|Y)    val="$define" ;;     
4370 *)      val="$undef" ;;
4371 esac
4372 set usesocks
4373 eval $setvar
4374
4375 case "$usesocks" in
4376 $define|true|[yY]*) useperlio="$define";;
4377 esac
4378
4379 : Looking for optional libraries
4380 echo " "
4381 echo "Checking for optional libraries..." >&4
4382 case "$libs" in
4383 ' '|'') dflt='';;
4384 *) dflt="$libs";;
4385 esac
4386 case "$libswanted" in
4387 '') libswanted='c_s';;
4388 esac
4389 case "$usesocks" in
4390 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4391 esac
4392 libsfound=''
4393 libsfiles=''
4394 libsdirs=''
4395 libspath=''
4396 for thisdir in $libpth $xlibpth; do
4397   test -d $thisdir && libspath="$libspath $thisdir"
4398 done
4399 for thislib in $libswanted; do
4400         for thisdir in $libspath; do
4401             xxx=''
4402             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4403                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4404                 $test -f "$xxx" && eval $libscheck
4405                 $test -f "$xxx" && libstyle=shared
4406             fi
4407             if test ! -f "$xxx"; then
4408                 xxx=$thisdir/lib$thislib.$so
4409                 $test -f "$xxx" && eval $libscheck
4410                 $test -f "$xxx" && libstyle=shared
4411             fi  
4412             if test ! -f "$xxx"; then
4413                 xxx=$thisdir/lib$thislib$_a
4414                 $test -f "$xxx" && eval $libscheck
4415                 $test -f "$xxx" && libstyle=static
4416             fi
4417             if test ! -f "$xxx"; then
4418                 xxx=$thisdir/$thislib$_a
4419                 $test -f "$xxx" && eval $libscheck
4420                 $test -f "$xxx" && libstyle=static
4421             fi
4422             if test ! -f "$xxx"; then
4423                 xxx=$thisdir/lib${thislib}_s$_a
4424                 $test -f "$xxx" && eval $libscheck
4425                 $test -f "$xxx" && libstyle=static
4426                 $test -f "$xxx" && thislib=${thislib}_s
4427             fi
4428             if test ! -f "$xxx"; then
4429                 xxx=$thisdir/Slib$thislib$_a
4430                 $test -f "$xxx" && eval $libscheck
4431                 $test -f "$xxx" && libstyle=static
4432             fi
4433             if $test -f "$xxx"; then
4434                 case "$libstyle" in
4435                 shared) echo "Found -l$thislib (shared)." ;;
4436                 static) echo "Found -l$thislib." ;;
4437                 *)      echo "Found -l$thislib ($libstyle)." ;;
4438                 esac
4439                 case " $dflt " in
4440                 *"-l$thislib "*);;
4441                 *) dflt="$dflt -l$thislib"
4442                    libsfound="$libsfound $xxx"
4443                    yyy=`basename $xxx`
4444                    libsfiles="$libsfiles $yyy"
4445                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4446                    case " $libsdirs " in
4447                    *" $yyy "*) ;;
4448                    *) libsdirs="$libsdirs $yyy" ;;
4449                    esac
4450                    ;;
4451                 esac
4452                 break
4453             fi  
4454         done
4455         if $test ! -f "$xxx"; then
4456             echo "No -l$thislib."
4457         fi
4458 done
4459 set X $dflt
4460 shift
4461 dflt="$*"
4462 case "$libs" in
4463 '') dflt="$dflt";;
4464 *) dflt="$libs";;
4465 esac
4466 case "$dflt" in
4467 ' '|'') dflt='none';;
4468 esac
4469
4470 $cat <<EOM
4471
4472 In order to compile $package on your machine, a number of libraries
4473 are usually needed.  Include any other special libraries here as well.
4474 Say "none" for none.  The default list is almost always right.
4475 EOM
4476
4477 echo " "
4478 rp="What libraries to use?"
4479 . ./myread
4480 case "$ans" in
4481 none) libs=' ';;
4482 *) libs="$ans";;
4483 esac
4484
4485 : determine optimization, if desired, or use for debug flag also
4486 case "$optimize" in
4487 ' '|$undef) dflt='none';;
4488 '') dflt='-O';;
4489 *) dflt="$optimize";;
4490 esac
4491 $cat <<EOH
4492
4493 By default, $package compiles with the -O flag to use the optimizer.
4494 Alternately, you might want to use the symbolic debugger, which uses
4495 the -g flag (on traditional Unix systems).  Either flag can be
4496 specified here.  To use neither flag, specify the word "none".
4497
4498 EOH
4499 rp="What optimizer/debugger flag should be used?"
4500 . ./myread
4501 optimize="$ans"
4502 case "$optimize" in
4503 'none') optimize=" ";;
4504 esac
4505
4506 dflt=''
4507 : We will not override a previous value, but we might want to
4508 : augment a hint file
4509 case "$hint" in
4510 default|recommended)
4511         case "$gccversion" in
4512         1*) dflt='-fpcc-struct-return' ;;
4513         esac
4514         case "$optimize" in
4515         *-g*) dflt="$dflt -DDEBUGGING";;
4516         esac
4517         case "$gccversion" in
4518         2*) if test -d /etc/conf/kconfig.d &&
4519                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4520                 then
4521                         dflt="$dflt -posix"
4522                 fi
4523                 ;;
4524         esac
4525         case "$gccversion" in
4526         1*) ;;
4527         2.[0-8]*) ;;
4528         ?*)     echo " "
4529                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4530                 echo 'int main(void) { return 0; }' > gcctest.c
4531                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4532                         echo "Yes, it does." 2>&1
4533                         case "$ccflags" in
4534                         *strict-aliasing*) 
4535                                 echo "Leaving current flags $ccflags alone." 2>&1
4536                                 ;;
4537                         *) dflt="$dflt -fno-strict-aliasing" ;;
4538                         esac
4539                 else
4540                         echo "Nope, it doesn't, but that's ok." 2>&1
4541                 fi
4542                 ;;
4543         esac
4544         ;;
4545 esac
4546
4547 case "$mips_type" in
4548 *BSD*|'') inclwanted="$locincpth $usrinc";;
4549 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4550 esac
4551 for thisincl in $inclwanted; do
4552         if $test -d $thisincl; then
4553                 if $test x$thisincl != x$usrinc; then
4554                         case "$dflt" in
4555                         *" -I$thisincl "*);;
4556                         *) dflt="$dflt -I$thisincl ";;
4557                         esac
4558                 fi
4559         fi
4560 done
4561
4562 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4563         xxx=true;
4564 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4565         xxx=true;
4566 else
4567         xxx=false;
4568 fi;
4569 if $xxx; then
4570         case "$dflt" in
4571         *$2*);;
4572         *) dflt="$dflt -D$2";;
4573         esac;
4574 fi'
4575
4576 set signal.h LANGUAGE_C; eval $inctest
4577
4578 case "$usesocks" in
4579 $define)
4580         ccflags="$ccflags -DSOCKS"
4581         ;;
4582 esac
4583
4584 case "$hint" in
4585 default|recommended) dflt="$ccflags $dflt" ;;
4586 *) dflt="$ccflags";;
4587 esac
4588
4589 case "$dflt" in
4590 ''|' ') dflt=none;;
4591 esac
4592
4593 $cat <<EOH
4594
4595 Your C compiler may want other flags.  For this question you should include
4596 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4597 but you should NOT include libraries or ld flags like -lwhatever.  If you
4598 want $package to honor its debug switch, you should include -DDEBUGGING here.
4599 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4600
4601 To use no flags, specify the word "none".
4602
4603 EOH
4604 set X $dflt
4605 shift
4606 dflt=${1+"$@"}
4607 rp="Any additional cc flags?"
4608 . ./myread
4609 case "$ans" in
4610 none) ccflags='';;
4611 *) ccflags="$ans";;
4612 esac
4613
4614 : the following weeds options from ccflags that are of no interest to cpp
4615 case "$cppflags" in
4616 '') cppflags="$ccflags" ;;
4617 *)  cppflags="$cppflags $ccflags" ;;
4618 esac
4619 case "$gccversion" in
4620 1*) cppflags="$cppflags -D__GNUC__"
4621 esac
4622 case "$mips_type" in
4623 '');;
4624 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4625 esac
4626 case "$cppflags" in
4627 '');;
4628 *)
4629         echo " "
4630         echo "Let me guess what the preprocessor flags are..." >&4
4631         set X $cppflags
4632         shift
4633         cppflags=''
4634         $cat >cpp.c <<'EOM'
4635 #define BLURFL foo
4636
4637 BLURFL xx LFRULB
4638 EOM
4639         previous=''
4640         for flag in $*
4641         do
4642                 case "$flag" in
4643                 -*) ftry="$flag";;
4644                 *) ftry="$previous $flag";;
4645                 esac
4646                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4647                         >cpp1.out 2>/dev/null && \
4648                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4649                         >cpp2.out 2>/dev/null && \
4650                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4651                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4652                 then
4653                         cppflags="$cppflags $ftry"
4654                         previous=''
4655                 else
4656                         previous="$flag"
4657                 fi
4658         done
4659         set X $cppflags
4660         shift
4661         cppflags=${1+"$@"}
4662         case "$cppflags" in
4663         *-*)  echo "They appear to be: $cppflags";;
4664         esac
4665         $rm -f cpp.c cpp?.out
4666         ;;
4667 esac
4668
4669 : flags used in final linking phase
4670 case "$ldflags" in
4671 '') if ./venix; then
4672                 dflt='-i -z'
4673         else
4674                 dflt=''
4675         fi
4676         case "$ccflags" in
4677         *-posix*) dflt="$dflt -posix" ;;
4678         esac
4679         ;;
4680 *) dflt="$ldflags";;
4681 esac
4682
4683 : Try to guess additional flags to pick up local libraries.
4684 for thislibdir in $libpth; do
4685         case " $loclibpth " in
4686         *" $thislibdir "*)
4687                 case "$dflt " in 
4688                 *"-L$thislibdir "*) ;;
4689                 *)  dflt="$dflt -L$thislibdir" ;;
4690                 esac
4691                 ;;
4692         esac
4693 done
4694
4695 case "$dflt" in
4696 '') dflt='none' ;;
4697 esac
4698
4699 $cat <<EOH
4700
4701 Your C linker may need flags.  For this question you should
4702 include -L/whatever and any other flags used by the C linker, but you
4703 should NOT include libraries like -lwhatever.
4704
4705 Make sure you include the appropriate -L/path flags if your C linker
4706 does not normally search all of the directories you specified above,
4707 namely
4708         $libpth
4709 To use no flags, specify the word "none".
4710
4711 EOH
4712
4713 rp="Any additional ld flags (NOT including libraries)?"
4714 . ./myread
4715 case "$ans" in
4716 none) ldflags='';;
4717 *) ldflags="$ans";;
4718 esac
4719 rmlist="$rmlist pdp11"
4720
4721 : coherency check
4722 echo " "
4723 echo "Checking your choice of C compiler and flags for coherency..." >&4
4724 $cat > try.c <<'EOF'
4725 #include <stdio.h>
4726 int main() { printf("Ok\n"); exit(0); }
4727 EOF
4728 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4729 shift
4730 $cat >try.msg <<'EOM'
4731 I've tried to compile and run the following simple program:
4732
4733 EOM
4734 $cat try.c >> try.msg
4735
4736 $cat >> try.msg <<EOM
4737
4738 I used the command:
4739
4740         $*
4741         $run ./try
4742
4743 and I got the following output:
4744
4745 EOM
4746 dflt=y
4747 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4748         if $sh -c "$run ./try" >>try.msg 2>&1; then
4749                 xxx=`$run ./try`
4750                 case "$xxx" in
4751                 "Ok") dflt=n ;;
4752                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4753                         case " $libs " in
4754                         *" -lsfio "*)
4755                                 cat >> try.msg <<'EOQS'
4756 If $libs contains -lsfio, and sfio is mis-configured, then it
4757 sometimes (apparently) runs and exits with a 0 status, but with no
4758 output!  It may have to do with sfio's use of _exit vs. exit.
4759
4760 EOQS
4761                                 rp="You have a big problem.  Shall I abort Configure"
4762                                 dflt=y
4763                                 ;;
4764                         esac
4765                         ;;
4766                 esac
4767         else
4768                 echo "The program compiled OK, but exited with status $?." >>try.msg
4769                 rp="You have a problem.  Shall I abort Configure"
4770                 dflt=y
4771         fi
4772 else
4773         echo "I can't compile the test program." >>try.msg
4774         rp="You have a BIG problem.  Shall I abort Configure"
4775         dflt=y
4776 fi
4777 case "$dflt" in
4778 y)
4779         $cat try.msg >&4
4780         case "$knowitall" in
4781         '')
4782                 echo "(The supplied flags or libraries might be incorrect.)"
4783                 ;;
4784         *) dflt=n;;
4785         esac
4786         echo " "
4787         . ./myread
4788         case "$ans" in
4789         n*|N*) ;;
4790         *)      echo "Ok.  Stopping Configure." >&4
4791                 exit 1
4792                 ;;
4793         esac
4794         ;;
4795 n) echo "OK, that should do.";;
4796 esac
4797 $rm -f try try.* core
4798
4799 : define a shorthand compile call
4800 compile='
4801 mc_file=$1;
4802 shift;
4803 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4804 : define a shorthand compile call for compilations that should be ok.
4805 compile_ok='
4806 mc_file=$1;
4807 shift;
4808 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4809
4810 : check for lengths of integral types
4811 echo " "
4812 case "$intsize" in
4813 '')
4814         echo "Checking to see how big your integers are..." >&4
4815         $cat >try.c <<'EOCP'
4816 #include <stdio.h>
4817 int main()
4818 {
4819         printf("intsize=%d;\n", (int)sizeof(int));
4820         printf("longsize=%d;\n", (int)sizeof(long));
4821         printf("shortsize=%d;\n", (int)sizeof(short));
4822         exit(0);
4823 }
4824 EOCP
4825         set try
4826         if eval $compile_ok && $run ./try > /dev/null; then
4827                 eval `$run ./try`
4828                 echo "Your integers are $intsize bytes long."
4829                 echo "Your long integers are $longsize bytes long."
4830                 echo "Your short integers are $shortsize bytes long."
4831         else
4832                 $cat >&4 <<EOM
4833 !
4834 Help! I can't compile and run the intsize test program: please enlighten me!
4835 (This is probably a misconfiguration in your system or libraries, and
4836 you really ought to fix it.  Still, I'll try anyway.)
4837 !
4838 EOM
4839                 dflt=4
4840                 rp="What is the size of an integer (in bytes)?"
4841                 . ./myread
4842                 intsize="$ans"
4843                 dflt=$intsize
4844                 rp="What is the size of a long integer (in bytes)?"
4845                 . ./myread
4846                 longsize="$ans"
4847                 dflt=2
4848                 rp="What is the size of a short integer (in bytes)?"
4849                 . ./myread
4850                 shortsize="$ans"
4851         fi
4852         ;;
4853 esac
4854 $rm -f try try.*
4855
4856 : check for long long
4857 echo " "
4858 echo "Checking to see if you have long long..." >&4
4859 echo 'int main() { long long x = 7; return 0; }' > try.c
4860 set try
4861 if eval $compile; then
4862         val="$define"
4863         echo "You have long long."
4864 else
4865         val="$undef"
4866         echo "You do not have long long."
4867 fi
4868 $rm try.*
4869 set d_longlong
4870 eval $setvar
4871
4872 : check for length of long long
4873 case "${d_longlong}${longlongsize}" in
4874 $define)
4875         echo " "
4876         echo "Checking to see how big your long longs are..." >&4
4877         $cat >try.c <<'EOCP'
4878 #include <stdio.h>
4879 int main()
4880 {
4881     printf("%d\n", (int)sizeof(long long));
4882     return(0);
4883 }
4884 EOCP
4885         set try
4886         if eval $compile_ok; then
4887                 longlongsize=`$run ./try`
4888                 echo "Your long longs are $longlongsize bytes long."
4889         else
4890                 dflt='8'
4891                 echo " "
4892                 echo "(I can't seem to compile the test program.  Guessing...)"
4893                 rp="What is the size of a long long (in bytes)?"
4894                 . ./myread
4895                 longlongsize="$ans"
4896         fi
4897         if $test "X$longsize" = "X$longlongsize"; then
4898                 echo "(That isn't any different from an ordinary long.)"
4899         fi      
4900         ;;
4901 esac
4902 $rm -f try.* try
4903
4904 : determine filename position in cpp output
4905 echo " "
4906 echo "Computing filename position in cpp output for #include directives..." >&4
4907 case "$osname" in
4908 vos) testaccess=-e ;;
4909 *)   testaccess=-r ;;
4910 esac
4911 echo '#include <stdio.h>' > foo.c
4912 $cat >fieldn <<EOF
4913 $startsh
4914 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4915 $grep '^[       ]*#.*stdio\.h' | \
4916 while read cline; do
4917         pos=1
4918         set \$cline
4919         while $test \$# -gt 0; do
4920                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4921                         echo "\$pos"
4922                         exit 0
4923                 fi
4924                 shift
4925                 pos=\`expr \$pos + 1\`
4926         done
4927 done
4928 EOF
4929 chmod +x fieldn
4930 fieldn=`./fieldn`
4931 $rm -f foo.c fieldn
4932 case $fieldn in
4933 '') pos='???';;
4934 1) pos=first;;
4935 2) pos=second;;
4936 3) pos=third;;
4937 *) pos="${fieldn}th";;
4938 esac
4939 echo "Your cpp writes the filename in the $pos field of the line."
4940
4941 case "$osname" in
4942 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4943 *)   cppfilter='' ;;
4944 esac
4945 : locate header file
4946 $cat >findhdr <<EOF
4947 $startsh
4948 wanted=\$1
4949 name=''
4950 for usrincdir in $usrinc
4951 do
4952         if test -f \$usrincdir/\$wanted; then
4953                 echo "\$usrincdir/\$wanted"
4954                 exit 0
4955         fi
4956 done
4957 awkprg='{ print \$$fieldn }'
4958 echo "#include <\$wanted>" > foo\$\$.c
4959 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4960 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4961 while read cline; do
4962         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4963         case "\$name" in
4964         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4965         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4966         *) exit 2;;
4967         esac;
4968 done;
4969 #
4970 # status = 0: grep returned 0 lines, case statement not executed
4971 # status = 1: headerfile found
4972 # status = 2: while loop executed, no headerfile found
4973 #
4974 status=\$?
4975 $rm -f foo\$\$.c;
4976 if test \$status -eq 1; then
4977         exit 0;
4978 fi
4979 exit 1
4980 EOF
4981 chmod +x findhdr
4982
4983 : define an alternate in-header-list? function
4984 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4985 cont=true; xxf="echo \"<\$1> found.\" >&4";
4986 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4987 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4988 esac;
4989 case $# in 4) instead=instead;; *) instead="at last";; esac;
4990 while $test "$cont"; do
4991         xxx=`./findhdr $1`
4992         var=$2; eval "was=\$$2";
4993         if $test "$xxx" && $test -r "$xxx";
4994         then eval $xxf;
4995         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4996                 cont="";
4997         else eval $xxnf;
4998         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4999         set $yyy; shift; shift; yyy=$@;
5000         case $# in 0) cont="";;
5001         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5002                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5003         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5004                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5005         esac;
5006 done;
5007 while $test "$yyy";
5008 do set $yyy; var=$2; eval "was=\$$2";
5009         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5010         set $yyy; shift; shift; yyy=$@;
5011 done'
5012
5013 : see if inttypes.h is available
5014 : we want a real compile instead of Inhdr because some systems
5015 : have an inttypes.h which includes non-existent headers
5016 echo " "
5017 $cat >try.c <<EOCP
5018 #include <inttypes.h>
5019 int main() {
5020         static int32_t foo32 = 0x12345678;
5021 }
5022 EOCP
5023 set try
5024 if eval $compile; then
5025         echo "<inttypes.h> found." >&4
5026         val="$define"
5027 else
5028         echo "<inttypes.h> NOT found." >&4
5029         val="$undef"
5030 fi
5031 $rm -f try.c try
5032 set i_inttypes
5033 eval $setvar
5034
5035 : check for int64_t
5036 echo " "
5037 echo "Checking to see if you have int64_t..." >&4
5038 $cat >try.c <<EOCP
5039 #include <sys/types.h>
5040 #$i_inttypes I_INTTYPES
5041 #ifdef I_INTTYPES
5042 #include <inttypes.h>
5043 #endif
5044 int main() { int64_t x = 7; }
5045 EOCP
5046 set try
5047 if eval $compile; then
5048         val="$define"
5049         echo "You have int64_t."
5050 else
5051         val="$undef"
5052         echo "You do not have int64_t."
5053 fi
5054 $rm -f try try.*
5055 set d_int64_t
5056 eval $setvar
5057
5058
5059 echo " "
5060 echo "Checking which 64-bit integer type we could use..." >&4
5061
5062 case "$intsize" in
5063 8) val=int
5064    set quadtype
5065    eval $setvar
5066    val='"unsigned int"'
5067    set uquadtype
5068    eval $setvar
5069    quadkind=1
5070    ;;
5071 *) case "$longsize" in
5072    8) val=long
5073       set quadtype
5074       eval $setvar
5075       val='"unsigned long"'
5076       set uquadtype
5077       eval $setvar
5078       quadkind=2
5079       ;;
5080    *) case "$d_longlong:$longlongsize" in
5081       define:8)
5082         val='"long long"'
5083         set quadtype
5084         eval $setvar
5085         val='"unsigned long long"'
5086         set uquadtype
5087         eval $setvar
5088         quadkind=3
5089         ;;
5090       *) case "$d_int64_t" in
5091          define)
5092            val=int64_t
5093            set quadtype
5094            eval $setvar
5095            val=uint64_t
5096            set uquadtype
5097            eval $setvar
5098            quadkind=4
5099            ;;
5100          esac
5101          ;;
5102       esac
5103       ;;
5104    esac
5105    ;;
5106 esac
5107
5108 case "$quadtype" in
5109 '')     echo "Alas, no 64-bit integer types in sight." >&4
5110         d_quad="$undef"
5111         ;;
5112 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5113         d_quad="$define"
5114         ;;
5115 esac
5116
5117
5118 case "$uselonglong" in
5119 "$define"|true|[yY]*)
5120         cat <<EOM >&4
5121
5122 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5123 EOM
5124         use64bitint="$define"
5125         ;;
5126 esac                          
5127 case "$use64bits" in
5128 "$define"|true|[yY]*)
5129         cat <<EOM >&4
5130
5131 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5132 EOM
5133         use64bitint="$define"
5134         ;;
5135 esac                          
5136 case "$use64bitints" in
5137 "$define"|true|[yY]*)
5138         cat <<EOM >&4
5139
5140 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5141 EOM
5142         use64bitint="$define"
5143         ;;
5144 esac                          
5145 case "$use64bitsint" in
5146 "$define"|true|[yY]*)
5147         cat <<EOM >&4
5148
5149 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5150 EOM
5151         use64bitint="$define"
5152         ;;
5153 esac                          
5154 case "$uselonglongs" in
5155 "$define"|true|[yY]*)
5156         cat <<EOM >&4
5157
5158 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5159 EOM
5160         use64bitint="$define"
5161         ;;
5162 esac                          
5163 case "$use64bitsall" in
5164 "$define"|true|[yY]*)
5165         cat <<EOM >&4
5166
5167 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5168 EOM
5169         use64bitall="$define"
5170         ;;
5171 esac                          
5172
5173 case "$ccflags" in
5174 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5175 esac
5176 case "$use64bitall" in
5177 "$define"|true|[yY]*) use64bitint="$define" ;;
5178 esac
5179
5180 case "$longsize" in
5181 8) cat <<EOM
5182
5183 You have natively 64-bit long integers.
5184 EOM
5185    val="$define"
5186    ;;
5187 *) case "$use64bitint" in
5188    "$define"|true|[yY]*) dflt='y';;
5189    *) dflt='n';;
5190    esac
5191    case "$d_quad" in
5192    "$define") ;;
5193    *) dflt='n' ;;
5194    esac
5195    cat <<EOM
5196
5197 Perl can be built to take advantage of 64-bit integer types
5198 on some systems.  To do so, Configure can be run with -Duse64bitint.
5199 Choosing this option will most probably introduce binary incompatibilities.
5200
5201 If this doesn't make any sense to you, just accept the default '$dflt'.
5202 (The default has been chosen based on your configuration.)
5203 EOM
5204    rp='Try to use 64-bit integers, if available?'
5205    . ./myread
5206    case "$ans" in
5207    [yY]*) val="$define" ;;
5208    *)     val="$undef"  ;;
5209    esac
5210    ;;
5211 esac
5212 set use64bitint
5213 eval $setvar
5214
5215 case "$use64bitall" in
5216 "$define"|true|[yY]*) dflt='y' ;;
5217 *) case "$longsize" in
5218    8) dflt='y' ;;
5219    *) dflt='n' ;;
5220    esac
5221    ;;
5222 esac    
5223 cat <<EOM
5224
5225 You may also choose to try maximal 64-bitness.  It means using as much
5226 64-bitness as possible on the platform.  This in turn means even more
5227 binary incompatibilities.  On the other hand, your platform may not
5228 have any more 64-bitness available than what you already have chosen.
5229
5230 If this doesn't make any sense to you, just accept the default '$dflt'.
5231 (The default has been chosen based on your configuration.)
5232 EOM
5233 rp='Try to use maximal 64-bit support, if available?'
5234 . ./myread
5235 case "$ans" in
5236 [yY]*) val="$define" ;;
5237 *)     val="$undef"  ;;
5238 esac
5239 set use64bitall
5240 eval $setvar
5241 case "$use64bitall" in
5242 "$define")
5243         case "$use64bitint" in
5244         "$undef")
5245                 cat <<EOM
5246
5247 Since you have chosen a maximally 64-bit build, I'm also turning on
5248 the use of 64-bit integers.
5249 EOM
5250                 use64bitint="$define" ;;
5251         esac
5252         ;;
5253 esac
5254
5255 case "$use64bitint" in
5256 "$define"|true|[yY]*)
5257 : Look for a hint-file generated 'call-back-unit'.  If the
5258 : user has specified that a 64-bit perl is to be built,
5259 : we may need to set or change some other defaults.
5260         if $test -f use64bitint.cbu; then
5261                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5262                 . ./use64bitint.cbu
5263         fi
5264         case "$longsize" in
5265         4) case "$archname64" in
5266            '') archname64=64int ;;
5267            esac
5268            ;;
5269         esac
5270         ;;
5271 esac
5272
5273 case "$use64bitall" in
5274 "$define"|true|[yY]*)
5275 : Look for a hint-file generated 'call-back-unit'.  If the
5276 : user has specified that a maximally 64-bit perl is to be built,
5277 : we may need to set or change some other defaults.
5278         if $test -f use64bitall.cbu; then
5279                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5280                 . ./use64bitall.cbu
5281         fi
5282         case "$longsize" in
5283         4) case "$archname64" in
5284            ''|64int) archname64=64all ;;
5285            esac
5286            ;;
5287         esac
5288         ;;
5289 esac
5290
5291 echo " "
5292 echo "Checking for GNU C Library..." >&4
5293 cat >try.c <<EOM
5294 #include <stdio.h>
5295 int main()
5296 {
5297 #ifdef __GLIBC__
5298     exit(0);
5299 #else
5300     exit(1);
5301 #endif
5302 }
5303 EOM
5304 set try
5305 if eval $compile_ok && $run ./try; then
5306         val="$define"
5307         echo "You are using the GNU C Library"
5308 else
5309         val="$undef"
5310         echo "You are not using the GNU C Library"
5311 fi
5312 $rm -f try try.*
5313 set d_gnulibc
5314 eval $setvar
5315
5316 : see if nm is to be used to determine whether a symbol is defined or not
5317 case "$usenm" in
5318 '')
5319         dflt=''
5320         case "$d_gnulibc" in
5321         "$define")
5322                 echo " "
5323                 echo "nm probably won't work on the GNU C Library." >&4
5324                 dflt=n
5325                 ;;
5326         esac
5327         case "$dflt" in
5328         '') 
5329                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5330                         echo " "
5331                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5332                         echo "'nm' won't be sufficient on this sytem." >&4
5333                         dflt=n
5334                 fi
5335                 ;;
5336         esac
5337         case "$dflt" in
5338         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5339                 if $test $dflt -gt 20; then
5340                         dflt=y
5341                 else
5342                         dflt=n
5343                 fi
5344                 ;;
5345         esac
5346         ;;
5347 *)
5348         case "$usenm" in
5349         true|$define) dflt=y;;
5350         *) dflt=n;;
5351         esac
5352         ;;
5353 esac
5354 $cat <<EOM
5355
5356 I can use $nm to extract the symbols from your C libraries. This
5357 is a time consuming task which may generate huge output on the disk (up
5358 to 3 megabytes) but that should make the symbols extraction faster. The
5359 alternative is to skip the 'nm' extraction part and to compile a small
5360 test program instead to determine whether each symbol is present. If
5361 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5362 this may be the best solution.
5363
5364 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5365
5366 EOM
5367 rp="Shall I use $nm to extract C symbols from the libraries?"
5368 . ./myread
5369 case "$ans" in
5370 [Nn]*) usenm=false;;
5371 *) usenm=true;;
5372 esac
5373
5374 runnm=$usenm
5375 case "$reuseval" in
5376 true) runnm=false;;
5377 esac
5378
5379 : nm options which may be necessary
5380 case "$nm_opt" in
5381 '') if $test -f /mach_boot; then
5382                 nm_opt=''       # Mach
5383         elif $test -d /usr/ccs/lib; then
5384                 nm_opt='-p'     # Solaris (and SunOS?)
5385         elif $test -f /dgux; then
5386                 nm_opt='-p'     # DG-UX
5387         elif $test -f /lib64/rld; then
5388                 nm_opt='-p'     # 64-bit Irix
5389         else
5390                 nm_opt=''
5391         fi;;
5392 esac
5393
5394 : nm options which may be necessary for shared libraries but illegal
5395 : for archive libraries.  Thank you, Linux.
5396 case "$nm_so_opt" in
5397 '')     case "$myuname" in
5398         *linux*)
5399                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5400                         nm_so_opt='--dynamic'
5401                 fi
5402                 ;;
5403         esac
5404         ;;
5405 esac
5406
5407 case "$runnm" in
5408 true)
5409 : get list of predefined functions in a handy place
5410 echo " "
5411 case "$libc" in
5412 '') libc=unknown
5413         case "$libs" in
5414         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5415         esac
5416         ;;
5417 esac
5418 case "$libs" in
5419 '') ;;
5420 *)  for thislib in $libs; do
5421         case "$thislib" in
5422         -lc|-lc_s)
5423                 : Handle C library specially below.
5424                 ;;
5425         -l*)
5426                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5427                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5428                         :
5429                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5430                         :
5431                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5432                         :
5433                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5434                         :
5435                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5436                         :
5437                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5438                         :
5439                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5440                         :
5441                 else
5442                         try=''
5443                 fi
5444                 libnames="$libnames $try"
5445                 ;;
5446         *) libnames="$libnames $thislib" ;;
5447         esac
5448         done
5449         ;;
5450 esac
5451 xxx=normal
5452 case "$libc" in
5453 unknown)
5454         set /lib/libc.$so
5455         for xxx in $libpth; do
5456                 $test -r $1 || set $xxx/libc.$so
5457                 : The messy sed command sorts on library version numbers.
5458                 $test -r $1 || \
5459                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5460                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5461                                 h
5462                                 s/[0-9][0-9]*/0000&/g
5463                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5464                                 G
5465                                 s/\n/ /' | \
5466                          $sort | $sed -e 's/^.* //'`
5467                 eval set \$$#
5468         done
5469         $test -r $1 || set /usr/ccs/lib/libc.$so
5470         $test -r $1 || set /lib/libsys_s$_a
5471         ;;
5472 *)
5473         set blurfl
5474         ;;
5475 esac
5476 if $test -r "$1"; then
5477         echo "Your (shared) C library seems to be in $1."
5478         libc="$1"
5479 elif $test -r /lib/libc && $test -r /lib/clib; then
5480         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5481         xxx=apollo
5482         libc='/lib/clib /lib/libc'
5483         if $test -r /lib/syslib; then
5484                 echo "(Your math library is in /lib/syslib.)"
5485                 libc="$libc /lib/syslib"
5486         fi
5487 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5488         echo "Your C library seems to be in $libc, as you said before."
5489 elif $test -r $incpath/usr/lib/libc$_a; then
5490         libc=$incpath/usr/lib/libc$_a;
5491         echo "Your C library seems to be in $libc.  That's fine."
5492 elif $test -r /lib/libc$_a; then
5493         libc=/lib/libc$_a;
5494         echo "Your C library seems to be in $libc.  You're normal."
5495 else
5496         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5497                 :
5498         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5499                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5500         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5501                 :
5502         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5503                 :
5504         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5505                 :
5506         else
5507                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5508         fi
5509         if $test -r "$tans"; then
5510                 echo "Your C library seems to be in $tans, of all places."
5511                 libc=$tans
5512         else
5513                 libc='blurfl'
5514         fi
5515 fi
5516 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5517         dflt="$libc"
5518         cat <<EOM
5519
5520 If the guess above is wrong (which it might be if you're using a strange
5521 compiler, or your machine supports multiple models), you can override it here.
5522
5523 EOM
5524 else
5525         dflt=''
5526         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5527         cat >&4 <<EOM
5528 I can't seem to find your C library.  I've looked in the following places:
5529
5530 EOM
5531         $sed 's/^/      /' libpath
5532         cat <<EOM
5533
5534 None of these seems to contain your C library. I need to get its name...
5535
5536 EOM
5537 fi
5538 fn=f
5539 rp='Where is your C library?'
5540 . ./getfile
5541 libc="$ans"
5542
5543 echo " "
5544 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5545 set X `cat libnames`
5546 shift
5547 xxx=files
5548 case $# in 1) xxx=file; esac
5549 echo "Extracting names from the following $xxx for later perusal:" >&4
5550 echo " "
5551 $sed 's/^/      /' libnames >&4
5552 echo " "
5553 $echo $n "This may take a while...$c" >&4
5554
5555 for file in $*; do
5556         case $file in
5557         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5558         *) $nm $nm_opt $file 2>/dev/null;;
5559         esac
5560 done >libc.tmp
5561
5562 $echo $n ".$c"
5563 $grep fprintf libc.tmp > libc.ptf
5564 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5565 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5566 xxx='[ADTSIW]'
5567 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5568         eval $xscan;\
5569         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5570                 eval $xrun
5571 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5572         eval $xscan;\
5573         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5574                 eval $xrun
5575 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5576         eval $xscan;\
5577         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5578                 eval $xrun
5579 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5580         eval $xscan;\
5581         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5582                 eval $xrun
5583 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5584         eval $xscan;\
5585         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5586                 eval $xrun
5587 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5588         eval $xscan;\
5589         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5590                 eval $xrun
5591 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5592                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5593         eval $xscan;\
5594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5595                 eval $xrun
5596 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5597         eval $xscan;\
5598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5599                 eval $xrun
5600 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5601         eval $xscan;\
5602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5603                 eval $xrun
5604 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5605         eval $xscan;\
5606         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5607                 eval $xrun
5608 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5609         eval $xscan;\
5610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5611                 eval $xrun
5612 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5613         eval $xscan;\
5614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5615                 eval $xrun
5616 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5617         eval $xscan;\
5618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5619                 eval $xrun
5620 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5621         eval $xscan;\
5622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5623                 eval $xrun
5624 else
5625         $nm -p $* 2>/dev/null >libc.tmp
5626         $grep fprintf libc.tmp > libc.ptf
5627         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5628                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5629         then
5630                 nm_opt='-p'
5631                 eval $xrun
5632         else
5633                 echo " "
5634                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5635                 com=''
5636                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5637                         for thisname in $libnames $libc; do
5638                                 $ar t $thisname >>libc.tmp
5639                         done
5640                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5641                         echo "Ok." >&4
5642                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5643                         # Repeat libc to extract forwarders to DLL entries too
5644                         for thisname in $libnames $libc; do
5645                                 $ar tv $thisname >>libc.tmp
5646                                 # Revision 50 of EMX has bug in $ar.
5647                                 # it will not extract forwarders to DLL entries
5648                                 # Use emximp which will extract exactly them.
5649                                 emximp -o tmp.imp $thisname \
5650                                     2>/dev/null && \
5651                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5652                                     < tmp.imp >>libc.tmp
5653                                 $rm tmp.imp
5654                         done
5655                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5656                         echo "Ok." >&4
5657                 else
5658                         echo "$ar didn't seem to work right." >&4
5659                         echo "Maybe this is a Cray...trying bld instead..." >&4
5660                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5661                         then
5662                                 for thisname in $libnames; do
5663                                         bld t $libnames | \
5664                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5665                                         $ar t $thisname >>libc.tmp
5666                                 done
5667                                 echo "Ok." >&4
5668                         else
5669                                 echo "That didn't work either.  Giving up." >&4
5670                                 exit 1
5671                         fi
5672                 fi
5673         fi
5674 fi
5675 nm_extract="$com"
5676 if $test -f /lib/syscalls.exp; then
5677         echo " "
5678         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5679         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5680 fi
5681 ;;
5682 esac
5683 $rm -f libnames libpath
5684
5685 : is a C symbol defined?
5686 csym='tlook=$1;
5687 case "$3" in
5688 -v) tf=libc.tmp; tc=""; tdc="";;
5689 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5690 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5691 esac;
5692 tx=yes;
5693 case "$reuseval-$4" in
5694 true-) ;;
5695 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5696 esac;
5697 case "$tx" in
5698 yes)
5699         case "$runnm" in
5700         true)
5701                 if $contains $tlook $tf >/dev/null 2>&1;
5702                 then tval=true;
5703                 else tval=false;
5704                 fi;;
5705         *)
5706                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5707                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5708                 then tval=true;
5709                 else tval=false;
5710                 fi;
5711                 $rm -f t t.c;;
5712         esac;;
5713 *)
5714         case "$tval" in
5715         $define) tval=true;;
5716         *) tval=false;;
5717         esac;;
5718 esac;
5719 eval "$2=$tval"'
5720
5721 : define an is-in-libc? function
5722 inlibc='echo " "; td=$define; tu=$undef;
5723 sym=$1; var=$2; eval "was=\$$2";
5724 tx=yes;
5725 case "$reuseval$was" in
5726 true) ;;
5727 true*) tx=no;;
5728 esac;
5729 case "$tx" in
5730 yes)
5731         set $sym tres -f;
5732         eval $csym;
5733         case "$tres" in
5734         true)
5735                 echo "$sym() found." >&4;
5736                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5737         *)
5738                 echo "$sym() NOT found." >&4;
5739                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5740         esac;;
5741 *)
5742         case "$was" in
5743         $define) echo "$sym() found." >&4;;
5744         *) echo "$sym() NOT found." >&4;;
5745         esac;;
5746 esac'
5747
5748 : see if sqrtl exists
5749 set sqrtl d_sqrtl
5750 eval $inlibc
5751
5752 : check for length of double
5753 echo " "
5754 case "$doublesize" in
5755 '')
5756         echo "Checking to see how big your double precision numbers are..." >&4
5757         $cat >try.c <<'EOCP'
5758 #include <stdio.h>
5759 int main()
5760 {
5761     printf("%d\n", (int)sizeof(double));
5762     exit(0);
5763 }
5764 EOCP
5765         set try
5766         if eval $compile_ok; then
5767                 doublesize=`$run ./try`
5768                 echo "Your double is $doublesize bytes long."
5769         else
5770                 dflt='8'
5771                 echo "(I can't seem to compile the test program.  Guessing...)"
5772                 rp="What is the size of a double precision number (in bytes)?"
5773                 . ./myread
5774                 doublesize="$ans"
5775         fi
5776         ;;
5777 esac
5778 $rm -f try.c try
5779
5780 : check for long doubles
5781 echo " "
5782 echo "Checking to see if you have long double..." >&4
5783 echo 'int main() { long double x = 7.0; }' > try.c
5784 set try
5785 if eval $compile; then
5786         val="$define"
5787         echo "You have long double."
5788 else
5789         val="$undef"
5790         echo "You do not have long double."
5791 fi
5792 $rm try.*
5793 set d_longdbl
5794 eval $setvar
5795
5796 : check for length of long double
5797 case "${d_longdbl}${longdblsize}" in
5798 $define)
5799         echo " "
5800         echo "Checking to see how big your long doubles are..." >&4
5801         $cat >try.c <<'EOCP'
5802 #include <stdio.h>
5803 int main()
5804 {
5805         printf("%d\n", sizeof(long double));
5806 }
5807 EOCP
5808         set try
5809         set try
5810         if eval $compile; then
5811                 longdblsize=`$run ./try`
5812                 echo "Your long doubles are $longdblsize bytes long."
5813         else
5814                 dflt='8'
5815                 echo " "
5816                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5817                 rp="What is the size of a long double (in bytes)?"
5818                 . ./myread
5819                 longdblsize="$ans"
5820         fi
5821         if $test "X$doublesize" = "X$longdblsize"; then
5822                 echo "(That isn't any different from an ordinary double.)"
5823         fi      
5824         ;;
5825 esac
5826 $rm -f try.* try
5827
5828 echo " "
5829
5830 if $test X"$d_longdbl" = X"$define"; then
5831
5832 echo "Checking how to print long doubles..." >&4
5833
5834 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5835         $cat >try.c <<'EOCP'
5836 #include <sys/types.h>
5837 #include <stdio.h>
5838 int main() {
5839   double d = 123.456;
5840   printf("%.3f\n", d);
5841 }
5842 EOCP
5843         set try
5844         if eval $compile; then
5845                 yyy=`$run ./try`
5846                 case "$yyy" in
5847                 123.456)
5848                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5849                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5850                         echo "We will use %f."
5851                         ;;
5852                 esac
5853         fi
5854 fi
5855
5856 if $test X"$sPRIfldbl" = X; then
5857         $cat >try.c <<'EOCP'
5858 #include <sys/types.h>
5859 #include <stdio.h>
5860 int main() {
5861   long double d = 123.456;
5862   printf("%.3Lf\n", d);
5863 }
5864 EOCP
5865         set try
5866         if eval $compile; then
5867                 yyy=`$run ./try`
5868                 case "$yyy" in
5869                 123.456)
5870                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5871                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5872                         echo "We will use %Lf."
5873                         ;;
5874                 esac
5875         fi
5876 fi
5877
5878 if $test X"$sPRIfldbl" = X; then
5879         $cat >try.c <<'EOCP'
5880 #include <sys/types.h>
5881 #include <stdio.h>
5882 int main() {
5883   long double d = 123.456;
5884   printf("%.3llf\n", d);
5885 }
5886 EOCP
5887         set try
5888         if eval $compile; then
5889                 yyy=`$run ./try`
5890                 case "$yyy" in
5891                 123.456)
5892                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5893                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5894                         echo "We will use %llf."
5895                         ;;
5896                 esac
5897         fi
5898 fi
5899
5900 if $test X"$sPRIfldbl" = X; then
5901         $cat >try.c <<'EOCP'
5902 #include <sys/types.h>
5903 #include <stdio.h>
5904 int main() {
5905   long double d = 123.456;
5906   printf("%.3lf\n", d);
5907 }
5908 EOCP
5909         set try
5910         if eval $compile; then
5911                 yyy=`$run ./try`
5912                 case "$yyy" in
5913                 123.456)
5914                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
5915                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
5916                         echo "We will use %lf."
5917                         ;;
5918                 esac
5919         fi
5920 fi
5921
5922 if $test X"$sPRIfldbl" = X; then
5923         echo "Cannot figure out how to print long doubles." >&4
5924 else
5925         sSCNfldbl=$sPRIfldbl    # expect consistency
5926 fi
5927
5928 $rm -f try try.*
5929
5930 fi # d_longdbl
5931
5932 case "$sPRIfldbl" in
5933 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
5934         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
5935         d_SCNfldbl="$undef";
5936         ;;
5937 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
5938         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
5939         d_SCNfldbl="$define";
5940         ;;
5941 esac
5942
5943 : see if modfl exists
5944 set modfl d_modfl
5945 eval $inlibc
5946
5947 d_modfl_pow32_bug="$undef"
5948
5949 case "$d_longdbl$d_modfl" in
5950 $define$define)
5951         $cat <<EOM
5952 Checking to see whether your modfl() is okay for large values...
5953 EOM
5954 $cat >try.c <<EOCP
5955 #include <math.h> 
5956 #include <stdio.h>
5957 int main() {
5958     long double nv = 4294967303.15;
5959     long double v, w;
5960     v = modfl(nv, &w);         
5961 #ifdef __GLIBC__
5962     printf("glibc");
5963 #endif
5964     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
5965     return 0;
5966 }
5967 EOCP
5968         case "$osname:$gccversion" in
5969         aix:)   saveccflags="$ccflags"
5970                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
5971         esac
5972         set try
5973         if eval $compile; then
5974                 foo=`$run ./try`
5975                 case "$foo" in
5976                 *" 4294967303.150000 1.150000 4294967302.000000")
5977                         echo >&4 "Your modfl() is broken for large values."
5978                         d_modfl_pow32_bug="$define"
5979                         case "$foo" in
5980                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
5981                         ;;
5982                         esac
5983                         ;;
5984                 *" 4294967303.150000 0.150000 4294967303.000000")
5985                         echo >&4 "Your modfl() seems okay for large values."
5986                         ;;
5987                 *)      echo >&4 "I don't understand your modfl() at all."
5988                         d_modfl="$undef"
5989                         ;;
5990                 esac
5991                 $rm -f try.* try core core.try.*
5992         else
5993                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
5994                 d_modfl="$undef"
5995         fi
5996         case "$osname:$gccversion" in
5997         aix:)   ccflags="$saveccflags" ;; # restore
5998         esac
5999         ;;
6000 esac
6001
6002 case "$ccflags" in
6003 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6004 esac
6005
6006 case "$uselongdouble" in
6007 $define|true|[yY]*)     dflt='y';;
6008 *) dflt='n';;
6009 esac
6010 cat <<EOM
6011
6012 Perl can be built to take advantage of long doubles which
6013 (if available) may give more accuracy and range for floating point numbers.
6014
6015 If this doesn't make any sense to you, just accept the default '$dflt'.
6016 EOM
6017 rp='Try to use long doubles if available?'
6018 . ./myread
6019 case "$ans" in
6020 y|Y)    val="$define"   ;;
6021 *)      val="$undef"    ;;
6022 esac
6023 set uselongdouble
6024 eval $setvar
6025
6026 case "$uselongdouble" in
6027 true|[yY]*) uselongdouble="$define" ;;
6028 esac
6029
6030 case "$uselongdouble" in
6031 $define)
6032 : Look for a hint-file generated 'call-back-unit'.  If the
6033 : user has specified that long doubles should be used,
6034 : we may need to set or change some other defaults.
6035         if $test -f uselongdouble.cbu; then
6036                 echo "Your platform has some specific hints for long doubles, using them..."
6037                 . ./uselongdouble.cbu
6038         else
6039                 $cat <<EOM
6040 (Your platform doesn't have any specific hints for long doubles.)
6041 EOM
6042         fi
6043         ;;
6044 esac
6045
6046 message=X
6047 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6048 $define:$define:$define)
6049         : You have both
6050         ;;
6051 $define:$define:$undef)
6052         message="I could not find modfl"
6053         ;;
6054 $define:$undef:$define)
6055         message="I could not find sqrtl"
6056         ;;
6057 $define:$undef:$undef)
6058         message="I found neither sqrtl nor modfl"
6059         ;;
6060 esac
6061
6062 if $test "$message" != X; then
6063         $cat <<EOM >&4
6064
6065 *** You requested the use of long doubles but you do not seem to have
6066 *** the mathematic functions for long doubles.
6067 *** ($message)
6068 *** I'm disabling the use of long doubles.
6069
6070 EOM
6071
6072         uselongdouble=$undef
6073 fi
6074
6075 case "$useperlio" in
6076 $define|true|[yY]*|'')  dflt='y';;
6077 *) dflt='n';;
6078 esac
6079 cat <<EOM
6080
6081 Previous version of $package used the standard IO mechanisms as
6082 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6083 alternate IO mechanisms via the PerlIO abstraction layer, but the
6084 stdio mechanism is still available if needed.  The abstraction layer
6085 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6086 Using PerlIO with sfio may cause problems with some extension modules.
6087
6088 If this doesn't make any sense to you, just accept the default '$dflt'.
6089 EOM
6090 rp='Use the PerlIO abstraction layer?'
6091 . ./myread
6092 case "$ans" in
6093 y|Y) 
6094         val="$define"
6095         ;;
6096 *)      
6097         echo "Ok, doing things the stdio way."
6098         val="$undef"
6099         ;;
6100 esac
6101 set useperlio
6102 eval $setvar 
6103
6104 case "$usesocks" in
6105 $define|true|[yY]*)
6106         case "$useperlio" in
6107         $define|true|[yY]*) ;;
6108         *)      cat >&4 <<EOM
6109
6110 You are using the SOCKS proxy protocol library which means that you
6111 should also use the PerlIO layer.  You may be headed for trouble.
6112
6113 EOM
6114                 ;;
6115         esac
6116         ;;
6117 esac
6118
6119         
6120 : determine the architecture name
6121 echo " "
6122 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6123         tarch=`arch`"-$osname"
6124 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6125         if uname -m > tmparch 2>&1 ; then
6126                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6127                         -e 's/$/'"-$osname/" tmparch`
6128         else
6129                 tarch="$osname"
6130         fi
6131         $rm -f tmparch
6132 else
6133         tarch="$osname"
6134 fi
6135 case "$myarchname" in
6136 ''|"$tarch") ;;
6137 *)
6138         echo "(Your architecture name used to be $myarchname.)"
6139         archname=''
6140         ;;
6141 esac
6142 case "$targetarch" in
6143 '') ;;
6144 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6145 esac
6146 myarchname="$tarch"
6147 case "$archname" in
6148 '') dflt="$tarch";;
6149 *) dflt="$archname";;
6150 esac
6151 rp='What is your architecture name'
6152 . ./myread
6153 archname="$ans"
6154 case "$usethreads" in
6155 $define)
6156         echo "Threads selected." >&4
6157         case "$archname" in
6158         *-thread*) echo "...and architecture name already has -thread." >&4
6159                 ;;
6160         *)      archname="$archname-thread"
6161                 echo "...setting architecture name to $archname." >&4
6162                 ;;
6163         esac
6164         ;;
6165 esac
6166 case "$usemultiplicity" in
6167 $define)
6168         echo "Multiplicity selected." >&4
6169         case "$archname" in
6170         *-multi*) echo "...and architecture name already has -multi." >&4
6171                 ;;
6172         *)      archname="$archname-multi"
6173                 echo "...setting architecture name to $archname." >&4
6174                 ;;
6175         esac
6176         ;;
6177 esac
6178 case "$use64bitint$use64bitall" in
6179 *"$define"*)
6180         case "$archname64" in
6181         '')
6182                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6183                 ;;
6184         *)
6185                 case "$use64bitint" in
6186                 "$define") echo "64 bit integers selected." >&4 ;;
6187                 esac
6188                 case "$use64bitall" in
6189                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6190                 esac
6191                 case "$archname" in
6192                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6193                         ;;
6194                 *)      archname="$archname-$archname64"
6195                         echo "...setting architecture name to $archname." >&4
6196                         ;;
6197                 esac
6198                 ;;
6199         esac
6200 esac
6201 case "$uselongdouble" in
6202 $define)
6203         echo "Long doubles selected." >&4
6204         case "$longdblsize" in
6205         $doublesize)
6206                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6207                 ;;
6208         *)
6209                 case "$archname" in
6210                 *-ld*) echo "...and architecture name already has -ld." >&4
6211                         ;;
6212                 *)      archname="$archname-ld"
6213                         echo "...setting architecture name to $archname." >&4
6214                         ;;
6215                 esac
6216                 ;;
6217         esac
6218         ;;
6219 esac
6220 case "$useperlio" in
6221 $define)
6222         echo "Perlio selected." >&4
6223         ;;
6224 *)
6225         echo "Perlio not selected, using stdio." >&4
6226         case "$archname" in
6227         *-stdio*) echo "...and architecture name already has -stdio." >&4
6228                 ;;
6229         *)      archname="$archname-stdio"
6230                 echo "...setting architecture name to $archname." >&4
6231                 ;;
6232         esac
6233         ;;
6234 esac
6235
6236 : determine root of directory hierarchy where package will be installed.
6237 case "$prefix" in
6238 '')
6239         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6240         ;;
6241 *)
6242         dflt="$prefix"
6243         ;;
6244 esac
6245 $cat <<EOM
6246
6247 By default, $package will be installed in $dflt/bin, manual pages
6248 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6249 installation directories. Typically this is something like /usr/local.
6250 If you wish to have binaries under /usr/bin but other parts of the
6251 installation under /usr/local, that's ok: you will be prompted
6252 separately for each of the installation directories, the prefix being
6253 only used to set the defaults.
6254
6255 EOM
6256 fn=d~
6257 rp='Installation prefix to use?'
6258 . ./getfile
6259 oldprefix=''
6260 case "$prefix" in
6261 '') ;;
6262 *)
6263         case "$ans" in
6264         "$prefix") ;;
6265         *) oldprefix="$prefix";;
6266         esac
6267         ;;
6268 esac
6269 prefix="$ans"
6270 prefixexp="$ansexp"
6271
6272 case "$afsroot" in
6273 '')     afsroot=/afs ;;
6274 *)      afsroot=$afsroot ;;
6275 esac
6276
6277 : is AFS running?
6278 echo " "
6279 case "$afs" in
6280 $define|true)   afs=true ;;
6281 $undef|false)   afs=false ;;
6282 *)      if test -d $afsroot; then
6283                 afs=true
6284         else
6285                 afs=false
6286         fi
6287         ;;
6288 esac
6289 if $afs; then
6290         echo "AFS may be running... I'll be extra cautious then..." >&4
6291 else
6292         echo "AFS does not seem to be running..." >&4
6293 fi
6294
6295 : determine installation prefix for where package is to be installed.
6296 if $afs; then 
6297 $cat <<EOM
6298
6299 Since you are running AFS, I need to distinguish the directory in which
6300 files will reside from the directory in which they are installed (and from
6301 which they are presumably copied to the former directory by occult means).
6302
6303 EOM
6304         case "$installprefix" in
6305         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6306         *) dflt="$installprefix";;
6307         esac
6308 else
6309 $cat <<EOM
6310
6311 In some special cases, particularly when building $package for distribution,
6312 it is convenient to distinguish between the directory in which files should 
6313 be installed from the directory ($prefix) in which they 
6314 will eventually reside.  For most users, these two directories are the same.
6315
6316 EOM
6317         case "$installprefix" in
6318         '') dflt=$prefix ;;
6319         *) dflt=$installprefix;;
6320         esac
6321 fi
6322 fn=d~
6323 rp='What installation prefix should I use for installing files?'
6324 . ./getfile
6325 installprefix="$ans"
6326 installprefixexp="$ansexp"
6327
6328 : set the prefixit variable, to compute a suitable default value
6329 prefixit='case "$3" in
6330 ""|none)
6331         case "$oldprefix" in
6332         "") eval "$1=\"\$$2\"";;
6333         *)
6334                 case "$3" in
6335                 "") eval "$1=";;
6336                 none)
6337                         eval "tp=\"\$$2\"";
6338                         case "$tp" in
6339                         ""|" ") eval "$1=\"\$$2\"";;
6340                         *) eval "$1=";;
6341                         esac;;
6342                 esac;;
6343         esac;;
6344 *)
6345         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6346         case "$tp" in
6347         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6348         /*-$oldprefix/*|\~*-$oldprefix/*)
6349                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6350         *) eval "$1=\"\$$2\"";;
6351         esac;;
6352 esac'
6353
6354 : get the patchlevel
6355 echo " "
6356 echo "Getting the current patchlevel..." >&4
6357 if $test -r $rsrc/patchlevel.h;then
6358         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6359         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6360         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6361         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6362         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6363         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6364        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6365 else
6366         revision=0
6367         patchlevel=0
6368         subversion=0
6369         api_revision=0
6370         api_version=0
6371         api_subversion=0
6372         perl_patchlevel=0
6373         $echo "(You do not have patchlevel.h.  Eek.)"
6374 fi
6375 if $test -r $rsrc/.patch ; then  
6376         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6377                 perl_patchlevel=`cat $rsrc/.patch`
6378         fi
6379 fi
6380 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6381 version_patchlevel_string="version $patchlevel subversion $subversion"
6382 case "$perl_patchlevel" in
6383 0|'') ;;
6384 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6385 esac
6386
6387 $echo "(You have $package $version_patchlevel_string.)"
6388
6389 case "$osname" in
6390 dos|vms)
6391         : XXX Should be a Configure test for double-dots in filenames.
6392         version=`echo $revision $patchlevel $subversion | \
6393                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6394         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6395                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6396         ;;
6397 *)
6398         version=`echo $revision $patchlevel $subversion | \
6399                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6400         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6401                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6402         ;;
6403 esac
6404 : Special case the 5.005_xx maintenance series, which used 5.005
6405 : without any subversion label as a subdirectory in $sitelib
6406 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6407         api_versionstring='5.005'
6408 fi
6409
6410 : determine installation style
6411 : For now, try to deduce it from prefix unless it is already set.
6412 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6413 case "$installstyle" in
6414 '')     case "$prefix" in
6415                 *perl*) dflt='lib';;
6416                 *) dflt='lib/perl5' ;;
6417         esac
6418         ;;
6419 *)      dflt="$installstyle" ;;
6420 esac
6421 : Probably not worth prompting for this since we prompt for all
6422 : the directories individually, and the prompt would be too long and
6423 : confusing anyway.
6424 installstyle=$dflt
6425
6426 : determine where private library files go
6427 : Usual default is /usr/local/lib/perl5/$version.
6428 : Also allow things like /opt/perl/lib/$version, since 
6429 : /opt/perl/lib/perl5... would be redundant.
6430 : The default "style" setting is made in installstyle.U
6431 case "$installstyle" in
6432 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6433 *)       set dflt privlib lib/$version ;;
6434 esac
6435 eval $prefixit
6436 $cat <<EOM
6437
6438 There are some auxiliary files for $package that need to be put into a
6439 private library directory that is accessible by everyone.
6440
6441 EOM
6442 fn=d~+
6443 rp='Pathname where the private library files will reside?'
6444 . ./getfile
6445 privlib="$ans"
6446 privlibexp="$ansexp"
6447 : Change installation prefix, if necessary.
6448 if $test X"$prefix" != X"$installprefix"; then
6449         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6450 else
6451         installprivlib="$privlibexp"
6452 fi
6453
6454 : set the prefixup variable, to restore leading tilda escape
6455 prefixup='case "$prefixexp" in
6456 "$prefix") ;;
6457 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6458 esac'
6459
6460 : determine where public architecture dependent libraries go
6461 set archlib archlib
6462 eval $prefixit
6463 : privlib default is /usr/local/lib/$package/$version
6464 : archlib default is /usr/local/lib/$package/$version/$archname
6465 : privlib may have an optional trailing /share.
6466 tdflt=`echo $privlib | $sed 's,/share$,,'`
6467 tdflt=$tdflt/$archname
6468 case "$archlib" in
6469 '')     dflt=$tdflt
6470         ;;
6471 *)      dflt="$archlib"
6472     ;;
6473 esac
6474 $cat <<EOM
6475
6476 $spackage contains architecture-dependent library files.  If you are
6477 sharing libraries in a heterogeneous environment, you might store
6478 these files in a separate location.  Otherwise, you can just include
6479 them with the rest of the public library files.
6480
6481 EOM
6482 fn=d+~
6483 rp='Where do you want to put the public architecture-dependent libraries?'
6484 . ./getfile
6485 archlib="$ans"
6486 archlibexp="$ansexp"
6487 if $test X"$archlib" = X"$privlib"; then
6488         d_archlib="$undef"
6489 else
6490         d_archlib="$define"
6491 fi
6492 : Change installation prefix, if necessary.
6493 if $test X"$prefix" != X"$installprefix"; then
6494         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6495 else
6496         installarchlib="$archlibexp"
6497 fi
6498
6499 : see if setuid scripts can be secure
6500 $cat <<EOM
6501
6502 Some kernels have a bug that prevents setuid #! scripts from being
6503 secure.  Some sites have disabled setuid #! scripts because of this.
6504
6505 First let's decide if your kernel supports secure setuid #! scripts.
6506 (If setuid #! scripts would be secure but have been disabled anyway,
6507 don't say that they are secure if asked.)
6508
6509 EOM
6510
6511 val="$undef"
6512 if $test -d /dev/fd; then
6513         echo "#!$ls" >reflect
6514         chmod +x,u+s reflect
6515         ./reflect >flect 2>&1
6516         if $contains "/dev/fd" flect >/dev/null; then
6517                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6518                 val="$define"
6519         else
6520                 $cat <<EOM
6521 If you are not sure if they are secure, I can check but I'll need a
6522 username and password different from the one you are using right now.
6523 If you don't have such a username or don't want me to test, simply
6524 enter 'none'.
6525
6526 EOM
6527                 rp='Other username to test security of setuid scripts with?'
6528                 dflt='none'
6529                 . ./myread
6530                 case "$ans" in
6531                 n|none)
6532                         case "$d_suidsafe" in
6533                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6534                                 dflt=n;;
6535                         "$undef")
6536                                 echo "Well, the $hint value is *not* secure." >&4
6537                                 dflt=n;;
6538                         *)      echo "Well, the $hint value *is* secure." >&4
6539                                 dflt=y;;
6540                         esac
6541                         ;;
6542                 *)
6543                         $rm -f reflect flect
6544                         echo "#!$ls" >reflect
6545                         chmod +x,u+s reflect
6546                         echo >flect
6547                         chmod a+w flect
6548                         echo '"su" will (probably) prompt you for '"$ans's password."
6549                         su $ans -c './reflect >flect'
6550                         if $contains "/dev/fd" flect >/dev/null; then
6551                                 echo "Okay, it looks like setuid scripts are secure." >&4
6552                                 dflt=y
6553                         else
6554                                 echo "I don't think setuid scripts are secure." >&4
6555                                 dflt=n
6556                         fi
6557                         ;;
6558                 esac
6559                 rp='Does your kernel have *secure* setuid scripts?'
6560                 . ./myread
6561                 case "$ans" in
6562                 [yY]*)  val="$define";;
6563                 *)      val="$undef";;
6564                 esac
6565         fi
6566 else
6567         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6568         echo "(That's for file descriptors, not floppy disks.)"
6569         val="$undef"
6570 fi
6571 set d_suidsafe
6572 eval $setvar
6573
6574 $rm -f reflect flect
6575
6576 : now see if they want to do setuid emulation
6577 echo " "
6578 val="$undef"
6579 case "$d_suidsafe" in
6580 "$define")
6581         val="$undef"
6582         echo "No need to emulate SUID scripts since they are secure here." >&4
6583         ;;
6584 *)
6585         $cat <<EOM
6586 Some systems have disabled setuid scripts, especially systems where
6587 setuid scripts cannot be secure.  On systems where setuid scripts have
6588 been disabled, the setuid/setgid bits on scripts are currently
6589 useless.  It is possible for $package to detect those bits and emulate
6590 setuid/setgid in a secure fashion.  This emulation will only work if
6591 setuid scripts have been disabled in your kernel.
6592
6593 EOM
6594         case "$d_dosuid" in
6595         "$define") dflt=y ;;
6596         *) dflt=n ;;
6597         esac
6598         rp="Do you want to do setuid/setgid emulation?"
6599         . ./myread
6600         case "$ans" in
6601         [yY]*)  val="$define";;
6602         *)      val="$undef";;
6603         esac
6604         ;;
6605 esac
6606 set d_dosuid
6607 eval $setvar
6608
6609 : see if this is a malloc.h system
6610 set malloc.h i_malloc
6611 eval $inhdr
6612
6613 : see if stdlib is available
6614 set stdlib.h i_stdlib
6615 eval $inhdr
6616
6617 : check for void type
6618 echo " "
6619 echo "Checking to see how well your C compiler groks the void type..." >&4
6620 case "$voidflags" in
6621 '')
6622         $cat >try.c <<'EOCP'
6623 #if TRY & 1
6624 void sub() {
6625 #else
6626 sub() {
6627 #endif
6628         extern void moo();      /* function returning void */
6629         void (*goo)();          /* ptr to func returning void */
6630 #if TRY & 8
6631         void *hue;              /* generic ptr */
6632 #endif
6633 #if TRY & 2
6634         void (*foo[10])();
6635 #endif
6636
6637 #if TRY & 4
6638         if(goo == moo) {
6639                 exit(0);
6640         }
6641 #endif
6642         exit(0);
6643 }
6644 int main() { sub(); }
6645 EOCP
6646         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6647                 voidflags=$defvoidused
6648         echo "Good.  It appears to support void to the level $package wants.">&4
6649                 if $contains warning .out >/dev/null 2>&1; then
6650                         echo "However, you might get some warnings that look like this:"
6651                         $cat .out
6652                 fi
6653         else
6654 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6655                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6656                         echo "It supports 1..."
6657                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6658                                 echo "It also supports 2..."
6659                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6660                                         voidflags=7
6661                                         echo "And it supports 4 but not 8 definitely."
6662                                 else
6663                                         echo "It doesn't support 4..."
6664                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6665                                                 voidflags=11
6666                                                 echo "But it supports 8."
6667                                         else
6668                                                 voidflags=3
6669                                                 echo "Neither does it support 8."
6670                                         fi
6671                                 fi
6672                         else
6673                                 echo "It does not support 2..."
6674                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6675                                         voidflags=13
6676                                         echo "But it supports 4 and 8."
6677                                 else
6678                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6679                                                 voidflags=5
6680                                                 echo "And it supports 4 but has not heard about 8."
6681                                         else
6682                                                 echo "However it supports 8 but not 4."
6683                                         fi
6684                                 fi
6685                         fi
6686                 else
6687                         echo "There is no support at all for void."
6688                         voidflags=0
6689                 fi
6690         fi
6691 esac
6692 case "$voidflags" in
6693 "$defvoidused") ;;
6694 *)      $cat >&4 <<'EOM'
6695   Support flag bits are:
6696     1: basic void declarations.
6697     2: arrays of pointers to functions returning void.
6698     4: operations between pointers to and addresses of void functions.
6699     8: generic void pointers.
6700 EOM
6701         dflt="$voidflags";
6702         rp="Your void support flags add up to what?"
6703         . ./myread
6704         voidflags="$ans"
6705         ;;
6706 esac
6707 $rm -f try.* .out
6708
6709 : check for length of pointer
6710 echo " "
6711 case "$ptrsize" in
6712 '')
6713         echo "Checking to see how big your pointers are..." >&4
6714         if test "$voidflags" -gt 7; then
6715                 echo '#define VOID_PTR char *' > try.c
6716         else
6717                 echo '#define VOID_PTR void *' > try.c
6718         fi
6719         $cat >>try.c <<'EOCP'
6720 #include <stdio.h>
6721 int main()
6722 {
6723     printf("%d\n", (int)sizeof(VOID_PTR));
6724     exit(0);
6725 }
6726 EOCP
6727         set try
6728         if eval $compile_ok; then
6729                 ptrsize=`$run ./try`
6730                 echo "Your pointers are $ptrsize bytes long."
6731         else
6732                 dflt='4'
6733                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6734                 rp="What is the size of a pointer (in bytes)?"
6735                 . ./myread
6736                 ptrsize="$ans"
6737         fi
6738         ;;
6739 esac
6740 $rm -f try.c try
6741 case "$use64bitall" in
6742 "$define"|true|[yY]*)
6743         case "$ptrsize" in
6744         4)      cat <<EOM >&4
6745
6746 *** You have chosen a maximally 64-bit build, but your pointers
6747 *** are only 4 bytes wide, disabling maximal 64-bitness.
6748
6749 EOM
6750                 use64bitall="$undef"
6751                 case "$use64bitint" in
6752                 "$define"|true|[yY]*) ;;
6753                 *)      cat <<EOM >&4
6754
6755 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6756
6757 EOM
6758                         use64bitint="$define"
6759                         ;;
6760                 esac
6761                 ;;
6762         esac
6763         ;;
6764 esac
6765
6766
6767 : determine which malloc to compile in
6768 echo " "
6769 case "$usemymalloc" in
6770 [yY]*|true|$define)     dflt='y' ;;
6771 [nN]*|false|$undef)     dflt='n' ;;
6772 *)      case "$ptrsize" in
6773         4) dflt='y' ;;
6774         *) dflt='n' ;;
6775         esac
6776         ;;
6777 esac
6778 rp="Do you wish to attempt to use the malloc that comes with $package?"
6779 . ./myread
6780 usemymalloc="$ans"
6781 case "$ans" in
6782 y*|true)
6783         usemymalloc='y'
6784         mallocsrc='malloc.c'
6785         mallocobj="malloc$_o"
6786         d_mymalloc="$define"
6787         case "$libs" in
6788         *-lmalloc*)
6789                 : Remove malloc from list of libraries to use
6790                 echo "Removing unneeded -lmalloc from library list" >&4
6791                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6792                 shift
6793                 libs="$*"
6794                 echo "libs = $libs" >&4
6795                 ;;
6796         esac
6797         ;;
6798 *)
6799         usemymalloc='n'
6800         mallocsrc=''
6801         mallocobj=''
6802         d_mymalloc="$undef"
6803         ;;
6804 esac
6805
6806 : compute the return types of malloc and free
6807 echo " "
6808 $cat >malloc.c <<END
6809 #$i_malloc I_MALLOC
6810 #$i_stdlib I_STDLIB
6811 #include <stdio.h>
6812 #include <sys/types.h>
6813 #ifdef I_MALLOC
6814 #include <malloc.h>
6815 #endif
6816 #ifdef I_STDLIB
6817 #include <stdlib.h>
6818 #endif
6819 #ifdef TRY_MALLOC
6820 void *malloc();
6821 #endif
6822 #ifdef TRY_FREE
6823 void free();
6824 #endif
6825 END
6826 case "$malloctype" in
6827 '')
6828         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6829                 malloctype='void *'
6830         else
6831                 malloctype='char *'
6832         fi
6833         ;;
6834 esac
6835 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6836
6837 case "$freetype" in
6838 '')
6839         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6840                 freetype='void'
6841         else
6842                 freetype='int'
6843         fi
6844         ;;
6845 esac
6846 echo "Your system uses $freetype free(), it would seem." >&4
6847 $rm -f malloc.[co]
6848 $cat <<EOM
6849
6850 After $package is installed, you may wish to install various
6851 add-on modules and utilities.  Typically, these add-ons will
6852 be installed under $prefix with the rest
6853 of this package.  However, you may wish to install such add-ons
6854 elsewhere under a different prefix.
6855
6856 If you do not wish to put everything under a single prefix, that's
6857 ok.  You will be prompted for the individual locations; this siteprefix
6858 is only used to suggest the defaults.
6859
6860 The default should be fine for most people.
6861
6862 EOM
6863 fn=d~+
6864 rp='Installation prefix to use for add-on modules and utilities?'
6865 : XXX Here might be another good place for an installstyle setting.
6866 case "$siteprefix" in
6867 '') dflt=$prefix ;;
6868 *)  dflt=$siteprefix ;;
6869 esac
6870 . ./getfile
6871 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6872 oldsiteprefix=''
6873 case "$siteprefix" in
6874 '') ;;
6875 *)      case "$ans" in
6876         "$prefix") ;;
6877         *) oldsiteprefix="$prefix";;
6878         esac
6879         ;;
6880 esac
6881 siteprefix="$ans"
6882 siteprefixexp="$ansexp"
6883
6884 : determine where site specific libraries go.
6885 : Usual default is /usr/local/lib/perl5/site_perl/$version
6886 : The default "style" setting is made in installstyle.U
6887 : XXX No longer works with Prefixit stuff.
6888 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6889 case "$sitelib" in
6890 '') case "$installstyle" in
6891         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6892         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6893         esac
6894         ;;
6895 *)      dflt="$sitelib"
6896         ;;
6897 esac
6898 $cat <<EOM
6899
6900 The installation process will create a directory for
6901 site-specific extensions and modules.  Most users find it convenient
6902 to place all site-specific files in this directory rather than in the
6903 main distribution directory.
6904
6905 EOM
6906 fn=d~+
6907 rp='Pathname for the site-specific library files?'
6908 . ./getfile
6909 sitelib="$ans"
6910 sitelibexp="$ansexp"
6911 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6912 : Change installation prefix, if necessary.
6913 if $test X"$prefix" != X"$installprefix"; then
6914         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6915 else
6916         installsitelib="$sitelibexp"
6917 fi
6918
6919 : determine where site specific architecture-dependent libraries go.
6920 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6921 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6922 : sitelib may have an optional trailing /share.
6923 case "$sitearch" in
6924 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6925         dflt="$dflt/$archname"
6926         ;;
6927 *)      dflt="$sitearch"
6928         ;;
6929 esac
6930 set sitearch sitearch none
6931 eval $prefixit
6932 $cat <<EOM
6933
6934 The installation process will also create a directory for
6935 architecture-dependent site-specific extensions and modules.
6936
6937 EOM
6938 fn=d~+
6939 rp='Pathname for the site-specific architecture-dependent library files?'
6940 . ./getfile
6941 sitearch="$ans"
6942 sitearchexp="$ansexp"
6943 : Change installation prefix, if necessary.
6944 if $test X"$prefix" != X"$installprefix"; then
6945         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6946 else
6947         installsitearch="$sitearchexp"
6948 fi
6949
6950 $cat <<EOM
6951
6952 The installation process will also create a directory for
6953 vendor-supplied add-ons.  Vendors who supply perl with their system
6954 may find it convenient to place all vendor-supplied files in this
6955 directory rather than in the main distribution directory.  This will
6956 ease upgrades between binary-compatible maintenance versions of perl.
6957
6958 Of course you may also use these directories in whatever way you see
6959 fit.  For example, you might use them to access modules shared over a
6960 company-wide network.
6961
6962 The default answer should be fine for most people.
6963 This causes further questions about vendor add-ons to be skipped
6964 and no vendor-specific directories will be configured for perl.
6965
6966 EOM
6967 rp='Do you want to configure vendor-specific add-on directories?'
6968 case "$usevendorprefix" in
6969 define|true|[yY]*) dflt=y ;;
6970 *)      : User may have set vendorprefix directly on Configure command line.
6971         case "$vendorprefix" in
6972         ''|' ') dflt=n ;;
6973         *)      dflt=y ;;
6974         esac
6975         ;;
6976 esac
6977 . ./myread
6978 case "$ans" in
6979 [yY]*)  fn=d~+
6980         rp='Installation prefix to use for vendor-supplied add-ons?'
6981         case "$vendorprefix" in
6982         '') dflt='' ;;
6983         *)  dflt=$vendorprefix ;;
6984         esac
6985         . ./getfile
6986         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6987         oldvendorprefix=''
6988         case "$vendorprefix" in
6989         '') ;;
6990         *)      case "$ans" in
6991                 "$prefix") ;;
6992                 *) oldvendorprefix="$prefix";;
6993                 esac
6994                 ;;
6995         esac
6996         usevendorprefix="$define"
6997         vendorprefix="$ans"
6998         vendorprefixexp="$ansexp"
6999         ;;
7000 *)      usevendorprefix="$undef"
7001         vendorprefix=''
7002         vendorprefixexp=''
7003         ;;
7004 esac
7005
7006 case "$vendorprefix" in
7007 '')     d_vendorlib="$undef"
7008         vendorlib=''
7009         vendorlibexp=''
7010         ;;
7011 *)      d_vendorlib="$define"
7012         : determine where vendor-supplied modules go.
7013         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7014         case "$vendorlib" in
7015         '')
7016                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7017                 case "$installstyle" in
7018                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7019                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7020                 esac
7021                 ;;
7022         *)      dflt="$vendorlib"
7023                 ;;
7024         esac
7025         fn=d~+
7026         rp='Pathname for the vendor-supplied library files?'
7027         . ./getfile
7028         vendorlib="$ans"
7029         vendorlibexp="$ansexp"
7030         ;;
7031 esac
7032 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7033 : Change installation prefix, if necessary.
7034 if $test X"$prefix" != X"$installprefix"; then
7035         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7036 else
7037         installvendorlib="$vendorlibexp"
7038 fi
7039
7040 case "$vendorprefix" in
7041 '')     d_vendorarch="$undef"
7042         vendorarch=''
7043         vendorarchexp=''
7044         ;;
7045 *)      d_vendorarch="$define"
7046         : determine where vendor-supplied architecture-dependent libraries go.
7047         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7048         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7049         : vendorlib may have an optional trailing /share.
7050         case "$vendorarch" in
7051         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7052                 dflt="$dflt/$archname"
7053                 ;;
7054         *)      dflt="$vendorarch" ;;
7055         esac
7056         fn=d~+
7057         rp='Pathname for vendor-supplied architecture-dependent files?'
7058         . ./getfile
7059         vendorarch="$ans"
7060         vendorarchexp="$ansexp"
7061         ;;
7062 esac
7063 : Change installation prefix, if necessary.
7064 if $test X"$prefix" != X"$installprefix"; then
7065         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7066 else
7067         installvendorarch="$vendorarchexp"
7068 fi
7069
7070 : Final catch-all directories to search
7071 $cat <<EOM
7072
7073 Lastly, you can have perl look in other directories for extensions and
7074 modules in addition to those already specified.
7075 These directories will be searched after 
7076         $sitearch 
7077         $sitelib 
7078 EOM
7079 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7080 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7081 echo ' '
7082 case "$otherlibdirs" in
7083 ''|' ') dflt='none' ;;
7084 *)      dflt="$otherlibdirs" ;;
7085 esac
7086 $cat <<EOM
7087 Enter a colon-separated set of extra paths to include in perl's @INC
7088 search path, or enter 'none' for no extra paths.
7089
7090 EOM
7091
7092 rp='Colon-separated list of additional directories for perl to search?'
7093 . ./myread
7094 case "$ans" in
7095 ' '|''|none)    otherlibdirs=' ' ;;     
7096 *)      otherlibdirs="$ans" ;;
7097 esac
7098 case "$otherlibdirs" in
7099 ' ') val=$undef ;;
7100 *)      val=$define ;;
7101 esac
7102 set d_perl_otherlibdirs
7103 eval $setvar
7104
7105 : Cruising for prototypes
7106 echo " "
7107 echo "Checking out function prototypes..." >&4
7108 $cat >prototype.c <<'EOCP'
7109 int main(int argc, char *argv[]) {
7110         exit(0);}
7111 EOCP
7112 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7113         echo "Your C compiler appears to support function prototypes."
7114         val="$define"
7115 else
7116         echo "Your C compiler doesn't seem to understand function prototypes."
7117         val="$undef"
7118 fi
7119 set prototype
7120 eval $setvar
7121 $rm -f prototype*
7122
7123 case "$prototype" in
7124 "$define") ;;
7125 *)      ansi2knr='ansi2knr'
7126         echo " "
7127         cat <<EOM >&4
7128
7129 $me:  FATAL ERROR:
7130 This version of $package can only be compiled by a compiler that 
7131 understands function prototypes.  Unfortunately, your C compiler 
7132         $cc $ccflags
7133 doesn't seem to understand them.  Sorry about that.
7134
7135 If GNU cc is available for your system, perhaps you could try that instead.  
7136
7137 Eventually, we hope to support building Perl with pre-ANSI compilers.
7138 If you would like to help in that effort, please contact <perlbug@perl.org>.
7139
7140 Aborting Configure now.
7141 EOM
7142         exit 2
7143         ;;
7144 esac
7145
7146 : determine where public executables go
7147 echo " "
7148 set dflt bin bin
7149 eval $prefixit
7150 fn=d~
7151 rp='Pathname where the public executables will reside?'
7152 . ./getfile
7153 if $test "X$ansexp" != "X$binexp"; then
7154         installbin=''
7155 fi
7156 bin="$ans"
7157 binexp="$ansexp"
7158 : Change installation prefix, if necessary.
7159 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7160 if $test X"$prefix" != X"$installprefix"; then
7161         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7162 else
7163         installbin="$binexp"
7164 fi
7165
7166 echo " "
7167 case "$extras" in
7168 '') dflt='n';;
7169 *) dflt='y';;
7170 esac
7171 cat <<EOM
7172 Perl can be built with extra modules or bundles of modules which
7173 will be fetched from the CPAN and installed alongside Perl.
7174
7175 Notice that you will need access to the CPAN; either via the Internet,
7176 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7177 be asked later to configure the CPAN.pm module which will in turn do
7178 the installation of the rest of the extra modules or bundles.)
7179
7180 Notice also that if the modules require any external software such as
7181 libraries and headers (the libz library and the zlib.h header for the
7182 Compress::Zlib module, for example) you MUST have any such software
7183 already installed, this configuration process will NOT install such
7184 things for you.
7185
7186 If this doesn't make any sense to you, just accept the default '$dflt'.
7187 EOM
7188 rp='Install any extra modules (y or n)?'
7189 . ./myread
7190 case "$ans" in
7191 y|Y)
7192         cat <<EOM
7193
7194 Please list any extra modules or bundles to be installed from CPAN,
7195 with spaces between the names.  The names can be in any format the
7196 'install' command of CPAN.pm will understand.  (Answer 'none',
7197 without the quotes, to install no extra modules or bundles.)
7198 EOM
7199         rp='Extras?'
7200         dflt="$extras"
7201         . ./myread
7202         extras="$ans"
7203 esac
7204 case "$extras" in
7205 ''|'none')
7206         val=''
7207         $rm -f ../extras.lst
7208         ;;
7209 *)      echo "(Saving the list of extras for later...)"
7210         echo "$extras" > ../extras.lst
7211         val="'$extras'"
7212         ;;
7213 esac
7214 set extras
7215 eval $setvar
7216 echo " "
7217
7218 : Find perl5.005 or later.
7219 echo "Looking for a previously installed perl5.005 or later... "
7220 case "$perl5" in
7221 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7222                 : Check if this perl is recent and can load a simple module
7223                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7224                         perl5=$tdir/perl
7225                         break;
7226                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7227                         perl5=$tdir/perl5
7228                         break;
7229                 fi
7230         done
7231         ;;
7232 *)      perl5="$perl5"
7233         ;;
7234 esac
7235 case "$perl5" in
7236 '')     echo "None found.  That's ok.";;
7237 *)      echo "Using $perl5." ;;
7238 esac
7239
7240 : Determine list of previous versions to include in @INC
7241 $cat > getverlist <<EOPL
7242 #!$perl5 -w
7243 use File::Basename;
7244 \$api_versionstring = "$api_versionstring";
7245 \$version = "$version";
7246 \$stem = "$sitelib_stem";
7247 \$archname = "$archname";
7248 EOPL
7249         $cat >> getverlist <<'EOPL'
7250 # Can't have leading @ because metaconfig interprets it as a command!
7251 ;@inc_version_list=();
7252 # XXX Redo to do opendir/readdir? 
7253 if (-d $stem) {
7254     chdir($stem);
7255     ;@candidates = glob("5.*");
7256 }
7257 else {
7258     ;@candidates = ();
7259 }
7260
7261 # XXX ToDo:  These comparisons must be reworked when two-digit
7262 # subversions come along, so that 5.7.10 compares as greater than
7263 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7264 # widespread that we can use the built-in version vectors rather
7265 # than reinventing them here.  For 5.6.0, however, we must
7266 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7267 foreach $d (@candidates) {
7268     if ($d lt $version) {
7269         if ($d ge $api_versionstring) {
7270             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7271         }
7272         elsif ($d ge "5.005") {
7273             unshift(@inc_version_list, grep { -d } $d);
7274         }
7275     }
7276     else {
7277         # Skip newer version.  I.e. don't look in
7278         # 5.7.0 if we're installing 5.6.1.
7279     }
7280 }
7281
7282 if (@inc_version_list) {
7283     print join(' ', @inc_version_list);
7284 }
7285 else {
7286     # Blank space to preserve value for next Configure run.
7287     print " ";
7288 }
7289 EOPL
7290 chmod +x getverlist
7291 case "$inc_version_list" in
7292 '')     if test -x "$perl5$exe_ext"; then
7293                 dflt=`$perl5 getverlist`
7294         else
7295                 dflt='none'
7296         fi
7297         ;;
7298 $undef) dflt='none' ;;
7299 *)  eval dflt=\"$inc_version_list\" ;;
7300 esac
7301 case "$dflt" in
7302 ''|' ') dflt=none ;;
7303 esac
7304 case "$dflt" in
7305 5.005) dflt=none ;;
7306 esac
7307 $cat <<'EOM'
7308
7309 In order to ease the process of upgrading, this version of perl 
7310 can be configured to use modules built and installed with earlier 
7311 versions of perl that were installed under $prefix.  Specify here
7312 the list of earlier versions that this version of perl should check.
7313 If Configure detected no earlier versions of perl installed under
7314 $prefix, then the list will be empty.  Answer 'none' to tell perl
7315 to not search earlier versions.
7316
7317 The default should almost always be sensible, so if you're not sure,
7318 just accept the default.
7319 EOM
7320
7321 rp='List of earlier versions to include in @INC?'
7322 . ./myread
7323 case "$ans" in
7324 [Nn]one|''|' ') inc_version_list=' ' ;;
7325 *) inc_version_list="$ans" ;;
7326 esac
7327 case "$inc_version_list" in
7328 ''|' ') 
7329         inc_version_list_init='0';;
7330 *)      inc_version_list_init=`echo $inc_version_list |
7331                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7332         ;;
7333 esac
7334 $rm -f getverlist
7335
7336 : determine whether to install perl also as /usr/bin/perl
7337
7338 echo " "
7339 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7340         $cat <<EOM
7341 Many scripts expect perl to be installed as /usr/bin/perl.
7342 I can install the perl you are about to compile also as /usr/bin/perl
7343 (in addition to $installbin/perl).
7344 EOM
7345         case "$installusrbinperl" in
7346         "$undef"|[nN]*) dflt='n';;
7347         *)              dflt='y';;
7348         esac
7349         rp="Do you want to install perl as /usr/bin/perl?"
7350         . ./myread
7351         case "$ans" in
7352         [yY]*)  val="$define";;
7353         *)      val="$undef" ;;
7354         esac
7355 else
7356         val="$undef"
7357 fi
7358 set installusrbinperl
7359 eval $setvar
7360
7361 : see if dld is available
7362 set dld.h i_dld
7363 eval $inhdr
7364
7365 : see if dlopen exists
7366 xxx_runnm="$runnm"
7367 runnm=false
7368 set dlopen d_dlopen
7369 eval $inlibc
7370 runnm="$xxx_runnm"
7371
7372 : determine which dynamic loading, if any, to compile in
7373 echo " "
7374 dldir="ext/DynaLoader"
7375 case "$usedl" in
7376 $define|y|true)
7377         dflt='y'
7378         usedl="$define"
7379         ;;
7380 $undef|n|false)
7381         dflt='n'
7382         usedl="$undef"
7383         ;;
7384 *) 
7385         dflt='n'
7386         case "$d_dlopen" in
7387             $define) dflt='y' ;;
7388         esac
7389         case "$i_dld" in
7390             $define) dflt='y' ;;
7391         esac
7392         : Does a dl_xxx.xs file exist for this operating system
7393         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7394         ;;
7395 esac
7396 rp="Do you wish to use dynamic loading?"
7397 . ./myread
7398 usedl="$ans"
7399 case "$ans" in
7400 y*) usedl="$define"
7401         case "$dlsrc" in
7402         '')
7403                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7404                         dflt="$dldir/dl_${osname}.xs"
7405                 elif $test "$d_dlopen" = "$define" ; then
7406                         dflt="$dldir/dl_dlopen.xs"
7407                 elif $test "$i_dld" = "$define" ; then
7408                         dflt="$dldir/dl_dld.xs"
7409                 else
7410                         dflt=''
7411                 fi
7412                 ;;
7413         *)      dflt="$dldir/$dlsrc"
7414                 ;;
7415         esac
7416     echo "The following dynamic loading files are available:"
7417         : Can not go over to $dldir because getfile has path hard-coded in.
7418         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7419         rp="Source file to use for dynamic loading"
7420         fn="fne"
7421         gfpth="$src"
7422         . ./getfile
7423         usedl="$define"
7424         : emulate basename
7425         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7426
7427         $cat << EOM
7428
7429 Some systems may require passing special flags to $cc -c to
7430 compile modules that will be used to create a shared library.
7431 To use no flags, say "none".
7432
7433 EOM
7434     case "$cccdlflags" in
7435     '') case "$gccversion" in
7436                 '') case "$osname" in
7437                         hpux)   dflt='+z' ;;
7438                         next)   dflt='none' ;;
7439                         irix*)  dflt='-KPIC' ;;
7440                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7441                         sunos)  dflt='-pic' ;;
7442                         *)      dflt='none' ;;
7443                     esac
7444                         ;;
7445                 *)  case "$osname" in
7446                         darwin) dflt='none' ;;
7447                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7448                         *)      dflt='-fpic' ;;
7449                     esac ;;
7450             esac ;;
7451         ' ') dflt='none' ;;
7452     *)  dflt="$cccdlflags" ;;
7453     esac
7454     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7455     . ./myread
7456     case "$ans" in
7457     none) cccdlflags=' ' ;;
7458     *) cccdlflags="$ans" ;;
7459     esac
7460
7461     cat << EOM
7462
7463 Some systems use ld to create libraries that can be dynamically loaded,
7464 while other systems (such as those using ELF) use $cc.
7465
7466 EOM
7467         case "$ld" in
7468         '')     $cat >try.c <<'EOM'
7469 /* Test for whether ELF binaries are produced */
7470 #include <fcntl.h>
7471 #include <stdlib.h>
7472 int main() {
7473         char b[4];
7474         int i = open("a.out",O_RDONLY);
7475         if(i == -1) 
7476                 exit(1); /* fail */
7477         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7478                 exit(0); /* succeed (yes, it's ELF) */
7479         else
7480                 exit(1); /* fail */
7481 }
7482 EOM
7483                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7484                         cat <<EOM
7485 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7486 EOM
7487                         dflt="$cc"
7488                 else
7489                         echo "I'll use ld to build dynamic libraries."
7490                         dflt='ld'
7491                 fi
7492                 rm -f try.c a.out
7493                 ;;
7494         *)      dflt="$ld"
7495                 ;;
7496         esac
7497
7498     rp="What command should be used to create dynamic libraries?"
7499     . ./myread
7500         ld="$ans"
7501
7502     cat << EOM
7503
7504 Some systems may require passing special flags to $ld to create a
7505 library that can be dynamically loaded.  If your ld flags include
7506 -L/other/path options to locate libraries outside your loader's normal
7507 search path, you may need to specify those -L options here as well.  To
7508 use no flags, say "none".
7509
7510 EOM
7511     case "$lddlflags" in
7512     '') case "$osname" in
7513                         beos) dflt='-nostart' ;;
7514                         hpux) dflt='-b';
7515                               case "$gccversion" in
7516                               '') dflt="$dflt +vnocompatwarnings" ;;
7517                               esac
7518                               ;;        
7519                         linux|irix*)    dflt='-shared' ;;
7520                         next)  dflt='none' ;;
7521                         solaris) dflt='-G' ;;
7522                         sunos) dflt='-assert nodefinitions' ;;
7523                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7524                 *)     dflt='none' ;;
7525                         esac
7526                         ;;
7527     *) dflt="$lddlflags" ;;
7528     esac
7529
7530         : Try to guess additional flags to pick up local libraries.
7531         : Be careful not to append to a plain 'none'
7532         case "$dflt" in
7533         none) dflt='' ;;
7534         esac
7535         for thisflag in $ldflags; do
7536                 case "$thisflag" in
7537                 -L*|-R*|-Wl,-R*)
7538                         case " $dflt " in
7539                         *" $thisflag "*) ;;
7540                         *) dflt="$dflt $thisflag" ;;
7541                         esac
7542                         ;;
7543                 esac
7544         done
7545
7546         case "$dflt" in
7547         ''|' ') dflt='none' ;;
7548         esac
7549
7550     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7551     . ./myread
7552     case "$ans" in
7553     none) lddlflags=' ' ;;
7554     *) lddlflags="$ans" ;;
7555     esac
7556
7557         cat <<EOM
7558
7559 Some systems may require passing special flags to $cc to indicate that
7560 the resulting executable will use dynamic linking.  To use no flags,
7561 say "none".
7562
7563 EOM
7564     case "$ccdlflags" in
7565     '') case "$osname" in
7566                 hpux)   dflt='-Wl,-E' ;;
7567                 linux)  dflt='-rdynamic' ;;
7568                 next)   dflt='none' ;;
7569                 sunos)  dflt='none' ;;
7570                 *)      dflt='none' ;;
7571             esac ;;
7572     ' ')  dflt='none' ;;
7573     *)  dflt="$ccdlflags" ;;
7574     esac
7575     rp="Any special flags to pass to $cc to use dynamic linking?"
7576     . ./myread
7577     case "$ans" in
7578     none) ccdlflags=' ' ;;
7579     *) ccdlflags="$ans" ;;
7580     esac
7581     ;;
7582 *)  usedl="$undef"
7583         ld='ld'
7584     dlsrc='dl_none.xs'
7585     lddlflags=''
7586     ccdlflags=''
7587     ;;
7588 esac
7589
7590 also=''
7591 case "$usedl" in
7592 $undef)
7593         # No dynamic loading being used, so don't bother even to prompt.
7594         useshrplib='false'
7595         ;;
7596 *)      case "$useshrplib" in
7597         '')     case "$osname" in
7598                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7599                         dflt=y
7600                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7601                         ;;
7602                 next*)
7603                         case "$osvers" in
7604                         4*)     dflt=y
7605                                 also='Building a shared libperl is needed for MAB support.'
7606                                 ;;
7607                         *)      dflt=n
7608                                 ;;
7609                         esac
7610                         ;;
7611                 *)      dflt=n
7612                         ;;
7613                 esac
7614                 ;;
7615         $define|true|[Yy]*)
7616                 dflt=y
7617                 ;;
7618         *)      dflt=n
7619                 ;;
7620         esac
7621         $cat << EOM
7622
7623 The perl executable is normally obtained by linking perlmain.c with
7624 libperl${_a}, any static extensions (usually just DynaLoader), and
7625 any other libraries needed on this system (such as -lm, etc.).  Since
7626 your system supports dynamic loading, it is probably possible to build
7627 a shared libperl.$so.  If you will have more than one executable linked
7628 to libperl.$so, this will significantly reduce the size of each
7629 executable, but it may have a noticeable affect on performance.  The
7630 default is probably sensible for your system.
7631 $also
7632
7633 EOM
7634         rp="Build a shared libperl.$so (y/n)"
7635         . ./myread
7636         case "$ans" in
7637         true|$define|[Yy]*)
7638                 useshrplib='true'  ;;
7639         *)      useshrplib='false' ;;
7640         esac
7641         ;;
7642 esac
7643
7644 case "$useshrplib" in
7645 true)
7646         case "$libperl" in
7647         '')
7648                 # Figure out a good name for libperl.so.  Since it gets stored in
7649                 # a version-specific architecture-dependent library, the version
7650                 # number isn't really that important, except for making cc/ld happy.
7651                 #
7652                 # A name such as libperl.so.3.1
7653                 majmin="libperl.$so.$patchlevel.$subversion"
7654                 # A name such as libperl.so.301
7655                 majonly=`echo $patchlevel $subversion |
7656                         $awk '{printf "%d%02d", $1, $2}'`
7657                 majonly=libperl.$so.$majonly
7658                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7659                 # rely on figuring it out from the naming of libc.
7660                 case "${osname}${osvers}" in
7661                 next4*)
7662                         dflt=libperl.5.$so
7663                         # XXX How handle the --version stuff for MAB?
7664                         ;;
7665                 linux*)  # ld won't link with a bare -lperl otherwise.
7666                         dflt=libperl.$so
7667                         ;;
7668                 cygwin*) # ld links against an importlib
7669                         dflt=libperl$lib_ext
7670                         ;;
7671                 *)      # Try to guess based on whether libc has major.minor.
7672                         case "$libc" in
7673                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7674                         *libc.$so.[0-9]*) dflt=$majonly ;;
7675                         *)      dflt=libperl.$so ;;
7676                         esac
7677                         ;;
7678                 esac
7679                 ;;
7680         *)      dflt=$libperl
7681                 ;;
7682         esac
7683         cat << EOM
7684
7685 I need to select a good name for the shared libperl.  If your system uses
7686 library names with major and minor numbers, then you might want something
7687 like $majmin.  Alternatively, if your system uses a single version
7688 number for shared libraries, then you might want to use $majonly.
7689 Or, your system might be quite happy with a simple libperl.$so.
7690
7691 Since the shared libperl will get installed into a version-specific
7692 architecture-dependent directory, the version number of the shared perl
7693 library probably isn't important, so the default should be o.k.
7694
7695 EOM
7696         rp='What name do you want to give to the shared libperl?'
7697         . ./myread
7698         libperl=$ans
7699         echo "Ok, I'll use $libperl"
7700         ;;
7701 *)
7702         libperl="libperl${_a}"
7703         ;;
7704 esac
7705
7706 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7707 case "$shrpdir" in
7708 '') ;;
7709 *)      $cat >&4 <<EOM
7710 WARNING:  Use of the shrpdir variable for the installation location of
7711 the shared $libperl is not supported.  It was never documented and
7712 will not work in this version.  Let me (perlbug@perl.org)
7713 know of any problems this may cause.
7714
7715 EOM
7716         case "$shrpdir" in
7717         "$archlibexp/CORE")
7718                 $cat >&4 <<EOM
7719 But your current setting of $shrpdir is
7720 the default anyway, so it's harmless.
7721 EOM
7722                 ;;
7723         *)
7724                 $cat >&4 <<EOM
7725 Further, your current attempted setting of $shrpdir
7726 conflicts with the value of $archlibexp/CORE
7727 that installperl will use.
7728 EOM
7729                 ;;
7730         esac
7731         ;;
7732 esac
7733
7734 # How will the perl executable find the installed shared $libperl?
7735 # Add $xxx to ccdlflags.
7736 # If we can't figure out a command-line option, use $shrpenv to
7737 # set env LD_RUN_PATH.  The main perl makefile uses this.
7738 shrpdir=$archlibexp/CORE
7739 xxx=''
7740 tmp_shrpenv=''
7741 if "$useshrplib"; then
7742     case "$osname" in 
7743         aix)
7744                 # We'll set it in Makefile.SH...
7745                 ;;
7746         solaris)
7747                 xxx="-R $shrpdir"
7748                 ;;
7749         freebsd|netbsd)
7750                 xxx="-Wl,-R$shrpdir"
7751                 ;;
7752         bsdos|linux|irix*|dec_osf)
7753                 xxx="-Wl,-rpath,$shrpdir"
7754                 ;;
7755         next)
7756                 # next doesn't like the default...
7757                 ;;
7758         beos)
7759                 # beos doesn't like the default, either.
7760                 ;;
7761         hpux*)
7762                 # hpux doesn't like the default, either.
7763                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7764                 ;;
7765         *)
7766                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7767                 ;;
7768         esac
7769         case "$xxx" in
7770         '') ;;
7771         *)      
7772                 # Only add $xxx if it isn't already in ccdlflags.
7773                 case " $ccdlflags " in
7774                 *" $xxx "*)     ;;
7775                 *)      ccdlflags="$ccdlflags $xxx"
7776                         cat <<EOM >&4
7777
7778 Adding $xxx to the flags
7779 passed to $ld so that the perl executable will find the 
7780 installed shared $libperl.
7781
7782 EOM
7783                         ;;
7784                 esac
7785                 ;;
7786         esac
7787 fi
7788 # Fix ccdlflags in AIX for building external extensions.
7789 # (For building Perl itself bare -bE:perl.exp is needed,
7790 #  Makefile.SH takes care of this.)
7791 case "$osname" in
7792 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7793 esac
7794 # Respect a hint or command-line value.
7795 case "$shrpenv" in
7796 '') shrpenv="$tmp_shrpenv" ;;
7797 esac
7798 case "$ldlibpthname" in
7799 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7800 none)   ldlibpthname='' ;;
7801 esac
7802
7803 : determine where manual pages are on this system
7804 echo " "
7805 case "$sysman" in
7806 '') 
7807         syspath='/usr/share/man/man1 /usr/man/man1'
7808         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7809         syspath="$syspath /usr/man/u_man/man1"
7810         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7811         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7812         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7813         sysman=`./loc . /usr/man/man1 $syspath`
7814         ;;
7815 esac
7816 if $test -d "$sysman"; then
7817         echo "System manual is in $sysman." >&4
7818 else
7819         echo "Could not find manual pages in source form." >&4
7820 fi
7821
7822 : determine where manual pages go
7823 set man1dir man1dir none
7824 eval $prefixit
7825 $cat <<EOM
7826
7827 $spackage has manual pages available in source form.
7828 EOM
7829 case "$nroff" in
7830 nroff)
7831         echo "However, you don't have nroff, so they're probably useless to you."
7832         case "$man1dir" in
7833         '') man1dir="none";;
7834         esac;;
7835 esac
7836 echo "If you don't want the manual sources installed, answer 'none'."
7837 case "$man1dir" in
7838 ' ') dflt=none
7839         ;;
7840 '')
7841         lookpath="$prefixexp/share/man/man1"
7842         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7843         lookpath="$lookpath $prefixexp/man/p_man/man1"
7844         lookpath="$lookpath $prefixexp/man/u_man/man1"
7845         lookpath="$lookpath $prefixexp/man/man.1"
7846         case "$sysman" in
7847         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7848         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7849         esac
7850         set dflt
7851         eval $prefixup
7852         ;;
7853 *)  dflt="$man1dir"
7854         ;;
7855 esac
7856 echo " "
7857 fn=dn+~
7858 rp="Where do the main $spackage manual pages (source) go?"
7859 . ./getfile
7860 if $test "X$man1direxp" != "X$ansexp"; then
7861         installman1dir=''
7862 fi
7863 man1dir="$ans"
7864 man1direxp="$ansexp"
7865 case "$man1dir" in
7866 '')     man1dir=' '
7867         installman1dir='';;
7868 esac
7869
7870 : Change installation prefix, if necessary.
7871 if $test X"$prefix" != X"$installprefix"; then
7872         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7873 else
7874         installman1dir="$man1direxp"
7875 fi
7876
7877 : What suffix to use on installed man pages
7878
7879 case "$man1dir" in
7880 ' ')
7881         man1ext='0'
7882         ;;
7883 *)
7884         rp="What suffix should be used for the main $spackage man pages?"
7885         case "$man1ext" in
7886         '')     case "$man1dir" in
7887                 *1)  dflt=1 ;;
7888                 *1p) dflt=1p ;;
7889                 *1pm) dflt=1pm ;;
7890                 *l) dflt=l;;
7891                 *n) dflt=n;;
7892                 *o) dflt=o;;
7893                 *p) dflt=p;;
7894                 *C) dflt=C;;
7895                 *L) dflt=L;;
7896                 *L1) dflt=L1;;
7897                 *) dflt=1;;
7898                 esac
7899                 ;;
7900         *)      dflt="$man1ext";;
7901         esac
7902         . ./myread
7903         man1ext="$ans"
7904         ;;
7905 esac
7906
7907 : see if we can have long filenames
7908 echo " "
7909 first=123456789abcdef
7910 $rm -f $first
7911 if (echo hi >$first) 2>/dev/null; then
7912         if $test -f 123456789abcde; then
7913                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7914                 val="$undef"
7915         else
7916                 echo 'You can have filenames longer than 14 characters.'>&4
7917                 val="$define"
7918         fi
7919 else
7920         $cat <<'EOM'
7921 You can't have filenames longer than 14 chars.
7922 You can't even think about them!
7923 EOM
7924         val="$undef"
7925 fi 
7926 set d_flexfnam
7927 eval $setvar
7928 $rm -rf 123456789abcde*
7929
7930 : determine where library module manual pages go
7931 set man3dir man3dir none
7932 eval $prefixit
7933 $cat <<EOM
7934
7935 $spackage has manual pages for many of the library modules.
7936 EOM
7937
7938 case "$nroff" in
7939 nroff)
7940         $cat <<'EOM'
7941 However, you don't have nroff, so they're probably useless to you.
7942 EOM
7943         case "$man3dir" in
7944         '') man3dir="none";;
7945         esac;;
7946 esac
7947
7948 case "$d_flexfnam" in
7949 undef)
7950         $cat <<'EOM'
7951 However, your system can't handle the long file names like File::Basename.3. 
7952 EOM
7953         case "$man3dir" in
7954         '') man3dir="none";;
7955         esac;;
7956 esac
7957
7958 echo "If you don't want the manual sources installed, answer 'none'."
7959 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7960 case "$man3dir" in
7961 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7962         if $test -d "$privlib/man/man3"; then
7963                 cat <<EOM >&4
7964
7965 WARNING:  Previous versions of perl installed man3 pages into
7966 $privlib/man/man3.  This version will suggest a 
7967 new default of $dflt.  
7968 EOM
7969                 tdflt=$dflt
7970                 dflt='n'
7971                 rp='Do you wish to preserve the old behavior?(y/n)'
7972                 . ./myread
7973                 case "$ans" in
7974                 y*) dflt="$privlib/man/man3" ;;
7975                 *)  dflt=$tdflt ;;
7976                 esac
7977     fi
7978         ;;
7979 *)      dflt="$man3dir" ;;
7980 esac
7981 case "$dflt" in
7982 ' ') dflt=none ;;
7983 esac
7984 echo " "
7985 fn=dn+~
7986 rp="Where do the $package library man pages (source) go?"
7987 . ./getfile
7988 man3dir="$ans"
7989 man3direxp="$ansexp"
7990 case "$man3dir" in
7991 '')     man3dir=' '
7992         installman3dir='';;
7993 esac
7994
7995 : Change installation prefix, if necessary.
7996 if $test X"$prefix" != X"$installprefix"; then
7997         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7998 else
7999         installman3dir="$man3direxp"
8000 fi
8001
8002 : What suffix to use on installed man pages
8003 case "$man3dir" in
8004 ' ')
8005         man3ext='0'
8006         ;;
8007 *)
8008         rp="What suffix should be used for the $package library man pages?"
8009         case "$man3ext" in
8010         '')     case "$man3dir" in
8011                 *3)  dflt=3 ;;
8012                 *3p) dflt=3p ;;
8013                 *3pm) dflt=3pm ;;
8014                 *l) dflt=l;;
8015                 *n) dflt=n;;
8016                 *o) dflt=o;;
8017                 *p) dflt=p;;
8018                 *C) dflt=C;;
8019                 *L) dflt=L;;
8020                 *L3) dflt=L3;;
8021                 *) dflt=3;;
8022                 esac
8023                 ;;
8024         *)      dflt="$man3ext";;
8025         esac
8026         . ./myread
8027         man3ext="$ans"
8028         ;;
8029 esac
8030
8031 : see if we have to deal with yellow pages, now NIS.
8032 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8033         if $test -f /usr/etc/nibindd; then
8034                 echo " "
8035                 echo "I'm fairly confident you're on a NeXT."
8036                 echo " "
8037                 rp='Do you get the hosts file via NetInfo?'
8038                 dflt=y
8039                 case "$hostcat" in
8040                 nidump*) ;;
8041                 '') ;;
8042                 *) dflt=n;;
8043                 esac
8044                 . ./myread
8045                 case "$ans" in
8046                 y*) hostcat='nidump hosts .';;
8047                 *)      case "$hostcat" in
8048                         nidump*) hostcat='';;
8049                         esac
8050                         ;;
8051                 esac
8052         fi
8053         case "$hostcat" in
8054         nidump*) ;;
8055         *)
8056                 case "$hostcat" in
8057                 *ypcat*) dflt=y;;
8058                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8059                                 dflt=y
8060                         else
8061                                 dflt=n
8062                         fi;;
8063                 *) dflt=n;;
8064                 esac
8065                 echo " "
8066                 rp='Are you getting the hosts file via yellow pages?'
8067                 . ./myread
8068                 case "$ans" in
8069                 y*) hostcat='ypcat hosts';;
8070                 *) hostcat='cat /etc/hosts';;
8071                 esac
8072                 ;;
8073         esac
8074 fi
8075 case "$hostcat" in
8076 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8077 esac
8078 case "$groupcat" in
8079 '') test -f /etc/group && groupcat='cat /etc/group';;
8080 esac
8081 case "$passcat" in
8082 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8083 esac
8084
8085 : now get the host name
8086 echo " "
8087 echo "Figuring out host name..." >&4
8088 case "$myhostname" in
8089 '') cont=true
8090         echo 'Maybe "hostname" will work...'
8091         if tans=`sh -c hostname 2>&1` ; then
8092                 myhostname=$tans
8093                 phostname=hostname
8094                 cont=''
8095         fi
8096         ;;
8097 *) cont='';;
8098 esac
8099 if $test "$cont"; then
8100         if ./xenix; then
8101                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8102                 if tans=`cat /etc/systemid 2>&1` ; then
8103                         myhostname=$tans
8104                         phostname='cat /etc/systemid'
8105                         echo "Whadyaknow.  Xenix always was a bit strange..."
8106                         cont=''
8107                 fi
8108         elif $test -r /etc/systemid; then
8109                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8110         fi
8111 fi
8112 if $test "$cont"; then
8113         echo 'No, maybe "uuname -l" will work...'
8114         if tans=`sh -c 'uuname -l' 2>&1` ; then
8115                 myhostname=$tans
8116                 phostname='uuname -l'
8117         else
8118                 echo 'Strange.  Maybe "uname -n" will work...'
8119                 if tans=`sh -c 'uname -n' 2>&1` ; then
8120                         myhostname=$tans
8121                         phostname='uname -n'
8122                 else
8123                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8124                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8125                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8126                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8127                         else
8128                                 case "$myhostname" in
8129                                 '') echo "Does this machine have an identity crisis or something?"
8130                                         phostname='';;
8131                                 *)
8132                                         echo "Well, you said $myhostname before..."
8133                                         phostname='echo $myhostname';;
8134                                 esac
8135                         fi
8136                 fi
8137         fi
8138 fi
8139 case "$myhostname" in
8140 '') myhostname=noname ;;
8141 esac
8142 : you do not want to know about this
8143 set $myhostname
8144 myhostname=$1
8145
8146 : verify guess
8147 if $test "$myhostname" ; then
8148         dflt=y
8149         rp='Your host name appears to be "'$myhostname'".'" Right?"
8150         . ./myread
8151         case "$ans" in
8152         y*) ;;
8153         *) myhostname='';;
8154         esac
8155 fi
8156
8157 : bad guess or no guess
8158 while $test "X$myhostname" = X ; do
8159         dflt=''
8160         rp="Please type the (one word) name of your host:"
8161         . ./myread
8162         myhostname="$ans"
8163 done
8164
8165 : translate upper to lower if necessary
8166 case "$myhostname" in
8167 *[A-Z]*)
8168         echo "(Normalizing case in your host name)"
8169         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8170         ;;
8171 esac
8172
8173 case "$myhostname" in
8174 *.*)
8175         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8176         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8177         echo "(Trimming domain name from host name--host name is now $myhostname)"
8178         ;;
8179 *) case "$mydomain" in
8180         '')
8181                 {
8182                         test "X$hostcat" = "Xypcat hosts" &&
8183                         ypmatch "$myhostname" hosts 2>/dev/null |\
8184                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8185                         $test -s hosts
8186                 } || {
8187                         test "X$hostcat" != "X" &&
8188                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8189                                         /[       ]$myhostname[  . ]/p" > hosts
8190                 }
8191                 tmp_re="[       . ]"
8192                 if $test -f hosts; then
8193                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8194                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8195                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8196                                 hosts | $sort | $uniq | \
8197                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8198                         case `$echo X$dflt` in
8199                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8200                                 dflt=.
8201                                 ;;
8202                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8203                                 ;;
8204                         esac
8205                 else
8206                         echo "(I cannot locate a hosts database anywhere)"
8207                         dflt=.
8208                 fi
8209                 case "$dflt" in
8210                 .)
8211                         tans=`./loc resolv.conf X /etc /usr/etc`
8212                         if $test -f "$tans"; then
8213                                 echo "(Attempting domain name extraction from $tans)"
8214                                 dflt=.`$sed -n -e 's/   / /g' \
8215                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8216                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8217                                 case "$dflt" in
8218                                 .) dflt=.`$sed -n -e 's/        / /g' \
8219                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8220                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8221                                         ;;
8222                                 esac
8223                         fi
8224                         ;;
8225                 esac
8226                 case "$dflt" in
8227                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8228                         dflt=.`sh -c domainname 2>/dev/null`
8229                         case "$dflt" in
8230                         '') dflt='.';;
8231                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8232                         esac
8233                         ;;
8234                 esac
8235                 case "$dflt$osname" in
8236                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8237                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8238                         ;;
8239                 esac
8240                 case "$dflt" in
8241                 .) echo "(Lost all hope -- silly guess then)"
8242                         dflt='.nonet'
8243                         ;;
8244                 esac
8245                 $rm -f hosts
8246                 ;;
8247         *) dflt="$mydomain";;
8248         esac;;
8249 esac
8250 echo " "
8251 rp="What is your domain name?"
8252 . ./myread
8253 tans="$ans"
8254 case "$ans" in
8255 '') ;;
8256 .*) ;;
8257 *) tans=".$tans";;
8258 esac
8259 mydomain="$tans"
8260
8261 : translate upper to lower if necessary
8262 case "$mydomain" in
8263 *[A-Z]*)
8264         echo "(Normalizing case in your domain name)"
8265         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8266         ;;
8267 esac
8268
8269 : a little sanity check here
8270 case "$phostname" in
8271 '') ;;
8272 *)
8273         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8274         $myhostname$mydomain|$myhostname) ;;
8275         *)
8276                 case "$phostname" in
8277                 sed*)
8278                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8279                         ;;
8280                 *)
8281                         echo "(That doesn't agree with your $phostname command, by the way.)"
8282                         ;;
8283                 esac
8284         ;;
8285         esac
8286         ;;
8287 esac
8288
8289 $cat <<EOM
8290
8291 I need to get your e-mail address in Internet format if possible, i.e.
8292 something like user@host.domain. Please answer accurately since I have
8293 no easy means to double check it. The default value provided below
8294 is most probably close to reality but may not be valid from outside
8295 your organization...
8296
8297 EOM
8298 cont=x
8299 while test "$cont"; do
8300         case "$cf_email" in
8301         '') dflt="$cf_by@$myhostname$mydomain";;
8302         *) dflt="$cf_email";;
8303         esac
8304         rp='What is your e-mail address?'
8305         . ./myread
8306         cf_email="$ans"
8307         case "$cf_email" in
8308         *@*.*) cont='' ;;
8309         *)
8310                 rp='Address does not look like an Internet one.  Use it anyway?'
8311                 case "$fastread" in
8312                 yes) dflt=y ;;
8313                 *) dflt=n ;;
8314                 esac
8315                 . ./myread
8316                 case "$ans" in
8317                 y*) cont='' ;;
8318                 *) echo " " ;;
8319                 esac
8320                 ;;
8321         esac
8322 done
8323
8324 $cat <<EOM
8325
8326 If you or somebody else will be maintaining perl at your site, please
8327 fill in the correct e-mail address here so that they may be contacted
8328 if necessary. Currently, the "perlbug" program included with perl
8329 will send mail to this address in addition to perlbug@perl.org. You may
8330 enter "none" for no administrator.
8331
8332 EOM
8333 case "$perladmin" in
8334 '') dflt="$cf_email";;
8335 *) dflt="$perladmin";;
8336 esac
8337 rp='Perl administrator e-mail address'
8338 . ./myread
8339 perladmin="$ans"
8340
8341 : determine whether to only install version-specific parts.
8342 echo " "
8343 $cat <<EOM
8344 Do you want to install only the version-specific parts of the perl
8345 distribution?  Usually you do *not* want to do this.
8346 EOM
8347 case "$versiononly" in
8348 "$define"|[Yy]*|true) dflt='y' ;;
8349 *) dflt='n';
8350 esac
8351 rp="Do you want to install only the version-specific parts of perl?"
8352 . ./myread
8353 case "$ans" in
8354 [yY]*)  val="$define";;
8355 *)      val="$undef" ;;
8356 esac
8357 set versiononly
8358 eval $setvar
8359
8360 case "$versiononly" in
8361 "$define") inc_version_list=''
8362            inc_version_list_init=0
8363            ;;
8364 esac
8365
8366 : figure out how to guarantee perl startup
8367 case "$startperl" in
8368 '')
8369         case "$sharpbang" in
8370         *!)
8371                 $cat <<EOH
8372
8373 I can use the #! construct to start perl on your system. This will
8374 make startup of perl scripts faster, but may cause problems if you
8375 want to share those scripts and perl is not in a standard place
8376 ($binexp/perl) on all your platforms. The alternative is to force
8377 a shell by starting the script with a single ':' character.
8378
8379 EOH
8380                 case "$versiononly" in
8381                 "$define")      dflt="$binexp/perl$version";;  
8382                 *)              dflt="$binexp/perl";;
8383                 esac
8384                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8385                 . ./myread
8386                 case "$ans" in
8387                 none)   startperl=": # use perl";;
8388                 *)      startperl="#!$ans"
8389                         if $test 30 -lt `echo "$ans" | wc -c`; then
8390                                 $cat >&4 <<EOM
8391
8392 WARNING:  Some systems limit the #! command to 32 characters.
8393 If you experience difficulty running Perl scripts with #!, try
8394 installing Perl in a directory with a shorter pathname.
8395
8396 EOM
8397                         fi ;;
8398                 esac
8399                 ;;
8400         *) startperl=": # use perl"
8401                 ;;
8402         esac
8403         ;;
8404 esac
8405 echo "I'll use $startperl to start perl scripts."
8406
8407 : figure best path for perl in scripts
8408 case "$perlpath" in
8409 '')
8410         case "$versiononly" in
8411         "$define")      perlpath="$binexp/perl$version";;
8412         *)              perlpath="$binexp/perl";;
8413         esac
8414         case "$startperl" in
8415         *!*) ;;
8416         *)
8417                 $cat <<EOH
8418
8419 I will use the "eval 'exec'" idiom to start Perl on your system.
8420 I can use the full path of your Perl binary for this purpose, but
8421 doing so may cause problems if you want to share those scripts and
8422 Perl is not always in a standard place ($binexp/perl).
8423
8424 EOH
8425                 dflt="$binexp/perl"
8426                 rp="What path shall I use in \"eval 'exec'\"?"
8427                 . ./myread
8428                 perlpath="$ans"
8429                 ;;
8430         esac
8431         ;;
8432 esac
8433 case "$startperl" in
8434 *!*)    ;;
8435 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8436 esac
8437
8438 : determine where public executable scripts go
8439 set scriptdir scriptdir
8440 eval $prefixit
8441 case "$scriptdir" in
8442 '')
8443         dflt="$bin"
8444         : guess some guesses
8445         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8446         $test -d /usr/share/bin     && dflt=/usr/share/bin
8447         $test -d /usr/local/script  && dflt=/usr/local/script
8448         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8449         $test -d $prefixexp/script  && dflt=$prefixexp/script
8450         set dflt
8451         eval $prefixup
8452         ;;
8453 *)  dflt="$scriptdir"
8454         ;;
8455 esac
8456 $cat <<EOM
8457  
8458 Some installations have a separate directory just for executable scripts so
8459 that they can mount it across multiple architectures but keep the scripts in
8460 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8461 Or you might just lump your scripts in with all your other executables.
8462  
8463 EOM
8464 fn=d~
8465 rp='Where do you keep publicly executable scripts?'
8466 . ./getfile
8467 if $test "X$ansexp" != "X$scriptdirexp"; then
8468         installscript=''
8469 fi
8470 scriptdir="$ans"
8471 scriptdirexp="$ansexp"
8472 : Change installation prefix, if necessary.
8473 if $test X"$prefix" != X"$installprefix"; then
8474         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8475 else
8476         installscript="$scriptdirexp"
8477 fi
8478
8479 : determine where add-on public executables go
8480 case "$sitebin" in
8481 '')     dflt=$siteprefix/bin ;;
8482 *)      dflt=$sitebin ;;
8483 esac
8484 fn=d~
8485 rp='Pathname where the add-on public executables should be installed?'
8486 . ./getfile
8487 sitebin="$ans"
8488 sitebinexp="$ansexp"
8489 : Change installation prefix, if necessary.
8490 if $test X"$prefix" != X"$installprefix"; then
8491         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8492 else
8493         installsitebin="$sitebinexp"
8494 fi
8495
8496 : define an is-a-typedef? function
8497 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8498 case "$inclist" in
8499 "") inclist="sys/types.h";;
8500 esac;
8501 eval "varval=\$$var";
8502 case "$varval" in
8503 "")
8504         $rm -f temp.c;
8505         for inc in $inclist; do
8506                 echo "#include <$inc>" >>temp.c;
8507         done;
8508         echo "#ifdef $type" >> temp.c;
8509         echo "printf(\"We have $type\");" >> temp.c;
8510         echo "#endif" >> temp.c;
8511         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8512         if $contains $type temp.E >/dev/null 2>&1; then
8513                 eval "$var=\$type";
8514         else
8515                 eval "$var=\$def";
8516         fi;
8517         $rm -f temp.?;;
8518 *) eval "$var=\$varval";;
8519 esac'
8520
8521 : define an is-a-typedef? function that prompts if the type is not available.
8522 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8523 case "$inclist" in
8524 "") inclist="sys/types.h";;
8525 esac;
8526 eval "varval=\$$var";
8527 case "$varval" in
8528 "")
8529         $rm -f temp.c;
8530         for inc in $inclist; do
8531                 echo "#include <$inc>" >>temp.c;
8532         done;
8533         echo "#ifdef $type" >> temp.c;
8534         echo "printf(\"We have $type\");" >> temp.c;
8535         echo "#endif" >> temp.c;
8536         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8537         echo " " ;
8538         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8539         if $contains $type temp.E >/dev/null 2>&1; then
8540                 echo "$type found." >&4;
8541                 eval "$var=\$type";
8542         else
8543                 echo "$type NOT found." >&4;
8544                 dflt="$def";
8545                 . ./myread ;
8546                 eval "$var=\$ans";
8547         fi;
8548         $rm -f temp.?;;
8549 *) eval "$var=\$varval";;
8550 esac'
8551
8552 : see what type lseek is declared as in the kernel
8553 rp="What is the type used for lseek's offset on this system?"
8554 set off_t lseektype long stdio.h sys/types.h
8555 eval $typedef_ask
8556
8557 echo " "
8558 echo "Checking to see how big your file offsets are..." >&4
8559 $cat >try.c <<EOCP
8560 #include <sys/types.h>
8561 #include <stdio.h>
8562 int main()
8563 {
8564     printf("%d\n", (int)sizeof($lseektype));
8565     return(0); 
8566 }
8567 EOCP
8568 set try
8569 if eval $compile_ok; then
8570         lseeksize=`$run ./try`
8571         echo "Your file offsets are $lseeksize bytes long."
8572 else
8573         dflt=$longsize
8574         echo " "
8575         echo "(I can't seem to compile the test program.  Guessing...)"
8576         rp="What is the size of your file offsets (in bytes)?"
8577         . ./myread
8578         lseeksize="$ans"
8579 fi
8580 $rm -f try.c try
8581
8582 : see what type file positions are declared as in the library
8583 rp="What is the type for file position used by fsetpos()?"
8584 set fpos_t fpostype long stdio.h sys/types.h
8585 eval $typedef_ask
8586
8587 echo " "
8588 case "$fpostype" in
8589 *_t) zzz="$fpostype"    ;;
8590 *)   zzz="fpos_t"       ;;
8591 esac
8592 echo "Checking the size of $zzz..." >&4 
8593 cat > try.c <<EOCP
8594 #include <sys/types.h>
8595 #include <stdio.h>
8596 int main() {
8597     printf("%d\n", (int)sizeof($fpostype));
8598     exit(0);
8599 }
8600 EOCP
8601 set try
8602 if eval $compile_ok; then
8603         yyy=`$run ./try`
8604         case "$yyy" in
8605         '')     fpossize=4
8606                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8607                 ;;
8608         *)      fpossize=$yyy
8609                 echo "Your $zzz is $fpossize bytes long."
8610                 ;;
8611         esac
8612 else
8613         dflt="$longsize"
8614         echo " " >&4
8615         echo "(I can't compile the test program.  Guessing...)" >&4
8616         rp="What is the size of your file positions (in bytes)?"
8617         . ./myread
8618         fpossize="$ans"
8619 fi
8620
8621
8622
8623 # Backward compatibility (uselfs is deprecated).
8624 case "$uselfs" in
8625 "$define"|true|[yY]*)
8626         cat <<EOM >&4
8627
8628 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8629 EOM
8630         uselargefiles="$define"
8631         ;;
8632 esac                          
8633
8634 case "$lseeksize:$fpossize" in
8635 8:8) cat <<EOM
8636
8637 You can have files larger than 2 gigabytes.
8638 EOM
8639    val="$define" ;;
8640 *)    case "$uselargefiles" in
8641    "$undef"|false|[nN]*) dflt='n' ;;
8642    *)   dflt='y' ;;
8643    esac
8644    cat <<EOM
8645
8646 Perl can be built to understand large files (files larger than 2 gigabytes)
8647 on some systems.  To do so, Configure can be run with -Duselargefiles.
8648
8649 If this doesn't make any sense to you, just accept the default '$dflt'.
8650 EOM
8651    rp='Try to understand large files, if available?'
8652    . ./myread
8653    case "$ans" in
8654    y|Y)         val="$define" ;;
8655    *)           val="$undef"  ;;
8656    esac
8657    ;;
8658 esac
8659 set uselargefiles
8660 eval $setvar
8661 case "$uselargefiles" in
8662 "$define")
8663 : Look for a hint-file generated 'call-back-unit'.  If the
8664 : user has specified that a large files perl is to be built,
8665 : we may need to set or change some other defaults.
8666         if $test -f uselargefiles.cbu; then
8667                 echo "Your platform has some specific hints for large file builds, using them..."
8668                 . ./uselargefiles.cbu
8669                 echo " "
8670                 echo "Rechecking to see how big your file offsets are..." >&4
8671                 $cat >try.c <<EOCP
8672 #include <sys/types.h>
8673 #include <stdio.h>
8674 int main()
8675 {
8676     printf("%d\n", (int)sizeof($lseektype));
8677     return(0); 
8678 }
8679 EOCP
8680                 set try
8681                 if eval $compile_ok; then
8682                         lseeksize=`$run ./try`
8683                         $echo "Your file offsets are now $lseeksize bytes long."
8684                 else
8685                         dflt="$lseeksize"
8686                         echo " "
8687                         echo "(I can't seem to compile the test program.  Guessing...)"
8688                         rp="What is the size of your file offsets (in bytes)?"
8689                         . ./myread
8690                         lseeksize="$ans"
8691                 fi
8692                 case "$fpostype" in
8693                 *_t) zzz="$fpostype"    ;;
8694                 *)   zzz="fpos_t"       ;;
8695                 esac
8696                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8697                 $cat > try.c <<EOCP
8698 #include <sys/types.h>
8699 #include <stdio.h>
8700 int main() {
8701     printf("%d\n", (int)sizeof($fpostype));
8702     exit(0);
8703 }
8704 EOCP
8705                 set try
8706                 if eval $compile_ok; then
8707                         yyy=`$run ./try`
8708                         dflt="$lseeksize"
8709                         case "$yyy" in
8710                         '')     echo " "
8711                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8712                                 ;;
8713                         *)      fpossize=$yyy
8714                                 echo " $fpossize bytes." >&4
8715                                 ;;
8716                         esac
8717                 else
8718                         dflt="$fpossize"
8719                         echo " "
8720                         echo "(I can't compile the test program.  Guessing...)" >&4
8721                         rp="What is the size of your file positions (in bytes)?"
8722                         . ./myread
8723                         fpossize="$ans"
8724                 fi
8725                 $rm -f try.c try
8726         fi
8727         ;;
8728 esac
8729
8730 case "$vendorprefix" in
8731 '')     d_vendorbin="$undef"
8732         vendorbin=''
8733         vendorbinexp=''
8734         ;;
8735 *)      d_vendorbin="$define"
8736         : determine where vendor-supplied executables go.
8737         case "$vendorbin" in
8738         '') dflt=$vendorprefix/bin ;;
8739         *)      dflt="$vendorbin" ;;
8740         esac
8741         fn=d~+
8742         rp='Pathname for the vendor-supplied executables directory?'
8743         . ./getfile
8744         vendorbin="$ans"
8745         vendorbinexp="$ansexp"
8746         ;;
8747 esac
8748 : Change installation prefix, if necessary.
8749 if $test X"$prefix" != X"$installprefix"; then
8750         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8751 else
8752         installvendorbin="$vendorbinexp"
8753 fi
8754
8755 : see if qgcvt exists
8756 set qgcvt d_qgcvt
8757 eval $inlibc
8758
8759 : Check how to convert floats to strings.
8760
8761 if test "X$d_Gconvert" = X; then
8762
8763 echo " "
8764 echo "Checking for an efficient way to convert floats to strings."
8765 echo " " > try.c
8766 case "$uselongdouble" in
8767 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8768 esac
8769 case "$d_longdbl" in
8770 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8771 esac
8772 case "$d_PRIgldbl" in
8773 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8774 esac
8775 $cat >>try.c <<EOP
8776 #ifdef TRY_gconvert
8777 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8778 char *myname = "gconvert";
8779 #endif
8780 #ifdef TRY_gcvt
8781 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8782 char *myname = "gcvt";
8783 #endif
8784 #ifdef TRY_qgcvt
8785 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8786 char *myname = "qgcvt";
8787 #define DOUBLETYPE long double
8788 #endif
8789 #ifdef TRY_sprintf
8790 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8791 #ifdef HAS_PRIgldbl
8792 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8793 #else
8794 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8795 #endif
8796 #else
8797 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8798 #endif
8799 char *myname = "sprintf";
8800 #endif
8801
8802 #ifndef DOUBLETYPE
8803 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8804 #define DOUBLETYPE long double
8805 #else
8806 #define DOUBLETYPE double
8807 #endif
8808 #endif
8809
8810 #include <stdio.h>
8811
8812 #define I_STDLIB $i_stdlib
8813 #ifdef I_STDLIB
8814 #include <stdlib.h>
8815 #endif
8816
8817 int
8818 checkit(expect, got)
8819 char *expect;
8820 char *got;
8821 {
8822     if (strcmp(expect, got)) {
8823                 printf("%s oddity:  Expected %s, got %s\n",
8824                         myname, expect, got);
8825                 exit(1);
8826         }
8827 }
8828
8829 int main()
8830
8831         char buf[64]; 
8832         buf[63] = '\0';
8833
8834         /* This must be 1st test on (which?) platform */
8835         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8836         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8837         checkit("0.1", buf);
8838
8839         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8840         checkit("0.01", buf);
8841
8842         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8843         checkit("0.001", buf);
8844
8845         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8846         checkit("0.0001", buf);
8847
8848         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8849         if (strlen(buf) > 5)
8850             checkit("9e-005", buf); /* for Microsoft ?? */
8851         else
8852             checkit("9e-05", buf);
8853
8854         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8855         checkit("1", buf);
8856
8857         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8858         checkit("1.1", buf);
8859
8860         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8861         checkit("1.01", buf);
8862
8863         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8864         checkit("1.001", buf);
8865
8866         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8867         checkit("1.0001", buf);
8868
8869         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8870         checkit("1.00001", buf);
8871
8872         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8873         checkit("1.000001", buf);
8874
8875         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8876         checkit("0", buf);
8877
8878         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8879         checkit("-1", buf);
8880
8881         /* Some Linux gcvt's give 1.e+5 here. */
8882         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8883         checkit("100000", buf);
8884         
8885         /* Some Linux gcvt's give -1.e+5 here. */
8886         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8887         checkit("-100000", buf);
8888
8889         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8890         checkit("123.456", buf);
8891
8892         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8893         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8894         /* 34 should be enough to scare even long double
8895          * places into using the e notation. */
8896         if (strlen(buf) > 5)
8897             checkit("1e+034", buf); /* for Microsoft */
8898         else
8899             checkit("1e+34", buf);
8900
8901         /* For Perl, if you add additional tests here, also add them to
8902          * t/base/num.t for benefit of platforms not using Configure or
8903          * overriding d_Gconvert */
8904
8905         exit(0);
8906 }
8907 EOP
8908 : first add preferred functions to our list
8909 xxx_list=""
8910 for xxx_convert in $gconvert_preference; do
8911     case $xxx_convert in
8912     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8913     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8914     esac 
8915 done
8916 : then add any others
8917 for xxx_convert in gconvert gcvt sprintf; do
8918     case "$xxx_list" in
8919     *$xxx_convert*) ;;
8920     *) xxx_list="$xxx_list $xxx_convert" ;;
8921     esac 
8922 done
8923
8924 case "$d_longdbl$uselongdouble" in
8925 "$define$define")
8926     : again, add prefered functions to our list first
8927     xxx_ld_list=""
8928     for xxx_convert in $gconvert_ld_preference; do
8929         case $xxx_convert in
8930         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8931         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8932         esac
8933     done
8934     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8935     for xxx_convert in qgcvt sprintf $xxx_list; do
8936         case "$xxx_ld_list" in
8937         $xxx_convert*|*" $xxx_convert"*) ;;
8938         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8939         esac
8940     done
8941     : if sprintf cannot do long doubles, move it to the end
8942     if test "$d_PRIgldbl" != "$define"; then
8943         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8944     fi
8945     : if no qgcvt, remove it
8946     if test "$d_qgcvt" != "$define"; then
8947         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8948     fi
8949     : use the ld_list
8950     xxx_list="$xxx_ld_list"
8951     ;;
8952 esac
8953
8954 for xxx_convert in $xxx_list; do
8955         echo "Trying $xxx_convert..."
8956         $rm -f try try$_o
8957         set try -DTRY_$xxx_convert
8958         if eval $compile; then
8959                 echo "$xxx_convert() found." >&4
8960                 if $run ./try; then
8961                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8962                         break;
8963                 else
8964                         echo "...But $xxx_convert didn't work as I expected."
8965                         xxx_convert=''
8966                 fi
8967         else
8968                 echo "$xxx_convert NOT found." >&4
8969         fi
8970 done
8971
8972 if test X$xxx_convert = X; then
8973     echo "*** WHOA THERE!!! ***" >&4
8974     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8975     xxx_convert=sprintf
8976 fi
8977
8978 case "$xxx_convert" in
8979 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8980 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8981 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8982 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8983    "$define$define$define")
8984       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8985    "$define$define$undef")
8986       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
8987    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8988    esac
8989    ;;  
8990 esac
8991
8992 fi
8993
8994 : see if _fwalk exists
8995 set fwalk d__fwalk
8996 eval $inlibc
8997
8998 : Initialize h_fcntl
8999 h_fcntl=false
9000
9001 : Initialize h_sysfile
9002 h_sysfile=false
9003
9004 : access call always available on UNIX
9005 set access d_access
9006 eval $inlibc
9007
9008 : locate the flags for 'access()'
9009 case "$d_access" in
9010 "$define")
9011         echo " "
9012         $cat >access.c <<'EOCP'
9013 #include <sys/types.h>
9014 #ifdef I_FCNTL
9015 #include <fcntl.h>
9016 #endif
9017 #ifdef I_SYS_FILE
9018 #include <sys/file.h>
9019 #endif
9020 #ifdef I_UNISTD
9021 #include <unistd.h>
9022 #endif
9023 int main() {
9024         exit(R_OK);
9025 }
9026 EOCP
9027         : check sys/file.h first, no particular reason here
9028         if $test `./findhdr sys/file.h` && \
9029                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9030                 h_sysfile=true;
9031                 echo "<sys/file.h> defines the *_OK access constants." >&4
9032         elif $test `./findhdr fcntl.h` && \
9033                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9034                 h_fcntl=true;
9035                 echo "<fcntl.h> defines the *_OK access constants." >&4
9036         elif $test `./findhdr unistd.h` && \
9037                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9038                 echo "<unistd.h> defines the *_OK access constants." >&4
9039         else
9040                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9041         fi
9042         ;;
9043 esac
9044 $rm -f access*
9045
9046 : see if accessx exists
9047 set accessx d_accessx
9048 eval $inlibc
9049
9050 : see if alarm exists
9051 set alarm d_alarm
9052 eval $inlibc
9053
9054 : see if POSIX threads are available
9055 set pthread.h i_pthread
9056 eval $inhdr
9057
9058 : define a fucntion to check prototypes
9059 $cat > protochk <<EOSH
9060 $startsh
9061 cc="$cc"
9062 optimize="$optimize"
9063 ccflags="$ccflags"
9064 prototype="$prototype"
9065 define="$define"
9066 rm=$rm
9067 usethreads=$usethreads
9068 i_pthread=$i_pthread
9069 pthread_h_first=$pthread_h_first
9070 EOSH
9071
9072 $cat >> protochk <<'EOSH'
9073
9074 $rm -f try.c
9075 foo="$1"
9076 shift
9077 while test $# -ge 2; do
9078         case "$1" in
9079                 $define) echo "#include <$2>" >> try.c ;;
9080                 literal) echo "$2" >> try.c ;;
9081         esac
9082     # Extra magic for the benefit of systems that need pthread.h
9083     # to be included early to correctly detect threadsafe functions.
9084     # Such functions must guarantee themselves, though, that the usethreads
9085     # and i_pthread have been defined, before calling protochk.
9086     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9087         echo "#include <pthread.h>" >> try.c
9088         pthread_h_done=yes
9089     fi
9090     shift 2
9091 done
9092 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9093 cat >> try.c <<'EOCP'
9094 #ifdef CAN_PROTOTYPE
9095 #define _(args) args
9096 #else
9097 #define _(args) ()
9098 #endif
9099 EOCP
9100 echo "$foo" >> try.c
9101 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9102 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9103 status=$?
9104 $rm -f try.[co]
9105 exit $status
9106 EOSH
9107 chmod +x protochk
9108 $eunicefix protochk
9109
9110 hasproto='varname=$1; func=$2; shift; shift;
9111 while $test $# -ge 2; do
9112         case "$1" in
9113         $define) echo "#include <$2>";;
9114         esac ;
9115     shift 2;
9116 done > try.c;
9117 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9118 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9119         echo "$func() prototype found.";
9120         val="$define";
9121 else
9122         echo "$func() prototype NOT found.";
9123         val="$undef";
9124 fi;
9125 set $varname;
9126 eval $setvar;
9127 $rm -f try.c tryout.c'
9128
9129 : see if sys/types.h has to be included
9130 set sys/types.h i_systypes
9131 eval $inhdr
9132
9133 : see if sys/select.h has to be included
9134 set sys/select.h i_sysselct
9135 eval $inhdr
9136
9137 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9138 while $test $# -ge 2; do
9139         case "$1" in
9140         $define) echo "#include <$2>";;
9141         esac ;
9142     shift 2;
9143 done > try.c;
9144 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9145 set try;
9146 if eval $compile; then
9147         val="$define";
9148 else
9149         val="$undef";
9150 fi;
9151 set $varname;
9152 eval $setvar;
9153 $rm -f try.c try.o'
9154
9155 : see if we should include time.h, sys/time.h, or both
9156 echo " "
9157 if test "X$timeincl" = X; then
9158         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9159         $echo $n "I'm now running the test program...$c"
9160         $cat >try.c <<'EOCP'
9161 #include <sys/types.h>
9162 #ifdef I_TIME
9163 #include <time.h>
9164 #endif
9165 #ifdef I_SYSTIME
9166 #ifdef SYSTIMEKERNEL
9167 #define KERNEL
9168 #endif
9169 #include <sys/time.h>
9170 #endif
9171 #ifdef I_SYSSELECT
9172 #include <sys/select.h>
9173 #endif
9174 int main()
9175 {
9176         struct tm foo;
9177 #ifdef S_TIMEVAL
9178         struct timeval bar;
9179 #endif
9180 #ifdef S_TIMEZONE
9181         struct timezone tzp;
9182 #endif
9183         if (foo.tm_sec == foo.tm_sec)
9184                 exit(0);
9185 #ifdef S_TIMEVAL
9186         if (bar.tv_sec == bar.tv_sec)
9187                 exit(0);
9188 #endif
9189         exit(1);
9190 }
9191 EOCP
9192         flags=''
9193         for s_timezone in '-DS_TIMEZONE' ''; do
9194         sysselect=''
9195         for s_timeval in '-DS_TIMEVAL' ''; do
9196         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9197         for i_time in '' '-DI_TIME'; do
9198         for i_systime in '-DI_SYSTIME' ''; do
9199                 case "$flags" in
9200                 '') $echo $n ".$c"
9201                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9202                         if eval $compile; then
9203                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9204                                 shift
9205                                 flags="$*"
9206                                 echo " "
9207                                 $echo $n "Succeeded with $flags$c"
9208                         fi
9209                         ;;
9210                 esac
9211         done
9212         done
9213         done
9214         done
9215         done
9216         timeincl=''
9217         echo " "
9218         case "$flags" in
9219         *SYSTIMEKERNEL*) i_systimek="$define"
9220                 timeincl=`./findhdr sys/time.h`
9221                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9222         *) i_systimek="$undef";;
9223         esac
9224         case "$flags" in
9225         *I_TIME*) i_time="$define"
9226                 timeincl=`./findhdr time.h`" $timeincl"
9227                 echo "We'll include <time.h>." >&4;;
9228         *) i_time="$undef";;
9229         esac
9230         case "$flags" in
9231         *I_SYSTIME*) i_systime="$define"
9232                 timeincl=`./findhdr sys/time.h`" $timeincl"
9233                 echo "We'll include <sys/time.h>." >&4;;
9234         *) i_systime="$undef";;
9235         esac
9236         $rm -f try.c try
9237 fi
9238 : see if struct tm knows about tm_zone
9239 case "$i_systime$i_time" in
9240 *$define*) 
9241         echo " "
9242         echo "Checking to see if your struct tm has tm_zone field..." >&4
9243         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9244         eval $hasfield
9245         ;;
9246 *)      val="$undef"
9247         set d_tm_tm_zone
9248         eval $setvar
9249         ;;
9250 esac
9251 case "$d_tm_tm_zone" in
9252 "$define")      echo "Yes, it does."   ;;
9253 *)              echo "No, it doesn't." ;;
9254 esac
9255 : see if struct tm knows about tm_gmtoff
9256 case "$i_systime$i_time" in
9257 *$define*) 
9258         echo " "
9259         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9260         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9261         eval $hasfield
9262         ;;
9263 *)      val="$undef"
9264         set d_tm_tm_gmtoff
9265         eval $setvar
9266         ;;
9267 esac
9268 case "$d_tm_tm_gmtoff" in
9269 "$define")      echo "Yes, it does."   ;;
9270 *)              echo "No, it doesn't." ;;
9271 esac
9272
9273 : see if asctime_r exists
9274 set asctime_r d_asctime_r
9275 eval $inlibc
9276 case "$d_asctime_r" in
9277 "$define")
9278         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9279         case "$d_asctime_r_proto:$usethreads" in
9280         ":define")      d_asctime_r_proto=define
9281                 set d_asctime_r_proto asctime_r $hdrs
9282                 eval $hasproto ;;
9283         *)      ;;
9284         esac
9285         case "$d_asctime_r_proto" in
9286         define)
9287         case "$asctime_r_proto" in
9288         ''|0) try='char* asctime_r(const struct tm*, char*);'
9289         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9290         esac
9291         case "$asctime_r_proto" in
9292         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9293         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9294         esac
9295         case "$asctime_r_proto" in
9296         ''|0) try='int asctime_r(const struct tm*, char*);'
9297         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9298         esac
9299         case "$asctime_r_proto" in
9300         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9301         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9302         esac
9303         case "$asctime_r_proto" in
9304         ''|0)   d_asctime_r=undef
9305                 asctime_r_proto=0
9306                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9307         * )     case "$asctime_r_proto" in
9308                 REENTRANT_PROTO*) ;;
9309                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9310                 esac
9311                 echo "Prototype: $try" ;;
9312         esac
9313         ;;
9314         *)      case "$usethreads" in
9315                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9316                 esac
9317                 d_asctime_r=undef
9318                 asctime_r_proto=0
9319                 ;;
9320         esac
9321         ;;
9322 *)      asctime_r_proto=0
9323         ;;
9324 esac
9325
9326 : see if atolf exists
9327 set atolf d_atolf
9328 eval $inlibc
9329
9330 : see if atoll exists
9331 set atoll d_atoll
9332 eval $inlibc
9333
9334 : Look for GNU-cc style attribute checking
9335 echo " "
9336 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9337 $cat >attrib.c <<'EOCP'
9338 #include <stdio.h>
9339 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9340 EOCP
9341 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9342         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9343                 echo "Your C compiler doesn't fully support __attribute__."
9344                 val="$undef"
9345         else
9346                 echo "Your C compiler supports __attribute__."
9347                 val="$define"
9348         fi
9349 else
9350         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9351         val="$undef"
9352 fi
9353 set d_attribut
9354 eval $setvar
9355 $rm -f attrib*
9356
9357 : see if bcmp exists
9358 set bcmp d_bcmp
9359 eval $inlibc
9360
9361 : see if bcopy exists
9362 set bcopy d_bcopy
9363 eval $inlibc
9364
9365 : see if this is a unistd.h system
9366 set unistd.h i_unistd
9367 eval $inhdr
9368
9369 : see if getpgrp exists
9370 set getpgrp d_getpgrp
9371 eval $inlibc
9372
9373 case "$d_getpgrp" in
9374 "$define")
9375         echo " "
9376         echo "Checking to see which flavor of getpgrp is in use..."
9377         $cat >try.c <<EOP
9378 #$i_unistd I_UNISTD
9379 #include <sys/types.h>
9380 #ifdef I_UNISTD
9381 #  include <unistd.h>
9382 #endif
9383 int main()
9384 {
9385         if (getuid() == 0) {
9386                 printf("(I see you are running Configure as super-user...)\n");
9387                 setuid(1);
9388         }
9389 #ifdef TRY_BSD_PGRP
9390         if (getpgrp(1) == 0)
9391                 exit(0);
9392 #else
9393         if (getpgrp() > 0)
9394                 exit(0);
9395 #endif
9396         exit(1);
9397 }
9398 EOP
9399         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9400                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9401                 val="$define"
9402         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9403                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9404                 val="$undef"
9405         else
9406                 echo "I can't seem to compile and run the test program."
9407                 if ./usg; then
9408                         xxx="a USG one, i.e. you use getpgrp()."
9409                 else
9410                         # SVR4 systems can appear rather BSD-ish.
9411                         case "$i_unistd" in
9412                         $undef)
9413                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9414                                 val="$define"
9415                                 ;;
9416                         $define)
9417                                 xxx="probably a USG one, i.e. you use getpgrp()."
9418                                 val="$undef"
9419                                 ;;
9420                         esac
9421                 fi
9422                 echo "Assuming your getpgrp is $xxx" >&4
9423         fi
9424         ;;
9425 *) val="$undef";;
9426 esac
9427 set d_bsdgetpgrp
9428 eval $setvar
9429 $rm -f try try.*
9430
9431 : see if setpgrp exists
9432 set setpgrp d_setpgrp
9433 eval $inlibc
9434
9435 case "$d_setpgrp" in
9436 "$define")
9437         echo " "
9438         echo "Checking to see which flavor of setpgrp is in use..."
9439         $cat >try.c <<EOP
9440 #$i_unistd I_UNISTD
9441 #include <sys/types.h>
9442 #ifdef I_UNISTD
9443 #  include <unistd.h>
9444 #endif
9445 int main()
9446 {
9447         if (getuid() == 0) {
9448                 printf("(I see you are running Configure as super-user...)\n");
9449                 setuid(1);
9450         }
9451 #ifdef TRY_BSD_PGRP
9452         if (-1 == setpgrp(1, 1))
9453                 exit(0);
9454 #else
9455         if (setpgrp() != -1)
9456                 exit(0);
9457 #endif
9458         exit(1);
9459 }
9460 EOP
9461         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9462                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9463                 val="$define"
9464         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9465                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9466                 val="$undef"
9467         else
9468                 echo "(I can't seem to compile and run the test program.)"
9469                 if ./usg; then
9470                         xxx="a USG one, i.e. you use setpgrp()."
9471                 else
9472                         # SVR4 systems can appear rather BSD-ish.
9473                         case "$i_unistd" in
9474                         $undef)
9475                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9476                                 val="$define"
9477                                 ;;
9478                         $define)
9479                                 xxx="probably a USG one, i.e. you use setpgrp()."
9480                                 val="$undef"
9481                                 ;;
9482                         esac
9483                 fi
9484                 echo "Assuming your setpgrp is $xxx" >&4
9485         fi
9486         ;;
9487 *) val="$undef";;
9488 esac
9489 set d_bsdsetpgrp
9490 eval $setvar
9491 $rm -f try try.*
9492 : see if bzero exists
9493 set bzero d_bzero
9494 eval $inlibc
9495
9496 : see if signal is declared as pointer to function returning int or void
9497 echo " "
9498 xxx=`./findhdr signal.h`
9499 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9500 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9501         echo "You have int (*signal())() instead of void." >&4
9502         val="$undef"
9503 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9504         echo "You have void (*signal())()." >&4
9505         val="$define"
9506 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9507         echo "You have int (*signal())() instead of void." >&4
9508         val="$undef"
9509 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9510         echo "You have void (*signal())()." >&4
9511         val="$define"
9512 else
9513         case "$d_voidsig" in
9514         '')
9515         echo "I can't determine whether signal handler returns void or int..." >&4
9516                 dflt=void
9517                 rp="What type does your signal handler return?"
9518                 . ./myread
9519                 case "$ans" in
9520                 v*) val="$define";;
9521                 *) val="$undef";;
9522                 esac;;
9523         "$define")
9524                 echo "As you already told me, signal handler returns void." >&4
9525                 val="$define"
9526                 ;;
9527         *)      echo "As you already told me, signal handler returns int." >&4
9528                 val="$undef"
9529                 ;;
9530         esac
9531 fi
9532 set d_voidsig
9533 eval $setvar
9534 case "$d_voidsig" in
9535 "$define") signal_t="void";;
9536 *) signal_t="int";;
9537 esac
9538 $rm -f $$.tmp
9539
9540 : check for ability to cast large floats to 32-bit ints.
9541 echo " "
9542 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9543 if $test "$intsize" -ge 4; then
9544         xxx=int
9545 else
9546         xxx=long
9547 fi
9548 $cat >try.c <<EOCP
9549 #include <stdio.h>
9550 #include <sys/types.h>
9551 #include <signal.h>
9552 $signal_t blech(s) int s; { exit(3); }
9553 int main()
9554 {
9555         $xxx i32;
9556         double f, g;
9557         int result = 0;
9558         char str[16];
9559         signal(SIGFPE, blech);
9560
9561         /* Don't let compiler optimize the test away.  Store the number 
9562            in a writable string for gcc to pass to sscanf under HP/UX.
9563         */
9564         sprintf(str, "2147483647");
9565         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9566         g = 10 * f;
9567         i32  = ($xxx) g;
9568
9569         /* x86 processors will probably give 0x8000 0000, which is a
9570        sign change.  We don't want that.  We want to mimic SPARC
9571            behavior here, which is to preserve the sign and give
9572            back 0x7fff ffff.
9573         */
9574         if (i32 != ($xxx) f)
9575                 result |= 1;
9576         exit(result);
9577 }
9578 EOCP
9579 set try
9580 if eval $compile_ok; then
9581         $run ./try
9582         yyy=$?
9583 else
9584         echo "(I can't seem to compile the test program--assuming it can't)"
9585         yyy=1
9586 fi
9587 case "$yyy" in
9588 0)      val="$define"
9589         echo "Yup, it can."
9590         ;;
9591 *)      val="$undef"
9592         echo "Nope, it can't."
9593         ;;
9594 esac
9595 set d_casti32
9596 eval $setvar
9597 $rm -f try try.*
9598
9599 : check for ability to cast negative floats to unsigned
9600 echo " "
9601 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9602 $cat >try.c <<EOCP
9603 #include <stdio.h>
9604 #include <sys/types.h>
9605 #include <signal.h>
9606 $signal_t blech(s) int s; { exit(7); }
9607 $signal_t blech_in_list(s) int s; { exit(4); }
9608 unsigned long dummy_long(p) unsigned long p; { return p; }
9609 unsigned int dummy_int(p) unsigned int p; { return p; }
9610 unsigned short dummy_short(p) unsigned short p; { return p; }
9611 int main()
9612 {
9613         double f;
9614         unsigned long along;
9615         unsigned int aint;
9616         unsigned short ashort;
9617         int result = 0;
9618         char str[16];
9619         
9620         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9621            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9622            optimized the whole file away
9623         */
9624         /* Store the number in a writable string for gcc to pass to 
9625            sscanf under HP/UX.
9626         */
9627         sprintf(str, "-123");
9628         sscanf(str, "%lf", &f);  /* f = -123.; */
9629
9630         signal(SIGFPE, blech);
9631         along = (unsigned long)f;
9632         aint = (unsigned int)f;
9633         ashort = (unsigned short)f;
9634         if (along != (unsigned long)-123)
9635                 result |= 1;
9636         if (aint != (unsigned int)-123)
9637                 result |= 1;
9638         if (ashort != (unsigned short)-123)
9639                 result |= 1;
9640         sprintf(str, "1073741824.");
9641         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9642         f = f + f;
9643         along = 0;
9644         along = (unsigned long)f;
9645         if (along != 0x80000000)
9646                 result |= 2;
9647         f -= 1.;
9648         along = 0;
9649         along = (unsigned long)f;
9650         if (along != 0x7fffffff)
9651                 result |= 1;
9652         f += 2.;
9653         along = 0;
9654         along = (unsigned long)f;
9655         if (along != 0x80000001)
9656                 result |= 2;
9657         if (result)
9658                 exit(result);
9659         signal(SIGFPE, blech_in_list);
9660         sprintf(str, "123.");
9661         sscanf(str, "%lf", &f);  /* f = 123.; */
9662         along = dummy_long((unsigned long)f);
9663         aint = dummy_int((unsigned int)f);
9664         ashort = dummy_short((unsigned short)f);
9665         if (along != (unsigned long)123)
9666                 result |= 4;
9667         if (aint != (unsigned int)123)
9668                 result |= 4;
9669         if (ashort != (unsigned short)123)
9670                 result |= 4;
9671         exit(result);
9672
9673 }
9674 EOCP
9675 set try
9676 if eval $compile_ok; then
9677         $run ./try
9678         castflags=$?
9679 else
9680         echo "(I can't seem to compile the test program--assuming it can't)"
9681         castflags=7
9682 fi
9683 case "$castflags" in
9684 0)      val="$define"
9685         echo "Yup, it can."
9686         ;;
9687 *)      val="$undef"
9688         echo "Nope, it can't."
9689         ;;
9690 esac
9691 set d_castneg
9692 eval $setvar
9693 $rm -f try.*
9694
9695 : see if vprintf exists
9696 echo " "
9697 if set vprintf val -f d_vprintf; eval $csym; $val; then
9698         echo 'vprintf() found.' >&4
9699         val="$define"
9700         $cat >try.c <<'EOF'
9701 #include <varargs.h>
9702
9703 int main() { xxx("foo"); }
9704
9705 xxx(va_alist)
9706 va_dcl
9707 {
9708         va_list args;
9709         char buf[10];
9710
9711         va_start(args);
9712         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9713 }
9714 EOF
9715         set try
9716         if eval $compile && $run ./try; then
9717                 echo "Your vsprintf() returns (int)." >&4
9718                 val2="$undef"
9719         else
9720                 echo "Your vsprintf() returns (char*)." >&4
9721                 val2="$define"
9722         fi
9723 else
9724         echo 'vprintf() NOT found.' >&4
9725                 val="$undef"
9726                 val2="$undef"
9727 fi
9728 $rm -f try try.*
9729 set d_vprintf
9730 eval $setvar
9731 val=$val2
9732 set d_charvspr
9733 eval $setvar
9734
9735 : see if chown exists
9736 set chown d_chown
9737 eval $inlibc
9738
9739 : see if chroot exists
9740 set chroot d_chroot
9741 eval $inlibc
9742
9743 : see if chsize exists
9744 set chsize d_chsize
9745 eval $inlibc
9746
9747 : see if class exists
9748 set class d_class
9749 eval $inlibc
9750
9751 hasstruct='varname=$1; struct=$2; shift; shift;
9752 while $test $# -ge 2; do
9753         case "$1" in
9754         $define) echo "#include <$2>";;
9755         esac ;
9756     shift 2;
9757 done > try.c;
9758 echo "int main () { struct $struct foo; }" >> try.c;
9759 set try;
9760 if eval $compile; then
9761         val="$define";
9762 else
9763         val="$undef";
9764 fi;
9765 set $varname;
9766 eval $setvar;
9767 $rm -f try.c try.o'
9768
9769 socketlib=''
9770 sockethdr=''
9771 : see whether socket exists
9772 echo " "
9773 $echo $n "Hmm... $c" >&4
9774 if set socket val -f d_socket; eval $csym; $val; then
9775         echo "Looks like you have Berkeley networking support." >&4
9776         d_socket="$define"
9777         if set setsockopt val -f; eval $csym; $val; then
9778                 d_oldsock="$undef"
9779         else
9780                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9781                 d_oldsock="$define"
9782         fi
9783 else
9784         if $contains socklib libc.list >/dev/null 2>&1; then
9785                 echo "Looks like you have Berkeley networking support." >&4
9786                 d_socket="$define"
9787                 : we will have to assume that it supports the 4.2 BSD interface
9788                 d_oldsock="$undef"
9789         else
9790                 echo "You don't have Berkeley networking in libc$_a..." >&4
9791                 if test "X$d_socket" = "X$define"; then
9792                    echo "...but you seem to believe that you have sockets." >&4
9793                 else
9794                         for net in net socket
9795                         do
9796                                 if test -f /usr/lib/lib$net$_a; then
9797                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9798                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9799                                         if $contains socket libc.list >/dev/null 2>&1; then
9800                                                 d_socket="$define"
9801                                                 socketlib="-l$net"
9802                                                 case "$net" in
9803                                                 net)
9804                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9805                                                         sockethdr="-I/usr/netinclude"
9806                                                         ;;
9807                                                 esac
9808                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9809                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9810                                                         d_oldsock="$undef"
9811                                                 else
9812                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9813                                                         d_oldsock="$define"
9814                                                 fi
9815                                                 break
9816                                         fi
9817                                 fi
9818                         done
9819                         if test "X$d_socket" != "X$define"; then
9820                            echo "or anywhere else I see." >&4
9821                            d_socket="$undef"
9822                            d_oldsock="$undef"
9823                         fi
9824                 fi
9825         fi
9826 fi
9827
9828 : see if socketpair exists
9829 set socketpair d_sockpair
9830 eval $inlibc
9831
9832
9833 echo " "
9834 echo "Checking the availability of certain socket constants..." >&4
9835 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9836         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9837         $cat >try.c <<EOF
9838 #include <sys/types.h>
9839 #include <sys/socket.h>
9840 int main() {
9841     int i = $ENUM;
9842 }
9843 EOF
9844         val="$undef"
9845         set try; if eval $compile; then
9846                 val="$define"
9847         fi
9848         set d_${enum}; eval $setvar
9849         $rm -f try.c try
9850 done
9851
9852 : see if this is a sys/uio.h system
9853 set sys/uio.h i_sysuio
9854 eval $inhdr
9855
9856
9857 echo " "
9858 echo "Checking to see if your system supports struct cmsghdr..." >&4
9859 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9860 eval $hasstruct
9861 case "$d_cmsghdr_s" in
9862 "$define")      echo "Yes, it does."   ;;
9863 *)              echo "No, it doesn't." ;;
9864 esac
9865
9866
9867 : check for const keyword
9868 echo " "
9869 echo 'Checking to see if your C compiler knows about "const"...' >&4
9870 $cat >const.c <<'EOCP'
9871 typedef struct spug { int drokk; } spug;
9872 int main()
9873 {
9874         const char *foo;
9875         const spug y;
9876 }
9877 EOCP
9878 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9879         val="$define"
9880         echo "Yup, it does."
9881 else
9882         val="$undef"
9883         echo "Nope, it doesn't."
9884 fi
9885 set d_const
9886 eval $setvar
9887
9888 : see if crypt exists
9889 echo " "
9890 set crypt d_crypt
9891 eval $inlibc
9892 case "$d_crypt" in
9893 $define) cryptlib='' ;;
9894 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9895                 echo 'crypt() found.' >&4
9896                 val="$define"
9897                 cryptlib=''
9898         else
9899                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9900                 if $test -z "$cryptlib"; then
9901                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9902                 else
9903                         cryptlib=-lcrypt
9904                 fi
9905                 if $test -z "$cryptlib"; then
9906                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9907                 else
9908                         cryptlib=-lcrypt
9909                 fi
9910                 if $test -z "$cryptlib"; then
9911                         cryptlib=`./loc libcrypt$_a "" $libpth`
9912                 else
9913                         cryptlib=-lcrypt
9914                 fi
9915                 if $test -z "$cryptlib"; then
9916                         echo 'crypt() NOT found.' >&4
9917                         val="$undef"
9918                 else
9919                         val="$define"
9920                 fi
9921         fi
9922         set d_crypt
9923         eval $setvar
9924         ;;
9925 esac
9926
9927 : see if this is a crypt.h system
9928 set crypt.h i_crypt
9929 eval $inhdr
9930
9931 : see if crypt_r exists
9932 set crypt_r d_crypt_r
9933 eval $inlibc
9934 case "$d_crypt_r" in
9935 "$define")
9936         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9937         case "$d_crypt_r_proto:$usethreads" in
9938         ":define")      d_crypt_r_proto=define
9939                 set d_crypt_r_proto crypt_r $hdrs
9940                 eval $hasproto ;;
9941         *)      ;;
9942         esac
9943         case "$d_crypt_r_proto" in
9944         define)
9945         case "$crypt_r_proto" in
9946         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9947         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9948         esac
9949         case "$crypt_r_proto" in
9950         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9951         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9952         esac
9953         case "$crypt_r_proto" in
9954         ''|0)   d_crypt_r=undef
9955                 crypt_r_proto=0
9956                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9957         * )     case "$crypt_r_proto" in
9958                 REENTRANT_PROTO*) ;;
9959                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9960                 esac
9961                 echo "Prototype: $try" ;;
9962         esac
9963         ;;
9964         *)      case "$usethreads" in
9965                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9966                 esac
9967                 d_crypt_r=undef
9968                 crypt_r_proto=0
9969                 ;;
9970         esac
9971         ;;
9972 *)      crypt_r_proto=0
9973         ;;
9974 esac
9975
9976 : get csh whereabouts
9977 case "$csh" in
9978 'csh') val="$undef" ;;
9979 *) val="$define" ;;
9980 esac
9981 set d_csh
9982 eval $setvar
9983 : Respect a hint or command line value for full_csh.
9984 case "$full_csh" in
9985 '') full_csh=$csh ;;
9986 esac
9987
9988 : see if ctermid_r exists
9989 set ctermid_r d_ctermid_r
9990 eval $inlibc
9991 case "$d_ctermid_r" in
9992 "$define")
9993         hdrs="$i_systypes sys/types.h define stdio.h "
9994         case "$d_ctermid_r_proto:$usethreads" in
9995         ":define")      d_ctermid_r_proto=define
9996                 set d_ctermid_r_proto ctermid_r $hdrs
9997                 eval $hasproto ;;
9998         *)      ;;
9999         esac
10000         case "$d_ctermid_r_proto" in
10001         define)
10002         case "$ctermid_r_proto" in
10003         ''|0) try='char* ctermid_r(char*);'
10004         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10005         esac
10006         case "$ctermid_r_proto" in
10007         ''|0)   d_ctermid_r=undef
10008                 ctermid_r_proto=0
10009                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10010         * )     case "$ctermid_r_proto" in
10011                 REENTRANT_PROTO*) ;;
10012                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10013                 esac
10014                 echo "Prototype: $try" ;;
10015         esac
10016         ;;
10017         *)      case "$usethreads" in
10018                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10019                 esac
10020                 d_ctermid_r=undef
10021                 ctermid_r_proto=0
10022                 ;;
10023         esac
10024         ;;
10025 *)      ctermid_r_proto=0
10026         ;;
10027 esac
10028
10029 : see if ctime_r exists
10030 set ctime_r d_ctime_r
10031 eval $inlibc
10032 case "$d_ctime_r" in
10033 "$define")
10034         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10035         case "$d_ctime_r_proto:$usethreads" in
10036         ":define")      d_ctime_r_proto=define
10037                 set d_ctime_r_proto ctime_r $hdrs
10038                 eval $hasproto ;;
10039         *)      ;;
10040         esac
10041         case "$d_ctime_r_proto" in
10042         define)
10043         case "$ctime_r_proto" in
10044         ''|0) try='char* ctime_r(const time_t*, char*);'
10045         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10046         esac
10047         case "$ctime_r_proto" in
10048         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10049         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10050         esac
10051         case "$ctime_r_proto" in
10052         ''|0) try='int ctime_r(const time_t*, char*);'
10053         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10054         esac
10055         case "$ctime_r_proto" in
10056         ''|0) try='int ctime_r(const time_t*, char*, int);'
10057         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10058         esac
10059         case "$ctime_r_proto" in
10060         ''|0)   d_ctime_r=undef
10061                 ctime_r_proto=0
10062                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10063         * )     case "$ctime_r_proto" in
10064                 REENTRANT_PROTO*) ;;
10065                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10066                 esac
10067                 echo "Prototype: $try" ;;
10068         esac
10069         ;;
10070         *)      case "$usethreads" in
10071                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10072                 esac
10073                 d_ctime_r=undef
10074                 ctime_r_proto=0
10075                 ;;
10076         esac
10077         ;;
10078 *)      ctime_r_proto=0
10079         ;;
10080 esac
10081
10082 : see if cuserid exists
10083 set cuserid d_cuserid
10084 eval $inlibc
10085
10086 : see if this is a limits.h system
10087 set limits.h i_limits
10088 eval $inhdr
10089
10090 : see if this is a float.h system
10091 set float.h i_float
10092 eval $inhdr
10093
10094 : See if number of significant digits in a double precision number is known
10095 echo " "
10096 $cat >dbl_dig.c <<EOM
10097 #$i_limits I_LIMITS
10098 #$i_float I_FLOAT
10099 #ifdef I_LIMITS
10100 #include <limits.h>
10101 #endif
10102 #ifdef I_FLOAT
10103 #include <float.h>
10104 #endif
10105 #ifdef DBL_DIG
10106 printf("Contains DBL_DIG");
10107 #endif
10108 EOM
10109 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10110 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10111         echo "DBL_DIG found." >&4
10112         val="$define"
10113 else
10114         echo "DBL_DIG NOT found." >&4
10115         val="$undef"
10116 fi
10117 $rm -f dbl_dig.?
10118 set d_dbl_dig
10119 eval $setvar
10120
10121 : see if dbm.h is available
10122 : see if dbmclose exists
10123 set dbmclose d_dbmclose
10124 eval $inlibc
10125
10126 case "$d_dbmclose" in
10127 $define)
10128         set dbm.h i_dbm
10129         eval $inhdr
10130         case "$i_dbm" in
10131         $define)
10132                 val="$undef"
10133                 set i_rpcsvcdbm
10134                 eval $setvar
10135                 ;;
10136         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10137                 eval $inhdr
10138                 ;;
10139         esac
10140         ;;
10141 *)      echo "We won't be including <dbm.h>"
10142         val="$undef"
10143         set i_dbm
10144         eval $setvar
10145         val="$undef"
10146         set i_rpcsvcdbm
10147         eval $setvar
10148         ;;
10149 esac
10150
10151 : see if prototype for dbminit is available
10152 echo " "
10153 set d_dbminitproto dbminit $i_dbm dbm.h
10154 eval $hasproto
10155
10156 : see if difftime exists
10157 set difftime d_difftime
10158 eval $inlibc
10159
10160 : see if this is a dirent system
10161 echo " "
10162 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10163         val="$define"
10164         echo "<dirent.h> found." >&4
10165 else
10166         val="$undef"
10167         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10168                 echo "<sys/dir.h> found." >&4
10169                 echo " "
10170         else
10171                 xinc=`./findhdr sys/ndir.h`
10172         fi
10173         echo "<dirent.h> NOT found." >&4
10174 fi
10175 set i_dirent
10176 eval $setvar
10177
10178 : Look for type of directory structure.
10179 echo " "
10180 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10181
10182 case "$direntrytype" in
10183 ''|' ')
10184         case "$i_dirent" in
10185         $define) guess1='struct dirent' ;;
10186         *) guess1='struct direct'  ;;
10187         esac
10188         ;;
10189 *)      guess1="$direntrytype"
10190         ;;
10191 esac
10192
10193 case "$guess1" in
10194 'struct dirent') guess2='struct direct' ;;
10195 *) guess2='struct dirent' ;;
10196 esac
10197                 
10198 if $contains "$guess1" try.c >/dev/null 2>&1; then
10199         direntrytype="$guess1"
10200         echo "Your directory entries are $direntrytype." >&4
10201 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10202         direntrytype="$guess2"
10203         echo "Your directory entries seem to be $direntrytype." >&4
10204 else
10205         echo "I don't recognize your system's directory entries." >&4
10206         rp="What type is used for directory entries on this system?"
10207         dflt="$guess1"
10208         . ./myread
10209         direntrytype="$ans"
10210 fi
10211 $rm -f try.c
10212
10213
10214 : see if the directory entry stores field length
10215 echo " "
10216 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10217 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10218         echo "Good, your directory entry keeps length information in d_namlen." >&4
10219         val="$define"
10220 else
10221         echo "Your directory entry does not know about the d_namlen field." >&4
10222         val="$undef"
10223 fi
10224 set d_dirnamlen
10225 eval $setvar
10226 $rm -f try.c
10227
10228 : see if this is an sysdir system
10229 set sys/dir.h i_sysdir
10230 eval $inhdr
10231
10232 : see if this is an sysndir system
10233 set sys/ndir.h i_sysndir
10234 eval $inhdr
10235
10236 : Look for dirfd
10237 echo " "
10238 $cat >dirfd.c <<EOM
10239 #include <stdio.h>
10240 #$i_dirent I_DIRENT             /**/
10241 #$i_sysdir I_SYS_DIR            /**/
10242 #$i_sysndir I_SYS_NDIR          /**/
10243 #$i_systypes I_SYS_TYPES        /**/
10244 #if defined(I_SYS_TYPES)
10245 #include <sys/types.h>
10246 #endif
10247 #if defined(I_DIRENT)
10248 #include <dirent.h>
10249 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10250 #include <sys/dir.h>
10251 #endif
10252 #else
10253 #ifdef I_SYS_NDIR
10254 #include <sys/ndir.h>
10255 #else
10256 #ifdef I_SYS_DIR
10257 #ifdef hp9000s500
10258 #include <ndir.h>       /* may be wrong in the future */
10259 #else
10260 #include <sys/dir.h>
10261 #endif
10262 #endif
10263 #endif
10264 #endif 
10265 int main() {
10266         DIR *dirp = opendir(".");
10267         if (dirfd(dirp) >= 0)
10268                 exit(0);
10269         else
10270                 exit(1);
10271 }
10272 EOM
10273 set dirfd
10274 if eval $compile; then
10275         val="$define"
10276 fi
10277 case "$val" in
10278 $define)        echo "dirfd() found." >&4       ;;
10279 *)              echo "dirfd() NOT found." >&4   ;;
10280 esac
10281 set d_dirfd
10282 eval $setvar
10283 $rm -f dirfd*
10284
10285 : see if dlerror exists
10286 xxx_runnm="$runnm"
10287 runnm=false
10288 set dlerror d_dlerror
10289 eval $inlibc
10290 runnm="$xxx_runnm"
10291
10292 : see if dlfcn is available
10293 set dlfcn.h i_dlfcn
10294 eval $inhdr
10295
10296 case "$usedl" in
10297 $define|y|true)
10298         $cat << EOM
10299
10300 On a few systems, the dynamically loaded modules that perl generates and uses
10301 will need a different extension than shared libs. The default will probably
10302 be appropriate.
10303
10304 EOM
10305         case "$dlext" in
10306         '')     dflt="$so" ;;
10307         *)      dflt="$dlext" ;;
10308         esac
10309         rp='What is the extension of dynamically loaded modules'
10310         . ./myread
10311         dlext="$ans"
10312         ;;
10313 *)
10314         dlext="none"
10315         ;;
10316 esac
10317
10318 : Check if dlsym need a leading underscore
10319 echo " "
10320 val="$undef"
10321
10322 case "$dlsrc" in
10323 dl_dlopen.xs)
10324         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10325         $cat >dyna.c <<'EOM'
10326 fred () { }
10327 EOM
10328
10329 $cat >fred.c<<EOM
10330
10331 #include <stdio.h>
10332 #$i_dlfcn I_DLFCN
10333 #ifdef I_DLFCN
10334 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10335 #else
10336 #include <sys/types.h>
10337 #include <nlist.h>
10338 #include <link.h>
10339 #endif
10340
10341 extern int fred() ;
10342
10343 int main()
10344 {
10345     void * handle ;
10346     void * symbol ;
10347 #ifndef RTLD_LAZY
10348     int mode = 1 ;
10349 #else
10350     int mode = RTLD_LAZY ;
10351 #endif
10352     handle = dlopen("./dyna.$dlext", mode) ;
10353     if (handle == NULL) {
10354         printf ("1\n") ;
10355         fflush (stdout) ;
10356         exit(0);
10357     }
10358     symbol = dlsym(handle, "fred") ;
10359     if (symbol == NULL) {
10360         /* try putting a leading underscore */
10361         symbol = dlsym(handle, "_fred") ;
10362         if (symbol == NULL) {
10363             printf ("2\n") ;
10364             fflush (stdout) ;
10365             exit(0);
10366         }
10367         printf ("3\n") ;
10368     }
10369     else
10370         printf ("4\n") ;
10371     fflush (stdout) ;
10372     exit(0);
10373 }
10374 EOM
10375         : Call the object file tmp-dyna.o in case dlext=o.
10376         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10377                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10378                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10379                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10380                 xxx=`$run ./fred`
10381                 case $xxx in
10382                 1)      echo "Test program failed using dlopen." >&4
10383                         echo "Perhaps you should not use dynamic loading." >&4;;
10384                 2)      echo "Test program failed using dlsym." >&4
10385                         echo "Perhaps you should not use dynamic loading." >&4;;
10386                 3)      echo "dlsym needs a leading underscore" >&4
10387                         val="$define" ;;
10388                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10389                 esac
10390         else
10391                 echo "I can't compile and run the test program." >&4
10392                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10393         fi
10394         ;;
10395 esac
10396                 
10397 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10398
10399 set d_dlsymun
10400 eval $setvar
10401
10402 : see if drand48_r exists
10403 set drand48_r d_drand48_r
10404 eval $inlibc
10405 case "$d_drand48_r" in
10406 "$define")
10407         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10408         case "$d_drand48_r_proto:$usethreads" in
10409         ":define")      d_drand48_r_proto=define
10410                 set d_drand48_r_proto drand48_r $hdrs
10411                 eval $hasproto ;;
10412         *)      ;;
10413         esac
10414         case "$d_drand48_r_proto" in
10415         define)
10416         case "$drand48_r_proto" in
10417         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10418         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10419         esac
10420         case "$drand48_r_proto" in
10421         ''|0)   d_drand48_r=undef
10422                 drand48_r_proto=0
10423                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10424         * )     case "$drand48_r_proto" in
10425                 REENTRANT_PROTO*) ;;
10426                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10427                 esac
10428                 echo "Prototype: $try" ;;
10429         esac
10430         ;;
10431         *)      case "$usethreads" in
10432                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10433                 esac
10434                 d_drand48_r=undef
10435                 drand48_r_proto=0
10436                 ;;
10437         esac
10438         ;;
10439 *)      drand48_r_proto=0
10440         ;;
10441 esac
10442
10443 : see if prototype for drand48 is available
10444 echo " "
10445 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10446 eval $hasproto
10447
10448 : see if dup2 exists
10449 set dup2 d_dup2
10450 eval $inlibc
10451
10452 : see if eaccess exists
10453 set eaccess d_eaccess
10454 eval $inlibc
10455
10456 : see if endgrent exists
10457 set endgrent d_endgrent
10458 eval $inlibc
10459
10460 : see if this is an grp system
10461 set grp.h i_grp
10462 eval $inhdr
10463
10464 case "$i_grp" in
10465 $define)
10466         xxx=`./findhdr grp.h`
10467         $cppstdin $cppflags $cppminus < $xxx >$$.h
10468
10469         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10470                 val="$define"
10471         else
10472                 val="$undef"
10473         fi
10474         set d_grpasswd
10475         eval $setvar
10476
10477         $rm -f $$.h
10478         ;;
10479 *)
10480         val="$undef";
10481         set d_grpasswd; eval $setvar
10482         ;;
10483 esac
10484
10485 : see if endgrent_r exists
10486 set endgrent_r d_endgrent_r
10487 eval $inlibc
10488 case "$d_endgrent_r" in
10489 "$define")
10490         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10491         case "$d_endgrent_r_proto:$usethreads" in
10492         ":define")      d_endgrent_r_proto=define
10493                 set d_endgrent_r_proto endgrent_r $hdrs
10494                 eval $hasproto ;;
10495         *)      ;;
10496         esac
10497         case "$d_endgrent_r_proto" in
10498         define)
10499         case "$endgrent_r_proto" in
10500         ''|0) try='int endgrent_r(FILE**);'
10501         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10502         esac
10503         case "$endgrent_r_proto" in
10504         ''|0) try='void endgrent_r(FILE**);'
10505         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10506         esac
10507         case "$endgrent_r_proto" in
10508         ''|0)   d_endgrent_r=undef
10509                 endgrent_r_proto=0
10510                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10511         * )     case "$endgrent_r_proto" in
10512                 REENTRANT_PROTO*) ;;
10513                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10514                 esac
10515                 echo "Prototype: $try" ;;
10516         esac
10517         ;;
10518         *)      case "$usethreads" in
10519                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10520                 esac
10521                 d_endgrent_r=undef
10522                 endgrent_r_proto=0
10523                 ;;
10524         esac
10525         ;;
10526 *)      endgrent_r_proto=0
10527         ;;
10528 esac
10529
10530 : see if endhostent exists
10531 set endhostent d_endhent
10532 eval $inlibc
10533
10534 : see if this is a netdb.h system
10535 set netdb.h i_netdb
10536 eval $inhdr
10537
10538 : see if endhostent_r exists
10539 set endhostent_r d_endhostent_r
10540 eval $inlibc
10541 case "$d_endhostent_r" in
10542 "$define")
10543         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10544         case "$d_endhostent_r_proto:$usethreads" in
10545         ":define")      d_endhostent_r_proto=define
10546                 set d_endhostent_r_proto endhostent_r $hdrs
10547                 eval $hasproto ;;
10548         *)      ;;
10549         esac
10550         case "$d_endhostent_r_proto" in
10551         define)
10552         case "$endhostent_r_proto" in
10553         ''|0) try='int endhostent_r(struct hostent_data*);'
10554         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10555         esac
10556         case "$endhostent_r_proto" in
10557         ''|0) try='void endhostent_r(struct hostent_data*);'
10558         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10559         esac
10560         case "$endhostent_r_proto" in
10561         ''|0)   d_endhostent_r=undef
10562                 endhostent_r_proto=0
10563                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10564         * )     case "$endhostent_r_proto" in
10565                 REENTRANT_PROTO*) ;;
10566                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10567                 esac
10568                 echo "Prototype: $try" ;;
10569         esac
10570         ;;
10571         *)      case "$usethreads" in
10572                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10573                 esac
10574                 d_endhostent_r=undef
10575                 endhostent_r_proto=0
10576                 ;;
10577         esac
10578         ;;
10579 *)      endhostent_r_proto=0
10580         ;;
10581 esac
10582
10583 : see if endnetent exists
10584 set endnetent d_endnent
10585 eval $inlibc
10586
10587 : see if endnetent_r exists
10588 set endnetent_r d_endnetent_r
10589 eval $inlibc
10590 case "$d_endnetent_r" in
10591 "$define")
10592         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10593         case "$d_endnetent_r_proto:$usethreads" in
10594         ":define")      d_endnetent_r_proto=define
10595                 set d_endnetent_r_proto endnetent_r $hdrs
10596                 eval $hasproto ;;
10597         *)      ;;
10598         esac
10599         case "$d_endnetent_r_proto" in
10600         define)
10601         case "$endnetent_r_proto" in
10602         ''|0) try='int endnetent_r(struct netent_data*);'
10603         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10604         esac
10605         case "$endnetent_r_proto" in
10606         ''|0) try='void endnetent_r(struct netent_data*);'
10607         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10608         esac
10609         case "$endnetent_r_proto" in
10610         ''|0)   d_endnetent_r=undef
10611                 endnetent_r_proto=0
10612                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10613         * )     case "$endnetent_r_proto" in
10614                 REENTRANT_PROTO*) ;;
10615                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10616                 esac
10617                 echo "Prototype: $try" ;;
10618         esac
10619         ;;
10620         *)      case "$usethreads" in
10621                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10622                 esac
10623                 d_endnetent_r=undef
10624                 endnetent_r_proto=0
10625                 ;;
10626         esac
10627         ;;
10628 *)      endnetent_r_proto=0
10629         ;;
10630 esac
10631
10632 : see if endprotoent exists
10633 set endprotoent d_endpent
10634 eval $inlibc
10635
10636 : see if endprotoent_r exists
10637 set endprotoent_r d_endprotoent_r
10638 eval $inlibc
10639 case "$d_endprotoent_r" in
10640 "$define")
10641         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10642         case "$d_endprotoent_r_proto:$usethreads" in
10643         ":define")      d_endprotoent_r_proto=define
10644                 set d_endprotoent_r_proto endprotoent_r $hdrs
10645                 eval $hasproto ;;
10646         *)      ;;
10647         esac
10648         case "$d_endprotoent_r_proto" in
10649         define)
10650         case "$endprotoent_r_proto" in
10651         ''|0) try='int endprotoent_r(struct protoent_data*);'
10652         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10653         esac
10654         case "$endprotoent_r_proto" in
10655         ''|0) try='void endprotoent_r(struct protoent_data*);'
10656         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10657         esac
10658         case "$endprotoent_r_proto" in
10659         ''|0)   d_endprotoent_r=undef
10660                 endprotoent_r_proto=0
10661                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10662         * )     case "$endprotoent_r_proto" in
10663                 REENTRANT_PROTO*) ;;
10664                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10665                 esac
10666                 echo "Prototype: $try" ;;
10667         esac
10668         ;;
10669         *)      case "$usethreads" in
10670                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10671                 esac
10672                 d_endprotoent_r=undef
10673                 endprotoent_r_proto=0
10674                 ;;
10675         esac
10676         ;;
10677 *)      endprotoent_r_proto=0
10678         ;;
10679 esac
10680
10681 : see if endpwent exists
10682 set endpwent d_endpwent
10683 eval $inlibc
10684
10685 : see if this is a pwd.h system
10686 set pwd.h i_pwd
10687 eval $inhdr
10688
10689 case "$i_pwd" in
10690 $define)
10691         xxx=`./findhdr pwd.h`
10692         $cppstdin $cppflags $cppminus < $xxx >$$.h
10693
10694         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10695                 val="$define"
10696         else
10697                 val="$undef"
10698         fi
10699         set d_pwquota
10700         eval $setvar
10701
10702         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10703                 val="$define"
10704         else
10705                 val="$undef"
10706         fi
10707         set d_pwage
10708         eval $setvar
10709
10710         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10711                 val="$define"
10712         else
10713                 val="$undef"
10714         fi
10715         set d_pwchange
10716         eval $setvar
10717
10718         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10719                 val="$define"
10720         else
10721                 val="$undef"
10722         fi
10723         set d_pwclass
10724         eval $setvar
10725
10726         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10727                 val="$define"
10728         else
10729                 val="$undef"
10730         fi
10731         set d_pwexpire
10732         eval $setvar
10733
10734         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10735                 val="$define"
10736         else
10737                 val="$undef"
10738         fi
10739         set d_pwcomment
10740         eval $setvar
10741
10742         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10743                 val="$define"
10744         else
10745                 val="$undef"
10746         fi
10747         set d_pwgecos
10748         eval $setvar
10749
10750         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10751                 val="$define"
10752         else
10753                 val="$undef"
10754         fi
10755         set d_pwpasswd
10756         eval $setvar
10757
10758         $rm -f $$.h
10759         ;;
10760 *)
10761         val="$undef"; 
10762         set d_pwquota; eval $setvar
10763         set d_pwage; eval $setvar
10764         set d_pwchange; eval $setvar
10765         set d_pwclass; eval $setvar
10766         set d_pwexpire; eval $setvar
10767         set d_pwcomment; eval $setvar
10768         set d_pwgecos; eval $setvar
10769         set d_pwpasswd; eval $setvar
10770         ;;
10771 esac
10772
10773 : see if endpwent_r exists
10774 set endpwent_r d_endpwent_r
10775 eval $inlibc
10776 case "$d_endpwent_r" in
10777 "$define")
10778         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10779         case "$d_endpwent_r_proto:$usethreads" in
10780         ":define")      d_endpwent_r_proto=define
10781                 set d_endpwent_r_proto endpwent_r $hdrs
10782                 eval $hasproto ;;
10783         *)      ;;
10784         esac
10785         case "$d_endpwent_r_proto" in
10786         define)
10787         case "$endpwent_r_proto" in
10788         ''|0) try='int endpwent_r(FILE**);'
10789         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10790         esac
10791         case "$endpwent_r_proto" in
10792         ''|0) try='void endpwent_r(FILE**);'
10793         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10794         esac
10795         case "$endpwent_r_proto" in
10796         ''|0)   d_endpwent_r=undef
10797                 endpwent_r_proto=0
10798                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10799         * )     case "$endpwent_r_proto" in
10800                 REENTRANT_PROTO*) ;;
10801                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10802                 esac
10803                 echo "Prototype: $try" ;;
10804         esac
10805         ;;
10806         *)      case "$usethreads" in
10807                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10808                 esac
10809                 d_endpwent_r=undef
10810                 endpwent_r_proto=0
10811                 ;;
10812         esac
10813         ;;
10814 *)      endpwent_r_proto=0
10815         ;;
10816 esac
10817
10818 : see if endservent exists
10819 set endservent d_endsent
10820 eval $inlibc
10821
10822 : see if endservent_r exists
10823 set endservent_r d_endservent_r
10824 eval $inlibc
10825 case "$d_endservent_r" in
10826 "$define")
10827         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10828         case "$d_endservent_r_proto:$usethreads" in
10829         ":define")      d_endservent_r_proto=define
10830                 set d_endservent_r_proto endservent_r $hdrs
10831                 eval $hasproto ;;
10832         *)      ;;
10833         esac
10834         case "$d_endservent_r_proto" in
10835         define)
10836         case "$endservent_r_proto" in
10837         ''|0) try='int endservent_r(struct servent_data*);'
10838         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10839         esac
10840         case "$endservent_r_proto" in
10841         ''|0) try='void endservent_r(struct servent_data*);'
10842         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10843         esac
10844         case "$endservent_r_proto" in
10845         ''|0)   d_endservent_r=undef
10846                 endservent_r_proto=0
10847                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10848         * )     case "$endservent_r_proto" in
10849                 REENTRANT_PROTO*) ;;
10850                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10851                 esac
10852                 echo "Prototype: $try" ;;
10853         esac
10854         ;;
10855         *)      case "$usethreads" in
10856                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10857                 esac
10858                 d_endservent_r=undef
10859                 endservent_r_proto=0
10860                 ;;
10861         esac
10862         ;;
10863 *)      endservent_r_proto=0
10864         ;;
10865 esac
10866
10867 : Locate the flags for 'open()'
10868 echo " "
10869 $cat >try.c <<'EOCP'
10870 #include <sys/types.h>
10871 #ifdef I_FCNTL
10872 #include <fcntl.h>
10873 #endif
10874 #ifdef I_SYS_FILE
10875 #include <sys/file.h>
10876 #endif
10877 int main() {
10878         if(O_RDONLY);
10879 #ifdef O_TRUNC
10880         exit(0);
10881 #else
10882         exit(1);
10883 #endif
10884 }
10885 EOCP
10886 : check sys/file.h first to get FREAD on Sun
10887 if $test `./findhdr sys/file.h` && \
10888                 set try -DI_SYS_FILE && eval $compile; then
10889         h_sysfile=true;
10890         echo "<sys/file.h> defines the O_* constants..." >&4
10891         if $run ./try; then
10892                 echo "and you have the 3 argument form of open()." >&4
10893                 val="$define"
10894         else
10895                 echo "but not the 3 argument form of open().  Oh, well." >&4
10896                 val="$undef"
10897         fi
10898 elif $test `./findhdr fcntl.h` && \
10899                 set try -DI_FCNTL && eval $compile; then
10900         h_fcntl=true;
10901         echo "<fcntl.h> defines the O_* constants..." >&4
10902         if $run ./try; then
10903                 echo "and you have the 3 argument form of open()." >&4
10904                 val="$define"
10905         else
10906                 echo "but not the 3 argument form of open().  Oh, well." >&4
10907                 val="$undef"
10908         fi
10909 else
10910         val="$undef"
10911         echo "I can't find the O_* constant definitions!  You got problems." >&4
10912 fi
10913 set d_open3
10914 eval $setvar
10915 $rm -f try try.*
10916
10917 : see which of string.h or strings.h is needed
10918 echo " "
10919 strings=`./findhdr string.h`
10920 if $test "$strings" && $test -r "$strings"; then
10921         echo "Using <string.h> instead of <strings.h>." >&4
10922         val="$define"
10923 else
10924         val="$undef"
10925         strings=`./findhdr strings.h`
10926         if $test "$strings" && $test -r "$strings"; then
10927                 echo "Using <strings.h> instead of <string.h>." >&4
10928         else
10929                 echo "No string header found -- You'll surely have problems." >&4
10930         fi
10931 fi
10932 set i_string
10933 eval $setvar
10934 case "$i_string" in
10935 "$undef") strings=`./findhdr strings.h`;;
10936 *)        strings=`./findhdr string.h`;;
10937 esac
10938
10939 : see if this is a sys/file.h system
10940 val=''
10941 set sys/file.h val
10942 eval $inhdr
10943
10944 : do we need to include sys/file.h ?
10945 case "$val" in
10946 "$define")
10947         echo " "
10948         if $h_sysfile; then
10949                 val="$define"
10950                 echo "We'll be including <sys/file.h>." >&4
10951         else
10952                 val="$undef"
10953                 echo "We won't be including <sys/file.h>." >&4
10954         fi
10955         ;;
10956 *)
10957         h_sysfile=false
10958         ;;
10959 esac
10960 set i_sysfile
10961 eval $setvar
10962
10963 : see if fcntl.h is there
10964 val=''
10965 set fcntl.h val
10966 eval $inhdr
10967
10968 : see if we can include fcntl.h
10969 case "$val" in
10970 "$define")
10971         echo " "
10972         if $h_fcntl; then
10973                 val="$define"
10974                 echo "We'll be including <fcntl.h>." >&4
10975         else
10976                 val="$undef"
10977                 if $h_sysfile; then
10978         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10979                 else
10980                         echo "We won't be including <fcntl.h>." >&4
10981                 fi
10982         fi
10983         ;;
10984 *)
10985         h_fcntl=false
10986         val="$undef"
10987         ;;
10988 esac
10989 set i_fcntl
10990 eval $setvar
10991
10992 : check for non-blocking I/O stuff
10993 case "$h_sysfile" in
10994 true) echo "#include <sys/file.h>" > head.c;;
10995 *)
10996        case "$h_fcntl" in
10997        true) echo "#include <fcntl.h>" > head.c;;
10998        *) echo "#include <sys/fcntl.h>" > head.c;;
10999        esac
11000        ;;
11001 esac
11002 echo " "
11003 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11004 case "$o_nonblock" in
11005 '')
11006         $cat head.c > try.c
11007         $cat >>try.c <<EOCP
11008 #include <stdio.h>
11009 #include <stdlib.h>
11010 #$i_fcntl I_FCNTL
11011 #ifdef I_FCNTL
11012 #include <fcntl.h>
11013 #endif
11014 int main() {
11015 #ifdef O_NONBLOCK
11016         printf("O_NONBLOCK\n");
11017         exit(0);
11018 #endif
11019 #ifdef O_NDELAY
11020         printf("O_NDELAY\n");
11021         exit(0);
11022 #endif
11023 #ifdef FNDELAY
11024         printf("FNDELAY\n");
11025         exit(0);
11026 #endif
11027         exit(0);
11028 }
11029 EOCP
11030         set try
11031         if eval $compile_ok; then
11032                 o_nonblock=`$run ./try`
11033                 case "$o_nonblock" in
11034                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11035                 *) echo "Seems like we can use $o_nonblock.";;
11036                 esac
11037         else
11038                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11039         fi
11040         ;;
11041 *) echo "Using $hint value $o_nonblock.";;
11042 esac
11043 $rm -f try try.* .out core
11044
11045 echo " "
11046 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11047 case "$eagain" in
11048 '')
11049         $cat head.c > try.c
11050         $cat >>try.c <<EOCP
11051 #include <errno.h>
11052 #include <sys/types.h>
11053 #include <signal.h>
11054 #include <stdio.h> 
11055 #include <stdlib.h> 
11056 #$i_fcntl I_FCNTL
11057 #ifdef I_FCNTL
11058 #include <fcntl.h>
11059 #endif
11060 #define MY_O_NONBLOCK $o_nonblock
11061 #ifndef errno  /* XXX need better Configure test */
11062 extern int errno;
11063 #endif
11064 #$i_unistd I_UNISTD
11065 #ifdef I_UNISTD
11066 #include <unistd.h>
11067 #endif
11068 #$i_string I_STRING
11069 #ifdef I_STRING
11070 #include <string.h>
11071 #else
11072 #include <strings.h>
11073 #endif
11074 $signal_t blech(x) int x; { exit(3); }
11075 EOCP
11076         $cat >> try.c <<'EOCP'
11077 int main()
11078 {
11079         int pd[2];
11080         int pu[2];
11081         char buf[1];
11082         char string[100];
11083
11084         pipe(pd);       /* Down: child -> parent */
11085         pipe(pu);       /* Up: parent -> child */
11086         if (0 != fork()) {
11087                 int ret;
11088                 close(pd[1]);   /* Parent reads from pd[0] */
11089                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11090 #ifdef F_SETFL
11091                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11092                         exit(1);
11093 #else
11094                 exit(4);
11095 #endif
11096                 signal(SIGALRM, blech);
11097                 alarm(5);
11098                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11099                         exit(2);
11100                 sprintf(string, "%d\n", ret);
11101                 write(2, string, strlen(string));
11102                 alarm(0);
11103 #ifdef EAGAIN
11104                 if (errno == EAGAIN) {
11105                         printf("EAGAIN\n");
11106                         goto ok;
11107                 }
11108 #endif
11109 #ifdef EWOULDBLOCK
11110                 if (errno == EWOULDBLOCK)
11111                         printf("EWOULDBLOCK\n");
11112 #endif
11113         ok:
11114                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11115                 sleep(2);                               /* Give it time to close our pipe */
11116                 alarm(5);
11117                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11118                 alarm(0);
11119                 sprintf(string, "%d\n", ret);
11120                 write(4, string, strlen(string));
11121                 exit(0);
11122         }
11123
11124         close(pd[0]);                   /* We write to pd[1] */
11125         close(pu[1]);                   /* We read from pu[0] */
11126         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11127         close(pd[1]);                   /* Pipe pd is now fully closed! */
11128         exit(0);                                /* Bye bye, thank you for playing! */
11129 }
11130 EOCP
11131         set try
11132         if eval $compile_ok; then
11133                 echo "$startsh" >mtry
11134                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11135                 chmod +x mtry
11136                 ./mtry >/dev/null 2>&1
11137                 case $? in
11138                 0) eagain=`$cat try.out`;;
11139                 1) echo "Could not perform non-blocking setting!";;
11140                 2) echo "I did a successful read() for something that was not there!";;
11141                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11142                 4) echo "Could not find F_SETFL!";;
11143                 *) echo "Something terribly wrong happened during testing.";;
11144                 esac
11145                 rd_nodata=`$cat try.ret`
11146                 echo "A read() system call with no data present returns $rd_nodata."
11147                 case "$rd_nodata" in
11148                 0|-1) ;;
11149                 *)
11150                         echo "(That's peculiar, fixing that to be -1.)"
11151                         rd_nodata=-1
11152                         ;;
11153                 esac
11154                 case "$eagain" in
11155                 '')
11156                         echo "Forcing errno EAGAIN on read() with no data available."
11157                         eagain=EAGAIN
11158                         ;;
11159                 *)
11160                         echo "Your read() sets errno to $eagain when no data is available."
11161                         ;;
11162                 esac
11163                 status=`$cat try.err`
11164                 case "$status" in
11165                 0) echo "And it correctly returns 0 to signal EOF.";;
11166                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11167                 *) echo "However, your read() returns '$status' on EOF??";;
11168                 esac
11169                 val="$define"
11170                 if test "$status" = "$rd_nodata"; then
11171                         echo "WARNING: you can't distinguish between EOF and no data!"
11172                         val="$undef"
11173                 fi
11174         else
11175                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11176                 eagain=EAGAIN
11177         fi
11178         set d_eofnblk
11179         eval $setvar
11180         ;;
11181 *)
11182         echo "Using $hint value $eagain."
11183         echo "Your read() returns $rd_nodata when no data is present."
11184         case "$d_eofnblk" in
11185         "$define") echo "And you can see EOF because read() returns 0.";;
11186         "$undef") echo "But you can't see EOF status from read() returned value.";;
11187         *)
11188                 echo "(Assuming you can't see EOF status from read anyway.)"
11189                 d_eofnblk=$undef
11190                 ;;
11191         esac
11192         ;;
11193 esac
11194 $rm -f try try.* .out core head.c mtry
11195
11196 : see if fchdir exists
11197 set fchdir d_fchdir
11198 eval $inlibc
11199
11200 : see if fchmod exists
11201 set fchmod d_fchmod
11202 eval $inlibc
11203
11204 : see if fchown exists
11205 set fchown d_fchown
11206 eval $inlibc
11207
11208 : see if this is an fcntl system
11209 set fcntl d_fcntl
11210 eval $inlibc
11211
11212 echo " "
11213 : See if fcntl-based locking works.
11214 $cat >try.c <<EOCP
11215 #include <stdlib.h>
11216 #include <unistd.h>
11217 #include <fcntl.h>
11218 #include <signal.h>
11219 $signal_t blech(x) int x; { exit(3); }
11220 int main() {
11221 #if defined(F_SETLK) && defined(F_SETLKW)
11222      struct flock flock;
11223      int retval, fd;
11224      fd = open("try.c", O_RDONLY);
11225      flock.l_type = F_RDLCK;
11226      flock.l_whence = SEEK_SET;
11227      flock.l_start = flock.l_len = 0;
11228      signal(SIGALRM, blech);
11229      alarm(10);
11230      retval = fcntl(fd, F_SETLK, &flock);
11231      close(fd);
11232      (retval < 0 ? exit(2) : exit(0));
11233 #else
11234      exit(2);
11235 #endif
11236 }
11237 EOCP
11238 echo "Checking if fcntl-based file locking works... "
11239 case "$d_fcntl" in
11240 "$define")
11241         set try
11242         if eval $compile_ok; then
11243                 if $run ./try; then
11244                         echo "Yes, it seems to work."
11245                         val="$define"
11246                 else
11247                         echo "Nope, it didn't work."
11248                         val="$undef"
11249                         case "$?" in
11250                         3) $cat >&4 <<EOM
11251 ***
11252 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11253 *** This is (almost) impossible.
11254 *** If your NFS lock daemons are not feeling well, something like
11255 *** this may happen, please investigate.  Cannot continue, aborting.
11256 ***
11257 EOM
11258                                 exit 1
11259                                 ;;
11260                         esac
11261                 fi
11262         else
11263                 echo "I'm unable to compile the test program, so I'll assume not."
11264                 val="$undef"
11265         fi
11266         ;;
11267 *) val="$undef";
11268         echo "Nope, since you don't even have fcntl()."
11269         ;;
11270 esac
11271 set d_fcntl_can_lock
11272 eval $setvar
11273 $rm -f try*
11274
11275
11276 : check for fd_set items
11277 $cat <<EOM
11278
11279 Checking to see how well your C compiler handles fd_set and friends ...
11280 EOM
11281 $cat >try.c <<EOCP
11282 #$i_systime I_SYS_TIME
11283 #$i_sysselct I_SYS_SELECT
11284 #$d_socket HAS_SOCKET
11285 #include <sys/types.h>
11286 #ifdef HAS_SOCKET
11287 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11288 #endif
11289 #ifdef I_SYS_TIME
11290 #include <sys/time.h>
11291 #endif
11292 #ifdef I_SYS_SELECT
11293 #include <sys/select.h>
11294 #endif
11295 int main() {
11296         fd_set fds;
11297
11298 #ifdef TRYBITS
11299         if(fds.fds_bits);
11300 #endif
11301
11302 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11303         exit(0);
11304 #else
11305         exit(1);
11306 #endif
11307 }
11308 EOCP
11309 set try -DTRYBITS
11310 if eval $compile; then
11311         d_fds_bits="$define"
11312         d_fd_set="$define"
11313         echo "Well, your system knows about the normal fd_set typedef..." >&4
11314         if $run ./try; then
11315                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11316                 d_fd_macros="$define"
11317         else
11318                 $cat >&4 <<'EOM'
11319 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11320 EOM
11321                 d_fd_macros="$undef"
11322         fi
11323 else
11324         $cat <<'EOM'
11325 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11326 EOM
11327         set try
11328         if eval $compile; then
11329                 d_fds_bits="$undef"
11330                 d_fd_set="$define"
11331                 echo "Well, your system has some sort of fd_set available..." >&4
11332                 if $run ./try; then
11333                         echo "and you have the normal fd_set macros." >&4
11334                         d_fd_macros="$define"
11335                 else
11336                         $cat <<'EOM'
11337 but not the normal fd_set macros!  Gross!  More work for me...
11338 EOM
11339                         d_fd_macros="$undef"
11340                 fi
11341         else
11342         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11343                 d_fd_set="$undef"
11344                 d_fds_bits="$undef"
11345                 d_fd_macros="$undef"
11346         fi
11347 fi
11348 $rm -f try try.*
11349
11350 : see if fgetpos exists
11351 set fgetpos d_fgetpos
11352 eval $inlibc
11353
11354 : see if finite exists
11355 set finite d_finite
11356 eval $inlibc
11357
11358 : see if finitel exists
11359 set finitel d_finitel
11360 eval $inlibc
11361
11362 : see if flock exists
11363 set flock d_flock
11364 eval $inlibc
11365
11366 : see if prototype for flock is available
11367 echo " "
11368 set d_flockproto flock $i_sysfile sys/file.h
11369 eval $hasproto
11370
11371 : see if fork exists
11372 set fork d_fork
11373 eval $inlibc
11374
11375 : see if fp_class exists
11376 set fp_class d_fp_class
11377 eval $inlibc
11378
11379 : see if pathconf exists
11380 set pathconf d_pathconf
11381 eval $inlibc
11382
11383 : see if fpathconf exists
11384 set fpathconf d_fpathconf
11385 eval $inlibc
11386
11387 : see if fpclass exists
11388 set fpclass d_fpclass
11389 eval $inlibc
11390
11391 : see if fpclassify exists
11392 set fpclassify d_fpclassify
11393 eval $inlibc
11394
11395 : see if fpclassl exists
11396 set fpclassl d_fpclassl
11397 eval $inlibc
11398
11399
11400 : check for fpos64_t
11401 echo " "
11402 echo "Checking to see if you have fpos64_t..." >&4
11403 $cat >try.c <<EOCP
11404 #include <stdio.h>
11405 int main() { fpos64_t x = 7; }
11406 EOCP
11407 set try
11408 if eval $compile; then
11409         val="$define"
11410         echo "You have fpos64_t."
11411 else
11412         val="$undef"
11413         echo "You do not have fpos64_t."
11414         case "$fpossize" in
11415         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11416         esac
11417 fi
11418 $rm -f try.* try
11419 set d_fpos64_t
11420 eval $setvar
11421
11422 : see if frexpl exists
11423 set frexpl d_frexpl
11424 eval $inlibc
11425
11426 : see if this is a sys/param system
11427 set sys/param.h i_sysparam
11428 eval $inhdr
11429
11430 : see if this is a sys/mount.h system
11431 set sys/mount.h i_sysmount
11432 eval $inhdr
11433
11434
11435 echo " "
11436 echo "Checking to see if your system supports struct fs_data..." >&4
11437 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11438 eval $hasstruct
11439 case "$d_fs_data_s" in
11440 "$define")      echo "Yes, it does."   ;;
11441 *)              echo "No, it doesn't." ;;
11442 esac
11443
11444 : see if fseeko exists
11445 set fseeko d_fseeko
11446 eval $inlibc
11447 case "$longsize" in
11448 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11449 esac
11450
11451 : see if fsetpos exists
11452 set fsetpos d_fsetpos
11453 eval $inlibc
11454
11455
11456 : see if fstatfs exists
11457 set fstatfs d_fstatfs
11458 eval $inlibc
11459
11460
11461 : see if statvfs exists
11462 set statvfs d_statvfs
11463 eval $inlibc
11464
11465 : see if fstatvfs exists
11466 set fstatvfs d_fstatvfs
11467 eval $inlibc
11468
11469
11470 : see if fsync exists
11471 set fsync d_fsync
11472 eval $inlibc
11473
11474 : see if ftello exists
11475 set ftello d_ftello
11476 eval $inlibc
11477 case "$longsize" in
11478 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11479 esac
11480
11481 : see if getcwd exists
11482 set getcwd d_getcwd
11483 eval $inlibc
11484
11485 : see if getespwnam exists
11486 set getespwnam d_getespwnam
11487 eval $inlibc
11488
11489
11490 : see if getfsstat exists
11491 set getfsstat d_getfsstat
11492 eval $inlibc
11493
11494 : see if getgrent exists
11495 set getgrent d_getgrent
11496 eval $inlibc
11497
11498 : see if getgrent_r exists
11499 set getgrent_r d_getgrent_r
11500 eval $inlibc
11501 case "$d_getgrent_r" in
11502 "$define")
11503         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11504         case "$d_getgrent_r_proto:$usethreads" in
11505         ":define")      d_getgrent_r_proto=define
11506                 set d_getgrent_r_proto getgrent_r $hdrs
11507                 eval $hasproto ;;
11508         *)      ;;
11509         esac
11510         case "$d_getgrent_r_proto" in
11511         define)
11512         case "$getgrent_r_proto" in
11513         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11514         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11515         esac
11516         case "$getgrent_r_proto" in
11517         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11518         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11519         esac
11520         case "$getgrent_r_proto" in
11521         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11522         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11523         esac
11524         case "$getgrent_r_proto" in
11525         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11526         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11527         esac
11528         case "$getgrent_r_proto" in
11529         ''|0) try='int getgrent_r(struct group*, char*, int);'
11530         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11531         esac
11532         case "$getgrent_r_proto" in
11533         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11534         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11535         esac
11536         case "$getgrent_r_proto" in
11537         ''|0)   d_getgrent_r=undef
11538                 getgrent_r_proto=0
11539                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11540         * )     case "$getgrent_r_proto" in
11541                 REENTRANT_PROTO*) ;;
11542                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11543                 esac
11544                 echo "Prototype: $try" ;;
11545         esac
11546         ;;
11547         *)      case "$usethreads" in
11548                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11549                 esac
11550                 d_getgrent_r=undef
11551                 getgrent_r_proto=0
11552                 ;;
11553         esac
11554         ;;
11555 *)      getgrent_r_proto=0
11556         ;;
11557 esac
11558
11559 : see if getgrgid_r exists
11560 set getgrgid_r d_getgrgid_r
11561 eval $inlibc
11562 case "$d_getgrgid_r" in
11563 "$define")
11564         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11565         case "$d_getgrgid_r_proto:$usethreads" in
11566         ":define")      d_getgrgid_r_proto=define
11567                 set d_getgrgid_r_proto getgrgid_r $hdrs
11568                 eval $hasproto ;;
11569         *)      ;;
11570         esac
11571         case "$d_getgrgid_r_proto" in
11572         define)
11573         case "$getgrgid_r_proto" in
11574         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11575         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11576         esac
11577         case "$getgrgid_r_proto" in
11578         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11579         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11580         esac
11581         case "$getgrgid_r_proto" in
11582         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11583         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11584         esac
11585         case "$getgrgid_r_proto" in
11586         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11587         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11588         esac
11589         case "$getgrgid_r_proto" in
11590         ''|0)   d_getgrgid_r=undef
11591                 getgrgid_r_proto=0
11592                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11593         * )     case "$getgrgid_r_proto" in
11594                 REENTRANT_PROTO*) ;;
11595                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11596                 esac
11597                 echo "Prototype: $try" ;;
11598         esac
11599         ;;
11600         *)      case "$usethreads" in
11601                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11602                 esac
11603                 d_getgrgid_r=undef
11604                 getgrgid_r_proto=0
11605                 ;;
11606         esac
11607         ;;
11608 *)      getgrgid_r_proto=0
11609         ;;
11610 esac
11611
11612 : see if getgrnam_r exists
11613 set getgrnam_r d_getgrnam_r
11614 eval $inlibc
11615 case "$d_getgrnam_r" in
11616 "$define")
11617         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11618         case "$d_getgrnam_r_proto:$usethreads" in
11619         ":define")      d_getgrnam_r_proto=define
11620                 set d_getgrnam_r_proto getgrnam_r $hdrs
11621                 eval $hasproto ;;
11622         *)      ;;
11623         esac
11624         case "$d_getgrnam_r_proto" in
11625         define)
11626         case "$getgrnam_r_proto" in
11627         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11628         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11629         esac
11630         case "$getgrnam_r_proto" in
11631         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11632         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11633         esac
11634         case "$getgrnam_r_proto" in
11635         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11636         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11637         esac
11638         case "$getgrnam_r_proto" in
11639         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11640         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11641         esac
11642         case "$getgrnam_r_proto" in
11643         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11644         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11645         esac
11646         case "$getgrnam_r_proto" in
11647         ''|0)   d_getgrnam_r=undef
11648                 getgrnam_r_proto=0
11649                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11650         * )     case "$getgrnam_r_proto" in
11651                 REENTRANT_PROTO*) ;;
11652                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11653                 esac
11654                 echo "Prototype: $try" ;;
11655         esac
11656         ;;
11657         *)      case "$usethreads" in
11658                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11659                 esac
11660                 d_getgrnam_r=undef
11661                 getgrnam_r_proto=0
11662                 ;;
11663         esac
11664         ;;
11665 *)      getgrnam_r_proto=0
11666         ;;
11667 esac
11668
11669 : see if gethostbyaddr exists
11670 set gethostbyaddr d_gethbyaddr
11671 eval $inlibc
11672
11673 : see if gethostbyname exists
11674 set gethostbyname d_gethbyname
11675 eval $inlibc
11676
11677 : see if gethostent exists
11678 set gethostent d_gethent
11679 eval $inlibc
11680
11681 : see how we will look up host name
11682 echo " "
11683 call=''
11684 if set gethostname val -f d_gethname; eval $csym; $val; then
11685         echo 'gethostname() found.' >&4
11686         d_gethname="$define"
11687         call=gethostname
11688 fi
11689 if set uname val -f d_uname; eval $csym; $val; then
11690         if ./xenix; then
11691                 $cat <<'EOM'
11692 uname() was found, but you're running xenix, and older versions of xenix
11693 have a broken uname(). If you don't really know whether your xenix is old
11694 enough to have a broken system call, use the default answer.
11695
11696 EOM
11697                 dflt=y
11698                 case "$d_uname" in
11699                 "$define") dflt=n;;
11700                 esac
11701                 rp='Is your uname() broken?'
11702                 . ./myread
11703                 case "$ans" in
11704                 n*) d_uname="$define"; call=uname;;
11705                 esac
11706         else
11707                 echo 'uname() found.' >&4
11708                 d_uname="$define"
11709                 case "$call" in
11710                 '') call=uname ;;
11711                 esac
11712         fi
11713 fi
11714 case "$d_gethname" in
11715 '') d_gethname="$undef";;
11716 esac
11717 case "$d_uname" in
11718 '') d_uname="$undef";;
11719 esac
11720 case "$d_uname$d_gethname" in
11721 *define*)
11722         dflt=n
11723         cat <<EOM
11724  
11725 Every now and then someone has a $call() that lies about the hostname
11726 but can't be fixed for political or economic reasons.  If you wish, I can
11727 pretend $call() isn't there and maybe compute hostname at run-time
11728 thanks to the '$phostname' command.
11729
11730 EOM
11731         rp="Shall I ignore $call() from now on?"
11732         . ./myread
11733         case "$ans" in
11734         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11735         esac;;
11736 esac
11737 case "$phostname" in
11738 '') aphostname='';;
11739 *) case "$aphostname" in
11740         /*) ;;
11741         *) set X $phostname
11742                 shift
11743                 file=$1
11744                 shift
11745                 file=`./loc $file $file $pth`
11746                 aphostname=`echo $file $*`
11747                 ;;
11748         esac
11749         ;;
11750 esac
11751 case "$d_uname$d_gethname" in
11752 *define*) ;;
11753 *)
11754         case "$phostname" in
11755         '')
11756                 echo "There will be no way for $package to get your hostname." >&4;;
11757         *)
11758         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11759                 ;;
11760         esac;;
11761 esac
11762 case "$d_phostname" in
11763 '') d_phostname="$undef";;
11764 esac
11765
11766 : see if gethostbyaddr_r exists
11767 set gethostbyaddr_r d_gethostbyaddr_r
11768 eval $inlibc
11769 case "$d_gethostbyaddr_r" in
11770 "$define")
11771         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11772         case "$d_gethostbyaddr_r_proto:$usethreads" in
11773         ":define")      d_gethostbyaddr_r_proto=define
11774                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11775                 eval $hasproto ;;
11776         *)      ;;
11777         esac
11778         case "$d_gethostbyaddr_r_proto" in
11779         define)
11780         case "$gethostbyaddr_r_proto" in
11781         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11782         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11783         esac
11784         case "$gethostbyaddr_r_proto" in
11785         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11786         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11787         esac
11788         case "$gethostbyaddr_r_proto" in
11789         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11790         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11791         esac
11792         case "$gethostbyaddr_r_proto" in
11793         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11794         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11795         esac
11796         case "$gethostbyaddr_r_proto" in
11797         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11798         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11799         esac
11800         case "$gethostbyaddr_r_proto" in
11801         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11802         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11803         esac
11804         case "$gethostbyaddr_r_proto" in
11805         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11806         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11807         esac
11808         case "$gethostbyaddr_r_proto" in
11809         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11810         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11811         esac
11812         case "$gethostbyaddr_r_proto" in
11813         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11814         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11815         esac
11816         case "$gethostbyaddr_r_proto" in
11817         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11818         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11819         esac
11820         case "$gethostbyaddr_r_proto" in
11821         ''|0)   d_gethostbyaddr_r=undef
11822                 gethostbyaddr_r_proto=0
11823                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11824         * )     case "$gethostbyaddr_r_proto" in
11825                 REENTRANT_PROTO*) ;;
11826                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11827                 esac
11828                 echo "Prototype: $try" ;;
11829         esac
11830         ;;
11831         *)      case "$usethreads" in
11832                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11833                 esac
11834                 d_gethostbyaddr_r=undef
11835                 gethostbyaddr_r_proto=0
11836                 ;;
11837         esac
11838         ;;
11839 *)      gethostbyaddr_r_proto=0
11840         ;;
11841 esac
11842
11843 : see if gethostbyname_r exists
11844 set gethostbyname_r d_gethostbyname_r
11845 eval $inlibc
11846 case "$d_gethostbyname_r" in
11847 "$define")
11848         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11849         case "$d_gethostbyname_r_proto:$usethreads" in
11850         ":define")      d_gethostbyname_r_proto=define
11851                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11852                 eval $hasproto ;;
11853         *)      ;;
11854         esac
11855         case "$d_gethostbyname_r_proto" in
11856         define)
11857         case "$gethostbyname_r_proto" in
11858         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11859         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11860         esac
11861         case "$gethostbyname_r_proto" in
11862         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11863         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11864         esac
11865         case "$gethostbyname_r_proto" in
11866         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11867         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11868         esac
11869         case "$gethostbyname_r_proto" in
11870         ''|0)   d_gethostbyname_r=undef
11871                 gethostbyname_r_proto=0
11872                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11873         * )     case "$gethostbyname_r_proto" in
11874                 REENTRANT_PROTO*) ;;
11875                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11876                 esac
11877                 echo "Prototype: $try" ;;
11878         esac
11879         ;;
11880         *)      case "$usethreads" in
11881                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11882                 esac
11883                 d_gethostbyname_r=undef
11884                 gethostbyname_r_proto=0
11885                 ;;
11886         esac
11887         ;;
11888 *)      gethostbyname_r_proto=0
11889         ;;
11890 esac
11891
11892 : see if gethostent_r exists
11893 set gethostent_r d_gethostent_r
11894 eval $inlibc
11895 case "$d_gethostent_r" in
11896 "$define")
11897         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11898         case "$d_gethostent_r_proto:$usethreads" in
11899         ":define")      d_gethostent_r_proto=define
11900                 set d_gethostent_r_proto gethostent_r $hdrs
11901                 eval $hasproto ;;
11902         *)      ;;
11903         esac
11904         case "$d_gethostent_r_proto" in
11905         define)
11906         case "$gethostent_r_proto" in
11907         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11908         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11909         esac
11910         case "$gethostent_r_proto" in
11911         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11912         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11913         esac
11914         case "$gethostent_r_proto" in
11915         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11916         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11917         esac
11918         case "$gethostent_r_proto" in
11919         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11920         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11921         esac
11922         case "$gethostent_r_proto" in
11923         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11924         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11925         esac
11926         case "$gethostent_r_proto" in
11927         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11928         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11929         esac
11930         case "$gethostent_r_proto" in
11931         ''|0)   d_gethostent_r=undef
11932                 gethostent_r_proto=0
11933                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11934         * )     case "$gethostent_r_proto" in
11935                 REENTRANT_PROTO*) ;;
11936                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11937                 esac
11938                 echo "Prototype: $try" ;;
11939         esac
11940         ;;
11941         *)      case "$usethreads" in
11942                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11943                 esac
11944                 d_gethostent_r=undef
11945                 gethostent_r_proto=0
11946                 ;;
11947         esac
11948         ;;
11949 *)      gethostent_r_proto=0
11950         ;;
11951 esac
11952
11953 : see if prototypes for various gethostxxx netdb.h functions are available
11954 echo " "
11955 set d_gethostprotos gethostent $i_netdb netdb.h
11956 eval $hasproto
11957
11958 : see if getitimer exists
11959 set getitimer d_getitimer
11960 eval $inlibc
11961
11962 : see if getlogin exists
11963 set getlogin d_getlogin
11964 eval $inlibc
11965
11966 : see if getlogin_r exists
11967 set getlogin_r d_getlogin_r
11968 eval $inlibc
11969 case "$d_getlogin_r" in
11970 "$define")
11971         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11972         case "$d_getlogin_r_proto:$usethreads" in
11973         ":define")      d_getlogin_r_proto=define
11974                 set d_getlogin_r_proto getlogin_r $hdrs
11975                 eval $hasproto ;;
11976         *)      ;;
11977         esac
11978         case "$d_getlogin_r_proto" in
11979         define)
11980         case "$getlogin_r_proto" in
11981         ''|0) try='int getlogin_r(char*, size_t);'
11982         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11983         esac
11984         case "$getlogin_r_proto" in
11985         ''|0) try='int getlogin_r(char*, int);'
11986         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11987         esac
11988         case "$getlogin_r_proto" in
11989         ''|0) try='char* getlogin_r(char*, size_t);'
11990         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11991         esac
11992         case "$getlogin_r_proto" in
11993         ''|0) try='char* getlogin_r(char*, int);'
11994         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11995         esac
11996         case "$getlogin_r_proto" in
11997         ''|0)   d_getlogin_r=undef
11998                 getlogin_r_proto=0
11999                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12000         * )     case "$getlogin_r_proto" in
12001                 REENTRANT_PROTO*) ;;
12002                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12003                 esac
12004                 echo "Prototype: $try" ;;
12005         esac
12006         ;;
12007         *)      case "$usethreads" in
12008                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12009                 esac
12010                 d_getlogin_r=undef
12011                 getlogin_r_proto=0
12012                 ;;
12013         esac
12014         ;;
12015 *)      getlogin_r_proto=0
12016         ;;
12017 esac
12018
12019 : see if getmnt exists
12020 set getmnt d_getmnt
12021 eval $inlibc
12022
12023 : see if getmntent exists
12024 set getmntent d_getmntent
12025 eval $inlibc
12026
12027 : see if getnetbyaddr exists
12028 set getnetbyaddr d_getnbyaddr
12029 eval $inlibc
12030
12031 : see if getnetbyname exists
12032 set getnetbyname d_getnbyname
12033 eval $inlibc
12034
12035 : see if getnetent exists
12036 set getnetent d_getnent
12037 eval $inlibc
12038
12039 : see if getnetbyaddr_r exists
12040 set getnetbyaddr_r d_getnetbyaddr_r
12041 eval $inlibc
12042 case "$d_getnetbyaddr_r" in
12043 "$define")
12044         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12045         case "$d_getnetbyaddr_r_proto:$usethreads" in
12046         ":define")      d_getnetbyaddr_r_proto=define
12047                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12048                 eval $hasproto ;;
12049         *)      ;;
12050         esac
12051         case "$d_getnetbyaddr_r_proto" in
12052         define)
12053         case "$getnetbyaddr_r_proto" in
12054         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12055         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12056         esac
12057         case "$getnetbyaddr_r_proto" in
12058         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12059         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12060         esac
12061         case "$getnetbyaddr_r_proto" in
12062         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12063         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12064         esac
12065         case "$getnetbyaddr_r_proto" in
12066         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12067         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12068         esac
12069         case "$getnetbyaddr_r_proto" in
12070         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12071         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12072         esac
12073         case "$getnetbyaddr_r_proto" in
12074         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12075         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12076         esac
12077         case "$getnetbyaddr_r_proto" in
12078         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12079         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12080         esac
12081         case "$getnetbyaddr_r_proto" in
12082         ''|0)   d_getnetbyaddr_r=undef
12083                 getnetbyaddr_r_proto=0
12084                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12085         * )     case "$getnetbyaddr_r_proto" in
12086                 REENTRANT_PROTO*) ;;
12087                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12088                 esac
12089                 echo "Prototype: $try" ;;
12090         esac
12091         ;;
12092         *)      case "$usethreads" in
12093                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12094                 esac
12095                 d_getnetbyaddr_r=undef
12096                 getnetbyaddr_r_proto=0
12097                 ;;
12098         esac
12099         ;;
12100 *)      getnetbyaddr_r_proto=0
12101         ;;
12102 esac
12103
12104 : see if getnetbyname_r exists
12105 set getnetbyname_r d_getnetbyname_r
12106 eval $inlibc
12107 case "$d_getnetbyname_r" in
12108 "$define")
12109         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12110         case "$d_getnetbyname_r_proto:$usethreads" in
12111         ":define")      d_getnetbyname_r_proto=define
12112                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12113                 eval $hasproto ;;
12114         *)      ;;
12115         esac
12116         case "$d_getnetbyname_r_proto" in
12117         define)
12118         case "$getnetbyname_r_proto" in
12119         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12120         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12121         esac
12122         case "$getnetbyname_r_proto" in
12123         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12124         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12125         esac
12126         case "$getnetbyname_r_proto" in
12127         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12128         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12129         esac
12130         case "$getnetbyname_r_proto" in
12131         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12132         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12133         esac
12134         case "$getnetbyname_r_proto" in
12135         ''|0)   d_getnetbyname_r=undef
12136                 getnetbyname_r_proto=0
12137                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12138         * )     case "$getnetbyname_r_proto" in
12139                 REENTRANT_PROTO*) ;;
12140                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12141                 esac
12142                 echo "Prototype: $try" ;;
12143         esac
12144         ;;
12145         *)      case "$usethreads" in
12146                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12147                 esac
12148                 d_getnetbyname_r=undef
12149                 getnetbyname_r_proto=0
12150                 ;;
12151         esac
12152         ;;
12153 *)      getnetbyname_r_proto=0
12154         ;;
12155 esac
12156
12157 : see if getnetent_r exists
12158 set getnetent_r d_getnetent_r
12159 eval $inlibc
12160 case "$d_getnetent_r" in
12161 "$define")
12162         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12163         case "$d_getnetent_r_proto:$usethreads" in
12164         ":define")      d_getnetent_r_proto=define
12165                 set d_getnetent_r_proto getnetent_r $hdrs
12166                 eval $hasproto ;;
12167         *)      ;;
12168         esac
12169         case "$d_getnetent_r_proto" in
12170         define)
12171         case "$getnetent_r_proto" in
12172         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12173         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12174         esac
12175         case "$getnetent_r_proto" in
12176         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12177         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12178         esac
12179         case "$getnetent_r_proto" in
12180         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12181         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12182         esac
12183         case "$getnetent_r_proto" in
12184         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12185         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12186         esac
12187         case "$getnetent_r_proto" in
12188         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12189         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12190         esac
12191         case "$getnetent_r_proto" in
12192         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12193         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12194         esac
12195         case "$getnetent_r_proto" in
12196         ''|0)   d_getnetent_r=undef
12197                 getnetent_r_proto=0
12198                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12199         * )     case "$getnetent_r_proto" in
12200                 REENTRANT_PROTO*) ;;
12201                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12202                 esac
12203                 echo "Prototype: $try" ;;
12204         esac
12205         ;;
12206         *)      case "$usethreads" in
12207                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12208                 esac
12209                 d_getnetent_r=undef
12210                 getnetent_r_proto=0
12211                 ;;
12212         esac
12213         ;;
12214 *)      getnetent_r_proto=0
12215         ;;
12216 esac
12217
12218 : see if prototypes for various getnetxxx netdb.h functions are available
12219 echo " "
12220 set d_getnetprotos getnetent $i_netdb netdb.h
12221 eval $hasproto
12222
12223 : see if getpagesize exists
12224 set getpagesize d_getpagsz
12225 eval $inlibc
12226
12227
12228 : see if getprotobyname exists
12229 set getprotobyname d_getpbyname
12230 eval $inlibc
12231
12232 : see if getprotobynumber exists
12233 set getprotobynumber d_getpbynumber
12234 eval $inlibc
12235
12236 : see if getprotoent exists
12237 set getprotoent d_getpent
12238 eval $inlibc
12239
12240 : see if getpgid exists
12241 set getpgid d_getpgid
12242 eval $inlibc
12243
12244 : see if getpgrp2 exists
12245 set getpgrp2 d_getpgrp2
12246 eval $inlibc
12247
12248 : see if getppid exists
12249 set getppid d_getppid
12250 eval $inlibc
12251
12252 : see if getpriority exists
12253 set getpriority d_getprior
12254 eval $inlibc
12255
12256 : see if getprotobyname_r exists
12257 set getprotobyname_r d_getprotobyname_r
12258 eval $inlibc
12259 case "$d_getprotobyname_r" in
12260 "$define")
12261         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12262         case "$d_getprotobyname_r_proto:$usethreads" in
12263         ":define")      d_getprotobyname_r_proto=define
12264                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12265                 eval $hasproto ;;
12266         *)      ;;
12267         esac
12268         case "$d_getprotobyname_r_proto" in
12269         define)
12270         case "$getprotobyname_r_proto" in
12271         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12272         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12273         esac
12274         case "$getprotobyname_r_proto" in
12275         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12276         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12277         esac
12278         case "$getprotobyname_r_proto" in
12279         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12280         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12281         esac
12282         case "$getprotobyname_r_proto" in
12283         ''|0)   d_getprotobyname_r=undef
12284                 getprotobyname_r_proto=0
12285                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12286         * )     case "$getprotobyname_r_proto" in
12287                 REENTRANT_PROTO*) ;;
12288                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12289                 esac
12290                 echo "Prototype: $try" ;;
12291         esac
12292         ;;
12293         *)      case "$usethreads" in
12294                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12295                 esac
12296                 d_getprotobyname_r=undef
12297                 getprotobyname_r_proto=0
12298                 ;;
12299         esac
12300         ;;
12301 *)      getprotobyname_r_proto=0
12302         ;;
12303 esac
12304
12305 : see if getprotobynumber_r exists
12306 set getprotobynumber_r d_getprotobynumber_r
12307 eval $inlibc
12308 case "$d_getprotobynumber_r" in
12309 "$define")
12310         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12311         case "$d_getprotobynumber_r_proto:$usethreads" in
12312         ":define")      d_getprotobynumber_r_proto=define
12313                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12314                 eval $hasproto ;;
12315         *)      ;;
12316         esac
12317         case "$d_getprotobynumber_r_proto" in
12318         define)
12319         case "$getprotobynumber_r_proto" in
12320         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12321         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12322         esac
12323         case "$getprotobynumber_r_proto" in
12324         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12325         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12326         esac
12327         case "$getprotobynumber_r_proto" in
12328         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12329         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12330         esac
12331         case "$getprotobynumber_r_proto" in
12332         ''|0)   d_getprotobynumber_r=undef
12333                 getprotobynumber_r_proto=0
12334                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12335         * )     case "$getprotobynumber_r_proto" in
12336                 REENTRANT_PROTO*) ;;
12337                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12338                 esac
12339                 echo "Prototype: $try" ;;
12340         esac
12341         ;;
12342         *)      case "$usethreads" in
12343                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12344                 esac
12345                 d_getprotobynumber_r=undef
12346                 getprotobynumber_r_proto=0
12347                 ;;
12348         esac
12349         ;;
12350 *)      getprotobynumber_r_proto=0
12351         ;;
12352 esac
12353
12354 : see if getprotoent_r exists
12355 set getprotoent_r d_getprotoent_r
12356 eval $inlibc
12357 case "$d_getprotoent_r" in
12358 "$define")
12359         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12360         case "$d_getprotoent_r_proto:$usethreads" in
12361         ":define")      d_getprotoent_r_proto=define
12362                 set d_getprotoent_r_proto getprotoent_r $hdrs
12363                 eval $hasproto ;;
12364         *)      ;;
12365         esac
12366         case "$d_getprotoent_r_proto" in
12367         define)
12368         case "$getprotoent_r_proto" in
12369         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12370         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12371         esac
12372         case "$getprotoent_r_proto" in
12373         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12374         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12375         esac
12376         case "$getprotoent_r_proto" in
12377         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12378         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12379         esac
12380         case "$getprotoent_r_proto" in
12381         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12382         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12383         esac
12384         case "$getprotoent_r_proto" in
12385         ''|0)   d_getprotoent_r=undef
12386                 getprotoent_r_proto=0
12387                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12388         * )     case "$getprotoent_r_proto" in
12389                 REENTRANT_PROTO*) ;;
12390                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12391                 esac
12392                 echo "Prototype: $try" ;;
12393         esac
12394         ;;
12395         *)      case "$usethreads" in
12396                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12397                 esac
12398                 d_getprotoent_r=undef
12399                 getprotoent_r_proto=0
12400                 ;;
12401         esac
12402         ;;
12403 *)      getprotoent_r_proto=0
12404         ;;
12405 esac
12406
12407 : see if prototypes for various getprotoxxx netdb.h functions are available
12408 echo " "
12409 set d_getprotoprotos getprotoent $i_netdb netdb.h
12410 eval $hasproto
12411
12412 : see if getprpwnam exists
12413 set getprpwnam d_getprpwnam
12414 eval $inlibc
12415
12416 : see if getpwent exists
12417 set getpwent d_getpwent
12418 eval $inlibc
12419
12420 : see if getpwent_r exists
12421 set getpwent_r d_getpwent_r
12422 eval $inlibc
12423 case "$d_getpwent_r" in
12424 "$define")
12425         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12426         case "$d_getpwent_r_proto:$usethreads" in
12427         ":define")      d_getpwent_r_proto=define
12428                 set d_getpwent_r_proto getpwent_r $hdrs
12429                 eval $hasproto ;;
12430         *)      ;;
12431         esac
12432         case "$d_getpwent_r_proto" in
12433         define)
12434         case "$getpwent_r_proto" in
12435         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12436         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12437         esac
12438         case "$getpwent_r_proto" in
12439         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12440         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12441         esac
12442         case "$getpwent_r_proto" in
12443         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12444         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12445         esac
12446         case "$getpwent_r_proto" in
12447         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12448         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12449         esac
12450         case "$getpwent_r_proto" in
12451         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12452         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12453         esac
12454         case "$getpwent_r_proto" in
12455         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12456         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12457         esac
12458         case "$getpwent_r_proto" in
12459         ''|0)   d_getpwent_r=undef
12460                 getpwent_r_proto=0
12461                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12462         * )     case "$getpwent_r_proto" in
12463                 REENTRANT_PROTO*) ;;
12464                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12465                 esac
12466                 echo "Prototype: $try" ;;
12467         esac
12468         ;;
12469         *)      case "$usethreads" in
12470                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12471                 esac
12472                 d_getpwent_r=undef
12473                 getpwent_r_proto=0
12474                 ;;
12475         esac
12476         ;;
12477 *)      getpwent_r_proto=0
12478         ;;
12479 esac
12480
12481 : see if getpwnam_r exists
12482 set getpwnam_r d_getpwnam_r
12483 eval $inlibc
12484 case "$d_getpwnam_r" in
12485 "$define")
12486         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12487         case "$d_getpwnam_r_proto:$usethreads" in
12488         ":define")      d_getpwnam_r_proto=define
12489                 set d_getpwnam_r_proto getpwnam_r $hdrs
12490                 eval $hasproto ;;
12491         *)      ;;
12492         esac
12493         case "$d_getpwnam_r_proto" in
12494         define)
12495         case "$getpwnam_r_proto" in
12496         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12497         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12498         esac
12499         case "$getpwnam_r_proto" in
12500         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12501         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12502         esac
12503         case "$getpwnam_r_proto" in
12504         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12505         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12506         esac
12507         case "$getpwnam_r_proto" in
12508         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12509         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12510         esac
12511         case "$getpwnam_r_proto" in
12512         ''|0)   d_getpwnam_r=undef
12513                 getpwnam_r_proto=0
12514                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12515         * )     case "$getpwnam_r_proto" in
12516                 REENTRANT_PROTO*) ;;
12517                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12518                 esac
12519                 echo "Prototype: $try" ;;
12520         esac
12521         ;;
12522         *)      case "$usethreads" in
12523                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12524                 esac
12525                 d_getpwnam_r=undef
12526                 getpwnam_r_proto=0
12527                 ;;
12528         esac
12529         ;;
12530 *)      getpwnam_r_proto=0
12531         ;;
12532 esac
12533
12534 : see if getpwuid_r exists
12535 set getpwuid_r d_getpwuid_r
12536 eval $inlibc
12537 case "$d_getpwuid_r" in
12538 "$define")
12539         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12540         case "$d_getpwuid_r_proto:$usethreads" in
12541         ":define")      d_getpwuid_r_proto=define
12542                 set d_getpwuid_r_proto getpwuid_r $hdrs
12543                 eval $hasproto ;;
12544         *)      ;;
12545         esac
12546         case "$d_getpwuid_r_proto" in
12547         define)
12548         case "$getpwuid_r_proto" in
12549         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12550         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12551         esac
12552         case "$getpwuid_r_proto" in
12553         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12554         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12555         esac
12556         case "$getpwuid_r_proto" in
12557         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12558         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12559         esac
12560         case "$getpwuid_r_proto" in
12561         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12562         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12563         esac
12564         case "$getpwuid_r_proto" in
12565         ''|0)   d_getpwuid_r=undef
12566                 getpwuid_r_proto=0
12567                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12568         * )     case "$getpwuid_r_proto" in
12569                 REENTRANT_PROTO*) ;;
12570                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12571                 esac
12572                 echo "Prototype: $try" ;;
12573         esac
12574         ;;
12575         *)      case "$usethreads" in
12576                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12577                 esac
12578                 d_getpwuid_r=undef
12579                 getpwuid_r_proto=0
12580                 ;;
12581         esac
12582         ;;
12583 *)      getpwuid_r_proto=0
12584         ;;
12585 esac
12586
12587
12588 : see if getservbyname exists
12589 set getservbyname d_getsbyname
12590 eval $inlibc
12591
12592 : see if getservbyport exists
12593 set getservbyport d_getsbyport
12594 eval $inlibc
12595
12596 : see if getservent exists
12597 set getservent d_getsent
12598 eval $inlibc
12599
12600 : see if getservbyname_r exists
12601 set getservbyname_r d_getservbyname_r
12602 eval $inlibc
12603 case "$d_getservbyname_r" in
12604 "$define")
12605         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12606         case "$d_getservbyname_r_proto:$usethreads" in
12607         ":define")      d_getservbyname_r_proto=define
12608                 set d_getservbyname_r_proto getservbyname_r $hdrs
12609                 eval $hasproto ;;
12610         *)      ;;
12611         esac
12612         case "$d_getservbyname_r_proto" in
12613         define)
12614         case "$getservbyname_r_proto" in
12615         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12616         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12617         esac
12618         case "$getservbyname_r_proto" in
12619         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12620         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12621         esac
12622         case "$getservbyname_r_proto" in
12623         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12624         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12625         esac
12626         case "$getservbyname_r_proto" in
12627         ''|0)   d_getservbyname_r=undef
12628                 getservbyname_r_proto=0
12629                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12630         * )     case "$getservbyname_r_proto" in
12631                 REENTRANT_PROTO*) ;;
12632                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12633                 esac
12634                 echo "Prototype: $try" ;;
12635         esac
12636         ;;
12637         *)      case "$usethreads" in
12638                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12639                 esac
12640                 d_getservbyname_r=undef
12641                 getservbyname_r_proto=0
12642                 ;;
12643         esac
12644         ;;
12645 *)      getservbyname_r_proto=0
12646         ;;
12647 esac
12648
12649 : see if getservbyport_r exists
12650 set getservbyport_r d_getservbyport_r
12651 eval $inlibc
12652 case "$d_getservbyport_r" in
12653 "$define")
12654         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12655         case "$d_getservbyport_r_proto:$usethreads" in
12656         ":define")      d_getservbyport_r_proto=define
12657                 set d_getservbyport_r_proto getservbyport_r $hdrs
12658                 eval $hasproto ;;
12659         *)      ;;
12660         esac
12661         case "$d_getservbyport_r_proto" in
12662         define)
12663         case "$getservbyport_r_proto" in
12664         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12665         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12666         esac
12667         case "$getservbyport_r_proto" in
12668         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12669         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12670         esac
12671         case "$getservbyport_r_proto" in
12672         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12673         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12674         esac
12675         case "$getservbyport_r_proto" in
12676         ''|0)   d_getservbyport_r=undef
12677                 getservbyport_r_proto=0
12678                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12679         * )     case "$getservbyport_r_proto" in
12680                 REENTRANT_PROTO*) ;;
12681                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12682                 esac
12683                 echo "Prototype: $try" ;;
12684         esac
12685         ;;
12686         *)      case "$usethreads" in
12687                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12688                 esac
12689                 d_getservbyport_r=undef
12690                 getservbyport_r_proto=0
12691                 ;;
12692         esac
12693         ;;
12694 *)      getservbyport_r_proto=0
12695         ;;
12696 esac
12697
12698 : see if getservent_r exists
12699 set getservent_r d_getservent_r
12700 eval $inlibc
12701 case "$d_getservent_r" in
12702 "$define")
12703         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12704         case "$d_getservent_r_proto:$usethreads" in
12705         ":define")      d_getservent_r_proto=define
12706                 set d_getservent_r_proto getservent_r $hdrs
12707                 eval $hasproto ;;
12708         *)      ;;
12709         esac
12710         case "$d_getservent_r_proto" in
12711         define)
12712         case "$getservent_r_proto" in
12713         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12714         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12715         esac
12716         case "$getservent_r_proto" in
12717         ''|0) try='int getservent_r(struct servent*, char*, int);'
12718         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12719         esac
12720         case "$getservent_r_proto" in
12721         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12722         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12723         esac
12724         case "$getservent_r_proto" in
12725         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12726         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12727         esac
12728         case "$getservent_r_proto" in
12729         ''|0)   d_getservent_r=undef
12730                 getservent_r_proto=0
12731                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12732         * )     case "$getservent_r_proto" in
12733                 REENTRANT_PROTO*) ;;
12734                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12735                 esac
12736                 echo "Prototype: $try" ;;
12737         esac
12738         ;;
12739         *)      case "$usethreads" in
12740                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12741                 esac
12742                 d_getservent_r=undef
12743                 getservent_r_proto=0
12744                 ;;
12745         esac
12746         ;;
12747 *)      getservent_r_proto=0
12748         ;;
12749 esac
12750
12751 : see if prototypes for various getservxxx netdb.h functions are available
12752 echo " "
12753 set d_getservprotos getservent $i_netdb netdb.h
12754 eval $hasproto
12755
12756 : see if getspnam exists
12757 set getspnam d_getspnam
12758 eval $inlibc
12759
12760 : see if this is a shadow.h system
12761 set shadow.h i_shadow
12762 eval $inhdr
12763
12764 : see if getspnam_r exists
12765 set getspnam_r d_getspnam_r
12766 eval $inlibc
12767 case "$d_getspnam_r" in
12768 "$define")
12769         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12770         case "$d_getspnam_r_proto:$usethreads" in
12771         ":define")      d_getspnam_r_proto=define
12772                 set d_getspnam_r_proto getspnam_r $hdrs
12773                 eval $hasproto ;;
12774         *)      ;;
12775         esac
12776         case "$d_getspnam_r_proto" in
12777         define)
12778         case "$getspnam_r_proto" in
12779         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12780         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12781         esac
12782         case "$getspnam_r_proto" in
12783         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12784         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12785         esac
12786         case "$getspnam_r_proto" in
12787         ''|0)   d_getspnam_r=undef
12788                 getspnam_r_proto=0
12789                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12790         * )     case "$getspnam_r_proto" in
12791                 REENTRANT_PROTO*) ;;
12792                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12793                 esac
12794                 echo "Prototype: $try" ;;
12795         esac
12796         ;;
12797         *)      case "$usethreads" in
12798                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12799                 esac
12800                 d_getspnam_r=undef
12801                 getspnam_r_proto=0
12802                 ;;
12803         esac
12804         ;;
12805 *)      getspnam_r_proto=0
12806         ;;
12807 esac
12808
12809 : see if gettimeofday or ftime exists
12810 set gettimeofday d_gettimeod
12811 eval $inlibc
12812 case "$d_gettimeod" in
12813 "$undef")
12814         set ftime d_ftime 
12815         eval $inlibc
12816         ;;
12817 *)
12818         val="$undef"; set d_ftime; eval $setvar
12819         ;;
12820 esac
12821 case "$d_gettimeod$d_ftime" in
12822 "$undef$undef")
12823         echo " "
12824         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12825         ;;
12826 esac
12827
12828 : see if gmtime_r exists
12829 set gmtime_r d_gmtime_r
12830 eval $inlibc
12831 case "$d_gmtime_r" in
12832 "$define")
12833         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12834         case "$d_gmtime_r_proto:$usethreads" in
12835         ":define")      d_gmtime_r_proto=define
12836                 set d_gmtime_r_proto gmtime_r $hdrs
12837                 eval $hasproto ;;
12838         *)      ;;
12839         esac
12840         case "$d_gmtime_r_proto" in
12841         define)
12842         case "$gmtime_r_proto" in
12843         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12844         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12845         esac
12846         case "$gmtime_r_proto" in
12847         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12848         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12849         esac
12850         case "$gmtime_r_proto" in
12851         ''|0)   d_gmtime_r=undef
12852                 gmtime_r_proto=0
12853                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12854         * )     case "$gmtime_r_proto" in
12855                 REENTRANT_PROTO*) ;;
12856                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12857                 esac
12858                 echo "Prototype: $try" ;;
12859         esac
12860         ;;
12861         *)      case "$usethreads" in
12862                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12863                 esac
12864                 d_gmtime_r=undef
12865                 gmtime_r_proto=0
12866                 ;;
12867         esac
12868         ;;
12869 *)      gmtime_r_proto=0
12870         ;;
12871 esac
12872
12873 : see if hasmntopt exists
12874 set hasmntopt d_hasmntopt
12875 eval $inlibc
12876
12877 : see if this is a netinet/in.h or sys/in.h system
12878 set netinet/in.h i_niin sys/in.h i_sysin
12879 eval $inhdr
12880
12881 : see if arpa/inet.h has to be included
12882 set arpa/inet.h i_arpainet
12883 eval $inhdr
12884
12885 : see if htonl --and friends-- exists
12886 val=''
12887 set htonl val
12888 eval $inlibc
12889
12890 : Maybe they are macros.
12891 case "$val" in
12892 $undef)
12893         $cat >htonl.c <<EOM
12894 #include <stdio.h>
12895 #include <sys/types.h>
12896 #$i_niin I_NETINET_IN
12897 #$i_sysin I_SYS_IN
12898 #$i_arpainet I_ARPA_INET
12899 #ifdef I_NETINET_IN
12900 #include <netinet/in.h>
12901 #endif
12902 #ifdef I_SYS_IN
12903 #include <sys/in.h>
12904 #endif
12905 #ifdef I_ARPA_INET
12906 #include <arpa/inet.h>
12907 #endif
12908 #ifdef htonl
12909 printf("Defined as a macro.");
12910 #endif
12911 EOM
12912         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12913         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12914                 val="$define"
12915                 echo "But it seems to be defined as a macro." >&4
12916         fi
12917         $rm -f htonl.?
12918         ;;
12919 esac
12920 set d_htonl
12921 eval $setvar
12922
12923 : index or strchr
12924 echo " "
12925 if set index val -f; eval $csym; $val; then
12926         if set strchr val -f d_strchr; eval $csym; $val; then
12927                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12928                         val="$define"
12929                         vali="$undef"
12930                         echo "strchr() found." >&4
12931                 else
12932                         val="$undef"
12933                         vali="$define"
12934                         echo "index() found." >&4
12935                 fi
12936         else
12937                 val="$undef"
12938                 vali="$define"
12939                 echo "index() found." >&4
12940         fi
12941 else
12942         if set strchr val -f d_strchr; eval $csym; $val; then
12943                 val="$define"
12944                 vali="$undef"
12945                 echo "strchr() found." >&4
12946         else
12947                 echo "No index() or strchr() found!" >&4
12948                 val="$undef"
12949                 vali="$undef"
12950         fi
12951 fi
12952 set d_strchr; eval $setvar
12953 val="$vali"
12954 set d_index; eval $setvar
12955
12956 : check whether inet_aton exists
12957 set inet_aton d_inetaton
12958 eval $inlibc
12959
12960 : Look for isascii
12961 echo " "
12962 $cat >isascii.c <<'EOCP'
12963 #include <stdio.h>
12964 #include <ctype.h>
12965 int main() {
12966         int c = 'A';
12967         if (isascii(c))
12968                 exit(0);
12969         else
12970                 exit(1);
12971 }
12972 EOCP
12973 set isascii
12974 if eval $compile; then
12975         echo "isascii() found." >&4
12976         val="$define"
12977 else
12978         echo "isascii() NOT found." >&4
12979         val="$undef"
12980 fi
12981 set d_isascii
12982 eval $setvar
12983 $rm -f isascii*
12984
12985 : see if isfinite exists
12986 set isfinite d_isfinite
12987 eval $inlibc
12988
12989 : see if isinf exists
12990 set isinf d_isinf
12991 eval $inlibc
12992
12993 : see if isnan exists
12994 set isnan d_isnan
12995 eval $inlibc
12996
12997 : see if isnanl exists
12998 set isnanl d_isnanl
12999 eval $inlibc
13000
13001 : see if killpg exists
13002 set killpg d_killpg
13003 eval $inlibc
13004
13005 : see if lchown exists
13006 echo " "
13007 $cat > try.c <<'EOCP'
13008 /* System header to define __stub macros and hopefully few prototypes,
13009     which can conflict with char lchown(); below.  */
13010 #include <assert.h>
13011 /* Override any gcc2 internal prototype to avoid an error.  */
13012 /* We use char because int might match the return type of a gcc2
13013    builtin and then its argument prototype would still apply.  */
13014 char lchown();
13015 int main() {
13016     /*  The GNU C library defines this for functions which it implements
13017         to always fail with ENOSYS.  Some functions are actually named
13018         something starting with __ and the normal name is an alias.  */
13019 #if defined (__stub_lchown) || defined (__stub___lchown)
13020 choke me
13021 #else
13022 lchown();
13023 #endif
13024 ; return 0; }
13025 EOCP
13026 set try
13027 if eval $compile; then
13028     $echo "lchown() found." >&4
13029     val="$define"
13030 else
13031     $echo "lchown() NOT found." >&4
13032     val="$undef"
13033 fi
13034 set d_lchown
13035 eval $setvar
13036
13037 : See if number of significant digits in a double precision number is known
13038 echo " "
13039 $cat >ldbl_dig.c <<EOM
13040 #$i_limits I_LIMITS
13041 #$i_float I_FLOAT
13042 #ifdef I_LIMITS
13043 #include <limits.h>
13044 #endif
13045 #ifdef I_FLOAT
13046 #include <float.h>
13047 #endif
13048 #ifdef LDBL_DIG
13049 printf("Contains LDBL_DIG");
13050 #endif
13051 EOM
13052 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13053 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13054         echo "LDBL_DIG found." >&4
13055         val="$define"
13056 else
13057         echo "LDBL_DIG NOT found." >&4
13058         val="$undef"
13059 fi
13060 $rm -f ldbl_dig.?
13061 set d_ldbl_dig
13062 eval $setvar
13063
13064 : see if link exists
13065 set link d_link
13066 eval $inlibc
13067
13068 : see if localtime_r exists
13069 set localtime_r d_localtime_r
13070 eval $inlibc
13071 case "$d_localtime_r" in
13072 "$define")
13073         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13074         case "$d_localtime_r_proto:$usethreads" in
13075         ":define")      d_localtime_r_proto=define
13076                 set d_localtime_r_proto localtime_r $hdrs
13077                 eval $hasproto ;;
13078         *)      ;;
13079         esac
13080         case "$d_localtime_r_proto" in
13081         define)
13082         case "$localtime_r_proto" in
13083         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13084         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13085         esac
13086         case "$localtime_r_proto" in
13087         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13088         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13089         esac
13090         case "$localtime_r_proto" in
13091         ''|0)   d_localtime_r=undef
13092                 localtime_r_proto=0
13093                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13094         * )     case "$localtime_r_proto" in
13095                 REENTRANT_PROTO*) ;;
13096                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13097                 esac
13098                 echo "Prototype: $try" ;;
13099         esac
13100         ;;
13101         *)      case "$usethreads" in
13102                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13103                 esac
13104                 d_localtime_r=undef
13105                 localtime_r_proto=0
13106                 ;;
13107         esac
13108         ;;
13109 *)      localtime_r_proto=0
13110         ;;
13111 esac
13112
13113 : see if localeconv exists
13114 set localeconv d_locconv
13115 eval $inlibc
13116
13117 : see if lockf exists
13118 set lockf d_lockf
13119 eval $inlibc
13120
13121 : see if prototype for lseek is available
13122 echo " "
13123 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13124 eval $hasproto
13125
13126 : see if lstat exists
13127 set lstat d_lstat
13128 eval $inlibc
13129
13130 : see if madvise exists
13131 set madvise d_madvise
13132 eval $inlibc
13133
13134 : see if mblen exists
13135 set mblen d_mblen
13136 eval $inlibc
13137
13138 : see if mbstowcs exists
13139 set mbstowcs d_mbstowcs
13140 eval $inlibc
13141
13142 : see if mbtowc exists
13143 set mbtowc d_mbtowc
13144 eval $inlibc
13145
13146 : see if memchr exists
13147 set memchr d_memchr
13148 eval $inlibc
13149
13150 : see if memcmp exists
13151 set memcmp d_memcmp
13152 eval $inlibc
13153
13154 : see if memcpy exists
13155 set memcpy d_memcpy
13156 eval $inlibc
13157
13158 : see if memmove exists
13159 set memmove d_memmove
13160 eval $inlibc
13161
13162 : see if memset exists
13163 set memset d_memset
13164 eval $inlibc
13165
13166 : see if mkdir exists
13167 set mkdir d_mkdir
13168 eval $inlibc
13169
13170 : see if mkdtemp exists
13171 set mkdtemp d_mkdtemp
13172 eval $inlibc
13173
13174 : see if mkfifo exists
13175 set mkfifo d_mkfifo
13176 eval $inlibc
13177
13178 : see if mkstemp exists
13179 set mkstemp d_mkstemp
13180 eval $inlibc
13181
13182 : see if mkstemps exists
13183 set mkstemps d_mkstemps
13184 eval $inlibc
13185
13186 : see if mktime exists
13187 set mktime d_mktime
13188 eval $inlibc
13189
13190 : see if this is a sys/mman.h system
13191 set sys/mman.h i_sysmman
13192 eval $inhdr
13193
13194 : see if mmap exists
13195 set mmap d_mmap
13196 eval $inlibc
13197 : see what shmat returns
13198 : default to something harmless
13199 mmaptype='void *'
13200 case "$i_sysmman$d_mmap" in
13201 "$define$define")
13202         $cat >mmap.c <<'END'
13203 #include <sys/mman.h>
13204 void *mmap();
13205 END
13206         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13207                 mmaptype='void *'
13208         else
13209                 mmaptype='caddr_t'
13210         fi
13211         echo "and it returns ($mmaptype)." >&4
13212         ;;
13213 esac
13214
13215
13216
13217 : see if mprotect exists
13218 set mprotect d_mprotect
13219 eval $inlibc
13220
13221 : see if msgctl exists
13222 set msgctl d_msgctl
13223 eval $inlibc
13224
13225 : see if msgget exists
13226 set msgget d_msgget
13227 eval $inlibc
13228
13229 : see if msgsnd exists
13230 set msgsnd d_msgsnd
13231 eval $inlibc
13232
13233 : see if msgrcv exists
13234 set msgrcv d_msgrcv
13235 eval $inlibc
13236
13237 : see how much of the 'msg*(2)' library is present.
13238 h_msg=true
13239 echo " "
13240 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13241 *"$undef"*) h_msg=false;;
13242 esac
13243 case "$osname" in
13244 freebsd)
13245     case "`ipcs 2>&1`" in
13246     "SVID messages"*"not configured"*)
13247         echo "Your $osname does not have the msg*(2) configured." >&4
13248         h_msg=false
13249         val="$undef"
13250         set msgctl d_msgctl
13251         eval $setvar
13252         set msgget d_msgget
13253         eval $setvar
13254         set msgsnd d_msgsnd
13255         eval $setvar
13256         set msgrcv d_msgrcv
13257         eval $setvar
13258         ;;
13259     esac
13260     ;;
13261 esac
13262 : we could also check for sys/ipc.h ...
13263 if $h_msg && $test `./findhdr sys/msg.h`; then
13264         echo "You have the full msg*(2) library." >&4
13265         val="$define"
13266 else
13267         echo "You don't have the full msg*(2) library." >&4
13268         val="$undef"
13269 fi
13270 set d_msg
13271 eval $setvar
13272
13273
13274 echo " "
13275 echo "Checking to see if your system supports struct msghdr..." >&4
13276 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13277 eval $hasstruct
13278 case "$d_msghdr_s" in
13279 "$define")      echo "Yes, it does."   ;;
13280 *)              echo "No, it doesn't." ;;
13281 esac
13282
13283
13284 : see if msync exists
13285 set msync d_msync
13286 eval $inlibc
13287
13288 : see if munmap exists
13289 set munmap d_munmap
13290 eval $inlibc
13291
13292 : see if nice exists
13293 set nice d_nice
13294 eval $inlibc
13295
13296 : see if this is a langinfo.h system
13297 set langinfo.h i_langinfo
13298 eval $inhdr
13299
13300 : see if nl_langinfo exists
13301 set nl_langinfo d_nl_langinfo
13302 eval $inlibc
13303
13304 : check for length of character
13305 echo " "
13306 case "$charsize" in
13307 '')
13308         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13309         $cat >try.c <<'EOCP'
13310 #include <stdio.h>
13311 int main()
13312 {
13313     printf("%d\n", (int)sizeof(char));
13314     exit(0);
13315 }
13316 EOCP
13317         set try
13318         if eval $compile_ok; then
13319                 dflt=`$run ./try`
13320         else
13321                 dflt='1'
13322                 echo "(I can't seem to compile the test program.  Guessing...)"
13323         fi
13324         ;;
13325 *)
13326         dflt="$charsize"
13327         ;;
13328 esac
13329 rp="What is the size of a character (in bytes)?"
13330 . ./myread
13331 charsize="$ans"
13332 $rm -f try.c try
13333
13334 : check for volatile keyword
13335 echo " "
13336 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13337 $cat >try.c <<'EOCP'
13338 int main()
13339 {
13340         typedef struct _goo_struct goo_struct;
13341         goo_struct * volatile goo = ((goo_struct *)0);
13342         struct _goo_struct {
13343                 long long_int;
13344                 int reg_int;
13345                 char char_var;
13346         };
13347         typedef unsigned short foo_t;
13348         char *volatile foo;
13349         volatile int bar;
13350         volatile foo_t blech;
13351         foo = foo;
13352 }
13353 EOCP
13354 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13355         val="$define"
13356         echo "Yup, it does."
13357 else
13358         val="$undef"
13359         echo "Nope, it doesn't."
13360 fi
13361 set d_volatile
13362 eval $setvar
13363 $rm -f try.*
13364
13365
13366 echo " "
13367 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13368
13369 case "$use64bitint:$d_quad:$quadtype" in
13370 define:define:?*)
13371         ivtype="$quadtype"
13372         uvtype="$uquadtype"
13373         ivsize=8
13374         uvsize=8
13375         ;;
13376 *)      ivtype="long"
13377         uvtype="unsigned long"
13378         ivsize=$longsize
13379         uvsize=$longsize
13380         ;;
13381 esac
13382
13383 case "$uselongdouble:$d_longdbl" in
13384 define:define)
13385         nvtype="long double"
13386         nvsize=$longdblsize
13387         ;;
13388 *)      nvtype=double
13389         nvsize=$doublesize
13390         ;;
13391 esac
13392
13393 $echo "(IV will be "$ivtype", $ivsize bytes)"
13394 $echo "(UV will be "$uvtype", $uvsize bytes)"
13395 $echo "(NV will be "$nvtype", $nvsize bytes)"
13396
13397 $cat >try.c <<EOCP
13398 #$i_inttypes I_INTTYPES
13399 #ifdef I_INTTYPES
13400 #include <inttypes.h>
13401 #endif
13402 #include <stdio.h>
13403 int main() {
13404 #ifdef INT8
13405    int8_t i =  INT8_MAX;
13406   uint8_t u = UINT8_MAX;
13407   printf("int8_t\n");
13408 #endif
13409 #ifdef INT16
13410    int16_t i =  INT16_MAX;
13411   uint16_t i = UINT16_MAX;
13412   printf("int16_t\n");
13413 #endif
13414 #ifdef INT32
13415    int32_t i =  INT32_MAX;
13416   uint32_t u = UINT32_MAX;
13417   printf("int32_t\n");
13418 #endif
13419 }
13420 EOCP
13421
13422 case "$i8type" in
13423 '')     case "$charsize" in
13424         1)      i8type=char
13425                 u8type="unsigned char"
13426                 i8size=$charsize
13427                 u8size=$charsize
13428                 ;;
13429         esac
13430         ;;
13431 esac
13432 case "$i8type" in
13433 '')     set try -DINT8
13434         if eval $compile; then
13435                 case "`$run ./try`" in
13436                 int8_t) i8type=int8_t
13437                         u8type=uint8_t
13438                         i8size=1
13439                         u8size=1
13440                         ;;
13441                 esac
13442         fi
13443         ;;
13444 esac
13445 case "$i8type" in
13446 '')     if $test $charsize -ge 1; then
13447                 i8type=char
13448                 u8type="unsigned char"
13449                 i8size=$charsize
13450                 u8size=$charsize
13451         fi
13452         ;;
13453 esac
13454
13455 case "$i16type" in
13456 '')     case "$shortsize" in
13457         2)      i16type=short
13458                 u16type="unsigned short"
13459                 i16size=$shortsize
13460                 u16size=$shortsize
13461                 ;;
13462         esac
13463         ;;
13464 esac
13465 case "$i16type" in
13466 '')     set try -DINT16
13467         if eval $compile; then
13468                 case "`$run ./try`" in
13469                 int16_t)
13470                         i16type=int16_t
13471                         u16type=uint16_t
13472                         i16size=2
13473                         u16size=2
13474                         ;;
13475                 esac
13476         fi
13477         ;;
13478 esac
13479 case "$i16type" in
13480 '')     if $test $shortsize -ge 2; then
13481                 i16type=short
13482                 u16type="unsigned short"
13483                 i16size=$shortsize
13484                 u16size=$shortsize
13485         fi
13486         ;;
13487 esac
13488
13489 case "$i32type" in
13490 '')     case "$longsize" in
13491         4)      i32type=long
13492                 u32type="unsigned long"
13493                 i32size=$longsize
13494                 u32size=$longsize
13495                 ;;
13496         *)      case "$intsize" in
13497                 4)      i32type=int
13498                         u32type="unsigned int"
13499                         i32size=$intsize
13500                         u32size=$intsize
13501                         ;;
13502                 esac
13503                 ;;
13504         esac
13505         ;;
13506 esac
13507 case "$i32type" in
13508 '')     set try -DINT32
13509         if eval $compile; then
13510                 case "`$run ./try`" in
13511                 int32_t)
13512                         i32type=int32_t
13513                         u32type=uint32_t
13514                         i32size=4
13515                         u32size=4
13516                         ;;
13517                 esac
13518         fi
13519         ;;
13520 esac
13521 case "$i32type" in
13522 '')     if $test $intsize -ge 4; then
13523                 i32type=int
13524                 u32type="unsigned int"
13525                 i32size=$intsize
13526                 u32size=$intsize
13527         fi
13528         ;;
13529 esac
13530
13531 case "$i64type" in
13532 '')     case "$d_quad:$quadtype" in
13533         define:?*)
13534                 i64type="$quadtype"
13535                 u64type="$uquadtype"
13536                 i64size=8
13537                 u64size=8
13538                 ;;
13539         esac
13540         ;;
13541 esac
13542
13543 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13544 : volatile so that the compiler has to store it out to memory.
13545 if test X"$d_volatile" = X"$define"; then
13546         volatile=volatile
13547 fi
13548 $cat <<EOP >try.c
13549 #include <stdio.h>
13550 #include <sys/types.h>
13551 #include <signal.h>
13552 #ifdef SIGFPE
13553 $volatile int bletched = 0;
13554 $signal_t blech(s) int s; { bletched = 1; }
13555 #endif
13556 int main() {
13557     $uvtype u = 0;
13558     $nvtype d;
13559     int     n = 8 * $uvsize;
13560     int     i;
13561 #ifdef SIGFPE
13562     signal(SIGFPE, blech);
13563 #endif
13564
13565     for (i = 0; i < n; i++) {
13566       u = u << 1 | ($uvtype)1;
13567       d = ($nvtype)u;
13568       if (($uvtype)d != u)
13569         break;
13570       if (d <= 0)
13571         break;
13572       d = ($nvtype)(u - 1);
13573       if (($uvtype)d != (u - 1))
13574         break;
13575 #ifdef SIGFPE
13576       if (bletched) {
13577         break;
13578 #endif
13579       } 
13580     }
13581     printf("%d\n", ((i == n) ? -n : i));
13582     exit(0);
13583 }
13584 EOP
13585 set try
13586
13587 d_nv_preserves_uv="$undef"
13588 if eval $compile; then
13589         nv_preserves_uv_bits="`$run ./try`"
13590 fi
13591 case "$nv_preserves_uv_bits" in
13592 \-[1-9]*)       
13593         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13594         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13595         d_nv_preserves_uv="$define"
13596         ;;
13597 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13598         d_nv_preserves_uv="$undef" ;;
13599 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13600         nv_preserves_uv_bits="$undef" ;;
13601 esac
13602
13603 $rm -f try.* try
13604
13605
13606 : check for off64_t
13607 echo " "
13608 echo "Checking to see if you have off64_t..." >&4
13609 $cat >try.c <<EOCP
13610 #include <sys/types.h>
13611 #include <unistd.h>
13612 int main() { off64_t x = 7; }
13613 EOCP
13614 set try
13615 if eval $compile; then
13616         val="$define"
13617         echo "You have off64_t."
13618 else
13619         val="$undef"
13620         echo "You do not have off64_t."
13621         case "$lseeksize" in
13622         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13623         esac
13624 fi
13625 $rm -f try.* try
13626 set d_off64_t
13627 eval $setvar
13628
13629 : how to create joinable pthreads
13630 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13631         echo " "
13632         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13633         $cat >try.c <<'EOCP'
13634 #include <pthread.h>
13635 int main() {
13636     int detachstate = JOINABLE;
13637 }
13638 EOCP
13639         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13640         if eval $compile; then
13641                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13642                 val="$undef" # Yes, undef.
13643                 set d_old_pthread_create_joinable
13644                 eval $setvar
13645                 val=""
13646                 set old_pthread_create_joinable
13647                 eval $setvar
13648         else
13649                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13650                 if eval $compile; then
13651                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13652                         val="$define"
13653                         set d_old_pthread_create_joinable
13654                         eval $setvar
13655                         val=PTHREAD_CREATE_UNDETACHED
13656                         set old_pthread_create_joinable
13657                         eval $setvar
13658                 else            
13659                         set try -DJOINABLE=__UNDETACHED
13660                         if eval $compile; then
13661                                 echo "You seem to use __UNDETACHED." >&4
13662                                 val="$define"
13663                                 set d_old_pthread_create_joinable
13664                                 eval $setvar
13665                                 val=__UNDETACHED
13666                                 set old_pthread_create_joinable
13667                                 eval $setvar
13668                         else
13669                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13670                                 val="$define"
13671                                 set d_old_pthread_create_joinable
13672                                 eval $setvar
13673                                 val=0
13674                                 set old_pthread_create_joinable
13675                                 eval $setvar
13676                         fi
13677                 fi
13678         fi
13679         $rm -f try try.*
13680 else
13681     d_old_pthread_create_joinable="$undef"
13682     old_pthread_create_joinable=""
13683 fi
13684
13685 : see if pause exists
13686 set pause d_pause
13687 eval $inlibc
13688
13689 : see if pipe exists
13690 set pipe d_pipe
13691 eval $inlibc
13692
13693 : see if poll exists
13694 set poll d_poll
13695 eval $inlibc
13696
13697 : see if readlink exists
13698 set readlink d_readlink
13699 eval $inlibc
13700
13701 echo " "
13702 procselfexe=''
13703 val="$undef"
13704 case "$d_readlink" in
13705 "$define")
13706         if $issymlink /proc/self/exe ; then
13707                 $ls -l /proc/self/exe > reflect
13708                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13709                         echo "You have Linux-like /proc/self/exe."
13710                         procselfexe='"/proc/self/exe"'
13711                         val="$define"
13712                 fi
13713         fi
13714         if $issymlink /proc/curproc/file ; then
13715                 $ls -l /proc/curproc/file > reflect
13716                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13717                         echo "You have BSD-like /proc/curproc/file."
13718                         procselfexe='"/proc/curproc/file"'
13719                         val="$define"
13720                 fi
13721         fi
13722         ;;
13723 esac
13724 $rm -f reflect
13725 set d_procselfexe
13726 eval $setvar
13727
13728 : see whether the pthread_atfork exists
13729 $cat >try.c <<EOP
13730 #include <pthread.h>
13731 #include <stdio.h>
13732 int main() {
13733 #ifdef  PTHREAD_ATFORK
13734         pthread_atfork(NULL,NULL,NULL);
13735 #endif
13736 }
13737 EOP
13738
13739 : see if pthread_atfork exists
13740 set try -DPTHREAD_ATFORK
13741 if eval $compile; then
13742     val="$define"
13743 else
13744     val="$undef"
13745 fi
13746 case "$usethreads" in
13747 $define)
13748         case "$val" in
13749         $define) echo 'pthread_atfork found.' >&4        ;;
13750         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13751         esac
13752 esac
13753 set d_pthread_atfork
13754 eval $setvar
13755
13756
13757 : see whether the various POSIXish _yields exist
13758 $cat >try.c <<EOP
13759 #include <pthread.h>
13760 #include <stdio.h>
13761 int main() {
13762 #ifdef SCHED_YIELD
13763         sched_yield();
13764 #else
13765 #ifdef PTHREAD_YIELD
13766         pthread_yield();
13767 #else
13768 #ifdef PTHREAD_YIELD_NULL
13769         pthread_yield(NULL);
13770 #endif
13771 #endif
13772 #endif
13773 }
13774 EOP
13775 : see if sched_yield exists
13776 set try -DSCHED_YIELD
13777 if eval $compile; then
13778     val="$define"
13779     sched_yield='sched_yield()'
13780 else
13781     val="$undef"
13782 fi
13783 case "$usethreads" in
13784 $define)
13785         case "$val" in
13786         $define) echo 'sched_yield() found.' >&4        ;;
13787         *)       echo 'sched_yield() NOT found.' >&4    ;;
13788         esac
13789 esac
13790 set d_sched_yield
13791 eval $setvar
13792
13793 : see if pthread_yield exists
13794 set try -DPTHREAD_YIELD
13795 if eval $compile; then
13796     val="$define"
13797     case "$sched_yield" in
13798     '') sched_yield='pthread_yield()' ;;
13799     esac
13800 else
13801     set try -DPTHREAD_YIELD_NULL
13802     if eval $compile; then
13803         val="$define"
13804         case "$sched_yield" in
13805         '') sched_yield='pthread_yield(NULL)' ;;
13806         esac
13807     else
13808         val="$undef"
13809     fi
13810 fi
13811 case "$usethreads" in
13812 $define)
13813         case "$val" in
13814         $define) echo 'pthread_yield() found.' >&4      ;;
13815         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13816         esac
13817         ;;
13818 esac
13819 set d_pthread_yield
13820 eval $setvar
13821
13822 case "$sched_yield" in
13823 '') sched_yield=undef ;;
13824 esac
13825
13826 $rm -f try try.*
13827
13828 : see if random_r exists
13829 set random_r d_random_r
13830 eval $inlibc
13831 case "$d_random_r" in
13832 "$define")
13833         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13834         case "$d_random_r_proto:$usethreads" in
13835         ":define")      d_random_r_proto=define
13836                 set d_random_r_proto random_r $hdrs
13837                 eval $hasproto ;;
13838         *)      ;;
13839         esac
13840         case "$d_random_r_proto" in
13841         define)
13842         case "$random_r_proto" in
13843         ''|0) try='int random_r(int*, struct random_data*);'
13844         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13845         esac
13846         case "$random_r_proto" in
13847         ''|0)   d_random_r=undef
13848                 random_r_proto=0
13849                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13850         * )     case "$random_r_proto" in
13851                 REENTRANT_PROTO*) ;;
13852                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13853                 esac
13854                 echo "Prototype: $try" ;;
13855         esac
13856         ;;
13857         *)      case "$usethreads" in
13858                 define) echo "random_r has no prototype, not using it." >&4 ;;
13859                 esac
13860                 d_random_r=undef
13861                 random_r_proto=0
13862                 ;;
13863         esac
13864         ;;
13865 *)      random_r_proto=0
13866         ;;
13867 esac
13868
13869 : see if readdir and friends exist
13870 set readdir d_readdir
13871 eval $inlibc
13872 set seekdir d_seekdir
13873 eval $inlibc
13874 set telldir d_telldir
13875 eval $inlibc
13876 set rewinddir d_rewinddir
13877 eval $inlibc
13878
13879 : see if readdir64_r exists
13880 set readdir64_r d_readdir64_r
13881 eval $inlibc
13882 case "$d_readdir64_r" in
13883 "$define")
13884         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13885         case "$d_readdir64_r_proto:$usethreads" in
13886         ":define")      d_readdir64_r_proto=define
13887                 set d_readdir64_r_proto readdir64_r $hdrs
13888                 eval $hasproto ;;
13889         *)      ;;
13890         esac
13891         case "$d_readdir64_r_proto" in
13892         define)
13893         case "$readdir64_r_proto" in
13894         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13895         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13896         esac
13897         case "$readdir64_r_proto" in
13898         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13899         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13900         esac
13901         case "$readdir64_r_proto" in
13902         ''|0)   d_readdir64_r=undef
13903                 readdir64_r_proto=0
13904                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13905         * )     case "$readdir64_r_proto" in
13906                 REENTRANT_PROTO*) ;;
13907                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13908                 esac
13909                 echo "Prototype: $try" ;;
13910         esac
13911         ;;
13912         *)      case "$usethreads" in
13913                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13914                 esac
13915                 d_readdir64_r=undef
13916                 readdir64_r_proto=0
13917                 ;;
13918         esac
13919         ;;
13920 *)      readdir64_r_proto=0
13921         ;;
13922 esac
13923
13924 : see if readdir_r exists
13925 set readdir_r d_readdir_r
13926 eval $inlibc
13927 case "$d_readdir_r" in
13928 "$define")
13929         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13930         case "$d_readdir_r_proto:$usethreads" in
13931         ":define")      d_readdir_r_proto=define
13932                 set d_readdir_r_proto readdir_r $hdrs
13933                 eval $hasproto ;;
13934         *)      ;;
13935         esac
13936         case "$d_readdir_r_proto" in
13937         define)
13938         case "$readdir_r_proto" in
13939         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13940         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13941         esac
13942         case "$readdir_r_proto" in
13943         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13944         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13945         esac
13946         case "$readdir_r_proto" in
13947         ''|0)   d_readdir_r=undef
13948                 readdir_r_proto=0
13949                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13950         * )     case "$readdir_r_proto" in
13951                 REENTRANT_PROTO*) ;;
13952                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13953                 esac
13954                 echo "Prototype: $try" ;;
13955         esac
13956         ;;
13957         *)      case "$usethreads" in
13958                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13959                 esac
13960                 d_readdir_r=undef
13961                 readdir_r_proto=0
13962                 ;;
13963         esac
13964         ;;
13965 *)      readdir_r_proto=0
13966         ;;
13967 esac
13968
13969 : see if readv exists
13970 set readv d_readv
13971 eval $inlibc
13972
13973 : see if recvmsg exists
13974 set recvmsg d_recvmsg
13975 eval $inlibc
13976
13977 : see if rename exists
13978 set rename d_rename
13979 eval $inlibc
13980
13981 : see if rmdir exists
13982 set rmdir d_rmdir
13983 eval $inlibc
13984
13985 : see if memory.h is available.
13986 val=''
13987 set memory.h val
13988 eval $inhdr
13989
13990 : See if it conflicts with string.h
13991 case "$val" in
13992 $define)
13993         case "$strings" in
13994         '') ;;
13995         *)
13996                 $cppstdin $cppflags $cppminus < $strings > mem.h
13997                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13998                         echo " "
13999                         echo "We won't be including <memory.h>."
14000                         val="$undef"
14001                 fi
14002                 $rm -f mem.h
14003                 ;;
14004         esac
14005 esac
14006 set i_memory
14007 eval $setvar
14008
14009 : can bcopy handle overlapping blocks?
14010 echo " "
14011 val="$undef"
14012 case "$d_memmove" in
14013 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14014 *)      case "$d_bcopy" in
14015         "$define")
14016                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14017                 $cat >try.c <<EOCP
14018 #$i_memory I_MEMORY
14019 #$i_stdlib I_STDLIB
14020 #$i_string I_STRING
14021 #$i_unistd I_UNISTD
14022 EOCP
14023         $cat >>try.c <<'EOCP'
14024 #include <stdio.h>
14025 #ifdef I_MEMORY
14026 #  include <memory.h>
14027 #endif
14028 #ifdef I_STDLIB
14029 #  include <stdlib.h>
14030 #endif
14031 #ifdef I_STRING
14032 #  include <string.h>
14033 #else
14034 #  include <strings.h>
14035 #endif
14036 #ifdef I_UNISTD
14037 #  include <unistd.h>  /* Needed for NetBSD */
14038 #endif
14039 int main()
14040 {
14041 char buf[128], abc[128];
14042 char *b;
14043 int len;
14044 int off;
14045 int align;
14046
14047 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14048    try to store the string in read-only memory. */
14049 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14050
14051 for (align = 7; align >= 0; align--) {
14052         for (len = 36; len; len--) {
14053                 b = buf+align;
14054                 bcopy(abc, b, len);
14055                 for (off = 1; off <= len; off++) {
14056                         bcopy(b, b+off, len);
14057                         bcopy(b+off, b, len);
14058                         if (bcmp(b, abc, len))
14059                                 exit(1);
14060                 }
14061         }
14062 }
14063 exit(0);
14064 }
14065 EOCP
14066                 set try
14067                 if eval $compile_ok; then
14068                         if ./try 2>/dev/null; then
14069                                 echo "Yes, it can."
14070                                 val="$define"
14071                         else
14072                                 echo "It can't, sorry."
14073                         fi
14074                 else
14075                         echo "(I can't compile the test program, so we'll assume not...)"
14076                 fi
14077                 ;;
14078         esac
14079         $rm -f try.* try core
14080         ;;
14081 esac
14082 set d_safebcpy
14083 eval $setvar
14084
14085 : can memcpy handle overlapping blocks?
14086 echo " "
14087 val="$undef"
14088 case "$d_memmove" in
14089 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14090 *)      case "$d_memcpy" in
14091         "$define")
14092                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14093                 $cat >try.c <<EOCP
14094 #$i_memory I_MEMORY
14095 #$i_stdlib I_STDLIB
14096 #$i_string I_STRING
14097 #$i_unistd I_UNISTD
14098 EOCP
14099         $cat >>try.c <<'EOCP'
14100 #include <stdio.h>
14101 #ifdef I_MEMORY
14102 #  include <memory.h>
14103 #endif
14104 #ifdef I_STDLIB
14105 #  include <stdlib.h>
14106 #endif
14107 #ifdef I_STRING
14108 #  include <string.h>
14109 #else
14110 #  include <strings.h>
14111 #endif
14112 #ifdef I_UNISTD
14113 #  include <unistd.h>  /* Needed for NetBSD */
14114 #endif
14115 int main()
14116 {
14117 char buf[128], abc[128];
14118 char *b;
14119 int len;
14120 int off;
14121 int align;
14122
14123 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14124    try to store the string in read-only memory. */
14125 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14126
14127 for (align = 7; align >= 0; align--) {
14128         for (len = 36; len; len--) {
14129                 b = buf+align;
14130                 memcpy(b, abc, len);
14131                 for (off = 1; off <= len; off++) {
14132                         memcpy(b+off, b, len);
14133                         memcpy(b, b+off, len);
14134                         if (memcmp(b, abc, len))
14135                                 exit(1);
14136                 }
14137         }
14138 }
14139 exit(0);
14140 }
14141 EOCP
14142                 set try
14143                 if eval $compile_ok; then
14144                         if ./try 2>/dev/null; then
14145                                 echo "Yes, it can."
14146                                 val="$define"
14147                         else
14148                                 echo "It can't, sorry."
14149                         fi
14150                 else
14151                         echo "(I can't compile the test program, so we'll assume not...)"
14152                 fi
14153                 ;;
14154         esac
14155         $rm -f try.* try core
14156         ;;
14157 esac
14158 set d_safemcpy
14159 eval $setvar
14160
14161 : can memcmp be trusted to compare relative magnitude?
14162 val="$undef"
14163 case "$d_memcmp" in
14164 "$define")
14165         echo " "
14166         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14167         $cat >try.c <<EOCP
14168 #$i_memory I_MEMORY
14169 #$i_stdlib I_STDLIB
14170 #$i_string I_STRING
14171 #$i_unistd I_UNISTD
14172 EOCP
14173         $cat >>try.c <<'EOCP'
14174 #include <stdio.h>
14175 #ifdef I_MEMORY
14176 #  include <memory.h>
14177 #endif
14178 #ifdef I_STDLIB
14179 #  include <stdlib.h>
14180 #endif
14181 #ifdef I_STRING
14182 #  include <string.h>
14183 #else
14184 #  include <strings.h>
14185 #endif
14186 #ifdef I_UNISTD
14187 #  include <unistd.h>  /* Needed for NetBSD */
14188 #endif
14189 int main()
14190 {
14191 char a = -1;
14192 char b = 0;
14193 if ((a < b) && memcmp(&a, &b, 1) < 0)
14194         exit(1);
14195 exit(0);
14196 }
14197 EOCP
14198         set try
14199         if eval $compile_ok; then
14200                 if $run ./try 2>/dev/null; then
14201                         echo "Yes, it can."
14202                         val="$define"
14203                 else
14204                         echo "No, it can't (it uses signed chars)."
14205                 fi
14206         else
14207                 echo "(I can't compile the test program, so we'll assume not...)"
14208         fi
14209         ;;
14210 esac
14211 $rm -f try.* try core
14212 set d_sanemcmp
14213 eval $setvar
14214
14215 : see if prototype for sbrk is available
14216 echo " "
14217 set d_sbrkproto sbrk $i_unistd unistd.h
14218 eval $hasproto
14219
14220 : see if select exists
14221 set select d_select
14222 eval $inlibc
14223
14224 : see if semctl exists
14225 set semctl d_semctl
14226 eval $inlibc
14227
14228 : see if semget exists
14229 set semget d_semget
14230 eval $inlibc
14231
14232 : see if semop exists
14233 set semop d_semop
14234 eval $inlibc
14235
14236 : see how much of the 'sem*(2)' library is present.
14237 h_sem=true
14238 echo " "
14239 case "$d_semctl$d_semget$d_semop" in
14240 *"$undef"*) h_sem=false;;
14241 esac
14242 case "$osname" in
14243 freebsd)
14244     case "`ipcs 2>&1`" in
14245     "SVID messages"*"not configured"*)
14246         echo "Your $osname does not have the sem*(2) configured." >&4
14247         h_sem=false
14248         val="$undef"
14249         set semctl d_semctl
14250         eval $setvar
14251         set semget d_semget
14252         eval $setvar
14253         set semop d_semop
14254         eval $setvar
14255         ;;
14256     esac
14257     ;;
14258 esac
14259 : we could also check for sys/ipc.h ...
14260 if $h_sem && $test `./findhdr sys/sem.h`; then
14261         echo "You have the full sem*(2) library." >&4
14262         val="$define"
14263 else
14264         echo "You don't have the full sem*(2) library." >&4
14265         val="$undef"
14266 fi
14267 set d_sem
14268 eval $setvar
14269
14270 : see whether sys/sem.h defines union semun
14271 echo " "
14272 $cat > try.c <<'END'
14273 #include <sys/types.h>
14274 #include <sys/ipc.h>
14275 #include <sys/sem.h>
14276 int main () { union semun semun; semun.buf = 0; }
14277 END
14278 set try
14279 if eval $compile; then
14280     echo "You have union semun in <sys/sem.h>." >&4
14281     val="$define"
14282 else
14283     echo "You do not have union semun in <sys/sem.h>." >&4
14284     val="$undef"
14285 fi
14286 $rm -f try try.c try.h
14287 set d_union_semun
14288 eval $setvar
14289
14290 : see how to do semctl IPC_STAT
14291 case "$d_sem" in
14292 $define)
14293     : see whether semctl IPC_STAT can use union semun
14294     echo " "
14295     $cat > try.h <<END
14296 #ifndef S_IRUSR
14297 #   ifdef S_IREAD
14298 #       define S_IRUSR S_IREAD
14299 #       define S_IWUSR S_IWRITE
14300 #       define S_IXUSR S_IEXEC
14301 #   else
14302 #       define S_IRUSR 0400
14303 #       define S_IWUSR 0200
14304 #       define S_IXUSR 0100
14305 #   endif
14306 #   define S_IRGRP (S_IRUSR>>3)
14307 #   define S_IWGRP (S_IWUSR>>3)
14308 #   define S_IXGRP (S_IXUSR>>3)
14309 #   define S_IROTH (S_IRUSR>>6)
14310 #   define S_IWOTH (S_IWUSR>>6)
14311 #   define S_IXOTH (S_IXUSR>>6)
14312 #endif
14313 #ifndef S_IRWXU
14314 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14315 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14316 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14317 #endif
14318 END
14319
14320     $cat > try.c <<END
14321 #include <sys/types.h>
14322 #include <sys/ipc.h>
14323 #include <sys/sem.h>
14324 #include <sys/stat.h>
14325 #include <stdio.h>
14326 #include <errno.h>
14327 #include "try.h"
14328 #ifndef errno
14329 extern int errno;
14330 #endif
14331 #$d_union_semun HAS_UNION_SEMUN
14332 int main() {
14333     union semun
14334 #ifndef HAS_UNION_SEMUN
14335     {
14336         int val;
14337         struct semid_ds *buf;
14338         unsigned short *array;
14339     }
14340 #endif
14341     arg;
14342     int sem, st;
14343
14344 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14345     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14346     if (sem > -1) {
14347         struct semid_ds argbuf;
14348         arg.buf = &argbuf;
14349 #       ifdef IPC_STAT
14350         st = semctl(sem, 0, IPC_STAT, arg);
14351         if (st == 0)
14352             printf("semun\n");
14353         else
14354 #       endif /* IPC_STAT */
14355             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14356 #       ifdef IPC_RMID
14357         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14358 #       endif /* IPC_RMID */
14359             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14360     } else
14361 #endif /* IPC_PRIVATE && ... */
14362         printf("semget failed: errno = %d\n", errno);
14363   return 0;
14364 }
14365 END
14366     val="$undef"
14367     set try
14368     if eval $compile; then
14369         xxx=`$run ./try`
14370         case "$xxx" in
14371         semun) val="$define" ;;
14372         esac
14373     fi
14374     $rm -f try try.c
14375     set d_semctl_semun
14376     eval $setvar
14377     case "$d_semctl_semun" in
14378     $define)
14379         echo "You can use union semun for semctl IPC_STAT." >&4
14380         also='also'
14381         ;;
14382     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14383         also=''
14384         ;;
14385     esac
14386
14387     : see whether semctl IPC_STAT can use struct semid_ds pointer
14388     $cat > try.c <<'END'
14389 #include <sys/types.h>
14390 #include <sys/ipc.h>
14391 #include <sys/sem.h>
14392 #include <sys/stat.h>
14393 #include "try.h"
14394 #include <stdio.h>
14395 #include <errno.h>
14396 #ifndef errno
14397 extern int errno;
14398 #endif
14399 int main() {
14400     struct semid_ds arg;
14401     int sem, st;
14402
14403 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14404     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14405     if (sem > -1) {
14406 #       ifdef IPC_STAT
14407         st = semctl(sem, 0, IPC_STAT, &arg);
14408         if (st == 0)
14409             printf("semid_ds\n");
14410         else
14411 #       endif /* IPC_STAT */
14412             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14413 #       ifdef IPC_RMID
14414         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14415 #       endif /* IPC_RMID */
14416             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14417     } else
14418 #endif /* IPC_PRIVATE && ... */
14419         printf("semget failed: errno = %d\n", errno);
14420
14421     return 0;
14422 }
14423 END
14424     val="$undef"
14425     set try
14426     if eval $compile; then
14427         xxx=`$run ./try`
14428         case "$xxx" in
14429         semid_ds) val="$define" ;;
14430         esac
14431     fi
14432     $rm -f try try.c
14433     set d_semctl_semid_ds
14434     eval $setvar
14435     case "$d_semctl_semid_ds" in
14436     $define)
14437         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14438         ;;
14439     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14440         ;;
14441     esac
14442     $rm -f try.h
14443     ;;
14444 *)  val="$undef"
14445
14446     # We do not have the full sem*(2) library, so assume we can not
14447     # use either.
14448
14449     set d_semctl_semun
14450     eval $setvar
14451
14452     set d_semctl_semid_ds
14453     eval $setvar
14454     ;;
14455 esac
14456
14457 : see if sendmsg exists
14458 set sendmsg d_sendmsg
14459 eval $inlibc
14460
14461 : see if setegid exists
14462 set setegid d_setegid
14463 eval $inlibc
14464
14465 : see if seteuid exists
14466 set seteuid d_seteuid
14467 eval $inlibc
14468
14469 : see if setgrent exists
14470 set setgrent d_setgrent
14471 eval $inlibc
14472
14473 : see if setgrent_r exists
14474 set setgrent_r d_setgrent_r
14475 eval $inlibc
14476 case "$d_setgrent_r" in
14477 "$define")
14478         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14479         case "$d_setgrent_r_proto:$usethreads" in
14480         ":define")      d_setgrent_r_proto=define
14481                 set d_setgrent_r_proto setgrent_r $hdrs
14482                 eval $hasproto ;;
14483         *)      ;;
14484         esac
14485         case "$d_setgrent_r_proto" in
14486         define)
14487         case "$setgrent_r_proto" in
14488         ''|0) try='int setgrent_r(FILE**);'
14489         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14490         esac
14491         case "$setgrent_r_proto" in
14492         ''|0) try='void setgrent_r(FILE**);'
14493         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14494         esac
14495         case "$setgrent_r_proto" in
14496         ''|0)   d_setgrent_r=undef
14497                 setgrent_r_proto=0
14498                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14499         * )     case "$setgrent_r_proto" in
14500                 REENTRANT_PROTO*) ;;
14501                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14502                 esac
14503                 echo "Prototype: $try" ;;
14504         esac
14505         ;;
14506         *)      case "$usethreads" in
14507                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14508                 esac
14509                 d_setgrent_r=undef
14510                 setgrent_r_proto=0
14511                 ;;
14512         esac
14513         ;;
14514 *)      setgrent_r_proto=0
14515         ;;
14516 esac
14517
14518 : see if sethostent exists
14519 set sethostent d_sethent
14520 eval $inlibc
14521
14522 : see if sethostent_r exists
14523 set sethostent_r d_sethostent_r
14524 eval $inlibc
14525 case "$d_sethostent_r" in
14526 "$define")
14527         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14528         case "$d_sethostent_r_proto:$usethreads" in
14529         ":define")      d_sethostent_r_proto=define
14530                 set d_sethostent_r_proto sethostent_r $hdrs
14531                 eval $hasproto ;;
14532         *)      ;;
14533         esac
14534         case "$d_sethostent_r_proto" in
14535         define)
14536         case "$sethostent_r_proto" in
14537         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14538         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14539         esac
14540         case "$sethostent_r_proto" in
14541         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14542         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14543         esac
14544         case "$sethostent_r_proto" in
14545         ''|0)   d_sethostent_r=undef
14546                 sethostent_r_proto=0
14547                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14548         * )     case "$sethostent_r_proto" in
14549                 REENTRANT_PROTO*) ;;
14550                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14551                 esac
14552                 echo "Prototype: $try" ;;
14553         esac
14554         ;;
14555         *)      case "$usethreads" in
14556                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14557                 esac
14558                 d_sethostent_r=undef
14559                 sethostent_r_proto=0
14560                 ;;
14561         esac
14562         ;;
14563 *)      sethostent_r_proto=0
14564         ;;
14565 esac
14566
14567 : see if setitimer exists
14568 set setitimer d_setitimer
14569 eval $inlibc
14570
14571 : see if setlinebuf exists
14572 set setlinebuf d_setlinebuf
14573 eval $inlibc
14574
14575 : see if setlocale exists
14576 set setlocale d_setlocale
14577 eval $inlibc
14578
14579 : see if locale.h is available
14580 set locale.h i_locale
14581 eval $inhdr
14582
14583 : see if setlocale_r exists
14584 set setlocale_r d_setlocale_r
14585 eval $inlibc
14586 case "$d_setlocale_r" in
14587 "$define")
14588         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14589         case "$d_setlocale_r_proto:$usethreads" in
14590         ":define")      d_setlocale_r_proto=define
14591                 set d_setlocale_r_proto setlocale_r $hdrs
14592                 eval $hasproto ;;
14593         *)      ;;
14594         esac
14595         case "$d_setlocale_r_proto" in
14596         define)
14597         case "$setlocale_r_proto" in
14598         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14599         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14600         esac
14601         case "$setlocale_r_proto" in
14602         ''|0)   d_setlocale_r=undef
14603                 setlocale_r_proto=0
14604                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14605         * )     case "$setlocale_r_proto" in
14606                 REENTRANT_PROTO*) ;;
14607                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14608                 esac
14609                 echo "Prototype: $try" ;;
14610         esac
14611         ;;
14612         *)      case "$usethreads" in
14613                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14614                 esac
14615                 d_setlocale_r=undef
14616                 setlocale_r_proto=0
14617                 ;;
14618         esac
14619         ;;
14620 *)      setlocale_r_proto=0
14621         ;;
14622 esac
14623
14624 : see if setnetent exists
14625 set setnetent d_setnent
14626 eval $inlibc
14627
14628 : see if setnetent_r exists
14629 set setnetent_r d_setnetent_r
14630 eval $inlibc
14631 case "$d_setnetent_r" in
14632 "$define")
14633         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14634         case "$d_setnetent_r_proto:$usethreads" in
14635         ":define")      d_setnetent_r_proto=define
14636                 set d_setnetent_r_proto setnetent_r $hdrs
14637                 eval $hasproto ;;
14638         *)      ;;
14639         esac
14640         case "$d_setnetent_r_proto" in
14641         define)
14642         case "$setnetent_r_proto" in
14643         ''|0) try='int setnetent_r(int, struct netent_data*);'
14644         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14645         esac
14646         case "$setnetent_r_proto" in
14647         ''|0) try='void setnetent_r(int, struct netent_data*);'
14648         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14649         esac
14650         case "$setnetent_r_proto" in
14651         ''|0)   d_setnetent_r=undef
14652                 setnetent_r_proto=0
14653                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14654         * )     case "$setnetent_r_proto" in
14655                 REENTRANT_PROTO*) ;;
14656                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14657                 esac
14658                 echo "Prototype: $try" ;;
14659         esac
14660         ;;
14661         *)      case "$usethreads" in
14662                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14663                 esac
14664                 d_setnetent_r=undef
14665                 setnetent_r_proto=0
14666                 ;;
14667         esac
14668         ;;
14669 *)      setnetent_r_proto=0
14670         ;;
14671 esac
14672
14673 : see if setprotoent exists
14674 set setprotoent d_setpent
14675 eval $inlibc
14676
14677 : see if setpgid exists
14678 set setpgid d_setpgid
14679 eval $inlibc
14680
14681 : see if setpgrp2 exists
14682 set setpgrp2 d_setpgrp2
14683 eval $inlibc
14684
14685 : see if setpriority exists
14686 set setpriority d_setprior
14687 eval $inlibc
14688
14689 : see if setproctitle exists
14690 set setproctitle d_setproctitle
14691 eval $inlibc
14692
14693 : see if setprotoent_r exists
14694 set setprotoent_r d_setprotoent_r
14695 eval $inlibc
14696 case "$d_setprotoent_r" in
14697 "$define")
14698         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14699         case "$d_setprotoent_r_proto:$usethreads" in
14700         ":define")      d_setprotoent_r_proto=define
14701                 set d_setprotoent_r_proto setprotoent_r $hdrs
14702                 eval $hasproto ;;
14703         *)      ;;
14704         esac
14705         case "$d_setprotoent_r_proto" in
14706         define)
14707         case "$setprotoent_r_proto" in
14708         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14709         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14710         esac
14711         case "$setprotoent_r_proto" in
14712         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14713         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14714         esac
14715         case "$setprotoent_r_proto" in
14716         ''|0)   d_setprotoent_r=undef
14717                 setprotoent_r_proto=0
14718                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14719         * )     case "$setprotoent_r_proto" in
14720                 REENTRANT_PROTO*) ;;
14721                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14722                 esac
14723                 echo "Prototype: $try" ;;
14724         esac
14725         ;;
14726         *)      case "$usethreads" in
14727                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14728                 esac
14729                 d_setprotoent_r=undef
14730                 setprotoent_r_proto=0
14731                 ;;
14732         esac
14733         ;;
14734 *)      setprotoent_r_proto=0
14735         ;;
14736 esac
14737
14738 : see if setpwent exists
14739 set setpwent d_setpwent
14740 eval $inlibc
14741
14742 : see if setpwent_r exists
14743 set setpwent_r d_setpwent_r
14744 eval $inlibc
14745 case "$d_setpwent_r" in
14746 "$define")
14747         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14748         case "$d_setpwent_r_proto:$usethreads" in
14749         ":define")      d_setpwent_r_proto=define
14750                 set d_setpwent_r_proto setpwent_r $hdrs
14751                 eval $hasproto ;;
14752         *)      ;;
14753         esac
14754         case "$d_setpwent_r_proto" in
14755         define)
14756         case "$setpwent_r_proto" in
14757         ''|0) try='int setpwent_r(FILE**);'
14758         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14759         esac
14760         case "$setpwent_r_proto" in
14761         ''|0) try='void setpwent_r(FILE**);'
14762         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14763         esac
14764         case "$setpwent_r_proto" in
14765         ''|0)   d_setpwent_r=undef
14766                 setpwent_r_proto=0
14767                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14768         * )     case "$setpwent_r_proto" in
14769                 REENTRANT_PROTO*) ;;
14770                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14771                 esac
14772                 echo "Prototype: $try" ;;
14773         esac
14774         ;;
14775         *)      case "$usethreads" in
14776                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14777                 esac
14778                 d_setpwent_r=undef
14779                 setpwent_r_proto=0
14780                 ;;
14781         esac
14782         ;;
14783 *)      setpwent_r_proto=0
14784         ;;
14785 esac
14786
14787 : see if setregid exists
14788 set setregid d_setregid
14789 eval $inlibc
14790 set setresgid d_setresgid
14791 eval $inlibc
14792
14793 : see if setreuid exists
14794 set setreuid d_setreuid
14795 eval $inlibc
14796 set setresuid d_setresuid
14797 eval $inlibc
14798
14799 : see if setrgid exists
14800 set setrgid d_setrgid
14801 eval $inlibc
14802
14803 : see if setruid exists
14804 set setruid d_setruid
14805 eval $inlibc
14806
14807 : see if setservent exists
14808 set setservent d_setsent
14809 eval $inlibc
14810
14811 : see if setservent_r exists
14812 set setservent_r d_setservent_r
14813 eval $inlibc
14814 case "$d_setservent_r" in
14815 "$define")
14816         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14817         case "$d_setservent_r_proto:$usethreads" in
14818         ":define")      d_setservent_r_proto=define
14819                 set d_setservent_r_proto setservent_r $hdrs
14820                 eval $hasproto ;;
14821         *)      ;;
14822         esac
14823         case "$d_setservent_r_proto" in
14824         define)
14825         case "$setservent_r_proto" in
14826         ''|0) try='int setservent_r(int, struct servent_data*);'
14827         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14828         esac
14829         case "$setservent_r_proto" in
14830         ''|0) try='void setservent_r(int, struct servent_data*);'
14831         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14832         esac
14833         case "$setservent_r_proto" in
14834         ''|0)   d_setservent_r=undef
14835                 setservent_r_proto=0
14836                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14837         * )     case "$setservent_r_proto" in
14838                 REENTRANT_PROTO*) ;;
14839                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14840                 esac
14841                 echo "Prototype: $try" ;;
14842         esac
14843         ;;
14844         *)      case "$usethreads" in
14845                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14846                 esac
14847                 d_setservent_r=undef
14848                 setservent_r_proto=0
14849                 ;;
14850         esac
14851         ;;
14852 *)      setservent_r_proto=0
14853         ;;
14854 esac
14855
14856 : see if setsid exists
14857 set setsid d_setsid
14858 eval $inlibc
14859
14860 : see if setvbuf exists
14861 set setvbuf d_setvbuf
14862 eval $inlibc
14863
14864 : see if sfio.h is available
14865 set sfio.h i_sfio
14866 eval $inhdr
14867
14868
14869 : see if sfio library is available
14870 case "$i_sfio" in
14871 $define)
14872         val=''
14873         set sfreserve val
14874         eval $inlibc
14875         ;;
14876 *)
14877         val="$undef"
14878         ;;
14879 esac
14880 : Ok, but do we want to use it.
14881 case "$val" in
14882 $define)
14883         case "$usesfio" in
14884         true|$define|[yY]*) dflt='y';;
14885         *) dflt='n';;
14886         esac
14887         echo "$package can use the sfio library, but it is experimental."
14888         case "$useperlio" in
14889         "$undef")
14890             echo "For sfio also the PerlIO abstraction layer is needed."
14891             echo "Earlier you said you wouldn't want that."
14892             ;;
14893         esac
14894         rp="You seem to have sfio available, do you want to try using it?"
14895         . ./myread
14896         case "$ans" in
14897         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14898                 useperlio="$define"
14899                 val="$define"
14900                 ;;
14901         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14902                 val="$undef"
14903                 ;;
14904         esac
14905         ;;
14906 *)      case "$usesfio" in
14907         true|$define|[yY]*)
14908                 echo "Sorry, cannot find sfio on this machine." >&4
14909                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14910                 val="$undef"
14911                 ;;
14912         esac
14913         ;;
14914 esac
14915 set d_sfio
14916 eval $setvar
14917 case "$d_sfio" in
14918 $define) usesfio='true';;
14919 *) usesfio='false';;
14920 esac
14921 case "$d_sfio" in
14922 $define) ;;
14923 *)      : Remove sfio from list of libraries to use
14924         case "$libs" in
14925         *-lsfio*)
14926                 echo "Removing unneeded -lsfio from library list" >&4
14927                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14928                 shift
14929                 libs="$*"
14930                 echo "libs = $libs" >&4
14931                 ;;
14932         esac
14933 ;;
14934 esac
14935
14936
14937 : see if shmctl exists
14938 set shmctl d_shmctl
14939 eval $inlibc
14940
14941 : see if shmget exists
14942 set shmget d_shmget
14943 eval $inlibc
14944
14945 : see if shmat exists
14946 set shmat d_shmat
14947 eval $inlibc
14948 : see what shmat returns
14949 case "$d_shmat" in
14950 "$define")
14951         $cat >shmat.c <<'END'
14952 #include <sys/shm.h>
14953 void *shmat();
14954 END
14955         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14956                 shmattype='void *'
14957         else
14958                 shmattype='char *'
14959         fi
14960         echo "and it returns ($shmattype)." >&4
14961         : see if a prototype for shmat is available
14962         xxx=`./findhdr sys/shm.h`
14963         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14964         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14965                 val="$define"
14966         else
14967                 val="$undef"
14968         fi
14969         $rm -f shmat.[co]
14970         ;;
14971 *)
14972         val="$undef"
14973         ;;
14974 esac
14975 set d_shmatprototype
14976 eval $setvar
14977
14978 : see if shmdt exists
14979 set shmdt d_shmdt
14980 eval $inlibc
14981
14982 : see how much of the 'shm*(2)' library is present.
14983 h_shm=true
14984 echo " "
14985 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14986 *"$undef"*) h_shm=false;;
14987 esac
14988 case "$osname" in
14989 freebsd)
14990     case "`ipcs 2>&1`" in
14991     "SVID shared memory"*"not configured"*)
14992         echo "Your $osname does not have the shm*(2) configured." >&4
14993         h_shm=false
14994         val="$undef"
14995         set shmctl d_shmctl
14996         evat $setvar
14997         set shmget d_shmget
14998         evat $setvar
14999         set shmat d_shmat
15000         evat $setvar
15001         set shmdt d_shmdt
15002         evat $setvar
15003         ;;
15004     esac
15005     ;;
15006 esac
15007 : we could also check for sys/ipc.h ...
15008 if $h_shm && $test `./findhdr sys/shm.h`; then
15009         echo "You have the full shm*(2) library." >&4
15010         val="$define"
15011 else
15012         echo "You don't have the full shm*(2) library." >&4
15013         val="$undef"
15014 fi
15015 set d_shm
15016 eval $setvar
15017
15018 echo " "
15019 : see if we have sigaction
15020 if set sigaction val -f d_sigaction; eval $csym; $val; then
15021         echo 'sigaction() found.' >&4
15022         $cat > try.c <<'EOP'
15023 #include <stdio.h>
15024 #include <sys/types.h>
15025 #include <signal.h>
15026 int main()
15027 {
15028     struct sigaction act, oact;
15029     act.sa_flags = 0;
15030     oact.sa_handler = 0;
15031     /* so that act and oact are used */
15032     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15033 }
15034 EOP
15035         set try
15036         if eval $compile_ok; then
15037                 val="$define"
15038         else
15039                 echo "But you don't seem to have a useable struct sigaction." >&4
15040                 val="$undef"
15041         fi
15042 else
15043         echo 'sigaction NOT found.' >&4
15044         val="$undef"
15045 fi
15046 set d_sigaction; eval $setvar
15047 $rm -f try try$_o try.c
15048
15049 : see if sigprocmask exists
15050 set sigprocmask d_sigprocmask
15051 eval $inlibc
15052
15053 : see if sigsetjmp exists
15054 echo " "
15055 case "$d_sigsetjmp" in
15056 '')
15057         $cat >try.c <<'EOP'
15058 #include <setjmp.h>
15059 sigjmp_buf env;
15060 int set = 1;
15061 int main()
15062 {
15063         if (sigsetjmp(env,1))
15064                 exit(set);
15065         set = 0;
15066         siglongjmp(env, 1);
15067         exit(1);
15068 }
15069 EOP
15070         set try
15071         if eval $compile; then
15072                 if $run ./try >/dev/null 2>&1; then
15073                         echo "POSIX sigsetjmp found." >&4
15074                         val="$define"
15075                 else
15076                         $cat >&4 <<EOM
15077 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15078 I'll ignore them.
15079 EOM
15080                         val="$undef"
15081                 fi
15082         else
15083                 echo "sigsetjmp not found." >&4
15084                 val="$undef"
15085         fi
15086         ;;
15087 *) val="$d_sigsetjmp"
15088         case "$d_sigsetjmp" in
15089         $define) echo "POSIX sigsetjmp found." >&4;;
15090         $undef) echo "sigsetjmp not found." >&4;;
15091         esac
15092         ;;
15093 esac
15094 set d_sigsetjmp
15095 eval $setvar
15096 $rm -f try.c try
15097
15098 : see if sockatmark exists
15099 set sockatmark d_sockatmark
15100 eval $inlibc
15101
15102 : see if prototype for sockatmark is available
15103 echo " "
15104 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15105 eval $hasproto
15106
15107 : see if socks5_init exists
15108 set socks5_init d_socks5_init
15109 eval $inlibc
15110
15111 : see if srand48_r exists
15112 set srand48_r d_srand48_r
15113 eval $inlibc
15114 case "$d_srand48_r" in
15115 "$define")
15116         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15117         case "$d_srand48_r_proto:$usethreads" in
15118         ":define")      d_srand48_r_proto=define
15119                 set d_srand48_r_proto srand48_r $hdrs
15120                 eval $hasproto ;;
15121         *)      ;;
15122         esac
15123         case "$d_srand48_r_proto" in
15124         define)
15125         case "$srand48_r_proto" in
15126         ''|0) try='int srand48_r(long, struct drand48_data*);'
15127         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15128         esac
15129         case "$srand48_r_proto" in
15130         ''|0)   d_srand48_r=undef
15131                 srand48_r_proto=0
15132                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15133         * )     case "$srand48_r_proto" in
15134                 REENTRANT_PROTO*) ;;
15135                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15136                 esac
15137                 echo "Prototype: $try" ;;
15138         esac
15139         ;;
15140         *)      case "$usethreads" in
15141                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15142                 esac
15143                 d_srand48_r=undef
15144                 srand48_r_proto=0
15145                 ;;
15146         esac
15147         ;;
15148 *)      srand48_r_proto=0
15149         ;;
15150 esac
15151
15152 : see if srandom_r exists
15153 set srandom_r d_srandom_r
15154 eval $inlibc
15155 case "$d_srandom_r" in
15156 "$define")
15157         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15158         case "$d_srandom_r_proto:$usethreads" in
15159         ":define")      d_srandom_r_proto=define
15160                 set d_srandom_r_proto srandom_r $hdrs
15161                 eval $hasproto ;;
15162         *)      ;;
15163         esac
15164         case "$d_srandom_r_proto" in
15165         define)
15166         case "$srandom_r_proto" in
15167         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15168         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15169         esac
15170         case "$srandom_r_proto" in
15171         ''|0)   d_srandom_r=undef
15172                 srandom_r_proto=0
15173                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15174         * )     case "$srandom_r_proto" in
15175                 REENTRANT_PROTO*) ;;
15176                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15177                 esac
15178                 echo "Prototype: $try" ;;
15179         esac
15180         ;;
15181         *)      case "$usethreads" in
15182                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15183                 esac
15184                 d_srandom_r=undef
15185                 srandom_r_proto=0
15186                 ;;
15187         esac
15188         ;;
15189 *)      srandom_r_proto=0
15190         ;;
15191 esac
15192
15193 : see if prototype for setresgid is available
15194 echo " "
15195 set d_sresgproto setresgid $i_unistd unistd.h
15196 eval $hasproto
15197
15198 : see if prototype for setresuid is available
15199 echo " "
15200 set d_sresuproto setresuid $i_unistd unistd.h
15201 eval $hasproto
15202
15203 : see if sys/stat.h is available
15204 set sys/stat.h i_sysstat
15205 eval $inhdr
15206
15207
15208 : see if stat knows about block sizes
15209 echo " "
15210 echo "Checking to see if your struct stat has st_blocks field..." >&4
15211 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15212 eval $hasfield
15213
15214
15215 : see if this is a sys/vfs.h system
15216 set sys/vfs.h i_sysvfs
15217 eval $inhdr
15218
15219
15220 : see if this is a sys/statfs.h system
15221 set sys/statfs.h i_sysstatfs
15222 eval $inhdr
15223
15224
15225 echo " "
15226 echo "Checking to see if your system supports struct statfs..." >&4
15227 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
15228 eval $hasstruct
15229 case "$d_statfs_s" in
15230 "$define")      echo "Yes, it does."   ;;
15231 *)              echo "No, it doesn't." ;;
15232 esac
15233
15234
15235
15236 : see if struct statfs knows about f_flags
15237 case "$d_statfs_s" in
15238 define) 
15239         echo " "
15240         echo "Checking to see if your struct statfs has f_flags field..." >&4
15241         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
15242         eval $hasfield
15243         ;;
15244 *)      val="$undef"
15245         set d_statfs_f_flags
15246         eval $setvar
15247         ;;
15248 esac
15249 case "$d_statfs_f_flags" in
15250 "$define")      echo "Yes, it does."   ;;
15251 *)              echo "No, it doesn't." ;;
15252 esac
15253
15254 : see if _ptr and _cnt from stdio act std
15255 echo " "
15256
15257 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15258         echo "(Looks like you have stdio.h from BSD.)"
15259         case "$stdio_ptr" in
15260         '') stdio_ptr='((fp)->_p)'
15261                 ptr_lval=$define
15262                 ;;
15263         *)      ptr_lval=$d_stdio_ptr_lval;;
15264         esac
15265         case "$stdio_cnt" in
15266         '') stdio_cnt='((fp)->_r)'
15267                 cnt_lval=$define
15268                 ;;
15269         *)      cnt_lval=$d_stdio_cnt_lval;;
15270         esac
15271         case "$stdio_base" in
15272         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15273         esac
15274         case "$stdio_bufsiz" in
15275         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15276         esac
15277 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15278         echo "(Looks like you have stdio.h from Linux.)"
15279         case "$stdio_ptr" in
15280         '') stdio_ptr='((fp)->_IO_read_ptr)'
15281                 ptr_lval=$define
15282                 ;;
15283         *)      ptr_lval=$d_stdio_ptr_lval;;
15284         esac
15285         case "$stdio_cnt" in
15286         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15287                 cnt_lval=$undef
15288                 ;;
15289         *)      cnt_lval=$d_stdio_cnt_lval;;
15290         esac
15291         case "$stdio_base" in
15292         '') stdio_base='((fp)->_IO_read_base)';;
15293         esac
15294         case "$stdio_bufsiz" in
15295         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15296         esac
15297 else
15298         case "$stdio_ptr" in
15299         '') stdio_ptr='((fp)->_ptr)'
15300                 ptr_lval=$define
15301                 ;;
15302         *)      ptr_lval=$d_stdio_ptr_lval;;
15303         esac
15304         case "$stdio_cnt" in
15305         '') stdio_cnt='((fp)->_cnt)'
15306                 cnt_lval=$define
15307                 ;;
15308         *)      cnt_lval=$d_stdio_cnt_lval;;
15309         esac
15310         case "$stdio_base" in
15311         '') stdio_base='((fp)->_base)';;
15312         esac
15313         case "$stdio_bufsiz" in
15314         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15315         esac
15316 fi
15317
15318 : test whether _ptr and _cnt really work
15319 echo "Checking how std your stdio is..." >&4
15320 $cat >try.c <<EOP
15321 #include <stdio.h>
15322 #define FILE_ptr(fp)    $stdio_ptr
15323 #define FILE_cnt(fp)    $stdio_cnt
15324 int main() {
15325         FILE *fp = fopen("try.c", "r");
15326         char c = getc(fp);
15327         if (
15328                 18 <= FILE_cnt(fp) &&
15329                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15330         )
15331                 exit(0);
15332         exit(1);
15333 }
15334 EOP
15335 val="$undef"
15336 set try
15337 if eval $compile && $to try.c; then
15338         if $run ./try; then
15339                 echo "Your stdio acts pretty std."
15340                 val="$define"
15341         else
15342                 echo "Your stdio isn't very std."
15343         fi
15344 else
15345         echo "Your stdio doesn't appear very std."
15346 fi
15347 $rm -f try.c try
15348 set d_stdstdio
15349 eval $setvar
15350
15351 : Can _ptr be used as an lvalue?
15352 case "$d_stdstdio$ptr_lval" in
15353 $define$define) val=$define ;;
15354 *) val=$undef ;;
15355 esac
15356 set d_stdio_ptr_lval
15357 eval $setvar
15358
15359 : Can _cnt be used as an lvalue?
15360 case "$d_stdstdio$cnt_lval" in
15361 $define$define) val=$define ;;
15362 *) val=$undef ;;
15363 esac
15364 set d_stdio_cnt_lval
15365 eval $setvar
15366
15367
15368 : test whether setting _ptr sets _cnt as a side effect
15369 d_stdio_ptr_lval_sets_cnt="$undef"
15370 d_stdio_ptr_lval_nochange_cnt="$undef"
15371 case "$d_stdio_ptr_lval$d_stdstdio" in
15372 $define$define)
15373         echo "Checking to see what happens if we set the stdio ptr..." >&4
15374 $cat >try.c <<EOP
15375 #include <stdio.h>
15376 /* Can we scream? */
15377 /* Eat dust sed :-) */
15378 /* In the buffer space, no one can hear you scream. */
15379 #define FILE_ptr(fp)    $stdio_ptr
15380 #define FILE_cnt(fp)    $stdio_cnt
15381 #include <sys/types.h>
15382 int main() {
15383         FILE *fp = fopen("try.c", "r");
15384         int c;
15385         char *ptr;
15386         size_t cnt;
15387         if (!fp) {
15388             puts("Fail even to read");
15389             exit(1);
15390         }
15391         c = getc(fp); /* Read away the first # */
15392         if (c == EOF) {
15393             puts("Fail even to read");
15394             exit(1);
15395         }
15396         if (!(
15397                 18 <= FILE_cnt(fp) &&
15398                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15399         )) {
15400                 puts("Fail even to read");
15401                 exit (1);
15402         }
15403         ptr = (char*) FILE_ptr(fp);
15404         cnt = (size_t)FILE_cnt(fp);
15405
15406         FILE_ptr(fp) += 42;
15407
15408         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15409                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15410                 exit (1);
15411         }
15412         if (FILE_cnt(fp) <= 20) {
15413                 printf ("Fail (<20 chars to test)");
15414                 exit (1);
15415         }
15416         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15417                 puts("Fail compare");
15418                 exit (1);
15419         }
15420         if (cnt == FILE_cnt(fp)) {
15421                 puts("Pass_unchanged");
15422                 exit (0);
15423         }       
15424         if (FILE_cnt(fp) == (cnt - 42)) {
15425                 puts("Pass_changed");
15426                 exit (0);
15427         }
15428         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15429         return 1;
15430
15431 }
15432 EOP
15433         set try
15434         if eval $compile && $to try.c; then
15435                 case `$run ./try` in
15436                 Pass_changed)
15437                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15438                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15439                 Pass_unchanged)
15440                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15441                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15442                 Fail*)
15443                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15444                 *)
15445                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15446         esac
15447         else
15448                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15449         fi
15450         $rm -f try.c try
15451         ;;
15452 esac
15453
15454 : see if _base is also standard
15455 val="$undef"
15456 case "$d_stdstdio" in
15457 $define)
15458         $cat >try.c <<EOP
15459 #include <stdio.h>
15460 #define FILE_base(fp)   $stdio_base
15461 #define FILE_bufsiz(fp) $stdio_bufsiz
15462 int main() {
15463         FILE *fp = fopen("try.c", "r");
15464         char c = getc(fp);
15465         if (
15466                 19 <= FILE_bufsiz(fp) &&
15467                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15468         )
15469                 exit(0);
15470         exit(1);
15471 }
15472 EOP
15473         set try
15474         if eval $compile && $to try.c; then
15475                 if $run ./try; then
15476                         echo "And its _base field acts std."
15477                         val="$define"
15478                 else
15479                         echo "But its _base field isn't std."
15480                 fi
15481         else
15482                 echo "However, it seems to be lacking the _base field."
15483         fi
15484         $rm -f try.c try
15485         ;;
15486 esac
15487 set d_stdiobase
15488 eval $setvar
15489
15490 $cat >&4 <<EOM
15491 Checking how to access stdio streams by file descriptor number...
15492 EOM
15493 case "$stdio_stream_array" in
15494 '')     $cat >try.c <<EOCP
15495 #include <stdio.h>
15496 int main() {
15497   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15498     printf("yes\n");
15499 }
15500 EOCP
15501         for s in _iob __iob __sF
15502         do
15503                 set try -DSTDIO_STREAM_ARRAY=$s
15504                 if eval $compile; then
15505                         case "`$run ./try`" in
15506                         yes)    stdio_stream_array=$s; break ;;
15507                         esac
15508                 fi
15509         done
15510         $rm -f try.* try$exe_ext
15511 esac
15512 case "$stdio_stream_array" in
15513 '')     $cat >&4 <<EOM
15514 I can't figure out how to access stdio streams by file descriptor number.
15515 EOM
15516         d_stdio_stream_array="$undef"
15517         ;;
15518 *)      $cat >&4 <<EOM
15519 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15520 EOM
15521         d_stdio_stream_array="$define"
15522         ;;
15523 esac
15524
15525 : see if strcoll exists
15526 set strcoll d_strcoll
15527 eval $inlibc
15528
15529 : check for structure copying
15530 echo " "
15531 echo "Checking to see if your C compiler can copy structs..." >&4
15532 $cat >try.c <<'EOCP'
15533 int main()
15534 {
15535         struct blurfl {
15536                 int dyick;
15537         } foo, bar;
15538
15539         foo = bar;
15540 }
15541 EOCP
15542 if $cc -c try.c >/dev/null 2>&1 ; then
15543         val="$define"
15544         echo "Yup, it can."
15545 else
15546         val="$undef"
15547         echo "Nope, it can't."
15548 fi
15549 set d_strctcpy
15550 eval $setvar
15551 $rm -f try.*
15552
15553 : see if strerror and/or sys_errlist[] exist
15554 echo " "
15555 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15556     if set strerror val -f d_strerror; eval $csym; $val; then
15557                 echo 'strerror() found.' >&4
15558                 d_strerror="$define"
15559                 d_strerrm='strerror(e)'
15560                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15561                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15562                         d_syserrlst="$define"
15563                 else
15564                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15565                         d_syserrlst="$undef"
15566                 fi
15567     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15568                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15569                 echo 'strerror() found in string header.' >&4
15570                 d_strerror="$define"
15571                 d_strerrm='strerror(e)'
15572                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15573                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15574                                 d_syserrlst="$define"
15575                 else
15576                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15577                         d_syserrlst="$undef"
15578                 fi
15579     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15580                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15581                 d_strerror="$undef"
15582                 d_syserrlst="$define"
15583                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15584     else
15585                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15586                 d_strerror="$undef"
15587                 d_syserrlst="$undef"
15588                 d_strerrm='"unknown"'
15589     fi
15590 fi
15591
15592 : see if strerror_r exists
15593 set strerror_r d_strerror_r
15594 eval $inlibc
15595 case "$d_strerror_r" in
15596 "$define")
15597         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15598         case "$d_strerror_r_proto:$usethreads" in
15599         ":define")      d_strerror_r_proto=define
15600                 set d_strerror_r_proto strerror_r $hdrs
15601                 eval $hasproto ;;
15602         *)      ;;
15603         esac
15604         case "$d_strerror_r_proto" in
15605         define)
15606         case "$strerror_r_proto" in
15607         ''|0) try='int strerror_r(int, char*, size_t);'
15608         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15609         esac
15610         case "$strerror_r_proto" in
15611         ''|0) try='int strerror_r(int, char*, int);'
15612         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15613         esac
15614         case "$strerror_r_proto" in
15615         ''|0) try='char* strerror_r(int, char*, size_t);'
15616         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15617         esac
15618         case "$strerror_r_proto" in
15619         ''|0)   d_strerror_r=undef
15620                 strerror_r_proto=0
15621                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15622         * )     case "$strerror_r_proto" in
15623                 REENTRANT_PROTO*) ;;
15624                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15625                 esac
15626                 echo "Prototype: $try" ;;
15627         esac
15628         ;;
15629         *)      case "$usethreads" in
15630                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15631                 esac
15632                 d_strerror_r=undef
15633                 strerror_r_proto=0
15634                 ;;
15635         esac
15636         ;;
15637 *)      strerror_r_proto=0
15638         ;;
15639 esac
15640
15641 : see if strftime exists
15642 set strftime d_strftime
15643 eval $inlibc
15644
15645 : see if strtod exists
15646 set strtod d_strtod
15647 eval $inlibc
15648
15649 : see if strtol exists
15650 set strtol d_strtol
15651 eval $inlibc
15652
15653 : see if strtold exists
15654 set strtold d_strtold
15655 eval $inlibc
15656
15657 : see if strtoll exists
15658 set strtoll d_strtoll
15659 eval $inlibc
15660
15661 case "$d_longlong-$d_strtoll" in
15662 "$define-$define")
15663         $cat <<EOM
15664 Checking whether your strtoll() works okay...
15665 EOM
15666         $cat >try.c <<'EOCP'
15667 #include <errno.h>
15668 #ifdef __hpux
15669 #define strtoll __strtoll
15670 #endif
15671 #ifdef __EMX__
15672 #define strtoll _strtoll
15673 #endif
15674 #include <stdio.h>
15675 extern long long int strtoll(char *s, char **, int); 
15676 static int bad = 0;
15677 int check(char *s, long long ell, int een) {
15678         long long gll;
15679         errno = 0;
15680         gll = strtoll(s, 0, 10);
15681         if (!((gll == ell) && (errno == een)))
15682                 bad++;
15683 }
15684 int main() {
15685         check(" 1",                                      1LL, 0);
15686         check(" 0",                                      0LL, 0);
15687         check("-1",                                     -1LL, 0);
15688         check("-9223372036854775808", -9223372036854775808LL, 0);
15689         check("-9223372036854775808", -9223372036854775808LL, 0);
15690         check(" 9223372036854775807",  9223372036854775807LL, 0);
15691         check("-9223372036854775808", -9223372036854775808LL, 0);
15692         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15693         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15694         if (!bad)
15695                 printf("ok\n");
15696 }
15697 EOCP
15698         set try
15699         if eval $compile; then
15700                 yyy=`$run ./try`
15701                 case "$yyy" in
15702                 ok) echo "Your strtoll() seems to be working okay." ;;
15703                 *) cat <<EOM >&4
15704 Your strtoll() doesn't seem to be working okay.
15705 EOM
15706                    d_strtoll="$undef"
15707                    ;;
15708                 esac
15709         else
15710                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15711                 d_strtoll="$undef"
15712         fi
15713         ;;
15714 esac
15715
15716 : see if strtoq exists
15717 set strtoq d_strtoq
15718 eval $inlibc
15719
15720 : see if strtoul exists
15721 set strtoul d_strtoul
15722 eval $inlibc
15723
15724 case "$d_strtoul" in
15725 "$define")
15726         $cat <<EOM
15727 Checking whether your strtoul() works okay...
15728 EOM
15729         $cat >try.c <<'EOCP'
15730 #include <errno.h>
15731 #include <stdio.h>
15732 extern unsigned long int strtoul(char *s, char **, int); 
15733 static int bad = 0;
15734 void check(char *s, unsigned long eul, int een) {
15735         unsigned long gul;
15736         errno = 0;
15737         gul = strtoul(s, 0, 10);
15738         if (!((gul == eul) && (errno == een)))
15739                 bad++;
15740 }
15741 int main() {
15742         check(" 1", 1L, 0);
15743         check(" 0", 0L, 0);
15744 EOCP
15745         case "$longsize" in
15746         8)
15747             $cat >>try.c <<'EOCP'
15748         check("18446744073709551615", 18446744073709551615UL, 0);
15749         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15750 #if 0 /* strtoul() for /^-/ strings is undefined. */
15751         check("-1", 18446744073709551615UL, 0);
15752         check("-18446744073709551614", 2, 0);
15753         check("-18446744073709551615", 1, 0);
15754         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15755         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15756 #endif
15757 EOCP
15758                 ;;
15759         4)
15760                     $cat >>try.c <<'EOCP'
15761         check("4294967295", 4294967295UL, 0);
15762         check("4294967296", 4294967295UL, ERANGE);
15763 #if 0 /* strtoul() for /^-/ strings is undefined. */
15764         check("-1", 4294967295UL, 0);
15765         check("-4294967294", 2, 0);
15766         check("-4294967295", 1, 0);
15767         check("-4294967296", 4294967295UL, ERANGE);
15768         check("-4294967297", 4294967295UL, ERANGE);
15769 #endif
15770 EOCP
15771                 ;;
15772         *)
15773 : Should we write these tests to be more portable by sprintf-ing
15774 : ~0 and then manipulating that char string as input for strtol?
15775                 ;;
15776         esac
15777         $cat >>try.c <<'EOCP'
15778         if (!bad)
15779                 printf("ok\n");
15780         return 0;
15781 }
15782 EOCP
15783         set try
15784         if eval $compile; then
15785                 case "`$run ./try`" in
15786                 ok) echo "Your strtoul() seems to be working okay." ;;
15787                 *) cat <<EOM >&4
15788 Your strtoul() doesn't seem to be working okay.
15789 EOM
15790                    d_strtoul="$undef"
15791                    ;;
15792                 esac
15793         fi
15794         ;;
15795 esac
15796
15797 : see if strtoull exists
15798 set strtoull d_strtoull
15799 eval $inlibc
15800
15801 case "$d_longlong-$d_strtoull" in
15802 "$define-$define")
15803         $cat <<EOM
15804 Checking whether your strtoull() works okay...
15805 EOM
15806         $cat >try.c <<'EOCP'
15807 #include <errno.h>
15808 #ifdef __hpux
15809 #define strtoull __strtoull
15810 #endif
15811 #include <stdio.h>
15812 extern unsigned long long int strtoull(char *s, char **, int); 
15813 static int bad = 0;
15814 int check(char *s, long long eull, int een) {
15815         long long gull;
15816         errno = 0;
15817         gull = strtoull(s, 0, 10);
15818         if (!((gull == eull) && (errno == een)))
15819                 bad++;
15820 }
15821 int main() {
15822         check(" 1",                                        1LL, 0);
15823         check(" 0",                                        0LL, 0);
15824         check("18446744073709551615",  18446744073709551615ULL, 0);
15825         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15826 #if 0 /* strtoull() for /^-/ strings is undefined. */
15827         check("-1",                    18446744073709551615ULL, 0);
15828         check("-18446744073709551614",                     2LL, 0);
15829         check("-18446744073709551615",                     1LL, 0);
15830         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15831         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15832 #endif
15833         if (!bad)
15834                 printf("ok\n");
15835 }
15836 EOCP
15837         set try
15838         if eval $compile; then
15839                 case "`$run ./try`" in
15840                 ok) echo "Your strtoull() seems to be working okay." ;;
15841                 *) cat <<EOM >&4
15842 Your strtoull() doesn't seem to be working okay.
15843 EOM
15844                    d_strtoull="$undef"
15845                    ;;
15846                 esac
15847         fi
15848         ;;
15849 esac
15850
15851 : see if strtouq exists
15852 set strtouq d_strtouq
15853 eval $inlibc
15854
15855 case "$d_strtouq" in
15856 "$define")
15857         $cat <<EOM
15858 Checking whether your strtouq() works okay...
15859 EOM
15860         $cat >try.c <<'EOCP'
15861 #include <errno.h>
15862 #include <stdio.h>
15863 extern unsigned long long int strtouq(char *s, char **, int); 
15864 static int bad = 0;
15865 void check(char *s, unsigned long long eull, int een) {
15866         unsigned long long gull;
15867         errno = 0;
15868         gull = strtouq(s, 0, 10);
15869         if (!((gull == eull) && (errno == een)))
15870                 bad++;
15871 }
15872 int main() {
15873         check(" 1",                                        1LL, 0);
15874         check(" 0",                                        0LL, 0);
15875         check("18446744073709551615",  18446744073709551615ULL, 0);
15876         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15877 #if 0 /* strtouq() for /^-/ strings is undefined. */
15878         check("-1",                    18446744073709551615ULL, 0);
15879         check("-18446744073709551614",                     2LL, 0);
15880         check("-18446744073709551615",                     1LL, 0);
15881         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15882         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15883 #endif
15884         if (!bad)
15885                 printf("ok\n");
15886         return 0;
15887 }
15888 EOCP
15889         set try
15890         if eval $compile; then
15891                 case "`$run ./try`" in
15892                 ok) echo "Your strtouq() seems to be working okay." ;;
15893                 *) cat <<EOM >&4
15894 Your strtouq() doesn't seem to be working okay.
15895 EOM
15896                    d_strtouq="$undef"
15897                    ;;
15898                 esac
15899         fi
15900         ;;
15901 esac
15902
15903 : see if strxfrm exists
15904 set strxfrm d_strxfrm
15905 eval $inlibc
15906
15907 : see if symlink exists
15908 set symlink d_symlink
15909 eval $inlibc
15910
15911 : see if syscall exists
15912 set syscall d_syscall
15913 eval $inlibc
15914
15915 : see if prototype for syscall is available
15916 echo " "
15917 set d_syscallproto syscall $i_unistd unistd.h
15918 eval $hasproto
15919
15920 : see if sysconf exists
15921 set sysconf d_sysconf
15922 eval $inlibc
15923
15924 : see if system exists
15925 set system d_system
15926 eval $inlibc
15927
15928 : see if tcgetpgrp exists
15929 set tcgetpgrp d_tcgetpgrp
15930 eval $inlibc
15931
15932 : see if tcsetpgrp exists
15933 set tcsetpgrp d_tcsetpgrp
15934 eval $inlibc
15935
15936 : see if prototype for telldir is available
15937 echo " "
15938 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15939 eval $hasproto
15940
15941 : see if time exists
15942 echo " "
15943 if test "X$d_time" = X -o X"$timetype" = X; then
15944     if set time val -f d_time; eval $csym; $val; then
15945                 echo 'time() found.' >&4
15946                 val="$define"
15947                 rp="What is the type returned by time() on this system?"
15948                 set time_t timetype long stdio.h sys/types.h
15949                 eval $typedef_ask
15950     else
15951                 echo 'time() not found, hope that will do.' >&4
15952                 val="$undef"
15953                 timetype='int';
15954     fi
15955     set d_time
15956     eval $setvar
15957 fi
15958
15959 : see if this is a sys/times.h system
15960 set sys/times.h i_systimes
15961 eval $inhdr
15962
15963 : see if times exists
15964 echo " "
15965 if set times val -f d_times; eval $csym; $val; then
15966         echo 'times() found.' >&4
15967         d_times="$define"
15968         inc=''
15969         case "$i_systimes" in
15970         "$define") inc='sys/times.h';;
15971         esac
15972         rp="What is the type returned by times() on this system?"
15973         set clock_t clocktype long stdio.h sys/types.h $inc
15974         eval $typedef_ask
15975 else
15976         echo 'times() NOT found, hope that will do.' >&4
15977         d_times="$undef"
15978         clocktype='int'
15979 fi
15980
15981 : see if tmpnam_r exists
15982 set tmpnam_r d_tmpnam_r
15983 eval $inlibc
15984 case "$d_tmpnam_r" in
15985 "$define")
15986         hdrs="$i_systypes sys/types.h define stdio.h "
15987         case "$d_tmpnam_r_proto:$usethreads" in
15988         ":define")      d_tmpnam_r_proto=define
15989                 set d_tmpnam_r_proto tmpnam_r $hdrs
15990                 eval $hasproto ;;
15991         *)      ;;
15992         esac
15993         case "$d_tmpnam_r_proto" in
15994         define)
15995         case "$tmpnam_r_proto" in
15996         ''|0) try='char* tmpnam_r(char*);'
15997         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15998         esac
15999         case "$tmpnam_r_proto" in
16000         ''|0)   d_tmpnam_r=undef
16001                 tmpnam_r_proto=0
16002                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16003         * )     case "$tmpnam_r_proto" in
16004                 REENTRANT_PROTO*) ;;
16005                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16006                 esac
16007                 echo "Prototype: $try" ;;
16008         esac
16009         ;;
16010         *)      case "$usethreads" in
16011                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16012                 esac
16013                 d_tmpnam_r=undef
16014                 tmpnam_r_proto=0
16015                 ;;
16016         esac
16017         ;;
16018 *)      tmpnam_r_proto=0
16019         ;;
16020 esac
16021
16022 : see if truncate exists
16023 set truncate d_truncate
16024 eval $inlibc
16025
16026 : see if ttyname_r exists
16027 set ttyname_r d_ttyname_r
16028 eval $inlibc
16029 case "$d_ttyname_r" in
16030 "$define")
16031         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16032         case "$d_ttyname_r_proto:$usethreads" in
16033         ":define")      d_ttyname_r_proto=define
16034                 set d_ttyname_r_proto ttyname_r $hdrs
16035                 eval $hasproto ;;
16036         *)      ;;
16037         esac
16038         case "$d_ttyname_r_proto" in
16039         define)
16040         case "$ttyname_r_proto" in
16041         ''|0) try='int ttyname_r(int, char*, size_t);'
16042         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16043         esac
16044         case "$ttyname_r_proto" in
16045         ''|0) try='int ttyname_r(int, char*, int);'
16046         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16047         esac
16048         case "$ttyname_r_proto" in
16049         ''|0) try='char* ttyname_r(int, char*, int);'
16050         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16051         esac
16052         case "$ttyname_r_proto" in
16053         ''|0)   d_ttyname_r=undef
16054                 ttyname_r_proto=0
16055                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16056         * )     case "$ttyname_r_proto" in
16057                 REENTRANT_PROTO*) ;;
16058                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16059                 esac
16060                 echo "Prototype: $try" ;;
16061         esac
16062         ;;
16063         *)      case "$usethreads" in
16064                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16065                 esac
16066                 d_ttyname_r=undef
16067                 ttyname_r_proto=0
16068                 ;;
16069         esac
16070         ;;
16071 *)      ttyname_r_proto=0
16072         ;;
16073 esac
16074
16075 : see if tzname[] exists
16076 echo " "
16077 if set tzname val -a d_tzname; eval $csym; $val; then
16078         val="$define"
16079         echo 'tzname[] found.' >&4
16080 else
16081         val="$undef"
16082         echo 'tzname[] NOT found.' >&4
16083 fi
16084 set d_tzname
16085 eval $setvar
16086
16087 case "$osname" in
16088 next|rhapsody|darwin) multiarch="$define" ;;
16089 esac
16090 case "$multiarch" in
16091 ''|[nN]*) multiarch="$undef" ;;
16092 esac
16093
16094 : check for ordering of bytes in a UV
16095 echo " "
16096 case "$usecrosscompile$multiarch" in
16097 *$define*)
16098         $cat <<EOM
16099 You seem to be either cross-compiling or doing a multiarchitecture build,
16100 skipping the byteorder check.
16101
16102 EOM
16103         byteorder='ffff'
16104         ;;
16105 *)
16106         case "$byteorder" in
16107         '')
16108                 $cat <<'EOM'
16109 In the following, larger digits indicate more significance.  A big-endian
16110 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16111 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16112 machines may have weird orders like 3412.  A Cray will report 87654321,
16113 an Alpha will report 12345678. If the test program works the default is
16114 probably right.
16115 I'm now running the test program...
16116 EOM
16117                 $cat >try.c <<EOCP
16118 #include <stdio.h>
16119 #include <sys/types.h>
16120 typedef $uvtype UV;
16121 int main()
16122 {
16123         int i;
16124         union {
16125                 UV l;
16126                 char c[$uvsize];
16127         } u;
16128
16129         if ($uvsize > 4)
16130                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16131         else
16132                 u.l = (UV)0x04030201;
16133         for (i = 0; i < $uvsize; i++)
16134                 printf("%c", u.c[i]+'0');
16135         printf("\n");
16136         exit(0);
16137 }
16138 EOCP
16139                 xxx_prompt=y
16140                 set try
16141                 if eval $compile && ./try > /dev/null; then
16142                         dflt=`$run ./try`
16143                         case "$dflt" in
16144                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16145                                 echo "(The test program ran ok.)"
16146                                 echo "byteorder=$dflt"
16147                                 xxx_prompt=n
16148                         ;;
16149                         ????|????????) echo "(The test program ran ok.)" ;;
16150                         *) echo "(The test program didn't run right for some reason.)" ;;
16151                         esac
16152                 else
16153                         dflt='4321'
16154                         cat <<'EOM'
16155 (I can't seem to compile the test program.  Guessing big-endian...)
16156 EOM
16157                 fi
16158                 case "$xxx_prompt" in
16159                 y)
16160                         rp="What is the order of bytes in $uvtype?"
16161                         . ./myread
16162                         byteorder="$ans"
16163                         ;;
16164                 *)      byteorder=$dflt
16165                         ;;
16166                 esac
16167                 ;;
16168         esac
16169         $rm -f try.c try
16170         ;;
16171 esac
16172
16173
16174 $cat <<EOM
16175
16176 Checking to see whether you can access character data unalignedly...
16177 EOM
16178 case "$d_u32align" in
16179 '')   $cat >try.c <<EOCP
16180 #include <stdio.h>
16181 #define U32 $u32type
16182 #define BYTEORDER 0x$byteorder
16183 #define U8 $u8type
16184 #include <signal.h>
16185 #ifdef SIGBUS
16186 $signal_t bletch(s) int s; { exit(4); }
16187 #endif
16188 int main() {
16189 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16190     U8 buf[8];
16191     U32 *up;
16192     int i;
16193
16194     if (sizeof(U32) != 4) {
16195         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16196         exit(1);
16197     }
16198
16199     fflush(stdout);
16200
16201 #ifdef SIGBUS
16202     signal(SIGBUS, bletch);
16203 #endif
16204
16205     buf[0] = 0;
16206     buf[1] = 0;
16207     buf[2] = 0;
16208     buf[3] = 1;
16209     buf[5] = 0;
16210     buf[6] = 0;
16211     buf[7] = 0;
16212     buf[8] = 1;
16213
16214     for (i = 0; i < 4; i++) {
16215         up = (U32*)(buf + i);
16216         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16217                (*up == 1 << (8*(3-i)))  /* little-endian */
16218               )
16219            )
16220         {
16221             printf("read failed (%x)\n", *up);
16222             exit(2);
16223         }
16224     }
16225
16226     /* write test */
16227     for (i = 0; i < 4; i++) {
16228         up = (U32*)(buf + i);
16229         *up = 0xBeef;
16230         if (*up != 0xBeef) {
16231             printf("write failed (%x)\n", *up);
16232             exit(3);
16233         }
16234     }
16235
16236     exit(0);
16237 #else
16238     printf("1\n");
16239     exit(1);
16240 #endif
16241     return 0;
16242 }
16243 EOCP
16244 set try
16245 if eval $compile_ok; then
16246         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16247         $run ./try 2>&1 >/dev/null
16248         case "$?" in
16249         0)      cat >&4 <<EOM
16250 You can access character data pretty unalignedly.
16251 EOM
16252                 d_u32align="$undef"
16253                 ;;
16254         *)      cat >&4 <<EOM
16255 It seems that you must access character data in an aligned manner.
16256 EOM
16257                 d_u32align="$define"
16258                 ;;
16259         esac
16260 else
16261         rp='Can you access character data at unaligned addresses?'
16262         dflt='n'
16263         . ./myread
16264         case "$ans" in
16265         [yY]*)  d_u32align="$undef"  ;;
16266         *)      d_u32align="$define" ;;
16267         esac
16268 fi
16269 $rm -f core core.try.* try.core
16270 ;;
16271 esac
16272
16273 : see if ualarm exists
16274 set ualarm d_ualarm
16275 eval $inlibc
16276
16277 : see if umask exists
16278 set umask d_umask
16279 eval $inlibc
16280
16281 : see if unordered exists
16282 set unordered d_unordered
16283 eval $inlibc
16284
16285 : see if usleep exists
16286 set usleep d_usleep
16287 eval $inlibc
16288
16289 : see if prototype for usleep is available
16290 echo " "
16291 set d_usleepproto usleep $i_unistd unistd.h
16292 eval $hasproto
16293
16294 : see if ustat exists
16295 set ustat d_ustat
16296 eval $inlibc
16297
16298 : backward compatibility for d_hvfork
16299 if test X$d_hvfork != X; then
16300         d_vfork="$d_hvfork"
16301         d_hvfork=''
16302 fi
16303 : see if there is a vfork
16304 val=''
16305 set vfork val
16306 eval $inlibc
16307
16308 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16309 : perl on Solaris 2.x, and probably elsewhere.
16310 case "$val" in
16311 $define)
16312         echo " "
16313         case "$usevfork" in
16314         false) dflt='n';;
16315         *) dflt='y';;
16316         esac
16317         cat <<'EOM'
16318  
16319 Perl can only use a vfork() that doesn't suffer from strict
16320 restrictions on calling functions or modifying global data in
16321 the child.  For example, glibc-2.1 contains such a vfork()
16322 that is unsuitable.  If your system provides a proper fork()
16323 call, chances are that you do NOT want perl to use vfork().
16324
16325 EOM
16326         rp="Do you still want to use vfork()?"
16327         . ./myread
16328         case "$ans" in
16329         y|Y) ;;
16330         *)
16331                 echo "Ok, we won't use vfork()."
16332                 val="$undef"
16333                 ;;
16334         esac
16335         ;;
16336 esac
16337 set d_vfork
16338 eval $setvar
16339 case "$d_vfork" in
16340 $define) usevfork='true';;
16341 *) usevfork='false';;
16342 esac
16343
16344 : see if closedir exists
16345 set closedir d_closedir
16346 eval $inlibc
16347
16348 case "$d_closedir" in
16349 "$define")
16350         echo " "
16351         echo "Checking whether closedir() returns a status..." >&4
16352         cat > try.c <<EOM
16353 #$i_dirent I_DIRENT             /**/
16354 #$i_sysdir I_SYS_DIR            /**/
16355 #$i_sysndir I_SYS_NDIR          /**/
16356 #$i_systypes I_SYS_TYPES        /**/
16357
16358 #if defined(I_SYS_TYPES)
16359 #include <sys/types.h>
16360 #endif
16361 #if defined(I_DIRENT)
16362 #include <dirent.h>
16363 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16364 #include <sys/dir.h>
16365 #endif
16366 #else
16367 #ifdef I_SYS_NDIR
16368 #include <sys/ndir.h>
16369 #else
16370 #ifdef I_SYS_DIR
16371 #ifdef hp9000s500
16372 #include <ndir.h>       /* may be wrong in the future */
16373 #else
16374 #include <sys/dir.h>
16375 #endif
16376 #endif
16377 #endif
16378 #endif 
16379 int main() { return closedir(opendir(".")); }
16380 EOM
16381         set try
16382         if eval $compile_ok; then
16383                 if $run ./try > /dev/null 2>&1 ; then
16384                         echo "Yes, it does."
16385                         val="$undef"
16386                 else
16387                         echo "No, it doesn't."
16388                         val="$define"
16389                 fi
16390         else
16391                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16392                 val="$define"
16393         fi
16394         ;;
16395 *)
16396         val="$undef";
16397         ;;
16398 esac
16399 set d_void_closedir
16400 eval $setvar
16401 $rm -f try try.*
16402 : see if there is a wait4
16403 set wait4 d_wait4
16404 eval $inlibc
16405
16406 : see if waitpid exists
16407 set waitpid d_waitpid
16408 eval $inlibc
16409
16410 : see if wcstombs exists
16411 set wcstombs d_wcstombs
16412 eval $inlibc
16413
16414 : see if wctomb exists
16415 set wctomb d_wctomb
16416 eval $inlibc
16417
16418 : see if writev exists
16419 set writev d_writev
16420 eval $inlibc
16421
16422 : preserve RCS keywords in files with variable substitution, grrr
16423 Date='$Date'
16424 Id='$Id'
16425 Log='$Log'
16426 RCSfile='$RCSfile'
16427 Revision='$Revision'
16428
16429 : check for alignment requirements
16430 echo " "
16431 case "$usecrosscompile$multiarch" in
16432 *$define*)
16433         $cat <<EOM
16434 You seem to be either cross-compiling or doing a multiarchitecture build,
16435 skipping the memory alignment check.
16436
16437 EOM
16438         case "$alignbytes" in
16439         '') alignbytes=8 ;;
16440         esac
16441         ;;
16442 *)
16443         case "$alignbytes" in
16444         '') echo "Checking alignment constraints..." >&4
16445                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16446                         $cat >try.c <<'EOCP'
16447 typedef long double NV;
16448 EOCP
16449                 else
16450                         $cat >try.c <<'EOCP'
16451 typedef double NV;
16452 EOCP
16453                 fi
16454                 $cat >>try.c <<'EOCP'
16455 #include <stdio.h>
16456 struct foobar {
16457         char foo;
16458         NV bar;
16459 } try_algn;
16460 int main()
16461 {
16462     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16463     return(0);
16464 }
16465 EOCP
16466                 set try
16467                 if eval $compile_ok; then
16468                         dflt=`$run ./try`
16469                 else
16470                         dflt='8'
16471                         echo "(I can't seem to compile the test program...)"
16472                 fi
16473                 ;;
16474         *) dflt="$alignbytes"
16475                 ;;
16476         esac
16477         rp="Doubles must be aligned on a how-many-byte boundary?"
16478         . ./myread
16479         alignbytes="$ans"
16480         $rm -f try.c try
16481         ;;
16482 esac
16483
16484
16485 : set the base revision
16486 baserev=5.0
16487
16488 : how do we catenate cpp tokens here?
16489 echo " "
16490 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16491 $cat >cpp_stuff.c <<'EOCP'
16492 #define RCAT(a,b)a/**/b
16493 #define ACAT(a,b)a ## b
16494 RCAT(Rei,ser)
16495 ACAT(Cir,cus)
16496 EOCP
16497 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16498 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16499         echo "Oh!  Smells like ANSI's been here." >&4
16500         echo "We can catify or stringify, separately or together!"
16501         cpp_stuff=42
16502 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16503         echo "Ah, yes!  The good old days!" >&4
16504         echo "However, in the good old days we don't know how to stringify and"
16505         echo "catify at the same time."
16506         cpp_stuff=1
16507 else
16508         $cat >&4 <<EOM
16509 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16510 to have to edit the values of CAT[2-5] in config.h...
16511 EOM
16512         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16513 fi
16514 $rm -f cpp_stuff.*
16515
16516 : see if this is a db.h system
16517 set db.h i_db
16518 eval $inhdr
16519
16520 case "$i_db" in
16521 $define)
16522         : Check db version.
16523         echo " "
16524         echo "Checking Berkeley DB version ..." >&4
16525         $cat >try.c <<EOCP
16526 #$d_const HASCONST
16527 #ifndef HASCONST
16528 #define const
16529 #endif
16530 #include <sys/types.h>
16531 #include <stdio.h>
16532 #include <db.h>
16533 int main(int argc, char *argv[])
16534 {
16535 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16536     int Major, Minor, Patch ;
16537     unsigned long Version ;
16538     (void)db_version(&Major, &Minor, &Patch) ;
16539     if (argc == 2) {
16540         printf("%d %d %d %d %d %d\n",
16541                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16542                Major, Minor, Patch);
16543         exit(0);
16544     }
16545     printf("You have Berkeley DB Version 2 or greater.\n");
16546
16547     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16548                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16549     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16550                 Major, Minor, Patch) ;
16551
16552     /* check that db.h & libdb are compatible */
16553     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16554         printf("db.h and libdb are incompatible.\n") ;
16555         exit(3);        
16556     }
16557
16558     printf("db.h and libdb are compatible.\n") ;
16559
16560     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16561                 + DB_VERSION_PATCH ;
16562
16563     /* needs to be >= 2.3.4 */
16564     if (Version < 2003004) {
16565     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16566         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16567         exit(2);        
16568     }
16569
16570     exit(0);
16571 #else
16572 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16573     if (argc == 2) {
16574         printf("1 0 0\n");
16575         exit(0);
16576     }
16577     printf("You have Berkeley DB Version 1.\n");
16578     exit(0);    /* DB version < 2: the coast is clear. */
16579 #else
16580     exit(1);    /* <db.h> not Berkeley DB? */
16581 #endif
16582 #endif
16583 }
16584 EOCP
16585         set try
16586         if eval $compile_ok && $run ./try; then
16587                 echo 'Looks OK.' >&4
16588                 set `$run ./try 1`
16589                 db_version_major=$1
16590                 db_version_minor=$2
16591                 db_version_patch=$3
16592         else
16593                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16594                 i_db=$undef
16595                 case " $libs " in
16596                 *"-ldb "*)
16597                         : Remove db from list of libraries to use
16598                         echo "Removing unusable -ldb from library list" >&4
16599                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16600                         shift
16601                         libs="$*"
16602                         echo "libs = $libs" >&4
16603                         ;;
16604                 esac
16605         fi
16606         $rm -f try.*
16607         ;;
16608 esac
16609
16610 case "$i_db" in
16611 define)
16612         : Check the return type needed for hash 
16613         echo " "
16614         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16615         $cat >try.c <<EOCP
16616 #$d_const HASCONST
16617 #ifndef HASCONST
16618 #define const
16619 #endif
16620 #include <sys/types.h>
16621 #include <db.h>
16622
16623 #ifndef DB_VERSION_MAJOR
16624 u_int32_t hash_cb (ptr, size)
16625 const void *ptr;
16626 size_t size;
16627 {
16628 }
16629 HASHINFO info;
16630 int main()
16631 {
16632         info.hash = hash_cb;
16633 }
16634 #endif
16635 EOCP
16636         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16637                 if $contains warning try.out >>/dev/null 2>&1 ; then
16638                         db_hashtype='int'
16639                 else
16640                         db_hashtype='u_int32_t'
16641                 fi
16642         else
16643                 : XXX Maybe we should just give up here.
16644                 db_hashtype=u_int32_t
16645                 $cat try.out >&4
16646                 echo "Help:  I can't seem to compile the db test program." >&4
16647                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16648         fi
16649         $rm -f try.*
16650         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16651         ;;
16652 *)      db_hashtype=u_int32_t
16653         ;;
16654 esac
16655 case "$i_db" in
16656 define)
16657         : Check the return type needed for prefix 
16658         echo " "
16659         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16660         cat >try.c <<EOCP
16661 #$d_const HASCONST
16662 #ifndef HASCONST
16663 #define const
16664 #endif
16665 #include <sys/types.h>
16666 #include <db.h>
16667
16668 #ifndef DB_VERSION_MAJOR
16669 size_t prefix_cb (key1, key2)
16670 const DBT *key1;
16671 const DBT *key2;
16672 {
16673 }
16674 BTREEINFO info;
16675 int main()
16676 {
16677         info.prefix = prefix_cb;
16678 }
16679 #endif
16680 EOCP
16681         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16682                 if $contains warning try.out >>/dev/null 2>&1 ; then
16683                         db_prefixtype='int'
16684                 else
16685                         db_prefixtype='size_t'
16686                 fi
16687         else
16688                 db_prefixtype='size_t'
16689                 : XXX Maybe we should just give up here.
16690                 $cat try.out >&4
16691                 echo "Help:  I can't seem to compile the db test program." >&4
16692                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16693         fi
16694         $rm -f try.*
16695         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16696         ;;
16697 *)      db_prefixtype='size_t'
16698         ;;
16699 esac
16700
16701
16702 : How can we generate normalized random numbers ?
16703 echo " "
16704 echo "Looking for a random number function..." >&4
16705 case "$randfunc" in
16706 '')
16707         if set drand48 val -f; eval $csym; $val; then
16708                 dflt="drand48"
16709                 echo "Good, found drand48()." >&4
16710         elif set random val -f; eval $csym; $val; then
16711                 dflt="random"
16712                 echo "OK, found random()." >&4
16713         else
16714                 dflt="rand"
16715                 echo "Yick, looks like I have to use rand()." >&4
16716         fi
16717         echo " "
16718         ;;
16719 *)
16720         dflt="$randfunc"
16721         ;;
16722 esac
16723 cont=true
16724
16725 case "$ccflags" in
16726 *-Dmy_rand=*|*-Dmy_srand=*)
16727         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16728         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16729         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16730         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16731         ;;
16732 esac
16733
16734 while $test "$cont"; do
16735         rp="Use which function to generate random numbers?"
16736         . ./myread
16737         if $test "$ans" = "$dflt"; then
16738                 : null
16739         else
16740                 randbits=''
16741         fi
16742         randfunc="$ans"
16743         if set $ans val -f; eval $csym; $val; then
16744                 cont=''
16745         else
16746                 dflt=y
16747                 rp="I cannot find function $ans. Use that name anyway?"
16748                 . ./myread
16749                 dflt=rand
16750                 case "$ans" in
16751                         [yY]*) cont='';;
16752                 esac
16753         fi
16754         case "$cont" in
16755         '')
16756                 case "$randfunc" in
16757                 drand48)
16758                         drand01="drand48()"
16759                         seedfunc="srand48"
16760                         randbits=48
16761                         randseedtype=long
16762                         ;;
16763                 rand|random)
16764                         case "$randbits" in
16765                         '')
16766 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16767                                 $cat >try.c <<EOCP
16768 #$i_unistd I_UNISTD
16769 #$i_stdlib I_STDLIB
16770 #include <stdio.h>
16771 #ifdef I_UNISTD
16772 #  include <unistd.h>
16773 #endif
16774 #ifdef I_STDLIB
16775 #  include <stdlib.h>
16776 #endif
16777 int main()
16778 {
16779         register int i;
16780         register unsigned long tmp;
16781         register unsigned long max = 0L;
16782
16783         for (i = 1000; i; i--) {
16784                 tmp = (unsigned long) $randfunc();
16785                 if (tmp > max) max = tmp;
16786         }
16787         for (i = 0; max; i++)
16788                 max /= 2;
16789         printf("%d\n",i);
16790 }
16791 EOCP
16792                                 set try
16793                                 if eval $compile_ok; then
16794                                         dflt=`try`
16795                                 else
16796                                         dflt='?'
16797                                         echo "(I can't seem to compile the test program...)"
16798                                 fi
16799                                 ;;
16800                         *)
16801                                 dflt="$randbits"
16802                                 ;;
16803                         esac
16804                         rp="How many bits does your $randfunc() function produce?"
16805                         . ./myread
16806                         randbits="$ans"
16807                         $rm -f try.c try
16808                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16809                         seedfunc="s$randfunc"
16810                         randseedtype=unsigned
16811                         ;;
16812                 *)
16813                         dflt="31"
16814                         rp="How many bits does your $randfunc() function produce?"
16815                         . ./myread
16816                         randbits="$ans"
16817                         seedfunc="s$randfunc"
16818                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16819                         if set $seedfunc val -f; eval $csym; $val; then
16820                                 echo "(Using $seedfunc() to seed random generator)"
16821                         else
16822                                 echo "(Warning: no $seedfunc() to seed random generator)"
16823                                 seedfunc=rand
16824                         fi
16825                         randseedtype=unsigned
16826                         ;;
16827                 esac
16828                 ;;
16829         esac
16830 done
16831
16832 echo " "
16833 echo "Determining whether or not we are on an EBCDIC system..." >&4
16834 $cat >try.c <<'EOM'
16835 int main()
16836 {
16837   if ('M'==0xd4) return 0;
16838   return 1;
16839 }
16840 EOM
16841
16842 val=$undef
16843 set try
16844 if eval $compile_ok; then
16845         if $run ./try; then
16846                 echo "You seem to speak EBCDIC." >&4
16847                 val="$define"
16848         else
16849                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16850         fi
16851 else
16852         echo "I'm unable to compile the test program." >&4
16853         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16854 fi
16855 $rm -f try try.*
16856 set ebcdic
16857 eval $setvar
16858
16859 echo " "
16860 $cat >&4 <<EOM
16861 Checking how to flush all pending stdio output...
16862 EOM
16863 # I only know how to find the first 32 possibly open files on SunOS.
16864 # See also hints/sunos_4_1.sh and util.c  --AD
16865 case "$osname" in
16866 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16867 esac
16868 $cat >>try.c <<EOCP
16869 #include <stdio.h>
16870 #$i_unistd I_UNISTD
16871 #ifdef I_UNISTD
16872 # include <unistd.h>
16873 #endif
16874 #$d_sysconf HAS_SYSCONF
16875 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16876 #ifdef HAS_STDIO_STREAM_ARRAY
16877 # define STDIO_STREAM_ARRAY $stdio_stream_array
16878 #endif
16879 int main() {
16880   FILE* p;
16881   unlink("try.out");
16882   p = fopen("try.out", "w");
16883 #ifdef TRY_FPUTC
16884   fputc('x', p);
16885 #else
16886 # ifdef TRY_FPRINTF
16887   fprintf(p, "x");
16888 # endif
16889 #endif
16890 #ifdef TRY_FFLUSH_NULL
16891   fflush(NULL);
16892 #endif
16893 #ifdef TRY_FFLUSH_ALL
16894   {
16895     long open_max = -1;
16896 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16897     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16898 # else
16899 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16900     open_max = sysconf(_SC_OPEN_MAX);
16901 #  else
16902 #   ifdef FOPEN_MAX
16903     open_max = FOPEN_MAX;
16904 #   else
16905 #    ifdef OPEN_MAX
16906     open_max = OPEN_MAX;
16907 #    else
16908 #     ifdef _NFILE
16909     open_max = _NFILE;
16910 #     endif
16911 #    endif
16912 #   endif
16913 #  endif
16914 # endif 
16915 # ifdef HAS_STDIO_STREAM_ARRAY
16916     if (open_max > 0) {
16917       long i;
16918       for (i = 0; i < open_max; i++)
16919             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16920                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16921                 STDIO_STREAM_ARRAY[i]._flag)
16922                 fflush(&STDIO_STREAM_ARRAY[i]);
16923     }   
16924   }
16925 # endif
16926 #endif
16927   _exit(42);
16928 }
16929 EOCP
16930 : first we have to find out how _not_ to flush
16931 $to try.c
16932 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16933     output=''
16934     set try -DTRY_FPUTC
16935     if eval $compile; then
16936             $run ./try 2>/dev/null
16937             code="$?"
16938             $from try.out
16939             if $test ! -s try.out -a "X$code" = X42; then
16940                 output=-DTRY_FPUTC
16941             fi
16942     fi
16943     case "$output" in
16944     '')
16945             set try -DTRY_FPRINTF
16946             if eval $compile; then
16947                     $run ./try 2>/dev/null
16948                     code="$?"
16949                     $from try.out
16950                     if $test ! -s try.out -a "X$code" = X42; then
16951                         output=-DTRY_FPRINTF
16952                     fi
16953             fi
16954         ;;
16955     esac
16956 fi
16957 : check for fflush NULL behaviour
16958 case "$fflushNULL" in
16959 '')     set try -DTRY_FFLUSH_NULL $output
16960         if eval $compile; then
16961                 $run ./try 2>/dev/null
16962                 code="$?"
16963                 $from try.out
16964                 if $test -s try.out -a "X$code" = X42; then
16965                         fflushNULL="`$cat try.out`"
16966                 else
16967                         if $test "X$code" != X42; then
16968                                 $cat >&4 <<EOM
16969 (If this test failed, don't worry, we'll try another method shortly.)
16970 EOM
16971                         fi
16972                 fi
16973         fi
16974         $rm -f core try.core core.try.*
16975         case "$fflushNULL" in
16976         x)      $cat >&4 <<EOM
16977 Your fflush(NULL) works okay for output streams.
16978 Let's see if it clobbers input pipes...
16979 EOM
16980 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16981 # bug that improperly flushes the input end of pipes.  So we avoid the
16982 # autoflush on fork/system/exec support for now. :-(
16983 $cat >tryp.c <<EOCP
16984 #include <stdio.h>
16985 int
16986 main(int argc, char **argv)
16987 {
16988     char buf[1024];
16989     int i;
16990     char *bp = buf;
16991     while (1) {
16992         while ((i = getc(stdin)) != -1
16993                && (*bp++ = i) != '\n'
16994                && bp < &buf[1024])
16995         /* DO NOTHING */ ;
16996         *bp = '\0';
16997         fprintf(stdout, "%s", buf);
16998         fflush(NULL);
16999         if (i == -1)
17000             return 0;
17001         bp = buf;
17002     }
17003 }
17004 EOCP
17005                 fflushNULL="$define"
17006                 set tryp
17007                 if eval $compile; then
17008                     $rm -f tryp.out
17009                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17010                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17011                        $cat >&4 <<EOM
17012 fflush(NULL) seems to behave okay with input streams.
17013 EOM
17014                         fflushNULL="$define"
17015                     else
17016                         $cat >&4 <<EOM
17017 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17018 EOM
17019                         fflushNULL="$undef"
17020                     fi
17021                 fi
17022                 $rm -f core tryp.c tryp.core core.tryp.*
17023                 ;;
17024         '')     $cat >&4 <<EOM
17025 Your fflush(NULL) isn't working (contrary to ANSI C).
17026 EOM
17027                 fflushNULL="$undef"
17028                 ;;
17029         *)      $cat >&4 <<EOM
17030 Cannot figure out whether your fflush(NULL) works or not.
17031 I'm assuming it doesn't (contrary to ANSI C).
17032 EOM
17033                 fflushNULL="$undef"
17034                 ;;
17035         esac
17036         ;;
17037 $define|true|[yY]*)
17038         fflushNULL="$define"
17039         ;;
17040 *)
17041         fflushNULL="$undef"
17042         ;;
17043 esac
17044 : check explicit looping only if NULL did not work, and if the pipe
17045 : bug does not show up on an explicit flush too
17046 case "$fflushNULL" in
17047 "$undef")
17048         $cat >tryp.c <<EOCP
17049 #include <stdio.h>
17050 int
17051 main(int argc, char **argv)
17052 {
17053     char buf[1024];
17054     int i;
17055     char *bp = buf;
17056     while (1) {
17057         while ((i = getc(stdin)) != -1
17058                && (*bp++ = i) != '\n'
17059                && bp < &buf[1024])
17060         /* DO NOTHING */ ;
17061         *bp = '\0';
17062         fprintf(stdout, "%s", buf);
17063         fflush(stdin);
17064         if (i == -1)
17065             return 0;
17066         bp = buf;
17067     }
17068 }
17069 EOCP
17070         set tryp
17071         if eval $compile; then
17072             $rm -f tryp.out
17073             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17074             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17075                $cat >&4 <<EOM
17076 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17077 EOM
17078                 : now check for fflushall behaviour
17079                 case "$fflushall" in
17080                 '')     set try -DTRY_FFLUSH_ALL $output
17081                         if eval $compile; then
17082                                 $cat >&4 <<EOM
17083 (Now testing the other method--but note that this also may fail.)
17084 EOM
17085                                 $run ./try 2>/dev/null
17086                                 code=$?
17087                                 $from try.out
17088                                 if $test -s try.out -a "X$code" = X42; then
17089                                         fflushall="`$cat try.out`"
17090                                 fi
17091                         fi
17092                         $rm -f core try.core core.try.*
17093                         case "$fflushall" in
17094                         x)      $cat >&4 <<EOM
17095 Whew. Flushing explicitly all the stdio streams works.
17096 EOM
17097                                 fflushall="$define"
17098                                 ;;
17099                         '')     $cat >&4 <<EOM
17100 Sigh. Flushing explicitly all the stdio streams doesn't work.
17101 EOM
17102                                 fflushall="$undef"
17103                                 ;;
17104                         *)      $cat >&4 <<EOM
17105 Cannot figure out whether flushing stdio streams explicitly works or not.
17106 I'm assuming it doesn't.
17107 EOM
17108                                 fflushall="$undef"
17109                                 ;;
17110                         esac
17111                         ;;
17112                 "$define"|true|[yY]*)
17113                         fflushall="$define"
17114                         ;;
17115                 *)
17116                         fflushall="$undef"
17117                         ;;
17118                 esac
17119             else
17120                 $cat >&4 <<EOM
17121 All is futile.  Even fflush(stdin) clobbers input pipes!
17122 EOM
17123                 fflushall="$undef"
17124             fi
17125         else
17126             fflushall="$undef"
17127         fi
17128         $rm -f core tryp.c tryp.core core.tryp.*
17129         ;;
17130 *)      fflushall="$undef"
17131         ;;
17132 esac
17133
17134 case "$fflushNULL$fflushall" in
17135 undefundef)
17136         $cat <<EOM
17137 OK, I give up.  I cannot figure out how to flush pending stdio output.
17138 We won't be flushing handles at all before fork/exec/popen.
17139 EOM
17140         ;;
17141 esac
17142 $rm -f try.* try$exe_ext
17143
17144 : Store the full pathname to the ar program for use in the C program
17145 : Respect a hint or command line value for full_ar.
17146 case "$full_ar" in
17147 '') full_ar=$ar ;;
17148 esac
17149
17150 : Store the full pathname to the sed program for use in the C program
17151 full_sed=$sed
17152
17153 : see what type gids are declared as in the kernel
17154 echo " "
17155 echo "Looking for the type for group ids returned by getgid()."
17156 set gid_t gidtype xxx stdio.h sys/types.h
17157 eval $typedef
17158 case "$gidtype" in
17159 xxx)
17160         xxx=`./findhdr sys/user.h`
17161         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17162         case $1 in
17163         unsigned) dflt="$1 $2" ;;
17164         *) dflt="$1" ;;
17165         esac
17166         ;;
17167 *) dflt="$gidtype";;
17168 esac
17169 case "$gidtype" in
17170 gid_t) echo "gid_t found." ;;
17171 *)      rp="What is the type for group ids returned by getgid()?"
17172         . ./myread
17173         gidtype="$ans"
17174         ;;
17175 esac
17176
17177 echo " "
17178 case "$gidtype" in
17179 *_t) zzz="$gidtype"     ;;
17180 *)   zzz="gid"          ;;
17181 esac
17182 echo "Checking the size of $zzz..." >&4 
17183 cat > try.c <<EOCP
17184 #include <sys/types.h>
17185 #include <stdio.h>
17186 int main() {
17187     printf("%d\n", (int)sizeof($gidtype));
17188     exit(0);
17189 }
17190 EOCP
17191 set try
17192 if eval $compile_ok; then
17193         yyy=`$run ./try`
17194         case "$yyy" in
17195         '')     gidsize=4
17196                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17197                 ;;
17198         *)      gidsize=$yyy
17199                 echo "Your $zzz is $gidsize bytes long."
17200                 ;;
17201         esac
17202 else
17203         gidsize=4
17204         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17205 fi
17206
17207
17208 echo " "
17209 case "$gidtype" in
17210 *_t) zzz="$gidtype"     ;;
17211 *)   zzz="gid"          ;;
17212 esac
17213 echo "Checking the sign of $zzz..." >&4 
17214 cat > try.c <<EOCP
17215 #include <sys/types.h>
17216 #include <stdio.h>
17217 int main() {
17218         $gidtype foo = -1;
17219         if (foo < 0)
17220                 printf("-1\n");
17221         else
17222                 printf("1\n");
17223 }
17224 EOCP
17225 set try
17226 if eval $compile; then
17227         yyy=`$run ./try`
17228         case "$yyy" in
17229         '')     gidsign=1
17230                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17231                 ;;
17232         *)      gidsign=$yyy
17233                 case "$gidsign" in
17234                  1) echo "Your $zzz is unsigned." ;;
17235                 -1) echo "Your $zzz is signed."   ;;
17236                 esac
17237                 ;;
17238         esac
17239 else
17240         gidsign=1
17241         echo "(I can't compile the test program--guessing unsigned.)" >&4
17242 fi
17243
17244
17245 echo " "
17246
17247 if $test X"$quadtype" != X; then
17248
17249 echo "Checking how to print 64-bit integers..." >&4
17250
17251 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17252         $cat >try.c <<'EOCP'
17253 #include <sys/types.h>
17254 #include <stdio.h>
17255 int main() {
17256   int q = 12345678901;
17257   printf("%ld\n", q);
17258 }
17259 EOCP
17260         set try
17261         if eval $compile; then
17262                 yyy=`$run ./try`
17263                 case "$yyy" in
17264                 12345678901)
17265                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17266                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17267                         echo "We will use %d."
17268                         ;;
17269                 esac
17270         fi
17271 fi
17272
17273 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17274         $cat >try.c <<'EOCP'
17275 #include <sys/types.h>
17276 #include <stdio.h>
17277 int main() {
17278   long q = 12345678901;
17279   printf("%ld\n", q);
17280 }
17281 EOCP
17282         set try
17283         if eval $compile; then
17284                 yyy=`$run ./try`
17285                 case "$yyy" in
17286                 12345678901)
17287                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17288                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17289                         echo "We will use %ld."
17290                         ;;
17291                 esac
17292         fi
17293 fi
17294
17295 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17296         $cat >try.c <<'EOCP'
17297 #include <sys/types.h>
17298 #include <inttypes.h>
17299 #include <stdio.h>
17300 int main() {
17301   int64_t q = 12345678901;
17302   printf("%" PRId64 "\n", q);
17303 }
17304 EOCP
17305         set try
17306         if eval $compile; then
17307                 yyy=`$run ./try`
17308                 case "$yyy" in
17309                 12345678901)
17310                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17311                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17312                         echo "We will use the C9X style."
17313                         ;;
17314                 esac
17315         fi
17316 fi
17317
17318 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17319         $cat >try.c <<EOCP
17320 #include <sys/types.h>
17321 #include <stdio.h>
17322 int main() {
17323   $quadtype q = 12345678901;
17324   printf("%Ld\n", q);
17325 }
17326 EOCP
17327         set try
17328         if eval $compile; then
17329                 yyy=`$run ./try`
17330                 case "$yyy" in
17331                 12345678901)
17332                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17333                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17334                         echo "We will use %Ld."
17335                         ;;
17336                 esac
17337         fi
17338 fi
17339
17340 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17341         $cat >try.c <<'EOCP'
17342 #include <sys/types.h>
17343 #include <stdio.h>
17344 int main() {
17345   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17346   printf("%lld\n", q);
17347 }
17348 EOCP
17349         set try
17350         if eval $compile; then
17351                 yyy=`$run ./try`
17352                 case "$yyy" in
17353                 12345678901)
17354                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17355                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17356                         echo "We will use the %lld style."
17357                         ;;
17358                 esac
17359         fi
17360 fi
17361
17362 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17363         $cat >try.c <<EOCP
17364 #include <sys/types.h>
17365 #include <stdio.h>
17366 int main() {
17367   $quadtype q = 12345678901;
17368   printf("%qd\n", q);
17369 }
17370 EOCP
17371         set try
17372         if eval $compile; then
17373                 yyy=`$run ./try`
17374                 case "$yyy" in
17375                 12345678901)
17376                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17377                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17378                         echo "We will use %qd."
17379                         ;;
17380                 esac
17381         fi
17382 fi
17383
17384 if $test X"$sPRId64" = X; then
17385         echo "Cannot figure out how to print 64-bit integers." >&4
17386 fi
17387
17388 $rm -f try try.*
17389
17390 fi
17391
17392 case "$sPRId64" in
17393 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17394         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17395         ;;
17396 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17397         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17398         ;;
17399 esac
17400
17401
17402 echo " "
17403 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17404
17405 if $test X"$ivsize" = X8; then
17406         ivdformat="$sPRId64"
17407         uvuformat="$sPRIu64"
17408         uvoformat="$sPRIo64"
17409         uvxformat="$sPRIx64"
17410         uvXUformat="$sPRIXU64"
17411 else
17412         if $test X"$ivsize" = X"$longsize"; then
17413                 ivdformat='"ld"'
17414                 uvuformat='"lu"'
17415                 uvoformat='"lo"'
17416                 uvxformat='"lx"'
17417                 uvXUformat='"lX"'
17418         else
17419                 if $test X"$ivsize" = X"$intsize"; then
17420                         ivdformat='"d"'
17421                         uvuformat='"u"'
17422                         uvoformat='"o"'
17423                         uvxformat='"x"'
17424                         uvXUformat='"X"'
17425                 else
17426                         : far out
17427                         if $test X"$ivsize" = X"$shortsize"; then
17428                                 ivdformat='"hd"'
17429                                 uvuformat='"hu"'
17430                                 uvoformat='"ho"'
17431                                 uvxformat='"hx"'
17432                                 uvXUformat='"hX"'
17433                         fi
17434                 fi
17435         fi
17436 fi
17437
17438 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17439         nveformat="$sPRIeldbl"
17440         nvfformat="$sPRIfldbl"
17441         nvgformat="$sPRIgldbl"
17442         nvEUformat="$sPRIEUldbl"
17443         nvFUformat="$sPRIFUldbl"
17444         nvGUformat="$sPRIGUldbl"
17445 else
17446         nveformat='"e"'
17447         nvfformat='"f"'
17448         nvgformat='"g"'
17449         nvEUformat='"E"'
17450         nvFUformat='"F"'
17451         nvGUformat='"G"'
17452 fi
17453
17454 case "$ivdformat" in
17455 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17456     exit 1
17457     ;;
17458 esac
17459
17460
17461 echo " "
17462 $echo "Checking the format string to be used for gids..." >&4
17463
17464 case "$gidsign" in
17465 -1)     if $test X"$gidsize" = X"$ivsize"; then
17466                 gidformat="$ivdformat"
17467         else
17468                 if $test X"$gidsize" = X"$longsize"; then
17469                         gidformat='"ld"'
17470                 else
17471                         if $test X"$gidsize" = X"$intsize"; then
17472                                 gidformat='"d"'
17473                         else
17474                                 if $test X"$gidsize" = X"$shortsize"; then
17475                                         gidformat='"hd"'
17476                                 fi
17477                         fi
17478                 fi
17479         fi
17480         ;;
17481 *)      if $test X"$gidsize" = X"$uvsize"; then
17482                 gidformat="$uvuformat"
17483         else
17484                 if $test X"$gidsize" = X"$longsize"; then
17485                         gidformat='"lu"'
17486                 else
17487                         if $test X"$gidsize" = X"$intsize"; then
17488                                 gidformat='"u"'
17489                         else
17490                                 if $test X"$gidsize" = X"$shortsize"; then
17491                                         gidformat='"hu"'
17492                                 fi
17493                         fi
17494                 fi
17495         fi
17496         ;;
17497 esac
17498
17499 : see if getgroups exists
17500 set getgroups d_getgrps
17501 eval $inlibc
17502
17503 : see if setgroups exists
17504 set setgroups d_setgrps
17505 eval $inlibc
17506
17507
17508 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17509 echo " "
17510 case "$d_getgrps$d_setgrps" in
17511 *define*)
17512         case "$groupstype" in
17513         '') dflt="$gidtype" ;;
17514         *)  dflt="$groupstype" ;;
17515         esac
17516         $cat <<EOM
17517 What type of pointer is the second argument to getgroups() and setgroups()?
17518 Usually this is the same as group ids, $gidtype, but not always.
17519
17520 EOM
17521         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17522         . ./myread
17523         groupstype="$ans"
17524         ;;
17525 *)  groupstype="$gidtype";;
17526 esac
17527
17528 echo " "
17529 echo "Checking if your $make program sets \$(MAKE)..." >&4
17530 case "$make_set_make" in
17531 '')
17532         $sed 's/^X //' > testmake.mak << 'EOF'
17533 Xall:
17534 X       @echo 'maketemp="$(MAKE)"'
17535 EOF
17536         case "`$make -f testmake.mak 2>/dev/null`" in
17537         *maketemp=*) make_set_make='#' ;;
17538         *)      make_set_make="MAKE=$make" ;;
17539         esac
17540         $rm -f testmake.mak
17541         ;;
17542 esac
17543 case "$make_set_make" in
17544 '#') echo "Yup, it does.";;
17545 *) echo "Nope, it doesn't.";;
17546 esac
17547
17548 : see what type is used for mode_t
17549 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17550 set mode_t modetype int stdio.h sys/types.h
17551 eval $typedef_ask
17552
17553 : see if stdarg is available
17554 echo " "
17555 if $test `./findhdr stdarg.h`; then
17556         echo "<stdarg.h> found." >&4
17557         valstd="$define"
17558 else
17559         echo "<stdarg.h> NOT found." >&4
17560         valstd="$undef"
17561 fi
17562
17563 : see if varags is available
17564 echo " "
17565 if $test `./findhdr varargs.h`; then
17566         echo "<varargs.h> found." >&4
17567 else
17568         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17569 fi
17570
17571 : set up the varargs testing programs
17572 $cat > varargs.c <<EOP
17573 #ifdef I_STDARG
17574 #include <stdarg.h>
17575 #endif
17576 #ifdef I_VARARGS
17577 #include <varargs.h>
17578 #endif
17579
17580 #ifdef I_STDARG
17581 int f(char *p, ...)
17582 #else
17583 int f(va_alist)
17584 va_dcl
17585 #endif
17586 {
17587         va_list ap;
17588 #ifndef I_STDARG
17589         char *p;
17590 #endif
17591 #ifdef I_STDARG
17592         va_start(ap,p);
17593 #else
17594         va_start(ap);
17595         p = va_arg(ap, char *);
17596 #endif
17597         va_end(ap);
17598 }
17599 EOP
17600 $cat > varargs <<EOP
17601 $startsh
17602 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17603         echo "true"
17604 else
17605         echo "false"
17606 fi
17607 $rm -f varargs$_o
17608 EOP
17609 chmod +x varargs
17610
17611 : now check which varargs header should be included
17612 echo " "
17613 i_varhdr=''
17614 case "$valstd" in
17615 "$define")
17616         if `./varargs I_STDARG`; then
17617                 val='stdarg.h'
17618         elif `./varargs I_VARARGS`; then
17619                 val='varargs.h'
17620         fi
17621         ;;
17622 *)
17623         if `./varargs I_VARARGS`; then
17624                 val='varargs.h'
17625         fi
17626         ;;
17627 esac
17628 case "$val" in
17629 '')
17630 echo "I could not find the definition for va_dcl... You have problems..." >&4
17631         val="$undef"; set i_stdarg; eval $setvar
17632         val="$undef"; set i_varargs; eval $setvar
17633         ;;
17634 *) 
17635         set i_varhdr
17636         eval $setvar
17637         case "$i_varhdr" in
17638         stdarg.h)
17639                 val="$define"; set i_stdarg; eval $setvar
17640                 val="$undef"; set i_varargs; eval $setvar
17641                 ;;
17642         varargs.h)
17643                 val="$undef"; set i_stdarg; eval $setvar
17644                 val="$define"; set i_varargs; eval $setvar
17645                 ;;
17646         esac
17647         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17648 esac
17649 $rm -f varargs*
17650
17651 : see if we need va_copy
17652 echo " "
17653 case "$i_stdarg" in
17654 "$define")
17655         $cat >try.c <<EOCP
17656 #include <stdarg.h>
17657 #include <stdio.h>
17658 #$i_stdlib I_STDLIB
17659 #ifdef I_STDLIB
17660 #include <stdlib.h>
17661 #endif
17662 #include <signal.h>
17663
17664 int
17665 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17666 {
17667   return vfprintf(f, fmt, *valp);
17668 }
17669  
17670 int    
17671 myvfprintf(FILE *f, const  char *fmt, va_list val)
17672 {
17673   return ivfprintf(f, fmt, &val);
17674 }
17675       
17676 int
17677 myprintf(char *fmt, ...) 
17678 {
17679   va_list val;
17680   va_start(val, fmt);
17681   return myvfprintf(stdout, fmt, val); 
17682 }         
17683
17684 int
17685 main(int ac, char **av)
17686 {
17687   signal(SIGSEGV, exit);
17688
17689   myprintf("%s%cs all right, then\n", "that", '\'');                            
17690   exit(0);      
17691 }
17692 EOCP
17693         set try
17694         if eval $compile && $run ./try 2>&1 >/dev/null; then
17695                 case "`$run ./try`" in
17696                 "that's all right, then")
17697                         okay=yes
17698                         ;;
17699                 esac
17700         fi
17701         case "$okay" in
17702         yes)    echo "It seems that you don't need va_copy()." >&4
17703                 need_va_copy="$undef"
17704                 ;;
17705         *)      echo "It seems that va_copy() or similar will be needed." >&4
17706                 need_va_copy="$define"
17707                 ;;
17708         esac
17709         $rm -f try.* core core.* *.core *.core.*
17710         ;;
17711 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17712         ;;
17713 esac
17714
17715 : see what type is used for size_t
17716 rp="What is the type used for the length parameter for string functions?"
17717 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17718 eval $typedef_ask
17719
17720 : check for type of arguments to gethostbyaddr. 
17721 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17722         case "$d_gethbyaddr" in
17723         $define)
17724                 $cat <<EOM
17725
17726 Checking to see what type of arguments are accepted by gethostbyaddr().
17727 EOM
17728                 hdrs="$define sys/types.h
17729                         $d_socket sys/socket.h 
17730                         $i_niin netinet/in.h 
17731                         $i_netdb netdb.h
17732                         $i_unistd unistd.h"
17733                 : The first arg can 'char *' or 'void *'
17734                 : The second arg is some of integral type
17735                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17736                         for yyy in size_t long int; do
17737                                 case "$netdb_host_type" in
17738                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17739                                         if ./protochk "$try" $hdrs; then
17740                                                 echo "Your system accepts $xxx for the first arg."
17741                                                 echo "...and $yyy for the second arg."
17742                                                 netdb_host_type="$xxx"
17743                                                 netdb_hlen_type="$yyy"
17744                                         fi
17745                                         ;;
17746                                 esac
17747                         done
17748                 done
17749                 : In case none of those worked, prompt the user.
17750                 case "$netdb_host_type" in
17751                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17752                         dflt='char *'
17753                         . ./myread
17754                         netdb_host_type=$ans
17755                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17756                         dflt="$sizetype"
17757                         . ./myread
17758                         netdb_hlen_type=$ans
17759                         ;;
17760                 esac
17761                 ;;
17762         *)      : no gethostbyaddr, so pick harmless defaults
17763                 netdb_host_type='char *'
17764                 netdb_hlen_type="$sizetype"
17765                 ;;
17766         esac
17767         # Remove the "const" if needed. -- but then we'll have a 
17768         # prototype clash!
17769         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17770 fi
17771
17772 : check for type of argument to gethostbyname. 
17773 if test "X$netdb_name_type" = X ; then
17774         case "$d_gethbyname" in
17775         $define)
17776                 $cat <<EOM
17777
17778 Checking to see what type of argument is accepted by gethostbyname().
17779 EOM
17780                 hdrs="$define sys/types.h
17781                         $d_socket sys/socket.h 
17782                         $i_niin netinet/in.h 
17783                         $i_netdb netdb.h
17784                         $i_unistd unistd.h"
17785                 for xxx in "const char *" "char *"; do
17786                         case "$netdb_name_type" in
17787                         '')     try="extern struct hostent *gethostbyname($xxx);"
17788                                 if ./protochk "$try" $hdrs; then
17789                                         echo "Your system accepts $xxx."
17790                                         netdb_name_type="$xxx"
17791                                 fi
17792                                 ;;
17793                         esac
17794                 done
17795                 : In case none of those worked, prompt the user.
17796                 case "$netdb_name_type" in
17797                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17798                         dflt='char *'
17799                         . ./myread
17800                         netdb_name_type=$ans
17801                         ;;
17802                 esac
17803                 ;;
17804         *)      : no gethostbyname, so pick harmless default
17805                 netdb_name_type='char *'
17806                 ;;
17807         esac
17808 fi
17809
17810 : check for type of 1st argument to getnetbyaddr. 
17811 if test "X$netdb_net_type" = X ; then
17812         case "$d_getnbyaddr" in
17813         $define)
17814                 $cat <<EOM
17815
17816 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17817 EOM
17818                 hdrs="$define sys/types.h
17819                         $d_socket sys/socket.h 
17820                         $i_niin netinet/in.h 
17821                         $i_netdb netdb.h
17822                         $i_unistd unistd.h"
17823                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17824                         case "$netdb_net_type" in
17825                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17826                                 if ./protochk "$try" $hdrs; then
17827                                         echo "Your system accepts $xxx."
17828                                         netdb_net_type="$xxx"
17829                                 fi
17830                                 ;;
17831                         esac
17832                 done
17833                 : In case none of those worked, prompt the user.
17834                 case "$netdb_net_type" in
17835                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17836                         dflt='long'
17837                         . ./myread
17838                         netdb_net_type=$ans
17839                         ;;
17840                 esac
17841                 ;;
17842         *)      : no getnetbyaddr, so pick harmless default
17843                 netdb_net_type='long'
17844                 ;;
17845         esac
17846 fi
17847 : locate the preferred pager for this system
17848 case "$pager" in
17849 '')
17850         dflt=''
17851         case "$pg" in
17852         /*) dflt=$pg;;
17853         [a-zA-Z]:/*) dflt=$pg;;
17854         esac
17855         case "$more" in
17856         /*) dflt=$more;;
17857         [a-zA-Z]:/*) dflt=$more;;
17858         esac
17859         case "$less" in
17860         /*) dflt=$less;;
17861         [a-zA-Z]:/*) dflt=$less;;
17862         esac
17863         case "$dflt" in
17864         '') dflt=/usr/ucb/more;;
17865         esac
17866         ;;
17867 *) dflt="$pager";;
17868 esac
17869 echo " "
17870 fn=f/
17871 rp='What pager is used on your system?'
17872 . ./getfile
17873 pager="$ans"
17874
17875 : see what type pids are declared as in the kernel
17876 rp="What is the type of process ids on this system?"
17877 set pid_t pidtype int stdio.h sys/types.h
17878 eval $typedef_ask
17879
17880 : Find earliest binary compatible site_perl subdirectory perl can use.
17881 xs_apiversion=$version # The current site_perl version.
17882 : Find earliest pure perl site_perl subdirectory perl can use.
17883 : The versioned directories started at 5.005.
17884 pm_apiversion='5.005'
17885
17886 : see if ar generates random libraries by itself
17887 echo " "
17888 echo "Checking how to generate random libraries on your machine..." >&4
17889 echo 'int bar1() { return bar2(); }' > bar1.c
17890 echo 'int bar2() { return 2; }' > bar2.c
17891 $cat > foo.c <<'EOP'
17892 int main() { printf("%d\n", bar1()); exit(0); }
17893 EOP
17894 $cc $ccflags -c bar1.c >/dev/null 2>&1
17895 $cc $ccflags -c bar2.c >/dev/null 2>&1
17896 $cc $ccflags -c foo.c >/dev/null 2>&1
17897 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17898 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17899         $run ./foobar >/dev/null 2>&1; then
17900         echo "$ar appears to generate random libraries itself."
17901         orderlib=false
17902         ranlib=":"
17903 elif $ar ts bar$_a >/dev/null 2>&1 &&
17904         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17905         $run ./foobar >/dev/null 2>&1; then
17906                 echo "a table of contents needs to be added with '$ar ts'."
17907                 orderlib=false
17908                 ranlib="$ar ts"
17909 else
17910         case "$ranlib" in
17911         :) ranlib='';;
17912         '')
17913                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17914                 $test -f $ranlib || ranlib=''
17915                 ;;
17916         esac
17917         if $test -n "$ranlib"; then
17918                 echo "your system has '$ranlib'; we'll use that."
17919                 orderlib=false
17920         else
17921                 echo "your system doesn't seem to support random libraries"
17922                 echo "so we'll use lorder and tsort to order the libraries."
17923                 orderlib=true
17924                 ranlib=":"
17925         fi
17926 fi
17927 $rm -f foo* bar* 
17928
17929 : check for type of arguments to select. 
17930 case "$selecttype" in
17931 '') case "$d_select" in
17932         $define)
17933                 echo " "
17934                 $cat <<EOM
17935 Checking to see what type of arguments are accepted by select().
17936 EOM
17937                 hdrs="$define sys/types.h
17938                         $i_systime sys/time.h 
17939                         $i_sysselct sys/select.h
17940                         $d_socket sys/socket.h"
17941                 : The first arg can be int, unsigned, or size_t
17942                 : The last arg may or may not be 'const'
17943                 val=''
17944                 : void pointer has been seen but using that
17945                 : breaks the selectminbits test
17946                 for xxx in 'fd_set *' 'int *'; do
17947                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17948                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17949                                         case "$val" in
17950                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17951                                                 if ./protochk "$try" $hdrs; then
17952                                                         echo "Your system accepts $xxx."
17953                                                         val="$xxx"
17954                                                 fi
17955                                                 ;;
17956                                         esac
17957                                 done
17958                         done
17959                 done
17960                 case "$val" in
17961                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17962                         case "$d_fd_set" in
17963                                 $define) dflt="fd_set *" ;;
17964                                 *)              dflt="int *" ;;
17965                         esac
17966                         . ./myread
17967                         val=$ans
17968                         ;;
17969                 esac
17970                 selecttype="$val"
17971                 ;;
17972         *)      : no select, so pick a harmless default
17973                 selecttype='int *'
17974                 ;;
17975         esac
17976         ;;
17977 esac
17978
17979 : check for the select 'width'
17980 case "$selectminbits" in
17981 '') case "$d_select" in
17982         $define)
17983                 $cat <<EOM
17984
17985 Checking to see on how many bits at a time your select() operates...
17986 EOM
17987                 $cat >try.c <<EOCP
17988 #include <sys/types.h>
17989 #$i_time I_TIME
17990 #$i_systime I_SYS_TIME
17991 #$i_systimek I_SYS_TIME_KERNEL
17992 #ifdef I_TIME
17993 #   include <time.h>
17994 #endif
17995 #ifdef I_SYS_TIME
17996 #   ifdef I_SYS_TIME_KERNEL
17997 #       define KERNEL
17998 #   endif
17999 #   include <sys/time.h>
18000 #   ifdef I_SYS_TIME_KERNEL
18001 #       undef KERNEL
18002 #   endif
18003 #endif
18004 #$i_sysselct I_SYS_SELECT
18005 #ifdef I_SYS_SELECT
18006 #include <sys/select.h>
18007 #endif
18008 #$d_socket HAS_SOCKET
18009 #ifdef HAS_SOCKET
18010 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18011 #endif
18012 #include <stdio.h>
18013 $selecttype b;
18014 #define S sizeof(*(b))
18015 #define MINBITS 64
18016 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18017 #define NBITS  (NBYTES * 8)
18018 int main() {
18019     char s[NBYTES];
18020     struct timeval t;
18021     int i;
18022     FILE* fp;
18023     int fd;
18024
18025     fclose(stdin);
18026     fp = fopen("try.c", "r");
18027     if (fp == 0)
18028       exit(1);
18029     fd = fileno(fp);
18030     if (fd < 0)
18031       exit(2);
18032     b = ($selecttype)s;
18033     for (i = 0; i < NBITS; i++)
18034         FD_SET(i, b);
18035     t.tv_sec  = 0;
18036     t.tv_usec = 0;
18037     select(fd + 1, b, 0, 0, &t);
18038     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18039     printf("%d\n", i + 1);
18040     return 0;
18041 }
18042 EOCP
18043                 set try
18044                 if eval $compile_ok; then
18045                         selectminbits=`$run ./try`
18046                         case "$selectminbits" in
18047                         '')     cat >&4 <<EOM
18048 Cannot figure out on how many bits at a time your select() operates.
18049 I'll play safe and guess it is 32 bits.
18050 EOM
18051                                 selectminbits=32
18052                                 bits="32 bits"
18053                                 ;;
18054                         1)      bits="1 bit" ;;
18055                         *)      bits="$selectminbits bits" ;;
18056                         esac
18057                         echo "Your select() operates on $bits at a time." >&4
18058                 else
18059                         rp='What is the minimum number of bits your select() operates on?'
18060                         case "$byteorder" in
18061                         1234|12345678)  dflt=32 ;;
18062                         *)              dflt=1  ;;
18063                         esac
18064                         . ./myread
18065                         val=$ans
18066                         selectminbits="$val"
18067                 fi
18068                 $rm -f try.* try
18069                 ;;
18070         *)      : no select, so pick a harmless default
18071                 selectminbits='32'
18072                 ;;
18073         esac
18074         ;;
18075 esac
18076
18077 : Trace out the files included by signal.h, then look for SIGxxx names.
18078 : Remove SIGARRAYSIZE used by HPUX.
18079 : Remove SIGSTKSIZE used by Linux.
18080 : Remove SIGSTKSZ used by Posix.
18081 : Remove SIGTYP void lines used by OS2.
18082 : Some cpps, like os390, dont give the file name anywhere
18083 if [ "X$fieldn" = X ]; then
18084         : Just make some guesses.  We check them later.
18085         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18086 else
18087         xxx=`echo '#include <signal.h>' |
18088         $cppstdin $cppminus $cppflags 2>/dev/null |
18089         $grep '^[       ]*#.*include' | 
18090         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18091 fi
18092 : Check this list of files to be sure we have parsed the cpp output ok.
18093 : This will also avoid potentially non-existent files, such 
18094 : as ../foo/bar.h
18095 xxxfiles=''
18096 for xx in $xxx /dev/null ; do
18097         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18098 done
18099 : If we have found no files, at least try signal.h
18100 case "$xxxfiles" in
18101 '')     xxxfiles=`./findhdr signal.h` ;;
18102 esac
18103 xxx=`awk '
18104 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18105         print substr($2, 4, 20)
18106 }
18107 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18108         print substr($3, 4, 20)
18109 }' $xxxfiles`
18110 : Append some common names just in case the awk scan failed.
18111 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18112 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18113 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18114 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18115 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18116
18117 : generate a few handy files for later
18118 $cat > signal.c <<'EOCP'
18119 #include <sys/types.h>
18120 #include <signal.h>
18121 #include <stdio.h>
18122 int main() {
18123
18124 /* Strange style to avoid deeply-nested #if/#else/#endif */
18125 #ifndef NSIG
18126 #  ifdef _NSIG
18127 #    define NSIG (_NSIG)
18128 #  endif
18129 #endif
18130
18131 #ifndef NSIG
18132 #  ifdef SIGMAX
18133 #    define NSIG (SIGMAX+1)
18134 #  endif
18135 #endif
18136
18137 #ifndef NSIG
18138 #  ifdef SIG_MAX
18139 #    define NSIG (SIG_MAX+1)
18140 #  endif
18141 #endif
18142
18143 #ifndef NSIG
18144 #  ifdef MAXSIG
18145 #    define NSIG (MAXSIG+1)
18146 #  endif
18147 #endif
18148
18149 #ifndef NSIG
18150 #  ifdef MAX_SIG
18151 #    define NSIG (MAX_SIG+1)
18152 #  endif
18153 #endif
18154
18155 #ifndef NSIG
18156 #  ifdef SIGARRAYSIZE
18157 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18158 #  endif
18159 #endif
18160
18161 #ifndef NSIG
18162 #  ifdef _sys_nsig
18163 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18164 #  endif
18165 #endif
18166
18167 /* Default to some arbitrary number that's big enough to get most
18168    of the common signals.
18169 */
18170 #ifndef NSIG
18171 #    define NSIG 50
18172 #endif
18173
18174 printf("NSIG %d\n", NSIG);
18175
18176 #ifndef JUST_NSIG
18177
18178 EOCP
18179
18180 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18181 {
18182         printf "#ifdef SIG"; printf $1; printf "\n"
18183         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18184         printf $1; printf ");\n"
18185         printf "#endif\n"
18186 }
18187 END {
18188         printf "#endif /* JUST_NSIG */\n";
18189         printf "exit(0);\n}\n";
18190 }
18191 ' >>signal.c
18192 $cat >signal.awk <<'EOP'
18193 BEGIN { ndups = 0 }
18194 $1 ~ /^NSIG$/ { nsig = $2 }
18195 ($1 !~ /^NSIG$/) && (NF == 2) {
18196     if ($2 > maxsig) { maxsig = $2 }
18197     if (sig_name[$2]) {
18198         dup_name[ndups] = $1
18199         dup_num[ndups] = $2
18200         ndups++ 
18201     }
18202     else {
18203         sig_name[$2] = $1
18204         sig_num[$2] = $2
18205     }
18206 }
18207 END { 
18208     if (nsig == 0) {
18209         nsig = maxsig + 1
18210     }
18211     printf("NSIG %d\n", nsig);
18212     for (n = 1; n < nsig; n++) {
18213         if (sig_name[n]) {
18214             printf("%s %d\n", sig_name[n], sig_num[n])
18215         }
18216         else {
18217             printf("NUM%d %d\n", n, n) 
18218         }
18219     }
18220     for (n = 0; n < ndups; n++) {
18221         printf("%s %d\n", dup_name[n], dup_num[n])
18222     }
18223 }
18224 EOP
18225 $cat >signal_cmd <<EOS
18226 $startsh
18227 if $test -s signal.lst; then
18228     echo "Using your existing signal.lst file"
18229         exit 0
18230 fi
18231 xxx="$xxx"
18232 EOS
18233 $cat >>signal_cmd <<'EOS'
18234
18235 set signal
18236 if eval $compile_ok; then
18237         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18238 else
18239         echo "(I can't seem be able to compile the whole test program)" >&4
18240         echo "(I'll try it in little pieces.)" >&4
18241         set signal -DJUST_NSIG
18242         if eval $compile_ok; then
18243                 $run ./signal$_exe > signal.nsg
18244                 $cat signal.nsg
18245         else
18246                 echo "I can't seem to figure out how many signals you have." >&4
18247                 echo "Guessing 50." >&4
18248                 echo 'NSIG 50' > signal.nsg
18249         fi
18250         : Now look at all the signal names, one at a time.
18251         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18252                 $cat > signal.c <<EOCP
18253 #include <sys/types.h>
18254 #include <signal.h>
18255 #include <stdio.h>
18256 int main() {
18257 printf("$xx %d\n", SIG${xx});
18258 return 0;
18259 }
18260 EOCP
18261                 set signal
18262                 if eval $compile; then
18263                         echo "SIG${xx} found."
18264                         $run ./signal$_exe  >> signal.ls1
18265                 else
18266                         echo "SIG${xx} NOT found."
18267                 fi
18268         done
18269         if $test -s signal.ls1; then
18270                 $cat signal.nsg signal.ls1 |
18271                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18272         fi
18273
18274 fi
18275 if $test -s signal.lst; then
18276         :
18277 else
18278         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18279         echo 'kill -l' >signal
18280         set X `csh -f <signal`
18281         $rm -f signal
18282         shift
18283         case $# in
18284         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18285         esac
18286         echo $@ | $tr ' ' $trnl | \
18287             $awk '{ printf "%s %d\n", $1, ++s; }
18288                   END { printf "NSIG %d\n", ++s }' >signal.lst
18289 fi
18290 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18291 EOS
18292 chmod a+x signal_cmd
18293 $eunicefix signal_cmd
18294
18295 : generate list of signal names
18296 echo " "
18297 case "$sig_name_init" in
18298 '') doinit=yes ;;
18299 *)  case "$sig_num_init" in
18300     ''|*,*) doinit=yes ;;
18301     esac ;;
18302 esac
18303 case "$doinit" in
18304 yes)
18305         echo "Generating a list of signal names and numbers..." >&4
18306         . ./signal_cmd
18307         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18308         sig_name=`$awk 'BEGIN { printf "ZERO " }
18309                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18310         sig_num=`$awk  'BEGIN { printf "0 " }
18311                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18312         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18313                              !/^NSIG/   { printf "\"%s\", ", $1 }
18314                              END        { printf "0\n" }' signal.lst`
18315         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18316                              !/^NSIG/   { printf "%d, ", $2}
18317                              END        { printf "0\n"}' signal.lst`
18318         ;;
18319 esac
18320 echo "The following $sig_count signals are available:"
18321 echo " "
18322 echo $sig_name | $awk \
18323 'BEGIN { linelen = 0 }
18324 {
18325         for (i = 1; i <= NF; i++) {
18326                 name = "SIG" $i " "
18327                 linelen = linelen + length(name)
18328                 if (linelen > 70) {
18329                         printf "\n"
18330                         linelen = length(name)
18331                 }
18332                 printf "%s", name
18333         }
18334         printf "\n"
18335 }'
18336 sig_size=`echo $sig_name | awk '{print NF}'`
18337 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18338
18339 echo " "
18340 case "$sizetype" in
18341 *_t) zzz="$sizetype"    ;;
18342 *)   zzz="filesize"     ;;
18343 esac
18344 echo "Checking the size of $zzz..." >&4 
18345 cat > try.c <<EOCP
18346 #include <sys/types.h>
18347 #include <stdio.h>
18348 int main() {
18349     printf("%d\n", (int)sizeof($sizetype));
18350     exit(0);
18351 }
18352 EOCP
18353 set try
18354 if eval $compile_ok; then
18355         yyy=`$run ./try`
18356         case "$yyy" in
18357         '')     sizesize=4
18358                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18359                 ;;
18360         *)      sizesize=$yyy
18361                 echo "Your $zzz size is $sizesize bytes."
18362                 ;;
18363         esac
18364 else
18365         sizesize=4
18366         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18367 fi
18368
18369
18370 : check for socklen_t
18371 echo " "
18372 echo "Checking to see if you have socklen_t..." >&4
18373 $cat >try.c <<EOCP
18374 #include <sys/types.h>
18375 #$d_socket HAS_SOCKET
18376 #ifdef HAS_SOCKET
18377 #include <sys/socket.h>
18378 #endif
18379 int main() { socklen_t x = 16; }
18380 EOCP
18381 set try
18382 if eval $compile; then
18383         val="$define"
18384         echo "You have socklen_t."
18385 else
18386         val="$undef"
18387         echo "You do not have socklen_t."
18388         case "$sizetype" in
18389         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18390         esac
18391 fi
18392 $rm -f try try.*
18393 set d_socklen_t
18394 eval $setvar
18395
18396 : see if this is a socks.h system
18397 set socks.h i_socks
18398 eval $inhdr
18399
18400 : check for type of the size argument to socket calls
18401 case "$d_socket" in
18402 "$define")
18403         $cat <<EOM
18404
18405 Checking to see what type is the last argument of accept().
18406 EOM
18407         yyy=''
18408         case "$d_socklen_t" in
18409         "$define") yyy="$yyy socklen_t"
18410         esac
18411         yyy="$yyy $sizetype int long unsigned"
18412         for xxx in $yyy; do
18413                 case "$socksizetype" in
18414                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18415                         case "$usesocks" in
18416                         "$define")
18417                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18418                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18419                                         socksizetype="$xxx"
18420                                 fi
18421                                 ;;
18422                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18423                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18424                                         socksizetype="$xxx"
18425                                 fi
18426                                 ;;
18427                         esac
18428                         ;;
18429                 esac
18430         done
18431 : In case none of those worked, prompt the user.
18432         case "$socksizetype" in
18433         '')     rp='What is the type for socket address structure sizes?'
18434                 dflt='int'
18435                 . ./myread
18436                 socksizetype=$ans
18437                 ;;
18438         esac
18439         ;;
18440 *)      : no sockets, so pick relatively harmless default
18441         socksizetype='int'
18442         ;;
18443 esac
18444
18445 : see what type is used for signed size_t
18446 set ssize_t ssizetype int stdio.h sys/types.h
18447 eval $typedef
18448 dflt="$ssizetype"
18449 $cat > try.c <<EOM
18450 #include <stdio.h>
18451 #include <sys/types.h>
18452 #define Size_t $sizetype
18453 #define SSize_t $dflt
18454 int main()
18455 {
18456         if (sizeof(Size_t) == sizeof(SSize_t))
18457                 printf("$dflt\n");
18458         else if (sizeof(Size_t) == sizeof(int))
18459                 printf("int\n");
18460         else 
18461                 printf("long\n");
18462         exit(0);
18463 }
18464 EOM
18465 echo " "
18466 set try
18467 if eval $compile_ok && $run ./try > /dev/null; then
18468         ssizetype=`$run ./try`
18469         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18470 else
18471         $cat >&4 <<EOM
18472 Help! I can't compile and run the ssize_t test program: please enlighten me!
18473 (This is probably a misconfiguration in your system or libraries, and
18474 you really ought to fix it.  Still, I'll try anyway.)
18475
18476 I need a type that is the same size as $sizetype, but is guaranteed to
18477 be signed.  Common values are ssize_t, int and long.
18478
18479 EOM
18480         rp="What signed type is the same size as $sizetype?"
18481         . ./myread
18482         ssizetype="$ans"
18483 fi
18484 $rm -f try try.*
18485
18486 : see what type of char stdio uses.
18487 echo " "
18488 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18489 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18490         echo "Your stdio uses unsigned chars." >&4
18491         stdchar="unsigned char"
18492 else
18493         echo "Your stdio uses signed chars." >&4
18494         stdchar="char"
18495 fi
18496 $rm -f stdioh
18497
18498
18499
18500 : see what type uids are declared as in the kernel
18501 echo " "
18502 echo "Looking for the type for user ids returned by getuid()."
18503 set uid_t uidtype xxx stdio.h sys/types.h
18504 eval $typedef
18505 case "$uidtype" in
18506 xxx)
18507         xxx=`./findhdr sys/user.h`
18508         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18509         case $1 in
18510         unsigned) dflt="$1 $2" ;;
18511         *) dflt="$1" ;;
18512         esac
18513         ;;
18514 *) dflt="$uidtype";;
18515 esac
18516 case "$uidtype" in
18517 uid_t)  echo "uid_t found." ;;
18518 *)      rp="What is the type for user ids returned by getuid()?"
18519         . ./myread
18520         uidtype="$ans"
18521         ;;
18522 esac
18523
18524 echo " "
18525 case "$uidtype" in
18526 *_t) zzz="$uidtype"     ;;
18527 *)   zzz="uid"          ;;
18528 esac
18529 echo "Checking the size of $zzz..." >&4 
18530 cat > try.c <<EOCP
18531 #include <sys/types.h>
18532 #include <stdio.h>
18533 int main() {
18534     printf("%d\n", (int)sizeof($uidtype));
18535     exit(0);
18536 }
18537 EOCP
18538 set try
18539 if eval $compile_ok; then
18540         yyy=`$run ./try`
18541         case "$yyy" in
18542         '')     uidsize=4
18543                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18544                 ;;
18545         *)      uidsize=$yyy
18546                 echo "Your $zzz is $uidsize bytes long."
18547                 ;;
18548         esac
18549 else
18550         uidsize=4
18551         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18552 fi
18553
18554 echo " "
18555 case "$uidtype" in
18556 *_t) zzz="$uidtype"     ;;
18557 *)   zzz="uid"          ;;
18558 esac
18559 echo "Checking the sign of $zzz..." >&4
18560 cat > try.c <<EOCP
18561 #include <sys/types.h>
18562 #include <stdio.h>
18563 int main() {
18564         $uidtype foo = -1;
18565         if (foo < 0)
18566                 printf("-1\n");
18567         else
18568                 printf("1\n");
18569 }
18570 EOCP
18571 set try
18572 if eval $compile; then
18573         yyy=`$run ./try`
18574         case "$yyy" in
18575         '')     uidsign=1
18576                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18577                 ;;
18578         *)      uidsign=$yyy
18579                 case "$uidsign" in
18580                  1) echo "Your $zzz is unsigned." ;;
18581                 -1) echo "Your $zzz is signed."   ;;
18582                 esac
18583                 ;;
18584         esac
18585 else
18586         uidsign=1
18587         echo "(I can't compile the test program--guessing unsigned.)" >&4
18588 fi
18589
18590
18591
18592 echo " "
18593 $echo "Checking the format string to be used for uids..." >&4
18594
18595 case "$uidsign" in
18596 -1)     if $test X"$uidsize" = X"$ivsize"; then
18597                 uidformat="$ivdformat"
18598         else
18599                 if $test X"$uidsize" = X"$longsize"; then
18600                         uidformat='"ld"'
18601                 else
18602                         if $test X"$uidsize" = X"$intsize"; then
18603                                 uidformat='"d"'
18604                         else
18605                                 if $test X"$uidsize" = X"$shortsize"; then
18606                                         uidformat='"hd"'
18607                                 fi
18608                         fi
18609                 fi
18610         fi
18611         ;;
18612 *)      if $test X"$uidsize" = X"$uvsize"; then
18613                 uidformat="$uvuformat"
18614         else
18615                 if $test X"$uidsize" = X"$longsize"; then
18616                         uidformat='"lu"'
18617                 else
18618                         if $test X"$uidsize" = X"$intsize"; then
18619                                 uidformat='"u"'
18620                         else
18621                                 if $test X"$uidsize" = X"$shortsize"; then
18622                                         uidformat='"hu"'
18623                                 fi
18624                         fi
18625                 fi
18626         fi
18627         ;;
18628 esac
18629
18630 : determine compiler compiler
18631 case "$yacc" in
18632 '')
18633         dflt=yacc;;
18634 *)
18635         dflt="$yacc";;
18636 esac
18637 echo " "
18638 comp='yacc'
18639 if $test -f "$byacc$_exe"; then
18640         dflt="$byacc"
18641         comp="byacc or $comp"
18642 fi
18643 if $test -f "$bison$_exe"; then
18644         comp="$comp or bison -y"
18645 fi
18646 rp="Which compiler compiler ($comp) shall I use?"
18647 . ./myread
18648 yacc="$ans"
18649 case "$yacc" in
18650 *bis*)
18651         case "$yacc" in
18652         *-y*) ;;
18653         *)
18654                 yacc="$yacc -y"
18655                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18656                 ;;
18657         esac
18658         ;;
18659 esac
18660
18661 : see if this is a fp.h system
18662 set fp.h i_fp
18663 eval $inhdr
18664
18665 : see if this is a fp_class.h system
18666 set fp_class.h i_fp_class
18667 eval $inhdr
18668
18669 : see if this is a ieeefp.h system
18670 case "$i_ieeefp" in
18671 '' ) set ieeefp.h i_ieeefp
18672      eval $inhdr
18673      ;;
18674 esac
18675
18676 : see if this is a libutil.h system
18677 set libutil.h i_libutil
18678 eval $inhdr
18679
18680 : see if mach cthreads are available
18681 if test "X$usethreads" = "X$define"; then
18682         set mach/cthreads.h i_machcthr
18683         eval $inhdr
18684 else
18685         i_machcthr="$undef"
18686 fi
18687
18688
18689
18690 : see if this is a math.h system
18691 set math.h i_math
18692 eval $inhdr
18693
18694 : see if this is a mntent.h system
18695 set mntent.h i_mntent
18696 eval $inhdr
18697
18698 : see if ndbm.h is available
18699 set ndbm.h t_ndbm
18700 eval $inhdr
18701
18702 case "$t_ndbm" in
18703 $undef)
18704     # Some Linux distributions such as RedHat 7.1 put the
18705     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18706     if $test -f /usr/include/gdbm/ndbm.h; then
18707         echo '<gdbm/ndbm.h> found.'
18708         ccflags="$ccflags -I/usr/include/gdbm"
18709         cppflags="$cppflags -I/usr/include/gdbm"
18710         t_ndbm=$define
18711     fi
18712     ;;
18713 esac
18714
18715 case "$t_ndbm" in
18716 $define)
18717         : see if dbm_open exists
18718         set dbm_open d_dbm_open
18719         eval $inlibc
18720         case "$d_dbm_open" in
18721         $undef)
18722                 t_ndbm="$undef"
18723                 echo "We won't be including <ndbm.h>"
18724                 ;;
18725         esac
18726         ;;
18727 esac
18728 val="$t_ndbm"
18729 set i_ndbm
18730 eval $setvar
18731
18732 : see if net/errno.h is available
18733 val=''
18734 set net/errno.h val
18735 eval $inhdr
18736
18737 : Unfortunately, it causes problems on some systems.  Arrgh.
18738 case "$val" in
18739 $define)
18740         cat > try.c <<'EOM'
18741 #include <stdio.h>
18742 #include <errno.h>
18743 #include <net/errno.h>
18744 int func()
18745 {
18746         return ENOTSOCK;
18747 }
18748 EOM
18749         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18750                 echo "We'll be including <net/errno.h>." >&4
18751         else
18752                 echo "We won't be including <net/errno.h>." >&4
18753                 val="$undef"
18754         fi
18755         $rm -f try.* try
18756         ;;
18757 esac
18758 set i_neterrno
18759 eval $setvar
18760
18761 : see if netinet/tcp.h is available
18762 set netinet/tcp.h i_netinettcp
18763 eval $inhdr
18764
18765 : see if this is a poll.h system
18766 set poll.h i_poll
18767 eval $inhdr
18768
18769 : see if this is a prot.h system
18770 set prot.h i_prot
18771 eval $inhdr
18772
18773 echo " "
18774 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18775 $cat <<'EOSH' > Cppsym.know
18776 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18777 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18778 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18779 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18780 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18781 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18782 bull c cadmus clipper CMU COFF COMPILER_VERSION
18783 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18784 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18785 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18786 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18787 GLIBC GLIBC_MINOR
18788 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18789 H3050R H3050RX hbullx20 hcx host_mips
18790 hp200 hp300 hp700 HP700 hp800 hp9000
18791 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18792 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18793 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18794 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18795 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18796 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18797 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18798 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18799 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18800 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18801 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18802 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18803 MATH_HAS_NO_SIDE_EFFECTS
18804 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18805 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18806 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18807 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18808 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18809 NetBSD news1500 news1700 news1800 news1900 news3700
18810 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18811 ns32016 ns32332 ns32k nsc32000
18812 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18813 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18814 pc532 pdp11 PGC PIC plexus PORTAR posix
18815 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18816 POSIX_C_SOURCE POSIX_SOURCE POWER
18817 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18818 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18819 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18820 sony sony_news sonyrisc sparc sparclite spectrum
18821 stardent stdc STDC_EXT stratos sun sun3 sun386
18822 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18823 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18824 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18825 sysV68 sysV88 Tek4132 Tek4300 titan
18826 TM3200 TM5400 TM5600
18827 tower tower32 tower32_200 tower32_600 tower32_700
18828 tower32_800 tower32_850 tss
18829 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18830 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18831 unix UNIX95 UNIX99 unixpc unos
18832 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18833 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18834 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18835 USGr4 USGr4_2
18836 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18837 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18838 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18839 z8000
18840 EOSH
18841 # Maybe put other stuff here too.
18842 cat <<EOSH >>Cppsym.know
18843 $osname
18844 EOSH
18845 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18846 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18847 $cat Cppsym.know > Cppsym.c
18848 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18849 $rm -f Cppsym.a Cppsym.b Cppsym.c
18850 cat <<EOSH > Cppsym
18851 $startsh
18852 if $test \$# -gt 0; then
18853     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18854     if $test -s Cppsym.got; then
18855         $rm -f Cppsym.got
18856         exit 0
18857     fi
18858     $rm -f Cppsym.got
18859     exit 1
18860 else
18861     $tr " " "$trnl" | ./Cppsym.try
18862     exit 0
18863 fi
18864 EOSH
18865 chmod +x Cppsym
18866 $eunicefix Cppsym
18867 cat <<EOSH > Cppsym.try
18868 $startsh
18869 cat <<'EOCP' > try.c
18870 #include <stdio.h>
18871 int main() {
18872 EOCP
18873 $awk \\
18874 EOSH
18875 cat <<'EOSH' >> Cppsym.try
18876 'length($1) > 0 {
18877     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
18878     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
18879     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
18880     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
18881 }'       >> try.c
18882 echo 'return 0;}' >> try.c
18883 EOSH
18884 cat <<EOSH >> Cppsym.try
18885 ccflags="$ccflags"
18886 case "$osname-$gccversion" in
18887 irix-) ccflags="\$ccflags -woff 1178" ;;
18888 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18889 esac
18890 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18891 EOSH
18892 chmod +x Cppsym.try
18893 $eunicefix Cppsym.try
18894 ./Cppsym < Cppsym.know > Cppsym.true
18895 : now check the C compiler for additional symbols
18896 postprocess_cc_v=''
18897 case "$osname" in
18898 aix) postprocess_cc_v="|$tr , ' '" ;;
18899 esac
18900 $cat >ccsym <<EOS
18901 $startsh
18902 $cat >tmp.c <<EOF
18903 extern int foo;
18904 EOF
18905 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18906 do
18907         case "\$i" in
18908         -D*) echo "\$i" | $sed 's/^-D//';;
18909         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18910         esac
18911 done
18912 $rm -f try.c
18913 EOS
18914 postprocess_cc_v=''
18915 chmod +x ccsym
18916 $eunicefix ccsym
18917 ./ccsym > ccsym1.raw
18918 if $test -s ccsym1.raw; then
18919        $sort ccsym1.raw | $uniq >ccsym.raw
18920 else
18921        mv ccsym1.raw ccsym.raw
18922 fi
18923
18924 $awk '/\=/ { print $0; next }
18925         { print $0"=1" }' ccsym.raw >ccsym.list
18926 $awk '/\=/ { print $0; next }
18927         { print $0"=1" }' Cppsym.true >ccsym.true
18928 $comm -13 ccsym.true ccsym.list >ccsym.own
18929 $comm -12 ccsym.true ccsym.list >ccsym.com
18930 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18931 also=''
18932 if $test -z ccsym.raw; then
18933         echo "Your C compiler doesn't seem to define any symbols!" >&4
18934         echo " "
18935         echo "However, your C preprocessor defines the following symbols:"
18936         $cat Cppsym.true
18937         ccsymbols=''
18938         cppsymbols=`$cat Cppsym.true`
18939         cppsymbols=`echo $cppsymbols`
18940         cppccsymbols="$cppsymbols"
18941 else
18942         if $test -s ccsym.com; then
18943                 echo "Your C compiler and pre-processor define these symbols:"
18944                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18945                 also='also '
18946                 symbols='ones'
18947                 cppccsymbols=`$cat ccsym.com`
18948                 cppccsymbols=`echo $cppccsymbols`
18949                 $test "$silent" || sleep 1
18950         fi
18951         if $test -s ccsym.cpp; then
18952                 $test "$also" && echo " "
18953                 echo "Your C pre-processor ${also}defines the following symbols:"
18954                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18955                 also='further '
18956                 cppsymbols=`$cat ccsym.cpp`
18957                 cppsymbols=`echo $cppsymbols`
18958                 $test "$silent" || sleep 1
18959         fi
18960         if $test -s ccsym.own; then
18961                 $test "$also" && echo " "
18962                 echo "Your C compiler ${also}defines the following cpp symbols:"
18963                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18964                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18965                 ccsymbols=`$cat ccsym.own`
18966                 ccsymbols=`echo $ccsymbols`
18967                 $test "$silent" || sleep 1
18968         fi
18969 fi
18970
18971 : see if this is a termio system
18972 val="$undef"
18973 val2="$undef"
18974 val3="$undef"
18975 if $test `./findhdr termios.h`; then
18976         set tcsetattr i_termios
18977         eval $inlibc
18978         val3="$i_termios"
18979 fi
18980 echo " "
18981 case "$val3" in
18982 "$define") echo "You have POSIX termios.h... good!" >&4;;
18983 *) if ./Cppsym pyr; then
18984                 case "`/bin/universe`" in
18985                 ucb) if $test `./findhdr sgtty.h`; then
18986                                 val2="$define"
18987                                 echo "<sgtty.h> found." >&4
18988                         else
18989                                 echo "System is pyramid with BSD universe."
18990                                 echo "<sgtty.h> not found--you could have problems." >&4
18991                         fi;;
18992                 *) if $test `./findhdr termio.h`; then
18993                                 val="$define"
18994                                 echo "<termio.h> found." >&4
18995                         else
18996                                 echo "System is pyramid with USG universe."
18997                                 echo "<termio.h> not found--you could have problems." >&4
18998                         fi;;
18999                 esac
19000         elif ./usg; then
19001                 if $test `./findhdr termio.h`; then
19002                         echo "<termio.h> found." >&4
19003                         val="$define"
19004                 elif $test `./findhdr sgtty.h`; then
19005                         echo "<sgtty.h> found." >&4
19006                         val2="$define"
19007                 else
19008 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19009                 fi
19010         else
19011                 if $test `./findhdr sgtty.h`; then
19012                         echo "<sgtty.h> found." >&4
19013                         val2="$define"
19014                 elif $test `./findhdr termio.h`; then
19015                         echo "<termio.h> found." >&4
19016                         val="$define"
19017                 else
19018 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19019                 fi
19020         fi;;
19021 esac
19022 set i_termio; eval $setvar
19023 val=$val2; set i_sgtty; eval $setvar
19024 val=$val3; set i_termios; eval $setvar
19025
19026 : see if stddef is available
19027 set stddef.h i_stddef
19028 eval $inhdr
19029
19030 : see if this is a sunmath.h system
19031 set sunmath.h i_sunmath
19032 eval $inhdr
19033
19034 : see if sys/access.h is available
19035 set sys/access.h i_sysaccess
19036 eval $inhdr
19037
19038 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19039 set sys/filio.h i_sysfilio
19040 eval $inhdr
19041 echo " "
19042 if $test `./findhdr sys/ioctl.h`; then
19043         val="$define"
19044         echo '<sys/ioctl.h> found.' >&4
19045 else
19046         val="$undef"
19047         if $test $i_sysfilio = "$define"; then
19048             echo '<sys/ioctl.h> NOT found.' >&4
19049         else
19050                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19051                 $test $i_termio = "$define" && xxx="termio.h"
19052                 $test $i_termios = "$define" && xxx="termios.h"
19053 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19054         fi
19055 fi
19056 set i_sysioctl
19057 eval $setvar
19058
19059 : see if socket ioctl defs are in sys/sockio.h
19060 echo " "
19061 xxx=`./findhdr sys/sockio.h`
19062 if $test "$xxx"; then
19063         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19064                 val="$define"
19065                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19066         else
19067                 val="$undef"
19068                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19069         fi
19070 else
19071         val="$undef"
19072         $cat <<EOM
19073 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19074 EOM
19075 fi
19076 set i_syssockio
19077 eval $setvar
19078
19079
19080 : see if this is a syslog.h system
19081 set syslog.h i_syslog
19082 eval $inhdr
19083
19084
19085 : see if this is a sys/mode.h system
19086 set sys/mode.h i_sysmode
19087 eval $inhdr
19088
19089 : see if sys/resource.h has to be included
19090 set sys/resource.h i_sysresrc
19091 eval $inhdr
19092
19093 : see if sys/security.h is available
19094 set sys/security.h i_syssecrt
19095 eval $inhdr
19096
19097 : see if this is a sys/statvfs.h system
19098 set sys/statvfs.h i_sysstatvfs
19099 eval $inhdr
19100
19101 : see if this is a sys/un.h system
19102 set sys/un.h i_sysun
19103 eval $inhdr
19104
19105
19106 : see if this is a sys/utsname.h system
19107 set sys/utsname.h i_sysutsname
19108 eval $inhdr
19109
19110 : see if this is a syswait system
19111 set sys/wait.h i_syswait
19112 eval $inhdr
19113
19114 : see if this is a ustat.h system
19115 set ustat.h i_ustat
19116 eval $inhdr
19117
19118 : see if this is an utime system
19119 set utime.h i_utime
19120 eval $inhdr
19121
19122 : see if this is a values.h system
19123 set values.h i_values
19124 eval $inhdr
19125
19126 : see if this is a vfork system
19127 case "$d_vfork" in
19128 "$define")
19129         set vfork.h i_vfork
19130         eval $inhdr
19131         ;;
19132 *)
19133         i_vfork="$undef"
19134         ;;
19135 esac
19136
19137 : see if gdbm.h is available
19138 set gdbm.h t_gdbm
19139 eval $inhdr
19140 case "$t_gdbm" in
19141 $define)
19142         : see if gdbm_open exists
19143         set gdbm_open d_gdbm_open
19144         eval $inlibc
19145         case "$d_gdbm_open" in
19146         $undef)
19147                 t_gdbm="$undef"
19148                 echo "We won't be including <gdbm.h>"
19149                 ;;
19150         esac
19151         ;;
19152 esac
19153 val="$t_gdbm"
19154 set i_gdbm
19155 eval $setvar
19156
19157 echo " "
19158 echo "Looking for extensions..." >&4
19159 : If we are using the old config.sh, known_extensions may contain
19160 : old or inaccurate or duplicate values.
19161 known_extensions=''
19162 nonxs_extensions=''
19163 : We do not use find because it might not be available.
19164 : We do not just use MANIFEST because the user may have dropped
19165 : some additional extensions into the source tree and expect them
19166 : to be built.
19167
19168 : Function to recursively find available extensions, ignoring DynaLoader
19169 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19170 find_extensions='
19171     for xxx in *; do
19172        case "$xxx" in
19173            DynaLoader|dynaload) ;;
19174            *)
19175            if $test -f $xxx/$xxx.xs; then
19176                known_extensions="$known_extensions $1$xxx";
19177            elif $test -f $xxx/Makefile.PL; then
19178                nonxs_extensions="$nonxs_extensions $1$xxx";
19179            else
19180                if $test -d $xxx -a $# -lt 10; then
19181                    set $1$xxx/ $*;
19182                    cd "$xxx";
19183                    eval $find_extensions;
19184                    cd ..;
19185                    shift;
19186                fi;
19187            fi
19188            ;;
19189        esac;
19190     done'
19191 tdir=`pwd`
19192 cd "$rsrc/ext"
19193 set X
19194 shift
19195 eval $find_extensions
19196 # Special case:  Add in threads/shared since it is not picked up by the
19197 # recursive find above (and adding in general recursive finding breaks
19198 # SDBM_File/sdbm).  A.D.  10/25/2001.
19199 known_extensions="$known_extensions threads/shared"
19200 set X $nonxs_extensions
19201 shift
19202 nonxs_extensions="$*"
19203 set X $known_extensions
19204 shift
19205 known_extensions="$*"
19206 cd "$tdir"
19207
19208 : Now see which are supported on this system.
19209 avail_ext=''
19210 for xxx in $known_extensions ; do
19211         case "$xxx" in
19212         DB_File|db_file)
19213                 case "$i_db" in
19214                 $define) avail_ext="$avail_ext $xxx" ;;
19215                 esac
19216                 ;;
19217         GDBM_File|gdbm_fil)
19218                 case "$i_gdbm" in 
19219                 $define) avail_ext="$avail_ext $xxx" ;;
19220                 esac
19221                 ;;
19222         I18N/Langinfo|i18n_lan)
19223                 case "$i_langinfo$d_nl_langinfo" in 
19224                 $define$define) avail_ext="$avail_ext $xxx" ;;
19225                 esac
19226                 ;;
19227         NDBM_File|ndbm_fil)
19228                 case "$i_ndbm" in
19229                 $define)
19230                     case "$osname-$use64bitint" in
19231                     cygwin-*|hpux-define)
19232                         case "$libs" in
19233                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19234                         esac
19235                         ;;
19236                     *) avail_ext="$avail_ext $xxx" ;;
19237                     esac
19238                     ;;
19239                 esac
19240                 ;;
19241         ODBM_File|odbm_fil) 
19242                 case "${i_dbm}${i_rpcsvcdbm}" in
19243                 *"${define}"*)
19244                     case "$osname-$use64bitint" in
19245                     cygwin-*|hpux-define)
19246                         case "$libs" in
19247                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19248                         esac
19249                         ;;
19250                     *) avail_ext="$avail_ext $xxx" ;;
19251                     esac
19252                     ;;
19253                 esac
19254                 ;;
19255         POSIX|posix)
19256                 case "$useposix" in
19257                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19258                 esac
19259                 ;;
19260         Opcode|opcode)
19261                 case "$useopcode" in
19262                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19263                 esac
19264                 ;;
19265         Socket|socket)
19266                 case "$d_socket" in 
19267                 true|$define|y)
19268                     case "$osname" in
19269                     beos) ;; # not unless BONE
19270                     *) avail_ext="$avail_ext $xxx" ;;
19271                     esac
19272                     ;;
19273                 esac
19274                 ;;
19275         Sys/Syslog|sys/syslog)
19276                 : XXX syslog requires socket
19277                 case "$d_socket" in 
19278                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19279                 esac
19280                 ;;
19281         Thread|thread)
19282                 case "$usethreads" in
19283                 true|$define|y)
19284                         case "$useithreads" in
19285                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19286                         esac
19287                 esac
19288                 ;;
19289         threads|threads/shared)
19290                 # threads and threads::shared are special cases.
19291                 # To stop people from asking "Perl 5.8.0 was supposed
19292                 # to have this new fancy threads implementation but my
19293                 # perl doesn't have it" and from people trying to
19294                 # (re)install the threads module using CPAN.pm and
19295                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19296                 # the threads.pm and threads/shared.pm will always be
19297                 # there, croaking informatively ("you need to rebuild
19298                 # all of Perl with threads, sorry") when threads haven't
19299                 # been compiled in.
19300                 # --jhi
19301                 avail_ext="$avail_ext $xxx"
19302                 ;;
19303         IPC/SysV|ipc/sysv)
19304                 : XXX Do we need a useipcsysv variable here
19305                 case "${d_msg}${d_sem}${d_shm}" in 
19306                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19307                 esac
19308                 ;;
19309         *)      avail_ext="$avail_ext $xxx"
19310                 ;;
19311         esac
19312 done
19313
19314 set X $avail_ext
19315 shift
19316 avail_ext="$*"
19317
19318 : Now see which nonxs extensions are supported on this system.
19319 : For now assume all are.
19320 nonxs_ext=''
19321 for xxx in $nonxs_extensions ; do
19322         case "$xxx" in
19323         *)      nonxs_ext="$nonxs_ext $xxx"
19324                 ;;
19325         esac
19326 done
19327
19328 set X $nonxs_ext
19329 shift
19330 nonxs_ext="$*"
19331
19332 case $usedl in
19333 $define)
19334         $cat <<EOM
19335 A number of extensions are supplied with $package.  You may choose to
19336 compile these extensions for dynamic loading (the default), compile
19337 them into the $package executable (static loading), or not include
19338 them at all.  Answer "none" to include no extensions.
19339 Note that DynaLoader is always built and need not be mentioned here.
19340
19341 EOM
19342         case "$dynamic_ext" in
19343         '') dflt="$avail_ext" ;;
19344         *)      dflt="$dynamic_ext"
19345                 # Perhaps we are reusing an old out-of-date config.sh.
19346                 case "$hint" in
19347                 previous)
19348                         if test X"$dynamic_ext" != X"$avail_ext"; then
19349                                 $cat <<EOM
19350 NOTICE:  Your previous config.sh list may be incorrect. 
19351 The extensions now available to you are 
19352         ${avail_ext}
19353 but the default list from your previous config.sh is
19354         ${dynamic_ext} 
19355
19356 EOM
19357                         fi
19358                         ;;
19359                 esac
19360                 ;;
19361         esac
19362         case "$dflt" in
19363         '')     dflt=none;;
19364         esac
19365         rp="What extensions do you wish to load dynamically?"
19366         . ./myread
19367         case "$ans" in
19368         none) dynamic_ext=' ' ;;
19369         *) dynamic_ext="$ans" ;;
19370         esac
19371
19372         case "$static_ext" in
19373         '')
19374                 : Exclude those already listed in dynamic linking
19375                 dflt=''
19376                 for xxx in $avail_ext; do
19377                         case " $dynamic_ext " in
19378                         *" $xxx "*) ;;
19379                         *) dflt="$dflt $xxx" ;;
19380                         esac
19381                 done
19382                 set X $dflt
19383                 shift
19384                 dflt="$*"
19385                 ;;
19386         *)  dflt="$static_ext" 
19387                 ;;
19388         esac
19389
19390         case "$dflt" in
19391         '')     dflt=none;;
19392         esac
19393         rp="What extensions do you wish to load statically?"
19394         . ./myread
19395         case "$ans" in
19396         none) static_ext=' ' ;;
19397         *) static_ext="$ans" ;;
19398         esac
19399         ;;
19400 *)
19401         $cat <<EOM
19402 A number of extensions are supplied with $package.  Answer "none" 
19403 to include no extensions. 
19404 Note that DynaLoader is always built and need not be mentioned here.
19405
19406 EOM
19407         case "$static_ext" in
19408         '') dflt="$avail_ext" ;;
19409         *)      dflt="$static_ext"
19410                 # Perhaps we are reusing an old out-of-date config.sh.
19411                 case "$hint" in
19412                 previous)
19413                         if test X"$static_ext" != X"$avail_ext"; then
19414                                 $cat <<EOM
19415 NOTICE:  Your previous config.sh list may be incorrect. 
19416 The extensions now available to you are 
19417         ${avail_ext}
19418 but the default list from your previous config.sh is
19419         ${static_ext} 
19420
19421 EOM
19422                         fi
19423                         ;;
19424                 esac
19425                 ;;
19426         esac
19427         : Exclude those that are not xs extensions
19428         case "$dflt" in
19429         '')     dflt=none;;
19430         esac
19431         rp="What extensions do you wish to include?"
19432         . ./myread
19433         case "$ans" in
19434         none) static_ext=' ' ;;
19435         *) static_ext="$ans" ;;
19436         esac
19437         ;;
19438 esac
19439 #        
19440 # Encode is a special case.  If we are building Encode as a static
19441 # extension, we need to explicitly list its subextensions as well.
19442 # For other nested extensions, this is handled automatically by
19443 # the appropriate Makefile.PL.
19444 case " $static_ext " in
19445         *" Encode "*) # Add the subextensions of Encode
19446         cd "$rsrc/ext"
19447         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19448                 static_ext="$static_ext Encode/$xxx"
19449         done
19450         cd "$tdir"
19451         ;;
19452 esac
19453
19454 set X $dynamic_ext $static_ext $nonxs_ext
19455 shift
19456 extensions="$*"
19457
19458 : Remove libraries needed only for extensions
19459 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19460 : The exception is SunOS 4.x, which needs them.
19461 case "${osname}X${osvers}" in
19462 sunos*X4*)
19463     perllibs="$libs"
19464     ;;
19465 *) case "$usedl" in
19466     $define|true|[yY]*)
19467             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19468             shift
19469             perllibs="$*"
19470             ;;
19471     *)  perllibs="$libs"
19472             ;;
19473     esac
19474     ;;
19475 esac
19476
19477 : Remove build directory name from cppstdin so it can be used from
19478 : either the present location or the final installed location.
19479 echo " "
19480 : Get out of the UU directory to get correct path name.
19481 cd ..
19482 case "$cppstdin" in
19483 `pwd`/cppstdin)
19484         echo "Stripping down cppstdin path name"
19485         cppstdin=cppstdin
19486         ;;
19487 esac
19488 cd UU
19489
19490 : end of configuration questions
19491 echo " "
19492 echo "End of configuration questions."
19493 echo " "
19494
19495 : back to where it started
19496 if test -d ../UU; then
19497         cd ..
19498 fi
19499
19500 : configuration may be patched via a 'config.arch' file
19501 if $test -f config.arch; then
19502         echo "I see a config.arch file, loading it."
19503         . ./config.arch
19504 fi
19505
19506 : configuration may be patched via a 'config.over' file
19507 if $test -f config.over; then
19508         echo " "
19509         dflt=y
19510         rp='I see a config.over file.  Do you wish to load it?'
19511         . UU/myread
19512         case "$ans" in
19513         n*) echo "OK, I'll ignore it.";;
19514         *)      . ./config.over
19515                 echo "Configuration override changes have been loaded."
19516                 ;;
19517         esac
19518 fi
19519
19520 : in case they want portability, strip down executable paths
19521 case "$d_portable" in
19522 "$define")
19523         echo " "
19524         echo "Stripping down executable paths..." >&4
19525         for file in $loclist $trylist; do
19526                 eval temp=\$$file
19527                 eval $file=`basename $temp`
19528         done
19529         ;;
19530 esac
19531
19532 : create config.sh file
19533 echo " "
19534 echo "Creating config.sh..." >&4
19535 $spitshell <<EOT >config.sh
19536 $startsh
19537 #
19538 # This file was produced by running the Configure script. It holds all the
19539 # definitions figured out by Configure. Should you modify one of these values,
19540 # do not forget to propagate your changes by running "Configure -der". You may
19541 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19542 #
19543
19544 # Package name      : $package
19545 # Source directory  : $src
19546 # Configuration time: $cf_time
19547 # Configured by     : $cf_by
19548 # Target system     : $myuname
19549
19550 Author='$Author'
19551 Date='$Date'
19552 Header='$Header'
19553 Id='$Id'
19554 Locker='$Locker'
19555 Log='$Log'
19556 Mcc='$Mcc'
19557 RCSfile='$RCSfile'
19558 Revision='$Revision'
19559 Source='$Source'
19560 State='$State'
19561 _a='$_a'
19562 _exe='$_exe'
19563 _o='$_o'
19564 afs='$afs'
19565 afsroot='$afsroot'
19566 alignbytes='$alignbytes'
19567 ansi2knr='$ansi2knr'
19568 aphostname='$aphostname'
19569 api_revision='$api_revision'
19570 api_subversion='$api_subversion'
19571 api_version='$api_version'
19572 api_versionstring='$api_versionstring'
19573 ar='$ar'
19574 archlib='$archlib'
19575 archlibexp='$archlibexp'
19576 archname64='$archname64'
19577 archname='$archname'
19578 archobjs='$archobjs'
19579 asctime_r_proto='$asctime_r_proto'
19580 awk='$awk'
19581 baserev='$baserev'
19582 bash='$bash'
19583 bin='$bin'
19584 binexp='$binexp'
19585 bison='$bison'
19586 byacc='$byacc'
19587 byteorder='$byteorder'
19588 c='$c'
19589 castflags='$castflags'
19590 cat='$cat'
19591 cc='$cc'
19592 cccdlflags='$cccdlflags'
19593 ccdlflags='$ccdlflags'
19594 ccflags='$ccflags'
19595 ccflags_uselargefiles='$ccflags_uselargefiles'
19596 ccname='$ccname'
19597 ccsymbols='$ccsymbols'
19598 ccversion='$ccversion'
19599 cf_by='$cf_by'
19600 cf_email='$cf_email'
19601 cf_time='$cf_time'
19602 charsize='$charsize'
19603 chgrp='$chgrp'
19604 chmod='$chmod'
19605 chown='$chown'
19606 clocktype='$clocktype'
19607 comm='$comm'
19608 compress='$compress'
19609 contains='$contains'
19610 cp='$cp'
19611 cpio='$cpio'
19612 cpp='$cpp'
19613 cpp_stuff='$cpp_stuff'
19614 cppccsymbols='$cppccsymbols'
19615 cppflags='$cppflags'
19616 cpplast='$cpplast'
19617 cppminus='$cppminus'
19618 cpprun='$cpprun'
19619 cppstdin='$cppstdin'
19620 cppsymbols='$cppsymbols'
19621 crypt_r_proto='$crypt_r_proto'
19622 cryptlib='$cryptlib'
19623 csh='$csh'
19624 ctermid_r_proto='$ctermid_r_proto'
19625 ctime_r_proto='$ctime_r_proto'
19626 d_Gconvert='$d_Gconvert'
19627 d_PRIEUldbl='$d_PRIEUldbl'
19628 d_PRIFUldbl='$d_PRIFUldbl'
19629 d_PRIGUldbl='$d_PRIGUldbl'
19630 d_PRIXU64='$d_PRIXU64'
19631 d_PRId64='$d_PRId64'
19632 d_PRIeldbl='$d_PRIeldbl'
19633 d_PRIfldbl='$d_PRIfldbl'
19634 d_PRIgldbl='$d_PRIgldbl'
19635 d_PRIi64='$d_PRIi64'
19636 d_PRIo64='$d_PRIo64'
19637 d_PRIu64='$d_PRIu64'
19638 d_PRIx64='$d_PRIx64'
19639 d_SCNfldbl='$d_SCNfldbl'
19640 d__fwalk='$d__fwalk'
19641 d_access='$d_access'
19642 d_accessx='$d_accessx'
19643 d_alarm='$d_alarm'
19644 d_archlib='$d_archlib'
19645 d_asctime_r='$d_asctime_r'
19646 d_atolf='$d_atolf'
19647 d_atoll='$d_atoll'
19648 d_attribut='$d_attribut'
19649 d_bcmp='$d_bcmp'
19650 d_bcopy='$d_bcopy'
19651 d_bsd='$d_bsd'
19652 d_bsdgetpgrp='$d_bsdgetpgrp'
19653 d_bsdsetpgrp='$d_bsdsetpgrp'
19654 d_bzero='$d_bzero'
19655 d_casti32='$d_casti32'
19656 d_castneg='$d_castneg'
19657 d_charvspr='$d_charvspr'
19658 d_chown='$d_chown'
19659 d_chroot='$d_chroot'
19660 d_chsize='$d_chsize'
19661 d_class='$d_class'
19662 d_closedir='$d_closedir'
19663 d_cmsghdr_s='$d_cmsghdr_s'
19664 d_const='$d_const'
19665 d_crypt='$d_crypt'
19666 d_crypt_r='$d_crypt_r'
19667 d_csh='$d_csh'
19668 d_ctermid_r='$d_ctermid_r'
19669 d_ctime_r='$d_ctime_r'
19670 d_cuserid='$d_cuserid'
19671 d_dbl_dig='$d_dbl_dig'
19672 d_dbminitproto='$d_dbminitproto'
19673 d_difftime='$d_difftime'
19674 d_dirfd='$d_dirfd'
19675 d_dirnamlen='$d_dirnamlen'
19676 d_dlerror='$d_dlerror'
19677 d_dlopen='$d_dlopen'
19678 d_dlsymun='$d_dlsymun'
19679 d_dosuid='$d_dosuid'
19680 d_drand48_r='$d_drand48_r'
19681 d_drand48proto='$d_drand48proto'
19682 d_dup2='$d_dup2'
19683 d_eaccess='$d_eaccess'
19684 d_endgrent='$d_endgrent'
19685 d_endgrent_r='$d_endgrent_r'
19686 d_endhent='$d_endhent'
19687 d_endhostent_r='$d_endhostent_r'
19688 d_endnent='$d_endnent'
19689 d_endnetent_r='$d_endnetent_r'
19690 d_endpent='$d_endpent'
19691 d_endprotoent_r='$d_endprotoent_r'
19692 d_endpwent='$d_endpwent'
19693 d_endpwent_r='$d_endpwent_r'
19694 d_endsent='$d_endsent'
19695 d_endservent_r='$d_endservent_r'
19696 d_eofnblk='$d_eofnblk'
19697 d_eunice='$d_eunice'
19698 d_fchdir='$d_fchdir'
19699 d_fchmod='$d_fchmod'
19700 d_fchown='$d_fchown'
19701 d_fcntl='$d_fcntl'
19702 d_fcntl_can_lock='$d_fcntl_can_lock'
19703 d_fd_macros='$d_fd_macros'
19704 d_fd_set='$d_fd_set'
19705 d_fds_bits='$d_fds_bits'
19706 d_fgetpos='$d_fgetpos'
19707 d_finite='$d_finite'
19708 d_finitel='$d_finitel'
19709 d_flexfnam='$d_flexfnam'
19710 d_flock='$d_flock'
19711 d_flockproto='$d_flockproto'
19712 d_fork='$d_fork'
19713 d_fp_class='$d_fp_class'
19714 d_fpathconf='$d_fpathconf'
19715 d_fpclass='$d_fpclass'
19716 d_fpclassify='$d_fpclassify'
19717 d_fpclassl='$d_fpclassl'
19718 d_fpos64_t='$d_fpos64_t'
19719 d_frexpl='$d_frexpl'
19720 d_fs_data_s='$d_fs_data_s'
19721 d_fseeko='$d_fseeko'
19722 d_fsetpos='$d_fsetpos'
19723 d_fstatfs='$d_fstatfs'
19724 d_fstatvfs='$d_fstatvfs'
19725 d_fsync='$d_fsync'
19726 d_ftello='$d_ftello'
19727 d_ftime='$d_ftime'
19728 d_getcwd='$d_getcwd'
19729 d_getespwnam='$d_getespwnam'
19730 d_getfsstat='$d_getfsstat'
19731 d_getgrent='$d_getgrent'
19732 d_getgrent_r='$d_getgrent_r'
19733 d_getgrgid_r='$d_getgrgid_r'
19734 d_getgrnam_r='$d_getgrnam_r'
19735 d_getgrps='$d_getgrps'
19736 d_gethbyaddr='$d_gethbyaddr'
19737 d_gethbyname='$d_gethbyname'
19738 d_gethent='$d_gethent'
19739 d_gethname='$d_gethname'
19740 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19741 d_gethostbyname_r='$d_gethostbyname_r'
19742 d_gethostent_r='$d_gethostent_r'
19743 d_gethostprotos='$d_gethostprotos'
19744 d_getitimer='$d_getitimer'
19745 d_getlogin='$d_getlogin'
19746 d_getlogin_r='$d_getlogin_r'
19747 d_getmnt='$d_getmnt'
19748 d_getmntent='$d_getmntent'
19749 d_getnbyaddr='$d_getnbyaddr'
19750 d_getnbyname='$d_getnbyname'
19751 d_getnent='$d_getnent'
19752 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19753 d_getnetbyname_r='$d_getnetbyname_r'
19754 d_getnetent_r='$d_getnetent_r'
19755 d_getnetprotos='$d_getnetprotos'
19756 d_getpagsz='$d_getpagsz'
19757 d_getpbyname='$d_getpbyname'
19758 d_getpbynumber='$d_getpbynumber'
19759 d_getpent='$d_getpent'
19760 d_getpgid='$d_getpgid'
19761 d_getpgrp2='$d_getpgrp2'
19762 d_getpgrp='$d_getpgrp'
19763 d_getppid='$d_getppid'
19764 d_getprior='$d_getprior'
19765 d_getprotobyname_r='$d_getprotobyname_r'
19766 d_getprotobynumber_r='$d_getprotobynumber_r'
19767 d_getprotoent_r='$d_getprotoent_r'
19768 d_getprotoprotos='$d_getprotoprotos'
19769 d_getprpwnam='$d_getprpwnam'
19770 d_getpwent='$d_getpwent'
19771 d_getpwent_r='$d_getpwent_r'
19772 d_getpwnam_r='$d_getpwnam_r'
19773 d_getpwuid_r='$d_getpwuid_r'
19774 d_getsbyname='$d_getsbyname'
19775 d_getsbyport='$d_getsbyport'
19776 d_getsent='$d_getsent'
19777 d_getservbyname_r='$d_getservbyname_r'
19778 d_getservbyport_r='$d_getservbyport_r'
19779 d_getservent_r='$d_getservent_r'
19780 d_getservprotos='$d_getservprotos'
19781 d_getspnam='$d_getspnam'
19782 d_getspnam_r='$d_getspnam_r'
19783 d_gettimeod='$d_gettimeod'
19784 d_gmtime_r='$d_gmtime_r'
19785 d_gnulibc='$d_gnulibc'
19786 d_grpasswd='$d_grpasswd'
19787 d_hasmntopt='$d_hasmntopt'
19788 d_htonl='$d_htonl'
19789 d_index='$d_index'
19790 d_inetaton='$d_inetaton'
19791 d_int64_t='$d_int64_t'
19792 d_isascii='$d_isascii'
19793 d_isfinite='$d_isfinite'
19794 d_isinf='$d_isinf'
19795 d_isnan='$d_isnan'
19796 d_isnanl='$d_isnanl'
19797 d_killpg='$d_killpg'
19798 d_lchown='$d_lchown'
19799 d_ldbl_dig='$d_ldbl_dig'
19800 d_link='$d_link'
19801 d_localtime_r='$d_localtime_r'
19802 d_locconv='$d_locconv'
19803 d_lockf='$d_lockf'
19804 d_longdbl='$d_longdbl'
19805 d_longlong='$d_longlong'
19806 d_lseekproto='$d_lseekproto'
19807 d_lstat='$d_lstat'
19808 d_madvise='$d_madvise'
19809 d_mblen='$d_mblen'
19810 d_mbstowcs='$d_mbstowcs'
19811 d_mbtowc='$d_mbtowc'
19812 d_memchr='$d_memchr'
19813 d_memcmp='$d_memcmp'
19814 d_memcpy='$d_memcpy'
19815 d_memmove='$d_memmove'
19816 d_memset='$d_memset'
19817 d_mkdir='$d_mkdir'
19818 d_mkdtemp='$d_mkdtemp'
19819 d_mkfifo='$d_mkfifo'
19820 d_mkstemp='$d_mkstemp'
19821 d_mkstemps='$d_mkstemps'
19822 d_mktime='$d_mktime'
19823 d_mmap='$d_mmap'
19824 d_modfl='$d_modfl'
19825 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19826 d_mprotect='$d_mprotect'
19827 d_msg='$d_msg'
19828 d_msg_ctrunc='$d_msg_ctrunc'
19829 d_msg_dontroute='$d_msg_dontroute'
19830 d_msg_oob='$d_msg_oob'
19831 d_msg_peek='$d_msg_peek'
19832 d_msg_proxy='$d_msg_proxy'
19833 d_msgctl='$d_msgctl'
19834 d_msgget='$d_msgget'
19835 d_msghdr_s='$d_msghdr_s'
19836 d_msgrcv='$d_msgrcv'
19837 d_msgsnd='$d_msgsnd'
19838 d_msync='$d_msync'
19839 d_munmap='$d_munmap'
19840 d_mymalloc='$d_mymalloc'
19841 d_nice='$d_nice'
19842 d_nl_langinfo='$d_nl_langinfo'
19843 d_nv_preserves_uv='$d_nv_preserves_uv'
19844 d_off64_t='$d_off64_t'
19845 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19846 d_oldpthreads='$d_oldpthreads'
19847 d_oldsock='$d_oldsock'
19848 d_open3='$d_open3'
19849 d_pathconf='$d_pathconf'
19850 d_pause='$d_pause'
19851 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19852 d_phostname='$d_phostname'
19853 d_pipe='$d_pipe'
19854 d_poll='$d_poll'
19855 d_portable='$d_portable'
19856 d_procselfexe='$d_procselfexe'
19857 d_pthread_atfork='$d_pthread_atfork'
19858 d_pthread_yield='$d_pthread_yield'
19859 d_pwage='$d_pwage'
19860 d_pwchange='$d_pwchange'
19861 d_pwclass='$d_pwclass'
19862 d_pwcomment='$d_pwcomment'
19863 d_pwexpire='$d_pwexpire'
19864 d_pwgecos='$d_pwgecos'
19865 d_pwpasswd='$d_pwpasswd'
19866 d_pwquota='$d_pwquota'
19867 d_qgcvt='$d_qgcvt'
19868 d_quad='$d_quad'
19869 d_random_r='$d_random_r'
19870 d_readdir64_r='$d_readdir64_r'
19871 d_readdir='$d_readdir'
19872 d_readdir_r='$d_readdir_r'
19873 d_readlink='$d_readlink'
19874 d_readv='$d_readv'
19875 d_recvmsg='$d_recvmsg'
19876 d_rename='$d_rename'
19877 d_rewinddir='$d_rewinddir'
19878 d_rmdir='$d_rmdir'
19879 d_safebcpy='$d_safebcpy'
19880 d_safemcpy='$d_safemcpy'
19881 d_sanemcmp='$d_sanemcmp'
19882 d_sbrkproto='$d_sbrkproto'
19883 d_sched_yield='$d_sched_yield'
19884 d_scm_rights='$d_scm_rights'
19885 d_seekdir='$d_seekdir'
19886 d_select='$d_select'
19887 d_sem='$d_sem'
19888 d_semctl='$d_semctl'
19889 d_semctl_semid_ds='$d_semctl_semid_ds'
19890 d_semctl_semun='$d_semctl_semun'
19891 d_semget='$d_semget'
19892 d_semop='$d_semop'
19893 d_sendmsg='$d_sendmsg'
19894 d_setegid='$d_setegid'
19895 d_seteuid='$d_seteuid'
19896 d_setgrent='$d_setgrent'
19897 d_setgrent_r='$d_setgrent_r'
19898 d_setgrps='$d_setgrps'
19899 d_sethent='$d_sethent'
19900 d_sethostent_r='$d_sethostent_r'
19901 d_setitimer='$d_setitimer'
19902 d_setlinebuf='$d_setlinebuf'
19903 d_setlocale='$d_setlocale'
19904 d_setlocale_r='$d_setlocale_r'
19905 d_setnent='$d_setnent'
19906 d_setnetent_r='$d_setnetent_r'
19907 d_setpent='$d_setpent'
19908 d_setpgid='$d_setpgid'
19909 d_setpgrp2='$d_setpgrp2'
19910 d_setpgrp='$d_setpgrp'
19911 d_setprior='$d_setprior'
19912 d_setproctitle='$d_setproctitle'
19913 d_setprotoent_r='$d_setprotoent_r'
19914 d_setpwent='$d_setpwent'
19915 d_setpwent_r='$d_setpwent_r'
19916 d_setregid='$d_setregid'
19917 d_setresgid='$d_setresgid'
19918 d_setresuid='$d_setresuid'
19919 d_setreuid='$d_setreuid'
19920 d_setrgid='$d_setrgid'
19921 d_setruid='$d_setruid'
19922 d_setsent='$d_setsent'
19923 d_setservent_r='$d_setservent_r'
19924 d_setsid='$d_setsid'
19925 d_setvbuf='$d_setvbuf'
19926 d_sfio='$d_sfio'
19927 d_shm='$d_shm'
19928 d_shmat='$d_shmat'
19929 d_shmatprototype='$d_shmatprototype'
19930 d_shmctl='$d_shmctl'
19931 d_shmdt='$d_shmdt'
19932 d_shmget='$d_shmget'
19933 d_sigaction='$d_sigaction'
19934 d_sigprocmask='$d_sigprocmask'
19935 d_sigsetjmp='$d_sigsetjmp'
19936 d_sockatmark='$d_sockatmark'
19937 d_sockatmarkproto='$d_sockatmarkproto'
19938 d_socket='$d_socket'
19939 d_socklen_t='$d_socklen_t'
19940 d_sockpair='$d_sockpair'
19941 d_socks5_init='$d_socks5_init'
19942 d_sqrtl='$d_sqrtl'
19943 d_srand48_r='$d_srand48_r'
19944 d_srandom_r='$d_srandom_r'
19945 d_sresgproto='$d_sresgproto'
19946 d_sresuproto='$d_sresuproto'
19947 d_statblks='$d_statblks'
19948 d_statfs_f_flags='$d_statfs_f_flags'
19949 d_statfs_s='$d_statfs_s'
19950 d_statvfs='$d_statvfs'
19951 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19952 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19953 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19954 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19955 d_stdio_stream_array='$d_stdio_stream_array'
19956 d_stdiobase='$d_stdiobase'
19957 d_stdstdio='$d_stdstdio'
19958 d_strchr='$d_strchr'
19959 d_strcoll='$d_strcoll'
19960 d_strctcpy='$d_strctcpy'
19961 d_strerrm='$d_strerrm'
19962 d_strerror='$d_strerror'
19963 d_strerror_r='$d_strerror_r'
19964 d_strftime='$d_strftime'
19965 d_strtod='$d_strtod'
19966 d_strtol='$d_strtol'
19967 d_strtold='$d_strtold'
19968 d_strtoll='$d_strtoll'
19969 d_strtoq='$d_strtoq'
19970 d_strtoul='$d_strtoul'
19971 d_strtoull='$d_strtoull'
19972 d_strtouq='$d_strtouq'
19973 d_strxfrm='$d_strxfrm'
19974 d_suidsafe='$d_suidsafe'
19975 d_symlink='$d_symlink'
19976 d_syscall='$d_syscall'
19977 d_syscallproto='$d_syscallproto'
19978 d_sysconf='$d_sysconf'
19979 d_sysernlst='$d_sysernlst'
19980 d_syserrlst='$d_syserrlst'
19981 d_system='$d_system'
19982 d_tcgetpgrp='$d_tcgetpgrp'
19983 d_tcsetpgrp='$d_tcsetpgrp'
19984 d_telldir='$d_telldir'
19985 d_telldirproto='$d_telldirproto'
19986 d_time='$d_time'
19987 d_times='$d_times'
19988 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19989 d_tm_tm_zone='$d_tm_tm_zone'
19990 d_tmpnam_r='$d_tmpnam_r'
19991 d_truncate='$d_truncate'
19992 d_ttyname_r='$d_ttyname_r'
19993 d_tzname='$d_tzname'
19994 d_u32align='$d_u32align'
19995 d_ualarm='$d_ualarm'
19996 d_umask='$d_umask'
19997 d_uname='$d_uname'
19998 d_union_semun='$d_union_semun'
19999 d_unordered='$d_unordered'
20000 d_usleep='$d_usleep'
20001 d_usleepproto='$d_usleepproto'
20002 d_ustat='$d_ustat'
20003 d_vendorarch='$d_vendorarch'
20004 d_vendorbin='$d_vendorbin'
20005 d_vendorlib='$d_vendorlib'
20006 d_vfork='$d_vfork'
20007 d_void_closedir='$d_void_closedir'
20008 d_voidsig='$d_voidsig'
20009 d_voidtty='$d_voidtty'
20010 d_volatile='$d_volatile'
20011 d_vprintf='$d_vprintf'
20012 d_wait4='$d_wait4'
20013 d_waitpid='$d_waitpid'
20014 d_wcstombs='$d_wcstombs'
20015 d_wctomb='$d_wctomb'
20016 d_writev='$d_writev'
20017 d_xenix='$d_xenix'
20018 date='$date'
20019 db_hashtype='$db_hashtype'
20020 db_prefixtype='$db_prefixtype'
20021 db_version_major='$db_version_major'
20022 db_version_minor='$db_version_minor'
20023 db_version_patch='$db_version_patch'
20024 defvoidused='$defvoidused'
20025 direntrytype='$direntrytype'
20026 dlext='$dlext'
20027 dlsrc='$dlsrc'
20028 doublesize='$doublesize'
20029 drand01='$drand01'
20030 drand48_r_proto='$drand48_r_proto'
20031 dynamic_ext='$dynamic_ext'
20032 eagain='$eagain'
20033 ebcdic='$ebcdic'
20034 echo='$echo'
20035 egrep='$egrep'
20036 emacs='$emacs'
20037 endgrent_r_proto='$endgrent_r_proto'
20038 endhostent_r_proto='$endhostent_r_proto'
20039 endnetent_r_proto='$endnetent_r_proto'
20040 endprotoent_r_proto='$endprotoent_r_proto'
20041 endpwent_r_proto='$endpwent_r_proto'
20042 endservent_r_proto='$endservent_r_proto'
20043 eunicefix='$eunicefix'
20044 exe_ext='$exe_ext'
20045 expr='$expr'
20046 extensions='$extensions'
20047 extras='$extras'
20048 fflushNULL='$fflushNULL'
20049 fflushall='$fflushall'
20050 find='$find'
20051 firstmakefile='$firstmakefile'
20052 flex='$flex'
20053 fpossize='$fpossize'
20054 fpostype='$fpostype'
20055 freetype='$freetype'
20056 from='$from'
20057 full_ar='$full_ar'
20058 full_csh='$full_csh'
20059 full_sed='$full_sed'
20060 gccosandvers='$gccosandvers'
20061 gccversion='$gccversion'
20062 getgrent_r_proto='$getgrent_r_proto'
20063 getgrgid_r_proto='$getgrgid_r_proto'
20064 getgrnam_r_proto='$getgrnam_r_proto'
20065 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20066 gethostbyname_r_proto='$gethostbyname_r_proto'
20067 gethostent_r_proto='$gethostent_r_proto'
20068 getlogin_r_proto='$getlogin_r_proto'
20069 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20070 getnetbyname_r_proto='$getnetbyname_r_proto'
20071 getnetent_r_proto='$getnetent_r_proto'
20072 getprotobyname_r_proto='$getprotobyname_r_proto'
20073 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20074 getprotoent_r_proto='$getprotoent_r_proto'
20075 getpwent_r_proto='$getpwent_r_proto'
20076 getpwnam_r_proto='$getpwnam_r_proto'
20077 getpwuid_r_proto='$getpwuid_r_proto'
20078 getservbyname_r_proto='$getservbyname_r_proto'
20079 getservbyport_r_proto='$getservbyport_r_proto'
20080 getservent_r_proto='$getservent_r_proto'
20081 getspnam_r_proto='$getspnam_r_proto'
20082 gidformat='$gidformat'
20083 gidsign='$gidsign'
20084 gidsize='$gidsize'
20085 gidtype='$gidtype'
20086 glibpth='$glibpth'
20087 gmake='$gmake'
20088 gmtime_r_proto='$gmtime_r_proto'
20089 grep='$grep'
20090 groupcat='$groupcat'
20091 groupstype='$groupstype'
20092 gzip='$gzip'
20093 h_fcntl='$h_fcntl'
20094 h_sysfile='$h_sysfile'
20095 hint='$hint'
20096 hostcat='$hostcat'
20097 i16size='$i16size'
20098 i16type='$i16type'
20099 i32size='$i32size'
20100 i32type='$i32type'
20101 i64size='$i64size'
20102 i64type='$i64type'
20103 i8size='$i8size'
20104 i8type='$i8type'
20105 i_arpainet='$i_arpainet'
20106 i_bsdioctl='$i_bsdioctl'
20107 i_crypt='$i_crypt'
20108 i_db='$i_db'
20109 i_dbm='$i_dbm'
20110 i_dirent='$i_dirent'
20111 i_dld='$i_dld'
20112 i_dlfcn='$i_dlfcn'
20113 i_fcntl='$i_fcntl'
20114 i_float='$i_float'
20115 i_fp='$i_fp'
20116 i_fp_class='$i_fp_class'
20117 i_gdbm='$i_gdbm'
20118 i_grp='$i_grp'
20119 i_ieeefp='$i_ieeefp'
20120 i_inttypes='$i_inttypes'
20121 i_langinfo='$i_langinfo'
20122 i_libutil='$i_libutil'
20123 i_limits='$i_limits'
20124 i_locale='$i_locale'
20125 i_machcthr='$i_machcthr'
20126 i_malloc='$i_malloc'
20127 i_math='$i_math'
20128 i_memory='$i_memory'
20129 i_mntent='$i_mntent'
20130 i_ndbm='$i_ndbm'
20131 i_netdb='$i_netdb'
20132 i_neterrno='$i_neterrno'
20133 i_netinettcp='$i_netinettcp'
20134 i_niin='$i_niin'
20135 i_poll='$i_poll'
20136 i_prot='$i_prot'
20137 i_pthread='$i_pthread'
20138 i_pwd='$i_pwd'
20139 i_rpcsvcdbm='$i_rpcsvcdbm'
20140 i_sfio='$i_sfio'
20141 i_sgtty='$i_sgtty'
20142 i_shadow='$i_shadow'
20143 i_socks='$i_socks'
20144 i_stdarg='$i_stdarg'
20145 i_stddef='$i_stddef'
20146 i_stdlib='$i_stdlib'
20147 i_string='$i_string'
20148 i_sunmath='$i_sunmath'
20149 i_sysaccess='$i_sysaccess'
20150 i_sysdir='$i_sysdir'
20151 i_sysfile='$i_sysfile'
20152 i_sysfilio='$i_sysfilio'
20153 i_sysin='$i_sysin'
20154 i_sysioctl='$i_sysioctl'
20155 i_syslog='$i_syslog'
20156 i_sysmman='$i_sysmman'
20157 i_sysmode='$i_sysmode'
20158 i_sysmount='$i_sysmount'
20159 i_sysndir='$i_sysndir'
20160 i_sysparam='$i_sysparam'
20161 i_sysresrc='$i_sysresrc'
20162 i_syssecrt='$i_syssecrt'
20163 i_sysselct='$i_sysselct'
20164 i_syssockio='$i_syssockio'
20165 i_sysstat='$i_sysstat'
20166 i_sysstatfs='$i_sysstatfs'
20167 i_sysstatvfs='$i_sysstatvfs'
20168 i_systime='$i_systime'
20169 i_systimek='$i_systimek'
20170 i_systimes='$i_systimes'
20171 i_systypes='$i_systypes'
20172 i_sysuio='$i_sysuio'
20173 i_sysun='$i_sysun'
20174 i_sysutsname='$i_sysutsname'
20175 i_sysvfs='$i_sysvfs'
20176 i_syswait='$i_syswait'
20177 i_termio='$i_termio'
20178 i_termios='$i_termios'
20179 i_time='$i_time'
20180 i_unistd='$i_unistd'
20181 i_ustat='$i_ustat'
20182 i_utime='$i_utime'
20183 i_values='$i_values'
20184 i_varargs='$i_varargs'
20185 i_varhdr='$i_varhdr'
20186 i_vfork='$i_vfork'
20187 ignore_versioned_solibs='$ignore_versioned_solibs'
20188 inc_version_list='$inc_version_list'
20189 inc_version_list_init='$inc_version_list_init'
20190 incpath='$incpath'
20191 inews='$inews'
20192 installarchlib='$installarchlib'
20193 installbin='$installbin'
20194 installman1dir='$installman1dir'
20195 installman3dir='$installman3dir'
20196 installprefix='$installprefix'
20197 installprefixexp='$installprefixexp'
20198 installprivlib='$installprivlib'
20199 installscript='$installscript'
20200 installsitearch='$installsitearch'
20201 installsitebin='$installsitebin'
20202 installsitelib='$installsitelib'
20203 installstyle='$installstyle'
20204 installusrbinperl='$installusrbinperl'
20205 installvendorarch='$installvendorarch'
20206 installvendorbin='$installvendorbin'
20207 installvendorlib='$installvendorlib'
20208 intsize='$intsize'
20209 issymlink='$issymlink'
20210 ivdformat='$ivdformat'
20211 ivsize='$ivsize'
20212 ivtype='$ivtype'
20213 known_extensions='$known_extensions'
20214 ksh='$ksh'
20215 ld='$ld'
20216 lddlflags='$lddlflags'
20217 ldflags='$ldflags'
20218 ldflags_uselargefiles='$ldflags_uselargefiles'
20219 ldlibpthname='$ldlibpthname'
20220 less='$less'
20221 lib_ext='$lib_ext'
20222 libc='$libc'
20223 libperl='$libperl'
20224 libpth='$libpth'
20225 libs='$libs'
20226 libsdirs='$libsdirs'
20227 libsfiles='$libsfiles'
20228 libsfound='$libsfound'
20229 libspath='$libspath'
20230 libswanted='$libswanted'
20231 libswanted_uselargefiles='$libswanted_uselargefiles'
20232 line='$line'
20233 lint='$lint'
20234 lkflags='$lkflags'
20235 ln='$ln'
20236 lns='$lns'
20237 localtime_r_proto='$localtime_r_proto'
20238 locincpth='$locincpth'
20239 loclibpth='$loclibpth'
20240 longdblsize='$longdblsize'
20241 longlongsize='$longlongsize'
20242 longsize='$longsize'
20243 lp='$lp'
20244 lpr='$lpr'
20245 ls='$ls'
20246 lseeksize='$lseeksize'
20247 lseektype='$lseektype'
20248 mail='$mail'
20249 mailx='$mailx'
20250 make='$make'
20251 make_set_make='$make_set_make'
20252 mallocobj='$mallocobj'
20253 mallocsrc='$mallocsrc'
20254 malloctype='$malloctype'
20255 man1dir='$man1dir'
20256 man1direxp='$man1direxp'
20257 man1ext='$man1ext'
20258 man3dir='$man3dir'
20259 man3direxp='$man3direxp'
20260 man3ext='$man3ext'
20261 mips_type='$mips_type'
20262 mkdir='$mkdir'
20263 mmaptype='$mmaptype'
20264 modetype='$modetype'
20265 more='$more'
20266 multiarch='$multiarch'
20267 mv='$mv'
20268 myarchname='$myarchname'
20269 mydomain='$mydomain'
20270 myhostname='$myhostname'
20271 myuname='$myuname'
20272 n='$n'
20273 need_va_copy='$need_va_copy'
20274 netdb_hlen_type='$netdb_hlen_type'
20275 netdb_host_type='$netdb_host_type'
20276 netdb_name_type='$netdb_name_type'
20277 netdb_net_type='$netdb_net_type'
20278 nm='$nm'
20279 nm_opt='$nm_opt'
20280 nm_so_opt='$nm_so_opt'
20281 nonxs_ext='$nonxs_ext'
20282 nroff='$nroff'
20283 nvEUformat='$nvEUformat'
20284 nvFUformat='$nvFUformat'
20285 nvGUformat='$nvGUformat'
20286 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20287 nveformat='$nveformat'
20288 nvfformat='$nvfformat'
20289 nvgformat='$nvgformat'
20290 nvsize='$nvsize'
20291 nvtype='$nvtype'
20292 o_nonblock='$o_nonblock'
20293 obj_ext='$obj_ext'
20294 old_pthread_create_joinable='$old_pthread_create_joinable'
20295 optimize='$optimize'
20296 orderlib='$orderlib'
20297 osname='$osname'
20298 osvers='$osvers'
20299 otherlibdirs='$otherlibdirs'
20300 package='$package'
20301 pager='$pager'
20302 passcat='$passcat'
20303 patchlevel='$patchlevel'
20304 path_sep='$path_sep'
20305 perl5='$perl5'
20306 perl='$perl'
20307 perl_patchlevel='$perl_patchlevel'
20308 perladmin='$perladmin'
20309 perllibs='$perllibs'
20310 perlpath='$perlpath'
20311 pg='$pg'
20312 phostname='$phostname'
20313 pidtype='$pidtype'
20314 plibpth='$plibpth'
20315 pm_apiversion='$pm_apiversion'
20316 pmake='$pmake'
20317 pr='$pr'
20318 prefix='$prefix'
20319 prefixexp='$prefixexp'
20320 privlib='$privlib'
20321 privlibexp='$privlibexp'
20322 procselfexe='$procselfexe'
20323 prototype='$prototype'
20324 ptrsize='$ptrsize'
20325 quadkind='$quadkind'
20326 quadtype='$quadtype'
20327 randbits='$randbits'
20328 randfunc='$randfunc'
20329 random_r_proto='$random_r_proto'
20330 randseedtype='$randseedtype'
20331 ranlib='$ranlib'
20332 rd_nodata='$rd_nodata'
20333 readdir64_r_proto='$readdir64_r_proto'
20334 readdir_r_proto='$readdir_r_proto'
20335 revision='$revision'
20336 rm='$rm'
20337 rmail='$rmail'
20338 run='$run'
20339 runnm='$runnm'
20340 sPRIEUldbl='$sPRIEUldbl'
20341 sPRIFUldbl='$sPRIFUldbl'
20342 sPRIGUldbl='$sPRIGUldbl'
20343 sPRIXU64='$sPRIXU64'
20344 sPRId64='$sPRId64'
20345 sPRIeldbl='$sPRIeldbl'
20346 sPRIfldbl='$sPRIfldbl'
20347 sPRIgldbl='$sPRIgldbl'
20348 sPRIi64='$sPRIi64'
20349 sPRIo64='$sPRIo64'
20350 sPRIu64='$sPRIu64'
20351 sPRIx64='$sPRIx64'
20352 sSCNfldbl='$sSCNfldbl'
20353 sched_yield='$sched_yield'
20354 scriptdir='$scriptdir'
20355 scriptdirexp='$scriptdirexp'
20356 sed='$sed'
20357 seedfunc='$seedfunc'
20358 selectminbits='$selectminbits'
20359 selecttype='$selecttype'
20360 sendmail='$sendmail'
20361 setgrent_r_proto='$setgrent_r_proto'
20362 sethostent_r_proto='$sethostent_r_proto'
20363 setlocale_r_proto='$setlocale_r_proto'
20364 setnetent_r_proto='$setnetent_r_proto'
20365 setprotoent_r_proto='$setprotoent_r_proto'
20366 setpwent_r_proto='$setpwent_r_proto'
20367 setservent_r_proto='$setservent_r_proto'
20368 sh='$sh'
20369 shar='$shar'
20370 sharpbang='$sharpbang'
20371 shmattype='$shmattype'
20372 shortsize='$shortsize'
20373 shrpenv='$shrpenv'
20374 shsharp='$shsharp'
20375 sig_count='$sig_count'
20376 sig_name='$sig_name'
20377 sig_name_init='$sig_name_init'
20378 sig_num='$sig_num'
20379 sig_num_init='$sig_num_init'
20380 sig_size='$sig_size'
20381 signal_t='$signal_t'
20382 sitearch='$sitearch'
20383 sitearchexp='$sitearchexp'
20384 sitebin='$sitebin'
20385 sitebinexp='$sitebinexp'
20386 sitelib='$sitelib'
20387 sitelib_stem='$sitelib_stem'
20388 sitelibexp='$sitelibexp'
20389 siteprefix='$siteprefix'
20390 siteprefixexp='$siteprefixexp'
20391 sizesize='$sizesize'
20392 sizetype='$sizetype'
20393 sleep='$sleep'
20394 smail='$smail'
20395 so='$so'
20396 sockethdr='$sockethdr'
20397 socketlib='$socketlib'
20398 socksizetype='$socksizetype'
20399 sort='$sort'
20400 spackage='$spackage'
20401 spitshell='$spitshell'
20402 srand48_r_proto='$srand48_r_proto'
20403 srandom_r_proto='$srandom_r_proto'
20404 src='$src'
20405 ssizetype='$ssizetype'
20406 startperl='$startperl'
20407 startsh='$startsh'
20408 static_ext='$static_ext'
20409 stdchar='$stdchar'
20410 stdio_base='$stdio_base'
20411 stdio_bufsiz='$stdio_bufsiz'
20412 stdio_cnt='$stdio_cnt'
20413 stdio_filbuf='$stdio_filbuf'
20414 stdio_ptr='$stdio_ptr'
20415 stdio_stream_array='$stdio_stream_array'
20416 strerror_r_proto='$strerror_r_proto'
20417 strings='$strings'
20418 submit='$submit'
20419 subversion='$subversion'
20420 sysman='$sysman'
20421 tail='$tail'
20422 tar='$tar'
20423 targetarch='$targetarch'
20424 tbl='$tbl'
20425 tee='$tee'
20426 test='$test'
20427 timeincl='$timeincl'
20428 timetype='$timetype'
20429 tmpnam_r_proto='$tmpnam_r_proto'
20430 to='$to'
20431 touch='$touch'
20432 tr='$tr'
20433 trnl='$trnl'
20434 troff='$troff'
20435 ttyname_r_proto='$ttyname_r_proto'
20436 u16size='$u16size'
20437 u16type='$u16type'
20438 u32size='$u32size'
20439 u32type='$u32type'
20440 u64size='$u64size'
20441 u64type='$u64type'
20442 u8size='$u8size'
20443 u8type='$u8type'
20444 uidformat='$uidformat'
20445 uidsign='$uidsign'
20446 uidsize='$uidsize'
20447 uidtype='$uidtype'
20448 uname='$uname'
20449 uniq='$uniq'
20450 uquadtype='$uquadtype'
20451 use5005threads='$use5005threads'
20452 use64bitall='$use64bitall'
20453 use64bitint='$use64bitint'
20454 usecrosscompile='$usecrosscompile'
20455 usedl='$usedl'
20456 useithreads='$useithreads'
20457 uselargefiles='$uselargefiles'
20458 uselongdouble='$uselongdouble'
20459 usemorebits='$usemorebits'
20460 usemultiplicity='$usemultiplicity'
20461 usemymalloc='$usemymalloc'
20462 usenm='$usenm'
20463 useopcode='$useopcode'
20464 useperlio='$useperlio'
20465 useposix='$useposix'
20466 usereentrant='$usereentrant'
20467 usesfio='$usesfio'
20468 useshrplib='$useshrplib'
20469 usesocks='$usesocks'
20470 usethreads='$usethreads'
20471 usevendorprefix='$usevendorprefix'
20472 usevfork='$usevfork'
20473 usrinc='$usrinc'
20474 uuname='$uuname'
20475 uvXUformat='$uvXUformat'
20476 uvoformat='$uvoformat'
20477 uvsize='$uvsize'
20478 uvtype='$uvtype'
20479 uvuformat='$uvuformat'
20480 uvxformat='$uvxformat'
20481 vendorarch='$vendorarch'
20482 vendorarchexp='$vendorarchexp'
20483 vendorbin='$vendorbin'
20484 vendorbinexp='$vendorbinexp'
20485 vendorlib='$vendorlib'
20486 vendorlib_stem='$vendorlib_stem'
20487 vendorlibexp='$vendorlibexp'
20488 vendorprefix='$vendorprefix'
20489 vendorprefixexp='$vendorprefixexp'
20490 version='$version'
20491 version_patchlevel_string='$version_patchlevel_string'
20492 versiononly='$versiononly'
20493 vi='$vi'
20494 voidflags='$voidflags'
20495 xlibpth='$xlibpth'
20496 xs_apiversion='$xs_apiversion'
20497 yacc='$yacc'
20498 yaccflags='$yaccflags'
20499 zcat='$zcat'
20500 zip='$zip'
20501 EOT
20502
20503 : Add in command line options if available
20504 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20505
20506 : add special variables
20507 $test -f $src/patchlevel.h && \
20508 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20509 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20510 echo "PERL_CONFIG_SH=true" >>config.sh
20511
20512 : propagate old symbols
20513 if $test -f UU/config.sh; then
20514         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20515         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20516         $sort | $uniq -u >UU/oldsyms
20517         set X `cat UU/oldsyms`
20518         shift
20519         case $# in
20520         0) ;;
20521         *)
20522                 cat <<EOM
20523 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20524 EOM
20525                 echo "# Variables propagated from previous config.sh file." >>config.sh
20526                 for sym in `cat UU/oldsyms`; do
20527                         echo "    Propagating $hint variable "'$'"$sym..."
20528                         eval 'tmp="$'"${sym}"'"'
20529                         echo "$tmp" | \
20530                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20531                 done
20532                 ;;
20533         esac
20534 fi
20535
20536 : Finish up by extracting the .SH files
20537 case "$alldone" in
20538 exit)
20539         $rm -rf UU
20540         echo "Extraction done."
20541         exit 0
20542         ;;
20543 cont)
20544         ;;
20545 '')
20546         dflt=''
20547         nostick=true
20548         $cat <<EOM
20549
20550 If you'd like to make any changes to the config.sh file before I begin
20551 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20552
20553 EOM
20554         rp="Press return or use a shell escape to edit config.sh:"
20555         . UU/myread
20556         nostick=''
20557         case "$ans" in
20558         '') ;;
20559         *) : in case they cannot read
20560                 sh 1>&4 -c "$ans";;
20561         esac
20562         ;;
20563 esac
20564
20565 : if this fails, just run all the .SH files by hand
20566 . ./config.sh
20567
20568 echo " "
20569 exec 1>&4
20570 pwd=`pwd`
20571 . ./UU/extract
20572 cd "$pwd"
20573
20574 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20575         dflt=y
20576         case "$silent" in
20577         true) ;;
20578         *)
20579                 $cat <<EOM
20580
20581 Now you need to generate make dependencies by running "$make depend".
20582 You might prefer to run it in background: "$make depend > makedepend.out &"
20583 It can take a while, so you might not want to run it right now.
20584
20585 EOM
20586                 ;;
20587         esac
20588         rp="Run $make depend now?"
20589         . UU/myread
20590         case "$ans" in
20591         y*)
20592                 $make depend && echo "Now you must run '$make'."
20593                 ;;
20594         *)
20595                 echo "You must run '$make depend' then '$make'."
20596                 ;;
20597         esac
20598 elif test -f [Mm]akefile; then
20599         echo " "
20600         echo "Now you must run a $make."
20601 else
20602         echo "Configure done."
20603 fi
20604
20605 if $test -f Policy.sh; then
20606     $cat <<EOM
20607
20608 If you compile $package on a different machine or from a different object
20609 directory, copy the Policy.sh file from this object directory to the
20610 new one before you run Configure -- this will help you with most of
20611 the policy defaults.
20612
20613 EOM
20614 fi
20615 if $test -f config.msg; then
20616     echo "Hmm.  I also noted the following information while running:"
20617     echo " "
20618     $cat config.msg >&4
20619     $rm -f config.msg
20620 fi
20621 $rm -f kit*isdone ark*isdone
20622 $rm -rf UU
20623
20624 : End of Configure
20625